From a85246c2f7aac3837027b7aea306c3906d17b82a Mon Sep 17 00:00:00 2001 From: NikhitaR-IFX Date: Mon, 12 Feb 2024 18:04:23 +0530 Subject: [PATCH] ports/psoc6: Commenting out invert functionality. Signed-off-by: NikhitaR-IFX --- ports/psoc6/machine_pwm.c | 9 +++++---- tests/psoc6/pwm.py | 2 +- tests/psoc6/pwm.py.exp | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ports/psoc6/machine_pwm.c b/ports/psoc6/machine_pwm.c index 423fc40ec7d27..1b411b093fdbb 100644 --- a/ports/psoc6/machine_pwm.c +++ b/ports/psoc6/machine_pwm.c @@ -15,7 +15,7 @@ typedef struct _machine_pwm_obj_t { uint32_t fz; uint8_t duty_type; mp_int_t duty; - bool invert; + // bool invert; } machine_pwm_obj_t; static machine_pwm_obj_t *pwm_obj[MAX_PWM_OBJS] = { NULL }; @@ -79,12 +79,13 @@ STATIC inline cy_rslt_t pwm_duty_set_ns(cyhal_pwm_t *pwm_obj, uint32_t fz, uint3 STATIC void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { machine_pwm_obj_t *self = MP_OBJ_TO_PTR(self_in); - mp_printf(print, "frequency=%u duty_cycle=%f invert=%u", self->fz, (double)self->duty, self->invert); + mp_printf(print, "frequency=%u duty_cycle=%f", self->fz, (double)self->duty); } STATIC void mp_machine_pwm_init_helper(machine_pwm_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum { ARG_freq, ARG_duty_u16, ARG_duty_ns, ARG_invert }; + enum { ARG_freq, ARG_duty_u16, ARG_duty_ns}; + // enum { ARG_freq, ARG_duty_u16, ARG_duty_ns, ARG_invert }; static const mp_arg_t allowed_args[] = { { MP_QSTR_freq, MP_ARG_INT, {.u_int = VALUE_NOT_SET} }, { MP_QSTR_duty_u16, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = VALUE_NOT_SET} }, @@ -141,7 +142,7 @@ STATIC mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args pwm_pin_alloc(self, all_args[0]); self->duty_type = DUTY_NOT_SET; self->fz = -1; - self->invert = -1; + // self->invert = -1; // Initialize PWM cy_rslt_t result = cyhal_pwm_init(&self->pwm_obj, self->pin->addr, NULL); diff --git a/tests/psoc6/pwm.py b/tests/psoc6/pwm.py index 5ed63e403e35e..16aeafa992207 100644 --- a/tests/psoc6/pwm.py +++ b/tests/psoc6/pwm.py @@ -9,7 +9,7 @@ elif "CY8CPROTO-063-BLE" in machine: pin_name = "P6_3" -pwm = PWM(pin_name, freq=50, duty_u16=8192, invert=0) +pwm = PWM(pin_name, freq=50, duty_u16=8192) print(pwm) print(pwm.freq()) print(pwm.duty_u16()) diff --git a/tests/psoc6/pwm.py.exp b/tests/psoc6/pwm.py.exp index bad68c2adcdb7..e74c028c06a33 100644 --- a/tests/psoc6/pwm.py.exp +++ b/tests/psoc6/pwm.py.exp @@ -1,4 +1,4 @@ -frequency=50 duty_cycle=8192.000000 invert=0 +frequency=50 duty_cycle=8192.000000 50 8192.0 1000.0