Subversion Repositories group.electronics

Rev

Rev 128 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
126 pfowler 1
#ifndef avrutil_h
2
#define avrutil_h
123 pfowler 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
 
126 pfowler 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
 
128 pfowler 18
uint32_t millis(void);
19
 
123 pfowler 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
 
126 pfowler 28
void swap_u8(uint8_t* a, uint8_t* b);
29
void swap_u16(uint16_t* a, uint16_t* b);
30
 
128 pfowler 31
void systemLed(uint8_t state);
126 pfowler 32
 
128 pfowler 33
uint8_t itobcd(uint32_t val, uint8_t *result);
34
 
123 pfowler 35
#endif