main.h 592 B

1234567891011121314151617181920212223242526272829
  1. #include <avr/interrupt.h>
  2. #define MAX_SENSOR_NUM 1
  3. #define KEY_ESC 128
  4. #define KEY_UP 32
  5. #define KEY_DOWN 16
  6. #define KEY_LEFT 64
  7. #define KEY_RIGHT 8
  8. #define KEY_1 1
  9. #define KEY_2 2
  10. #define KEY_OK 4
  11. #define ms(x) ((unsigned int)x/16)
  12. struct timers {
  13. unsigned int tick;
  14. unsigned int owire;
  15. };
  16. extern volatile struct timers timers;
  17. static inline void atomic_set_uint(volatile unsigned int *volatile data, unsigned int value) __attribute__((always_inline));
  18. static inline void atomic_set_uint(volatile unsigned int *volatile data, unsigned int value){
  19. cli();
  20. *data = value;
  21. sei();
  22. }