* pwm fix special state + debug print + IRAM interupt
* Special state = don't set timer, safer
* fix timer crash, cant divide by 0
* pwm dont start when duty is set
* reverse option
* fix low duty crash + comments
This commit is contained in:
Zaltora 2017-12-02 07:54:04 +01:00 committed by Ruslan V. Uss
parent 9b4a58c8e1
commit a0f846013c
4 changed files with 91 additions and 32 deletions

View file

@ -83,6 +83,11 @@ int timer_set_frequency(const timer_frc_t frc, uint32_t freq)
uint32_t counts = 0;
timer_clkdiv_t div = timer_freq_to_div(freq);
if(freq == 0) //can't divide by 0
{
return -EINVAL;
}
counts = timer_freq_to_count(frc, freq, div);
if(counts == 0)
{