include/port.h
changeset 9 49643ef9d3d2
equal deleted inserted replaced
8:61eba9d55764 9:49643ef9d3d2
       
     1 #ifndef QMSK_PORT_H
       
     2 #define QMSK_PORT_H
       
     3 
       
     4 #include <avr/io.h>
       
     5 
       
     6 typedef volatile uint8_t ioport_t;
       
     7 
       
     8 static inline ioport_t tbi(ioport_t *port, uint8_t bit)
       
     9 {
       
    10     return *port & (1 << bit);
       
    11 }
       
    12 
       
    13 static inline void sbi(ioport_t *port, uint8_t bit)
       
    14 {
       
    15     *port |= (1 << bit);
       
    16 }
       
    17 
       
    18 static inline void cbi(ioport_t *port, uint8_t bit)
       
    19 {
       
    20     *port &= ~(1 << bit);
       
    21 }
       
    22 
       
    23 static inline void xbi(ioport_t *port, uint8_t bit)
       
    24 {
       
    25     *port ^= (1 << bit);
       
    26 }
       
    27 #endif