From b0751c1304ec3b6d835a36faf1df397ce697e317 Mon Sep 17 00:00:00 2001 From: enriquezgarc Date: Fri, 13 Oct 2023 10:54:02 +0200 Subject: [PATCH] ports/psoc6: Cleanup of previous machine_pin implementation. Signed-off-by: enriquezgarc --- ports/psoc6/modules/machine/machine_adc.h | 1 + ports/psoc6/modules/machine/machine_adcblock.h | 2 -- ports/psoc6/modules/machine/machine_pin.c | 8 ++++---- ports/psoc6/modules/machine/machine_pin.h | 9 --------- ports/psoc6/mphalport.c | 2 +- ports/psoc6/mphalport.h | 1 + 6 files changed, 7 insertions(+), 16 deletions(-) delete mode 100644 ports/psoc6/modules/machine/machine_pin.h diff --git a/ports/psoc6/modules/machine/machine_adc.h b/ports/psoc6/modules/machine/machine_adc.h index 4df04cfff6a1b..4d37d70fdb2f4 100644 --- a/ports/psoc6/modules/machine/machine_adc.h +++ b/ports/psoc6/modules/machine/machine_adc.h @@ -2,6 +2,7 @@ #define MICROPY_INCLUDED_MACHINE_ADC_H #include "machine_adcblock.h" +#include "machine_pin_phy.h" typedef struct _machine_adc_obj_t { mp_obj_base_t base; diff --git a/ports/psoc6/modules/machine/machine_adcblock.h b/ports/psoc6/modules/machine/machine_adcblock.h index 9e5c6727d9d93..1d65ec441e672 100644 --- a/ports/psoc6/modules/machine/machine_adcblock.h +++ b/ports/psoc6/modules/machine/machine_adcblock.h @@ -11,8 +11,6 @@ #define MAX_BLOCKS (1) #define MAX_CHANNELS (6) -#include "machine_pin.h" - typedef struct _machine_adc_obj_t machine_adc_obj_t; /* Forward declaration of adc_obj */ typedef struct _machine_adcblock_obj_t { diff --git a/ports/psoc6/modules/machine/machine_pin.c b/ports/psoc6/modules/machine/machine_pin.c index 01938fb1d68f4..8b1f8b08557b1 100644 --- a/ports/psoc6/modules/machine/machine_pin.c +++ b/ports/psoc6/modules/machine/machine_pin.c @@ -4,7 +4,7 @@ // port-specific includes #include "modmachine.h" -#include "machine_pin.h" +#include "machine_pin_phy.h" #include "extmod/virtpin.h" #include "mplogger.h" #include "cyhal.h" @@ -178,7 +178,7 @@ static bool machine_pin_is_inited(machine_pin_io_obj_t *self) { STATIC mp_obj_t machine_pin_obj_init_helper(machine_pin_io_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { mplogger_print("init helper function called\n"); - enum {ARG_mode, ARG_pull, ARG_value, ARG_drive}; // , ARG_alt}; + enum {ARG_mode, ARG_pull, ARG_value}; static const mp_arg_t allowed_args[] = { {MP_QSTR_mode, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE}}, {MP_QSTR_pull, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE}}, @@ -223,7 +223,7 @@ STATIC mp_obj_t machine_pin_obj_init_helper(machine_pin_io_obj_t *self, size_t n } // Machine Pin methods - port-specific definitions -// Pin constructor(id,mode,pull,value=value,drive=drive,alt=alt) +// Pin constructor(id,mode,pull,value=value) mp_obj_t mp_pin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mplogger_print("%q constructor invoked\n", MP_QSTR_Pin); @@ -272,7 +272,7 @@ STATIC mp_obj_t machine_pin_value(size_t n_args, const mp_obj_t *args) { STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pin_value_obj, 1, 2, machine_pin_value); // instantiates obj of Pin class -// Pin.init(mode,pull,value=value,drive=drive,alt=alt) +// Pin.init(mode,pull,value=value) STATIC mp_obj_t machine_pin_obj_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) { return machine_pin_obj_init_helper(args[0], n_args - 1, args + 1, kw_args); } diff --git a/ports/psoc6/modules/machine/machine_pin.h b/ports/psoc6/modules/machine/machine_pin.h deleted file mode 100644 index 4fd411532646a..0000000000000 --- a/ports/psoc6/modules/machine/machine_pin.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef MICROPY_INCLUDED_MACHINE_PIN_H -#define MICROPY_INCLUDED_MACHINE_PIN_H - -#include -#include "machine_pin_phy.h" - -void mod_pin_deinit(); - -#endif // MICROPY_INCLUDED_MACHINE_PIN_H diff --git a/ports/psoc6/mphalport.c b/ports/psoc6/mphalport.c index 5acc2e20ef150..b13096b06d0dc 100644 --- a/ports/psoc6/mphalport.c +++ b/ports/psoc6/mphalport.c @@ -16,7 +16,7 @@ // port-specific includes -#include "modules/machine/machine_pin.h" +#include "modules/machine/machine_pin_phy.h" extern cyhal_rtc_t psoc6_rtc; extern cyhal_timer_t psoc6_timer; diff --git a/ports/psoc6/mphalport.h b/ports/psoc6/mphalport.h index a09eeaa9960ef..e266a7b2727f5 100644 --- a/ports/psoc6/mphalport.h +++ b/ports/psoc6/mphalport.h @@ -15,6 +15,7 @@ // port-specific includes + #define MP_HAL_PIN_FMT "%u" #define mp_hal_pin_obj_t uint