From 38243cd8e0792fd6e597e4761f9d9949a9d41599 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 4 May 2023 12:58:04 +1000 Subject: [PATCH] extmod/machine_pwm: Remove PWM_INIT and PWM_DUTY_U16_NS config options. All ports that enable MICROPY_PY_MACHINE_PWM now enable these two sub-options, so remove these sub-options altogether to force consistency in new ports that implement machine.PWM. Signed-off-by: Damien George --- extmod/machine_pwm.c | 10 ---------- ports/esp32/mpconfigport.h | 2 -- ports/esp8266/mpconfigport.h | 2 -- ports/mimxrt/mpconfigport.h | 2 -- ports/nrf/mpconfigport.h | 2 -- ports/rp2/mpconfigport.h | 2 -- ports/samd/mpconfigport.h | 2 -- 7 files changed, 22 deletions(-) diff --git a/extmod/machine_pwm.c b/extmod/machine_pwm.c index 220d34d7da..8a633b3793 100644 --- a/extmod/machine_pwm.c +++ b/extmod/machine_pwm.c @@ -34,13 +34,11 @@ #include MICROPY_PY_MACHINE_PWM_INCLUDEFILE #endif -#if MICROPY_PY_MACHINE_PWM_INIT STATIC mp_obj_t machine_pwm_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) { mp_machine_pwm_init_helper(args[0], n_args - 1, args + 1, kw_args); return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_pwm_init_obj, 1, machine_pwm_init); -#endif // PWM.deinit() STATIC mp_obj_t machine_pwm_deinit(mp_obj_t self_in) { @@ -82,8 +80,6 @@ STATIC mp_obj_t machine_pwm_duty(size_t n_args, const mp_obj_t *args) { STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pwm_duty_obj, 1, 2, machine_pwm_duty); #endif -#if MICROPY_PY_MACHINE_PWM_DUTY_U16_NS - // PWM.duty_u16([value]) STATIC mp_obj_t machine_pwm_duty_u16(size_t n_args, const mp_obj_t *args) { machine_pwm_obj_t *self = MP_OBJ_TO_PTR(args[0]); @@ -114,21 +110,15 @@ STATIC mp_obj_t machine_pwm_duty_ns(size_t n_args, const mp_obj_t *args) { } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pwm_duty_ns_obj, 1, 2, machine_pwm_duty_ns); -#endif - STATIC const mp_rom_map_elem_t machine_pwm_locals_dict_table[] = { - #if MICROPY_PY_MACHINE_PWM_INIT { MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_pwm_init_obj) }, - #endif { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&machine_pwm_deinit_obj) }, { MP_ROM_QSTR(MP_QSTR_freq), MP_ROM_PTR(&machine_pwm_freq_obj) }, #if MICROPY_PY_MACHINE_PWM_DUTY { MP_ROM_QSTR(MP_QSTR_duty), MP_ROM_PTR(&machine_pwm_duty_obj) }, #endif - #if MICROPY_PY_MACHINE_PWM_DUTY_U16_NS { MP_ROM_QSTR(MP_QSTR_duty_u16), MP_ROM_PTR(&machine_pwm_duty_u16_obj) }, { MP_ROM_QSTR(MP_QSTR_duty_ns), MP_ROM_PTR(&machine_pwm_duty_ns_obj) }, - #endif }; STATIC MP_DEFINE_CONST_DICT(machine_pwm_locals_dict, machine_pwm_locals_dict_table); diff --git a/ports/esp32/mpconfigport.h b/ports/esp32/mpconfigport.h index 807ae23b0c..ea3487bcd8 100644 --- a/ports/esp32/mpconfigport.h +++ b/ports/esp32/mpconfigport.h @@ -98,9 +98,7 @@ #define MICROPY_PY_MACHINE_BITSTREAM (1) #define MICROPY_PY_MACHINE_PULSE (1) #define MICROPY_PY_MACHINE_PWM (1) -#define MICROPY_PY_MACHINE_PWM_INIT (1) #define MICROPY_PY_MACHINE_PWM_DUTY (1) -#define MICROPY_PY_MACHINE_PWM_DUTY_U16_NS (1) #define MICROPY_PY_MACHINE_PWM_INCLUDEFILE "ports/esp32/machine_pwm.c" #define MICROPY_PY_MACHINE_I2C (1) #define MICROPY_PY_MACHINE_I2C_TRANSFER_WRITE1 (1) diff --git a/ports/esp8266/mpconfigport.h b/ports/esp8266/mpconfigport.h index 54549614e5..12ea3716d4 100644 --- a/ports/esp8266/mpconfigport.h +++ b/ports/esp8266/mpconfigport.h @@ -66,9 +66,7 @@ #define MICROPY_PY_MACHINE_BITSTREAM (1) #define MICROPY_PY_MACHINE_PULSE (1) #define MICROPY_PY_MACHINE_PWM (1) -#define MICROPY_PY_MACHINE_PWM_INIT (1) #define MICROPY_PY_MACHINE_PWM_DUTY (1) -#define MICROPY_PY_MACHINE_PWM_DUTY_U16_NS (1) #define MICROPY_PY_MACHINE_PWM_INCLUDEFILE "ports/esp8266/machine_pwm.c" #define MICROPY_PY_MACHINE_I2C (1) #define MICROPY_PY_MACHINE_SOFTI2C (1) diff --git a/ports/mimxrt/mpconfigport.h b/ports/mimxrt/mpconfigport.h index b1fdf14f22..1dd7711efe 100644 --- a/ports/mimxrt/mpconfigport.h +++ b/ports/mimxrt/mpconfigport.h @@ -83,8 +83,6 @@ uint32_t trng_random_u32(void); #define MICROPY_PY_MACHINE_BITSTREAM (1) #define MICROPY_PY_MACHINE_PULSE (1) #define MICROPY_PY_MACHINE_PWM (1) -#define MICROPY_PY_MACHINE_PWM_INIT (1) -#define MICROPY_PY_MACHINE_PWM_DUTY_U16_NS (1) #define MICROPY_PY_MACHINE_PWM_INCLUDEFILE "ports/mimxrt/machine_pwm.c" #define MICROPY_PY_MACHINE_I2C (1) #ifndef MICROPY_PY_MACHINE_I2S diff --git a/ports/nrf/mpconfigport.h b/ports/nrf/mpconfigport.h index a3ceb023ee..23f7e560dc 100644 --- a/ports/nrf/mpconfigport.h +++ b/ports/nrf/mpconfigport.h @@ -197,9 +197,7 @@ #define MICROPY_PY_MACHINE_SOFT_PWM (0) #endif -#define MICROPY_PY_MACHINE_PWM_INIT (1) #define MICROPY_PY_MACHINE_PWM_DUTY (1) -#define MICROPY_PY_MACHINE_PWM_DUTY_U16_NS (1) #if MICROPY_PY_MACHINE_HW_PWM #define MICROPY_PY_MACHINE_PWM_INCLUDEFILE "ports/nrf/modules/machine/pwm.c" diff --git a/ports/rp2/mpconfigport.h b/ports/rp2/mpconfigport.h index 653b51091a..b4487a23d7 100644 --- a/ports/rp2/mpconfigport.h +++ b/ports/rp2/mpconfigport.h @@ -114,8 +114,6 @@ #define MICROPY_PY_MACHINE_BITSTREAM (1) #define MICROPY_PY_MACHINE_PULSE (1) #define MICROPY_PY_MACHINE_PWM (1) -#define MICROPY_PY_MACHINE_PWM_INIT (1) -#define MICROPY_PY_MACHINE_PWM_DUTY_U16_NS (1) #define MICROPY_PY_MACHINE_PWM_INCLUDEFILE "ports/rp2/machine_pwm.c" #define MICROPY_PY_MACHINE_I2C (1) #define MICROPY_PY_MACHINE_SOFTI2C (1) diff --git a/ports/samd/mpconfigport.h b/ports/samd/mpconfigport.h index 6ed8186ec0..bc1ad3d988 100644 --- a/ports/samd/mpconfigport.h +++ b/ports/samd/mpconfigport.h @@ -107,8 +107,6 @@ #define MICROPY_PY_MACHINE_BITSTREAM (1) #define MICROPY_PY_MACHINE_PULSE (1) #define MICROPY_PY_MACHINE_PWM (1) -#define MICROPY_PY_MACHINE_PWM_INIT (1) -#define MICROPY_PY_MACHINE_PWM_DUTY_U16_NS (1) #define MICROPY_PY_MACHINE_PWM_INCLUDEFILE "ports/samd/machine_pwm.c" #define MICROPY_PY_MACHINE_PIN_MAKE_NEW mp_pin_make_new