Merge branch 'master' into nfc_copy

This commit is contained in:
Sabas 2020-04-09 17:05:11 -05:00 committed by GitHub
commit cac4fb0318
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
656 changed files with 27509 additions and 3372 deletions

View File

@ -16,15 +16,15 @@ jobs:
env: env:
GITHUB_CONTEXT: ${{ toJson(github) }} GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT" run: echo "$GITHUB_CONTEXT"
- name: Set up Python 3.5 - name: Set up Python 3.8
uses: actions/setup-python@v1 uses: actions/setup-python@v1
with: with:
python-version: 3.5 python-version: 3.8
- name: Install deps - name: Install deps
run: | run: |
sudo apt-get install -y eatmydata sudo apt-get install -y eatmydata
sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64
pip install requests sh click setuptools cpp-coveralls Sphinx sphinx-rtd-theme recommonmark sphinxcontrib-svg2pdfconverter polib pyyaml pip install requests sh click setuptools cpp-coveralls "Sphinx<3" sphinx-rtd-theme recommonmark sphinxcontrib-svg2pdfconverter polib pyyaml
- name: Versions - name: Versions
run: | run: |
gcc --version gcc --version
@ -42,7 +42,7 @@ jobs:
make -C ports/unix -j2 make -C ports/unix -j2
make -C ports/unix coverage -j2 make -C ports/unix coverage -j2
- name: Test all - name: Test all
run: MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1
working-directory: tests working-directory: tests
- name: Print failure info - name: Print failure info
run: | run: |
@ -54,10 +54,10 @@ jobs:
working-directory: tests working-directory: tests
if: failure() if: failure()
- name: Native Tests - name: Native Tests
run: MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --emit native run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --emit native
working-directory: tests working-directory: tests
- name: mpy Tests - name: mpy Tests
run: MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --via-mpy -d basics float run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --via-mpy -d basics float
working-directory: tests working-directory: tests
- name: Docs - name: Docs
run: sphinx-build -E -W -b html . _build/html run: sphinx-build -E -W -b html . _build/html
@ -122,6 +122,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
board: board:
- "8086_commander"
- "TG-Watch02A" - "TG-Watch02A"
- "aramcon_badge_2019" - "aramcon_badge_2019"
- "arduino_mkr1300" - "arduino_mkr1300"
@ -130,6 +131,7 @@ jobs:
- "arduino_nano_33_iot" - "arduino_nano_33_iot"
- "arduino_zero" - "arduino_zero"
- "bast_pro_mini_m0" - "bast_pro_mini_m0"
- "bdmicro_vina_m0"
- "capablerobot_usbhub" - "capablerobot_usbhub"
- "catwan_usbstick" - "catwan_usbstick"
- "circuitbrains_basic_m0" - "circuitbrains_basic_m0"
@ -230,9 +232,11 @@ jobs:
- "stringcar_m0_express" - "stringcar_m0_express"
- "teensy40" - "teensy40"
- "teknikio_bluebird" - "teknikio_bluebird"
- "thunderpack"
- "trellis_m4_express" - "trellis_m4_express"
- "trinket_m0" - "trinket_m0"
- "trinket_m0_haxpress" - "trinket_m0_haxpress"
- "uartlogger2"
- "uchip" - "uchip"
- "ugame10" - "ugame10"
- "winterbloom_big_honking_button" - "winterbloom_big_honking_button"
@ -241,10 +245,10 @@ jobs:
- "xinabox_cs11" - "xinabox_cs11"
steps: steps:
- name: Set up Python 3.5 - name: Set up Python 3.8
uses: actions/setup-python@v1 uses: actions/setup-python@v1
with: with:
python-version: 3.5 python-version: 3.8
- name: Install deps - name: Install deps
run: | run: |
sudo apt-get install -y gettext sudo apt-get install -y gettext
@ -275,4 +279,50 @@ jobs:
env: env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested'))
build-riscv:
runs-on: ubuntu-16.04
needs: test
strategy:
fail-fast: false
matrix:
board:
- "fomu"
steps:
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install deps
run: |
sudo apt-get install -y gettext
pip install requests sh click setuptools awscli
wget https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-centos6.tar.gz
sudo tar -C /usr --strip-components=1 -xaf riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-centos6.tar.gz
- name: Versions
run: |
gcc --version
riscv64-unknown-elf-gcc --version
python3 --version
- uses: actions/checkout@v1
with:
submodules: true
- name: mpy-cross
run: make -C mpy-cross -j2
- name: build
run: python3 -u build_release_files.py
working-directory: tools
env:
BOARDS: ${{ matrix.board }}
- uses: actions/upload-artifact@v1.0.0
with:
name: ${{ matrix.board }}
path: bin/${{ matrix.board }}
- name: Upload to S3
run: "[ -z \"$AWS_ACCESS_KEY_ID\" ] || aws s3 cp bin/ s3://adafruit-circuit-python/bin/ --recursive --no-progress --region us-east-1"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested'))

View File

@ -12,10 +12,10 @@ jobs:
env: env:
GITHUB_CONTEXT: ${{ toJson(github) }} GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT" run: echo "$GITHUB_CONTEXT"
- name: Set up Python 3.5 - name: Set up Python 3.8
uses: actions/setup-python@v1 uses: actions/setup-python@v1
with: with:
python-version: 3.5 python-version: 3.8
- name: Install deps - name: Install deps
run: | run: |
pip install requests sh click pip install requests sh click

24
.gitmodules vendored
View File

@ -29,10 +29,6 @@
[submodule "tools/python-semver"] [submodule "tools/python-semver"]
path = tools/python-semver path = tools/python-semver
url = https://github.com/k-bx/python-semver.git url = https://github.com/k-bx/python-semver.git
[submodule "lib/stm32lib"]
path = lib/stm32lib
url = https://github.com/micropython/stm32lib
branch = work-F4-1.13.1+F7-1.5.0+L4-1.3.0
[submodule "atmel-samd/asf4"] [submodule "atmel-samd/asf4"]
path = ports/atmel-samd/asf4 path = ports/atmel-samd/asf4
url = https://github.com/adafruit/asf4.git url = https://github.com/adafruit/asf4.git
@ -96,9 +92,6 @@
[submodule "frozen/circuitpython-stage"] [submodule "frozen/circuitpython-stage"]
path = frozen/circuitpython-stage path = frozen/circuitpython-stage
url = https://github.com/python-ugame/circuitpython-stage.git url = https://github.com/python-ugame/circuitpython-stage.git
[submodule "ports/stm32f4/stm32f4"]
path = ports/stm32f4/stm32f4
url = https://github.com/adafruit/stm32f4.git
[submodule "ports/cxd56/spresense-exported-sdk"] [submodule "ports/cxd56/spresense-exported-sdk"]
path = ports/cxd56/spresense-exported-sdk path = ports/cxd56/spresense-exported-sdk
url = https://github.com/sonydevworld/spresense-exported-sdk.git url = https://github.com/sonydevworld/spresense-exported-sdk.git
@ -110,4 +103,19 @@
url = https://github.com/adafruit/Adafruit_MP3 url = https://github.com/adafruit/Adafruit_MP3
[submodule "ports/mimxrt10xx/sdk"] [submodule "ports/mimxrt10xx/sdk"]
path = ports/mimxrt10xx/sdk path = ports/mimxrt10xx/sdk
url = https://github.com/arturo182/MIMXRT10xx_SDK url = https://github.com/adafruit/MIMXRT10xx_SDK
[submodule "frozen/Adafruit_CircuitPython_Register"]
path = frozen/Adafruit_CircuitPython_Register
url = https://github.com/adafruit/Adafruit_CircuitPython_Register.git
[submodule "extmod/ulab"]
path = extmod/ulab
url = https://github.com/v923z/micropython-ulab/
[submodule "frozen/Adafruit_CircuitPython_ESP32SPI"]
path = frozen/Adafruit_CircuitPython_ESP32SPI
url = https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI
[submodule "frozen/Adafruit_CircuitPython_Requests"]
path = frozen/Adafruit_CircuitPython_Requests
url = https://github.com/adafruit/Adafruit_CircuitPython_Requests
[submodule "ports/stm/st_driver"]
path = ports/stm/st_driver
url = https://github.com/hathach/st_driver.git

View File

@ -36,7 +36,7 @@ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(BASEOPTS)
# the i18n builder cannot share the environment and doctrees with the others # the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(BASEOPTS) I18NSPHINXOPTS = $(BASEOPTS)
TRANSLATE_SOURCES = extmod lib main.c ports/atmel-samd ports/nrf py shared-bindings shared-module supervisor TRANSLATE_SOURCES = extmod lib main.c ports/atmel-samd ports/cxd56 ports/mimxrt10xx ports/nrf ports/stm py shared-bindings shared-module supervisor
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext stubs .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext stubs

View File

@ -94,13 +94,12 @@ Differences from `MicroPython <https://github.com/micropython/micropython>`__
CircuitPython: CircuitPython:
- includes ports for MicroChip SAMD21 (Commonly known as M0 in Adafruit - Supports native USB on all boards, allowing file editing without special tools.
product names) and SAMD51 (M4). - Supports only SAMD21, SAMD51, nRF52840, CXD56, STM32F4 and i.MX RT ports.
- supports only SAMD21, SAMD51, and nRF52840 ports. - Tracks MicroPython's releases (not master).
- tracks MicroPython's releases (not master). - Floats (aka decimals) are enabled for all builds.
- floats (aka decimals) are enabled for all builds. - Error messages are translated into 10+ languages.
- error messages are translated into 10+ languages. - Does not support concurrency within Python (including interrupts and threading). Some concurrency
- does not support concurrency within Python (including interrupts and threading). Some concurrency
is achieved with native modules for tasks that require it such as audio file playback. is achieved with native modules for tasks that require it such as audio file playback.
Behavior Behavior

25
conf.py
View File

@ -121,16 +121,9 @@ exclude_patterns = ["**/build*",
"ports/atmel-samd/peripherals", "ports/atmel-samd/peripherals",
"ports/atmel-samd/QTouch", "ports/atmel-samd/QTouch",
"ports/atmel-samd/tools", "ports/atmel-samd/tools",
"ports/bare-arm",
"ports/cc3200",
"ports/cc3200/FreeRTOS",
"ports/cc3200/hal",
"ports/cxd56/mkspk", "ports/cxd56/mkspk",
"ports/cxd56/spresense-exported-sdk", "ports/cxd56/spresense-exported-sdk",
"ports/esp32", "ports/litex/hw",
"ports/esp8266/boards",
"ports/esp8266/common-hal",
"ports/esp8266/modules",
"ports/minimal", "ports/minimal",
"ports/mimxrt10xx/peripherals", "ports/mimxrt10xx/peripherals",
"ports/mimxrt10xx/sdk", "ports/mimxrt10xx/sdk",
@ -140,20 +133,10 @@ exclude_patterns = ["**/build*",
"ports/nrf/nrfx", "ports/nrf/nrfx",
"ports/nrf/peripherals", "ports/nrf/peripherals",
"ports/nrf/usb", "ports/nrf/usb",
"ports/stm32f4/stm32f4", "ports/stm/st_driver",
"ports/stm32f4/peripherals", "ports/stm/peripherals",
"ports/stm32f4/ref", "ports/stm/ref",
"ports/pic16bit",
"ports/qemu-arm",
"ports/stm32",
"ports/stm32/hal",
"ports/stm32/cmsis",
"ports/stm32/usbdev",
"ports/stm32/usbhost",
"ports/teensy",
"ports/unix", "ports/unix",
"ports/windows",
"ports/zephyr",
"py", "py",
"shared-bindings/util.*", "shared-bindings/util.*",
"shared-module", "shared-module",

View File

@ -476,6 +476,8 @@ properties.
+-----------------------+-----------------------+-------------------------------------------------------------------------+ +-----------------------+-----------------------+-------------------------------------------------------------------------+
| ``distance`` | float | centimeters | | ``distance`` | float | centimeters |
+-----------------------+-----------------------+-------------------------------------------------------------------------+ +-----------------------+-----------------------+-------------------------------------------------------------------------+
| ``proximity`` | int | non-unit-specifc proximity values (monotonic but not actual distance) |
+-----------------------+-----------------------+-------------------------------------------------------------------------+
| ``light`` | float | non-unit-specific light levels (should be monotonic but is not lux) | | ``light`` | float | non-unit-specific light levels (should be monotonic but is not lux) |
+-----------------------+-----------------------+-------------------------------------------------------------------------+ +-----------------------+-----------------------+-------------------------------------------------------------------------+
| ``lux`` | float | SI lux | | ``lux`` | float | SI lux |
@ -504,6 +506,8 @@ properties.
+-----------------------+-----------------------+-------------------------------------------------------------------------+ +-----------------------+-----------------------+-------------------------------------------------------------------------+
| ``weight`` | float | grams (g) | | ``weight`` | float | grams (g) |
+-----------------------+-----------------------+-------------------------------------------------------------------------+ +-----------------------+-----------------------+-------------------------------------------------------------------------+
| ``sound_level`` | float | non-unit-specific sound level (monotonic but not actual decibels) |
+-----------------------+-----------------------+-------------------------------------------------------------------------+
Adding native modules Adding native modules
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View File

@ -10,5 +10,5 @@ and ESP8266.
../ports/atmel-samd/README ../ports/atmel-samd/README
../ports/mimxrt10xx/README ../ports/mimxrt10xx/README
../ports/nrf/README ../ports/nrf/README
../ports/stm32f4/README ../ports/stm/README
../ports/cxd56/README ../ports/cxd56/README

View File

@ -28,6 +28,7 @@
#include <string.h> #include <string.h>
#include "py/runtime.h" #include "py/runtime.h"
#include "py/objtype.h"
#include "py/proto.h" #include "py/proto.h"
#if MICROPY_PY_FRAMEBUF #if MICROPY_PY_FRAMEBUF
@ -304,9 +305,18 @@ STATIC mp_obj_t framebuf_make_new(const mp_obj_type_t *type, size_t n_args, cons
return MP_OBJ_FROM_PTR(o); return MP_OBJ_FROM_PTR(o);
} }
STATIC const mp_obj_type_t mp_type_framebuf;
// Helper to ensure we have the native super class instead of a subclass.
static mp_obj_framebuf_t* native_framebuf(mp_obj_t framebuf_obj) {
mp_obj_t native_framebuf = mp_instance_cast_to_native_base(framebuf_obj, &mp_type_framebuf);
mp_obj_assert_native_inited(native_framebuf);
return MP_OBJ_TO_PTR(native_framebuf);
}
STATIC mp_int_t framebuf_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) { STATIC mp_int_t framebuf_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) {
(void)flags; (void)flags;
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(self_in); mp_obj_framebuf_t *self = native_framebuf(self_in);
bufinfo->buf = self->buf; bufinfo->buf = self->buf;
bufinfo->len = self->stride * self->height * (self->format == FRAMEBUF_RGB565 ? 2 : 1); bufinfo->len = self->stride * self->height * (self->format == FRAMEBUF_RGB565 ? 2 : 1);
bufinfo->typecode = 'B'; // view framebuf as bytes bufinfo->typecode = 'B'; // view framebuf as bytes
@ -314,7 +324,7 @@ STATIC mp_int_t framebuf_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo,
} }
STATIC mp_obj_t framebuf_fill(mp_obj_t self_in, mp_obj_t col_in) { STATIC mp_obj_t framebuf_fill(mp_obj_t self_in, mp_obj_t col_in) {
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(self_in); mp_obj_framebuf_t *self = native_framebuf(self_in);
mp_int_t col = mp_obj_get_int(col_in); mp_int_t col = mp_obj_get_int(col_in);
formats[self->format].fill_rect(self, 0, 0, self->width, self->height, col); formats[self->format].fill_rect(self, 0, 0, self->width, self->height, col);
return mp_const_none; return mp_const_none;
@ -324,7 +334,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(framebuf_fill_obj, framebuf_fill);
STATIC mp_obj_t framebuf_fill_rect(size_t n_args, const mp_obj_t *args) { STATIC mp_obj_t framebuf_fill_rect(size_t n_args, const mp_obj_t *args) {
(void)n_args; (void)n_args;
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_framebuf_t *self = native_framebuf(args[0]);
mp_int_t x = mp_obj_get_int(args[1]); mp_int_t x = mp_obj_get_int(args[1]);
mp_int_t y = mp_obj_get_int(args[2]); mp_int_t y = mp_obj_get_int(args[2]);
mp_int_t width = mp_obj_get_int(args[3]); mp_int_t width = mp_obj_get_int(args[3]);
@ -338,7 +348,7 @@ STATIC mp_obj_t framebuf_fill_rect(size_t n_args, const mp_obj_t *args) {
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_fill_rect_obj, 6, 6, framebuf_fill_rect); STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_fill_rect_obj, 6, 6, framebuf_fill_rect);
STATIC mp_obj_t framebuf_pixel(size_t n_args, const mp_obj_t *args) { STATIC mp_obj_t framebuf_pixel(size_t n_args, const mp_obj_t *args) {
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_framebuf_t *self = native_framebuf(args[0]);
mp_int_t x = mp_obj_get_int(args[1]); mp_int_t x = mp_obj_get_int(args[1]);
mp_int_t y = mp_obj_get_int(args[2]); mp_int_t y = mp_obj_get_int(args[2]);
if (0 <= x && x < self->width && 0 <= y && y < self->height) { if (0 <= x && x < self->width && 0 <= y && y < self->height) {
@ -357,7 +367,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_pixel_obj, 3, 4, framebuf_pi
STATIC mp_obj_t framebuf_hline(size_t n_args, const mp_obj_t *args) { STATIC mp_obj_t framebuf_hline(size_t n_args, const mp_obj_t *args) {
(void)n_args; (void)n_args;
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_framebuf_t *self = native_framebuf(args[0]);
mp_int_t x = mp_obj_get_int(args[1]); mp_int_t x = mp_obj_get_int(args[1]);
mp_int_t y = mp_obj_get_int(args[2]); mp_int_t y = mp_obj_get_int(args[2]);
mp_int_t w = mp_obj_get_int(args[3]); mp_int_t w = mp_obj_get_int(args[3]);
@ -372,7 +382,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_hline_obj, 5, 5, framebuf_hl
STATIC mp_obj_t framebuf_vline(size_t n_args, const mp_obj_t *args) { STATIC mp_obj_t framebuf_vline(size_t n_args, const mp_obj_t *args) {
(void)n_args; (void)n_args;
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_framebuf_t *self = native_framebuf(args[0]);
mp_int_t x = mp_obj_get_int(args[1]); mp_int_t x = mp_obj_get_int(args[1]);
mp_int_t y = mp_obj_get_int(args[2]); mp_int_t y = mp_obj_get_int(args[2]);
mp_int_t h = mp_obj_get_int(args[3]); mp_int_t h = mp_obj_get_int(args[3]);
@ -387,7 +397,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_vline_obj, 5, 5, framebuf_vl
STATIC mp_obj_t framebuf_rect(size_t n_args, const mp_obj_t *args) { STATIC mp_obj_t framebuf_rect(size_t n_args, const mp_obj_t *args) {
(void)n_args; (void)n_args;
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_framebuf_t *self = native_framebuf(args[0]);
mp_int_t x = mp_obj_get_int(args[1]); mp_int_t x = mp_obj_get_int(args[1]);
mp_int_t y = mp_obj_get_int(args[2]); mp_int_t y = mp_obj_get_int(args[2]);
mp_int_t w = mp_obj_get_int(args[3]); mp_int_t w = mp_obj_get_int(args[3]);
@ -406,7 +416,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_rect_obj, 6, 6, framebuf_rec
STATIC mp_obj_t framebuf_line(size_t n_args, const mp_obj_t *args) { STATIC mp_obj_t framebuf_line(size_t n_args, const mp_obj_t *args) {
(void)n_args; (void)n_args;
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_framebuf_t *self = native_framebuf(args[0]);
mp_int_t x1 = mp_obj_get_int(args[1]); mp_int_t x1 = mp_obj_get_int(args[1]);
mp_int_t y1 = mp_obj_get_int(args[2]); mp_int_t y1 = mp_obj_get_int(args[2]);
mp_int_t x2 = mp_obj_get_int(args[3]); mp_int_t x2 = mp_obj_get_int(args[3]);
@ -470,8 +480,8 @@ STATIC mp_obj_t framebuf_line(size_t n_args, const mp_obj_t *args) {
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_line_obj, 6, 6, framebuf_line); STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_line_obj, 6, 6, framebuf_line);
STATIC mp_obj_t framebuf_blit(size_t n_args, const mp_obj_t *args) { STATIC mp_obj_t framebuf_blit(size_t n_args, const mp_obj_t *args) {
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_framebuf_t *self = native_framebuf(args[0]);
mp_obj_framebuf_t *source = MP_OBJ_TO_PTR(args[1]); mp_obj_framebuf_t *source = native_framebuf(args[1]);
mp_int_t x = mp_obj_get_int(args[2]); mp_int_t x = mp_obj_get_int(args[2]);
mp_int_t y = mp_obj_get_int(args[3]); mp_int_t y = mp_obj_get_int(args[3]);
mp_int_t key = -1; mp_int_t key = -1;
@ -513,7 +523,7 @@ STATIC mp_obj_t framebuf_blit(size_t n_args, const mp_obj_t *args) {
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_blit_obj, 4, 5, framebuf_blit); STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_blit_obj, 4, 5, framebuf_blit);
STATIC mp_obj_t framebuf_scroll(mp_obj_t self_in, mp_obj_t xstep_in, mp_obj_t ystep_in) { STATIC mp_obj_t framebuf_scroll(mp_obj_t self_in, mp_obj_t xstep_in, mp_obj_t ystep_in) {
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(self_in); mp_obj_framebuf_t *self = native_framebuf(self_in);
mp_int_t xstep = mp_obj_get_int(xstep_in); mp_int_t xstep = mp_obj_get_int(xstep_in);
mp_int_t ystep = mp_obj_get_int(ystep_in); mp_int_t ystep = mp_obj_get_int(ystep_in);
int sx, y, xend, yend, dx, dy; int sx, y, xend, yend, dx, dy;
@ -546,7 +556,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(framebuf_scroll_obj, framebuf_scroll);
STATIC mp_obj_t framebuf_text(size_t n_args, const mp_obj_t *args) { STATIC mp_obj_t framebuf_text(size_t n_args, const mp_obj_t *args) {
// extract arguments // extract arguments
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_framebuf_t *self = native_framebuf(args[0]);
const char *str = mp_obj_str_get_str(args[1]); const char *str = mp_obj_str_get_str(args[1]);
mp_int_t x0 = mp_obj_get_int(args[2]); mp_int_t x0 = mp_obj_get_int(args[2]);
mp_int_t y0 = mp_obj_get_int(args[3]); mp_int_t y0 = mp_obj_get_int(args[3]);

1
extmod/ulab Submodule

@ -0,0 +1 @@
Subproject commit a91b36986d81fd906a6232010778f2a93d690f8e

View File

@ -345,14 +345,21 @@ STATIC mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) {
} else { } else {
mode |= MP_S_IFREG; mode |= MP_S_IFREG;
} }
mp_uint_t seconds = timeutils_seconds_since_epoch( #if MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_NONE
1980 + ((fno.fdate >> 9) & 0x7f), // On non-longint builds, the number of seconds since 1970 (epoch) is too
(fno.fdate >> 5) & 0x0f, // large to fit in a smallint, so just return 31-DEC-1999 (0).
fno.fdate & 0x1f, mp_obj_t seconds = MP_OBJ_NEW_SMALL_INT(946684800);
(fno.ftime >> 11) & 0x1f, #else
(fno.ftime >> 5) & 0x3f, mp_obj_t seconds = mp_obj_new_int_from_uint(
2 * (fno.ftime & 0x1f) timeutils_seconds_since_epoch(
); 1980 + ((fno.fdate >> 9) & 0x7f),
(fno.fdate >> 5) & 0x0f,
fno.fdate & 0x1f,
(fno.ftime >> 11) & 0x1f,
(fno.ftime >> 5) & 0x3f,
2 * (fno.ftime & 0x1f)
));
#endif
t->items[0] = MP_OBJ_NEW_SMALL_INT(mode); // st_mode t->items[0] = MP_OBJ_NEW_SMALL_INT(mode); // st_mode
t->items[1] = MP_OBJ_NEW_SMALL_INT(0); // st_ino t->items[1] = MP_OBJ_NEW_SMALL_INT(0); // st_ino
t->items[2] = MP_OBJ_NEW_SMALL_INT(0); // st_dev t->items[2] = MP_OBJ_NEW_SMALL_INT(0); // st_dev
@ -360,9 +367,9 @@ STATIC mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) {
t->items[4] = MP_OBJ_NEW_SMALL_INT(0); // st_uid t->items[4] = MP_OBJ_NEW_SMALL_INT(0); // st_uid
t->items[5] = MP_OBJ_NEW_SMALL_INT(0); // st_gid t->items[5] = MP_OBJ_NEW_SMALL_INT(0); // st_gid
t->items[6] = mp_obj_new_int_from_uint(fno.fsize); // st_size t->items[6] = mp_obj_new_int_from_uint(fno.fsize); // st_size
t->items[7] = mp_obj_new_int_from_uint(seconds); // st_atime t->items[7] = seconds; // st_atime
t->items[8] = mp_obj_new_int_from_uint(seconds); // st_mtime t->items[8] = seconds; // st_mtime
t->items[9] = mp_obj_new_int_from_uint(seconds); // st_ctime t->items[9] = seconds; // st_ctime
return MP_OBJ_FROM_PTR(t); return MP_OBJ_FROM_PTR(t);
} }

View File

@ -28,6 +28,7 @@
#if MICROPY_VFS && MICROPY_VFS_FAT #if MICROPY_VFS && MICROPY_VFS_FAT
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include "py/runtime.h" #include "py/runtime.h"
#include "py/stream.h" #include "py/stream.h"
@ -199,7 +200,7 @@ STATIC mp_obj_t file_open(fs_user_mount_t *vfs, const mp_obj_type_t *type, mp_ar
FRESULT res = f_open(&vfs->fatfs, &o->fp, fname, mode); FRESULT res = f_open(&vfs->fatfs, &o->fp, fname, mode);
if (res != FR_OK) { if (res != FR_OK) {
m_del_obj(pyb_file_obj_t, o); m_del_obj(pyb_file_obj_t, o);
mp_raise_OSError(fresult_to_errno_table[res]); mp_raise_OSError_errno_str(fresult_to_errno_table[res], args[0].u_obj);
} }
// If we're reading, turn on fast seek. // If we're reading, turn on fast seek.
if (mode == FA_READ) { if (mode == FA_READ) {

@ -1 +1 @@
Subproject commit 805d41a021c70df7609da772a6f6131810e5d6ba Subproject commit 0b0d1e999a6c7944e55bed59a30ccc21b3c96666

@ -1 +1 @@
Subproject commit 82ba9e40dfff41fdc0541636afde4936c930d86c Subproject commit 2cf0f40ab818fddbc2cecf3ec495ed16067c5f7e

@ -1 +1 @@
Subproject commit 5534662902a223ac8562e6f999d6359e4c17dab1 Subproject commit 09bd10e94894a4eec7e3a02b51ffb5d8581b3024

@ -1 +1 @@
Subproject commit 01e89a8437c78b62d4d655c745ded57e26dc747a Subproject commit 84eadeafa9144829b8c6faf903b4282d58a77353

@ -0,0 +1 @@
Subproject commit f523b2316bc3e25220b88c5435868c6a5880dfab

@ -1 +1 @@
Subproject commit 2d1dce6ad6ca7e091fd8b5c3f102693c24af8b88 Subproject commit f044548d6d3aa21650b50232bb16e0b29f540b8f

@ -1 +1 @@
Subproject commit 8b7611a2cc076a2ac1b368c70227519f69f1e3e9 Subproject commit 9dac9628e48675308d447b70b2005f7d1f0ddf6b

@ -1 +1 @@
Subproject commit 53146ab2e82c318c3c37bd76bac34035a597b311 Subproject commit 42a55eafcb29f563b31e23af902c31dac8289900

@ -1 +1 @@
Subproject commit f69fc9b47fa25ba1414eb3d5c82f05013280c0d2 Subproject commit ddcd1e7154f1b27f9a87daffb6e691e1e7051b64

@ -1 +1 @@
Subproject commit ff99d55115f81899902c2c4a84fdfbea9ae83823 Subproject commit 10db851c81873fd8db207ff0c4d9342426ee25a4

@ -0,0 +1 @@
Subproject commit c525eedeb0d20c9829febfbf621eab707da71f8a

@ -0,0 +1 @@
Subproject commit e8a759719e94c69a01f9e07d418ca6db39114db3

@ -1 +1 @@
Subproject commit dd0fe8530a2dcc64ac95bb3e116af2158dcd7cd2 Subproject commit efd548b1e36c534bbce494f4cb0d9a625dd170cd

@ -1 +1 @@
Subproject commit 2e5aedf18eb417a4120d4998ac1f387a4f600730 Subproject commit ac83a3dc703ec50b2236c773d22c47a0c0aaba43

@ -1 +1 @@
Subproject commit ea5e445edd4441cacd207aa2d2bfd724b813a253 Subproject commit dc01285aa45dd8260bb3ae35a657e4cdcbf325b8

@ -1 +1 @@
Subproject commit 8d5cc384058b1cb296aaeab86fb8405042d547ed Subproject commit 19a66d79f0650a15e502464b42e16692365eab36

View File

@ -24,6 +24,7 @@
*/ */
#include "fdlibm.h" #include "fdlibm.h"
#pragma GCC diagnostic ignored "-Wfloat-equal"
#define __ieee754_logf logf #define __ieee754_logf logf

View File

@ -18,6 +18,8 @@
#include "libm.h" #include "libm.h"
#pragma GCC diagnostic ignored "-Wfloat-equal"
static const float static const float
ln2_hi = 6.9313812256e-01, /* 0x3f317180 */ ln2_hi = 6.9313812256e-01, /* 0x3f317180 */
ln2_lo = 9.0580006145e-06, /* 0x3717f7d1 */ ln2_lo = 9.0580006145e-06, /* 0x3717f7d1 */

View File

@ -50,6 +50,9 @@ float copysignf(float x, float y) {
static const float _M_LN10 = 2.30258509299404; // 0x40135d8e static const float _M_LN10 = 2.30258509299404; // 0x40135d8e
float log10f(float x) { return logf(x) / (float)_M_LN10; } float log10f(float x) { return logf(x) / (float)_M_LN10; }
#undef _M_LN2
static const float _M_LN2 = 0.6931472;
float log2f(float x) { return logf(x) / (float)_M_LN2; }
float tanhf(float x) { float tanhf(float x) {
if (isinf(x)) { if (isinf(x)) {

View File

@ -206,7 +206,7 @@ int readline_process_char(int c) {
redraw_step_forward = compl_len; redraw_step_forward = compl_len;
} }
#endif #endif
} else if (32 <= c && c <= 126) { } else if (32 <= c ) {
// printable character // printable character
vstr_ins_char(rl.line, rl.cursor_pos, c); vstr_ins_char(rl.line, rl.cursor_pos, c);
// set redraw parameters // set redraw parameters

View File

@ -3382,11 +3382,7 @@ FRESULT f_read (
if (!sect) ABORT(fs, FR_INT_ERR); if (!sect) ABORT(fs, FR_INT_ERR);
sect += csect; sect += csect;
cc = btr / SS(fs); /* When remaining bytes >= sector size, */ cc = btr / SS(fs); /* When remaining bytes >= sector size, */
if (cc if (cc) {/* Read maximum contiguous sectors directly */
#if _FS_DISK_READ_ALIGNED
&& (((int)rbuff & 3) == 0)
#endif
) {/* Read maximum contiguous sectors directly */
if (csect + cc > fs->csize) { /* Clip at cluster boundary */ if (csect + cc > fs->csize) { /* Clip at cluster boundary */
cc = fs->csize - csect; cc = fs->csize - csect;
} }

View File

@ -343,12 +343,6 @@
/ SemaphoreHandle_t and etc.. A header file for O/S definitions needs to be / SemaphoreHandle_t and etc.. A header file for O/S definitions needs to be
/ included somewhere in the scope of ff.h. */ / included somewhere in the scope of ff.h. */
// Set to nonzero if buffers passed to disk_read have a word alignment
// restriction
#ifndef _FS_DISK_READ_ALIGNED
#define _FS_DISK_READ_ALIGNED 0
#endif
/* #include <windows.h> // O/S definitions */ /* #include <windows.h> // O/S definitions */

@ -1 +1 @@
Subproject commit dda4c9a94b509238faa7b5ab5b9464c1d2e63ff0 Subproject commit 1f95f439e11f519e69d75a4a8b7b9f28eaf5060e

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

5
main.c
View File

@ -57,6 +57,8 @@
#include "supervisor/shared/stack.h" #include "supervisor/shared/stack.h"
#include "supervisor/serial.h" #include "supervisor/serial.h"
#include "boards/board.h"
#if CIRCUITPY_DISPLAYIO #if CIRCUITPY_DISPLAYIO
#include "shared-module/displayio/__init__.h" #include "shared-module/displayio/__init__.h"
#endif #endif
@ -425,6 +427,9 @@ int __attribute__((used)) main(void) {
// no SPI flash filesystem, and we might erase the existing one. // no SPI flash filesystem, and we might erase the existing one.
filesystem_init(safe_mode == NO_SAFE_MODE, false); filesystem_init(safe_mode == NO_SAFE_MODE, false);
// displays init after filesystem, since they could share the flash SPI
board_init();
// Reset everything and prep MicroPython to run boot.py. // Reset everything and prep MicroPython to run boot.py.
reset_port(); reset_port();
reset_board(); reset_board();

View File

@ -1 +1,7 @@
mpy-cross /build-*
/mpy-cross
/mpy-cross.static
/mpy-cross.static.exe
/mpy-cross.static-raspbian
/mpy-cross.fuzz
/pitools

View File

@ -11,84 +11,4 @@ override undefine BUILD
override undefine PROG override undefine PROG
endif endif
include ../py/mkenv.mk include mpy-cross.mk
# define main target
ifeq ($(OS),Windows_NT)
# Detect a MINGW32 build, and change the name of the final executable.
PROG = mpy-cross.exe
else
PROG = mpy-cross
endif
# qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h
# OS name, for simple autoconfig
UNAME_S := $(shell uname -s)
# include py core make definitions
include $(TOP)/py/py.mk
INC += -I.
INC += -I$(TOP)
INC += -I$(BUILD)
# compiler settings
CWARN = -Wall -Werror
CWARN += -Wpointer-arith -Wuninitialized
CFLAGS = $(INC) $(CWARN) -std=gnu99 $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA)
CFLAGS += -fdata-sections -ffunction-sections -fno-asynchronous-unwind-tables
# Build a static executable.
# Useful for Windows builds, etc., that must run on multiple operating system versions.
ifdef STATIC_BUILD
CFLAGS += -static -static-libgcc -static-libstdc++
endif
# Debugging/Optimization
ifdef DEBUG
CFLAGS += -g
COPT = -O0
else
COPT = -Os #-DNDEBUG
endif
# On OSX, 'gcc' is a symlink to clang unless a real gcc is installed.
# The unix port of MicroPython on OSX must be compiled with clang,
# while cross-compile ports require gcc, so we test here for OSX and
# if necessary override the value of 'CC' set in py/mkenv.mk
ifeq ($(UNAME_S),Darwin)
CC = clang
# Use clang syntax for map file
LDFLAGS_ARCH = -Wl,-map,$@.map -Wl,-dead_strip
else
# Use gcc syntax for map file
LDFLAGS_ARCH = -Wl,-Map=$@.map,--cref -Wl,--gc-sections
endif
LDFLAGS = $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA)
ifdef STATIC_BUILD
LDFLAGS += -static -static-libgcc -static-libstdc++
endif
# source files
SRC_C = \
main.c \
gccollect.c \
supervisor/stub/safe_mode.c \
supervisor/stub/stack.c \
supervisor/shared/translate.c
# Add fmode when compiling with mingw gcc
COMPILER_TARGET := $(shell $(CC) -dumpmachine)
ifneq (,$(findstring mingw,$(COMPILER_TARGET)))
SRC_C += ports/windows/fmode.c
endif
OBJ = $(PY_O)
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
include $(TOP)/py/mkrules.mk

6
mpy-cross/Makefile.fuzz Normal file
View File

@ -0,0 +1,6 @@
PROG=mpy-cross.fuzz
BUILD=build-static
STATIC_BUILD=1
CC=afl-clang-fast
include mpy-cross.mk

View File

@ -0,0 +1,5 @@
PROG=mpy-cross.static
BUILD=build-static
STATIC_BUILD=1
include mpy-cross.mk

View File

@ -0,0 +1,6 @@
PROG=mpy-cross.static.exe
CROSS_COMPILE = x86_64-w64-mingw32-
BUILD=build-static-mingw
STATIC_BUILD=1
include mpy-cross.mk

View File

@ -0,0 +1,8 @@
PROG=mpy-cross.static-raspbian
BUILD=build-static-raspbian
STATIC_BUILD=1
CROSS_COMPILE = pitools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-
include mpy-cross.mk
$(shell [ -d pitools ] || git clone --progress --verbose https://github.com/raspberrypi/tools.git --depth=1 pitools)

49
mpy-cross/fmode.c Normal file
View File

@ -0,0 +1,49 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2013-2016 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "fmode.h"
#include "py/mpconfig.h"
#include <fcntl.h>
#include <stdlib.h>
// Workaround for setting file translation mode: we must distinguish toolsets
// since mingw has no _set_fmode, and altering msvc's _fmode directly has no effect
STATIC int set_fmode_impl(int mode) {
#ifndef _MSC_VER
_fmode = mode;
return 0;
#else
return _set_fmode(mode);
#endif
}
void set_fmode_binary(void) {
set_fmode_impl(O_BINARY);
}
void set_fmode_text(void) {
set_fmode_impl(O_TEXT);
}

37
mpy-cross/fmode.h Normal file
View File

@ -0,0 +1,37 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2013-2016 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef MICROPY_INCLUDED_WINDOWS_FMODE_H
#define MICROPY_INCLUDED_WINDOWS_FMODE_H
// Treat files opened by open() as binary. No line ending translation is done.
void set_fmode_binary(void);
// Treat files opened by open() as text.
// When reading from the file \r\n will be converted to \n.
// When writing to the file \n will be converted into \r\n.
void set_fmode_text(void);
#endif // MICROPY_INCLUDED_WINDOWS_FMODE_H

View File

@ -35,7 +35,7 @@
#include "py/gc.h" #include "py/gc.h"
#include "py/stackctrl.h" #include "py/stackctrl.h"
#ifdef _WIN32 #ifdef _WIN32
#include "ports/windows/fmode.h" #include "fmode.h"
#endif #endif
// Command line options, with their defaults // Command line options, with their defaults
@ -284,3 +284,7 @@ void nlr_jump_fail(void *val) {
printf("FATAL: uncaught NLR %p\n", val); printf("FATAL: uncaught NLR %p\n", val);
exit(1); exit(1);
} }
void serial_write(const char* text) {
printf("%s", text);
}

81
mpy-cross/mpy-cross.mk Normal file
View File

@ -0,0 +1,81 @@
include ../py/mkenv.mk
# define main target
ifeq ($(OS),Windows_NT)
# Detect a MINGW32 build, and change the name of the final executable.
PROG ?= mpy-cross.exe
else
PROG ?= mpy-cross
endif
# qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h
# OS name, for simple autoconfig
UNAME_S := $(shell uname -s)
# include py core make definitions
include $(TOP)/py/py.mk
INC += -I.
INC += -I$(TOP)
INC += -I$(BUILD)
# compiler settings
CWARN = -Wall -Werror
CWARN += -Wpointer-arith -Wuninitialized
CFLAGS = $(INC) $(CWARN) -std=gnu99 $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA)
CFLAGS += -fdata-sections -ffunction-sections -fno-asynchronous-unwind-tables
# Build a static executable.
# Useful for Windows builds, etc., that must run on multiple operating system versions.
ifdef STATIC_BUILD
CFLAGS += -static -static-libgcc -static-libstdc++
endif
# Debugging/Optimization
ifdef DEBUG
CFLAGS += -g
COPT = -O0
else
COPT = -Os #-DNDEBUG
endif
# On OSX, 'gcc' is a symlink to clang unless a real gcc is installed.
# The unix port of MicroPython on OSX must be compiled with clang,
# while cross-compile ports require gcc, so we test here for OSX and
# if necessary override the value of 'CC' set in py/mkenv.mk
ifeq ($(UNAME_S),Darwin)
CC = clang
# Use clang syntax for map file
LDFLAGS_ARCH = -Wl,-map,$@.map -Wl,-dead_strip
else
# Use gcc syntax for map file
LDFLAGS_ARCH = -Wl,-Map=$@.map,--cref -Wl,--gc-sections
endif
LDFLAGS = $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA)
ifdef STATIC_BUILD
LDFLAGS += -static -static-libgcc -static-libstdc++
endif
# source files
SRC_C = \
main.c \
gccollect.c \
supervisor/stub/safe_mode.c \
supervisor/stub/stack.c \
supervisor/shared/translate.c
# Add fmode when compiling with mingw gcc
COMPILER_TARGET := $(shell $(CC) -dumpmachine)
ifneq (,$(findstring mingw,$(COMPILER_TARGET)))
SRC_C += fmode.c
endif
OBJ = $(PY_O)
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
include $(TOP)/py/mkrules.mk

View File

@ -11,6 +11,7 @@ CircuitPython. Supported boards include:
- Adafruit M0 Bluefruit LE - Adafruit M0 Bluefruit LE
- Arduino Zero - Arduino Zero
- Arduino MKR Zero - Arduino MKR Zero
- Arduino Nano 33 IoT
Pinout Pinout
@ -22,51 +23,51 @@ different names. The table below matches the pin order in
and omits the pins only available on the largest package because all supported and omits the pins only available on the largest package because all supported
boards use smaller version. boards use smaller version.
===================== =================== =============== =========================== ====================== ================ ================== ========================= ================ ================================ ====================== ================ ===================== =================== =================== =============== =========================== ====================== ================ ================== ========================= ================ ================================ ====================== ================
`microcontroller.pin` `board` `microcontroller.pin` `board`
--------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------- -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Datasheet arduino_mkrzero arduino_zero circuitplayground_express feather_m0_adalogger feather_m0_basic feather_m0_express gemma_m0 metro_m0_express sparkfun_samd21_mini sparkfun_samd21_dev trinket_m0 Datasheet arduino_mkrzero arduino_nano_33_iot arduino_zero circuitplayground_express feather_m0_adalogger feather_m0_basic feather_m0_express gemma_m0 metro_m0_express sparkfun_samd21_mini sparkfun_samd21_dev trinket_m0
===================== =================== =============== =========================== ====================== ================ ================== ========================= ================ ================================ ====================== ================ ===================== =================== =================== =============== =========================== ====================== ================ ================== ========================= ================ ================================ ====================== ================
PA00 ``ACCELEROMETER_SDA`` ``APA102_MOSI`` ``APA102_MOSI`` PA00 ``ACCELEROMETER_SDA`` ``APA102_MOSI`` ``APA102_MOSI``
PA01 ``ACCELEROMETER_SCL`` ``APA102_SCK`` ``APA102_SCK`` PA01 ``ACCELEROMETER_SCL`` ``APA102_SCK`` ``APA102_SCK``
PA02 ``A0`` ``A0`` ``A0`` / ``SPEAKER`` ``A0`` ``A0`` ``A0`` ``A0`` / ``D1`` ``A0`` ``A0`` ``A0`` ``D1`` / ``A0`` PA02 ``A0`` ``A0`` ``A0`` ``A0`` / ``SPEAKER`` ``A0`` ``A0`` ``A0`` ``A0`` / ``D1`` ``A0`` ``A0`` ``A0`` ``D1`` / ``A0``
PA03 PA03
PB08 ``L`` ``A1`` ``A7`` / ``TX`` ``A1`` ``A1`` ``A1`` ``A1`` ``A1`` ``A1`` PB08 ``L`` ``A4`` / ``SDA`` ``A1`` ``A7`` / ``TX`` ``A1`` ``A1`` ``A1`` ``A1`` ``A1`` ``A1``
PB09 ``BATTERY`` ``A2`` ``A6`` / ``RX`` ``A2`` ``A2`` ``A2`` ``A2`` ``A2`` ``A2`` PB09 ``BATTERY`` ``A5`` / ``SCL`` ``A2`` ``A6`` / ``RX`` ``A2`` ``A2`` ``A2`` ``A2`` ``A2`` ``A2``
PA04 ``A3`` ``A3`` ``IR_PROXIMITY`` ``A3`` ``A3`` ``A3`` ``D0`` / ``TX`` / ``SDA`` ``A3`` ``A3`` ``A3`` PA04 ``A3`` ``D6`` ``A3`` ``IR_PROXIMITY`` ``A3`` ``A3`` ``A3`` ``D0`` / ``TX`` / ``SDA`` ``A3`` ``A3`` ``A3``
PA05 ``A4`` ``A4`` ``A1`` ``A4`` ``A4`` ``A4`` ``D2`` / ``RX`` / ``SCL`` ``A4`` ``A4`` PA05 ``A4`` ``D5`` ``A4`` ``A1`` ``A4`` ``A4`` ``A4`` ``D2`` / ``RX`` / ``SCL`` ``A4`` ``A4``
PA06 ``A5`` ``D8`` ``A2`` ``D8`` / ``GREEN_LED`` ``NEOPIXEL`` ``D8`` ``D8`` ``D8`` ``D4`` / ``TX`` PA06 ``A5`` ``D7`` ``D8`` ``A2`` ``D8`` / ``GREEN_LED`` ``NEOPIXEL`` ``D8`` ``D8`` ``D8`` ``D4`` / ``TX``
PA07 ``A6`` ``D9`` ``A3`` ``D9`` ``D9`` ``D9`` ``D9`` ``D9`` ``D9`` ``D3`` / ``RX`` PA07 ``A6`` ``D4`` ``D9`` ``A3`` ``D9`` ``D9`` ``D9`` ``D9`` ``D9`` ``D9`` ``D3`` / ``RX``
PA08 ``D11`` / ``SDA`` ``D4`` ``MICROPHONE_DO`` ``D4`` / ``SD_CS`` ``D4`` ``D4`` ``D4`` ``D0`` / ``SDA`` PA08 ``D11`` / ``SDA`` ``ESP_RESET`` ``D4`` ``MICROPHONE_DO`` ``D4`` / ``SD_CS`` ``D4`` ``D4`` ``D4`` ``D0`` / ``SDA``
PA09 ``D12`` / ``SCL`` ``D3`` ``TEMPERATURE`` / ``A9`` ``D3`` ``D3`` ``D3`` ``D2`` / ``SCL`` PA09 ``D12`` / ``SCL`` ``A6`` ``D3`` ``TEMPERATURE`` / ``A9`` ``D3`` ``D3`` ``D3`` ``D2`` / ``SCL``
PA10 ``D2`` ``D1`` / ``TX`` ``MICROPHONE_SCK`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D13`` PA10 ``D2`` ``A3`` ``D1`` / ``TX`` ``MICROPHONE_SCK`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D13``
PA11 ``D3`` ``D0`` / ``RX`` ``LIGHT`` / ``A8`` ``D0`` / ``RX`` ``D0`` / ``RX`` ``D0`` / ``RX`` ``D0`` / ``RX`` ``D0`` / ``RX`` ``D0`` / ``RX`` PA11 ``D3`` ``A2`` ``D0`` / ``RX`` ``LIGHT`` / ``A8`` ``D0`` / ``RX`` ``D0`` / ``RX`` ``D0`` / ``RX`` ``D0`` / ``RX`` ``D0`` / ``RX`` ``D0`` / ``RX``
PB10 ``D4`` ``MOSI`` ``MOSI`` ``MOSI`` ``MOSI`` ``MOSI`` ``MOSI`` PB10 ``D4`` ``D2`` ``MOSI`` ``MOSI`` ``MOSI`` ``MOSI`` ``MOSI`` ``MOSI``
PB11 ``D5`` ``SCK`` ``SCK`` ``SCK`` ``SCK`` ``SCK`` ``SCK`` PB11 ``D5`` ``D3`` ``SCK`` ``SCK`` ``SCK`` ``SCK`` ``SCK`` ``SCK``
PA12 ``SD_MOSI`` ``MISO`` ``REMOTEIN`` / ``IR_RX`` ``MISO`` ``MISO`` ``MISO`` ``MISO`` ``MISO`` PA12 ``SD_MOSI`` ``ESP_MOSI`` ``MISO`` ``REMOTEIN`` / ``IR_RX`` ``MISO`` ``MISO`` ``MISO`` ``MISO`` ``MISO``
PA13 ``SD_SCK`` ``ACCELEROMETER_INTERRUPT`` ``FLASH_CS`` ``D38`` PA13 ``SD_SCK`` ``ESP_MISO`` ``ACCELEROMETER_INTERRUPT`` ``FLASH_CS`` ``D38``
PA14 ``SD_CS`` ``D2`` ``BUTTON_B`` / ``D5`` ``D2`` ``D2`` ``D2`` PA14 ``SD_CS`` ``ESP_CS`` ``D2`` ``BUTTON_B`` / ``D5`` ``D2`` ``D2`` ``D2``
PA15 ``SD_MISO`` ``D5`` ``SLIDE_SWITCH`` / ``D7`` ``D5`` ``D5`` ``D5`` ``D5`` ``D5`` ``D5`` PA15 ``SD_MISO`` ``ESP_SCK`` ``D5`` ``SLIDE_SWITCH`` / ``D7`` ``D5`` ``D5`` ``D5`` ``D5`` ``D5`` ``D5``
PA16 ``D8`` / ``MOSI`` ``D11`` ``MISO`` ``D11`` ``D11`` ``D11`` ``D11`` ``D11`` / ``MOSI`` ``D11`` PA16 ``D8`` / ``MOSI`` ``D11`` / ``MOSI`` ``D11`` ``MISO`` ``D11`` ``D11`` ``D11`` ``D11`` ``D11`` / ``MOSI`` ``D11``
PA17 ``D9`` / ``SCK`` ``D13`` ``D13`` ``D13`` / ``RED_LED`` ``D13`` ``D13`` ``D13`` ``D13`` / ``SCK`` / ``BLUE_LED`` ``D13`` / ``BLUE_LED`` PA17 ``D9`` / ``SCK`` ``D13`` / ``SCK`` ``D13`` ``D13`` ``D13`` / ``RED_LED`` ``D13`` ``D13`` ``D13`` ``D13`` / ``SCK`` / ``BLUE_LED`` ``D13`` / ``BLUE_LED``
PA18 ``D10`` ``D10`` ``D10`` ``D10`` ``D10`` ``D10`` ``D10`` PA18 ``D8`` ``D10`` ``D10`` ``D10`` ``D10`` ``D10`` ``D10`` ``D10``
PA19 ``D10`` / ``MISO`` ``D12`` ``D12`` ``D12`` ``D12`` ``D12`` ``D12`` / ``MISO`` ``D12`` PA19 ``D10`` / ``MISO`` ``D12`` / ``MISO`` ``D12`` ``D12`` ``D12`` ``D12`` ``D12`` ``D12`` / ``MISO`` ``D12``
PA20 ``D6`` ``D6`` ``MOSI`` ``D6`` ``D6`` ``D6`` ``D6`` ``D6`` ``D6`` PA20 ``D6`` ``D9`` ``D6`` ``MOSI`` ``D6`` ``D6`` ``D6`` ``D6`` ``D6`` ``D6``
PA21 ``D7`` ``D7`` ``SCK`` ``D7`` / ``SD_CD`` ``D7`` ``D7`` ``D7`` PA21 ``D7`` ``D10`` ``D7`` ``SCK`` ``D7`` / ``SD_CD`` ``D7`` ``D7`` ``D7``
PA22 ``D0`` ``SDA`` ``SDA`` ``SDA`` ``SDA`` ``SDA`` ``SDA`` ``SDA`` PA22 ``D0`` ``ESP_TX`` ``SDA`` ``SDA`` ``SDA`` ``SDA`` ``SDA`` ``SDA`` ``SDA``
PA23 ``D1`` ``SCL`` ``REMOTEOUT`` / ``IR_TX`` ``SCL`` ``SCL`` ``SCL`` ``L`` / ``D13`` ``SCL`` ``SCL`` ``SCL`` PA23 ``D1`` ``ESP_RX`` ``SCL`` ``REMOTEOUT`` / ``IR_TX`` ``SCL`` ``SCL`` ``SCL`` ``L`` / ``D13`` ``SCL`` ``SCL`` ``SCL``
PA24 PA24
PA25 PA25
PB22 ``D14`` / ``TX`` ``FLASH_CS`` ``D30`` / ``TX1`` PB22 ``D14`` / ``TX`` ``D1`` / ``TX`` ``FLASH_CS`` ``D30`` / ``TX1``
PB23 ``D13`` / ``RX`` ``NEOPIXEL`` / ``D8`` ``D31`` / ``RX1`` PB23 ``D13`` / ``RX`` ``D0`` / ``RX`` ``NEOPIXEL`` / ``D8`` ``D31`` / ``RX1``
PA27 ``SD_CD`` ``GREEN_LED`` ``GREEN_LED`` PA27 ``SD_CD`` ``ESP_GPIO0`` ``GREEN_LED`` ``GREEN_LED``
PA28 ``BUTTON_A`` / ``D4`` PA28 ``ESP_BUSY`` ``BUTTON_A`` / ``D4``
PA29 PA29
PA30 ``SPEAKER_ENABLE`` ``NEOPIXEL`` PA30 ``SPEAKER_ENABLE`` ``NEOPIXEL``
PA31 PA31
PB02 ``A1`` ``A5`` ``A5`` / ``SDA`` ``A5`` ``A5`` ``A5`` ``A5`` ``A5`` PB02 ``A1`` ``A1`` ``A5`` ``A5`` / ``SDA`` ``A5`` ``A5`` ``A5`` ``A5`` ``A5``
PB03 ``A2`` ``A4`` / ``SCL`` ``YELLOW_LED`` ``YELLOW_LED`` PB03 ``A2`` ``A7`` ``A4`` / ``SCL`` ``YELLOW_LED`` ``YELLOW_LED``
===================== =================== =============== =========================== ====================== ================ ================== ========================= ================ ================================ ====================== ================ ===================== =================== =================== =============== =========================== ====================== ================ ================== ========================= ================ ================================ ====================== ================
Here is a table about which pins can do what in CircuitPython terms. However, Here is a table about which pins can do what in CircuitPython terms. However,
just because something is listed, doesn't mean it will always work. Existing use just because something is listed, doesn't mean it will always work. Existing use

View File

@ -203,13 +203,13 @@ audio_dma_result audio_dma_setup_playback(audio_dma_t* dma,
if (output_signed != samples_signed) { if (output_signed != samples_signed) {
output_spacing = 1; output_spacing = 1;
max_buffer_length /= dma->spacing; max_buffer_length /= dma->spacing;
dma->first_buffer = (uint8_t*) m_malloc(max_buffer_length, false); dma->first_buffer = (uint8_t*) m_realloc(dma->first_buffer, max_buffer_length);
if (dma->first_buffer == NULL) { if (dma->first_buffer == NULL) {
return AUDIO_DMA_MEMORY_ERROR; return AUDIO_DMA_MEMORY_ERROR;
} }
dma->first_buffer_free = true; dma->first_buffer_free = true;
if (!single_buffer) { if (!single_buffer) {
dma->second_buffer = (uint8_t*) m_malloc(max_buffer_length, false); dma->second_buffer = (uint8_t*) m_realloc(dma->second_buffer, max_buffer_length);
if (dma->second_buffer == NULL) { if (dma->second_buffer == NULL) {
return AUDIO_DMA_MEMORY_ERROR; return AUDIO_DMA_MEMORY_ERROR;
} }

View File

@ -0,0 +1,37 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2017 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "boards/board.h"
void board_init(void) {
}
bool board_requests_safe_mode(void) {
return false;
}
void reset_board(void) {
}

View File

@ -0,0 +1,28 @@
#define MICROPY_HW_BOARD_NAME "8086 Commander"
#define MICROPY_HW_MCU_NAME "samd21g18"
#define BOARD_HAS_CRYSTAL 0
#define CALIBRATE_CRYSTALLESS 1
#define MICROPY_HW_LED_STATUS (&pin_PA06)
#define MICROPY_PORT_A (0)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
// USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1
#define DEFAULT_I2C_BUS_SCL (&pin_PA23)
#define DEFAULT_I2C_BUS_SDA (&pin_PA22)
#define SPI_FLASH_BAUDRATE (8000000)
#define SPI_FLASH_MISO_PIN &pin_PA19
#define SPI_FLASH_MOSI_PIN &pin_PA16
#define SPI_FLASH_SCK_PIN &pin_PA17
#define SPI_FLASH_CS_PIN &pin_PA18
#define DEFAULT_UART_BUS_RX (&pin_PA11)
#define DEFAULT_UART_BUS_TX (&pin_PA10)

View File

@ -0,0 +1,26 @@
USB_VID = 0x3171
USB_PID = 0x0101
USB_PRODUCT = "Commander"
USB_MANUFACTURER = "8086 Consultancy"
USB_DEVICES= "CDC,MSC,HID"
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = "W25Q128JV_SQ"
LONGINT_IMPL = NONE
CIRCUITPY_SMALL_BUILD = 1
SUPEROPT_GC = 0
CFLAGS_INLINE_LIMIT = 60
# Include these Python libraries in firmware.
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD
#FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_ADXL34x

View File

@ -0,0 +1,63 @@
#include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
// Serial
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) }, // RX
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA11) },
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA10) }, // TX
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA10) },
// Buttons
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA20) }, // 1
{ MP_ROM_QSTR(MP_QSTR_B1), MP_ROM_PTR(&pin_PA20) },
{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA09) }, // 2
{ MP_ROM_QSTR(MP_QSTR_B2), MP_ROM_PTR(&pin_PA09) },
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PB09) }, // 3
{ MP_ROM_QSTR(MP_QSTR_B3), MP_ROM_PTR(&pin_PB09) },
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA02) }, // 4
{ MP_ROM_QSTR(MP_QSTR_B4), MP_ROM_PTR(&pin_PA02) },
// SD Card / SPI
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA13) }, // CS
{ MP_ROM_QSTR(MP_QSTR_CS), MP_ROM_PTR(&pin_PA13) },
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PB10) }, // MOSI
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB10) },
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PB11) }, // SCK
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB11) },
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA12) }, // MISO
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA12) },
// LED
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA15) }, // 1A
{ MP_ROM_QSTR(MP_QSTR_LED1A), MP_ROM_PTR(&pin_PA15) },
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA14) }, // 1B
{ MP_ROM_QSTR(MP_QSTR_LED1B), MP_ROM_PTR(&pin_PA14) },
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA08) }, // 2A
{ MP_ROM_QSTR(MP_QSTR_LED2A), MP_ROM_PTR(&pin_PA08) },
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA07) }, // 2B
{ MP_ROM_QSTR(MP_QSTR_LED2B), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA06) }, // ALERT
{ MP_ROM_QSTR(MP_QSTR_ALERT), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA05) }, // 3A
{ MP_ROM_QSTR(MP_QSTR_LED3A), MP_ROM_PTR(&pin_PA05) },
{ MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_PA04) }, // 3B
{ MP_ROM_QSTR(MP_QSTR_LED3B), MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_PB02) }, // 4A
{ MP_ROM_QSTR(MP_QSTR_LED4A), MP_ROM_PTR(&pin_PB02) },
{ MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_PB03) }, // 4B
{ MP_ROM_QSTR(MP_QSTR_LED4B), MP_ROM_PTR(&pin_PB03) },
// Accelerometer / I2C
{ MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_PA23) }, // SCL
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA23) },
{ MP_ROM_QSTR(MP_QSTR_D20), MP_ROM_PTR(&pin_PA22) }, // SDA
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA22) },
// Comm objects
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -0,0 +1,40 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2017 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "boards/board.h"
#include "mpconfigboard.h"
#include "hal/include/hal_gpio.h"
void board_init(void)
{
}
bool board_requests_safe_mode(void) {
return false;
}
void reset_board(void) {
}

View File

@ -0,0 +1,22 @@
#define MICROPY_HW_BOARD_NAME "Arduino Nano 33 IoT"
#define MICROPY_HW_MCU_NAME "samd21g18"
#define MICROPY_HW_LED_STATUS (&pin_PA17)
#define MICROPY_PORT_A (0)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
#define DEFAULT_I2C_BUS_SCL (&pin_PB09)
#define DEFAULT_I2C_BUS_SDA (&pin_PB08)
#define DEFAULT_SPI_BUS_SCK (&pin_PA17)
#define DEFAULT_SPI_BUS_MOSI (&pin_PA16)
#define DEFAULT_SPI_BUS_MISO (&pin_PA19)
#define DEFAULT_UART_BUS_RX (&pin_PB23)
#define DEFAULT_UART_BUS_TX (&pin_PB22)
// USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1

View File

@ -0,0 +1,13 @@
USB_VID = 0x2341
USB_PID = 0x8057
USB_PRODUCT = "Arduino Nano 33 IoT"
USB_MANUFACTURER = "Arduino"
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_SMALL_BUILD = 1
SUPEROPT_GC = 0

View File

@ -0,0 +1,49 @@
#include "shared-bindings/board/__init__.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) },
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA11) },
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA10) },
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PB08) },
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB08) },
{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB09) },
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB09) },
{ MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PA09) },
{ MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PB03) },
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PB23) },
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB23) },
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PB22) },
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB22) },
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PB10) },
{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PB11) },
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA05) },
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA18) },
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA20) },
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA21) },
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) },
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA16) },
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) },
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA19) },
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) },
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA17) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
// NINA-W102
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RESET), MP_ROM_PTR(&pin_PA08) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_MOSI), MP_ROM_PTR(&pin_PA12) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_MISO), MP_ROM_PTR(&pin_PA13) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_CS), MP_ROM_PTR(&pin_PA14) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_SCK), MP_ROM_PTR(&pin_PA15) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_TX), MP_ROM_PTR(&pin_PA22) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RX), MP_ROM_PTR(&pin_PA23) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_GPIO0), MP_ROM_PTR(&pin_PA27) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_BUSY), MP_ROM_PTR(&pin_PA28) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -0,0 +1,48 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2017 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "boards/board.h"
#include "mpconfigboard.h"
void board_init(void)
{
// struct port_config pin_conf;
// port_get_config_defaults(&pin_conf);
//
// pin_conf.direction = PORT_PIN_DIR_OUTPUT;
// port_pin_set_config(MICROPY_HW_LED_TX, &pin_conf);
// port_pin_set_output_level(MICROPY_HW_LED_TX, true);
//
// port_pin_set_config(MICROPY_HW_LED_RX, &pin_conf);
// port_pin_set_output_level(MICROPY_HW_LED_RX, true);
}
bool board_requests_safe_mode(void) {
return false;
}
void reset_board(void) {
}

View File

@ -0,0 +1,35 @@
#define MICROPY_HW_BOARD_NAME "BDMICRO Vina M0"
#define MICROPY_HW_MCU_NAME "samd21g18"
#define MICROPY_HW_LED_STATUS (&pin_PA28)
#define MICROPY_HW_LED_TX &pin_PA27
#define MICROPY_HW_LED_RX &pin_PA31
// Clock rates are off: Salae reads 12MHz which is the limit even though we set it to the safer 8MHz.
#define SPI_FLASH_BAUDRATE (8000000)
#define SPI_FLASH_MOSI_PIN &pin_PB22
#define SPI_FLASH_MISO_PIN &pin_PB03
#define SPI_FLASH_SCK_PIN &pin_PB23
#define SPI_FLASH_CS_PIN &pin_PA13
// These are pins not to reset.
#define MICROPY_PORT_A (0)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
#define BOARD_HAS_CRYSTAL 0
#define DEFAULT_I2C_BUS_SCL (&pin_PA23)
#define DEFAULT_I2C_BUS_SDA (&pin_PA22)
#define DEFAULT_SPI_BUS_SCK (&pin_PB11)
#define DEFAULT_SPI_BUS_MOSI (&pin_PB10)
#define DEFAULT_SPI_BUS_MISO (&pin_PA12)
#define DEFAULT_UART_BUS_RX (&pin_PA11)
#define DEFAULT_UART_BUS_TX (&pin_PA10)
// USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1

View File

@ -0,0 +1,18 @@
USB_VID = 0x31e2
USB_PID = 0x2002
USB_PRODUCT = "Vina M0"
USB_MANUFACTURER = "BDMICRO LLC"
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = "MX25L51245G"
LONGINT_IMPL = MPZ
CIRCUITPY_BITBANGIO = 0
CIRCUITPY_I2CSLAVE = 0
CFLAGS_INLINE_LIMIT = 60
SUPEROPT_GC = 0

View File

@ -0,0 +1,39 @@
#include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_RTC_INT), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_RTC_CLK), MP_ROM_PTR(&pin_PA01) },
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) },
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB09) },
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA05) },
{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB02) },
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) },
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA11) },
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA10) },
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA10) },
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA14) },
{ MP_ROM_QSTR(MP_QSTR_RTC_TS), MP_ROM_PTR(&pin_PA14) },
{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA09) },
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA08) },
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) },
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) },
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA21) },
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) },
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) },
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) },
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) },
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA22) },
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA23) },
{ MP_ROM_QSTR(MP_QSTR_PGM_LED), MP_ROM_PTR(&pin_PA28) },
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB11) },
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB10) },
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA12) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -0,0 +1,40 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Original work copyright (c) 2017 Scott Shawcroft for Adafruit Industries
* Modified work copyright (c) 2019 Kevin Neubauer for Null Byte Labs LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "boards/board.h"
#include "mpconfigboard.h"
#include "hal/include/hal_gpio.h"
void board_init(void) {
}
bool board_requests_safe_mode(void) {
return false;
}
void reset_board(void) {
}

View File

@ -0,0 +1,35 @@
#define MICROPY_HW_BOARD_NAME "CircuitBrains Basic"
#define MICROPY_HW_MCU_NAME "samd21e18"
#define CIRCUITPY_MCU_FAMILY samd21
#define MICROPY_HW_LED_STATUS (&pin_PA14)
// On-board flash
#define SPI_FLASH_MOSI_PIN &pin_PA16
#define SPI_FLASH_MISO_PIN &pin_PA18
#define SPI_FLASH_SCK_PIN &pin_PA17
#define SPI_FLASH_CS_PIN &pin_PA19
// These are pins not to reset.
#define MICROPY_PORT_A (0)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
#define SPI_FLASH_BAUDRATE (8000000)
#define CALIBRATE_CRYSTALLESS 1
#define DEFAULT_I2C_BUS_SCL (&pin_PA05)
#define DEFAULT_I2C_BUS_SDA (&pin_PA04)
#define DEFAULT_SPI_BUS_SCK (&pin_PA11)
#define DEFAULT_SPI_BUS_MOSI (&pin_PA10)
#define DEFAULT_SPI_BUS_MISO (&pin_PA09)
#define DEFAULT_UART_BUS_RX (&pin_PA07)
#define DEFAULT_UART_BUS_TX (&pin_PA06)
// USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1

View File

@ -0,0 +1,16 @@
USB_VID = 0x04D8
USB_PID = 0xEC63
USB_PRODUCT = "CircuitBrains Basic"
USB_MANUFACTURER = "Kevin Neubauer"
CHIP_VARIANT = SAMD21E18A
CHIP_FAMILY = samd21
SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = "W25Q32JV_IQ"
LONGINT_IMPL = MPZ
CIRCUITPY_BITBANGIO = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_I2CSLAVE = 0

View File

@ -0,0 +1,35 @@
#include "shared-bindings/board/__init__.h"
// 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_rom_map_elem_t board_global_dict_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA06) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA06) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA07) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA07) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA08) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA00) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA01) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA28) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA27) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA23) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA22) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA15) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA14) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_STATUS_LED),MP_ROM_PTR(&pin_PA14) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_PA04) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_PA05) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_SCK),MP_ROM_PTR(&pin_PA11) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_PA10) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_PA09) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -0,0 +1,40 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Original work copyright (c) 2017 Scott Shawcroft for Adafruit Industries
* Modified work copyright (c) 2019 Kevin Neubauer for Null Byte Labs LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "boards/board.h"
#include "mpconfigboard.h"
#include "hal/include/hal_gpio.h"
void board_init(void) {
}
bool board_requests_safe_mode(void) {
return false;
}
void reset_board(void) {
}

View File

@ -0,0 +1,32 @@
#define MICROPY_HW_BOARD_NAME "CircuitBrains Deluxe"
#define MICROPY_HW_MCU_NAME "samd51j19"
#define CIRCUITPY_MCU_FAMILY samd51
#define MICROPY_HW_LED_STATUS (&pin_PB13)
// These are pins not to reset.
// QSPI Data pins
#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11)
// QSPI CS, QSPI SCK
#define MICROPY_PORT_B (PORT_PB10 | PORT_PB11)
#define MICROPY_PORT_C (0)
#define MICROPY_PORT_D (0)
#define AUTORESET_DELAY_MS 500
#define BOARD_HAS_CRYSTAL 1
#define DEFAULT_I2C_BUS_SCL (&pin_PB03)
#define DEFAULT_I2C_BUS_SDA (&pin_PB02)
#define DEFAULT_SPI_BUS_SCK (&pin_PA13)
#define DEFAULT_SPI_BUS_MOSI (&pin_PA12)
#define DEFAULT_SPI_BUS_MISO (&pin_PA14)
#define DEFAULT_UART_BUS_RX (&pin_PA23)
#define DEFAULT_UART_BUS_TX (&pin_PA22)
// USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1

View File

@ -0,0 +1,16 @@
USB_VID = 0x04D8
USB_PID = 0xEC64
USB_PRODUCT = "CircuitBrains Deluxe"
USB_MANUFACTURER = "Kevin Neubauer"
CHIP_VARIANT = SAMD51J19A
CHIP_FAMILY = samd51
QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 2
EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ, S25FL064L"
LONGINT_IMPL = MPZ
CIRCUITPY_NETWORK = 1
MICROPY_PY_WIZNET5K = 5500
CIRCUITPY_PS2IO = 1

View File

@ -0,0 +1,55 @@
#include "shared-bindings/board/__init__.h"
// 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_rom_map_elem_t board_global_dict_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB04) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB05) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PB06) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PB07) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB08) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PB09) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PA04) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PA05) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_PA06) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_PA07) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A11), MP_ROM_PTR(&pin_PB00) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A12), MP_ROM_PTR(&pin_PB01) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA23) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA23) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA22) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA22) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA21) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA20) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PB17) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PB16) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA19) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA18) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA17) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA16) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA15) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PB15) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PB14) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PB13) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_STATUS_LED),MP_ROM_PTR(&pin_PB13) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PB12) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PB31) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_PA27) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_PB23) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_PB22) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_PB02) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_PB03) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_SCK),MP_ROM_PTR(&pin_PA13) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_PA12) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_PA14) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -28,9 +28,8 @@
#include "boards/board.h" #include "boards/board.h"
#include "common-hal/microcontroller/Pin.h" #include "common-hal/microcontroller/Pin.h"
#include "supervisor/shared/board.h"
#include "hal/include/hal_gpio.h" #include "hal/include/hal_gpio.h"
#include "shared-bindings/digitalio/DigitalInOut.h"
#include "shared-bindings/neopixel_write/__init__.h"
void board_init(void) void board_init(void)
{ {
@ -54,12 +53,5 @@ bool board_requests_safe_mode(void) {
} }
void reset_board(void) { void reset_board(void) {
uint8_t empty[30]; board_reset_user_neopixels();
memset(empty, 0, 30);
digitalio_digitalinout_obj_t neopixel_pin;
common_hal_digitalio_digitalinout_construct(&neopixel_pin, &pin_PB23);
common_hal_digitalio_digitalinout_switch_to_output(&neopixel_pin, false,
DRIVE_MODE_PUSH_PULL);
common_hal_neopixel_write(&neopixel_pin, empty, 30);
common_hal_digitalio_digitalinout_deinit(&neopixel_pin);
} }

View File

@ -30,6 +30,8 @@
// Increase stack size slightly due to CPX library import nesting // Increase stack size slightly due to CPX library import nesting
#define CIRCUITPY_DEFAULT_STACK_SIZE (4760) //divisible by 8 #define CIRCUITPY_DEFAULT_STACK_SIZE (4760) //divisible by 8
#define USER_NEOPIXELS_PIN (&pin_PB23)
#define DEFAULT_I2C_BUS_SCL (&pin_PB03) #define DEFAULT_I2C_BUS_SCL (&pin_PB03)
#define DEFAULT_I2C_BUS_SDA (&pin_PB02) #define DEFAULT_I2C_BUS_SDA (&pin_PB02)

View File

@ -29,8 +29,7 @@
#include "boards/board.h" #include "boards/board.h"
#include "common-hal/microcontroller/Pin.h" #include "common-hal/microcontroller/Pin.h"
#include "hal/include/hal_gpio.h" #include "hal/include/hal_gpio.h"
#include "shared-bindings/digitalio/DigitalInOut.h" #include "supervisor/shared/board.h"
#include "shared-bindings/neopixel_write/__init__.h"
void board_init(void) void board_init(void)
{ {
@ -54,12 +53,5 @@ bool board_requests_safe_mode(void) {
} }
void reset_board(void) { void reset_board(void) {
uint8_t empty[30]; board_reset_user_neopixels();
memset(empty, 0, 30);
digitalio_digitalinout_obj_t neopixel_pin;
common_hal_digitalio_digitalinout_construct(&neopixel_pin, &pin_PB23);
common_hal_digitalio_digitalinout_switch_to_output(&neopixel_pin, false,
DRIVE_MODE_PUSH_PULL);
common_hal_neopixel_write(&neopixel_pin, empty, 30);
common_hal_digitalio_digitalinout_deinit(&neopixel_pin);
} }

View File

@ -24,6 +24,8 @@
#define CALIBRATE_CRYSTALLESS 1 #define CALIBRATE_CRYSTALLESS 1
#define USER_NEOPIXELS_PIN (&pin_PB23)
// Explanation of how a user got into safe mode. // Explanation of how a user got into safe mode.
#define BOARD_USER_SAFE_MODE_ACTION "pressing both buttons at start up" #define BOARD_USER_SAFE_MODE_ACTION "pressing both buttons at start up"

View File

@ -14,9 +14,9 @@ EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C"
LONGINT_IMPL = NONE LONGINT_IMPL = NONE
CIRCUITPY_DISPLAYIO = 0 CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_GAMEPAD = 0
CIRCUITPY_I2CSLAVE = 0 CIRCUITPY_I2CSLAVE = 0
CIRCUITPY_PIXELBUF = 0 CIRCUITPY_PIXELBUF = 0
CIRCUITPY_RTC = 0
SUPEROPT_GC = 0 SUPEROPT_GC = 0
CFLAGS_INLINE_LIMIT = 55 CFLAGS_INLINE_LIMIT = 55

View File

@ -29,8 +29,7 @@
#include "boards/board.h" #include "boards/board.h"
#include "common-hal/microcontroller/Pin.h" #include "common-hal/microcontroller/Pin.h"
#include "hal/include/hal_gpio.h" #include "hal/include/hal_gpio.h"
#include "shared-bindings/digitalio/DigitalInOut.h" #include "supervisor/shared/board.h"
#include "shared-bindings/neopixel_write/__init__.h"
void board_init(void) void board_init(void)
{ {
@ -54,12 +53,5 @@ bool board_requests_safe_mode(void) {
} }
void reset_board(void) { void reset_board(void) {
uint8_t empty[30]; board_reset_user_neopixels();
memset(empty, 0, 30);
digitalio_digitalinout_obj_t neopixel_pin;
common_hal_digitalio_digitalinout_construct(&neopixel_pin, &pin_PB23);
common_hal_digitalio_digitalinout_switch_to_output(&neopixel_pin, false,
DRIVE_MODE_PUSH_PULL);
common_hal_neopixel_write(&neopixel_pin, empty, 30);
common_hal_digitalio_digitalinout_deinit(&neopixel_pin);
} }

View File

@ -30,6 +30,8 @@
// Increase stack size slightly due to CPX library import nesting. // Increase stack size slightly due to CPX library import nesting.
#define CIRCUITPY_DEFAULT_STACK_SIZE (4760) // divisible by 8 #define CIRCUITPY_DEFAULT_STACK_SIZE (4760) // divisible by 8
#define USER_NEOPIXELS_PIN (&pin_PB23)
#define DEFAULT_I2C_BUS_SCL (&pin_PB03) #define DEFAULT_I2C_BUS_SCL (&pin_PB03)
#define DEFAULT_I2C_BUS_SDA (&pin_PB02) #define DEFAULT_I2C_BUS_SDA (&pin_PB02)

View File

@ -16,7 +16,6 @@ CIRCUITPY_BITBANGIO = 0
CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_I2CSLAVE = 0 CIRCUITPY_I2CSLAVE = 0
CIRCUITPY_PIXELBUF = 0 CIRCUITPY_PIXELBUF = 0
CIRCUITPY_GAMEPAD = 0
CIRCUITPY_RTC = 0 CIRCUITPY_RTC = 0
SUPEROPT_GC = 0 SUPEROPT_GC = 0

View File

@ -79,7 +79,9 @@ void board_init(void) {
&pin_PA28, // Command or data &pin_PA28, // Command or data
&pin_PA01, // Chip select &pin_PA01, // Chip select
&pin_PA27, // Reset &pin_PA27, // Reset
12000000); 12000000, // Baudrate
0, // Polarity
0); // Phase
displayio_display_obj_t* display = &displays[0].display; displayio_display_obj_t* display = &displays[0].display;
display->base.type = &displayio_display_type; display->base.type = &displayio_display_type;
@ -108,7 +110,8 @@ void board_init(void) {
false, // single_byte_bounds false, // single_byte_bounds
false, // data_as_commands false, // data_as_commands
true, // auto_refresh true, // auto_refresh
60); // native_frames_per_second 60, // native_frames_per_second
true); // backlight_on_high
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -59,7 +59,9 @@ void board_init(void) {
&pin_PB31, // TFT_DC Command or data &pin_PB31, // TFT_DC Command or data
&pin_PA27, // TFT_CS Chip select &pin_PA27, // TFT_CS Chip select
&pin_PB30, // TFT_RST Reset &pin_PB30, // TFT_RST Reset
60000000); 60000000, // Baudrate
0, // Polarity
0); // Phase
displayio_display_obj_t* display = &displays[0].display; displayio_display_obj_t* display = &displays[0].display;
display->base.type = &displayio_display_type; display->base.type = &displayio_display_type;
@ -88,7 +90,8 @@ void board_init(void) {
false, // single_byte_bounds false, // single_byte_bounds
false, // data_as_commands false, // data_as_commands
true, // auto_refresh true, // auto_refresh
60); // native_frames_per_second 60, // native_frames_per_second
true); // backlight_on_high
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -15,3 +15,5 @@ CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_NETWORK = 0 CIRCUITPY_NETWORK = 0
CIRCUITPY_PS2IO = 0 CIRCUITPY_PS2IO = 0
CIRCUITPY_AUDIOMP3 = 0 CIRCUITPY_AUDIOMP3 = 0
CIRCUITPY_ULAB = 0

View File

@ -10,3 +10,5 @@ QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 3 EXTERNAL_FLASH_DEVICE_COUNT = 3
EXTERNAL_FLASH_DEVICES = "S25FL116K, S25FL216K, GD25Q16C" EXTERNAL_FLASH_DEVICES = "S25FL116K, S25FL216K, GD25Q16C"
LONGINT_IMPL = MPZ LONGINT_IMPL = MPZ
CIRCUITPY__EVE = 1

View File

@ -60,7 +60,9 @@ void board_init(void) {
&pin_PA07, // TFT_DC Command or data &pin_PA07, // TFT_DC Command or data
&pin_PA06, // TFT_CS Chip select &pin_PA06, // TFT_CS Chip select
&pin_PA04, // TFT_RST Reset &pin_PA04, // TFT_RST Reset
60000000); 60000000, // Baudrate
0, // Polarity
0); // Phase
displayio_display_obj_t* display = &displays[0].display; displayio_display_obj_t* display = &displays[0].display;
display->base.type = &displayio_display_type; display->base.type = &displayio_display_type;
@ -89,7 +91,8 @@ void board_init(void) {
false, // single_byte_bounds false, // single_byte_bounds
false, // data_as_commands false, // data_as_commands
true, // auto_refresh true, // auto_refresh
60); // native_frames_per_second 60, // native_frames_per_second
true); // backlight_on_high
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

View File

@ -0,0 +1,39 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2017 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "boards/board.h"
#include "mpconfigboard.h"
#include "hal/include/hal_gpio.h"
void board_init(void) {
}
bool board_requests_safe_mode(void) {
return false;
}
void reset_board(void) {
}

View File

@ -0,0 +1,32 @@
#define MICROPY_HW_BOARD_NAME "ndGarage[n°]Bit6:FeatherSnow"
#define MICROPY_HW_MCU_NAME "samd21e18"
#define MICROPY_HW_LED_STATUS (&pin_PA23)
#define SPI_FLASH_MOSI_PIN &pin_PA16
#define SPI_FLASH_MISO_PIN &pin_PA18
#define SPI_FLASH_SCK_PIN &pin_PA17
#define SPI_FLASH_CS_PIN &pin_PA15
#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
#define CIRCUITPY_INTERNAL_NVM_SIZE 256
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 CIRCUITPY_INTERNAL_NVM_SIZE)
#define DEFAULT_I2C_BUS_SCL (&pin_PA09)
#define DEFAULT_I2C_BUS_SDA (&pin_PA08)
#define DEFAULT_SPI_BUS_SCK (&pin_PA05)
#define DEFAULT_SPI_BUS_MOSI (&pin_PA04)
#define DEFAULT_SPI_BUS_MISO (&pin_PA06)
#define DEFAULT_UART_BUS_RX (&pin_PA09)
#define DEFAULT_UART_BUS_TX (&pin_PA08)
// USB is always used.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1

View File

@ -0,0 +1,15 @@
LD_FILE = boards/samd21x18-bootloader.ld
USB_VID = 0x239A
USB_PID = 0x8066
USB_PRODUCT = "Bit6"
USB_MANUFACTURER = "ndGarage"
CHIP_VARIANT = SAMD21E18A
CHIP_FAMILY = samd21
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_SMALL_BUILD = 1
SUPEROPT_GC = 0

View File

@ -0,0 +1,39 @@
#include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA05) },
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA08) },
{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA11) },
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA22) },
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA28) },
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA03) },
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA09) },
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA15) },
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA23) },
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA01) },
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA10) },
{ MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_PA14) },
{ MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_PA27) },
{ MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA05) },
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA08) },
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA09) },
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA09) },
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA08) },
{ MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_PA23) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -65,7 +65,9 @@ void board_init(void) {
&pin_PB05, // EPD_DC Command or data &pin_PB05, // EPD_DC Command or data
&pin_PB07, // EPD_CS Chip select &pin_PB07, // EPD_CS Chip select
&pin_PA00, // EPD_RST Reset &pin_PA00, // EPD_RST Reset
1000000); 1000000, // Baudrate
0, // Polarity
0); // Phase
displayio_epaperdisplay_obj_t* display = &displays[0].epaper_display; displayio_epaperdisplay_obj_t* display = &displays[0].epaper_display;
display->base.type = &displayio_epaperdisplay_type; display->base.type = &displayio_epaperdisplay_type;

View File

@ -107,7 +107,9 @@ void board_init(void) {
&pin_PA16, // TFT_DC Command or data &pin_PA16, // TFT_DC Command or data
&pin_PA11, // TFT_CS Chip select &pin_PA11, // TFT_CS Chip select
&pin_PA17, // TFT_RST Reset &pin_PA17, // TFT_RST Reset
60000000); 60000000, // Baudrate
0, // Polarity
0); // Phase
uint32_t cfg0 = lookupCfg(CFG_DISPLAY_CFG0, 0x000000); uint32_t cfg0 = lookupCfg(CFG_DISPLAY_CFG0, 0x000000);
uint32_t offX = (cfg0 >> 8) & 0xff; uint32_t offX = (cfg0 >> 8) & 0xff;
@ -139,7 +141,8 @@ void board_init(void) {
false, // single_byte_bounds false, // single_byte_bounds
false, // data_as_commands false, // data_as_commands
false, // auto_refresh false, // auto_refresh
20); // native_frames_per_second 20, // native_frames_per_second
true); // backlight_on_high
} }
bool board_requests_safe_mode(void) { bool board_requests_safe_mode(void) {

Some files were not shown because too many files have changed in this diff Show More