From 5920ac647a66ff93fe0ec5167f71f5706c1af8f5 Mon Sep 17 00:00:00 2001 From: Kong Wai Weng Date: Fri, 28 May 2021 22:42:54 +0800 Subject: [PATCH] Modified the essential files for Maker Pi RP2040. --- .github/workflows/build.yml | 1 + .../cytron_maker_pi_rp2040/mpconfigboard.h | 13 +++++++- .../cytron_maker_pi_rp2040/mpconfigboard.mk | 8 ++--- .../boards/cytron_maker_pi_rp2040/pins.c | 31 ++++++++++++------- 4 files changed, 36 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0b23f4538e..67c93fc02b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -212,6 +212,7 @@ jobs: - "cp_sapling_m0" - "cp_sapling_m0_revb" - "cp_sapling_m0_spiflash" + - "cytron_maker_pi_rp2040" - "datalore_ip_m4" - "datum_distance" - "datum_imu" diff --git a/ports/raspberrypi/boards/cytron_maker_pi_rp2040/mpconfigboard.h b/ports/raspberrypi/boards/cytron_maker_pi_rp2040/mpconfigboard.h index efb2fc3402..341b0f619b 100644 --- a/ports/raspberrypi/boards/cytron_maker_pi_rp2040/mpconfigboard.h +++ b/ports/raspberrypi/boards/cytron_maker_pi_rp2040/mpconfigboard.h @@ -1,2 +1,13 @@ -#define MICROPY_HW_BOARD_NAME "Raspberry Pi Pico" +#define MICROPY_HW_BOARD_NAME "Cytron Maker Pi RP2040" #define MICROPY_HW_MCU_NAME "rp2040" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO18) + +#define MICROPY_HW_BAT_SENSE (&pin_GPIO29) + +#define MICROPY_HW_BUZZER (&pin_GPIO22) + +#define MICROPY_HW_MOTOR_M1A (&pin_GPIO8) +#define MICROPY_HW_MOTOR_M1B (&pin_GPIO9) +#define MICROPY_HW_MOTOR_M2A (&pin_GPIO10) +#define MICROPY_HW_MOTOR_M2B (&pin_GPIO11) diff --git a/ports/raspberrypi/boards/cytron_maker_pi_rp2040/mpconfigboard.mk b/ports/raspberrypi/boards/cytron_maker_pi_rp2040/mpconfigboard.mk index 608ca280df..6d6dc1af1b 100644 --- a/ports/raspberrypi/boards/cytron_maker_pi_rp2040/mpconfigboard.mk +++ b/ports/raspberrypi/boards/cytron_maker_pi_rp2040/mpconfigboard.mk @@ -1,7 +1,7 @@ -USB_VID = 0x239A -USB_PID = 0x80F4 -USB_PRODUCT = "Pico" -USB_MANUFACTURER = "Raspberry Pi" +USB_VID = 0x2E8A +USB_PID = 0x1000 +USB_PRODUCT = "Maker Pi RP2040" +USB_MANUFACTURER = "Cytron" CHIP_VARIANT = RP2040 CHIP_FAMILY = rp2 diff --git a/ports/raspberrypi/boards/cytron_maker_pi_rp2040/pins.c b/ports/raspberrypi/boards/cytron_maker_pi_rp2040/pins.c index 057eaec2af..20cefa591b 100644 --- a/ports/raspberrypi/boards/cytron_maker_pi_rp2040/pins.c +++ b/ports/raspberrypi/boards/cytron_maker_pi_rp2040/pins.c @@ -9,31 +9,37 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) }, { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, - { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, - { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, - { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_M1A), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_M1B), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_M2A), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_M2B), MP_ROM_PTR(&pin_GPIO11) }, { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) }, { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_RGB), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO18) }, { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) }, { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) }, { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_BUZZER), MP_ROM_PTR(&pin_GPIO22) }, { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) }, - { MP_ROM_QSTR(MP_QSTR_SMPS_MODE), MP_ROM_PTR(&pin_GPIO23) }, - { MP_ROM_QSTR(MP_QSTR_GP23), MP_ROM_PTR(&pin_GPIO23) }, - - { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO24) }, - { MP_ROM_QSTR(MP_QSTR_GP24), MP_ROM_PTR(&pin_GPIO24) }, - - { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO25) }, - { MP_ROM_QSTR(MP_QSTR_GP25), MP_ROM_PTR(&pin_GPIO25) }, - { MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) }, { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, @@ -47,6 +53,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_VBATT), MP_ROM_PTR(&pin_GPIO29) }, { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO29) }, }; MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);