123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #ifndef MAIN_H
- #define MAIN_H
- #include <avr/interrupt.h>
- #define MAX_SENSOR_NUM 1
- #define KEY_ESC 128
- #define KEY_UP 32
- #define KEY_DOWN 16
- #define KEY_LEFT 64
- #define KEY_RIGHT 8
- #define KEY_1 1
- #define KEY_2 2
- #define KEY_OK 4
- #define VOLT_DAC 0
- #define CURR_DAC 1
- #define ms(x) ((unsigned int)x/16)
- struct timers {
- unsigned int tick;
- unsigned int owire;
- };
- extern volatile struct timers timers;
- static inline void atomic_set_uint(volatile unsigned int *volatile data, unsigned int value) __attribute__((always_inline));
- static inline void atomic_set_uint(volatile unsigned int *volatile data, unsigned int value){
- cli();
- *data = value;
- sei();
- }
- static inline void atomic_set_slint(volatile signed long int *volatile data, signed long int value) __attribute__((always_inline));
- static inline void atomic_set_slint(volatile signed long int *volatile data, signed long int value){
- cli();
- *data = value;
- sei();
- }
- #endif
|