Subversion Repositories group.NITPanels

Rev

Blame | Last modification | View Log | RSS feed

#ifndef avrutil_h
#define avrutil_h

#define sbi(sfr, bit)   ((sfr) |= _BV(bit))
#define cbi(sfr, bit)   ((sfr) &= ~(_BV(bit)))
#define xbi(sfr, bit)   ((sfr) ^= _BV(bit))
#define rbi(sfr, bit)   (((sfr) >> (bit)) & 0x01)

#define HIGH 1
#define LOW 0
#define OUTPUT 1
#define INPUT 0
#define ON 1
#define OFF 0

volatile uint32_t systime;

uint32_t millis(void);

inline uint8_t map_8(uint8_t x, uint8_t in_min, uint8_t in_max, uint8_t out_min, uint8_t out_max);
void analogInit(void);
uint8_t analogRead(uint8_t channel);
typedef void (*tick_ptr)();
void sysclockInit(void);
inline void delay_ms(uint16_t count);
void pulsePin(uint8_t port, uint8_t pin, uint16_t count);

void swap_u8(uint8_t* a, uint8_t* b);
void swap_u16(uint16_t* a, uint16_t* b);

void systemLed(uint8_t state);

uint8_t itobcd(uint32_t val, uint8_t *result);

#endif