include/stdlib.h
author Tero Marttila <terom@paivola.fi>
Wed, 24 Sep 2014 23:49:12 +0300
changeset 6 c5ab059eadc1
parent 4 959d4b9c3f0a
child 9 49643ef9d3d2
permissions -rw-r--r--
stdlib: *bi indexes are bytes
#ifndef QMSK_ARDUINO_STDLIB_H
#define QMSK_ARDUINO_STDLIB_H

#include <stdint.h>

#define false       0
#define true        1

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);
}

#endif