summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/esp32s2/Makefile2
-rw-r--r--ports/esp32s2/common-hal/countio/Counter.c5
-rw-r--r--ports/esp32s2/common-hal/countio/Counter.h2
-rw-r--r--ports/esp32s2/peripherals/pcnt.c (renamed from ports/esp32s2/peripherals/pcnt_handler.c)6
-rw-r--r--ports/esp32s2/peripherals/pcnt.h (renamed from ports/esp32s2/peripherals/pcnt_handler.h)4
5 files changed, 10 insertions, 9 deletions
diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile
index 56f0d46a3..55d6e91d4 100644
--- a/ports/esp32s2/Makefile
+++ b/ports/esp32s2/Makefile
@@ -188,7 +188,7 @@ SRC_C += \
lib/utils/pyexec.c \
lib/utils/stdout_helpers.c \
lib/utils/sys_stdio_mphal.c \
- peripherals/pcnt_handler.c \
+ peripherals/pcnt.c \
peripherals/pins.c \
peripherals/rmt.c \
supervisor/shared/memory.c
diff --git a/ports/esp32s2/common-hal/countio/Counter.c b/ports/esp32s2/common-hal/countio/Counter.c
index 435762473..81f9f7ad2 100644
--- a/ports/esp32s2/common-hal/countio/Counter.c
+++ b/ports/esp32s2/common-hal/countio/Counter.c
@@ -42,7 +42,8 @@ void common_hal_countio_counter_construct(countio_counter_obj_t* self,
.neg_mode = PCNT_COUNT_DIS, // Keep the counter value on the negative edge
};
// Initialize PCNT unit
- pcnt_handler_init(&pcnt_config);
+ // This also sets pcnt_config.unit
+ peripherals_pcnt_init(&pcnt_config);
self->pin = pin->number;
self->unit = pcnt_config.unit;
@@ -57,7 +58,7 @@ void common_hal_countio_counter_deinit(countio_counter_obj_t* self) {
return;
}
reset_pin_number(self->pin);
- pcnt_handler_deinit(&self->unit);
+ peripherals_pcnt_deinit(&self->unit);
}
mp_int_t common_hal_countio_counter_get_count(countio_counter_obj_t* self) {
diff --git a/ports/esp32s2/common-hal/countio/Counter.h b/ports/esp32s2/common-hal/countio/Counter.h
index 63d1eb98b..20fe5b83e 100644
--- a/ports/esp32s2/common-hal/countio/Counter.h
+++ b/ports/esp32s2/common-hal/countio/Counter.h
@@ -28,7 +28,7 @@
#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_COUNTIO_COUNTER_H
#include "py/obj.h"
-#include "pcnt_handler.h"
+#include "peripherals/pcnt.h"
typedef struct {
mp_obj_base_t base;
diff --git a/ports/esp32s2/peripherals/pcnt_handler.c b/ports/esp32s2/peripherals/pcnt.c
index 5a0cc9a7c..e7eb32c1d 100644
--- a/ports/esp32s2/peripherals/pcnt_handler.c
+++ b/ports/esp32s2/peripherals/pcnt.c
@@ -24,7 +24,7 @@
* THE SOFTWARE.
*/
-#include "pcnt_handler.h"
+#include "peripherals/pcnt.h"
#include "py/runtime.h"
#include "supervisor/shared/translate.h"
@@ -34,7 +34,7 @@
static uint8_t pcnt_state[4];
-void pcnt_handler_init(pcnt_config_t* pcnt_config) {
+void peripherals_pcnt_init(pcnt_config_t* pcnt_config) {
// Look for available pcnt unit
for (uint8_t i = 0; i<=3; i++) {
if (pcnt_state[i] == PCNT_UNIT_INACTIVE) {
@@ -61,7 +61,7 @@ void pcnt_handler_init(pcnt_config_t* pcnt_config) {
pcnt_counter_resume(pcnt_config->unit);
}
-void pcnt_handler_deinit(pcnt_unit_t* unit) {
+void peripherals_pcnt_deinit(pcnt_unit_t* unit) {
pcnt_state[*unit] = PCNT_UNIT_INACTIVE;
*unit = PCNT_UNIT_MAX;
}
diff --git a/ports/esp32s2/peripherals/pcnt_handler.h b/ports/esp32s2/peripherals/pcnt.h
index f44ee1f83..64072501c 100644
--- a/ports/esp32s2/peripherals/pcnt_handler.h
+++ b/ports/esp32s2/peripherals/pcnt.h
@@ -29,7 +29,7 @@
#include "driver/pcnt.h"
-extern void pcnt_handler_init(pcnt_config_t* pcnt_config);
-extern void pcnt_handler_deinit(pcnt_unit_t* unit);
+extern void peripherals_pcnt_init(pcnt_config_t* pcnt_config);
+extern void peripherals_pcnt_deinit(pcnt_unit_t* unit);
#endif // MICROPY_INCLUDED_ESP32S2_PERIPHERALS_PCNT_HANDLER_H