]>
cloudbase.mooo.com Git - z180-stamp.git/blob - include/common.h
2 * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
4 * SPDX-License-Identifier: GPL-2.0
17 #define GCC_VERSION (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)
19 #define USED __attribute__((used))
20 #define UNUSED __attribute__((unused))
24 #include <avr/pgmspace.h>
25 #include <util/delay.h>
27 #define udelay(n) _delay_us(n)
38 } __attribute__((__packed__
));
40 #define SBIT(port,pin) ((*(volatile struct bits*)&port).b##pin)
43 // Known to work: 4.8.4, 4.9.1
44 // Known to fail: 4.8.3, 4.9.0
46 #if (GCC_VERSION < 40804) || (GCC_VERSION == 40900)
47 #define GCC_BUG_61443 1
50 #define DEVICE_NAME __AVR_DEVICE_NAME__
64 #define stringify(s) tostring(s)
65 #define tostring(s) #s
67 #define FSTR(X) ((const FLASH char[]) { X } )
68 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
70 #define MIN(a,b) ({ typeof (a) _a = (a); \
71 typeof (b) _b = (b); \
73 #define MAX(a,b) ({ typeof (a) _a = (a); \
74 typeof (b) _b = (b); \
80 extern volatile uint_least8_t Stat
;
83 #define S_10MS_TO (1<<0)
84 #define S_MSG_PENDING (1<<1)
85 #define S_CON_PENDING (1<<3)
86 #define S_RESET_POLARITY (1<<4)
89 int my_puts(const char *s
)
91 return fputs(s
, stdout
);
95 int my_puts_P(const char *s
)
98 return fputs_P(s
, stdout
);
100 return fputs(s
, stdout
);
104 #endif /* COMMON_H */