pentabug/firmware/lib/apps.h

30 lines
647 B
C
Raw Normal View History

2012-10-11 18:59:09 +02:00
#ifndef APPS_H
#define APPS_H
#include <inttypes.h>
2012-10-12 11:52:49 +02:00
/*
* REGISTER makro exploits special avr-libc startup code voodo.
* This could be understood by reading
* http://www.nongnu.org/avr-libc/user-manual/mem_sections.html
*
* */
2012-10-11 18:59:09 +02:00
#define MAX_FUNS 16
#define REGISTER(fun) static void init(void) __attribute__ ((naked, used, section (".init8"))); \
void init(void) { \
mode_funs[mode_num] = fun; \
++mode_num; \
} \
typedef void (*mode_fun)(void);
extern mode_fun mode_funs[MAX_FUNS];
extern uint8_t mode_num;
extern uint8_t mode_uninitialized;
extern uint8_t mode_last_tick;
#endif /* APPS_H */