rename pcnt_handler to pcnt
This commit is contained in:
parent
fe6bfde590
commit
d8ef9a127b
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
@ -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
|
Loading…
Reference in New Issue
Block a user