From 2dbae95a7eecd34ac234e5ff178752b76b20560c Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Tue, 6 Dec 2016 01:11:32 +0200 Subject: [PATCH 1/2] Fix wrong assignment of channel and unit in pcnt_unit_config --- components/driver/include/driver/pcnt.h | 2 +- components/driver/pcnt.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/driver/include/driver/pcnt.h b/components/driver/include/driver/pcnt.h index deff781839..7cc7843977 100644 --- a/components/driver/include/driver/pcnt.h +++ b/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, diff --git a/components/driver/pcnt.c b/components/driver/pcnt.c index b39d53a800..e65d733c01 100644 --- a/components/driver/pcnt.c +++ b/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; From 3cd9cb891123cd63669d9d21aa774358d7a6f5a1 Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Tue, 6 Dec 2016 02:10:35 +0200 Subject: [PATCH 2/2] Fix comment in the header --- components/driver/include/driver/pcnt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/driver/include/driver/pcnt.h b/components/driver/include/driver/pcnt.h index 7cc7843977..d2620cf15e 100644 --- a/components/driver/include/driver/pcnt.h +++ b/components/driver/include/driver/pcnt.h @@ -27,9 +27,9 @@ typedef enum { } pcnt_ctrl_mode_t; typedef enum { - PCNT_COUNT_DIS = 0, /*!< Counter mode: Decrease counter value*/ + PCNT_COUNT_DIS = 0, /*!< Counter mode: Inhibit counter(counter value will not change in this condition)*/ PCNT_COUNT_INC = 1, /*!< Counter mode: Increase counter value*/ - PCNT_COUNT_DEC = 2, /*!< Counter mode: Inhibit counter(counter value will not change in this condition)*/ + PCNT_COUNT_DEC = 2, /*!< Counter mode: Decrease counter value*/ PCNT_COUNT_MAX } pcnt_count_mode_t;