summaryrefslogtreecommitdiff
path: root/include/common.h
diff options
context:
space:
mode:
authorLeo C2014-11-22 17:30:41 +0100
committerLeo C2014-11-22 17:30:41 +0100
commit26331e248f87b8d640054c91b581f482cd89bede (patch)
treeb1019be76108cee256ed90c136702bd646c0232c /include/common.h
parent289c32526f98d9637df35ad95ed0b65223cf6770 (diff)
downloadz180-stamp-26331e248f87b8d640054c91b581f482cd89bede.zip
Move macro SBIT to common.h
Diffstat (limited to 'include/common.h')
-rw-r--r--include/common.h20
1 files changed, 16 insertions, 4 deletions
diff --git a/include/common.h b/include/common.h
index 121922f..b0dd038 100644
--- a/include/common.h
+++ b/include/common.h
@@ -8,6 +8,19 @@
#define udelay(n) _delay_us(n)
+struct bits {
+ uint8_t b0:1;
+ uint8_t b1:1;
+ uint8_t b2:1;
+ uint8_t b3:1;
+ uint8_t b4:1;
+ uint8_t b5:1;
+ uint8_t b6:1;
+ uint8_t b7:1;
+} __attribute__((__packed__));
+
+#define SBIT(port,pin) ((*(volatile struct bits*)&port).b##pin)
+
//TODO:
// Known to work: 4.8.4, 4.9.1
// Known to fail: 4.8.3, 4.9.0
@@ -25,7 +38,7 @@
#else
#define FLASH
#define MEMX
-#endif
+#endif
#define stringify(s) tostring(s)
#define tostring(s) #s
@@ -44,13 +57,13 @@ extern volatile uint_least8_t Stat;
#define S_MSG_PENDING (1<<1)
#define S_CON_PENDING (1<<2)
-static inline
+static inline
void my_puts(const char *s)
{
fputs(s, stdout);
}
-static inline
+static inline
void my_puts_P(const char *s)
{
#ifdef __AVR__
@@ -61,4 +74,3 @@ void my_puts_P(const char *s)
}
#endif /* COMMON_H */
-