Skip to content

Commit

Permalink
rp2: Add support for 48-pin RP2350 variant.
Browse files Browse the repository at this point in the history
Update NUM_GPIOS to match NUM_BANK0_GPIOS, and increase bit-width of
variables that store pin numbers.

Signed-off-by: Phil Howard <[email protected]>
  • Loading branch information
Gadgetoid authored and dpgeorge committed Oct 15, 2024
1 parent d2c85c7 commit 6d39418
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ports/rp2/boards/make-pins.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import boardgen

# This is NUM_BANK0_GPIOS. Pin indices are 0 to 29 (inclusive).
NUM_GPIOS = 30
NUM_GPIOS = 48
# Up to 32 additional extended pins (e.g. via the wifi chip or io expanders).
NUM_EXT_GPIOS = 32

Expand Down
2 changes: 1 addition & 1 deletion ports/rp2/machine_pin.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ static const mp_irq_methods_t machine_pin_irq_methods;
extern const machine_pin_obj_t machine_pin_obj_table[NUM_BANK0_GPIOS];

// Mask with "1" indicating that the corresponding pin is in simulated open-drain mode.
uint32_t machine_pin_open_drain_mask;
uint64_t machine_pin_open_drain_mask;

#if MICROPY_HW_PIN_EXT_COUNT
static inline bool is_ext_pin(__unused const machine_pin_obj_t *self) {
Expand Down
2 changes: 1 addition & 1 deletion ports/rp2/machine_pin.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ typedef struct _machine_pin_af_obj_t {
typedef struct _machine_pin_obj_t {
mp_obj_base_t base;
qstr name;
uint8_t id : 5;
uint8_t id : 6;
#if MICROPY_HW_PIN_EXT_COUNT
uint8_t is_ext : 1;
uint8_t is_output : 1;
Expand Down
2 changes: 1 addition & 1 deletion ports/rp2/mphalport.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ static inline mp_uint_t mp_hal_get_cpu_freq(void) {
#define MP_HAL_PIN_PULL_UP (1)
#define MP_HAL_PIN_PULL_DOWN (2)

extern uint32_t machine_pin_open_drain_mask;
extern uint64_t machine_pin_open_drain_mask;

mp_hal_pin_obj_t mp_hal_get_pin_obj(mp_obj_t pin_in);

Expand Down

0 comments on commit 6d39418

Please sign in to comment.