]>
Commit | Line | Data |
---|---|---|
d684c216 L |
1 | #ifndef COMMON_H |
2 | #define COMMON_H | |
3 | ||
4 | #ifdef __AVR__ | |
5 | #include <avr/io.h> | |
6 | ||
7 | //TODO: | |
8 | // Known to work: 4.8.4, 4.9.1 | |
9 | // Known to fail: 4.8.3, 4.9.0 | |
10 | #define GCC_BUG_61443 1 | |
11 | ||
12 | #else | |
13 | // TODO: stm32 | |
72f58822 | 14 | #endif /* __AVR__ */ |
d684c216 L |
15 | |
16 | #include <stdio.h> | |
17 | ||
18 | #ifdef __FLASH | |
19 | #define FLASH __flash | |
fc30b18e | 20 | #define MEMX __memx |
d684c216 L |
21 | #else |
22 | #define FLASH | |
fc30b18e | 23 | #define MEMX |
d684c216 L |
24 | #endif |
25 | ||
26 | #define stringify(s) tostring(s) | |
27 | #define tostring(s) #s | |
28 | ||
29 | #define FSTR(X) ((const FLASH char[]) { X } ) | |
30 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | |
31 | ||
32 | ||
33 | #ifdef __AVR__ | |
34 | #define Stat GPIOR0 | |
35 | #else | |
36 | extern volatile uint_least8_t Stat; | |
72f58822 | 37 | #endif /* __AVR__ */ |
d684c216 L |
38 | |
39 | #define S_10MS_TO (1<<0) | |
bad2d92d | 40 | #define S_MSG_PENDING (2<<0) |
d684c216 L |
41 | |
42 | static inline | |
43 | void my_puts(const char *s) | |
44 | { | |
45 | fputs(s, stdout); | |
d684c216 L |
46 | } |
47 | ||
48 | static inline | |
49 | void my_puts_P(const char *s) | |
50 | { | |
61b0cfe9 | 51 | #ifdef __AVR__ |
d684c216 | 52 | fputs_P(s, stdout); |
72f58822 | 53 | #else |
72f58822 | 54 | fputs(s, stdout); |
72f58822 | 55 | #endif /* __AVR__ */ |
61b0cfe9 L |
56 | } |
57 | ||
d684c216 L |
58 | #endif /* COMMON_H */ |
59 |