ir-cock-grenade/avr/ir grenade/main.h

41 lines
1.1 KiB
C

// What pins do what
#define LED PB2
#define IRLED PB0
#define TX PB1
// Lets us calculate the size of the NA/EU databases
#define NUM_ELEM(x) (sizeof (x) / sizeof (*(x)));
// set define to 0 to turn off debug output
#define DEBUG 1
#define DEBUGP(x) if (DEBUG == 1) { x ; }
// Shortcut to insert single, non-optimized-out nop
#define NOP __asm__ __volatile__ ("nop")
// Tweak this if neccessary to change timing
#define DELAY_CNT 11
#define TIMING_CORRECTION 1.18
// Makes the codes more readable. the OCRA is actually
// programmed in terms of 'periods' not 'freqs' - that
// is, the inverse!
#define freq_to_timerval(x) ((F_CPU / x - 1)/ 2)
// The structure of compressed code entries
struct IrCode {
uint8_t timer_val;
uint8_t numpairs;
uint8_t bitcompression;
uint16_t const *times;
uint8_t codes[];
};
void xmitCodeElement(uint16_t ontime, uint16_t offtime, uint8_t PWM_code );
void flashslowLEDx( uint8_t num_blinks );
void quickflashLEDx( uint8_t x );
void tvbgone_sleep( void );
void delay_ten_us(uint16_t us);
void quickflashLED( void );