From f50b5481faba516ff83f945ebbb8af4893a7e379 Mon Sep 17 00:00:00 2001 From: Nilay Date: Fri, 16 Jun 2017 11:11:52 +0530 Subject: [PATCH] PCNT: Fixed pcnt_counter_clear, Pulse Count now able to resume after API call --- components/driver/pcnt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/driver/pcnt.c b/components/driver/pcnt.c index 9c16e92eb7..907221edfe 100644 --- a/components/driver/pcnt.c +++ b/components/driver/pcnt.c @@ -143,7 +143,9 @@ esp_err_t pcnt_counter_clear(pcnt_unit_t pcnt_unit) { PCNT_CHECK(pcnt_unit < PCNT_UNIT_MAX, PCNT_UNIT_ERR_STR, ESP_ERR_INVALID_ARG); PCNT_ENTER_CRITICAL(&pcnt_spinlock); - PCNT.ctrl.val &= (~(BIT(PCNT_PLUS_CNT_RST_U0_S + (pcnt_unit * 2)))); + uint32_t reset_bit = BIT(PCNT_PLUS_CNT_RST_U0_S + (pcnt_unit * 2)); + PCNT.ctrl.val |= reset_bit; + PCNT.ctrl.val &= ~reset_bit; PCNT_EXIT_CRITICAL(&pcnt_spinlock); return ESP_OK; } -- 2.40.0