Subversion Repositories group.electronics

Rev

Rev 123 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 123 Rev 126
Line 1... Line 1...
1
#ifndef util_h
1
#ifndef avrutil_h
2
#define util_h
2
#define avrutil_h
3
 
3
 
4
#define sbi(sfr, bit)   ((sfr) |= _BV(bit))
4
#define sbi(sfr, bit)   ((sfr) |= _BV(bit))
5
#define cbi(sfr, bit)   ((sfr) &= ~(_BV(bit)))
5
#define cbi(sfr, bit)   ((sfr) &= ~(_BV(bit)))
6
#define xbi(sfr, bit)   ((sfr) ^= _BV(bit))
6
#define xbi(sfr, bit)   ((sfr) ^= _BV(bit))
7
#define rbi(sfr, bit)   (((sfr) >> (bit)) & 0x01)
7
#define rbi(sfr, bit)   (((sfr) >> (bit)) & 0x01)
8
 
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
 
9
inline uint8_t map_8(uint8_t x, uint8_t in_min, uint8_t in_max, uint8_t out_min, uint8_t out_max);
16
volatile uint32_t systime;
10
 
17
 
-
 
18
inline uint8_t map_8(uint8_t x, uint8_t in_min, uint8_t in_max, uint8_t out_min, uint8_t out_max);
11
void analogInit(void);
19
void analogInit(void);
12
uint8_t analogRead(uint8_t channel);
20
uint8_t analogRead(uint8_t channel);
13
 
-
 
14
typedef void (*tick_ptr)();
21
typedef void (*tick_ptr)();
15
 
-
 
16
void sysclockInit(void);
22
void sysclockInit(void);
17
 
-
 
18
inline void delay_ms(uint16_t count);
23
inline void delay_ms(uint16_t count);
19
 
-
 
20
void pulsePin(uint8_t port, uint8_t pin, uint16_t count);
24
void pulsePin(uint8_t port, uint8_t pin, uint16_t count);
21
 
25
 
-
 
26
void swap_u8(uint8_t* a, uint8_t* b);
-
 
27
void swap_u16(uint16_t* a, uint16_t* b);
-
 
28
 
-
 
29
void statusLed(uint8_t state);
-
 
30
 
22
#endif
31
#endif