|
| 1 | +// This file is part of the CircuitPython project: https://circuitpython.org |
| 2 | +// |
| 3 | +// SPDX-FileCopyrightText: Copyright (c) 2020 Scott Shawcroft for Adafruit Industries |
| 4 | +// |
| 5 | +// SPDX-License-Identifier: MIT |
| 6 | + |
| 7 | +#include "shared-bindings/board/__init__.h" |
| 8 | +#include "shared-module/displayio/__init__.h" |
| 9 | + |
| 10 | +CIRCUITPY_BOARD_BUS_SINGLETON(tf_spi, spi, 0) |
| 11 | +CIRCUITPY_BOARD_BUS_SINGLETON(epd_spi, spi, 1) |
| 12 | + |
| 13 | + |
| 14 | +static const mp_rom_map_elem_t board_module_globals_table[] = { |
| 15 | + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS |
| 16 | + |
| 17 | + // Buttons |
| 18 | + { MP_ROM_QSTR(MP_QSTR_BUTTON_BOOT), MP_ROM_PTR(&pin_GPIO0) }, |
| 19 | + { MP_ROM_QSTR(MP_QSTR_BUTTON_EXIT), MP_ROM_PTR(&pin_GPIO1) }, |
| 20 | + { MP_ROM_QSTR(MP_QSTR_BUTTON_MENU), MP_ROM_PTR(&pin_GPIO2) }, |
| 21 | + |
| 22 | + // Rocker Switch |
| 23 | + { MP_ROM_QSTR(MP_QSTR_ROCKER_DOWN), MP_ROM_PTR(&pin_GPIO4) }, |
| 24 | + { MP_ROM_QSTR(MP_QSTR_ROCKER_CLICK), MP_ROM_PTR(&pin_GPIO5) }, |
| 25 | + { MP_ROM_QSTR(MP_QSTR_ROCKER_UP), MP_ROM_PTR(&pin_GPIO6) }, |
| 26 | + |
| 27 | + // LED |
| 28 | + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO41) }, |
| 29 | + |
| 30 | + // Device Control (Pins that, when activated, enable devices) |
| 31 | + { MP_ROM_QSTR(MP_QSTR_EPD_ENABLE), MP_ROM_PTR(&pin_GPIO7) }, |
| 32 | + { MP_ROM_QSTR(MP_QSTR_TF_ENABLE), MP_ROM_PTR(&pin_GPIO42) }, |
| 33 | + |
| 34 | + // EPD |
| 35 | + { MP_ROM_QSTR(MP_QSTR_EPD_BUSY), MP_ROM_PTR(&pin_GPIO48) }, |
| 36 | + { MP_ROM_QSTR(MP_QSTR_EPD_RES), MP_ROM_PTR(&pin_GPIO47) }, |
| 37 | + { MP_ROM_QSTR(MP_QSTR_EPD_DC), MP_ROM_PTR(&pin_GPIO46) }, |
| 38 | + { MP_ROM_QSTR(MP_QSTR_EPD_CS), MP_ROM_PTR(&pin_GPIO45) }, |
| 39 | + { MP_ROM_QSTR(MP_QSTR_EPD_CLK), MP_ROM_PTR(&pin_GPIO12) }, |
| 40 | + { MP_ROM_QSTR(MP_QSTR_EPD_MOSI), MP_ROM_PTR(&pin_GPIO10) }, |
| 41 | + |
| 42 | + // TF Slot |
| 43 | + { MP_ROM_QSTR(MP_QSTR_TF_CS), MP_ROM_PTR(&pin_GPIO10) }, |
| 44 | + { MP_ROM_QSTR(MP_QSTR_TF_MOSI), MP_ROM_PTR(&pin_GPIO40) }, |
| 45 | + { MP_ROM_QSTR(MP_QSTR_TF_CLK), MP_ROM_PTR(&pin_GPIO39) }, |
| 46 | + { MP_ROM_QSTR(MP_QSTR_TF_MISO), MP_ROM_PTR(&pin_GPIO13) }, |
| 47 | + |
| 48 | + // User accessible GPIO |
| 49 | + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, |
| 50 | + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, |
| 51 | + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, |
| 52 | + { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, |
| 53 | + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, |
| 54 | + { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, |
| 55 | + { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, |
| 56 | + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, |
| 57 | + { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, |
| 58 | + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, |
| 59 | + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, |
| 60 | + { MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) }, |
| 61 | + |
| 62 | + // TODO: Are the UART pins really this, or are they reversed? |
| 63 | + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO44) }, |
| 64 | + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO43) }, |
| 65 | + |
| 66 | + // Objects |
| 67 | + { MP_ROM_QSTR(MP_QSTR_TF_SPI), MP_ROM_PTR(&board_tf_spi_obj) }, |
| 68 | + { MP_ROM_QSTR(MP_QSTR_EPD_SPI), MP_ROM_PTR(&board_epd_spi_obj) }, |
| 69 | + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, |
| 70 | + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)}, |
| 71 | + |
| 72 | +}; |
| 73 | +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); |
0 commit comments