Skip to content

Commit d8ef9a1

Browse files
committed
rename pcnt_handler to pcnt
1 parent fe6bfde commit d8ef9a1

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

ports/esp32s2/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ SRC_C += \
188188
lib/utils/pyexec.c \
189189
lib/utils/stdout_helpers.c \
190190
lib/utils/sys_stdio_mphal.c \
191-
peripherals/pcnt_handler.c \
191+
peripherals/pcnt.c \
192192
peripherals/pins.c \
193193
peripherals/rmt.c \
194194
supervisor/shared/memory.c

ports/esp32s2/common-hal/countio/Counter.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ void common_hal_countio_counter_construct(countio_counter_obj_t* self,
4242
.neg_mode = PCNT_COUNT_DIS, // Keep the counter value on the negative edge
4343
};
4444
// Initialize PCNT unit
45-
pcnt_handler_init(&pcnt_config);
45+
// This also sets pcnt_config.unit
46+
peripherals_pcnt_init(&pcnt_config);
4647

4748
self->pin = pin->number;
4849
self->unit = pcnt_config.unit;
@@ -57,7 +58,7 @@ void common_hal_countio_counter_deinit(countio_counter_obj_t* self) {
5758
return;
5859
}
5960
reset_pin_number(self->pin);
60-
pcnt_handler_deinit(&self->unit);
61+
peripherals_pcnt_deinit(&self->unit);
6162
}
6263

6364
mp_int_t common_hal_countio_counter_get_count(countio_counter_obj_t* self) {

ports/esp32s2/common-hal/countio/Counter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_COUNTIO_COUNTER_H
2929

3030
#include "py/obj.h"
31-
#include "pcnt_handler.h"
31+
#include "peripherals/pcnt.h"
3232

3333
typedef struct {
3434
mp_obj_base_t base;

ports/esp32s2/peripherals/pcnt_handler.c renamed to ports/esp32s2/peripherals/pcnt.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* THE SOFTWARE.
2525
*/
2626

27-
#include "pcnt_handler.h"
27+
#include "peripherals/pcnt.h"
2828

2929
#include "py/runtime.h"
3030
#include "supervisor/shared/translate.h"
@@ -34,7 +34,7 @@
3434

3535
static uint8_t pcnt_state[4];
3636

37-
void pcnt_handler_init(pcnt_config_t* pcnt_config) {
37+
void peripherals_pcnt_init(pcnt_config_t* pcnt_config) {
3838
// Look for available pcnt unit
3939
for (uint8_t i = 0; i<=3; i++) {
4040
if (pcnt_state[i] == PCNT_UNIT_INACTIVE) {
@@ -61,7 +61,7 @@ void pcnt_handler_init(pcnt_config_t* pcnt_config) {
6161
pcnt_counter_resume(pcnt_config->unit);
6262
}
6363

64-
void pcnt_handler_deinit(pcnt_unit_t* unit) {
64+
void peripherals_pcnt_deinit(pcnt_unit_t* unit) {
6565
pcnt_state[*unit] = PCNT_UNIT_INACTIVE;
6666
*unit = PCNT_UNIT_MAX;
6767
}

ports/esp32s2/peripherals/pcnt_handler.h renamed to ports/esp32s2/peripherals/pcnt.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
#include "driver/pcnt.h"
3131

32-
extern void pcnt_handler_init(pcnt_config_t* pcnt_config);
33-
extern void pcnt_handler_deinit(pcnt_unit_t* unit);
32+
extern void peripherals_pcnt_init(pcnt_config_t* pcnt_config);
33+
extern void peripherals_pcnt_deinit(pcnt_unit_t* unit);
3434

3535
#endif // MICROPY_INCLUDED_ESP32S2_PERIPHERALS_PCNT_HANDLER_H

0 commit comments

Comments
 (0)