]> granicus.if.org Git - esp-idf/commitdiff
add pcnt.rst
authorWangjialin <wangjialin@espressif.com>
Wed, 23 Nov 2016 11:07:30 +0000 (19:07 +0800)
committerWangjialin <wangjialin@espressif.com>
Wed, 23 Nov 2016 11:07:30 +0000 (19:07 +0800)
components/driver/include/driver/periph_ctrl.h
components/driver/periph_ctrl.c
docs/api/pcnt.rst

index d7a98284b7045060c90f62cbb64f9da6f6cc3c10..8c404e5b1367050d0d8b9d04cab9b8801a865012 100644 (file)
@@ -40,6 +40,7 @@ typedef enum {
     PERIPH_UHCI0_MODULE,
     PERIPH_UHCI1_MODULE,
     PERIPH_RMT_MODULE,
+    PERIPH_PCNT_MODULE,
 } periph_module_t;
 
 /**
index a687a2aee2dcf74d4d01820ea6039b0394f6c008..7fc4091aa585952ee726689615bdde69084bc569 100644 (file)
@@ -107,6 +107,10 @@ void periph_module_disable(periph_module_t periph)
 {
     portENTER_CRITICAL(&periph_spinlock);
     switch(periph) {
+        case PERIPH_RMT_MODULE:
+            CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_RMT_CLK_EN);
+            SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_RMT_RST);
+            break;
         case PERIPH_LEDC_MODULE:
             CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_LEDC_CLK_EN);
             SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_LEDC_RST);
@@ -171,6 +175,10 @@ void periph_module_disable(periph_module_t periph)
             CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_UHCI1_CLK_EN);
             SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_UHCI1_RST);
             break;
+        case PERIPH_PCNT_MODULE:
+            CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_PCNT_CLK_EN);
+            SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_PCNT_RST);
+            break;
         default:
             break;
     }
index 177027f62e253a28e7476f461878a0623d7be4ec..a3f654909d8d38adad4cf44a517bef38140e538e 100644 (file)
@@ -1,3 +1,25 @@
+PCNT
+========
+
+Overview
+--------
+
+The PCNT (Pulse Counter) module is designed to count the number of rising and/or falling edges of an input signal. Each pulse counter unit has a 16-bit signed counter register and two channels that can be configured to either increment or decrement the counter. Each channel has a signal input that accepts signal edges to be detected, as well as a control input that can be used to enable or disable the signal input. The inputs have optional filters that can be used to discard unwanted glitches in the signal.
+
+Application Example
+-------------------
+
+PCNT counter with control signal and event interrupt example: `examples/12_pcnt <https://github.com/espressif/esp-idf/tree/master/examples/12_pcnt>`_.
+
+API Reference
+-------------
+
+Header Files
+^^^^^^^^^^^^
+
+  * `driver/pcnt.h <https://github.com/espressif/esp-idf/blob/master/components/driver/include/driver/pcnt.h>`_
+
+
 Macros
 ^^^^^^