static void init(void) { ACSR = _BV(ACD); // Disable Analog Comparator (power save) //motion_init(); TCCR0 = _BV(CS02) | _BV(CS00); // clk / 256 TIMSK = _BV(TOIE0); io_init(); // init twi if (!TWIM_Init()) { while (1); } ds1631_init(I2C_ADRESSE_DS1631); // Init twi temperature sensor spi_init(); // initialize spi port can_read_addr(); can_init(); // initialize can communication sei(); // turn on interrupts wdt_enable(WDTO_250MS); #ifndef NO_NETVAR switch_netvars_init(); lamp_out_init(); #endif }
int main (void) { // enable pull ups for the 4 keys PORTA |= (1<<PORTA4)|(1<<PORTA5)|(1<<PORTA6)|(1<<PORTA7); // set LED Pins to output DDRC |= (1<<DDC2); // BL-LED1 DDRD |= (1<<DDD6); // BL-LED2 DDRD |= (1<<DDD7); // BL-LED3 DDRC |= (1<<DDC6); // buzzer // disable bootloader LED DDRC |= (1<<DDC3); PORTC |= (1<<PORTC3); LCD_Init (); USART_Init (); USART1_Init (); TWIM_Init (200000); TIMER0_Init (); sei (); lcd_cls (); lcd_printp (PSTR("Hallo"), 0); for (;;) { } }
uint8_t twi_init(uint32_t bitrate) { TWIM_Init(bitrate); }