]>
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
18 #define GCC_VERSION (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)
20 #define USED __attribute__((used))
21 #define UNUSED __attribute__((unused))
25 #include <avr/pgmspace.h>
26 #include <util/delay.h>
28 #define udelay(n) _delay_us(n)
39 } __attribute__((__packed__
));
41 #define SBIT(port,pin) ((*(volatile struct bits*)&port).b##pin)
44 // Known to work: 4.8.4, 4.9.1
45 // Known to fail: 4.8.3, 4.9.0
47 #if (GCC_VERSION < 40804) || (GCC_VERSION == 40900)
48 #define GCC_BUG_61443 1
51 #define DEVICE_NAME __AVR_DEVICE_NAME__
65 #define stringify(s) tostring(s)
66 #define tostring(s) #s
68 #define FSTR(X) ((const FLASH char[]) { X } )
69 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
71 #define MIN(a,b) ({ typeof (a) _a = (a); \
72 typeof (b) _b = (b); \
74 #define MAX(a,b) ({ typeof (a) _a = (a); \
75 typeof (b) _b = (b); \
81 extern volatile uint_least8_t Stat
;
84 #define S_10MS_TO (1<<0)
85 #define S_MSG_PENDING (1<<1)
86 #define S_CON_PENDING (1<<3)
87 #define S_RESET_POLARITY (1<<4)
90 int my_puts(const char *s
)
92 return fputs(s
, stdout
);
96 int my_puts_P(const char *s
)
99 return fputs_P(s
, stdout
);
101 return fputs(s
, stdout
);
105 #endif /* COMMON_H */