]> granicus.if.org Git - esp-idf/commitdiff
Merge branch 'feature/ledc_more_meaningful_parameter_names' into 'master'
authorJiang Jiang Jian <jack@espressif.com>
Fri, 1 Dec 2017 11:33:53 +0000 (19:33 +0800)
committerJiang Jiang Jian <jack@espressif.com>
Fri, 1 Dec 2017 11:33:53 +0000 (19:33 +0800)
Provided more meaningful parameter names by renaming 'bit_num' to 'duty_resoluti…

See merge request !1440

1  2 
components/driver/ledc.c

index f8d2d11d9c555e463845f3ffb5c99230acd176e4,49b9e1ecf632b3f4c9f5784349a3e6dba8c2fb17..881f01ba539ed783421ac4f20c76a52ab0084d56
@@@ -535,11 -533,9 +535,11 @@@ esp_err_t ledc_set_fade_with_step(ledc_
      LEDC_CHECK(speed_mode < LEDC_SPEED_MODE_MAX, LEDC_MODE_ERR_STR, ESP_ERR_INVALID_ARG);
      LEDC_CHECK(channel < LEDC_CHANNEL_MAX, LEDC_CHANNEL_ERR_STR, ESP_ERR_INVALID_ARG);
      LEDC_CHECK(ledc_fade_channel_init_check(speed_mode, channel) == ESP_OK , LEDC_FADE_INIT_ERROR_STR, ESP_FAIL);
 +    LEDC_CHECK(scale > 0, LEDC_SCALE_ERR_STR, ESP_ERR_INVALID_ARG);
 +    LEDC_CHECK(cycle_num > 0, LEDC_CYCLE_ERR_STR, ESP_ERR_INVALID_ARG);
  
      int timer_sel = LEDC.channel_group[speed_mode].channel[channel].conf0.timer_sel;
-     uint32_t max_duty = (1 << (LEDC.timer_group[speed_mode].timer[timer_sel].conf.bit_num)) - 1;
+     uint32_t max_duty = (1 << (LEDC.timer_group[speed_mode].timer[timer_sel].conf.duty_resolution)) - 1;
      LEDC_CHECK(target_duty <= max_duty, LEDC_FADE_TARGET_ERR_STR, ESP_ERR_INVALID_ARG);
      //disable the interrupt, so the operation will not mess up
      ledc_enable_intr_type(speed_mode, channel, LEDC_INTR_DISABLE);