]> cloudbase.mooo.com Git - z180-stamp.git/commitdiff
Move macro SBIT to common.h
authorLeo C <erbl259-lmu@yahoo.de>
Sat, 22 Nov 2014 16:30:41 +0000 (17:30 +0100)
committerLeo C <erbl259-lmu@yahoo.de>
Sat, 22 Nov 2014 16:30:41 +0000 (17:30 +0100)
avr/z80-if.c
include/common.h

index 9492c28d6fd14a1eab7c697656e54dd3b23ab3d0..45449974209a150ecc106185658b1bbbaa1a5363 100644 (file)
 
  */
 
-#include <avr/io.h>
+#include "common.h"
 #include <util/atomic.h>
-#include <stdio.h>
 #include "debug.h"
 #include "z80-if.h"
 
 
-/* Number of array elements */
-#define NELEMS(x)  (sizeof x/sizeof *x)
-
-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__));
-
-typedef struct bits pbit_t;
-
-#define SBIT(port,pin) ((*(volatile struct bits*)&port).b##pin)
-
 
 //#define P_ZCLK               PORTB
 //#define ZCLK         5
index 121922f390389baf54b49e3857a20c29666605fe..b0dd038e8775df2be44988733a352c2f07266dab 100644 (file)
@@ -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 */
-