void IrTransceiver_Init(void)
{
	IR_TIMER_INIT();

#if IR_RX_ENABLE==1
	for (uint8_t i = 0; i < 3; i++)
	{
		drvIrRxChannel[i].storeEnable = FALSE;
		drvIrRxChannel[i].rxlen = 0;
	}
#endif
	
#if IR_TX_ENABLE==1
	/* Set up transmitter */
	#if defined(__AVR_ATmega88__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega328P__)
	TCCR0A = (0<<COM0A1)|(0<<COM0A0)|(1<<WGM01)|(0<<WGM00);
	TCCR0B = (0<<WGM02)|(1<<CS00)|(0<<CS01)|(0<<CS02);
	
	/* Set up modulation frequency */
	IR_MODULATION_REG = (((F_CPU / 2000) / drvIrTxModFreqkHz) - 1);

	/* start pwm generator */
	TCCR0A |= (1<<COM0A0);
	#endif

#endif

}
Ejemplo n.º 2
0
void IrTransceiver_Init(void)
{
	IR_TIMER_INIT();
	IR_TIMEOUT_REG = IR_MAX_PULSE_WIDTH;
	IRDDR &= ~(1<<IRBIT);
	DDRC |= (1<<PC5);
}
Ejemplo n.º 3
0
void ir_init(void) {
	/*
	 * Variables
	 */
	status = IR_STARTBIT1;
	buffer_read = 0;
	buffer_write = 0;
	toggle = 0;

#if IR_DBG_EN
	cnt_start2 = 0;
	cnt_toggle = 0;
	cnt_addr = 0;
	cnt_cmd = 0;
#endif

	IR_INT_INIT();
	IR_TIMER_INIT();

	IR_FALLING_INT();
}