void init(void) { LED_INIT(); SW_INIT(); SENS_INIT(); // SPI // MOSI, SCK, als Output / MISO als Input SPI_DDR |= _BV( SPI_MOSI ) | _BV( SPI_SCLK ); // mosi, sck output SPI_DDR &= ~_BV( SPI_MISO ); // miso input // test pin change interrupt GIMSK |= _BV(PCIE0); /* PCIE0 pin change interrupt auf pcint 7 bis 0 aktiviert */ PCMSK0 |= _BV(PCINT0) | _BV(PCINT1); /* pcint0 + 1 aktivieren */ // read housecode/button from eprom readConfig(); // init devices ccInitChip(); fs20_init(); // init watchdog timer as long timer (8s). Timeout will lead to an interrupt and not a reset // do not set WDE (as if so we need to set WDIE after every interrupt) WDTCSR |= _BV(WDIE) | _BV(WDP3) | _BV(WDP0); }
int main(void) { // // Set the clocking to run directly from the crystal. // SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ); // // Configure GPIO output mode. LED // LED_INIT(); // // Configure GPIO input mode. Switch // SW_INIT(); // // Loop forever. // while(1) { if (SW_IS_PUSHED()) { LED_ON(); } else { LED_OFF(); } } }