rename pcnt_handler to pcnt

This commit is contained in:
microDev 2020-11-05 10:10:39 +05:30
parent fe6bfde590
commit d8ef9a127b
No known key found for this signature in database
GPG Key ID: 2C0867BE60967730
5 changed files with 10 additions and 9 deletions

View File

@ -188,7 +188,7 @@ SRC_C += \
lib/utils/pyexec.c \ lib/utils/pyexec.c \
lib/utils/stdout_helpers.c \ lib/utils/stdout_helpers.c \
lib/utils/sys_stdio_mphal.c \ lib/utils/sys_stdio_mphal.c \
peripherals/pcnt_handler.c \ peripherals/pcnt.c \
peripherals/pins.c \ peripherals/pins.c \
peripherals/rmt.c \ peripherals/rmt.c \
supervisor/shared/memory.c supervisor/shared/memory.c

View File

@ -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 .neg_mode = PCNT_COUNT_DIS, // Keep the counter value on the negative edge
}; };
// Initialize PCNT unit // Initialize PCNT unit
pcnt_handler_init(&pcnt_config); // This also sets pcnt_config.unit
peripherals_pcnt_init(&pcnt_config);
self->pin = pin->number; self->pin = pin->number;
self->unit = pcnt_config.unit; self->unit = pcnt_config.unit;
@ -57,7 +58,7 @@ void common_hal_countio_counter_deinit(countio_counter_obj_t* self) {
return; return;
} }
reset_pin_number(self->pin); 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) { mp_int_t common_hal_countio_counter_get_count(countio_counter_obj_t* self) {

View File

@ -28,7 +28,7 @@
#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_COUNTIO_COUNTER_H #define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_COUNTIO_COUNTER_H
#include "py/obj.h" #include "py/obj.h"
#include "pcnt_handler.h" #include "peripherals/pcnt.h"
typedef struct { typedef struct {
mp_obj_base_t base; mp_obj_base_t base;

View File

@ -24,7 +24,7 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include "pcnt_handler.h" #include "peripherals/pcnt.h"
#include "py/runtime.h" #include "py/runtime.h"
#include "supervisor/shared/translate.h" #include "supervisor/shared/translate.h"
@ -34,7 +34,7 @@
static uint8_t pcnt_state[4]; 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 // Look for available pcnt unit
for (uint8_t i = 0; i<=3; i++) { for (uint8_t i = 0; i<=3; i++) {
if (pcnt_state[i] == PCNT_UNIT_INACTIVE) { 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); 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; pcnt_state[*unit] = PCNT_UNIT_INACTIVE;
*unit = PCNT_UNIT_MAX; *unit = PCNT_UNIT_MAX;
} }

View File

@ -29,7 +29,7 @@
#include "driver/pcnt.h" #include "driver/pcnt.h"
extern void pcnt_handler_init(pcnt_config_t* pcnt_config); extern void peripherals_pcnt_init(pcnt_config_t* pcnt_config);
extern void pcnt_handler_deinit(pcnt_unit_t* unit); extern void peripherals_pcnt_deinit(pcnt_unit_t* unit);
#endif // MICROPY_INCLUDED_ESP32S2_PERIPHERALS_PCNT_HANDLER_H #endif // MICROPY_INCLUDED_ESP32S2_PERIPHERALS_PCNT_HANDLER_H