Skip to content

Commit

Permalink
ports/psoc6: Cleanup of previous machine_pin implementation.
Browse files Browse the repository at this point in the history
Signed-off-by: enriquezgarc <enriquezgarcia.external@infineon.com>
  • Loading branch information
jaenrig-ifx committed Oct 17, 2023
1 parent dcd83b4 commit 8a5eac8
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 16 deletions.
1 change: 1 addition & 0 deletions ports/psoc6/modules/machine/machine_adc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions ports/psoc6/modules/machine/machine_adcblock.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions ports/psoc6/modules/machine/machine_pin.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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}},
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
}
Expand Down
9 changes: 0 additions & 9 deletions ports/psoc6/modules/machine/machine_pin.h

This file was deleted.

2 changes: 1 addition & 1 deletion ports/psoc6/mphalport.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions ports/psoc6/mphalport.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// port-specific includes



#define MP_HAL_PIN_FMT "%u"
#define mp_hal_pin_obj_t uint

Expand Down

0 comments on commit 8a5eac8

Please sign in to comment.