Exemplo n.º 1
0
/* ------------------------------------------------------------------------- */
void init(void)
{
	/* 
           most important: configure layer enable as output and low
           as the latches are not able to source more than one layer
           at once
        */
	PORTC = 0;
	DDRC  = 0xFF;
	DDRA  = 0xFF;
	DDRD  = 0xFF;
	PORTA = 0;
	PORTD = 0;

	cube_show_init();

	//usbInit();
	//usbReset();

	// USB Poll with Timer1 (16Bit)
	TCCR1A = 0x00;
	TCCR1B = (1 << CS10); // prescale = 0
	TCNT1 = USB_POLL_TCNT_START;
	TIMSK |= (1 << TOIE1);

	// Timer2 (8Bit)
	TCCR2  = 0x00;
	TCCR2 |= (1 << WGM21); // CTC
	TCCR2 |= (1 << CS22) | (1 << CS21) | (1 << CS20); // prescale = 1024
	TCNT2 = 1;
    OCR2 = 125; // Ergibt genau 0,008 Sekunden
	TIMSK |= (1 << OCIE2);

	_delay_ms(1);
	sei();
	_delay_ms(1);
	qBlock[0] = 0;
	qBlock[1] = 0;
	qBlock[2] = 0;
	qBlock[3] = 0;	
	qBlock[4] = 0;
	qBlock[5] = 0;
	qBlock[6] = 0;
	falldown = 1;
	sekunden = 0;
	minuten = 0;
	stunden = 0;
	showTime = false;

    uart_init(UART_BAUD_SELECT(BAUDRATE, F_CPU));

}	
Exemplo n.º 2
0
void init(void)
{
	/* 
           most important: configure layer enable as output and low
           as the latches are not able to source more than one layer
           at once
        */
	PORTC = 0;
	DDRC = 0xFF;
	DDRA = 0xFF;
	DDRD = 0xFF;
	PORTA = 0;
	PORTD = 0;
	cube_show_init();
	_delay_ms(1);
	sei();
	_delay_ms(1);
}