esp8266/esppwm: Clip negative duty numbers to 0.
Prior to this patch a negative duty would lead to full PWM.
This commit is contained in:
parent
ab7819c314
commit
5c83d05b49
@ -210,12 +210,12 @@ pwm_start(void)
|
||||
/******************************************************************************
|
||||
* FunctionName : pwm_set_duty
|
||||
* Description : set each channel's duty params
|
||||
* Parameters : uint8 duty : 0 ~ PWM_DEPTH
|
||||
* Parameters : int16_t duty : 0 ~ PWM_DEPTH
|
||||
* uint8 channel : channel index
|
||||
* Returns : NONE
|
||||
*******************************************************************************/
|
||||
void ICACHE_FLASH_ATTR
|
||||
pwm_set_duty(uint16 duty, uint8 channel)
|
||||
pwm_set_duty(int16_t duty, uint8 channel)
|
||||
{
|
||||
uint8 i;
|
||||
for(i=0;i<pwm_channel_num;i++){
|
||||
|
@ -7,7 +7,7 @@
|
||||
void pwm_init(void);
|
||||
void pwm_start(void);
|
||||
|
||||
void pwm_set_duty(uint16_t duty, uint8_t channel);
|
||||
void pwm_set_duty(int16_t duty, uint8_t channel);
|
||||
uint16_t pwm_get_duty(uint8_t channel);
|
||||
void pwm_set_freq(uint16_t freq, uint8_t channel);
|
||||
uint16_t pwm_get_freq(uint8_t channel);
|
||||
|
Loading…
Reference in New Issue
Block a user