void TCE0_init() { /* Select a Waveform Genreation mode and the CC channels to use*/ TC0_ConfigWGM( &TCE0, TC_WGMODE_SS_gc ); TC0_EnableCCChannels( &TCE0, TC0_CCAEN_bm); // only CCA is used TC_SetPeriod( &TCE0, 60000); /* The corresponding port pins MUST be output for the Waveform to be visible */ PORTE.DIRSET = 0xFF; PORTE.OUTSET = 0xFF; //set port high to switch LEDs off, take INVEN into account /* To have inverted ouput on some pins we set the corresponding INVEN bit for the pin*/ TC0_ConfigClockSource(&TCE0, TC_CLKSEL_DIV1_gc); }
void configDelayTimer (volatile TC0_t * tc) { TC_SetPeriod (tc, (uint16_t)65535); // set tc period TC0_ConfigWGM (tc, TC_WGMODE_NORMAL_gc); // normal timer countermode TC0_ConfigClockSource (tc, TC_CLKSEL_DIV1024_gc); }