Timer with a relax period
HI
I need a simple timer that can make a PWM signal BUT with custom pauses or a relax period every number of pulses ... I have the code working very well with no relax , but I do not know how to write the relax period in the timer script itself...
Here is my actual code :
void SwitchPulse(){
TimerPulse.pause();
PeriodCyc = (Current[curMark] + Current[curSpace]) * (F_CPU/1000000.0);
Prescaler = (PeriodCyc / MAX_RELOAD) + 1.0;
TimerPulse.setPrescaleFactor(Prescaler);
Overflow = (PeriodCyc + (Prescaler / 2.0)) / Prescaler;
TimerPulse.setOverflow(Overflow);
DutyCyc = Overflow*Current[curMark]/(Current[curMark]+Current[curSpace]);
pwmWrite(PinPulse,DutyCyc);
TimerPulse.refresh();
TimerPulse.resume();
}
I wonder if it can be done more directly with the timer registers...
