include/stdlib.h
changeset 9 49643ef9d3d2
parent 6 c5ab059eadc1
equal deleted inserted replaced
8:61eba9d55764 9:49643ef9d3d2
     1 #ifndef QMSK_ARDUINO_STDLIB_H
     1 #ifndef QMSK_STDLIB_H
     2 #define QMSK_ARDUINO_STDLIB_H
     2 #define QMSK_STDLIB_H
     3 
     3 
     4 #include <stdint.h>
     4 #include <stdint.h>
     5 
     5 
     6 #define false       0
     6 #define false       0
     7 #define true        1
     7 #define true        1
     8 
     8 
     9 typedef uint8_t byte;
     9 typedef uint8_t byte;
    10 
    10 
    11 typedef volatile uint8_t ioport_t;
    11 #include "port.h"
    12 
       
    13 static inline ioport_t tbi(ioport_t *port, byte bit)
       
    14 {
       
    15     return *port & (1 << bit);
       
    16 }
       
    17 
       
    18 static inline void sbi(ioport_t *port, byte bit)
       
    19 {
       
    20     *port |= (1 << bit);
       
    21 }
       
    22 
       
    23 static inline void cbi(ioport_t *port, byte bit)
       
    24 {
       
    25     *port &= ~(1 << bit);
       
    26 }
       
    27 
       
    28 static inline void xbi(ioport_t *port, byte bit)
       
    29 {
       
    30     *port ^= (1 << bit);
       
    31 }
       
    32 
    12 
    33 #endif
    13 #endif