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-- |
0 | 1 |
#ifndef QMSK_ARDUINO_STDLIB_H |
2 |
#define QMSK_ARDUINO_STDLIB_H |
|
3 |
||
4 | 4 |
#include <stdint.h> |
5 |
||
0 | 6 |
#define false 0 |
7 |
#define true 1 |
|
8 |
||
9 |
typedef uint8_t byte; |
|
10 |
||
11 |
typedef volatile uint8_t ioport_t; |
|
12 |
||
6
c5ab059eadc1
stdlib: *bi indexes are bytes
Tero Marttila <terom@paivola.fi>
parents:
4
diff
changeset
|
13 |
static inline ioport_t tbi(ioport_t *port, byte bit) |
0 | 14 |
{ |
15 |
return *port & (1 << bit); |
|
16 |
} |
|
17 |
||
6
c5ab059eadc1
stdlib: *bi indexes are bytes
Tero Marttila <terom@paivola.fi>
parents:
4
diff
changeset
|
18 |
static inline void sbi(ioport_t *port, byte bit) |
0 | 19 |
{ |
20 |
*port |= (1 << bit); |
|
21 |
} |
|
22 |
||
6
c5ab059eadc1
stdlib: *bi indexes are bytes
Tero Marttila <terom@paivola.fi>
parents:
4
diff
changeset
|
23 |
static inline void cbi(ioport_t *port, byte bit) |
0 | 24 |
{ |
25 |
*port &= ~(1 << bit); |
|
26 |
} |
|
27 |
||
6
c5ab059eadc1
stdlib: *bi indexes are bytes
Tero Marttila <terom@paivola.fi>
parents:
4
diff
changeset
|
28 |
static inline void xbi(ioport_t *port, byte bit) |
0 | 29 |
{ |
30 |
*port ^= (1 << bit); |
|
31 |
} |
|
32 |
||
33 |
#endif |