Eurobot2012_Primary
Dependencies: mbed Eurobot_2012_Primary
Diff: system.h
- Revision:
- 2:cffa347bb943
- Parent:
- 1:bbabbd997d21
- Child:
- 3:429829612cf9
--- a/system.h Fri Apr 20 21:56:15 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ - -#ifndef SYSTEM_H -#define SYSTEM_H - -#include "globals.h" -#include "rtos.h" - -//a type which is a pointer to a rtos thread function -typedef void (*tfuncptr_t)(void const *argument); - -//--------------------- -//Signal ticker stuff -#define SIGTICKARGS(thread, signal) \ - (tfuncptr_t) (&Signalsetter::callback), osTimerPeriodic, (void*)(new Signalsetter(thread, signal)) - -class Signalsetter { -public: - Signalsetter(Thread& inthread, int insignal) : - thread(inthread) { - signal = insignal; - //pc.printf("ptr saved as %#x \r\n", (int)(&(inthread))); - } - - static void callback(void* thisin) { - - Signalsetter* fthis = (Signalsetter*)thisin; - //pc.printf("callback will signal thread object at %#x \r\n", (int)(&(fthis->thread))); - fthis->thread.signal_set(fthis->signal); - //delete fthis; //this is useful for single fire tickers! - } - -private: - Thread& thread; - int signal; -}; - -//--------------------- -//cpu usage measurement function -extern float cpupercent; -void measureCPUidle (void const* arg); - -#endif