]>
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 | |
14 | #endif | |
15 | ||
16 | #include <stdio.h> | |
17 | ||
18 | #ifdef __FLASH | |
19 | #define FLASH __flash | |
20 | #else | |
21 | #define FLASH | |
22 | #endif | |
23 | ||
24 | #define stringify(s) tostring(s) | |
25 | #define tostring(s) #s | |
26 | ||
27 | #define FSTR(X) ((const FLASH char[]) { X } ) | |
28 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | |
29 | ||
30 | ||
31 | #ifdef __AVR__ | |
32 | #define Stat GPIOR0 | |
33 | #else | |
34 | extern volatile uint_least8_t Stat; | |
35 | #endif | |
36 | ||
37 | #define S_10MS_TO (1<<0) | |
38 | ||
39 | ||
40 | #include <util/delay.h> | |
41 | ||
42 | static inline | |
43 | void my_puts(const char *s) | |
44 | { | |
45 | fputs(s, stdout); | |
46 | // _delay_ms(10); | |
47 | } | |
48 | ||
49 | static inline | |
50 | void my_puts_P(const char *s) | |
51 | { | |
52 | fputs_P(s, stdout); | |
53 | // _delay_ms(10); | |
54 | } | |
55 | ||
56 | #endif /* COMMON_H */ | |
57 |