Skip to content

Commit c5c0de5

Browse files
committed
Also add convenience constants for the RP2040 GPIO pin names
1 parent faac034 commit c5c0de5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

components/driver_mch22/modmch22.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ static mp_obj_t read_vusb() {
307307
}
308308
static MP_DEFINE_CONST_FUN_OBJ_0(read_vusb_obj, read_vusb);
309309

310+
typedef enum {SAO_IO0_PIN, SAO_IO1_PIN, PROTO_0_PIN, PROTO_1_PIN} gpio_name_t;
310311

311312
STATIC const mp_rom_map_elem_t mch22_module_globals_table[] = {
312313
{MP_ROM_QSTR(MP_QSTR_buttons), MP_ROM_PTR(&buttons_obj)},
@@ -329,6 +330,11 @@ STATIC const mp_rom_map_elem_t mch22_module_globals_table[] = {
329330
{MP_ROM_QSTR(MP_QSTR_exit_python), MP_ROM_PTR(&mch22_return_to_launcher_obj)},
330331
{MP_ROM_QSTR(MP_QSTR_read_vbat), MP_ROM_PTR(&read_vbat_obj)},
331332
{MP_ROM_QSTR(MP_QSTR_read_vusb), MP_ROM_PTR(&read_vusb_obj)},
333+
334+
{ MP_ROM_QSTR(MP_QSTR_SAO_IO0_PIN), MP_ROM_INT(SAO_IO0_PIN) },
335+
{ MP_ROM_QSTR(MP_QSTR_SAO_IO1_PIN), MP_ROM_INT(SAO_IO1_PIN) },
336+
{ MP_ROM_QSTR(MP_QSTR_PROTO_0_PIN), MP_ROM_INT(PROTO_0_PIN) },
337+
{ MP_ROM_QSTR(MP_QSTR_PROTO_1_PIN), MP_ROM_INT(PROTO_1_PIN) },
332338
};
333339

334340
STATIC MP_DEFINE_CONST_DICT(mch22_module_globals, mch22_module_globals_table);

0 commit comments

Comments
 (0)