From f1bd703f6bf78b15435c894998cf907db468b77b Mon Sep 17 00:00:00 2001 From: enriquezgarc Date: Tue, 7 Nov 2023 10:44:30 +0100 Subject: [PATCH] ports/psoc6/machine_pwm.c: Resolving merge conflicts. Signed-off-by: enriquezgarc --- ports/psoc6/modules/machine/machine_pwm.c | 48 ----------------------- 1 file changed, 48 deletions(-) diff --git a/ports/psoc6/modules/machine/machine_pwm.c b/ports/psoc6/modules/machine/machine_pwm.c index 1d02809eb14f5..41857a1418d0f 100644 --- a/ports/psoc6/modules/machine/machine_pwm.c +++ b/ports/psoc6/modules/machine/machine_pwm.c @@ -56,54 +56,6 @@ STATIC inline void pwm_pin_free(machine_pwm_obj_t *pwm_obj) { pin_phy_free(pwm_obj->pin); } -typedef struct _machine_pwm_obj_t { - mp_obj_base_t base; - cyhal_pwm_t pwm_obj; - machine_pin_phy_obj_t *pin; - uint32_t fz; - uint8_t duty_type; - mp_float_t duty; - bool invert; -} machine_pwm_obj_t; - -static machine_pwm_obj_t *pwm_obj[MAX_PWM_OBJS] = { NULL }; - -STATIC inline machine_pwm_obj_t *pwm_obj_alloc() { - for (uint8_t i = 0; i < MAX_PWM_OBJS; i++) - { - if (pwm_obj[i] == NULL) { - pwm_obj[i] = mp_obj_malloc(machine_pwm_obj_t, &machine_pwm_type); - return pwm_obj[i]; - } - } - - return NULL; -} - -STATIC inline void pwm_obj_free(machine_pwm_obj_t *pwm_obj_ptr) { - for (uint8_t i = 0; i < MAX_PWM_OBJS; i++) - { - if (pwm_obj[i] == pwm_obj_ptr) { - pwm_obj[i] = NULL; - } - } -} - -STATIC inline void pwm_pin_alloc(machine_pwm_obj_t *pwm_obj, mp_obj_t pin_name) { - machine_pin_phy_obj_t *pin = pin_phy_realloc(pin_name, PIN_PHY_FUNC_PWM); - - if (pin == NULL) { - size_t slen; - mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("PWM pin (%s) not found !"), mp_obj_str_get_data(pin_name, &slen)); - } - - pwm_obj->pin = pin; -} - -STATIC inline void pwm_pin_free(machine_pwm_obj_t *pwm_obj) { - pin_phy_free(pwm_obj->pin); -} - enum { VALUE_NOT_SET = -1, DUTY_NOT_SET = 0,