Explorar el Código

Fix wrong assignment of channel and unit in pcnt_unit_config

me-no-dev hace 9 años
padre
commit
2dbae95a7e
Se han modificado 2 ficheros con 3 adiciones y 3 borrados
  1. 1 1
      components/driver/include/driver/pcnt.h
  2. 2 2
      components/driver/pcnt.c

+ 1 - 1
components/driver/include/driver/pcnt.h

@@ -45,7 +45,7 @@ typedef enum {
     PCNT_UNIT_MAX,
 } pcnt_unit_t; 
 
-typedef enum{
+typedef enum {
     PCNT_CHANNEL_0 = 0x00,           /*!< PCNT channel0 */
     PCNT_CHANNEL_1 = 0x01,           /*!< PCNT channel1 */
     PCNT_CHANNEL_MAX,

+ 2 - 2
components/driver/pcnt.c

@@ -38,8 +38,8 @@ static portMUX_TYPE pcnt_spinlock = portMUX_INITIALIZER_UNLOCKED;
 
 esp_err_t pcnt_unit_config(pcnt_config_t *pcnt_config)
 {
-    uint8_t unit = pcnt_config->channel;
-    uint8_t channel = pcnt_config->unit;
+    uint8_t unit = pcnt_config->unit;
+    uint8_t channel = pcnt_config->channel;
     int input_io = pcnt_config->pulse_gpio_num;
     int ctrl_io = pcnt_config->ctrl_gpio_num;