pmc_enable_periph_clk((uint32_t)Timers[timer].irq);
// Do magic, and find's best clock
clock = bestClock(frequency, rc);
TC_Configure(t.tc, t.channel, TC_CMR_WAVE | TC_CMR_WAVSEL_UP_RC | clock);
// Pwm stuff
TC_SetRA(t.tc, t.channel, rc/2); //50% high, 50% low
TC_SetRC(t.tc, t.channel, rc);
TC_Start(t.tc, t.channel);
t.tc-›TC_CHANNEL[t.channel].TC_IER=TC_IER_CPCS;
t.tc-›TC_CHANNEL[t.channel].TC_IDR=~TC_IER_CPCS; |