49
|
1 |
#include <util/delay.h>
|
|
2 |
|
|
3 |
#define false 0
|
|
4 |
#define true 1
|
|
5 |
|
|
6 |
typedef volatile uint8_t ioport_t;
|
|
7 |
|
|
8 |
static inline ioport_t tbi(ioport_t *port, int bit)
|
|
9 |
{
|
|
10 |
return *port & (1 << bit);
|
|
11 |
}
|
|
12 |
|
|
13 |
static inline void sbi(ioport_t *port, int bit)
|
|
14 |
{
|
|
15 |
*port |= (1 << bit);
|
|
16 |
}
|
|
17 |
|
|
18 |
static inline void cbi(ioport_t *port, int bit)
|
|
19 |
{
|
|
20 |
*port &= ~(1 << bit);
|
|
21 |
}
|
|
22 |
|
|
23 |
static inline void xbi(ioport_t *port, int bit)
|
|
24 |
{
|
|
25 |
*port ^= (1 << bit);
|
|
26 |
}
|
|
27 |
|
|
28 |
void delay_1s ()
|
|
29 |
{
|
|
30 |
// busyloop
|
|
31 |
_delay_ms(1000);
|
|
32 |
}
|