bugfix(pwm): support fractional phase

* Supports fractional phase, making the phase function produce higher precision waveforms.
* Enhanced stability
This commit is contained in:
xiongyu
2020-06-04 14:17:59 +08:00
parent ac10b42802
commit 72cbf0d55e
4 changed files with 17 additions and 17 deletions

View File

@ -51,7 +51,7 @@ typedef struct {
uint32_t step_01duty; // 0.1 of the duty value
uint32_t step_001duty; // 0.01 of the duty value
uint32_t gpio_num;//gpio pins
int16_t phase; //init phase
float phase; //init phase
int fade_time; // Time to duty by fade
} ledc_obj_t;
@ -277,7 +277,7 @@ static void ledc_task(void* pvParameters)
esp_err_t ledc_fade_func_install(int intr_alloc_flags)
{
int16_t ledc_phase[LEDC_CHANNEL_MAX] = {0};
float ledc_phase[LEDC_CHANNEL_MAX] = {0};
uint32_t ledc_duty[LEDC_CHANNEL_MAX] = {0};
uint32_t ledc_gpio_num[LEDC_CHANNEL_MAX] = {0};