2019-01-07 17:50:09 -05:00
|
|
|
#include "shared-bindings/board/__init__.h"
|
|
|
|
|
2019-01-09 13:19:07 -05:00
|
|
|
#include "boards/board.h"
|
2019-01-17 03:20:16 -05:00
|
|
|
#include "supervisor/shared/board_busses.h"
|
2019-01-07 17:50:09 -05:00
|
|
|
|
|
|
|
// This mapping only includes functional names because pins broken
|
|
|
|
// out on connectors are labeled with their MCU name available from
|
|
|
|
// microcontroller.pin.
|
|
|
|
STATIC const mp_map_elem_t board_global_dict_table[] = {
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_AUDIO_OUT), (mp_obj_t)&pin_PA02 },
|
2019-01-16 01:49:12 -05:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_A0), (mp_obj_t)&pin_PA02 }, // analog out/in
|
2019-01-07 17:50:09 -05:00
|
|
|
|
2019-01-16 01:49:12 -05:00
|
|
|
// STEMMA connectors
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_A1), (mp_obj_t)&pin_PB02 }, // SDA
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_A2), (mp_obj_t)&pin_PB03 }, // SCL
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_A3), (mp_obj_t)&pin_PB00 }, // D3
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_D3), (mp_obj_t)&pin_PB00 }, // D3
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_A4), (mp_obj_t)&pin_PB01 }, // D4
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_D4), (mp_obj_t)&pin_PB01 }, // D4
|
|
|
|
|
|
|
|
// Indicator LED
|
2019-01-07 17:50:09 -05:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_D13), (mp_obj_t)&pin_PA27 },
|
2019-01-16 01:49:12 -05:00
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_L), (mp_obj_t)&pin_PA27 },
|
|
|
|
{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in_PA23 },
|
|
|
|
|
|
|
|
// Touch pins
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_TOUCH_YD), (mp_obj_t)&pin_PA04 },
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_TOUCH_XL), (mp_obj_t)&pin_PA05 },
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_TOUCH_YU), (mp_obj_t)&pin_PA06 },
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_TOUCH_XR), (mp_obj_t)&pin_PB08 },
|
|
|
|
|
|
|
|
// ESP control
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_CS), (mp_obj_t)&pin_PA15 },
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_BUSY), (mp_obj_t)&pin_PB14 },
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_GPIO0), (mp_obj_t)&pin_PB15 },
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RESET), (mp_obj_t)&pin_PB16 },
|
|
|
|
|
2019-01-16 01:49:12 -05:00
|
|
|
// UART
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_TX), (mp_obj_t)&pin_PB12 },
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_RX), (mp_obj_t)&pin_PB13 },
|
|
|
|
|
|
|
|
// SPI
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), (mp_obj_t)&pin_PA12 },
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_SCK), (mp_obj_t)&pin_PA13 },
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_MISO), (mp_obj_t)&pin_PA14 },
|
|
|
|
|
|
|
|
// I2C
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_SDA), (mp_obj_t)&pin_PB02 },
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_SCL), (mp_obj_t)&pin_PB03 },
|
2019-01-07 17:50:09 -05:00
|
|
|
|
|
|
|
// SD Card
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_SD_CS), (mp_obj_t)&pin_PB30 },
|
|
|
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_SD_CARD_DETECT), (mp_obj_t)&pin_PA01 },
|
|
|
|
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
|
2019-01-16 01:49:12 -05:00
|
|
|
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
|
2019-01-07 17:50:09 -05:00
|
|
|
};
|
|
|
|
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
|