8 |
pfowler |
1 |
#ifndef avrutil_h
|
|
|
2 |
#define avrutil_h
|
|
|
3 |
|
|
|
4 |
#define sbi(sfr, bit) ((sfr) |= _BV(bit))
|
|
|
5 |
#define cbi(sfr, bit) ((sfr) &= ~(_BV(bit)))
|
|
|
6 |
#define xbi(sfr, bit) ((sfr) ^= _BV(bit))
|
|
|
7 |
#define rbi(sfr, bit) (((sfr) >> (bit)) & 0x01)
|
|
|
8 |
|
|
|
9 |
#define HIGH 1
|
|
|
10 |
#define LOW 0
|
|
|
11 |
#define OUTPUT 1
|
|
|
12 |
#define INPUT 0
|
|
|
13 |
#define ON 1
|
|
|
14 |
#define OFF 0
|
|
|
15 |
|
|
|
16 |
volatile uint32_t systime;
|
|
|
17 |
|
|
|
18 |
uint32_t millis(void);
|
|
|
19 |
|
|
|
20 |
inline uint8_t map_8(uint8_t x, uint8_t in_min, uint8_t in_max, uint8_t out_min, uint8_t out_max);
|
|
|
21 |
void analogInit(void);
|
|
|
22 |
uint8_t analogRead(uint8_t channel);
|
|
|
23 |
typedef void (*tick_ptr)();
|
|
|
24 |
void sysclockInit(void);
|
|
|
25 |
inline void delay_ms(uint16_t count);
|
|
|
26 |
void pulsePin(uint8_t port, uint8_t pin, uint16_t count);
|
|
|
27 |
|
|
|
28 |
void swap_u8(uint8_t* a, uint8_t* b);
|
|
|
29 |
void swap_u16(uint16_t* a, uint16_t* b);
|
|
|
30 |
|
|
|
31 |
void systemLed(uint8_t state);
|
|
|
32 |
|
|
|
33 |
uint8_t itobcd32(uint32_t val, uint8_t *result);
|
|
|
34 |
uint8_t itobcd16(uint16_t val, uint8_t *result);
|
|
|
35 |
uint8_t itobcd8(uint8_t val, uint8_t *result);
|
|
|
36 |
|
|
|
37 |
#endif
|