2011-08-03 14:50:25 +00:00
|
|
|
#ifndef __BASICIDLE_H_
|
|
|
|
#define __BASICIDLE_H_
|
|
|
|
|
2011-07-24 13:44:35 +00:00
|
|
|
#define MAXQENTRIES 8
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
void (*callback)(void);
|
|
|
|
} QENTRY;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int qstart;
|
|
|
|
int qend;
|
|
|
|
QENTRY queue[MAXQENTRIES];
|
|
|
|
} QUEUE;
|
|
|
|
|
|
|
|
extern QUEUE the_queue;
|
|
|
|
extern volatile uint32_t _timectr;
|
|
|
|
|
|
|
|
void work_queue(void);
|
2011-08-03 14:50:25 +00:00
|
|
|
void delayms_queue(uint32_t);
|
|
|
|
void delayms_power(uint32_t);
|
2011-07-24 20:25:35 +00:00
|
|
|
int push_queue(void (*qnew)(void));
|
|
|
|
int magic(void *qnew);
|
2011-07-24 13:44:35 +00:00
|
|
|
|
2011-07-29 17:06:23 +00:00
|
|
|
// Note:
|
|
|
|
// Our time implementation will fail after 497 days of continous uptime.
|
|
|
|
// ( 2^32 / 1000 * SYSTICKSPEED ) seconds
|
|
|
|
|
|
|
|
#define incTimer(void) do{_timectr++;}while(0);
|
|
|
|
#define getTimer() (_timectr)
|
2011-07-24 13:44:35 +00:00
|
|
|
|
2011-08-03 14:50:25 +00:00
|
|
|
#endif
|