Skip to content

Commit

Permalink
ports/psoc6: Commenting out invert functionality.
Browse files Browse the repository at this point in the history
Signed-off-by: NikhitaR-IFX <Nikhita.Rajasekhar@infineon.com>
  • Loading branch information
NikhitaR-IFX authored and actions-user committed Feb 21, 2024
1 parent 01170bd commit 93f4c32
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions ports/psoc6/machine_pwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down Expand Up @@ -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} },
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tests/psoc6/pwm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion tests/psoc6/pwm.py.exp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
frequency=50 duty_cycle=8192.000000 invert=0
frequency=50 duty_cycle=8192.000000
50
8192.0
1000.0

0 comments on commit 93f4c32

Please sign in to comment.