port: move over ioport stuff from stdlib
authorTero Marttila <terom@paivola.fi>
Wed, 08 Oct 2014 23:19:03 +0300
changeset 9 49643ef9d3d2
parent 8 61eba9d55764
child 10 d485c5b3ab4d
port: move over ioport stuff from stdlib
include/port.h
include/stdlib.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/port.h	Wed Oct 08 23:19:03 2014 +0300
@@ -0,0 +1,27 @@
+#ifndef QMSK_PORT_H
+#define QMSK_PORT_H
+
+#include <avr/io.h>
+
+typedef volatile uint8_t ioport_t;
+
+static inline ioport_t tbi(ioport_t *port, uint8_t bit)
+{
+    return *port & (1 << bit);
+}
+
+static inline void sbi(ioport_t *port, uint8_t bit)
+{
+    *port |= (1 << bit);
+}
+
+static inline void cbi(ioport_t *port, uint8_t bit)
+{
+    *port &= ~(1 << bit);
+}
+
+static inline void xbi(ioport_t *port, uint8_t bit)
+{
+    *port ^= (1 << bit);
+}
+#endif
--- a/include/stdlib.h	Thu Sep 25 00:55:47 2014 +0300
+++ b/include/stdlib.h	Wed Oct 08 23:19:03 2014 +0300
@@ -1,5 +1,5 @@
-#ifndef QMSK_ARDUINO_STDLIB_H
-#define QMSK_ARDUINO_STDLIB_H
+#ifndef QMSK_STDLIB_H
+#define QMSK_STDLIB_H
 
 #include <stdint.h>
 
@@ -8,26 +8,6 @@
 
 typedef uint8_t byte;
 
-typedef volatile uint8_t ioport_t;
-
-static inline ioport_t tbi(ioport_t *port, byte bit)
-{
-    return *port & (1 << bit);
-}
-
-static inline void sbi(ioport_t *port, byte bit)
-{
-    *port |= (1 << bit);
-}
-
-static inline void cbi(ioport_t *port, byte bit)
-{
-    *port &= ~(1 << bit);
-}
-
-static inline void xbi(ioport_t *port, byte bit)
-{
-    *port ^= (1 << bit);
-}
+#include "port.h"
 
 #endif