* 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

@ -16,12 +16,41 @@
extern "C" {
#endif
void pwm_init(uint8_t npins, const uint8_t* pins);
//Warning: Printf disturb pwm. You can use "uart_putc" instead.
/**
* Initialize pwm
* @param npins Number of pwm pin used
* @param pins Array pointer to the pins
* @param reverse If true, the pwm work in reverse mode
*/
void pwm_init(uint8_t npins, const uint8_t* pins, uint8_t reverse);
/**
* Set PWM frequency. If error, frequency not set
* @param freq PWM frequency value in Hertz
*/
void pwm_set_freq(uint16_t freq);
/**
* Set Duty between 0 and UINT16_MAX
* @param duty Duty value
*/
void pwm_set_duty(uint16_t duty);
/**
* Restart the pwm signal
*/
void pwm_restart();
/**
* Start the pwm signal
*/
void pwm_start();
/**
* Stop the pwm signal
*/
void pwm_stop();
#ifdef __cplusplus