#ifndef ZETA_H #define ZETA_H #include #include typedef int8_t s8; typedef int16_t s16; typedef int32_t s32; typedef int64_t s64; typedef uint8_t u8; typedef uint16_t u16; typedef uint32_t u32; typedef uint64_t u64; #define LENGTH(x) (sizeof(x) / sizeof(x[0])) #define MAX(x, y) ((x) > (y) ? (x) : (y)) #define MIN(x, y) ((x) < (y) ? (x) : (y)) // Corrent version, but the compiler does not recognize this as a constant // expression // #define ISR_ADDRESS(x) (((u16)&x) & 0xFF) #define ISR_ADDRESS(x) ((u16)&x) extern void *rx_isr_ptr; extern void *ctc0_isr_ptr; extern void *ctc1_isr_ptr; extern void *ctc2_isr_ptr; extern void *ctc3_isr_ptr; extern void *port_a_isr_ptr; extern void *port_b_isr_ptr; void bootloader(void); uint16_t crc16(const void *buf, size_t len); void _menu(void); static inline int max(int a, int b) { return a > b ? a : b; } static inline int min(int a, int b) { return a < b ? a : b; } static inline int clamp(int v, int low, int high) { return min(max(v, low), high); } static inline uint8_t bcd(uint8_t x) { return ((x / 10) << 4) | (x % 10); } #endif // ZETA_H