Reorganize board busses into shared-bindings and shared-module.
This commit is contained in:
parent
7686f93ef4
commit
0f003ac5b8
16
locale/ID.po
16
locale/ID.po
@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-04-04 13:37-0700\n"
|
||||
"POT-Creation-Date: 2019-04-08 16:48-0700\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@ -924,17 +924,9 @@ msgstr "Tidak ada pin TX"
|
||||
msgid "No available clocks"
|
||||
msgstr ""
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default I2C bus"
|
||||
msgstr "Tidak ada standar bus I2C"
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default SPI bus"
|
||||
msgstr "Tidak ada standar bus SPI"
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default UART bus"
|
||||
msgstr "Tidak ada standar bus UART"
|
||||
#: shared-bindings/board/__init__.c
|
||||
msgid "No default %q bus"
|
||||
msgstr "Tidak ada standar bus %q"
|
||||
|
||||
#: ports/atmel-samd/common-hal/touchio/TouchIn.c
|
||||
msgid "No free GCLKs"
|
||||
|
@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-04-04 13:37-0700\n"
|
||||
"POT-Creation-Date: 2019-04-08 16:48-0700\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@ -899,16 +899,8 @@ msgstr ""
|
||||
msgid "No available clocks"
|
||||
msgstr ""
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default I2C bus"
|
||||
msgstr ""
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default SPI bus"
|
||||
msgstr ""
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default UART bus"
|
||||
#: shared-bindings/board/__init__.c
|
||||
msgid "No default %q bus"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/touchio/TouchIn.c
|
||||
|
@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-04-04 13:37-0700\n"
|
||||
"POT-Creation-Date: 2019-04-08 16:48-0700\n"
|
||||
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
|
||||
"Last-Translator: Pascal Deneaux\n"
|
||||
"Language-Team: Sebastian Plamauer, Pascal Deneaux\n"
|
||||
@ -912,17 +912,9 @@ msgstr "Kein TX Pin"
|
||||
msgid "No available clocks"
|
||||
msgstr ""
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default I2C bus"
|
||||
msgstr "Kein Standard I2C Bus"
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default SPI bus"
|
||||
msgstr "Kein Standard SPI Bus"
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default UART bus"
|
||||
msgstr "Kein Standard UART Bus"
|
||||
#: shared-bindings/board/__init__.c
|
||||
msgid "No default %q bus"
|
||||
msgstr "Kein Standard %q Bus"
|
||||
|
||||
#: ports/atmel-samd/common-hal/touchio/TouchIn.c
|
||||
msgid "No free GCLKs"
|
||||
|
@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-04-04 13:37-0700\n"
|
||||
"POT-Creation-Date: 2019-04-08 16:48-0700\n"
|
||||
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
@ -899,16 +899,8 @@ msgstr ""
|
||||
msgid "No available clocks"
|
||||
msgstr ""
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default I2C bus"
|
||||
msgstr ""
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default SPI bus"
|
||||
msgstr ""
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default UART bus"
|
||||
#: shared-bindings/board/__init__.c
|
||||
msgid "No default %q bus"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/touchio/TouchIn.c
|
||||
|
@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-04-04 13:37-0700\n"
|
||||
"POT-Creation-Date: 2019-04-08 16:48-0700\n"
|
||||
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: @sommersoft, @MrCertainly\n"
|
||||
@ -903,16 +903,8 @@ msgstr ""
|
||||
msgid "No available clocks"
|
||||
msgstr ""
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default I2C bus"
|
||||
msgstr ""
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default SPI bus"
|
||||
msgstr ""
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default UART bus"
|
||||
#: shared-bindings/board/__init__.c
|
||||
msgid "No default %q bus"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/touchio/TouchIn.c
|
||||
|
16
locale/es.po
16
locale/es.po
@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-04-04 13:37-0700\n"
|
||||
"POT-Creation-Date: 2019-04-08 16:48-0700\n"
|
||||
"PO-Revision-Date: 2018-08-24 22:56-0500\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
@ -937,17 +937,9 @@ msgstr "Sin pin TX"
|
||||
msgid "No available clocks"
|
||||
msgstr "Relojes no disponibles"
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default I2C bus"
|
||||
msgstr "Sin bus I2C por defecto"
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default SPI bus"
|
||||
msgstr "Sin bus SPI por defecto"
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default UART bus"
|
||||
msgstr "Sin bus UART por defecto"
|
||||
#: shared-bindings/board/__init__.c
|
||||
msgid "No default %q bus"
|
||||
msgstr "Sin bus %q por defecto"
|
||||
|
||||
#: ports/atmel-samd/common-hal/touchio/TouchIn.c
|
||||
msgid "No free GCLKs"
|
||||
|
@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-04-04 13:37-0700\n"
|
||||
"POT-Creation-Date: 2019-04-08 16:48-0700\n"
|
||||
"PO-Revision-Date: 2018-12-20 22:15-0800\n"
|
||||
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
|
||||
"Language-Team: fil\n"
|
||||
@ -933,17 +933,9 @@ msgstr "Walang TX pin"
|
||||
msgid "No available clocks"
|
||||
msgstr ""
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default I2C bus"
|
||||
msgstr "Walang default na I2C bus"
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default SPI bus"
|
||||
msgstr "Walang default SPI bus"
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default UART bus"
|
||||
msgstr "Walang default UART bus"
|
||||
#: shared-bindings/board/__init__.c
|
||||
msgid "No default %q bus"
|
||||
msgstr "Walang default na %q bus"
|
||||
|
||||
#: ports/atmel-samd/common-hal/touchio/TouchIn.c
|
||||
msgid "No free GCLKs"
|
||||
|
16
locale/fr.po
16
locale/fr.po
@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: 0.1\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-04-04 13:37-0700\n"
|
||||
"POT-Creation-Date: 2019-04-08 16:48-0700\n"
|
||||
"PO-Revision-Date: 2018-12-23 20:05+0100\n"
|
||||
"Last-Translator: Pierrick Couturier <arofarn@arofarn.info>\n"
|
||||
"Language-Team: fr\n"
|
||||
@ -936,17 +936,9 @@ msgstr "Pas de broche TX"
|
||||
msgid "No available clocks"
|
||||
msgstr ""
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default I2C bus"
|
||||
msgstr "Pas de bus I2C par défaut"
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default SPI bus"
|
||||
msgstr "Pas de bus SPI par défaut"
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default UART bus"
|
||||
msgstr "Pas de bus UART par défaut"
|
||||
#: shared-bindings/board/__init__.c
|
||||
msgid "No default %q bus"
|
||||
msgstr "Pas de bus %q par défaut"
|
||||
|
||||
#: ports/atmel-samd/common-hal/touchio/TouchIn.c
|
||||
msgid "No free GCLKs"
|
||||
|
@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-04-04 13:37-0700\n"
|
||||
"POT-Creation-Date: 2019-04-08 16:48-0700\n"
|
||||
"PO-Revision-Date: 2018-10-02 16:27+0200\n"
|
||||
"Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n"
|
||||
"Language-Team: \n"
|
||||
@ -932,17 +932,9 @@ msgstr "Nessun pin TX"
|
||||
msgid "No available clocks"
|
||||
msgstr ""
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default I2C bus"
|
||||
msgstr "Nessun bus I2C predefinito"
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default SPI bus"
|
||||
msgstr "Nessun bus SPI predefinito"
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default UART bus"
|
||||
msgstr "Nessun bus UART predefinito"
|
||||
#: shared-bindings/board/__init__.c
|
||||
msgid "No default %q bus"
|
||||
msgstr "Nessun bus %q predefinito"
|
||||
|
||||
#: ports/atmel-samd/common-hal/touchio/TouchIn.c
|
||||
msgid "No free GCLKs"
|
||||
|
16
locale/pl.po
16
locale/pl.po
@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-04-04 13:37-0700\n"
|
||||
"POT-Creation-Date: 2019-04-08 16:48-0700\n"
|
||||
"PO-Revision-Date: 2019-03-19 18:37-0700\n"
|
||||
"Last-Translator: Radomir Dopieralski <circuitpython@sheep.art.pl>\n"
|
||||
"Language-Team: pl\n"
|
||||
@ -909,17 +909,9 @@ msgstr "Brak nóżki TX"
|
||||
msgid "No available clocks"
|
||||
msgstr "Brak dostępnych zegarów"
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default I2C bus"
|
||||
msgstr "Nie ma domyślnej magistrali I2C"
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default SPI bus"
|
||||
msgstr "Nie ma domyślnej magistrali SPI"
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default UART bus"
|
||||
msgstr "Nie ma domyślnej magistrali UART"
|
||||
#: shared-bindings/board/__init__.c
|
||||
msgid "No default %q bus"
|
||||
msgstr "Nie ma domyślnej magistrali %q"
|
||||
|
||||
#: ports/atmel-samd/common-hal/touchio/TouchIn.c
|
||||
msgid "No free GCLKs"
|
||||
|
@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-04-04 13:37-0700\n"
|
||||
"POT-Creation-Date: 2019-04-08 16:48-0700\n"
|
||||
"PO-Revision-Date: 2018-10-02 21:14-0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
@ -922,17 +922,9 @@ msgstr "Nenhum pino TX"
|
||||
msgid "No available clocks"
|
||||
msgstr ""
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default I2C bus"
|
||||
msgstr "Nenhum barramento I2C padrão"
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default SPI bus"
|
||||
msgstr "Nenhum barramento SPI padrão"
|
||||
|
||||
#: supervisor/shared/board_busses.c
|
||||
msgid "No default UART bus"
|
||||
msgstr "Nenhum barramento UART padrão"
|
||||
#: shared-bindings/board/__init__.c
|
||||
msgid "No default %q bus"
|
||||
msgstr "Nenhum barramento %q padrão"
|
||||
|
||||
#: ports/atmel-samd/common-hal/touchio/TouchIn.c
|
||||
msgid "No free GCLKs"
|
||||
|
5
main.c
5
main.c
@ -50,7 +50,6 @@
|
||||
#include "supervisor/port.h"
|
||||
#include "supervisor/filesystem.h"
|
||||
#include "supervisor/shared/autoreload.h"
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
#include "supervisor/shared/translate.h"
|
||||
#include "supervisor/shared/rgb_led_status.h"
|
||||
#include "supervisor/shared/safe_mode.h"
|
||||
@ -62,6 +61,10 @@
|
||||
#include "shared-module/network/__init__.h"
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_BOARD
|
||||
#include "shared-module/board/__init__.h"
|
||||
#endif
|
||||
|
||||
void do_str(const char *src, mp_parse_input_kind_t input_kind) {
|
||||
mp_lexer_t *lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, src, strlen(src), 0);
|
||||
if (lex == NULL) {
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB02) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB02) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA30) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA31) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA02) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA02) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
// This mapping only includes functional names because pins broken
|
||||
// out on connectors are labeled with their MCU name available from
|
||||
// microcontroller.pin.
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
// This mapping only includes functional names because pins broken
|
||||
// out on connectors are labeled with their MCU name available from
|
||||
// microcontroller.pin.
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA05) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PB02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB03) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA05) }, // pad 1
|
||||
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA05) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
// This mapping only includes functional names because pins broken
|
||||
// out on connectors are labeled with their MCU name available from
|
||||
// microcontroller.pin.
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "boards/board.h"
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA11) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
// This mapping only includes functional names because pins broken
|
||||
// out on connectors are labeled with their MCU name available from
|
||||
// microcontroller.pin.
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA03) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
// This mapping only includes functional names because pins broken
|
||||
// out on connectors are labeled with their MCU name available from
|
||||
// microcontroller.pin.
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
// This mapping only includes functional names because pins broken
|
||||
// out on connectors are labeled with their MCU name available from
|
||||
// microcontroller.pin.
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
// This mapping only includes functional names because pins broken
|
||||
// out on connectors are labeled with their MCU name available from
|
||||
// microcontroller.pin.
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
// Pins for internal use.
|
||||
{ MP_ROM_QSTR(MP_QSTR__R1), MP_ROM_PTR(&pin_PA05) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_REMOTEIN), MP_ROM_PTR(&pin_PA28) },
|
||||
|
||||
|
@ -69,16 +69,15 @@ uint8_t display_init_sequence[] = {
|
||||
0x29, 0 | DELAY, 100, // _DISPON
|
||||
};
|
||||
|
||||
STATIC busio_spi_obj_t display_spi_obj;
|
||||
|
||||
void board_init(void) {
|
||||
common_hal_busio_spi_construct(&display_spi_obj, &pin_PB13, &pin_PB12, NULL);
|
||||
common_hal_busio_spi_never_reset(&display_spi_obj);
|
||||
busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_PB13, &pin_PB12, NULL);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus;
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
&display_spi_obj,
|
||||
spi,
|
||||
&pin_PB05, // TFT_DC Command or data
|
||||
&pin_PB07, // TFT_CS Chip select
|
||||
&pin_PA01); // TFT_RST Reset
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "boards/board.h"
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
|
@ -25,7 +25,6 @@
|
||||
*/
|
||||
|
||||
#include "boards/board.h"
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "hal/include/hal_gpio.h"
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#include "boards/board.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
// This mapping only includes functional names because pins broken
|
||||
// out on connectors are labeled with their MCU name available from
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PB08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB09) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA05) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
|
||||
// Analog pins
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
|
||||
// Analog pins
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
// This mapping only includes functional names because pins broken
|
||||
// out on connectors are labeled with their MCU name available from
|
||||
// microcontroller.pin.
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA08) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA08) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA08) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_X), MP_ROM_PTR(&pin_PA00) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_O), MP_ROM_PTR(&pin_PA01) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_05) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_AIN0), MP_ROM_PTR(&pin_P0_02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_AIN1), MP_ROM_PTR(&pin_P0_03) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_AIN0), MP_ROM_PTR(&pin_P0_02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_AIN1), MP_ROM_PTR(&pin_P0_03) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_03) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_04) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_03) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_04) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_03) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_04) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_P0_00), MP_ROM_PTR(&pin_P0_00) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_P0_01), MP_ROM_PTR(&pin_P0_01) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_P0_02), MP_ROM_PTR(&pin_P0_02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_P0_04), MP_ROM_PTR(&pin_P0_04) },
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_P1_15) }, // D1/TX
|
||||
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_P0_17) }, // D0/RX
|
||||
|
@ -302,6 +302,7 @@ $(filter $(SRC_PATTERNS), \
|
||||
bitbangio/OneWire.c \
|
||||
bitbangio/SPI.c \
|
||||
bitbangio/__init__.c \
|
||||
board/__init__.c \
|
||||
busio/OneWire.c \
|
||||
displayio/Bitmap.c \
|
||||
displayio/ColorConverter.c \
|
||||
|
@ -252,8 +252,29 @@ extern const struct _mp_obj_module_t bleio_module;
|
||||
#if CIRCUITPY_BOARD
|
||||
#define BOARD_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_board), (mp_obj_t)&board_module },
|
||||
extern const struct _mp_obj_module_t board_module;
|
||||
|
||||
#define BOARD_I2C (defined(DEFAULT_I2C_BUS_SDA) && defined(DEFAULT_I2C_BUS_SCL))
|
||||
#define BOARD_SPI (defined(DEFAULT_SPI_BUS_SCK) && defined(DEFAULT_SPI_BUS_MISO) && defined(DEFAULT_SPI_BUS_MOSI))
|
||||
#define BOARD_UART (defined(DEFAULT_UART_BUS_RX) && defined(DEFAULT_UART_BUS_TX))
|
||||
|
||||
#if BOARD_I2C
|
||||
#define BOARD_I2C_ROOT_POINTER mp_obj_t shared_i2c_bus;
|
||||
#else
|
||||
#define BOARD_I2C_ROOT_POINTER
|
||||
#endif
|
||||
|
||||
// SPI is always allocated off the heap.
|
||||
|
||||
#if BOARD_UART
|
||||
#define BOARD_UART_ROOT_POINTER mp_obj_t shared_uart_bus;
|
||||
#else
|
||||
#define BOARD_UART_ROOT_POINTER
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define BOARD_MODULE
|
||||
#define BOARD_I2C_ROOT_POINTER
|
||||
#define BOARD_UART_ROOT_POINTER
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_BUSIO
|
||||
@ -586,6 +607,8 @@ extern const struct _mp_obj_module_t ustack_module;
|
||||
mp_obj_t gamepad_singleton; \
|
||||
mp_obj_t pew_singleton; \
|
||||
mp_obj_t terminal_tilegrid_tiles; \
|
||||
BOARD_I2C_ROOT_POINTER \
|
||||
BOARD_UART_ROOT_POINTER \
|
||||
FLASH_ROOT_POINTERS \
|
||||
NETWORK_ROOT_POINTERS \
|
||||
|
||||
|
32
py/gc.c
32
py/gc.c
@ -176,6 +176,8 @@ void gc_init(void *start, void *end) {
|
||||
mp_thread_mutex_init(&MP_STATE_MEM(gc_mutex));
|
||||
#endif
|
||||
|
||||
MP_STATE_MEM(permanent_pointers) = NULL;
|
||||
|
||||
DEBUG_printf("GC layout:\n");
|
||||
DEBUG_printf(" alloc table at %p, length " UINT_FMT " bytes, " UINT_FMT " blocks\n", MP_STATE_MEM(gc_alloc_table_start), MP_STATE_MEM(gc_alloc_table_byte_len), MP_STATE_MEM(gc_alloc_table_byte_len) * BLOCKS_PER_ATB);
|
||||
#if MICROPY_ENABLE_FINALISER
|
||||
@ -359,6 +361,10 @@ void gc_collect_start(void) {
|
||||
size_t root_end = offsetof(mp_state_ctx_t, vm.qstr_last_chunk);
|
||||
gc_collect_root(ptrs + root_start / sizeof(void*), (root_end - root_start) / sizeof(void*));
|
||||
|
||||
if (MP_STATE_MEM(permanent_pointers) != NULL) {
|
||||
gc_collect_root(MP_STATE_MEM(permanent_pointers), BYTES_PER_BLOCK / sizeof(void*));
|
||||
}
|
||||
|
||||
#if MICROPY_ENABLE_PYSTACK
|
||||
// Trace root pointers from the Python stack.
|
||||
ptrs = (void**)(void*)MP_STATE_THREAD(pystack_start);
|
||||
@ -938,6 +944,32 @@ void *gc_realloc(void *ptr_in, size_t n_bytes, bool allow_move) {
|
||||
}
|
||||
#endif // Alternative gc_realloc impl
|
||||
|
||||
bool gc_never_free(void *ptr) {
|
||||
// Pointers are stored in a linked list where each block is BYTES_PER_BLOCK long and the first
|
||||
// pointer is the next block of pointers.
|
||||
void ** current_reference_block = MP_STATE_MEM(permanent_pointers);
|
||||
while (current_reference_block != NULL) {
|
||||
for (size_t i = 1; i < BYTES_PER_BLOCK / sizeof(void*); i++) {
|
||||
if (current_reference_block[i] == NULL) {
|
||||
current_reference_block[i] = ptr;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
current_reference_block = current_reference_block[0];
|
||||
}
|
||||
void** next_block = gc_alloc(BYTES_PER_BLOCK, false, true);
|
||||
if (next_block == NULL) {
|
||||
return false;
|
||||
}
|
||||
if (MP_STATE_MEM(permanent_pointers) == NULL) {
|
||||
MP_STATE_MEM(permanent_pointers) = next_block;
|
||||
} else {
|
||||
current_reference_block[0] = next_block;
|
||||
}
|
||||
next_block[1] = ptr;
|
||||
return true;
|
||||
}
|
||||
|
||||
void gc_dump_info(void) {
|
||||
gc_info_t info;
|
||||
gc_info(&info);
|
||||
|
4
py/gc.h
4
py/gc.h
@ -57,6 +57,10 @@ bool gc_has_finaliser(const void *ptr);
|
||||
void *gc_make_long_lived(void *old_ptr);
|
||||
void *gc_realloc(void *ptr, size_t n_bytes, bool allow_move);
|
||||
|
||||
// Prevents a pointer from ever being freed because it establishes a permanent reference to it. Use
|
||||
// very sparingly because it can leak memory.
|
||||
bool gc_never_free(void *ptr);
|
||||
|
||||
typedef struct _gc_info_t {
|
||||
size_t total;
|
||||
size_t used;
|
||||
|
@ -103,6 +103,8 @@ typedef struct _mp_state_mem_t {
|
||||
// This is a global mutex used to make the GC thread-safe.
|
||||
mp_thread_mutex_t gc_mutex;
|
||||
#endif
|
||||
|
||||
void** permanent_pointers;
|
||||
} mp_state_mem_t;
|
||||
|
||||
// This structure hold runtime and VM information. It includes a section
|
||||
|
@ -37,6 +37,81 @@
|
||||
//|
|
||||
//| Common container for board base pin names. These will vary from board to
|
||||
//| board so don't expect portability when using this module.
|
||||
//|
|
||||
//| .. warning:: The board module varies by board. The APIs documented here may or may not be
|
||||
//| available on a specific board.
|
||||
|
||||
//| .. method:: I2C()
|
||||
//|
|
||||
//| Returns the `busio.I2C` object for the board designated SDA and SCL pins. It is a singleton.
|
||||
//|
|
||||
|
||||
#if BOARD_I2C
|
||||
mp_obj_t board_i2c(void) {
|
||||
mp_obj_t singleton = common_hal_board_get_i2c();
|
||||
if (singleton != NULL) {
|
||||
return singleton;
|
||||
}
|
||||
assert_pin_free(DEFAULT_I2C_BUS_SDA);
|
||||
assert_pin_free(DEFAULT_I2C_BUS_SCL);
|
||||
return common_hal_board_create_i2c();
|
||||
}
|
||||
#else
|
||||
mp_obj_t board_i2c(void) {
|
||||
mp_raise_NotImplementedError_varg(translate("No default %q bus"), MP_QSTR_I2C);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
MP_DEFINE_CONST_FUN_OBJ_0(board_i2c_obj, board_i2c);
|
||||
|
||||
|
||||
//| .. method:: SPI()
|
||||
//|
|
||||
//| Returns the `busio.SPI` object for the board designated SCK, MOSI and MISO pins. It is a
|
||||
//| singleton.
|
||||
//|
|
||||
#if BOARD_SPI
|
||||
mp_obj_t board_spi(void) {
|
||||
mp_obj_t singleton = common_hal_board_get_spi();
|
||||
if (singleton != NULL) {
|
||||
return singleton;
|
||||
}
|
||||
assert_pin_free(DEFAULT_SPI_BUS_SCK);
|
||||
assert_pin_free(DEFAULT_SPI_BUS_MOSI);
|
||||
assert_pin_free(DEFAULT_SPI_BUS_MISO);
|
||||
return common_hal_board_create_spi();
|
||||
}
|
||||
#else
|
||||
mp_obj_t board_spi(void) {
|
||||
mp_raise_NotImplementedError_varg(translate("No default %q bus"), MP_QSTR_SPI);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
MP_DEFINE_CONST_FUN_OBJ_0(board_spi_obj, board_spi);
|
||||
|
||||
//| .. method:: UART()
|
||||
//|
|
||||
//| Returns the `busio.UART` object for the board designated TX and RX pins. It is a singleton.
|
||||
//|
|
||||
#if BOARD_UART
|
||||
mp_obj_t board_uart(void) {
|
||||
mp_obj_t singleton = common_hal_board_get_uart();
|
||||
if (singleton != NULL) {
|
||||
return singleton;
|
||||
}
|
||||
|
||||
assert_pin_free(DEFAULT_UART_BUS_RX);
|
||||
assert_pin_free(DEFAULT_UART_BUS_TX);
|
||||
|
||||
return common_hal_board_create_uart();
|
||||
}
|
||||
#else
|
||||
mp_obj_t board_uart(void) {
|
||||
mp_raise_NotImplementedError_varg(translate("No default %q bus"), MP_QSTR_SPI);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
MP_DEFINE_CONST_FUN_OBJ_0(board_uart_obj, board_uart);
|
||||
|
||||
const mp_obj_module_t board_module = {
|
||||
.base = { &mp_type_module },
|
||||
|
@ -33,4 +33,16 @@
|
||||
|
||||
extern const mp_obj_dict_t board_module_globals;
|
||||
|
||||
mp_obj_t common_hal_board_get_i2c(void);
|
||||
mp_obj_t common_hal_board_create_i2c(void);
|
||||
MP_DECLARE_CONST_FUN_OBJ_0(board_i2c_obj);
|
||||
|
||||
mp_obj_t common_hal_board_get_spi(void);
|
||||
mp_obj_t common_hal_board_create_spi(void);
|
||||
MP_DECLARE_CONST_FUN_OBJ_0(board_spi_obj);
|
||||
|
||||
mp_obj_t common_hal_board_get_uart(void);
|
||||
mp_obj_t common_hal_board_create_uart(void);
|
||||
MP_DECLARE_CONST_FUN_OBJ_0(board_uart_obj);
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_BOARD___INIT___H
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "common-hal/microcontroller/Pin.h"
|
||||
|
||||
#include "shared-module/displayio/Group.h"
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
extern const mp_obj_type_t displayio_fourwire_type;
|
||||
|
||||
|
@ -37,35 +37,19 @@
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#endif
|
||||
|
||||
#define BOARD_I2C (defined(DEFAULT_I2C_BUS_SDA) && defined(DEFAULT_I2C_BUS_SCL))
|
||||
#define BOARD_SPI (defined(DEFAULT_SPI_BUS_SCK) && defined(DEFAULT_SPI_BUS_MISO) && defined(DEFAULT_SPI_BUS_MOSI))
|
||||
#define BOARD_UART (defined(DEFAULT_UART_BUS_RX) && defined(DEFAULT_UART_BUS_TX))
|
||||
|
||||
#if BOARD_I2C
|
||||
STATIC mp_obj_t i2c_singleton = NULL;
|
||||
|
||||
mp_obj_t board_i2c(void) {
|
||||
|
||||
if (i2c_singleton == NULL) {
|
||||
busio_i2c_obj_t *self = m_new_ll_obj(busio_i2c_obj_t);
|
||||
self->base.type = &busio_i2c_type;
|
||||
|
||||
assert_pin_free(DEFAULT_I2C_BUS_SDA);
|
||||
assert_pin_free(DEFAULT_I2C_BUS_SCL);
|
||||
common_hal_busio_i2c_construct(self, DEFAULT_I2C_BUS_SCL, DEFAULT_I2C_BUS_SDA, 400000, 0);
|
||||
i2c_singleton = (mp_obj_t)self;
|
||||
}
|
||||
return i2c_singleton;
|
||||
mp_obj_t common_hal_board_get_i2c(void) {
|
||||
return MP_STATE_VM(shared_i2c_bus);
|
||||
}
|
||||
|
||||
mp_obj_t common_hal_board_create_i2c(void) {
|
||||
busio_i2c_obj_t *self = m_new_ll_obj(busio_i2c_obj_t);
|
||||
self->base.type = &busio_i2c_type;
|
||||
|
||||
common_hal_busio_i2c_construct(self, DEFAULT_I2C_BUS_SCL, DEFAULT_I2C_BUS_SDA, 400000, 0);
|
||||
MP_STATE_VM(shared_i2c_bus) = MP_OBJ_FROM_PTR(self);
|
||||
return MP_STATE_VM(shared_i2c_bus);
|
||||
}
|
||||
#else
|
||||
mp_obj_t board_i2c(void) {
|
||||
mp_raise_NotImplementedError(translate("No default I2C bus"));
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
MP_DEFINE_CONST_FUN_OBJ_0(board_i2c_obj, board_i2c);
|
||||
|
||||
#if BOARD_SPI
|
||||
// Statically allocate the SPI object so it can live past the end of the heap and into the next VM.
|
||||
// That way it can be used by built-in FourWire displays and be accessible through board.SPI().
|
||||
STATIC busio_spi_obj_t spi_obj;
|
||||
@ -82,11 +66,7 @@ mp_obj_t common_hal_board_create_spi(void) {
|
||||
}
|
||||
busio_spi_obj_t *self = &spi_obj;
|
||||
self->base.type = &busio_spi_type;
|
||||
if (!common_hal_mcu_pin_is_free(DEFAULT_SPI_BUS_SCK) ||
|
||||
!common_hal_mcu_pin_is_free(DEFAULT_SPI_BUS_MOSI) ||
|
||||
!common_hal_mcu_pin_is_free(DEFAULT_SPI_BUS_MISO)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const mcu_pin_obj_t* clock = MP_OBJ_TO_PTR(DEFAULT_SPI_BUS_SCK);
|
||||
const mcu_pin_obj_t* mosi = MP_OBJ_TO_PTR(DEFAULT_SPI_BUS_MOSI);
|
||||
const mcu_pin_obj_t* miso = MP_OBJ_TO_PTR(DEFAULT_SPI_BUS_MISO);
|
||||
@ -95,55 +75,25 @@ mp_obj_t common_hal_board_create_spi(void) {
|
||||
return spi_singleton;
|
||||
}
|
||||
|
||||
mp_obj_t board_spi(void) {
|
||||
mp_obj_t singleton = common_hal_board_get_spi();
|
||||
if (singleton != NULL) {
|
||||
return singleton;
|
||||
}
|
||||
assert_pin_free(DEFAULT_SPI_BUS_SCK);
|
||||
assert_pin_free(DEFAULT_SPI_BUS_MOSI);
|
||||
assert_pin_free(DEFAULT_SPI_BUS_MISO);
|
||||
return common_hal_board_create_spi();
|
||||
mp_obj_t common_hal_board_get_uart(void) {
|
||||
return MP_STATE_VM(shared_uart_bus);
|
||||
}
|
||||
#else
|
||||
mp_obj_t common_hal_board_spi(void) {
|
||||
mp_raise_NotImplementedError(translate("No default SPI bus"));
|
||||
return NULL;
|
||||
|
||||
mp_obj_t common_hal_board_create_uart(void) {
|
||||
busio_uart_obj_t *self = m_new_ll_obj(busio_uart_obj_t);
|
||||
self->base.type = &busio_uart_type;
|
||||
|
||||
const mcu_pin_obj_t* rx = MP_OBJ_TO_PTR(DEFAULT_UART_BUS_RX);
|
||||
const mcu_pin_obj_t* tx = MP_OBJ_TO_PTR(DEFAULT_UART_BUS_TX);
|
||||
|
||||
common_hal_busio_uart_construct(self, tx, rx, 9600, 8, PARITY_NONE, 1, 1000, 64);
|
||||
MP_STATE_VM(shared_uart_bus) = MP_OBJ_FROM_PTR(self);
|
||||
return MP_STATE_VM(shared_uart_bus);
|
||||
}
|
||||
#endif
|
||||
MP_DEFINE_CONST_FUN_OBJ_0(board_spi_obj, board_spi);
|
||||
|
||||
#if BOARD_UART
|
||||
STATIC mp_obj_t uart_singleton = NULL;
|
||||
|
||||
mp_obj_t board_uart(void) {
|
||||
if (uart_singleton == NULL) {
|
||||
busio_uart_obj_t *self = m_new_ll_obj(busio_uart_obj_t);
|
||||
self->base.type = &busio_uart_type;
|
||||
|
||||
assert_pin_free(DEFAULT_UART_BUS_RX);
|
||||
assert_pin_free(DEFAULT_UART_BUS_TX);
|
||||
|
||||
const mcu_pin_obj_t* rx = MP_OBJ_TO_PTR(DEFAULT_UART_BUS_RX);
|
||||
const mcu_pin_obj_t* tx = MP_OBJ_TO_PTR(DEFAULT_UART_BUS_TX);
|
||||
|
||||
common_hal_busio_uart_construct(self, tx, rx, 9600, 8, PARITY_NONE, 1, 1000, 64);
|
||||
uart_singleton = (mp_obj_t)self;
|
||||
}
|
||||
return uart_singleton;
|
||||
}
|
||||
#else
|
||||
mp_obj_t board_uart(void) {
|
||||
mp_raise_NotImplementedError(translate("No default UART bus"));
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
MP_DEFINE_CONST_FUN_OBJ_0(board_uart_obj, board_uart);
|
||||
|
||||
|
||||
void reset_board_busses(void) {
|
||||
#if BOARD_I2C
|
||||
i2c_singleton = NULL;
|
||||
MP_STATE_VM(shared_i2c_bus) = NULL;
|
||||
#endif
|
||||
#if BOARD_SPI
|
||||
bool display_using_spi = false;
|
||||
@ -160,6 +110,6 @@ void reset_board_busses(void) {
|
||||
}
|
||||
#endif
|
||||
#if BOARD_UART
|
||||
uart_singleton = NULL;
|
||||
MP_STATE_VM(shared_uart_bus) = NULL;
|
||||
#endif
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Scott Shawcroft for Adafruit Industries
|
||||
* Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -24,21 +24,9 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_SUPERVISOR_SHARED_BOARD_BUSSES_H
|
||||
#define MICROPY_INCLUDED_SUPERVISOR_SHARED_BOARD_BUSSES_H
|
||||
|
||||
#include "py/obj.h"
|
||||
|
||||
mp_obj_t common_hal_board_get_spi(void);
|
||||
mp_obj_t common_hal_board_create_spi(void);
|
||||
MP_DECLARE_CONST_FUN_OBJ_0(board_i2c_obj);
|
||||
|
||||
mp_obj_t board_spi(void);
|
||||
MP_DECLARE_CONST_FUN_OBJ_0(board_spi_obj);
|
||||
|
||||
mp_obj_t board_uart(void);
|
||||
MP_DECLARE_CONST_FUN_OBJ_0(board_uart_obj);
|
||||
#ifndef MICROPY_INCLUDED_SHARED_MODULE_BOARD__INIT__H
|
||||
#define MICROPY_INCLUDED_SHARED_MODULE_BOARD__INIT__H
|
||||
|
||||
void reset_board_busses(void);
|
||||
|
||||
#endif // MICROPY_INCLUDED_SUPERVISOR_SHARED_BOARD_BUSSES_H
|
||||
#endif // MICROPY_INCLUDED_SHARED_MODULE_BOARD__INIT__H
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "py/gc.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/digitalio/DigitalInOut.h"
|
||||
#include "shared-bindings/time/__init__.h"
|
||||
@ -40,6 +41,7 @@ void common_hal_displayio_fourwire_construct(displayio_fourwire_obj_t* self,
|
||||
|
||||
self->bus = spi;
|
||||
common_hal_busio_spi_never_reset(self->bus);
|
||||
gc_never_free(self->bus);
|
||||
|
||||
common_hal_digitalio_digitalinout_construct(&self->command, command);
|
||||
common_hal_digitalio_digitalinout_switch_to_output(&self->command, true, DRIVE_MODE_PUSH_PULL);
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "lib/utils/interrupt_char.h"
|
||||
#include "py/reload.h"
|
||||
#include "py/runtime.h"
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
#include "shared-bindings/displayio/Bitmap.h"
|
||||
#include "shared-bindings/displayio/Display.h"
|
||||
#include "shared-bindings/displayio/Group.h"
|
||||
@ -190,6 +191,9 @@ void reset_displays(void) {
|
||||
if (((uint32_t) fourwire->bus) < ((uint32_t) &displays) ||
|
||||
((uint32_t) fourwire->bus) > ((uint32_t) &displays + CIRCUITPY_DISPLAY_LIMIT)) {
|
||||
busio_spi_obj_t* original_spi = fourwire->bus;
|
||||
// We don't need to move original_spi if it is the board.SPI object because it is
|
||||
// statically allocated already. (Doing so would also make it impossible to reference in
|
||||
// a subsequent VM run.)
|
||||
if (original_spi == common_hal_board_get_spi()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "supervisor/shared/safe_mode.h"
|
||||
|
||||
#include "mphalport.h"
|
||||
// #include "py/mpconfig.h"
|
||||
|
||||
#include "shared-bindings/digitalio/DigitalInOut.h"
|
||||
|
||||
@ -77,7 +76,7 @@ safe_mode_t wait_for_safe_mode_reset(void) {
|
||||
return NO_SAFE_MODE;
|
||||
}
|
||||
|
||||
// Inline this so it's easy to break on it from GDB.
|
||||
// Don't inline this so it's easy to break on it from GDB.
|
||||
void __attribute__((noinline,)) reset_into_safe_mode(safe_mode_t reason) {
|
||||
if (current_safe_mode > BROWNOUT && reason > BROWNOUT) {
|
||||
while (true) {
|
||||
|
@ -2,7 +2,6 @@ SRC_SUPERVISOR = \
|
||||
main.c \
|
||||
supervisor/port.c \
|
||||
supervisor/shared/autoreload.c \
|
||||
supervisor/shared/board_busses.c \
|
||||
supervisor/shared/display.c \
|
||||
supervisor/shared/filesystem.c \
|
||||
supervisor/shared/flash.c \
|
||||
|
Loading…
x
Reference in New Issue
Block a user