]> granicus.if.org Git - esp-idf/commitdiff
Minor modification
authorWangjialin <wangjialin@espressif.com>
Wed, 28 Sep 2016 04:04:15 +0000 (12:04 +0800)
committerWangjialin <wangjialin@espressif.com>
Wed, 28 Sep 2016 04:04:15 +0000 (12:04 +0800)
1. add new line between typedefs
2. for param check functions, return bool if they are true/false

components/driver/include/driver/ledc.h
components/driver/ledc.c

index 2dffce8c9cafdd9769c4e62e14662c3dead87a85..3e3d3740df70a46b7cd87d0cbe21c96632465f1e 100644 (file)
@@ -34,24 +34,29 @@ typedef enum {
     //LEDC_LOW_SPEED_MODE,    /*LEDC low speed speed_mode */
     LEDC_SPEED_MODE_MAX,
 } ledc_mode_t;
+
 typedef enum {
     LEDC_INTR_DISABLE = 0,    /*Disable LEDC interrupt */
     LEDC_INTR_FADE_END,       /*Enable LEDC interrupt */
 } ledc_intr_type_t;
+
 typedef enum {
     LEDC_DUTY_DIR_DECREASE = 0,    /*LEDC duty decrease direction */
     LEDC_DUTY_DIR_INCREASE = 1,    /*LEDC duty increase direction */
 } ledc_duty_direction_t;
+
 typedef enum  {
     LEDC_REF_TICK = 0, /*LEDC timer clock divided from reference tick(1Mhz) */
     LEDC_APB_CLK,      /*LEDC timer clock divided from APB clock(80Mhz)*/
 } ledc_clk_src_t;
+
 typedef enum {
     LEDC_TIMER0 = 0, /*LEDC source timer TIMER0 */
     LEDC_TIMER1,     /*LEDC source timer TIMER1 */
     LEDC_TIMER2,     /*LEDC source timer TIMER2 */
     LEDC_TIMER3,     /*LEDC source timer TIMER3 */
 } ledc_timer_t;
+
 typedef enum {
     LEDC_CHANNEL_0 = 0, /*LEDC channel 0 */
     LEDC_CHANNEL_1,     /*LEDC channel 1 */
@@ -62,6 +67,7 @@ typedef enum {
     LEDC_CHANNEL_6,     /*LEDC channel 6 */
     LEDC_CHANNEL_7,     /*LEDC channel 7 */
 } ledc_channel_t;
+
 typedef enum {
     LEDC_TIMER_10_BIT = 10, /*LEDC PWM depth 10Bit */
     LEDC_TIMER_11_BIT = 11, /*LEDC PWM depth 11Bit */
index a5bf92f6f9b94b03c54e03ee148679adfa28d2ec..3fd0f27afb30c6abe3632bb9729748637e3d6371 100644 (file)
@@ -20,7 +20,7 @@
 #include "soc/gpio_sig_map.h"
 #include "driver/ledc.h"
 
-//TODO: Move these debug options to menuconfig
+//TODO: to use APIs in esp_log.h.
 #define LEDC_DBG_WARING_ENABLE (0)
 #define LEDC_DBG_ERROR_ENABLE  (0)
 #define LEDC_INFO_ENABLE       (0)
 
 static portMUX_TYPE ledc_spinlock = portMUX_INITIALIZER_UNLOCKED;
 
-static int ledc_is_valid_channel(uint32_t channel)
+static bool ledc_is_valid_channel(uint32_t channel)
 {
     if(channel > LEDC_CHANNEL_7) {
         LEDC_ERROR("LEDC CHANNEL ERR: %d\n",channel);
-        return 0;
+        return false;
     }
-    return 1;
+    return true;
 }
 
-static int ledc_is_valid_mode(uint32_t mode)
+static bool ledc_is_valid_mode(uint32_t mode)
 {
     if(mode >= LEDC_SPEED_MODE_MAX) {
         LEDC_ERROR("LEDC MODE ERR: %d\n",mode);
-        return 0;
+        return false;
     }
-    return 1;
+    return true;
 }
 
-static int ledc_is_valid_timer(int timer)
+static bool ledc_is_valid_timer(int timer)
 {
     if(timer > LEDC_TIMER3) {
         LEDC_ERROR("LEDC TIMER ERR: %d\n", timer);
-        return 0;
+        return false;
     }
-    return 1;
+    return true;
 }
 
 esp_err_t ledc_timer_config(ledc_mode_t speed_mode, ledc_timer_t timer_sel, uint32_t div_num, uint32_t bit_num, ledc_clk_src_t clk_src)