Eurobot2012_Primary
Dependencies: mbed Eurobot_2012_Primary
Diff: system.h
- Revision:
- 1:bbabbd997d21
- Parent:
- 0:f3bf6c7e2283
--- a/system.h Fri Apr 20 20:39:35 2012 +0000 +++ b/system.h Fri Apr 20 21:56:15 2012 +0000 @@ -3,28 +3,16 @@ #define SYSTEM_H #include "globals.h" - -//#include "rtos.h" +#include "rtos.h" -// rectifies angle to range -PI to PI -template <typename T> -T rectifyAng (T ang_in) { - ang_in -= (floor(ang_in/(2*PI)))*2*PI; - if (ang_in < -PI) { - ang_in += 2*PI; - } - if (ang_in > PI) { - ang_in -= 2*PI; - } +//a type which is a pointer to a rtos thread function +typedef void (*tfuncptr_t)(void const *argument); - return ang_in; -} - +//--------------------- +//Signal ticker stuff #define SIGTICKARGS(thread, signal) \ (tfuncptr_t) (&Signalsetter::callback), osTimerPeriodic, (void*)(new Signalsetter(thread, signal)) -typedef void (*tfuncptr_t)(void const *argument); - class Signalsetter { public: Signalsetter(Thread& inthread, int insignal) : @@ -46,4 +34,9 @@ int signal; }; +//--------------------- +//cpu usage measurement function +extern float cpupercent; +void measureCPUidle (void const* arg); + #endif