# HG changeset patch # User Tero Marttila # Date 1412799543 -10800 # Node ID 49643ef9d3d2599666430fa508b026d41c9b4bd1 # Parent 61eba9d55764f68e9936057e77e72b0728867677 port: move over ioport stuff from stdlib diff -r 61eba9d55764 -r 49643ef9d3d2 include/port.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 + +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 diff -r 61eba9d55764 -r 49643ef9d3d2 include/stdlib.h --- 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 @@ -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