summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucian Copeland <hierophect@gmail.com>2020-04-17 13:27:48 -0400
committerLucian Copeland <hierophect@gmail.com>2020-04-17 13:27:48 -0400
commit25245bc44204856c6fd834d7d2bc30187a77bc3a (patch)
tree61995279880cd0a49b797d0ad3897a38e3312bbc
parent3c50098dfc353b0f30f3a743d45dce9de95e060a (diff)
parent1a71c8c51577cc7014d5db1c05084778c0b977e9 (diff)
Merge remote-tracking branch 'upstream/master' into stm32-docfix
-rw-r--r--.github/workflows/build.yml115
-rw-r--r--.github/workflows/create_website_pr.yml11
-rw-r--r--.gitmodules25
-rw-r--r--CODE_OF_CONDUCT.md125
-rw-r--r--Makefile2
-rw-r--r--conf.py40
-rw-r--r--docs/design_guide.rst4
-rw-r--r--docs/library/network.rst2
-rw-r--r--docs/supported_ports.rst2
m---------extmod/ulab0
-rw-r--r--extmod/vfs_fat.c29
m---------frozen/Adafruit_CircuitPython_ESP32SPI0
m---------frozen/Adafruit_CircuitPython_Register0
m---------frozen/Adafruit_CircuitPython_Requests0
-rw-r--r--lib/libm/erf_lgamma.c1
-rw-r--r--lib/libm/log1pf.c2
-rw-r--r--lib/libm/math.c3
-rw-r--r--lib/mp-readline/readline.c2
-rw-r--r--lib/oofatfs/ff.c6
-rw-r--r--lib/oofatfs/ffconf.h6
m---------lib/protomatter0
-rw-r--r--locale/ID.po455
-rw-r--r--locale/circuitpython.pot455
-rw-r--r--locale/de_DE.po455
-rw-r--r--locale/en_US.po455
-rw-r--r--locale/en_x_pirate.po455
-rw-r--r--locale/es.po455
-rw-r--r--locale/fil.po455
-rw-r--r--locale/fr.po455
-rw-r--r--locale/it_IT.po455
-rw-r--r--locale/ko.po455
-rw-r--r--locale/pl.po455
-rw-r--r--locale/pt_BR.po455
-rw-r--r--locale/zh_Latn_pinyin.po610
-rw-r--r--mpy-cross/.gitignore1
-rw-r--r--mpy-cross/Makefile.fuzz6
-rw-r--r--ports/atmel-samd/README.rst79
-rw-r--r--ports/atmel-samd/boards/8086_commander/board.c37
-rw-r--r--ports/atmel-samd/boards/8086_commander/mpconfigboard.h28
-rw-r--r--ports/atmel-samd/boards/8086_commander/mpconfigboard.mk26
-rw-r--r--ports/atmel-samd/boards/8086_commander/pins.c63
-rw-r--r--ports/atmel-samd/boards/arduino_nano_33_iot/board.c40
-rw-r--r--ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.h22
-rw-r--r--ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.mk13
-rw-r--r--ports/atmel-samd/boards/arduino_nano_33_iot/pins.c49
-rw-r--r--ports/atmel-samd/boards/bdmicro_vina_m0/board.c48
-rw-r--r--ports/atmel-samd/boards/bdmicro_vina_m0/mpconfigboard.h35
-rw-r--r--ports/atmel-samd/boards/bdmicro_vina_m0/mpconfigboard.mk18
-rw-r--r--ports/atmel-samd/boards/bdmicro_vina_m0/pins.c39
-rwxr-xr-xports/atmel-samd/boards/circuitbrains_basic_m0/board.c40
-rwxr-xr-xports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.h35
-rwxr-xr-xports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.mk16
-rwxr-xr-xports/atmel-samd/boards/circuitbrains_basic_m0/pins.c35
-rwxr-xr-xports/atmel-samd/boards/circuitbrains_deluxe_m4/board.c40
-rwxr-xr-xports/atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.h32
-rwxr-xr-xports/atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.mk16
-rwxr-xr-xports/atmel-samd/boards/circuitbrains_deluxe_m4/pins.c55
-rw-r--r--ports/atmel-samd/boards/hallowing_m0_express/board.c8
-rw-r--r--ports/atmel-samd/boards/hallowing_m4_express/board.c10
-rw-r--r--ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk4
-rw-r--r--ports/atmel-samd/boards/metro_m4_express/mpconfigboard.mk2
-rw-r--r--ports/atmel-samd/boards/monster_m4sk/board.c10
-rw-r--r--ports/atmel-samd/boards/nfc_copy_cat/board.c38
-rw-r--r--ports/atmel-samd/boards/nfc_copy_cat/mpconfigboard.h51
-rw-r--r--ports/atmel-samd/boards/nfc_copy_cat/mpconfigboard.mk14
-rw-r--r--ports/atmel-samd/boards/nfc_copy_cat/pins.c20
-rw-r--r--ports/atmel-samd/boards/openbook_m4/board.c6
-rw-r--r--ports/atmel-samd/boards/pewpew_m4/board.c10
-rw-r--r--ports/atmel-samd/boards/pybadge/board.c14
-rw-r--r--ports/atmel-samd/boards/pybadge_airlift/board.c10
-rw-r--r--ports/atmel-samd/boards/pycubed/board.c (renamed from ports/stm32f4/common-hal/pulseio/PulseOut.c)44
-rw-r--r--ports/atmel-samd/boards/pycubed/mpconfigboard.h34
-rw-r--r--ports/atmel-samd/boards/pycubed/mpconfigboard.mk26
-rw-r--r--ports/atmel-samd/boards/pycubed/pins.c55
-rw-r--r--ports/atmel-samd/boards/pygamer/board.c14
-rw-r--r--ports/atmel-samd/boards/pygamer_advance/board.c10
-rw-r--r--ports/atmel-samd/boards/pyportal/board.c4
-rw-r--r--ports/atmel-samd/boards/pyportal_titano/board.c4
-rw-r--r--ports/atmel-samd/boards/robohatmm1_m4/mpconfigboard.mk2
-rw-r--r--ports/atmel-samd/boards/sam32/mpconfigboard.h13
-rw-r--r--ports/atmel-samd/boards/sam32/mpconfigboard.mk7
-rw-r--r--ports/atmel-samd/boards/sam32/pins.c33
-rw-r--r--ports/atmel-samd/boards/sparkfun_samd51_thing_plus/board.c38
-rw-r--r--ports/atmel-samd/boards/sparkfun_samd51_thing_plus/mpconfigboard.h33
-rw-r--r--ports/atmel-samd/boards/sparkfun_samd51_thing_plus/mpconfigboard.mk17
-rw-r--r--ports/atmel-samd/boards/sparkfun_samd51_thing_plus/pins.c37
-rw-r--r--ports/atmel-samd/boards/uartlogger2/board.c39
-rw-r--r--ports/atmel-samd/boards/uartlogger2/mpconfigboard.h35
-rw-r--r--ports/atmel-samd/boards/uartlogger2/mpconfigboard.mk12
-rw-r--r--ports/atmel-samd/boards/uartlogger2/pins.c55
-rw-r--r--ports/atmel-samd/boards/ugame10/board.c8
-rw-r--r--ports/atmel-samd/boards/winterbloom_big_honking_button/board.c38
-rw-r--r--ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.h20
-rw-r--r--ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk34
-rw-r--r--ports/atmel-samd/boards/winterbloom_big_honking_button/pins.c10
-rw-r--r--ports/atmel-samd/boards/winterbloom_sol/mpconfigboard.mk8
-rw-r--r--ports/atmel-samd/common-hal/_protomatter/Protomatter.c78
-rw-r--r--ports/atmel-samd/common-hal/_protomatter/Protomatter.h35
-rw-r--r--ports/atmel-samd/common-hal/_protomatter/__init__.c0
-rw-r--r--ports/atmel-samd/common-hal/analogio/AnalogIn.c4
-rw-r--r--ports/atmel-samd/common-hal/audiobusio/I2SOut.c12
-rw-r--r--ports/atmel-samd/common-hal/audiobusio/PDMIn.c9
-rw-r--r--ports/atmel-samd/common-hal/audioio/AudioOut.c9
-rw-r--r--ports/atmel-samd/common-hal/busio/SPI.c4
-rw-r--r--ports/atmel-samd/common-hal/busio/UART.c19
-rw-r--r--ports/atmel-samd/common-hal/digitalio/DigitalInOut.c4
-rw-r--r--ports/atmel-samd/common-hal/microcontroller/Pin.c12
-rw-r--r--ports/atmel-samd/common-hal/pulseio/PWMOut.c31
-rw-r--r--ports/atmel-samd/common-hal/time/__init__.c11
-rw-r--r--ports/atmel-samd/mpconfigport.h30
-rw-r--r--ports/atmel-samd/mpconfigport.mk20
m---------ports/atmel-samd/peripherals0
-rw-r--r--ports/atmel-samd/timer_handler.c7
-rw-r--r--ports/atmel-samd/timer_handler.h5
-rw-r--r--ports/cxd56/Makefile4
-rw-r--r--ports/cxd56/boards/spresense/mpconfigboard.h3
-rw-r--r--ports/cxd56/common-hal/analogio/AnalogIn.c4
-rw-r--r--ports/cxd56/common-hal/busio/UART.c12
-rw-r--r--ports/cxd56/common-hal/digitalio/DigitalInOut.c4
-rw-r--r--ports/cxd56/common-hal/pulseio/PWMOut.c8
-rw-r--r--ports/cxd56/common-hal/pulseio/PulseIn.c25
-rw-r--r--ports/cxd56/common-hal/time/__init__.c8
-rw-r--r--ports/cxd56/mpconfigport.mk2
-rw-r--r--ports/litex/Makefile200
-rw-r--r--ports/litex/background.c (renamed from ports/stm32f4/background.c)0
-rw-r--r--ports/litex/background.h (renamed from ports/stm32f4/background.h)6
-rw-r--r--ports/litex/boards/board.h45
-rw-r--r--ports/litex/boards/fomu/board.c75
-rw-r--r--ports/litex/boards/fomu/csr.h647
-rw-r--r--ports/litex/boards/fomu/fomu-spi.ld116
-rw-r--r--ports/litex/boards/fomu/generated/soc.h58
-rw-r--r--ports/litex/boards/fomu/mpconfigboard.h37
-rw-r--r--ports/litex/boards/fomu/mpconfigboard.mk20
-rw-r--r--ports/litex/boards/fomu/pins.c9
-rw-r--r--ports/litex/boards/fomu/profiling.gdb.txt16
-rw-r--r--ports/litex/common-hal/digitalio/DigitalInOut.c119
-rw-r--r--ports/litex/common-hal/digitalio/DigitalInOut.h38
-rw-r--r--ports/litex/common-hal/digitalio/__init__.c (renamed from ports/stm32f4/common-hal/digitalio/__init__.c)0
-rw-r--r--ports/litex/common-hal/microcontroller/Pin.c56
-rw-r--r--ports/litex/common-hal/microcontroller/Pin.h59
-rw-r--r--ports/litex/common-hal/microcontroller/Processor.c (renamed from ports/stm32f4/common-hal/microcontroller/Processor.c)25
-rw-r--r--ports/litex/common-hal/microcontroller/Processor.h39
-rw-r--r--ports/litex/common-hal/microcontroller/__init__.c111
-rw-r--r--ports/litex/common-hal/neopixel_write/__init__.c93
-rw-r--r--ports/litex/common-hal/os/__init__.c61
-rw-r--r--[-rwxr-xr-x]ports/litex/common-hal/supervisor/Runtime.c (renamed from ports/stm32f4/common-hal/supervisor/Runtime.c)0
-rw-r--r--[-rwxr-xr-x]ports/litex/common-hal/supervisor/Runtime.h (renamed from ports/stm32f4/common-hal/supervisor/Runtime.h)6
-rw-r--r--[-rwxr-xr-x]ports/litex/common-hal/supervisor/__init__.c (renamed from ports/stm32f4/common-hal/supervisor/__init__.c)0
-rw-r--r--ports/litex/common-hal/time/__init__.c (renamed from ports/stm32f4/common-hal/time/__init__.c)8
-rw-r--r--ports/litex/crt0-vexriscv.S94
-rw-r--r--ports/litex/fatfs_port.c (renamed from ports/stm32f4/fatfs_port.c)0
-rw-r--r--ports/litex/hw/common.h33
-rw-r--r--ports/litex/irq.h71
-rw-r--r--ports/litex/mpconfigport.h (renamed from ports/stm32f4/mpconfigport.h)26
-rw-r--r--ports/litex/mpconfigport.mk31
-rw-r--r--ports/litex/mphalport.c85
-rw-r--r--ports/litex/mphalport.h (renamed from ports/stm32f4/mphalport.h)5
-rw-r--r--ports/litex/qstrdefsport.h (renamed from ports/stm32f4/qstrdefsport.h)0
-rw-r--r--ports/litex/supervisor/internal_flash.c350
-rw-r--r--ports/litex/supervisor/internal_flash.h38
-rw-r--r--ports/litex/supervisor/internal_flash_root_pointers.h31
-rw-r--r--ports/litex/supervisor/port.c (renamed from ports/stm32f4/supervisor/port.c)49
-rw-r--r--ports/litex/supervisor/usb.c36
-rw-r--r--ports/litex/tick.c82
-rw-r--r--ports/litex/tick.h46
-rw-r--r--ports/mimxrt10xx/Makefile8
-rw-r--r--ports/mimxrt10xx/background.c3
-rw-r--r--ports/mimxrt10xx/boards/feather_m7_1011/board.c39
-rw-r--r--ports/mimxrt10xx/boards/feather_m7_1011/flash_config.c122
-rw-r--r--ports/mimxrt10xx/boards/feather_m7_1011/mpconfigboard.h20
-rw-r--r--ports/mimxrt10xx/boards/feather_m7_1011/mpconfigboard.mk12
-rw-r--r--ports/mimxrt10xx/boards/feather_m7_1011/pins.c43
-rw-r--r--ports/mimxrt10xx/boards/feather_mimxrt1011/mpconfigboard.mk4
-rw-r--r--ports/mimxrt10xx/boards/imxrt1020_evk/flash_config.c6
-rw-r--r--ports/mimxrt10xx/common-hal/analogio/AnalogIn.c4
-rw-r--r--ports/mimxrt10xx/common-hal/busio/I2C.c4
-rw-r--r--ports/mimxrt10xx/common-hal/busio/SPI.c20
-rw-r--r--ports/mimxrt10xx/common-hal/busio/UART.c96
-rw-r--r--ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c4
-rw-r--r--ports/mimxrt10xx/common-hal/displayio/ParallelBus.c68
-rw-r--r--ports/mimxrt10xx/common-hal/displayio/ParallelBus.h36
-rw-r--r--ports/mimxrt10xx/common-hal/microcontroller/Pin.c4
-rw-r--r--ports/mimxrt10xx/common-hal/microcontroller/Processor.c11
-rw-r--r--ports/mimxrt10xx/common-hal/neopixel_write/__init__.c19
-rw-r--r--ports/mimxrt10xx/common-hal/time/__init__.c12
-rw-r--r--ports/mimxrt10xx/linking/flash/W25Q32JV.ld1
-rw-r--r--ports/mimxrt10xx/mpconfigport.h2
-rw-r--r--ports/mimxrt10xx/mpconfigport.mk1
-rw-r--r--ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.c20
-rw-r--r--ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.h2
-rw-r--r--ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.c132
-rw-r--r--ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.h2
-rw-r--r--ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.c40
-rw-r--r--ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.h2
-rw-r--r--ports/mimxrt10xx/supervisor/flexspi_nor_flash_ops.c4
-rw-r--r--ports/mimxrt10xx/supervisor/port.c2
-rwxr-xr-xports/nrf/Makefile1
-rw-r--r--ports/nrf/boards/TG-Watch02A/board.c (renamed from ports/stm32f4/boards/pyboard_v11/board.c)0
-rw-r--r--ports/nrf/boards/TG-Watch02A/mpconfigboard.h61
-rw-r--r--ports/nrf/boards/TG-Watch02A/mpconfigboard.mk11
-rw-r--r--ports/nrf/boards/TG-Watch02A/pins.c51
-rw-r--r--ports/nrf/boards/clue_nrf52840_express/board.c10
-rw-r--r--ports/nrf/boards/common.template.ld8
-rw-r--r--ports/nrf/boards/feather_bluefruit_sense/mpconfigboard.h2
-rw-r--r--ports/nrf/boards/feather_bluefruit_sense/pins.c8
-rw-r--r--ports/nrf/boards/metro_nrf52840_express/mpconfigboard.mk2
-rw-r--r--ports/nrf/boards/ohs2020_badge/board.c12
-rw-r--r--ports/nrf/boards/ohs2020_badge/pins.c5
-rw-r--r--ports/nrf/boards/pca10056/mpconfigboard.h1
-rw-r--r--ports/nrf/common-hal/_bleio/Adapter.c5
-rw-r--r--ports/nrf/common-hal/_bleio/Connection.c3
-rw-r--r--ports/nrf/common-hal/_bleio/PacketBuffer.c14
-rw-r--r--ports/nrf/common-hal/_bleio/__init__.c7
-rw-r--r--ports/nrf/common-hal/_protomatter/Protomatter.c66
-rw-r--r--ports/nrf/common-hal/_protomatter/Protomatter.h35
-rw-r--r--ports/nrf/common-hal/_protomatter/__init__.c0
-rw-r--r--ports/nrf/common-hal/analogio/AnalogIn.c4
-rw-r--r--ports/nrf/common-hal/audiobusio/PDMIn.c3
-rw-r--r--ports/nrf/common-hal/audiopwmio/PWMAudioOut.c3
-rw-r--r--ports/nrf/common-hal/busio/SPI.c169
-rw-r--r--ports/nrf/common-hal/busio/SPI.h4
-rw-r--r--ports/nrf/common-hal/busio/UART.c27
-rw-r--r--ports/nrf/common-hal/digitalio/DigitalInOut.c4
-rw-r--r--ports/nrf/common-hal/microcontroller/Pin.c12
-rw-r--r--ports/nrf/common-hal/neopixel_write/__init__.c52
-rw-r--r--ports/nrf/common-hal/neopixel_write/__init__.h32
-rw-r--r--ports/nrf/common-hal/pulseio/PulseOut.c5
-rw-r--r--ports/nrf/common-hal/time/__init__.c8
-rw-r--r--ports/nrf/ld_defines.c3
-rw-r--r--ports/nrf/mpconfigport.h39
-rw-r--r--ports/nrf/mpconfigport.mk4
-rw-r--r--ports/nrf/nrfx_config.h18
-rw-r--r--ports/nrf/peripherals/nrf/timers.c55
-rw-r--r--ports/nrf/peripherals/nrf/timers.h5
-rw-r--r--ports/nrf/supervisor/port.c2
-rw-r--r--ports/nrf/supervisor/qspi_flash.c43
-rw-r--r--ports/stm/.gitignore (renamed from ports/stm32f4/.gitignore)0
-rwxr-xr-xports/stm/Makefile (renamed from ports/stm32f4/Makefile)197
-rw-r--r--ports/stm/README.md3
-rw-r--r--ports/stm/background.c60
-rw-r--r--ports/stm/background.h35
-rw-r--r--ports/stm/boards/STM32F401xd_fs.ld26
-rw-r--r--ports/stm/boards/STM32F401xe_boot.ld26
-rw-r--r--ports/stm/boards/STM32F401xe_fs.ld26
-rw-r--r--ports/stm/boards/STM32F405_boot.ld27
-rw-r--r--ports/stm/boards/STM32F405_default.ld27
-rw-r--r--ports/stm/boards/STM32F405_fs.ld28
-rw-r--r--ports/stm/boards/STM32F407_fs.ld28
-rw-r--r--ports/stm/boards/STM32F411_fs.ld27
-rw-r--r--ports/stm/boards/STM32F411_nvm.ld27
-rw-r--r--ports/stm/boards/STM32F412_fs.ld27
-rw-r--r--ports/stm/boards/STM32F767_fs.ld27
-rw-r--r--ports/stm/boards/STM32H743_fs.ld39
-rw-r--r--ports/stm/boards/board.h (renamed from ports/stm32f4/boards/board.h)0
-rw-r--r--ports/stm/boards/common_default.ld (renamed from ports/stm32f4/boards/STM32F401_boot.ld)41
-rw-r--r--ports/stm/boards/common_nvm.ld (renamed from ports/stm32f4/boards/STM32F405_default.ld)54
-rw-r--r--ports/stm/boards/common_tcm.ld (renamed from ports/stm32f4/boards/STM32F401_fs.ld)90
-rw-r--r--ports/stm/boards/espruino_pico/README.md15
-rw-r--r--ports/stm/boards/espruino_pico/board.c (renamed from ports/stm32f4/boards/feather_stm32f405_express/board.c)0
-rw-r--r--ports/stm/boards/espruino_pico/mpconfigboard.h39
-rw-r--r--ports/stm/boards/espruino_pico/mpconfigboard.mk15
-rw-r--r--ports/stm/boards/espruino_pico/pins.c33
-rw-r--r--ports/stm/boards/espruino_pico/stm32f4xx_hal_conf.h (renamed from ports/stm32f4/boards/pyb_nano_v2/stm32f4xx_hal_conf.h)0
-rw-r--r--ports/stm/boards/espruino_wifi/README.MD15
-rw-r--r--ports/stm/boards/espruino_wifi/board.c (renamed from ports/stm32f4/boards/stm32f411ve_discovery/board.c)0
-rw-r--r--ports/stm/boards/espruino_wifi/mpconfigboard.h36
-rw-r--r--ports/stm/boards/espruino_wifi/mpconfigboard.mk15
-rw-r--r--ports/stm/boards/espruino_wifi/pins.c39
-rw-r--r--ports/stm/boards/espruino_wifi/stm32f4xx_hal_conf.h (renamed from ports/stm32f4/boards/stm32f411ve_discovery/stm32f4xx_hal_conf.h)0
-rw-r--r--ports/stm/boards/feather_stm32f405_express/board.c (renamed from ports/stm32f4/boards/pyb_nano_v2/board.c)0
-rw-r--r--ports/stm/boards/feather_stm32f405_express/mpconfigboard.h (renamed from ports/stm32f4/boards/feather_stm32f405_express/mpconfigboard.h)4
-rw-r--r--ports/stm/boards/feather_stm32f405_express/mpconfigboard.mk (renamed from ports/stm32f4/boards/feather_stm32f405_express/mpconfigboard.mk)11
-rw-r--r--ports/stm/boards/feather_stm32f405_express/pins.c (renamed from ports/stm32f4/boards/feather_stm32f405_express/pins.c)0
-rw-r--r--ports/stm/boards/feather_stm32f405_express/stm32f4xx_hal_conf.h (renamed from ports/stm32f4/boards/feather_stm32f405_express/stm32f4xx_hal_conf.h)0
-rw-r--r--ports/stm/boards/meowbit_v121/board.c (renamed from ports/stm32f4/boards/meowbit_v121/board.c)10
-rw-r--r--ports/stm/boards/meowbit_v121/mpconfigboard.h (renamed from ports/stm32f4/boards/meowbit_v121/mpconfigboard.h)6
-rw-r--r--ports/stm/boards/meowbit_v121/mpconfigboard.mk (renamed from ports/stm32f4/boards/meowbit_v121/mpconfigboard.mk)17
-rw-r--r--ports/stm/boards/meowbit_v121/pins.c (renamed from ports/stm32f4/boards/meowbit_v121/pins.c)0
-rw-r--r--ports/stm/boards/meowbit_v121/stm32f4xx_hal_conf.h (renamed from ports/stm32f4/boards/meowbit_v121/stm32f4xx_hal_conf.h)0
-rw-r--r--ports/stm/boards/nucleo_f767zi/board.c (renamed from ports/stm32f4/boards/stm32f412zg_discovery/board.c)0
-rw-r--r--ports/stm/boards/nucleo_f767zi/mpconfigboard.h35
-rw-r--r--ports/stm/boards/nucleo_f767zi/mpconfigboard.mk15
-rw-r--r--ports/stm/boards/nucleo_f767zi/pins.c142
-rw-r--r--ports/stm/boards/nucleo_f767zi/stm32f7xx_hal_conf.h445
-rw-r--r--ports/stm/boards/nucleo_h743zi_2/board.c38
-rw-r--r--ports/stm/boards/nucleo_h743zi_2/mpconfigboard.h34
-rw-r--r--ports/stm/boards/nucleo_h743zi_2/mpconfigboard.mk15
-rw-r--r--ports/stm/boards/nucleo_h743zi_2/pins.c98
-rw-r--r--ports/stm/boards/nucleo_h743zi_2/stm32h7xx_hal_conf.h493
-rw-r--r--ports/stm/boards/openocd_stm32f4.cfg (renamed from ports/stm32f4/boards/openocd_stm32f4.cfg)0
-rw-r--r--ports/stm/boards/pyb_nano_v2/board.c (renamed from ports/stm32f4/boards/stm32f411ce_blackpill/board.c)0
-rw-r--r--ports/stm/boards/pyb_nano_v2/mpconfigboard.h (renamed from ports/stm32f4/boards/pyb_nano_v2/mpconfigboard.h)6
-rw-r--r--ports/stm/boards/pyb_nano_v2/mpconfigboard.mk (renamed from ports/stm32f4/boards/pyb_nano_v2/mpconfigboard.mk)13
-rw-r--r--ports/stm/boards/pyb_nano_v2/pins.c (renamed from ports/stm32f4/boards/pyb_nano_v2/pins.c)0
-rw-r--r--ports/stm/boards/pyb_nano_v2/stm32f4xx_hal_conf.h440
-rw-r--r--ports/stm/boards/pyboard_v11/board.c38
-rw-r--r--ports/stm/boards/pyboard_v11/mpconfigboard.h (renamed from ports/stm32f4/boards/pyboard_v11/mpconfigboard.h)1
-rw-r--r--ports/stm/boards/pyboard_v11/mpconfigboard.mk (renamed from ports/stm32f4/boards/pyboard_v11/mpconfigboard.mk)11
-rw-r--r--ports/stm/boards/pyboard_v11/pins.c (renamed from ports/stm32f4/boards/pyboard_v11/pins.c)0
-rw-r--r--ports/stm/boards/pyboard_v11/stm32f4xx_hal_conf.h (renamed from ports/stm32f4/boards/pyboard_v11/stm32f4xx_hal_conf.h)0
-rw-r--r--ports/stm/boards/stm32f411ce_blackpill/board.c39
-rw-r--r--ports/stm/boards/stm32f411ce_blackpill/mpconfigboard.h (renamed from ports/stm32f4/boards/stm32f411ce_blackpill/mpconfigboard.h)8
-rw-r--r--ports/stm/boards/stm32f411ce_blackpill/mpconfigboard.mk (renamed from ports/stm32f4/boards/stm32f411ce_blackpill/mpconfigboard.mk)13
-rw-r--r--ports/stm/boards/stm32f411ce_blackpill/pins.c (renamed from ports/stm32f4/boards/stm32f411ce_blackpill/pins.c)0
-rw-r--r--ports/stm/boards/stm32f411ce_blackpill/stm32f4xx_hal_conf.h (renamed from ports/stm32f4/boards/stm32f411ce_blackpill/stm32f4xx_hal_conf.h)0
-rw-r--r--ports/stm/boards/stm32f411ve_discovery/board.c38
-rw-r--r--ports/stm/boards/stm32f411ve_discovery/mpconfigboard.h (renamed from ports/stm32f4/boards/stm32f411ve_discovery/mpconfigboard.h)2
-rw-r--r--ports/stm/boards/stm32f411ve_discovery/mpconfigboard.mk (renamed from ports/stm32f4/boards/stm32f411ve_discovery/mpconfigboard.mk)13
-rw-r--r--ports/stm/boards/stm32f411ve_discovery/pins.c (renamed from ports/stm32f4/boards/stm32f411ve_discovery/pins.c)0
-rw-r--r--ports/stm/boards/stm32f411ve_discovery/stm32f4xx_hal_conf.h439
-rw-r--r--ports/stm/boards/stm32f412zg_discovery/board.c38
-rw-r--r--ports/stm/boards/stm32f412zg_discovery/mpconfigboard.h (renamed from ports/stm32f4/boards/stm32f412zg_discovery/mpconfigboard.h)2
-rw-r--r--ports/stm/boards/stm32f412zg_discovery/mpconfigboard.mk (renamed from ports/stm32f4/boards/stm32f412zg_discovery/mpconfigboard.mk)13
-rw-r--r--ports/stm/boards/stm32f412zg_discovery/pins.c (renamed from ports/stm32f4/boards/stm32f412zg_discovery/pins.c)0
-rw-r--r--ports/stm/boards/stm32f412zg_discovery/stm32f4xx_hal_conf.h (renamed from ports/stm32f4/boards/stm32f412zg_discovery/stm32f4xx_hal_conf.h)0
-rw-r--r--ports/stm/boards/stm32f4_discovery/board.c38
-rw-r--r--ports/stm/boards/stm32f4_discovery/mpconfigboard.h35
-rw-r--r--ports/stm/boards/stm32f4_discovery/mpconfigboard.mk15
-rw-r--r--ports/stm/boards/stm32f4_discovery/pins.c107
-rw-r--r--ports/stm/boards/stm32f4_discovery/stm32f4xx_hal_conf.h439
-rw-r--r--ports/stm/boards/system_stm32f4xx.c (renamed from ports/stm32f4/system_stm32f4xx.c)2
-rw-r--r--ports/stm/boards/system_stm32f7xx.c247
-rw-r--r--ports/stm/boards/system_stm32h7xx.c425
-rw-r--r--ports/stm/boards/thunderpack/board.c38
-rw-r--r--ports/stm/boards/thunderpack/mpconfigboard.h51
-rw-r--r--ports/stm/boards/thunderpack/mpconfigboard.mk17
-rw-r--r--ports/stm/boards/thunderpack/pins.c34
-rw-r--r--ports/stm/boards/thunderpack/stm32f4xx_hal_conf.h440
-rw-r--r--ports/stm/common-hal/analogio/AnalogIn.c (renamed from ports/stm32f4/common-hal/analogio/AnalogIn.c)14
-rw-r--r--ports/stm/common-hal/analogio/AnalogIn.h (renamed from ports/stm32f4/common-hal/analogio/AnalogIn.h)0
-rw-r--r--ports/stm/common-hal/analogio/AnalogOut.c (renamed from ports/stm32f4/common-hal/analogio/AnalogOut.c)4
-rw-r--r--ports/stm/common-hal/analogio/AnalogOut.h (renamed from ports/stm32f4/common-hal/analogio/AnalogOut.h)2
-rw-r--r--ports/stm/common-hal/analogio/__init__.c (renamed from ports/stm32f4/common-hal/analogio/__init__.c)0
-rw-r--r--ports/stm/common-hal/board/__init__.c (renamed from ports/stm32f4/common-hal/board/__init__.c)0
-rw-r--r--ports/stm/common-hal/busio/I2C.c (renamed from ports/stm32f4/common-hal/busio/I2C.c)74
-rw-r--r--ports/stm/common-hal/busio/I2C.h (renamed from ports/stm32f4/common-hal/busio/I2C.h)13
-rw-r--r--ports/stm/common-hal/busio/OneWire.h (renamed from ports/stm32f4/common-hal/busio/OneWire.h)6
-rw-r--r--ports/stm/common-hal/busio/SPI.c (renamed from ports/stm32f4/common-hal/busio/SPI.c)112
-rw-r--r--ports/stm/common-hal/busio/SPI.h (renamed from ports/stm32f4/common-hal/busio/SPI.h)17
-rw-r--r--ports/stm/common-hal/busio/UART.c (renamed from ports/stm32f4/common-hal/busio/UART.c)62
-rw-r--r--ports/stm/common-hal/busio/UART.h (renamed from ports/stm32f4/common-hal/busio/UART.h)11
-rw-r--r--ports/stm/common-hal/busio/__init__.c (renamed from ports/stm32f4/common-hal/busio/__init__.c)0
-rw-r--r--ports/stm/common-hal/digitalio/DigitalInOut.c (renamed from ports/stm32f4/common-hal/digitalio/DigitalInOut.c)19
-rw-r--r--ports/stm/common-hal/digitalio/DigitalInOut.h (renamed from ports/stm32f4/common-hal/digitalio/DigitalInOut.h)6
-rw-r--r--ports/stm/common-hal/digitalio/__init__.c1
-rw-r--r--ports/stm/common-hal/displayio/ParallelBus.c (renamed from ports/stm32f4/common-hal/displayio/ParallelBus.c)0
-rw-r--r--ports/stm/common-hal/displayio/ParallelBus.h (renamed from ports/stm32f4/common-hal/displayio/ParallelBus.h)0
-rw-r--r--ports/stm/common-hal/microcontroller/Pin.c (renamed from ports/stm32f4/common-hal/microcontroller/Pin.c)11
-rw-r--r--ports/stm/common-hal/microcontroller/Pin.h (renamed from ports/stm32f4/common-hal/microcontroller/Pin.h)8
-rw-r--r--ports/stm/common-hal/microcontroller/Processor.c139
-rw-r--r--ports/stm/common-hal/microcontroller/Processor.h (renamed from ports/stm32f4/common-hal/microcontroller/Processor.h)6
-rw-r--r--ports/stm/common-hal/microcontroller/__init__.c121
-rw-r--r--ports/stm/common-hal/neopixel_write/__init__.c (renamed from ports/stm32f4/common-hal/neopixel_write/__init__.c)0
-rw-r--r--ports/stm/common-hal/nvm/ByteArray.c73
-rw-r--r--ports/stm/common-hal/nvm/ByteArray.h45
-rw-r--r--ports/stm/common-hal/nvm/__init__.c27
-rw-r--r--ports/stm/common-hal/os/__init__.c (renamed from ports/stm32f4/common-hal/os/__init__.c)2
-rw-r--r--ports/stm/common-hal/pulseio/PWMOut.c (renamed from ports/stm32f4/common-hal/pulseio/PWMOut.c)18
-rw-r--r--ports/stm/common-hal/pulseio/PWMOut.h (renamed from ports/stm32f4/common-hal/pulseio/PWMOut.h)2
-rw-r--r--ports/stm/common-hal/pulseio/PulseIn.c303
-rw-r--r--ports/stm/common-hal/pulseio/PulseIn.h (renamed from ports/stm32f4/common-hal/pulseio/PulseIn.h)3
-rw-r--r--ports/stm/common-hal/pulseio/PulseOut.c214
-rw-r--r--ports/stm/common-hal/pulseio/PulseOut.h (renamed from ports/stm32f4/common-hal/pulseio/PulseOut.h)2
-rw-r--r--ports/stm/common-hal/pulseio/__init__.c (renamed from ports/stm32f4/common-hal/pulseio/__init__.c)0
-rwxr-xr-xports/stm/common-hal/supervisor/Runtime.c38
-rwxr-xr-xports/stm/common-hal/supervisor/Runtime.h37
-rwxr-xr-xports/stm/common-hal/supervisor/__init__.c40
-rw-r--r--ports/stm/common-hal/time/__init__.c45
-rw-r--r--ports/stm/fatfs_port.c33
-rw-r--r--ports/stm/mpconfigport.h85
-rw-r--r--ports/stm/mpconfigport.mk (renamed from ports/stm32f4/mpconfigport.mk)37
-rw-r--r--ports/stm/mphalport.c (renamed from ports/stm32f4/mphalport.c)20
-rw-r--r--ports/stm/mphalport.h51
-rw-r--r--ports/stm/packages/LQFP100_f4.c117
-rw-r--r--ports/stm/packages/LQFP100_x7.c115
-rw-r--r--ports/stm/packages/LQFP144.c (renamed from ports/stm32f4/common-hal/microcontroller/__init__.c)175
-rw-r--r--ports/stm/packages/LQFP64.c81
-rw-r--r--ports/stm/packages/UFQFPN48.c63
-rw-r--r--ports/stm/peripherals/clocks.h (renamed from ports/stm32f4/peripherals/stm32f4/clocks.h)4
-rw-r--r--ports/stm/peripherals/gpio.h (renamed from ports/stm32f4/peripherals/stm32f4/gpio.h)5
-rw-r--r--ports/stm/peripherals/periph.h127
-rw-r--r--ports/stm/peripherals/pins.h (renamed from ports/stm32f4/peripherals/stm32f4/pins.h)34
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f401xe/clocks.c (renamed from ports/stm32f4/peripherals/stm32f4/stm32f411xe/clocks.c)4
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f401xe/gpio.c (renamed from ports/stm32f4/peripherals/stm32f4/stm32f401xe/gpio.c)11
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f401xe/periph.c (renamed from ports/stm32f4/peripherals/stm32f4/stm32f401xe/periph.c)132
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f401xe/periph.h (renamed from ports/stm32f4/peripherals/stm32f4/stm32f401xe/periph.h)22
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f401xe/pins.c (renamed from ports/stm32f4/peripherals/stm32f4/stm32f401xe/pins.c)2
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f401xe/pins.h (renamed from ports/stm32f4/peripherals/stm32f4/stm32f401xe/pins.h)6
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f405xx/clocks.c (renamed from ports/stm32f4/peripherals/stm32f4/stm32f405xx/clocks.c)7
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f405xx/gpio.c (renamed from ports/stm32f4/peripherals/stm32f4/stm32f405xx/gpio.c)11
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f405xx/periph.c (renamed from ports/stm32f4/peripherals/stm32f4/stm32f405xx/periph.c)134
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f405xx/periph.h (renamed from ports/stm32f4/peripherals/stm32f4/stm32f405xx/periph.h)22
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f405xx/pins.c (renamed from ports/stm32f4/peripherals/stm32f4/stm32f405xx/pins.c)2
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f405xx/pins.h (renamed from ports/stm32f4/peripherals/stm32f4/stm32f405xx/pins.h)6
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f407xx/clocks.c62
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f407xx/gpio.c59
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f407xx/periph.c194
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f407xx/periph.h57
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f407xx/pins.c161
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f407xx/pins.h (renamed from ports/stm32f4/peripherals/stm32f4/stm32f412zx/pins.h)6
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f411xe/clocks.c (renamed from ports/stm32f4/peripherals/stm32f4/stm32f401xe/clocks.c)7
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f411xe/gpio.c (renamed from ports/stm32f4/peripherals/stm32f4/stm32f411xe/gpio.c)9
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f411xe/periph.c (renamed from ports/stm32f4/peripherals/stm32f4/stm32f411xe/periph.c)176
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f411xe/periph.h (renamed from ports/stm32f4/peripherals/stm32f4/stm32f411xe/periph.h)22
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f411xe/pins.c (renamed from ports/stm32f4/peripherals/stm32f4/stm32f411xe/pins.c)2
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f411xe/pins.h (renamed from ports/stm32f4/peripherals/stm32f4/stm32f411xe/pins.h)4
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f412zx/clocks.c (renamed from ports/stm32f4/peripherals/stm32f4/stm32f412zx/clocks.c)9
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f412zx/gpio.c54
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f412zx/periph.c (renamed from ports/stm32f4/peripherals/stm32f4/stm32f412zx/periph.c)196
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f412zx/periph.h (renamed from ports/stm32f4/peripherals/stm32f4/stm32f412zx/periph.h)22
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f412zx/pins.c (renamed from ports/stm32f4/peripherals/stm32f4/stm32f412zx/pins.c)2
-rw-r--r--ports/stm/peripherals/stm32f4/stm32f412zx/pins.h157
-rw-r--r--ports/stm/peripherals/stm32f7/stm32f767xx/clocks.c66
-rw-r--r--ports/stm/peripherals/stm32f7/stm32f767xx/gpio.c48
-rw-r--r--ports/stm/peripherals/stm32f7/stm32f767xx/periph.c248
-rw-r--r--ports/stm/peripherals/stm32f7/stm32f767xx/periph.h55
-rw-r--r--ports/stm/peripherals/stm32f7/stm32f767xx/pins.c200
-rw-r--r--ports/stm/peripherals/stm32f7/stm32f767xx/pins.h199
-rw-r--r--ports/stm/peripherals/stm32h7/stm32h743xx/clocks.c83
-rw-r--r--ports/stm/peripherals/stm32h7/stm32h743xx/gpio.c48
-rw-r--r--ports/stm/peripherals/stm32h7/stm32h743xx/periph.c260
-rw-r--r--ports/stm/peripherals/stm32h7/stm32h743xx/periph.h55
-rw-r--r--ports/stm/peripherals/stm32h7/stm32h743xx/pins.c210
-rw-r--r--ports/stm/peripherals/stm32h7/stm32h743xx/pins.h199
-rw-r--r--ports/stm/qstrdefsport.h1
m---------ports/stm/st_driver0
-rwxr-xr-xports/stm/supervisor/cpu.s (renamed from ports/stm32f4/supervisor/cpu.s)0
-rw-r--r--ports/stm/supervisor/internal_flash.c321
-rw-r--r--ports/stm/supervisor/internal_flash.h (renamed from ports/stm32f4/supervisor/internal_flash.h)38
-rw-r--r--ports/stm/supervisor/internal_flash_root_pointers.h (renamed from ports/stm32f4/supervisor/internal_flash_root_pointers.h)0
-rw-r--r--ports/stm/supervisor/port.c256
-rw-r--r--ports/stm/supervisor/qspi_flash.c (renamed from ports/stm32f4/supervisor/qspi_flash.c)0
-rw-r--r--ports/stm/supervisor/serial.c (renamed from ports/stm32f4/supervisor/serial.c)0
-rw-r--r--ports/stm/supervisor/usb.c (renamed from ports/stm32f4/supervisor/usb.c)31
-rw-r--r--ports/stm/tick.c (renamed from ports/stm32f4/tick.c)2
-rw-r--r--ports/stm/tick.h (renamed from ports/stm32f4/tick.h)6
-rw-r--r--ports/stm/tools/examples/nucleo_h743.csv130
-rw-r--r--ports/stm/tools/examples/stm32f405.csv142
-rw-r--r--ports/stm/tools/parse_af_csv.py137
-rw-r--r--ports/stm/tools/parse_pins_csv.py49
-rw-r--r--ports/stm/tools/pins.csv93
-rw-r--r--ports/stm/tools/stm32f767_af.csv168
-rw-r--r--ports/stm32f4/README.md3
-rw-r--r--ports/stm32f4/boards/STM32F405_boot.ld107
-rw-r--r--ports/stm32f4/boards/STM32F405_fs.ld108
-rw-r--r--ports/stm32f4/boards/STM32F411VETx_FLASH.ld109
-rw-r--r--ports/stm32f4/boards/STM32F412ZGTx_FLASH.ld105
-rw-r--r--ports/stm32f4/boards/startup_stm32f401xe.s448
-rw-r--r--ports/stm32f4/boards/startup_stm32f405xx.s516
-rw-r--r--ports/stm32f4/boards/startup_stm32f411xe.s452
-rw-r--r--ports/stm32f4/boards/startup_stm32f412zx.s524
-rw-r--r--ports/stm32f4/common-hal/pulseio/PulseIn.c79
-rw-r--r--ports/stm32f4/peripherals/stm32f4/periph.h169
-rw-r--r--ports/stm32f4/peripherals/stm32f4/stm32f412zx/gpio.c243
m---------ports/stm32f4/stm32f40
-rw-r--r--ports/stm32f4/supervisor/internal_flash.c204
-rw-r--r--ports/unix/Makefile12
-rw-r--r--ports/unix/mpconfigport.h3
-rw-r--r--ports/unix/mpconfigport.mk2
-rw-r--r--py/builtin.h7
-rw-r--r--py/builtinimport.c30
-rw-r--r--py/circuitpy_defns.mk38
-rw-r--r--py/circuitpy_mpconfig.h34
-rw-r--r--py/circuitpy_mpconfig.mk26
-rw-r--r--py/compile.c17
-rwxr-xr-xpy/gc.c81
-rwxr-xr-xpy/gc_long_lived.c2
-rw-r--r--py/lexer.c166
-rw-r--r--py/lexer.h16
-rw-r--r--py/mkrules.mk2
-rwxr-xr-xpy/mpconfig.h17
-rw-r--r--py/mpstate.h2
-rw-r--r--py/obj.h1
-rw-r--r--py/objint.c37
-rw-r--r--py/objmodule.c15
-rw-r--r--py/objslice.c65
-rw-r--r--py/parse.c64
-rw-r--r--py/py.mk17
-rw-r--r--py/runtime.c2
-rw-r--r--shared-bindings/_bleio/Adapter.c2
-rw-r--r--shared-bindings/_bleio/PacketBuffer.c7
-rw-r--r--shared-bindings/_bleio/__init__.c12
-rw-r--r--shared-bindings/_eve/__init__.c1105
-rw-r--r--shared-bindings/_eve/__init__.h84
-rw-r--r--shared-bindings/_protomatter/Protomatter.c376
-rw-r--r--shared-bindings/_protomatter/Protomatter.h59
-rw-r--r--shared-bindings/_protomatter/__init__.c55
-rw-r--r--shared-bindings/analogio/AnalogIn.c9
-rw-r--r--shared-bindings/analogio/AnalogOut.c6
-rw-r--r--shared-bindings/audiobusio/I2SOut.c14
-rw-r--r--shared-bindings/audiobusio/PDMIn.c11
-rw-r--r--shared-bindings/audiocore/RawSample.c2
-rw-r--r--shared-bindings/audioio/AudioOut.c12
-rw-r--r--shared-bindings/audiopwmio/PWMAudioOut.c12
-rw-r--r--shared-bindings/bitbangio/I2C.c7
-rw-r--r--shared-bindings/bitbangio/OneWire.c5
-rw-r--r--shared-bindings/bitbangio/SPI.c10
-rw-r--r--shared-bindings/busio/I2C.c10
-rw-r--r--shared-bindings/busio/OneWire.c4
-rw-r--r--shared-bindings/busio/SPI.c23
-rw-r--r--shared-bindings/busio/UART.c30
-rw-r--r--shared-bindings/busio/UART.h8
-rw-r--r--shared-bindings/digitalio/DigitalInOut.c6
-rw-r--r--shared-bindings/displayio/Bitmap.c19
-rw-r--r--shared-bindings/displayio/Bitmap.h1
-rw-r--r--shared-bindings/displayio/Display.c35
-rw-r--r--shared-bindings/displayio/Display.h4
-rw-r--r--shared-bindings/displayio/EPaperDisplay.c21
-rw-r--r--shared-bindings/displayio/FourWire.c42
-rw-r--r--shared-bindings/displayio/FourWire.h3
-rw-r--r--shared-bindings/displayio/I2CDisplay.c20
-rw-r--r--shared-bindings/displayio/OnDiskBitmap.c2
-rw-r--r--shared-bindings/displayio/ParallelBus.c33
-rw-r--r--shared-bindings/framebufferio/FramebufferDisplay.c428
-rw-r--r--shared-bindings/framebufferio/FramebufferDisplay.h69
-rw-r--r--shared-bindings/framebufferio/__init__.c63
-rw-r--r--shared-bindings/framebufferio/__init__.h0
-rw-r--r--shared-bindings/frequencyio/FrequencyIn.c4
-rw-r--r--shared-bindings/i2cslave/I2CSlave.c8
-rw-r--r--shared-bindings/microcontroller/Pin.c29
-rw-r--r--shared-bindings/microcontroller/Pin.h12
-rw-r--r--shared-bindings/os/__init__.c5
-rw-r--r--shared-bindings/ps2io/Ps2.c9
-rw-r--r--shared-bindings/pulseio/PWMOut.c5
-rw-r--r--shared-bindings/pulseio/PulseIn.c4
-rw-r--r--shared-bindings/rotaryio/IncrementalEncoder.c9
-rw-r--r--shared-bindings/time/__init__.c10
-rw-r--r--shared-bindings/time/__init__.h1
-rw-r--r--shared-bindings/touchio/TouchIn.c5
-rw-r--r--shared-bindings/ulab/__init__.rst491
-rw-r--r--shared-bindings/wiznet/wiznet5k.c6
-rw-r--r--shared-module/_eve/__init__.c317
-rw-r--r--shared-module/_eve/__init__.h37
-rw-r--r--shared-module/_pixelbuf/PixelBuf.c1
-rw-r--r--shared-module/_protomatter/Protomatter.c200
-rw-r--r--shared-module/_protomatter/Protomatter.h0
-rw-r--r--shared-module/_protomatter/__init__.c0
-rw-r--r--shared-module/_protomatter/__init__.h0
-rw-r--r--shared-module/_protomatter/allocator.h29
-rw-r--r--shared-module/bitbangio/SPI.c6
-rw-r--r--shared-module/board/__init__.c24
-rw-r--r--shared-module/displayio/Bitmap.c21
-rw-r--r--shared-module/displayio/ColorConverter.c11
-rw-r--r--shared-module/displayio/Display.c10
-rw-r--r--shared-module/displayio/Display.h1
-rw-r--r--shared-module/displayio/EPaperDisplay.c2
-rw-r--r--shared-module/displayio/FourWire.c7
-rw-r--r--shared-module/displayio/Palette.c7
-rw-r--r--shared-module/displayio/Palette.h1
-rw-r--r--shared-module/displayio/__init__.c84
-rw-r--r--shared-module/displayio/__init__.h15
-rw-r--r--shared-module/displayio/display_core.c46
-rw-r--r--shared-module/displayio/display_core.h2
-rw-r--r--shared-module/framebufferio/FramebufferDisplay.c300
-rw-r--r--shared-module/framebufferio/FramebufferDisplay.h81
-rw-r--r--shared-module/framebufferio/__init__.c0
-rw-r--r--shared-module/framebufferio/__init__.h0
-rw-r--r--shared-module/storage/__init__.c4
-rw-r--r--shared-module/wiznet/wiznet5k.c4
-rw-r--r--shared-module/wiznet/wiznet5k.h2
-rwxr-xr-xsupervisor/linker.h2
-rwxr-xr-xsupervisor/memory.h1
-rw-r--r--supervisor/shared/bluetooth.c13
-rw-r--r--supervisor/shared/display.c22
-rw-r--r--supervisor/shared/external_flash/devices.h54
-rw-r--r--supervisor/shared/filesystem.c4
-rwxr-xr-xsupervisor/shared/memory.c11
-rw-r--r--supervisor/shared/rgb_led_status.c4
-rw-r--r--supervisor/shared/usb/usb_msc_flash.c16
-rw-r--r--supervisor/usb.h1
-rw-r--r--tests/basics/dict1.py2
-rw-r--r--tests/basics/exception1.py1
-rw-r--r--tests/basics/gen_yield_from.py.exp14
-rw-r--r--tests/basics/gen_yield_from_close.py.exp20
-rw-r--r--tests/basics/gen_yield_from_throw.py.exp6
-rw-r--r--tests/basics/generator_close.py.exp10
-rw-r--r--tests/basics/generator_return.py2
-rw-r--r--tests/basics/int_big_error.py4
-rw-r--r--tests/basics/int_bytes.py12
-rw-r--r--tests/basics/int_bytes_intbig.py8
-rw-r--r--tests/basics/int_longint_bytes.py1
-rw-r--r--tests/basics/parser.py.exp3
-rw-r--r--tests/basics/python34.py6
-rw-r--r--tests/basics/python34.py.exp1
-rw-r--r--tests/basics/set_pop.py2
-rw-r--r--tests/basics/string_pep498_fstring.py113
-rw-r--r--tests/basics/string_pep498_fstring.py.exp0
-rw-r--r--tests/basics/subclass_native3.py4
-rw-r--r--tests/basics/try_as_var.py2
-rw-r--r--tests/cmdline/cmd_parsetree.py.exp4
-rw-r--r--tests/import/import_override.py.exp2
-rw-r--r--tests/misc/sys_exc_info.py2
-rwxr-xr-xtests/run-tests3
-rw-r--r--tools/build_board_info.py26
-rw-r--r--tools/convert_release_notes.py3
-rw-r--r--[-rwxr-xr-x]tools/dfu.py84
-rw-r--r--tools/gc_activity.md2
-rw-r--r--tools/gc_activity_between_collects.py141
-rw-r--r--tools/hid_report_descriptors.py4
-rw-r--r--tools/output_gc_until_repl.txt15
-rwxr-xr-xtools/upload_release_files.py35
601 files changed, 27905 insertions, 6072 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 369c26a53..fa3aee4a5 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -16,24 +16,29 @@ jobs:
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- - name: Set up Python 3.5
+ - uses: actions/checkout@v2
+ with:
+ submodules: true
+ fetch-depth: 0
+ - run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
+ - run: git submodule sync
+ - run: git submodule foreach git remote -v
+ - run: git submodule foreach git fetch --recurse-submodules=no origin +refs/tags/*:refs/tags/*
+ - name: CircuitPython version
+ run: git describe --dirty --tags
+ - name: Set up Python 3.8
uses: actions/setup-python@v1
with:
- python-version: 3.5
+ python-version: 3.8
- name: Install deps
run: |
sudo apt-get install -y eatmydata
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<4" sphinx-rtd-theme recommonmark sphinxcontrib-svg2pdfconverter polib pyyaml
- name: Versions
run: |
gcc --version
python3 --version
- - uses: actions/checkout@v1
- with:
- submodules: true
- - name: CircuitPython version
- run: git describe --dirty --always --tags
- name: Build mpy-cross
run: make -C mpy-cross -j2
- name: Build unix port
@@ -42,7 +47,7 @@ jobs:
make -C ports/unix -j2
make -C ports/unix coverage -j2
- 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
- name: Print failure info
run: |
@@ -54,10 +59,10 @@ jobs:
working-directory: tests
if: failure()
- 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
- 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
- name: Docs
run: sphinx-build -E -W -b html . _build/html
@@ -103,11 +108,16 @@ jobs:
gcc --version
python3 --version
msgfmt --version
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v2
with:
submodules: true
+ fetch-depth: 0
+ - run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
+ - run: git submodule sync
+ - run: git submodule foreach git remote -v
+ - run: git submodule foreach git fetch --recurse-submodules=no origin +refs/tags/*:refs/tags/*
- name: CircuitPython version
- run: git describe --dirty --always --tags
+ run: git describe --dirty --tags
- name: Build mpy-cross
run: make -C mpy-cross -j2
- uses: actions/upload-artifact@v1.0.0
@@ -122,14 +132,20 @@ jobs:
fail-fast: false
matrix:
board:
+ - "8086_commander"
+ - "TG-Watch02A"
- "aramcon_badge_2019"
- "arduino_mkr1300"
- "arduino_mkrzero"
- "arduino_nano_33_ble"
+ - "arduino_nano_33_iot"
- "arduino_zero"
- "bast_pro_mini_m0"
+ - "bdmicro_vina_m0"
- "capablerobot_usbhub"
- "catwan_usbstick"
+ - "circuitbrains_basic_m0"
+ - "circuitbrains_deluxe_m4"
- "circuitplayground_bluefruit"
- "circuitplayground_express"
- "circuitplayground_express_crickit"
@@ -144,6 +160,8 @@ jobs:
- "electronut_labs_blip"
- "electronut_labs_papyr"
- "escornabot_makech"
+ - "espruino_pico"
+ - "espruino_wifi"
- "feather_bluefruit_sense"
- "feather_m0_adalogger"
- "feather_m0_basic"
@@ -153,6 +171,7 @@ jobs:
- "feather_m0_rfm9x"
- "feather_m0_supersized"
- "feather_m4_express"
+ - "feather_m7_1011"
- "feather_mimxrt1011"
- "feather_mimxrt1062"
- "feather_nrf52840_express"
@@ -180,6 +199,9 @@ jobs:
- "mini_sam_m4"
- "monster_m4sk"
- "ndgarage_ndbit6"
+ - "nfc_copy_cat"
+ - "nucleo_f767zi"
+ - "nucleo_h743zi_2"
- "ohs2020_badge"
- "openbook_m4"
- "particle_argon"
@@ -194,6 +216,7 @@ jobs:
- "pybadge"
- "pybadge_airlift"
- "pyboard_v11"
+ - "pycubed"
- "pygamer"
- "pygamer_advance"
- "pyportal"
@@ -212,27 +235,32 @@ jobs:
- "sparkfun_redboard_turbo"
- "sparkfun_samd21_dev"
- "sparkfun_samd21_mini"
+ - "sparkfun_samd51_thing_plus"
- "spresense"
- "stm32f411ce_blackpill"
- "stm32f411ve_discovery"
- "stm32f412zg_discovery"
+ - "stm32f4_discovery"
- "stringcar_m0_express"
- "teensy40"
- "teknikio_bluebird"
+ - "thunderpack"
- "trellis_m4_express"
- "trinket_m0"
- "trinket_m0_haxpress"
+ - "uartlogger2"
- "uchip"
- "ugame10"
+ - "winterbloom_big_honking_button"
- "winterbloom_sol"
- "xinabox_cc03"
- "xinabox_cs11"
steps:
- - name: Set up Python 3.5
+ - name: Set up Python 3.8
uses: actions/setup-python@v1
with:
- python-version: 3.5
+ python-version: 3.8
- name: Install deps
run: |
sudo apt-get install -y gettext
@@ -244,9 +272,14 @@ jobs:
gcc --version
arm-none-eabi-gcc --version
python3 --version
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v2
with:
submodules: true
+ fetch-depth: 0
+ - run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
+ - run: git submodule sync
+ - run: git submodule foreach git remote -v
+ - run: git submodule foreach git fetch --recurse-submodules=no origin +refs/tags/*:refs/tags/*
- name: mpy-cross
run: make -C mpy-cross -j2
- name: build
@@ -264,13 +297,49 @@ jobs:
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'))
- - name: Install upload deps
+
+ 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: |
- pip install uritemplate
- - name: Upload to Release
- run: "[ -z \"$ADABOT_GITHUB_ACCESS_TOKEN\" ] || python3 -u upload_release_files.py"
+ 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:
- UPLOAD_URL: ${{ github.event.release.upload_url }}
- ADABOT_GITHUB_ACCESS_TOKEN: ${{ secrets.BLINKA_GITHUB_ACCESS_TOKEN }}
- if: github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')
+ 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'))
diff --git a/.github/workflows/create_website_pr.yml b/.github/workflows/create_website_pr.yml
index 69ca8f12b..da4dad179 100644
--- a/.github/workflows/create_website_pr.yml
+++ b/.github/workflows/create_website_pr.yml
@@ -12,10 +12,10 @@ jobs:
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- - name: Set up Python 3.5
+ - name: Set up Python 3.8
uses: actions/setup-python@v1
with:
- python-version: 3.5
+ python-version: 3.8
- name: Install deps
run: |
pip install requests sh click
@@ -23,11 +23,14 @@ jobs:
run: |
gcc --version
python3 --version
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v2
with:
submodules: true
+ fetch-depth: 0
+ - run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
+ - run: git submodule foreach git fetch --recurse-submodules=no origin +refs/tags/*:refs/tags/*
- name: CircuitPython version
- run: git describe --dirty --always --tags
+ run: git describe --dirty --tags
- name: Website
run: python3 build_board_info.py
working-directory: tools
diff --git a/.gitmodules b/.gitmodules
index cb36ad4c4..ebff8ecb2 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -29,10 +29,6 @@
[submodule "tools/python-semver"]
path = tools/python-semver
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"]
path = ports/atmel-samd/asf4
url = https://github.com/adafruit/asf4.git
@@ -96,9 +92,6 @@
[submodule "frozen/circuitpython-stage"]
path = frozen/circuitpython-stage
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"]
path = ports/cxd56/spresense-exported-sdk
url = https://github.com/sonydevworld/spresense-exported-sdk.git
@@ -111,3 +104,21 @@
[submodule "ports/mimxrt10xx/sdk"]
path = ports/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
+[submodule "lib/protomatter"]
+ path = lib/protomatter
+ url = https://github.com/adafruit/Adafruit_Protomatter
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
index 1617586f3..7eb8d93ea 100644
--- a/CODE_OF_CONDUCT.md
+++ b/CODE_OF_CONDUCT.md
@@ -1,74 +1,129 @@
-# Contributor Covenant Code of Conduct
+# Adafruit Community Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
-contributors and maintainers pledge to making participation in our project and
+contributors and leaders pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
-size, disability, ethnicity, gender identity and expression, level of experience,
-nationality, personal appearance, race, religion, or sexual identity and
-orientation.
+size, disability, ethnicity, gender identity and expression, level or type of
+experience, education, socio-economic status, nationality, personal appearance,
+race, religion, or sexual identity and orientation.
## Our Standards
+We are committed to providing a friendly, safe and welcoming environment for
+all.
+
Examples of behavior that contributes to creating a positive environment
include:
+* Be kind and courteous to others
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
+* Collaborating with other community members
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
-* The use of sexualized language or imagery and unwelcome sexual attention or
-advances
+* The use of sexualized language or imagery and sexual attention or advances
+* The use of inappropriate images, including in a community member's avatar
+* The use of inappropriate language, including in a community member's nickname
+* Any spamming, flaming, baiting or other attention-stealing behavior
+* Excessive or unwelcome helping; answering outside the scope of the question
+ asked
* Trolling, insulting/derogatory comments, and personal or political attacks
+* Promoting or spreading disinformation, lies, or conspiracy theories against
+ a person, group, organisation, project, or community
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
-* Other conduct which could reasonably be considered inappropriate in a
- professional setting
+* Other conduct which could reasonably be considered inappropriate
+
+The goal of the standards and moderation guidelines outlined here is to build
+and maintain a respectful community. We ask that you don’t just aim to be
+"technically unimpeachable", but rather try to be your best self.
+
+We value many things beyond technical expertise, including collaboration and
+supporting others within our community. Providing a positive experience for
+other community members can have a much more significant impact than simply
+providing the correct answer.
## Our Responsibilities
-Project maintainers are responsible for clarifying the standards of acceptable
+Project leaders are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
-Project maintainers have the right and responsibility to remove, edit, or
-reject comments, commits, code, wiki edits, issues, and other contributions
+Project leaders have the right and responsibility to remove, edit, or
+reject messages, comments, commits, code, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
-permanently any contributor for other behaviors that they deem inappropriate,
-threatening, offensive, or harmful.
+permanently any community member for other behaviors that they deem
+inappropriate, threatening, offensive, or harmful.
-## Scope
+## Moderation
-This Code of Conduct applies both within project spaces and in public spaces
-when an individual is representing the project or its community. Examples of
-representing a project or community include using an official project e-mail
-address, posting via an official social media account, or acting as an appointed
-representative at an online or offline event. Representation of a project may be
-further defined and clarified by project maintainers.
+Instances of behaviors that violate the Adafruit Community Code of Conduct
+may be reported by any member of the community. Community members are
+encouraged to report these situations, including situations they witness
+involving other community members.
+
+You may report in the following ways:
+
+In any situation, you may send an email to <support@adafruit.com>.
-## Enforcement
+On the Adafruit Discord, you may send an open message from any channel
+to all Community Moderators by tagging @community moderators. You may
+also send an open message from any channel, or a direct message to
+@kattni#1507, @tannewt#4653, @danh#1614, @cater#2442,
+@sommersoft#0222, @Mr. Certainly#0472 or @Andon#8175.
-Instances of abusive, harassing, or otherwise unacceptable behavior may be
-reported by contacting the project team at support@adafruit.com. All
-complaints will be reviewed and investigated and will result in a response that
-is deemed necessary and appropriate to the circumstances. The project team is
-obligated to maintain confidentiality with regard to the reporter of an incident.
-Further details of specific enforcement policies may be posted separately.
+Email and direct message reports will be kept confidential.
-Project maintainers who do not follow or enforce the Code of Conduct in good
-faith may face temporary or permanent repercussions as determined by other
-members of the project's leadership.
+In situations on Discord where the issue is particularly egregious, possibly
+illegal, requires immediate action, or violates the Discord terms of service,
+you should also report the message directly to Discord.
+
+These are the steps for upholding our community’s standards of conduct.
+
+1. Any member of the community may report any situation that violates the
+Adafruit Community Code of Conduct. All reports will be reviewed and
+investigated.
+2. If the behavior is an egregious violation, the community member who
+committed the violation may be banned immediately, without warning.
+3. Otherwise, moderators will first respond to such behavior with a warning.
+4. Moderators follow a soft "three strikes" policy - the community member may
+be given another chance, if they are receptive to the warning and change their
+behavior.
+5. If the community member is unreceptive or unreasonable when warned by a
+moderator, or the warning goes unheeded, they may be banned for a first or
+second offense. Repeated offenses will result in the community member being
+banned.
+
+## Scope
+
+This Code of Conduct and the enforcement policies listed above apply to all
+Adafruit Community venues. This includes but is not limited to any community
+spaces (both public and private), the entire Adafruit Discord server, and
+Adafruit GitHub repositories. Examples of Adafruit Community spaces include
+but are not limited to meet-ups, audio chats on the Adafruit Discord, or
+interaction at a conference.
+
+This Code of Conduct applies both within project spaces and in public spaces
+when an individual is representing the project or its community. As a community
+member, you are representing our community, and are expected to behave
+accordingly.
## Attribution
-This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
-available at [http://contributor-covenant.org/version/1/4][version]
+This Code of Conduct is adapted from the [Contributor Covenant][homepage],
+version 1.4, available at
+<https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>,
+and the [Rust Code of Conduct](https://www.rust-lang.org/en-US/conduct.html).
-[homepage]: http://contributor-covenant.org
-[version]: http://contributor-covenant.org/version/1/4/
+For other projects adopting the Adafruit Community Code of
+Conduct, please contact the maintainers of those projects for enforcement.
+If you wish to use this code of conduct for your own project, consider
+explicitly mentioning your moderation policy or making a copy with your
+own moderation policy so as to avoid confusion.
diff --git a/Makefile b/Makefile
index 7eff665c0..5e949cd40 100644
--- a/Makefile
+++ b/Makefile
@@ -36,7 +36,7 @@ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(BASEOPTS)
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(BASEOPTS)
-TRANSLATE_SOURCES = extmod lib main.c ports/atmel-samd ports/cxd56 ports/mimxrt10xx ports/nrf ports/stm32f4 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
diff --git a/conf.py b/conf.py
index 3b29986c0..2e503737c 100644
--- a/conf.py
+++ b/conf.py
@@ -17,7 +17,7 @@ import json
import sys
import os
-from recommonmark.parser import CommonMarkParser
+import recommonmark
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
@@ -55,16 +55,20 @@ extensions = [
'sphinx.ext.todo',
'sphinx.ext.coverage',
'rstjinja',
- 'c2rst'
+ 'c2rst',
+ 'recommonmark',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['templates']
# The suffix of source filenames.
-source_suffix = ['.rst', '.md', '.c', '.h']
+source_suffix = {
+ '.rst': 'restructuredtext',
+ '.md': 'markdown',
+ '.c': ''
+}
-source_parsers = {'.md': CommonMarkParser}
# The encoding of source files.
#source_encoding = 'utf-8-sig'
@@ -121,16 +125,9 @@ exclude_patterns = ["**/build*",
"ports/atmel-samd/peripherals",
"ports/atmel-samd/QTouch",
"ports/atmel-samd/tools",
- "ports/bare-arm",
- "ports/cc3200",
- "ports/cc3200/FreeRTOS",
- "ports/cc3200/hal",
"ports/cxd56/mkspk",
"ports/cxd56/spresense-exported-sdk",
- "ports/esp32",
- "ports/esp8266/boards",
- "ports/esp8266/common-hal",
- "ports/esp8266/modules",
+ "ports/litex/hw",
"ports/minimal",
"ports/mimxrt10xx/peripherals",
"ports/mimxrt10xx/sdk",
@@ -140,20 +137,11 @@ exclude_patterns = ["**/build*",
"ports/nrf/nrfx",
"ports/nrf/peripherals",
"ports/nrf/usb",
- "ports/stm32f4/stm32f4",
- "ports/stm32f4/peripherals",
- "ports/stm32f4/ref",
- "ports/pic16bit",
- "ports/qemu-arm",
- "ports/stm32",
- "ports/stm32/hal",
- "ports/stm32/cmsis",
- "ports/stm32/usbdev",
- "ports/stm32/usbhost",
- "ports/teensy",
+ "ports/stm/st_driver",
+ "ports/stm/packages",
+ "ports/stm/peripherals",
+ "ports/stm/ref",
"ports/unix",
- "ports/windows",
- "ports/zephyr",
"py",
"shared-bindings/util.*",
"shared-module",
@@ -374,4 +362,4 @@ intersphinx_mapping = {"cpython": ('https://docs.python.org/3/', None),
"register": ('https://circuitpython.readthedocs.io/projects/register/en/latest/', None)}
def setup(app):
- app.add_stylesheet("customstyle.css")
+ app.add_css_file("customstyle.css")
diff --git a/docs/design_guide.rst b/docs/design_guide.rst
index 5d965f907..6f87ecf79 100644
--- a/docs/design_guide.rst
+++ b/docs/design_guide.rst
@@ -476,6 +476,8 @@ properties.
+-----------------------+-----------------------+-------------------------------------------------------------------------+
| ``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) |
+-----------------------+-----------------------+-------------------------------------------------------------------------+
| ``lux`` | float | SI lux |
@@ -504,6 +506,8 @@ properties.
+-----------------------+-----------------------+-------------------------------------------------------------------------+
| ``weight`` | float | grams (g) |
+-----------------------+-----------------------+-------------------------------------------------------------------------+
+| ``sound_level`` | float | non-unit-specific sound level (monotonic but not actual decibels) |
++-----------------------+-----------------------+-------------------------------------------------------------------------+
Adding native modules
--------------------------------------------------------------------------------
diff --git a/docs/library/network.rst b/docs/library/network.rst
index cdcc5f323..bd32267fe 100644
--- a/docs/library/network.rst
+++ b/docs/library/network.rst
@@ -247,7 +247,7 @@ Methods
nic.ifconfig(('192.168.0.4', '255.255.255.0', '192.168.0.1', '8.8.8.8'))
.. method:: wlan.config('param')
-.. method:: wlan.config(param=value, ...)
+ wlan.config(param=value, ...)
Get or set general network interface parameters. These methods allow to work
with additional parameters beyond standard IP configuration (as dealt with by
diff --git a/docs/supported_ports.rst b/docs/supported_ports.rst
index 9416a9c4f..bd237fb5d 100644
--- a/docs/supported_ports.rst
+++ b/docs/supported_ports.rst
@@ -10,5 +10,5 @@ and ESP8266.
../ports/atmel-samd/README
../ports/mimxrt10xx/README
../ports/nrf/README
- ../ports/stm32f4/README
+ ../ports/stm/README
../ports/cxd56/README
diff --git a/extmod/ulab b/extmod/ulab
new file mode 160000
+Subproject a746bd8e0953853056ee405e2fa02c8ebca4fb7
diff --git a/extmod/vfs_fat.c b/extmod/vfs_fat.c
index 60f4393f4..9cb4d9842 100644
--- a/extmod/vfs_fat.c
+++ b/extmod/vfs_fat.c
@@ -345,14 +345,21 @@ STATIC mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) {
} else {
mode |= MP_S_IFREG;
}
- mp_uint_t seconds = 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)
- );
+#if MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_NONE
+ // On non-longint builds, the number of seconds since 1970 (epoch) is too
+ // large to fit in a smallint, so just return 31-DEC-1999 (0).
+ mp_obj_t seconds = MP_OBJ_NEW_SMALL_INT(946684800);
+#else
+ mp_obj_t seconds = mp_obj_new_int_from_uint(
+ 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[1] = MP_OBJ_NEW_SMALL_INT(0); // st_ino
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[5] = MP_OBJ_NEW_SMALL_INT(0); // st_gid
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[8] = mp_obj_new_int_from_uint(seconds); // st_mtime
- t->items[9] = mp_obj_new_int_from_uint(seconds); // st_ctime
+ t->items[7] = seconds; // st_atime
+ t->items[8] = seconds; // st_mtime
+ t->items[9] = seconds; // st_ctime
return MP_OBJ_FROM_PTR(t);
}
diff --git a/frozen/Adafruit_CircuitPython_ESP32SPI b/frozen/Adafruit_CircuitPython_ESP32SPI
new file mode 160000
+Subproject f523b2316bc3e25220b88c5435868c6a5880dfa
diff --git a/frozen/Adafruit_CircuitPython_Register b/frozen/Adafruit_CircuitPython_Register
new file mode 160000
+Subproject c525eedeb0d20c9829febfbf621eab707da71f8
diff --git a/frozen/Adafruit_CircuitPython_Requests b/frozen/Adafruit_CircuitPython_Requests
new file mode 160000
+Subproject e8a759719e94c69a01f9e07d418ca6db39114db
diff --git a/lib/libm/erf_lgamma.c b/lib/libm/erf_lgamma.c
index 877816a0c..fcb1d0a0c 100644
--- a/lib/libm/erf_lgamma.c
+++ b/lib/libm/erf_lgamma.c
@@ -24,6 +24,7 @@
*/
#include "fdlibm.h"
+#pragma GCC diagnostic ignored "-Wfloat-equal"
#define __ieee754_logf logf
diff --git a/lib/libm/log1pf.c b/lib/libm/log1pf.c
index 0d32b0a2f..89ed250b0 100644
--- a/lib/libm/log1pf.c
+++ b/lib/libm/log1pf.c
@@ -18,6 +18,8 @@
#include "libm.h"
+#pragma GCC diagnostic ignored "-Wfloat-equal"
+
static const float
ln2_hi = 6.9313812256e-01, /* 0x3f317180 */
ln2_lo = 9.0580006145e-06, /* 0x3717f7d1 */
diff --git a/lib/libm/math.c b/lib/libm/math.c
index 39c6a68a5..0e53563bc 100644
--- a/lib/libm/math.c
+++ b/lib/libm/math.c
@@ -50,6 +50,9 @@ float copysignf(float x, float y) {
static const float _M_LN10 = 2.30258509299404; // 0x40135d8e
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) {
if (isinf(x)) {
diff --git a/lib/mp-readline/readline.c b/lib/mp-readline/readline.c
index 9d254d8cf..0edaebbfa 100644
--- a/lib/mp-readline/readline.c
+++ b/lib/mp-readline/readline.c
@@ -206,7 +206,7 @@ int readline_process_char(int c) {
redraw_step_forward = compl_len;
}
#endif
- } else if (32 <= c && c <= 126) {
+ } else if (32 <= c ) {
// printable character
vstr_ins_char(rl.line, rl.cursor_pos, c);
// set redraw parameters
diff --git a/lib/oofatfs/ff.c b/lib/oofatfs/ff.c
index 71bd19702..e961c789d 100644
--- a/lib/oofatfs/ff.c
+++ b/lib/oofatfs/ff.c
@@ -3382,11 +3382,7 @@ FRESULT f_read (
if (!sect) ABORT(fs, FR_INT_ERR);
sect += csect;
cc = btr / SS(fs); /* When remaining bytes >= sector size, */
- if (cc
-#if _FS_DISK_READ_ALIGNED
- && (((int)rbuff & 3) == 0)
-#endif
- ) {/* Read maximum contiguous sectors directly */
+ if (cc) {/* Read maximum contiguous sectors directly */
if (csect + cc > fs->csize) { /* Clip at cluster boundary */
cc = fs->csize - csect;
}
diff --git a/lib/oofatfs/ffconf.h b/lib/oofatfs/ffconf.h
index a3795fa3f..214311b4c 100644
--- a/lib/oofatfs/ffconf.h
+++ b/lib/oofatfs/ffconf.h
@@ -343,12 +343,6 @@
/ SemaphoreHandle_t and etc.. A header file for O/S definitions needs to be
/ 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 */
diff --git a/lib/protomatter b/lib/protomatter
new file mode 160000
+Subproject c411714cbdc05725e80398acb18c3c1fb6fa68a
diff --git a/locale/ID.po b/locale/ID.po
index bcdad2994..57cdce469 100644
--- a/locale/ID.po
+++ b/locale/ID.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-02-05 15:55-0800\n"
+"POT-Creation-Date: 2020-04-15 10:24-0400\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"
@@ -53,6 +53,11 @@ msgstr "output:\n"
msgid "%%c requires int or char"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "%d address pins and %d rgb pins indicate a height of %d, not %d"
+msgstr ""
+
#: shared-bindings/microcontroller/Pin.c
msgid "%q in use"
msgstr ""
@@ -134,6 +139,10 @@ msgstr ""
msgid "'%s' integer 0x%x does not fit in mask 0x%x"
msgstr "'%s' integer 0x%x tidak cukup didalam mask 0x%x"
+#: py/runtime.c
+msgid "'%s' object cannot assign attribute '%q'"
+msgstr ""
+
#: py/proto.c
msgid "'%s' object does not support '%q'"
msgstr ""
@@ -185,6 +194,10 @@ msgid "'align' requires 1 argument"
msgstr "'align' membutuhkan 1 argumen"
#: py/compile.c
+msgid "'async for' or 'async with' outside async function"
+msgstr ""
+
+#: py/compile.c
msgid "'await' outside function"
msgstr "'await' diluar fungsi"
@@ -275,7 +288,7 @@ msgstr "Semua timer untuk pin ini sedang digunakan"
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
#: ports/cxd56/common-hal/pulseio/PulseOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
-#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c
+#: ports/nrf/peripherals/nrf/timers.c shared-bindings/pulseio/PWMOut.c
#: shared-module/_pew/PewPew.c
msgid "All timers in use"
msgstr "Semua timer sedang digunakan"
@@ -315,6 +328,10 @@ msgstr ""
msgid "Array values should be single bytes."
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+msgid "At most %d %q may be specified (not %d)"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
@@ -332,6 +349,7 @@ msgstr ""
"menjalankannya atau masuk ke REPL untukmenonaktifkan.\n"
#: shared-module/displayio/Display.c
+#: shared-module/framebufferio/FramebufferDisplay.c
msgid "Below minimum frame rate"
msgstr ""
@@ -347,7 +365,9 @@ msgstr ""
msgid "Both pins must support hardware interrupts"
msgstr "Kedua pin harus mendukung hardware interrut"
+#: shared-bindings/_protomatter/Protomatter.c
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness must be 0-1.0"
msgstr ""
@@ -356,6 +376,7 @@ msgid "Brightness must be between 0 and 255"
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness not adjustable"
msgstr ""
@@ -370,10 +391,12 @@ msgid "Buffer incorrect size. Should be %d bytes."
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is not a bytearray."
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is too small"
msgstr ""
@@ -390,6 +413,11 @@ msgstr ""
msgid "Buffer too large and unable to allocate"
msgstr ""
+#: shared-bindings/_bleio/PacketBuffer.c
+#, c-format
+msgid "Buffer too short by %d bytes"
+msgstr ""
+
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
#: ports/nrf/common-hal/displayio/ParallelBus.c
#, fuzzy, c-format
@@ -462,6 +490,10 @@ msgstr ""
msgid "Cannot set value when direction is input."
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Cannot specify RTS or CTS in RS485 mode"
+msgstr ""
+
#: py/objslice.c
msgid "Cannot subclass slice"
msgstr ""
@@ -474,7 +506,7 @@ msgstr ""
msgid "Cannot unambiguously get sizeof scalar"
msgstr "tidak dapat mendapatkan ukuran scalar secara tidak ambigu"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Cannot vary frequency on a timer that is already in use"
msgstr ""
@@ -535,31 +567,31 @@ msgstr ""
msgid "Could not initialize UART"
msgstr "Tidak dapat menginisialisasi UART"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not initialize channel"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not initialize timer"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not re-init channel"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not re-init timer"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not restart PWM"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not start PWM"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Could not start interrupt, RX busy"
msgstr ""
@@ -585,11 +617,11 @@ msgstr ""
msgid "Crash into the HardFault_Handler."
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Channel Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Device Init Error"
msgstr ""
@@ -624,11 +656,13 @@ msgid "DigitalInOut not supported on given pin"
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Display must have a 16 bit colorspace."
msgstr ""
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Display rotation must be in 90 degree increments"
msgstr ""
@@ -680,6 +714,10 @@ msgstr ""
msgid "Extended advertisements with scan response not supported."
msgstr ""
+#: extmod/ulab/code/fft.c
+msgid "FFT is defined for ndarrays only"
+msgstr ""
+
#: shared-bindings/ps2io/Ps2.c
msgid "Failed sending command."
msgstr ""
@@ -697,6 +735,7 @@ msgstr "Gagal untuk mengalokasikan buffer RX"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
msgstr "Gagal untuk megalokasikan buffer RX dari %d byte"
@@ -730,7 +769,7 @@ msgstr ""
msgid "Frequency captured is above capability. Capture Paused."
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Frequency must match existing PWMOut using this timer"
msgstr ""
@@ -741,6 +780,7 @@ msgstr ""
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Group already used"
msgstr ""
@@ -748,11 +788,11 @@ msgstr ""
msgid "Group full"
msgstr ""
-#: ports/stm32f4/common-hal/busio/I2C.c ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c
msgid "Hardware busy, try alternative pins"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Hardware in use, try alternative pins"
msgstr ""
@@ -760,7 +800,7 @@ msgstr ""
msgid "I/O operation on closed file"
msgstr "operasi I/O pada file tertutup"
-#: ports/stm32f4/common-hal/busio/I2C.c
+#: ports/stm/common-hal/busio/I2C.c
msgid "I2C Init Error"
msgstr ""
@@ -790,7 +830,7 @@ msgstr ""
msgid "Insufficient encryption"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr ""
@@ -799,7 +839,7 @@ msgstr ""
msgid "Invalid %q pin"
msgstr "%q pada tidak valid"
-#: ports/stm32f4/common-hal/analogio/AnalogIn.c
+#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Invalid ADC Unit value"
msgstr ""
@@ -807,11 +847,11 @@ msgstr ""
msgid "Invalid BMP file"
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "Invalid DAC pin supplied"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/stm32f4/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c
msgid "Invalid I2C pin selection"
msgstr ""
@@ -821,16 +861,15 @@ msgstr ""
msgid "Invalid PWM frequency"
msgstr "Frekuensi PWM tidak valid"
-#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm32f4/common-hal/busio/SPI.c
+#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c
msgid "Invalid SPI pin selection"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
msgid "Invalid UART pin selection"
msgstr ""
-#: py/moduerrno.c
+#: py/moduerrno.c shared-module/_protomatter/Protomatter.c
msgid "Invalid argument"
msgstr ""
@@ -838,7 +877,7 @@ msgstr ""
msgid "Invalid bits per value"
msgstr ""
-#: ports/nrf/common-hal/busio/UART.c ports/stm32f4/common-hal/busio/UART.c
+#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
msgid "Invalid buffer size"
msgstr "Ukuran buffer tidak valid"
@@ -866,7 +905,7 @@ msgstr ""
msgid "Invalid format chunk size"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Invalid frequency supplied"
msgstr ""
@@ -879,12 +918,13 @@ msgid "Invalid number of bits"
msgstr ""
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
+#: shared-bindings/displayio/FourWire.c
msgid "Invalid phase"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/atmel-samd/common-hal/touchio/TouchIn.c
-#: shared-bindings/pulseio/PWMOut.c
+#: shared-bindings/pulseio/PWMOut.c shared-module/_protomatter/Protomatter.c
msgid "Invalid pin"
msgstr "Pin tidak valid"
@@ -902,11 +942,15 @@ msgstr "Pin untuk channel kanan tidak valid"
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c
#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c
#: ports/cxd56/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
msgid "Invalid pins"
msgstr "Pin-pin tidak valid"
+#: ports/stm/common-hal/pulseio/PWMOut.c
+msgid "Invalid pins for PWMOut"
+msgstr ""
+
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
+#: shared-bindings/displayio/FourWire.c
msgid "Invalid polarity"
msgstr ""
@@ -934,7 +978,7 @@ msgstr ""
msgid "Invalid wave file"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Invalid word/bit length"
msgstr ""
@@ -983,7 +1027,7 @@ msgstr ""
msgid "Microphone startup delay must be in range 0.0 to 1.0"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "Missing MISO or MOSI Pin"
msgstr ""
@@ -991,10 +1035,19 @@ msgstr ""
msgid "Must be a %q subclass."
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "Must provide MISO or MOSI pin"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "Must use a multiple of 6 rgb pins, not %d"
+msgstr ""
+
+#: py/parse.c
+msgid "Name too long"
+msgstr ""
+
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Negative step not supported"
msgstr ""
@@ -1004,7 +1057,7 @@ msgid "No CCCD for this Characteristic"
msgstr ""
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "No DAC on chip"
msgstr "Tidak ada DAC (Digital Analog Converter) di dalam chip"
@@ -1013,23 +1066,23 @@ msgstr "Tidak ada DAC (Digital Analog Converter) di dalam chip"
msgid "No DMA channel found"
msgstr "tidak ada channel DMA ditemukan"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "No MISO Pin"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "No MOSI Pin"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "No RX pin"
msgstr "Tidak pin RX"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "No TX pin"
msgstr "Tidak ada pin TX"
@@ -1058,7 +1111,7 @@ msgstr ""
msgid "No hardware support on pin"
msgstr "Tidak ada dukungan hardware untuk pin"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "No more timers available on this pin."
msgstr ""
@@ -1074,6 +1127,10 @@ msgstr ""
msgid "No such file/directory"
msgstr ""
+#: shared-module/_protomatter/Protomatter.c
+msgid "No timer available"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid "Nordic Soft Device failure assertion."
msgstr ""
@@ -1129,7 +1186,8 @@ msgid ""
"PWM frequency not writable when variable_frequency is False on construction."
msgstr ""
-#: ports/stm32f4/common-hal/displayio/ParallelBus.c
+#: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c
+#: ports/stm/common-hal/displayio/ParallelBus.c
msgid "ParallelBus not yet supported"
msgstr ""
@@ -1141,10 +1199,22 @@ msgstr ""
#: ports/cxd56/common-hal/analogio/AnalogIn.c
#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c
#: ports/nrf/common-hal/analogio/AnalogIn.c
-#: ports/stm32f4/common-hal/analogio/AnalogIn.c
+#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Pin does not have ADC capabilities"
msgstr "Pin tidak mempunya kemampuan untuk ADC (Analog Digital Converter)"
+#: ports/stm/common-hal/pulseio/PulseIn.c
+msgid "Pin number already reserved by EXTI"
+msgstr ""
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid ""
+"Pinout uses %d bytes per element, which consumes more than the ideal %d "
+"bytes. If this cannot be avoided, pass allow_inefficient=True to the "
+"constructor"
+msgstr ""
+
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr "Tambahkan module apapun pada filesystem\n"
@@ -1163,26 +1233,31 @@ msgstr ""
"Tekan tombol apa saja untuk masuk ke dalam REPL. Gunakan CTRL+D untuk reset "
"(Reload)"
-#: shared-bindings/digitalio/DigitalInOut.c
-msgid "Pull not used when direction is output."
+#: shared-module/_protomatter/Protomatter.c
+#, c-format
+msgid "Protomatter internal error #%d"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PulseIn.c
-msgid "PulseIn not yet supported"
+#: shared-bindings/digitalio/DigitalInOut.c
+msgid "Pull not used when direction is output."
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PulseOut.c
-msgid "PulseOut not yet supported"
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid "PulseOut not supported on this chip"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/stm/common-hal/os/__init__.c
msgid "RNG Init Error"
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "RS485 inversion specified when not in RS485 mode"
+msgstr ""
+
#: ports/cxd56/common-hal/rtc/RTC.c ports/mimxrt10xx/common-hal/rtc/RTC.c
#: ports/nrf/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
@@ -1192,7 +1267,12 @@ msgstr ""
msgid "RTC is not supported on this board"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
+#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+msgid "RTS/CTS/RS485 Not yet supported on this device"
+msgstr ""
+
+#: ports/stm/common-hal/os/__init__.c
msgid "Random number generation error"
msgstr ""
@@ -1234,11 +1314,11 @@ msgstr ""
msgid "SDA or SCL needs a pull up"
msgstr "SDA atau SCL membutuhkan pull up"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Re-initialization error"
msgstr ""
@@ -1255,6 +1335,14 @@ msgstr "Nilai sampel terlalu tinggi. Nilai harus kurang dari %d"
msgid "Scan already in progess. Stop with stop_scan."
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Selected CTS pin not valid"
+msgstr ""
+
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Selected RTS pin not valid"
+msgstr ""
+
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "Serializer in use"
@@ -1281,10 +1369,14 @@ msgstr ""
msgid "Stream missing readinto() or write() method."
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Supply at least one UART pin"
msgstr ""
+#: ports/stm/common-hal/microcontroller/Processor.c
+msgid "Temperature read timed out"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid ""
"The CircuitPython heap was corrupted because the stack was too small.\n"
@@ -1340,13 +1432,11 @@ msgstr ""
msgid "Too many channels in sample."
msgstr "Terlalu banyak channel dalam sampel"
-#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
-#: shared-bindings/displayio/ParallelBus.c
+#: shared-module/displayio/__init__.c
msgid "Too many display busses"
msgstr ""
-#: shared-bindings/displayio/Display.c
-#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-module/displayio/__init__.c
msgid "Too many displays"
msgstr ""
@@ -1358,23 +1448,23 @@ msgstr ""
msgid "Tuple or struct_time argument required"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Buffer allocation error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART De-init error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Re-init error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART write error"
msgstr ""
@@ -1494,6 +1584,10 @@ msgstr ""
msgid "Viper functions don't currently support more than 4 arguments"
msgstr ""
+#: ports/stm/common-hal/microcontroller/Processor.c
+msgid "Voltage read timed out"
+msgstr ""
+
#: main.c
msgid "WARNING: Your code filename has two extensions\n"
msgstr "PERINGATAN: Nama file kode anda mempunyai dua ekstensi\n"
@@ -1560,10 +1654,18 @@ msgstr ""
msgid "addresses is empty"
msgstr ""
+#: extmod/ulab/code/vectorise.c
+msgid "arctan2 is implemented for scalars and ndarrays only"
+msgstr ""
+
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "argsort argument must be an ndarray"
+msgstr ""
+
#: py/runtime.c
msgid "argument has wrong type"
msgstr ""
@@ -1577,14 +1679,34 @@ msgstr "argumen num/types tidak cocok"
msgid "argument should be a '%q' not a '%q'"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "arguments must be ndarrays"
+msgstr ""
+
#: py/objarray.c shared-bindings/nvm/ByteArray.c
msgid "array/bytes required on right side"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "attempt to get argmin/argmax of an empty sequence"
+msgstr ""
+
#: py/objstr.c
msgid "attributes not supported yet"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "axis must be -1, 0, None, or 1"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "axis must be -1, 0, or 1"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "axis must be None, 0, or 1"
+msgstr ""
+
#: py/builtinevex.c
msgid "bad compile mode"
msgstr "mode compile buruk"
@@ -1828,6 +1950,10 @@ msgstr ""
msgid "cannot perform relative import"
msgstr "tidak dapat melakukan relative import"
+#: extmod/ulab/code/ndarray.c
+msgid "cannot reshape array (incompatible input/output shape)"
+msgstr ""
+
#: py/emitnative.c
msgid "casting"
msgstr ""
@@ -1884,6 +2010,30 @@ msgstr ""
msgid "conversion to object"
msgstr ""
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must be linear arrays"
+msgstr ""
+
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must be ndarrays"
+msgstr ""
+
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must not be empty"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "could not broadast input array from shape"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "could not invert Vandermonde matrix"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "ddof must be smaller than length of data set"
+msgstr ""
+
#: py/parsenum.c
msgid "decimal numbers not supported"
msgstr ""
@@ -1909,6 +2059,10 @@ msgstr ""
msgid "dict update sequence has wrong length"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "diff argument must be an ndarray"
+msgstr ""
+
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@@ -1979,6 +2133,26 @@ msgstr "argumen keyword ekstra telah diberikan"
msgid "extra positional arguments given"
msgstr "argumen posisi ekstra telah diberikan"
+#: py/parse.c
+msgid "f-string expression part cannot include a '#'"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string expression part cannot include a backslash"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: empty expression not allowed"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: expecting '}'"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: single '}' is not allowed"
+msgstr ""
+
#: shared-bindings/audiocore/WaveFile.c shared-bindings/audiomp3/MP3Decoder.c
#: shared-bindings/displayio/OnDiskBitmap.c
msgid "file must be a file opened in byte mode"
@@ -1988,6 +2162,14 @@ msgstr ""
msgid "filesystem must provide mount method"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "first argument must be an iterable"
+msgstr ""
+
+#: extmod/ulab/code/vectorise.c
+msgid "first argument must be an ndarray"
+msgstr ""
+
#: py/objtype.c
msgid "first argument to super() must be type"
msgstr ""
@@ -1996,6 +2178,14 @@ msgstr ""
msgid "firstbit must be MSB"
msgstr "bit pertama(firstbit) harus berupa MSB"
+#: extmod/ulab/code/ndarray.c
+msgid "flattening order must be either 'C', or 'F'"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "flip argument must be an ndarray"
+msgstr ""
+
#: py/objint.c
msgid "float too big"
msgstr ""
@@ -2088,9 +2278,14 @@ msgstr ""
msgid "incorrect padding"
msgstr "lapisan (padding) tidak benar"
+#: extmod/ulab/code/ndarray.c
+msgid "index is out of bounds"
+msgstr ""
+
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
-#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c
+#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c
msgid "index out of range"
msgstr "index keluar dari jangkauan"
@@ -2098,10 +2293,46 @@ msgstr "index keluar dari jangkauan"
msgid "indices must be integers"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "indices must be integers, slices, or Boolean lists"
+msgstr ""
+
#: py/compile.c
msgid "inline assembler must be a function"
msgstr "inline assembler harus sebuah fungsi"
+#: extmod/ulab/code/create.c
+msgid "input argument must be an integer or a 2-tuple"
+msgstr ""
+
+#: extmod/ulab/code/fft.c
+msgid "input array length must be power of 2"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "input data must be an iterable"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input matrix is asymmetric"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input matrix is singular"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input must be square matrix"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "input must be tuple, list, range, or ndarray"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "input vectors must be of equal length"
+msgstr ""
+
#: py/parsenum.c
msgid "int() arg 2 must be >= 2 and <= 36"
msgstr ""
@@ -2180,6 +2411,14 @@ msgstr ""
msgid "issubclass() arg 2 must be a class or a tuple of classes"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "iterables are not of the same length"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "iterations did not converge"
+msgstr ""
+
#: py/objstr.c
msgid "join expects a list of str/bytes objects consistent with self object"
msgstr ""
@@ -2228,6 +2467,10 @@ msgstr ""
msgid "long int not supported in this build"
msgstr ""
+#: py/parse.c
+msgid "malformed f-string"
+msgstr ""
+
#: shared-bindings/_stage/Layer.c
msgid "map buffer too small"
msgstr ""
@@ -2236,6 +2479,14 @@ msgstr ""
msgid "math domain error"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "matrix dimensions do not match"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "matrix is not positive definite"
+msgstr ""
+
#: ports/nrf/common-hal/_bleio/Characteristic.c
#: ports/nrf/common-hal/_bleio/Descriptor.c
#, c-format
@@ -2259,6 +2510,10 @@ msgstr ""
msgid "module not found"
msgstr "modul tidak ditemukan"
+#: extmod/ulab/code/poly.c
+msgid "more degrees of freedom than data points"
+msgstr ""
+
#: py/compile.c
msgid "multiple *x in assignment"
msgstr "perkalian *x dalam assignment"
@@ -2283,6 +2538,10 @@ msgstr "harus menentukan semua pin sck/mosi/miso"
msgid "must use keyword argument for key function"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "n must be between 0, and 9"
+msgstr ""
+
#: py/runtime.c
msgid "name '%q' is not defined"
msgstr ""
@@ -2369,6 +2628,14 @@ msgstr ""
msgid "not enough arguments for format string"
msgstr ""
+#: extmod/ulab/code/poly.c
+msgid "number of arguments must be 2, or 3"
+msgstr ""
+
+#: extmod/ulab/code/create.c
+msgid "number of points must be at least 2"
+msgstr ""
+
#: py/obj.c
#, c-format
msgid "object '%s' is not a tuple or list"
@@ -2437,6 +2704,18 @@ msgstr ""
msgid "only slices with step=1 (aka None) are supported"
msgstr ""
+#: extmod/ulab/code/ndarray.c extmod/ulab/code/vectorise.c
+msgid "operands could not be broadcast together"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "operation is not implemented on ndarrays"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "operation is not supported for given type"
+msgstr ""
+
#: py/modbuiltins.c
msgid "ord expects a character"
msgstr ""
@@ -2485,6 +2764,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "pop from an empty PulseIn"
msgstr "Muncul dari PulseIn yang kosong"
@@ -2512,6 +2792,14 @@ msgstr ""
msgid "queue overflow"
msgstr "antrian meluap (overflow)"
+#: py/parse.c
+msgid "raw f-strings are not implemented"
+msgstr ""
+
+#: extmod/ulab/code/fft.c
+msgid "real and imaginary parts must be of equal length"
+msgstr ""
+
#: py/builtinimport.c
msgid "relative import"
msgstr "relative import"
@@ -2529,6 +2817,20 @@ msgstr "anotasi return harus sebuah identifier"
msgid "return expected '%q' but got '%q'"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "rgb_pins[%d] duplicates another pin assignment"
+msgstr ""
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "rgb_pins[%d] is not on the same port as clock"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "right hand side must be an ndarray, or a scalar"
+msgstr ""
+
#: py/objstr.c
msgid "rsplit(None,n)"
msgstr ""
@@ -2551,6 +2853,10 @@ msgstr ""
msgid "script compilation not supported"
msgstr "kompilasi script tidak didukung"
+#: extmod/ulab/code/ndarray.c
+msgid "shape must be a 2-tuple"
+msgstr ""
+
#: py/objstr.c
msgid "sign not allowed in string format specifier"
msgstr ""
@@ -2563,6 +2869,10 @@ msgstr ""
msgid "single '}' encountered in format string"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "size is defined for ndarrays only"
+msgstr ""
+
#: shared-bindings/time/__init__.c
msgid "sleep length must be non-negative"
msgstr ""
@@ -2579,6 +2889,10 @@ msgstr ""
msgid "soft reboot\n"
msgstr "memulai ulang software(soft reboot)\n"
+#: extmod/ulab/code/numerical.c
+msgid "sort argument must be an ndarray"
+msgstr ""
+
#: py/objstr.c
msgid "start/end indices"
msgstr ""
@@ -2669,12 +2983,16 @@ msgstr ""
msgid "too many arguments provided with the given format"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "too many indices"
+msgstr ""
+
#: py/runtime.c
#, c-format
msgid "too many values to unpack (expected %d)"
msgstr ""
-#: py/objstr.c
+#: extmod/ulab/code/linalg.c py/objstr.c
msgid "tuple index out of range"
msgstr ""
@@ -2688,6 +3006,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
+#: shared-bindings/busio/UART.c
msgid "tx and rx cannot both be None"
msgstr "tx dan rx keduanya tidak boleh kosong"
@@ -2805,6 +3124,14 @@ msgstr ""
msgid "window must be <= interval"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "wrong argument type"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "wrong index type"
+msgstr ""
+
#: py/objstr.c
msgid "wrong number of arguments"
msgstr ""
@@ -2813,6 +3140,10 @@ msgstr ""
msgid "wrong number of values to unpack"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "wrong operand type"
+msgstr ""
+
#: shared-module/displayio/Shape.c
msgid "x value out of bounds"
msgstr ""
diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot
index 6069bdd97..e9e7838cb 100644
--- a/locale/circuitpython.pot
+++ b/locale/circuitpython.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-02-05 15:55-0800\n"
+"POT-Creation-Date: 2020-04-15 12:24-0400\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"
@@ -53,6 +53,11 @@ msgstr ""
msgid "%%c requires int or char"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "%d address pins and %d rgb pins indicate a height of %d, not %d"
+msgstr ""
+
#: shared-bindings/microcontroller/Pin.c
msgid "%q in use"
msgstr ""
@@ -133,6 +138,10 @@ msgstr ""
msgid "'%s' integer 0x%x does not fit in mask 0x%x"
msgstr ""
+#: py/runtime.c
+msgid "'%s' object cannot assign attribute '%q'"
+msgstr ""
+
#: py/proto.c
msgid "'%s' object does not support '%q'"
msgstr ""
@@ -184,6 +193,10 @@ msgid "'align' requires 1 argument"
msgstr ""
#: py/compile.c
+msgid "'async for' or 'async with' outside async function"
+msgstr ""
+
+#: py/compile.c
msgid "'await' outside function"
msgstr ""
@@ -273,7 +286,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
#: ports/cxd56/common-hal/pulseio/PulseOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
-#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c
+#: ports/nrf/peripherals/nrf/timers.c shared-bindings/pulseio/PWMOut.c
#: shared-module/_pew/PewPew.c
msgid "All timers in use"
msgstr ""
@@ -313,6 +326,10 @@ msgstr ""
msgid "Array values should be single bytes."
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+msgid "At most %d %q may be specified (not %d)"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
@@ -328,6 +345,7 @@ msgid ""
msgstr ""
#: shared-module/displayio/Display.c
+#: shared-module/framebufferio/FramebufferDisplay.c
msgid "Below minimum frame rate"
msgstr ""
@@ -343,7 +361,9 @@ msgstr ""
msgid "Both pins must support hardware interrupts"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness must be 0-1.0"
msgstr ""
@@ -352,6 +372,7 @@ msgid "Brightness must be between 0 and 255"
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness not adjustable"
msgstr ""
@@ -366,10 +387,12 @@ msgid "Buffer incorrect size. Should be %d bytes."
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is not a bytearray."
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is too small"
msgstr ""
@@ -386,6 +409,11 @@ msgstr ""
msgid "Buffer too large and unable to allocate"
msgstr ""
+#: shared-bindings/_bleio/PacketBuffer.c
+#, c-format
+msgid "Buffer too short by %d bytes"
+msgstr ""
+
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
#: ports/nrf/common-hal/displayio/ParallelBus.c
#, c-format
@@ -452,6 +480,10 @@ msgstr ""
msgid "Cannot set value when direction is input."
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Cannot specify RTS or CTS in RS485 mode"
+msgstr ""
+
#: py/objslice.c
msgid "Cannot subclass slice"
msgstr ""
@@ -464,7 +496,7 @@ msgstr ""
msgid "Cannot unambiguously get sizeof scalar"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Cannot vary frequency on a timer that is already in use"
msgstr ""
@@ -525,31 +557,31 @@ msgstr ""
msgid "Could not initialize UART"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not initialize channel"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not initialize timer"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not re-init channel"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not re-init timer"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not restart PWM"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not start PWM"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Could not start interrupt, RX busy"
msgstr ""
@@ -575,11 +607,11 @@ msgstr ""
msgid "Crash into the HardFault_Handler."
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Channel Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Device Init Error"
msgstr ""
@@ -613,11 +645,13 @@ msgid "DigitalInOut not supported on given pin"
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Display must have a 16 bit colorspace."
msgstr ""
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Display rotation must be in 90 degree increments"
msgstr ""
@@ -669,6 +703,10 @@ msgstr ""
msgid "Extended advertisements with scan response not supported."
msgstr ""
+#: extmod/ulab/code/fft.c
+msgid "FFT is defined for ndarrays only"
+msgstr ""
+
#: shared-bindings/ps2io/Ps2.c
msgid "Failed sending command."
msgstr ""
@@ -686,6 +724,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
msgstr ""
@@ -719,7 +758,7 @@ msgstr ""
msgid "Frequency captured is above capability. Capture Paused."
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Frequency must match existing PWMOut using this timer"
msgstr ""
@@ -730,6 +769,7 @@ msgstr ""
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Group already used"
msgstr ""
@@ -737,11 +777,11 @@ msgstr ""
msgid "Group full"
msgstr ""
-#: ports/stm32f4/common-hal/busio/I2C.c ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c
msgid "Hardware busy, try alternative pins"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Hardware in use, try alternative pins"
msgstr ""
@@ -749,7 +789,7 @@ msgstr ""
msgid "I/O operation on closed file"
msgstr ""
-#: ports/stm32f4/common-hal/busio/I2C.c
+#: ports/stm/common-hal/busio/I2C.c
msgid "I2C Init Error"
msgstr ""
@@ -779,7 +819,7 @@ msgstr ""
msgid "Insufficient encryption"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr ""
@@ -788,7 +828,7 @@ msgstr ""
msgid "Invalid %q pin"
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogIn.c
+#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Invalid ADC Unit value"
msgstr ""
@@ -796,11 +836,11 @@ msgstr ""
msgid "Invalid BMP file"
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "Invalid DAC pin supplied"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/stm32f4/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c
msgid "Invalid I2C pin selection"
msgstr ""
@@ -810,16 +850,15 @@ msgstr ""
msgid "Invalid PWM frequency"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm32f4/common-hal/busio/SPI.c
+#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c
msgid "Invalid SPI pin selection"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
msgid "Invalid UART pin selection"
msgstr ""
-#: py/moduerrno.c
+#: py/moduerrno.c shared-module/_protomatter/Protomatter.c
msgid "Invalid argument"
msgstr ""
@@ -827,7 +866,7 @@ msgstr ""
msgid "Invalid bits per value"
msgstr ""
-#: ports/nrf/common-hal/busio/UART.c ports/stm32f4/common-hal/busio/UART.c
+#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
msgid "Invalid buffer size"
msgstr ""
@@ -855,7 +894,7 @@ msgstr ""
msgid "Invalid format chunk size"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Invalid frequency supplied"
msgstr ""
@@ -868,12 +907,13 @@ msgid "Invalid number of bits"
msgstr ""
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
+#: shared-bindings/displayio/FourWire.c
msgid "Invalid phase"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/atmel-samd/common-hal/touchio/TouchIn.c
-#: shared-bindings/pulseio/PWMOut.c
+#: shared-bindings/pulseio/PWMOut.c shared-module/_protomatter/Protomatter.c
msgid "Invalid pin"
msgstr ""
@@ -891,11 +931,15 @@ msgstr ""
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c
#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c
#: ports/cxd56/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
msgid "Invalid pins"
msgstr ""
+#: ports/stm/common-hal/pulseio/PWMOut.c
+msgid "Invalid pins for PWMOut"
+msgstr ""
+
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
+#: shared-bindings/displayio/FourWire.c
msgid "Invalid polarity"
msgstr ""
@@ -923,7 +967,7 @@ msgstr ""
msgid "Invalid wave file"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Invalid word/bit length"
msgstr ""
@@ -972,7 +1016,7 @@ msgstr ""
msgid "Microphone startup delay must be in range 0.0 to 1.0"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "Missing MISO or MOSI Pin"
msgstr ""
@@ -980,10 +1024,19 @@ msgstr ""
msgid "Must be a %q subclass."
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "Must provide MISO or MOSI pin"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "Must use a multiple of 6 rgb pins, not %d"
+msgstr ""
+
+#: py/parse.c
+msgid "Name too long"
+msgstr ""
+
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Negative step not supported"
msgstr ""
@@ -993,7 +1046,7 @@ msgid "No CCCD for this Characteristic"
msgstr ""
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "No DAC on chip"
msgstr ""
@@ -1002,23 +1055,23 @@ msgstr ""
msgid "No DMA channel found"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "No MISO Pin"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "No MOSI Pin"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "No RX pin"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "No TX pin"
msgstr ""
@@ -1047,7 +1100,7 @@ msgstr ""
msgid "No hardware support on pin"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "No more timers available on this pin."
msgstr ""
@@ -1063,6 +1116,10 @@ msgstr ""
msgid "No such file/directory"
msgstr ""
+#: shared-module/_protomatter/Protomatter.c
+msgid "No timer available"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid "Nordic Soft Device failure assertion."
msgstr ""
@@ -1117,7 +1174,8 @@ msgid ""
"PWM frequency not writable when variable_frequency is False on construction."
msgstr ""
-#: ports/stm32f4/common-hal/displayio/ParallelBus.c
+#: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c
+#: ports/stm/common-hal/displayio/ParallelBus.c
msgid "ParallelBus not yet supported"
msgstr ""
@@ -1129,10 +1187,22 @@ msgstr ""
#: ports/cxd56/common-hal/analogio/AnalogIn.c
#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c
#: ports/nrf/common-hal/analogio/AnalogIn.c
-#: ports/stm32f4/common-hal/analogio/AnalogIn.c
+#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Pin does not have ADC capabilities"
msgstr ""
+#: ports/stm/common-hal/pulseio/PulseIn.c
+msgid "Pin number already reserved by EXTI"
+msgstr ""
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid ""
+"Pinout uses %d bytes per element, which consumes more than the ideal %d "
+"bytes. If this cannot be avoided, pass allow_inefficient=True to the "
+"constructor"
+msgstr ""
+
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr ""
@@ -1149,26 +1219,31 @@ msgstr ""
msgid "Press any key to enter the REPL. Use CTRL-D to reload."
msgstr ""
-#: shared-bindings/digitalio/DigitalInOut.c
-msgid "Pull not used when direction is output."
+#: shared-module/_protomatter/Protomatter.c
+#, c-format
+msgid "Protomatter internal error #%d"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PulseIn.c
-msgid "PulseIn not yet supported"
+#: shared-bindings/digitalio/DigitalInOut.c
+msgid "Pull not used when direction is output."
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PulseOut.c
-msgid "PulseOut not yet supported"
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid "PulseOut not supported on this chip"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/stm/common-hal/os/__init__.c
msgid "RNG Init Error"
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "RS485 inversion specified when not in RS485 mode"
+msgstr ""
+
#: ports/cxd56/common-hal/rtc/RTC.c ports/mimxrt10xx/common-hal/rtc/RTC.c
#: ports/nrf/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
@@ -1178,7 +1253,12 @@ msgstr ""
msgid "RTC is not supported on this board"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
+#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+msgid "RTS/CTS/RS485 Not yet supported on this device"
+msgstr ""
+
+#: ports/stm/common-hal/os/__init__.c
msgid "Random number generation error"
msgstr ""
@@ -1218,11 +1298,11 @@ msgstr ""
msgid "SDA or SCL needs a pull up"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Re-initialization error"
msgstr ""
@@ -1239,6 +1319,14 @@ msgstr ""
msgid "Scan already in progess. Stop with stop_scan."
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Selected CTS pin not valid"
+msgstr ""
+
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Selected RTS pin not valid"
+msgstr ""
+
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "Serializer in use"
@@ -1265,10 +1353,14 @@ msgstr ""
msgid "Stream missing readinto() or write() method."
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Supply at least one UART pin"
msgstr ""
+#: ports/stm/common-hal/microcontroller/Processor.c
+msgid "Temperature read timed out"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid ""
"The CircuitPython heap was corrupted because the stack was too small.\n"
@@ -1324,13 +1416,11 @@ msgstr ""
msgid "Too many channels in sample."
msgstr ""
-#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
-#: shared-bindings/displayio/ParallelBus.c
+#: shared-module/displayio/__init__.c
msgid "Too many display busses"
msgstr ""
-#: shared-bindings/displayio/Display.c
-#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-module/displayio/__init__.c
msgid "Too many displays"
msgstr ""
@@ -1342,23 +1432,23 @@ msgstr ""
msgid "Tuple or struct_time argument required"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Buffer allocation error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART De-init error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Re-init error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART write error"
msgstr ""
@@ -1477,6 +1567,10 @@ msgstr ""
msgid "Viper functions don't currently support more than 4 arguments"
msgstr ""
+#: ports/stm/common-hal/microcontroller/Processor.c
+msgid "Voltage read timed out"
+msgstr ""
+
#: main.c
msgid "WARNING: Your code filename has two extensions\n"
msgstr ""
@@ -1537,10 +1631,18 @@ msgstr ""
msgid "addresses is empty"
msgstr ""
+#: extmod/ulab/code/vectorise.c
+msgid "arctan2 is implemented for scalars and ndarrays only"
+msgstr ""
+
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "argsort argument must be an ndarray"
+msgstr ""
+
#: py/runtime.c
msgid "argument has wrong type"
msgstr ""
@@ -1554,14 +1656,34 @@ msgstr ""
msgid "argument should be a '%q' not a '%q'"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "arguments must be ndarrays"
+msgstr ""
+
#: py/objarray.c shared-bindings/nvm/ByteArray.c
msgid "array/bytes required on right side"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "attempt to get argmin/argmax of an empty sequence"
+msgstr ""
+
#: py/objstr.c
msgid "attributes not supported yet"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "axis must be -1, 0, None, or 1"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "axis must be -1, 0, or 1"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "axis must be None, 0, or 1"
+msgstr ""
+
#: py/builtinevex.c
msgid "bad compile mode"
msgstr ""
@@ -1804,6 +1926,10 @@ msgstr ""
msgid "cannot perform relative import"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "cannot reshape array (incompatible input/output shape)"
+msgstr ""
+
#: py/emitnative.c
msgid "casting"
msgstr ""
@@ -1860,6 +1986,30 @@ msgstr ""
msgid "conversion to object"
msgstr ""
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must be linear arrays"
+msgstr ""
+
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must be ndarrays"
+msgstr ""
+
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must not be empty"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "could not broadast input array from shape"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "could not invert Vandermonde matrix"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "ddof must be smaller than length of data set"
+msgstr ""
+
#: py/parsenum.c
msgid "decimal numbers not supported"
msgstr ""
@@ -1885,6 +2035,10 @@ msgstr ""
msgid "dict update sequence has wrong length"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "diff argument must be an ndarray"
+msgstr ""
+
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@@ -1955,6 +2109,26 @@ msgstr ""
msgid "extra positional arguments given"
msgstr ""
+#: py/parse.c
+msgid "f-string expression part cannot include a '#'"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string expression part cannot include a backslash"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: empty expression not allowed"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: expecting '}'"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: single '}' is not allowed"
+msgstr ""
+
#: shared-bindings/audiocore/WaveFile.c shared-bindings/audiomp3/MP3Decoder.c
#: shared-bindings/displayio/OnDiskBitmap.c
msgid "file must be a file opened in byte mode"
@@ -1964,6 +2138,14 @@ msgstr ""
msgid "filesystem must provide mount method"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "first argument must be an iterable"
+msgstr ""
+
+#: extmod/ulab/code/vectorise.c
+msgid "first argument must be an ndarray"
+msgstr ""
+
#: py/objtype.c
msgid "first argument to super() must be type"
msgstr ""
@@ -1972,6 +2154,14 @@ msgstr ""
msgid "firstbit must be MSB"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "flattening order must be either 'C', or 'F'"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "flip argument must be an ndarray"
+msgstr ""
+
#: py/objint.c
msgid "float too big"
msgstr ""
@@ -2064,9 +2254,14 @@ msgstr ""
msgid "incorrect padding"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "index is out of bounds"
+msgstr ""
+
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
-#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c
+#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c
msgid "index out of range"
msgstr ""
@@ -2074,10 +2269,46 @@ msgstr ""
msgid "indices must be integers"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "indices must be integers, slices, or Boolean lists"
+msgstr ""
+
#: py/compile.c
msgid "inline assembler must be a function"
msgstr ""
+#: extmod/ulab/code/create.c
+msgid "input argument must be an integer or a 2-tuple"
+msgstr ""
+
+#: extmod/ulab/code/fft.c
+msgid "input array length must be power of 2"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "input data must be an iterable"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input matrix is asymmetric"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input matrix is singular"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input must be square matrix"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "input must be tuple, list, range, or ndarray"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "input vectors must be of equal length"
+msgstr ""
+
#: py/parsenum.c
msgid "int() arg 2 must be >= 2 and <= 36"
msgstr ""
@@ -2156,6 +2387,14 @@ msgstr ""
msgid "issubclass() arg 2 must be a class or a tuple of classes"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "iterables are not of the same length"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "iterations did not converge"
+msgstr ""
+
#: py/objstr.c
msgid "join expects a list of str/bytes objects consistent with self object"
msgstr ""
@@ -2204,6 +2443,10 @@ msgstr ""
msgid "long int not supported in this build"
msgstr ""
+#: py/parse.c
+msgid "malformed f-string"
+msgstr ""
+
#: shared-bindings/_stage/Layer.c
msgid "map buffer too small"
msgstr ""
@@ -2212,6 +2455,14 @@ msgstr ""
msgid "math domain error"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "matrix dimensions do not match"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "matrix is not positive definite"
+msgstr ""
+
#: ports/nrf/common-hal/_bleio/Characteristic.c
#: ports/nrf/common-hal/_bleio/Descriptor.c
#, c-format
@@ -2235,6 +2486,10 @@ msgstr ""
msgid "module not found"
msgstr ""
+#: extmod/ulab/code/poly.c
+msgid "more degrees of freedom than data points"
+msgstr ""
+
#: py/compile.c
msgid "multiple *x in assignment"
msgstr ""
@@ -2259,6 +2514,10 @@ msgstr ""
msgid "must use keyword argument for key function"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "n must be between 0, and 9"
+msgstr ""
+
#: py/runtime.c
msgid "name '%q' is not defined"
msgstr ""
@@ -2345,6 +2604,14 @@ msgstr ""
msgid "not enough arguments for format string"
msgstr ""
+#: extmod/ulab/code/poly.c
+msgid "number of arguments must be 2, or 3"
+msgstr ""
+
+#: extmod/ulab/code/create.c
+msgid "number of points must be at least 2"
+msgstr ""
+
#: py/obj.c
#, c-format
msgid "object '%s' is not a tuple or list"
@@ -2412,6 +2679,18 @@ msgstr ""
msgid "only slices with step=1 (aka None) are supported"
msgstr ""
+#: extmod/ulab/code/ndarray.c extmod/ulab/code/vectorise.c
+msgid "operands could not be broadcast together"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "operation is not implemented on ndarrays"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "operation is not supported for given type"
+msgstr ""
+
#: py/modbuiltins.c
msgid "ord expects a character"
msgstr ""
@@ -2460,6 +2739,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "pop from an empty PulseIn"
msgstr ""
@@ -2487,6 +2767,14 @@ msgstr ""
msgid "queue overflow"
msgstr ""
+#: py/parse.c
+msgid "raw f-strings are not implemented"
+msgstr ""
+
+#: extmod/ulab/code/fft.c
+msgid "real and imaginary parts must be of equal length"
+msgstr ""
+
#: py/builtinimport.c
msgid "relative import"
msgstr ""
@@ -2504,6 +2792,20 @@ msgstr ""
msgid "return expected '%q' but got '%q'"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "rgb_pins[%d] duplicates another pin assignment"
+msgstr ""
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "rgb_pins[%d] is not on the same port as clock"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "right hand side must be an ndarray, or a scalar"
+msgstr ""
+
#: py/objstr.c
msgid "rsplit(None,n)"
msgstr ""
@@ -2526,6 +2828,10 @@ msgstr ""
msgid "script compilation not supported"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "shape must be a 2-tuple"
+msgstr ""
+
#: py/objstr.c
msgid "sign not allowed in string format specifier"
msgstr ""
@@ -2538,6 +2844,10 @@ msgstr ""
msgid "single '}' encountered in format string"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "size is defined for ndarrays only"
+msgstr ""
+
#: shared-bindings/time/__init__.c
msgid "sleep length must be non-negative"
msgstr ""
@@ -2554,6 +2864,10 @@ msgstr ""
msgid "soft reboot\n"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "sort argument must be an ndarray"
+msgstr ""
+
#: py/objstr.c
msgid "start/end indices"
msgstr ""
@@ -2643,12 +2957,16 @@ msgstr ""
msgid "too many arguments provided with the given format"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "too many indices"
+msgstr ""
+
#: py/runtime.c
#, c-format
msgid "too many values to unpack (expected %d)"
msgstr ""
-#: py/objstr.c
+#: extmod/ulab/code/linalg.c py/objstr.c
msgid "tuple index out of range"
msgstr ""
@@ -2662,6 +2980,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
+#: shared-bindings/busio/UART.c
msgid "tx and rx cannot both be None"
msgstr ""
@@ -2779,6 +3098,14 @@ msgstr ""
msgid "window must be <= interval"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "wrong argument type"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "wrong index type"
+msgstr ""
+
#: py/objstr.c
msgid "wrong number of arguments"
msgstr ""
@@ -2787,6 +3114,10 @@ msgstr ""
msgid "wrong number of values to unpack"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "wrong operand type"
+msgstr ""
+
#: shared-module/displayio/Shape.c
msgid "x value out of bounds"
msgstr ""
diff --git a/locale/de_DE.po b/locale/de_DE.po
index f2d8537f6..bdc4c9bf4 100644
--- a/locale/de_DE.po
+++ b/locale/de_DE.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-02-05 15:55-0800\n"
+"POT-Creation-Date: 2020-04-15 10:24-0400\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: Pascal Deneaux\n"
"Language-Team: Sebastian Plamauer, Pascal Deneaux\n"
@@ -55,6 +55,11 @@ msgstr " Ausgabe:\n"
msgid "%%c requires int or char"
msgstr "%%c erwartet int oder char"
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "%d address pins and %d rgb pins indicate a height of %d, not %d"
+msgstr ""
+
#: shared-bindings/microcontroller/Pin.c
msgid "%q in use"
msgstr "%q in Benutzung"
@@ -135,6 +140,10 @@ msgstr "'%s' integer %d ist nicht im Bereich %d..%d"
msgid "'%s' integer 0x%x does not fit in mask 0x%x"
msgstr "'%s' Integer 0x%x passt nicht in Maske 0x%x"
+#: py/runtime.c
+msgid "'%s' object cannot assign attribute '%q'"
+msgstr ""
+
#: py/proto.c
msgid "'%s' object does not support '%q'"
msgstr ""
@@ -186,6 +195,10 @@ msgid "'align' requires 1 argument"
msgstr "'align' erfordert genau ein Argument"
#: py/compile.c
+msgid "'async for' or 'async with' outside async function"
+msgstr ""
+
+#: py/compile.c
msgid "'await' outside function"
msgstr "'await' außerhalb einer Funktion"
@@ -275,7 +288,7 @@ msgstr "Alle timer für diesen Pin werden bereits benutzt"
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
#: ports/cxd56/common-hal/pulseio/PulseOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
-#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c
+#: ports/nrf/peripherals/nrf/timers.c shared-bindings/pulseio/PWMOut.c
#: shared-module/_pew/PewPew.c
msgid "All timers in use"
msgstr "Alle timer werden benutzt"
@@ -315,6 +328,10 @@ msgstr "Array muss Halbwörter enthalten (type 'H')"
msgid "Array values should be single bytes."
msgstr "Array-Werte sollten aus Einzelbytes bestehen."
+#: shared-bindings/_protomatter/Protomatter.c
+msgid "At most %d %q may be specified (not %d)"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
@@ -332,6 +349,7 @@ msgstr ""
"auszuführen oder verbinde dich mit der REPL zum Deaktivieren.\n"
#: shared-module/displayio/Display.c
+#: shared-module/framebufferio/FramebufferDisplay.c
msgid "Below minimum frame rate"
msgstr "Unterhalb der minimalen Frame Rate"
@@ -347,7 +365,9 @@ msgstr "Bit depth muss ein Vielfaches von 8 sein."
msgid "Both pins must support hardware interrupts"
msgstr "Beide pins müssen Hardware Interrupts unterstützen"
+#: shared-bindings/_protomatter/Protomatter.c
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness must be 0-1.0"
msgstr "Die Helligkeit muss zwischen 0 und 1.0 liegen"
@@ -356,6 +376,7 @@ msgid "Brightness must be between 0 and 255"
msgstr "Die Helligkeit muss zwischen 0 und 255 liegen"
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness not adjustable"
msgstr "Die Helligkeit ist nicht einstellbar"
@@ -370,10 +391,12 @@ msgid "Buffer incorrect size. Should be %d bytes."
msgstr "Der Puffergröße ist inkorrekt. Sie sollte %d bytes haben."
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is not a bytearray."
msgstr "Der Puffer ist kein Byte-Array"
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is too small"
msgstr "Der Puffer ist zu klein"
@@ -390,6 +413,11 @@ msgstr "Der Puffer muss eine Mindestenslänge von 1 haben"
msgid "Buffer too large and unable to allocate"
msgstr ""
+#: shared-bindings/_bleio/PacketBuffer.c
+#, c-format
+msgid "Buffer too short by %d bytes"
+msgstr ""
+
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
#: ports/nrf/common-hal/displayio/ParallelBus.c
#, c-format
@@ -456,6 +484,10 @@ msgstr "Reset zum bootloader nicht möglich da bootloader nicht vorhanden"
msgid "Cannot set value when direction is input."
msgstr "Der Wert kann nicht gesetzt werden, wenn die Richtung input ist."
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Cannot specify RTS or CTS in RS485 mode"
+msgstr ""
+
#: py/objslice.c
msgid "Cannot subclass slice"
msgstr ""
@@ -468,7 +500,7 @@ msgstr "Übertragung ohne MOSI- und MISO-Pins nicht möglich."
msgid "Cannot unambiguously get sizeof scalar"
msgstr "sizeof scalar kann nicht eindeutig bestimmt werden"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Cannot vary frequency on a timer that is already in use"
msgstr ""
@@ -529,31 +561,31 @@ msgstr "Beschädigter raw code"
msgid "Could not initialize UART"
msgstr "Konnte UART nicht initialisieren"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not initialize channel"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not initialize timer"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not re-init channel"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not re-init timer"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not restart PWM"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not start PWM"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Could not start interrupt, RX busy"
msgstr ""
@@ -579,11 +611,11 @@ msgstr "Konnte second buffer nicht zuteilen"
msgid "Crash into the HardFault_Handler."
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Channel Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Device Init Error"
msgstr ""
@@ -617,11 +649,13 @@ msgid "DigitalInOut not supported on given pin"
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Display must have a 16 bit colorspace."
msgstr "Display muss einen 16 Bit Farbraum haben."
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Display rotation must be in 90 degree increments"
msgstr "Die Rotation der Anzeige muss in 90-Grad-Schritten erfolgen"
@@ -673,6 +707,10 @@ msgstr "Habe ein Tupel der Länge %d erwartet aber %d erhalten"
msgid "Extended advertisements with scan response not supported."
msgstr ""
+#: extmod/ulab/code/fft.c
+msgid "FFT is defined for ndarrays only"
+msgstr ""
+
#: shared-bindings/ps2io/Ps2.c
msgid "Failed sending command."
msgstr "Kommando nicht gesendet."
@@ -690,6 +728,7 @@ msgstr "Konnte keinen RX Buffer allozieren"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
msgstr "Konnte keine RX Buffer mit %d allozieren"
@@ -725,7 +764,7 @@ msgstr ""
"Die aufgezeichnete Frequenz liegt über der Leistungsgrenze. Aufnahme "
"angehalten."
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Frequency must match existing PWMOut using this timer"
msgstr ""
@@ -736,6 +775,7 @@ msgstr "Die Funktion erwartet, dass der 'lock'-Befehl zuvor ausgeführt wurde"
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Group already used"
msgstr "Gruppe schon benutzt"
@@ -743,11 +783,11 @@ msgstr "Gruppe schon benutzt"
msgid "Group full"
msgstr "Gruppe voll"
-#: ports/stm32f4/common-hal/busio/I2C.c ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c
msgid "Hardware busy, try alternative pins"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Hardware in use, try alternative pins"
msgstr ""
@@ -755,7 +795,7 @@ msgstr ""
msgid "I/O operation on closed file"
msgstr "Lese/Schreibe-operation an geschlossener Datei"
-#: ports/stm32f4/common-hal/busio/I2C.c
+#: ports/stm/common-hal/busio/I2C.c
msgid "I2C Init Error"
msgstr ""
@@ -787,7 +827,7 @@ msgstr ""
msgid "Insufficient encryption"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr ""
@@ -796,7 +836,7 @@ msgstr ""
msgid "Invalid %q pin"
msgstr "Ungültiger %q pin"
-#: ports/stm32f4/common-hal/analogio/AnalogIn.c
+#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Invalid ADC Unit value"
msgstr ""
@@ -804,11 +844,11 @@ msgstr ""
msgid "Invalid BMP file"
msgstr "Ungültige BMP-Datei"
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "Invalid DAC pin supplied"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/stm32f4/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c
msgid "Invalid I2C pin selection"
msgstr ""
@@ -818,16 +858,15 @@ msgstr ""
msgid "Invalid PWM frequency"
msgstr "Ungültige PWM Frequenz"
-#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm32f4/common-hal/busio/SPI.c
+#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c
msgid "Invalid SPI pin selection"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
msgid "Invalid UART pin selection"
msgstr ""
-#: py/moduerrno.c
+#: py/moduerrno.c shared-module/_protomatter/Protomatter.c
msgid "Invalid argument"
msgstr "Ungültiges Argument"
@@ -835,7 +874,7 @@ msgstr "Ungültiges Argument"
msgid "Invalid bits per value"
msgstr "Ungültige Bits pro Wert"
-#: ports/nrf/common-hal/busio/UART.c ports/stm32f4/common-hal/busio/UART.c
+#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
msgid "Invalid buffer size"
msgstr "Ungültige Puffergröße"
@@ -863,7 +902,7 @@ msgstr "Ungültige Datei"
msgid "Invalid format chunk size"
msgstr "Ungültige format chunk size"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Invalid frequency supplied"
msgstr ""
@@ -876,12 +915,13 @@ msgid "Invalid number of bits"
msgstr "Ungültige Anzahl von Bits"
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
+#: shared-bindings/displayio/FourWire.c
msgid "Invalid phase"
msgstr "Ungültige Phase"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/atmel-samd/common-hal/touchio/TouchIn.c
-#: shared-bindings/pulseio/PWMOut.c
+#: shared-bindings/pulseio/PWMOut.c shared-module/_protomatter/Protomatter.c
msgid "Invalid pin"
msgstr "Ungültiger Pin"
@@ -899,11 +939,15 @@ msgstr "Ungültiger Pin für rechten Kanal"
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c
#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c
#: ports/cxd56/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
msgid "Invalid pins"
msgstr "Ungültige Pins"
+#: ports/stm/common-hal/pulseio/PWMOut.c
+msgid "Invalid pins for PWMOut"
+msgstr ""
+
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
+#: shared-bindings/displayio/FourWire.c
msgid "Invalid polarity"
msgstr "Ungültige Polarität"
@@ -931,7 +975,7 @@ msgstr "Ungültige Anzahl von Stimmen"
msgid "Invalid wave file"
msgstr "Ungültige wave Datei"
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Invalid word/bit length"
msgstr ""
@@ -981,7 +1025,7 @@ msgid "Microphone startup delay must be in range 0.0 to 1.0"
msgstr ""
"Die Startverzögerung des Mikrofons muss im Bereich von 0,0 bis 1,0 liegen"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "Missing MISO or MOSI Pin"
msgstr ""
@@ -989,10 +1033,19 @@ msgstr ""
msgid "Must be a %q subclass."
msgstr "Muss eine %q Unterklasse sein."
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "Must provide MISO or MOSI pin"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "Must use a multiple of 6 rgb pins, not %d"
+msgstr ""
+
+#: py/parse.c
+msgid "Name too long"
+msgstr ""
+
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Negative step not supported"
msgstr ""
@@ -1002,7 +1055,7 @@ msgid "No CCCD for this Characteristic"
msgstr "Kein CCCD für diese Charakteristik"
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "No DAC on chip"
msgstr "Kein DAC im Chip vorhanden"
@@ -1011,23 +1064,23 @@ msgstr "Kein DAC im Chip vorhanden"
msgid "No DMA channel found"
msgstr "Kein DMA Kanal gefunden"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "No MISO Pin"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "No MOSI Pin"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "No RX pin"
msgstr "Kein RX Pin"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "No TX pin"
msgstr "Kein TX Pin"
@@ -1056,7 +1109,7 @@ msgstr "Keine Hardwareunterstützung am clk Pin"
msgid "No hardware support on pin"
msgstr "Keine Hardwareunterstützung an diesem Pin"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "No more timers available on this pin."
msgstr ""
@@ -1072,6 +1125,10 @@ msgstr "Kein Speicherplatz mehr verfügbar auf dem Gerät"
msgid "No such file/directory"
msgstr "Keine solche Datei/Verzeichnis"
+#: shared-module/_protomatter/Protomatter.c
+msgid "No timer available"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid "Nordic Soft Device failure assertion."
msgstr ""
@@ -1132,7 +1189,8 @@ msgid ""
"PWM frequency not writable when variable_frequency is False on construction."
msgstr "Die PWM-Frequenz ist nicht schreibbar wenn variable_Frequenz = False."
-#: ports/stm32f4/common-hal/displayio/ParallelBus.c
+#: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c
+#: ports/stm/common-hal/displayio/ParallelBus.c
msgid "ParallelBus not yet supported"
msgstr ""
@@ -1144,10 +1202,22 @@ msgstr "Zugang verweigert"
#: ports/cxd56/common-hal/analogio/AnalogIn.c
#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c
#: ports/nrf/common-hal/analogio/AnalogIn.c
-#: ports/stm32f4/common-hal/analogio/AnalogIn.c
+#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Pin does not have ADC capabilities"
msgstr "Pin hat keine ADC Funktionalität"
+#: ports/stm/common-hal/pulseio/PulseIn.c
+msgid "Pin number already reserved by EXTI"
+msgstr ""
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid ""
+"Pinout uses %d bytes per element, which consumes more than the ideal %d "
+"bytes. If this cannot be avoided, pass allow_inefficient=True to the "
+"constructor"
+msgstr ""
+
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr "und alle Module im Dateisystem \n"
@@ -1166,26 +1236,31 @@ msgstr ""
"Drücke eine Taste um dich mit der REPL zu verbinden. Drücke Strg-D zum neu "
"laden"
+#: shared-module/_protomatter/Protomatter.c
+#, c-format
+msgid "Protomatter internal error #%d"
+msgstr ""
+
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Pull not used when direction is output."
msgstr "Pull wird nicht verwendet, wenn die Richtung output ist."
-#: ports/stm32f4/common-hal/pulseio/PulseIn.c
-msgid "PulseIn not yet supported"
-msgstr ""
-
-#: ports/stm32f4/common-hal/pulseio/PulseOut.c
-msgid "PulseOut not yet supported"
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid "PulseOut not supported on this chip"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/stm/common-hal/os/__init__.c
msgid "RNG Init Error"
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "RS485 inversion specified when not in RS485 mode"
+msgstr ""
+
#: ports/cxd56/common-hal/rtc/RTC.c ports/mimxrt10xx/common-hal/rtc/RTC.c
#: ports/nrf/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
@@ -1195,7 +1270,12 @@ msgstr "Die RTC-Kalibrierung wird auf diesem Board nicht unterstützt"
msgid "RTC is not supported on this board"
msgstr "Eine RTC wird auf diesem Board nicht unterstützt"
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
+#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+msgid "RTS/CTS/RS485 Not yet supported on this device"
+msgstr ""
+
+#: ports/stm/common-hal/os/__init__.c
msgid "Random number generation error"
msgstr ""
@@ -1235,11 +1315,11 @@ msgstr "Sicherheitsmodus aktiv! Gespeicherter Code wird nicht ausgeführt\n"
msgid "SDA or SCL needs a pull up"
msgstr "SDA oder SCL brauchen pull up"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Re-initialization error"
msgstr ""
@@ -1256,6 +1336,14 @@ msgstr "Abtastrate zu hoch. Wert muss unter %d liegen"
msgid "Scan already in progess. Stop with stop_scan."
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Selected CTS pin not valid"
+msgstr ""
+
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Selected RTS pin not valid"
+msgstr ""
+
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "Serializer in use"
@@ -1282,10 +1370,14 @@ msgstr "Die Stackgröße sollte mindestens 256 sein"
msgid "Stream missing readinto() or write() method."
msgstr "Stream fehlt readinto() oder write() Methode."
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Supply at least one UART pin"
msgstr ""
+#: ports/stm/common-hal/microcontroller/Processor.c
+msgid "Temperature read timed out"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid ""
"The CircuitPython heap was corrupted because the stack was too small.\n"
@@ -1343,13 +1435,11 @@ msgstr ""
msgid "Too many channels in sample."
msgstr "Zu viele Kanäle im sample"
-#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
-#: shared-bindings/displayio/ParallelBus.c
+#: shared-module/displayio/__init__.c
msgid "Too many display busses"
msgstr ""
-#: shared-bindings/displayio/Display.c
-#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-module/displayio/__init__.c
msgid "Too many displays"
msgstr "Zu viele displays"
@@ -1361,23 +1451,23 @@ msgstr "Zurückverfolgung (jüngste Aufforderung zuletzt):\n"
msgid "Tuple or struct_time argument required"
msgstr "Tuple- oder struct_time-Argument erforderlich"
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Buffer allocation error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART De-init error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Re-init error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART write error"
msgstr ""
@@ -1498,6 +1588,10 @@ msgstr "Länge des Wertes > max_length"
msgid "Viper functions don't currently support more than 4 arguments"
msgstr "Viper-Funktionen unterstützen derzeit nicht mehr als 4 Argumente"
+#: ports/stm/common-hal/microcontroller/Processor.c
+msgid "Voltage read timed out"
+msgstr ""
+
#: main.c
msgid "WARNING: Your code filename has two extensions\n"
msgstr ""
@@ -1565,10 +1659,18 @@ msgstr "Adresse außerhalb der Grenzen"
msgid "addresses is empty"
msgstr "adresses ist leer"
+#: extmod/ulab/code/vectorise.c
+msgid "arctan2 is implemented for scalars and ndarrays only"
+msgstr ""
+
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr "arg ist eine leere Sequenz"
+#: extmod/ulab/code/numerical.c
+msgid "argsort argument must be an ndarray"
+msgstr ""
+
#: py/runtime.c
msgid "argument has wrong type"
msgstr "Argument hat falschen Typ"
@@ -1582,14 +1684,34 @@ msgstr "Anzahl/Type der Argumente passen nicht"
msgid "argument should be a '%q' not a '%q'"
msgstr "Argument sollte '%q' sein, nicht '%q'"
+#: extmod/ulab/code/linalg.c
+msgid "arguments must be ndarrays"
+msgstr ""
+
#: py/objarray.c shared-bindings/nvm/ByteArray.c
msgid "array/bytes required on right side"
msgstr "Array/Bytes auf der rechten Seite erforderlich"
+#: extmod/ulab/code/numerical.c
+msgid "attempt to get argmin/argmax of an empty sequence"
+msgstr ""
+
#: py/objstr.c
msgid "attributes not supported yet"
msgstr "Attribute werden noch nicht unterstützt"
+#: extmod/ulab/code/numerical.c
+msgid "axis must be -1, 0, None, or 1"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "axis must be -1, 0, or 1"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "axis must be None, 0, or 1"
+msgstr ""
+
#: py/builtinevex.c
msgid "bad compile mode"
msgstr ""
@@ -1832,6 +1954,10 @@ msgstr "Name %q kann nicht importiert werden"
msgid "cannot perform relative import"
msgstr "kann keinen relativen Import durchführen"
+#: extmod/ulab/code/ndarray.c
+msgid "cannot reshape array (incompatible input/output shape)"
+msgstr ""
+
#: py/emitnative.c
msgid "casting"
msgstr ""
@@ -1889,6 +2015,30 @@ msgstr "constant muss ein integer sein"
msgid "conversion to object"
msgstr "Umwandlung zu Objekt"
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must be linear arrays"
+msgstr ""
+
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must be ndarrays"
+msgstr ""
+
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must not be empty"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "could not broadast input array from shape"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "could not invert Vandermonde matrix"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "ddof must be smaller than length of data set"
+msgstr ""
+
#: py/parsenum.c
msgid "decimal numbers not supported"
msgstr "Dezimalzahlen nicht unterstützt"
@@ -1914,6 +2064,10 @@ msgstr "destination_length muss ein int >= 0 sein"
msgid "dict update sequence has wrong length"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "diff argument must be an ndarray"
+msgstr ""
+
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@@ -1984,6 +2138,26 @@ msgstr "Es wurden zusätzliche Keyword-Argumente angegeben"
msgid "extra positional arguments given"
msgstr "Es wurden zusätzliche Argumente ohne Keyword angegeben"
+#: py/parse.c
+msgid "f-string expression part cannot include a '#'"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string expression part cannot include a backslash"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: empty expression not allowed"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: expecting '}'"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: single '}' is not allowed"
+msgstr ""
+
#: shared-bindings/audiocore/WaveFile.c shared-bindings/audiomp3/MP3Decoder.c
#: shared-bindings/displayio/OnDiskBitmap.c
msgid "file must be a file opened in byte mode"
@@ -1993,6 +2167,14 @@ msgstr "Die Datei muss eine im Byte-Modus geöffnete Datei sein"
msgid "filesystem must provide mount method"
msgstr "Das Dateisystem muss eine Mount-Methode bereitstellen"
+#: extmod/ulab/code/ndarray.c
+msgid "first argument must be an iterable"
+msgstr ""
+
+#: extmod/ulab/code/vectorise.c
+msgid "first argument must be an ndarray"
+msgstr ""
+
#: py/objtype.c
msgid "first argument to super() must be type"
msgstr "Das erste Argument für super() muss type sein"
@@ -2001,6 +2183,14 @@ msgstr "Das erste Argument für super() muss type sein"
msgid "firstbit must be MSB"
msgstr "Erstes Bit muss das höchstwertigste Bit (MSB) sein"
+#: extmod/ulab/code/ndarray.c
+msgid "flattening order must be either 'C', or 'F'"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "flip argument must be an ndarray"
+msgstr ""
+
#: py/objint.c
msgid "float too big"
msgstr "float zu groß"
@@ -2094,9 +2284,14 @@ msgstr "unvollständiger Formatschlüssel"
msgid "incorrect padding"
msgstr "padding ist inkorrekt"
+#: extmod/ulab/code/ndarray.c
+msgid "index is out of bounds"
+msgstr ""
+
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
-#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c
+#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c
msgid "index out of range"
msgstr "index außerhalb der Reichweite"
@@ -2104,10 +2299,46 @@ msgstr "index außerhalb der Reichweite"
msgid "indices must be integers"
msgstr "Indizes müssen ganze Zahlen sein"
+#: extmod/ulab/code/ndarray.c
+msgid "indices must be integers, slices, or Boolean lists"
+msgstr ""
+
#: py/compile.c
msgid "inline assembler must be a function"
msgstr "inline assembler muss eine function sein"
+#: extmod/ulab/code/create.c
+msgid "input argument must be an integer or a 2-tuple"
+msgstr ""
+
+#: extmod/ulab/code/fft.c
+msgid "input array length must be power of 2"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "input data must be an iterable"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input matrix is asymmetric"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input matrix is singular"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input must be square matrix"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "input must be tuple, list, range, or ndarray"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "input vectors must be of equal length"
+msgstr ""
+
#: py/parsenum.c
msgid "int() arg 2 must be >= 2 and <= 36"
msgstr "int() arg 2 muss >= 2 und <= 36 sein"
@@ -2186,6 +2417,14 @@ msgstr "issubclass() arg 1 muss eine Klasse sein"
msgid "issubclass() arg 2 must be a class or a tuple of classes"
msgstr "issubclass() arg 2 muss eine Klasse oder ein Tupel von Klassen sein"
+#: extmod/ulab/code/ndarray.c
+msgid "iterables are not of the same length"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "iterations did not converge"
+msgstr ""
+
#: py/objstr.c
msgid "join expects a list of str/bytes objects consistent with self object"
msgstr ""
@@ -2240,6 +2479,10 @@ msgstr ""
msgid "long int not supported in this build"
msgstr "long int wird in diesem Build nicht unterstützt"
+#: py/parse.c
+msgid "malformed f-string"
+msgstr ""
+
#: shared-bindings/_stage/Layer.c
msgid "map buffer too small"
msgstr "map buffer zu klein"
@@ -2248,6 +2491,14 @@ msgstr "map buffer zu klein"
msgid "math domain error"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "matrix dimensions do not match"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "matrix is not positive definite"
+msgstr ""
+
#: ports/nrf/common-hal/_bleio/Characteristic.c
#: ports/nrf/common-hal/_bleio/Descriptor.c
#, c-format
@@ -2271,6 +2522,10 @@ msgstr "Speicherzuweisung fehlgeschlagen, der Heap ist gesperrt"
msgid "module not found"
msgstr "Modul nicht gefunden"
+#: extmod/ulab/code/poly.c
+msgid "more degrees of freedom than data points"
+msgstr ""
+
#: py/compile.c
msgid "multiple *x in assignment"
msgstr "mehrere *x in Zuordnung"
@@ -2295,6 +2550,10 @@ msgstr "sck/mosi/miso müssen alle spezifiziert sein"
msgid "must use keyword argument for key function"
msgstr "muss Schlüsselwortargument für key function verwenden"
+#: extmod/ulab/code/numerical.c
+msgid "n must be between 0, and 9"
+msgstr ""
+
#: py/runtime.c
msgid "name '%q' is not defined"
msgstr "Name '%q' ist nirgends definiert worden (Schreibweise kontrollieren)"
@@ -2381,6 +2640,14 @@ msgstr ""
msgid "not enough arguments for format string"
msgstr ""
+#: extmod/ulab/code/poly.c
+msgid "number of arguments must be 2, or 3"
+msgstr ""
+
+#: extmod/ulab/code/create.c
+msgid "number of points must be at least 2"
+msgstr ""
+
#: py/obj.c
#, c-format
msgid "object '%s' is not a tuple or list"
@@ -2448,6 +2715,18 @@ msgstr "nur eine sample_rate=16000 wird unterstützt"
msgid "only slices with step=1 (aka None) are supported"
msgstr ""
+#: extmod/ulab/code/ndarray.c extmod/ulab/code/vectorise.c
+msgid "operands could not be broadcast together"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "operation is not implemented on ndarrays"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "operation is not supported for given type"
+msgstr ""
+
#: py/modbuiltins.c
msgid "ord expects a character"
msgstr "ord erwartet ein Zeichen"
@@ -2498,6 +2777,7 @@ msgstr "pixel_shader muss displayio.Palette oder displayio.ColorConverter sein"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "pop from an empty PulseIn"
msgstr "pop von einem leeren PulseIn"
@@ -2525,6 +2805,14 @@ msgstr ""
msgid "queue overflow"
msgstr "Warteschlangenüberlauf"
+#: py/parse.c
+msgid "raw f-strings are not implemented"
+msgstr ""
+
+#: extmod/ulab/code/fft.c
+msgid "real and imaginary parts must be of equal length"
+msgstr ""
+
#: py/builtinimport.c
msgid "relative import"
msgstr "relativer Import"
@@ -2542,6 +2830,20 @@ msgstr "return annotation muss ein identifier sein"
msgid "return expected '%q' but got '%q'"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "rgb_pins[%d] duplicates another pin assignment"
+msgstr ""
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "rgb_pins[%d] is not on the same port as clock"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "right hand side must be an ndarray, or a scalar"
+msgstr ""
+
#: py/objstr.c
msgid "rsplit(None,n)"
msgstr ""
@@ -2566,6 +2868,10 @@ msgstr "Der schedule stack ist voll"
msgid "script compilation not supported"
msgstr "kompilieren von Skripten nicht unterstützt"
+#: extmod/ulab/code/ndarray.c
+msgid "shape must be a 2-tuple"
+msgstr ""
+
#: py/objstr.c
msgid "sign not allowed in string format specifier"
msgstr ""
@@ -2578,6 +2884,10 @@ msgstr ""
msgid "single '}' encountered in format string"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "size is defined for ndarrays only"
+msgstr ""
+
#: shared-bindings/time/__init__.c
msgid "sleep length must be non-negative"
msgstr ""
@@ -2594,6 +2904,10 @@ msgstr "small int Überlauf"
msgid "soft reboot\n"
msgstr "weicher reboot\n"
+#: extmod/ulab/code/numerical.c
+msgid "sort argument must be an ndarray"
+msgstr ""
+
#: py/objstr.c
msgid "start/end indices"
msgstr "start/end Indizes"
@@ -2684,12 +2998,16 @@ msgstr ""
msgid "too many arguments provided with the given format"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "too many indices"
+msgstr ""
+
#: py/runtime.c
#, c-format
msgid "too many values to unpack (expected %d)"
msgstr ""
-#: py/objstr.c
+#: extmod/ulab/code/linalg.c py/objstr.c
msgid "tuple index out of range"
msgstr ""
@@ -2703,6 +3021,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
+#: shared-bindings/busio/UART.c
msgid "tx and rx cannot both be None"
msgstr "tx und rx können nicht beide None sein"
@@ -2824,6 +3143,14 @@ msgstr "value_count muss größer als 0 sein"
msgid "window must be <= interval"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "wrong argument type"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "wrong index type"
+msgstr ""
+
#: py/objstr.c
msgid "wrong number of arguments"
msgstr "falsche Anzahl an Argumenten"
@@ -2832,6 +3159,10 @@ msgstr "falsche Anzahl an Argumenten"
msgid "wrong number of values to unpack"
msgstr "falsche Anzahl zu entpackender Werte"
+#: extmod/ulab/code/ndarray.c
+msgid "wrong operand type"
+msgstr ""
+
#: shared-module/displayio/Shape.c
msgid "x value out of bounds"
msgstr "x Wert außerhalb der Grenzen"
diff --git a/locale/en_US.po b/locale/en_US.po
index 680c535a9..8028a42da 100644
--- a/locale/en_US.po
+++ b/locale/en_US.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-02-05 15:55-0800\n"
+"POT-Creation-Date: 2020-04-15 10:24-0400\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -53,6 +53,11 @@ msgstr ""
msgid "%%c requires int or char"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "%d address pins and %d rgb pins indicate a height of %d, not %d"
+msgstr ""
+
#: shared-bindings/microcontroller/Pin.c
msgid "%q in use"
msgstr ""
@@ -133,6 +138,10 @@ msgstr ""
msgid "'%s' integer 0x%x does not fit in mask 0x%x"
msgstr ""
+#: py/runtime.c
+msgid "'%s' object cannot assign attribute '%q'"
+msgstr ""
+
#: py/proto.c
msgid "'%s' object does not support '%q'"
msgstr ""
@@ -184,6 +193,10 @@ msgid "'align' requires 1 argument"
msgstr ""
#: py/compile.c
+msgid "'async for' or 'async with' outside async function"
+msgstr ""
+
+#: py/compile.c
msgid "'await' outside function"
msgstr ""
@@ -273,7 +286,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
#: ports/cxd56/common-hal/pulseio/PulseOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
-#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c
+#: ports/nrf/peripherals/nrf/timers.c shared-bindings/pulseio/PWMOut.c
#: shared-module/_pew/PewPew.c
msgid "All timers in use"
msgstr ""
@@ -313,6 +326,10 @@ msgstr ""
msgid "Array values should be single bytes."
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+msgid "At most %d %q may be specified (not %d)"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
@@ -328,6 +345,7 @@ msgid ""
msgstr ""
#: shared-module/displayio/Display.c
+#: shared-module/framebufferio/FramebufferDisplay.c
msgid "Below minimum frame rate"
msgstr ""
@@ -343,7 +361,9 @@ msgstr ""
msgid "Both pins must support hardware interrupts"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness must be 0-1.0"
msgstr ""
@@ -352,6 +372,7 @@ msgid "Brightness must be between 0 and 255"
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness not adjustable"
msgstr ""
@@ -366,10 +387,12 @@ msgid "Buffer incorrect size. Should be %d bytes."
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is not a bytearray."
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is too small"
msgstr ""
@@ -386,6 +409,11 @@ msgstr ""
msgid "Buffer too large and unable to allocate"
msgstr ""
+#: shared-bindings/_bleio/PacketBuffer.c
+#, c-format
+msgid "Buffer too short by %d bytes"
+msgstr ""
+
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
#: ports/nrf/common-hal/displayio/ParallelBus.c
#, c-format
@@ -452,6 +480,10 @@ msgstr ""
msgid "Cannot set value when direction is input."
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Cannot specify RTS or CTS in RS485 mode"
+msgstr ""
+
#: py/objslice.c
msgid "Cannot subclass slice"
msgstr ""
@@ -464,7 +496,7 @@ msgstr ""
msgid "Cannot unambiguously get sizeof scalar"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Cannot vary frequency on a timer that is already in use"
msgstr ""
@@ -525,31 +557,31 @@ msgstr ""
msgid "Could not initialize UART"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not initialize channel"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not initialize timer"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not re-init channel"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not re-init timer"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not restart PWM"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not start PWM"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Could not start interrupt, RX busy"
msgstr ""
@@ -575,11 +607,11 @@ msgstr ""
msgid "Crash into the HardFault_Handler."
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Channel Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Device Init Error"
msgstr ""
@@ -613,11 +645,13 @@ msgid "DigitalInOut not supported on given pin"
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Display must have a 16 bit colorspace."
msgstr ""
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Display rotation must be in 90 degree increments"
msgstr ""
@@ -669,6 +703,10 @@ msgstr ""
msgid "Extended advertisements with scan response not supported."
msgstr ""
+#: extmod/ulab/code/fft.c
+msgid "FFT is defined for ndarrays only"
+msgstr ""
+
#: shared-bindings/ps2io/Ps2.c
msgid "Failed sending command."
msgstr ""
@@ -686,6 +724,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
msgstr ""
@@ -719,7 +758,7 @@ msgstr ""
msgid "Frequency captured is above capability. Capture Paused."
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Frequency must match existing PWMOut using this timer"
msgstr ""
@@ -730,6 +769,7 @@ msgstr ""
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Group already used"
msgstr ""
@@ -737,11 +777,11 @@ msgstr ""
msgid "Group full"
msgstr ""
-#: ports/stm32f4/common-hal/busio/I2C.c ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c
msgid "Hardware busy, try alternative pins"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Hardware in use, try alternative pins"
msgstr ""
@@ -749,7 +789,7 @@ msgstr ""
msgid "I/O operation on closed file"
msgstr ""
-#: ports/stm32f4/common-hal/busio/I2C.c
+#: ports/stm/common-hal/busio/I2C.c
msgid "I2C Init Error"
msgstr ""
@@ -779,7 +819,7 @@ msgstr ""
msgid "Insufficient encryption"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr ""
@@ -788,7 +828,7 @@ msgstr ""
msgid "Invalid %q pin"
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogIn.c
+#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Invalid ADC Unit value"
msgstr ""
@@ -796,11 +836,11 @@ msgstr ""
msgid "Invalid BMP file"
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "Invalid DAC pin supplied"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/stm32f4/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c
msgid "Invalid I2C pin selection"
msgstr ""
@@ -810,16 +850,15 @@ msgstr ""
msgid "Invalid PWM frequency"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm32f4/common-hal/busio/SPI.c
+#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c
msgid "Invalid SPI pin selection"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
msgid "Invalid UART pin selection"
msgstr ""
-#: py/moduerrno.c
+#: py/moduerrno.c shared-module/_protomatter/Protomatter.c
msgid "Invalid argument"
msgstr ""
@@ -827,7 +866,7 @@ msgstr ""
msgid "Invalid bits per value"
msgstr ""
-#: ports/nrf/common-hal/busio/UART.c ports/stm32f4/common-hal/busio/UART.c
+#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
msgid "Invalid buffer size"
msgstr ""
@@ -855,7 +894,7 @@ msgstr ""
msgid "Invalid format chunk size"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Invalid frequency supplied"
msgstr ""
@@ -868,12 +907,13 @@ msgid "Invalid number of bits"
msgstr ""
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
+#: shared-bindings/displayio/FourWire.c
msgid "Invalid phase"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/atmel-samd/common-hal/touchio/TouchIn.c
-#: shared-bindings/pulseio/PWMOut.c
+#: shared-bindings/pulseio/PWMOut.c shared-module/_protomatter/Protomatter.c
msgid "Invalid pin"
msgstr ""
@@ -891,11 +931,15 @@ msgstr ""
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c
#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c
#: ports/cxd56/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
msgid "Invalid pins"
msgstr ""
+#: ports/stm/common-hal/pulseio/PWMOut.c
+msgid "Invalid pins for PWMOut"
+msgstr ""
+
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
+#: shared-bindings/displayio/FourWire.c
msgid "Invalid polarity"
msgstr ""
@@ -923,7 +967,7 @@ msgstr ""
msgid "Invalid wave file"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Invalid word/bit length"
msgstr ""
@@ -972,7 +1016,7 @@ msgstr ""
msgid "Microphone startup delay must be in range 0.0 to 1.0"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "Missing MISO or MOSI Pin"
msgstr ""
@@ -980,10 +1024,19 @@ msgstr ""
msgid "Must be a %q subclass."
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "Must provide MISO or MOSI pin"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "Must use a multiple of 6 rgb pins, not %d"
+msgstr ""
+
+#: py/parse.c
+msgid "Name too long"
+msgstr ""
+
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Negative step not supported"
msgstr ""
@@ -993,7 +1046,7 @@ msgid "No CCCD for this Characteristic"
msgstr ""
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "No DAC on chip"
msgstr ""
@@ -1002,23 +1055,23 @@ msgstr ""
msgid "No DMA channel found"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "No MISO Pin"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "No MOSI Pin"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "No RX pin"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "No TX pin"
msgstr ""
@@ -1047,7 +1100,7 @@ msgstr ""
msgid "No hardware support on pin"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "No more timers available on this pin."
msgstr ""
@@ -1063,6 +1116,10 @@ msgstr ""
msgid "No such file/directory"
msgstr ""
+#: shared-module/_protomatter/Protomatter.c
+msgid "No timer available"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid "Nordic Soft Device failure assertion."
msgstr ""
@@ -1117,7 +1174,8 @@ msgid ""
"PWM frequency not writable when variable_frequency is False on construction."
msgstr ""
-#: ports/stm32f4/common-hal/displayio/ParallelBus.c
+#: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c
+#: ports/stm/common-hal/displayio/ParallelBus.c
msgid "ParallelBus not yet supported"
msgstr ""
@@ -1129,10 +1187,22 @@ msgstr ""
#: ports/cxd56/common-hal/analogio/AnalogIn.c
#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c
#: ports/nrf/common-hal/analogio/AnalogIn.c
-#: ports/stm32f4/common-hal/analogio/AnalogIn.c
+#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Pin does not have ADC capabilities"
msgstr ""
+#: ports/stm/common-hal/pulseio/PulseIn.c
+msgid "Pin number already reserved by EXTI"
+msgstr ""
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid ""
+"Pinout uses %d bytes per element, which consumes more than the ideal %d "
+"bytes. If this cannot be avoided, pass allow_inefficient=True to the "
+"constructor"
+msgstr ""
+
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr ""
@@ -1149,26 +1219,31 @@ msgstr ""
msgid "Press any key to enter the REPL. Use CTRL-D to reload."
msgstr ""
-#: shared-bindings/digitalio/DigitalInOut.c
-msgid "Pull not used when direction is output."
+#: shared-module/_protomatter/Protomatter.c
+#, c-format
+msgid "Protomatter internal error #%d"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PulseIn.c
-msgid "PulseIn not yet supported"
+#: shared-bindings/digitalio/DigitalInOut.c
+msgid "Pull not used when direction is output."
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PulseOut.c
-msgid "PulseOut not yet supported"
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid "PulseOut not supported on this chip"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/stm/common-hal/os/__init__.c
msgid "RNG Init Error"
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "RS485 inversion specified when not in RS485 mode"
+msgstr ""
+
#: ports/cxd56/common-hal/rtc/RTC.c ports/mimxrt10xx/common-hal/rtc/RTC.c
#: ports/nrf/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
@@ -1178,7 +1253,12 @@ msgstr ""
msgid "RTC is not supported on this board"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
+#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+msgid "RTS/CTS/RS485 Not yet supported on this device"
+msgstr ""
+
+#: ports/stm/common-hal/os/__init__.c
msgid "Random number generation error"
msgstr ""
@@ -1218,11 +1298,11 @@ msgstr ""
msgid "SDA or SCL needs a pull up"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Re-initialization error"
msgstr ""
@@ -1239,6 +1319,14 @@ msgstr ""
msgid "Scan already in progess. Stop with stop_scan."
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Selected CTS pin not valid"
+msgstr ""
+
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Selected RTS pin not valid"
+msgstr ""
+
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "Serializer in use"
@@ -1265,10 +1353,14 @@ msgstr ""
msgid "Stream missing readinto() or write() method."
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Supply at least one UART pin"
msgstr ""
+#: ports/stm/common-hal/microcontroller/Processor.c
+msgid "Temperature read timed out"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid ""
"The CircuitPython heap was corrupted because the stack was too small.\n"
@@ -1324,13 +1416,11 @@ msgstr ""
msgid "Too many channels in sample."
msgstr ""
-#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
-#: shared-bindings/displayio/ParallelBus.c
+#: shared-module/displayio/__init__.c
msgid "Too many display busses"
msgstr ""
-#: shared-bindings/displayio/Display.c
-#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-module/displayio/__init__.c
msgid "Too many displays"
msgstr ""
@@ -1342,23 +1432,23 @@ msgstr ""
msgid "Tuple or struct_time argument required"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Buffer allocation error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART De-init error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Re-init error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART write error"
msgstr ""
@@ -1477,6 +1567,10 @@ msgstr ""
msgid "Viper functions don't currently support more than 4 arguments"
msgstr ""
+#: ports/stm/common-hal/microcontroller/Processor.c
+msgid "Voltage read timed out"
+msgstr ""
+
#: main.c
msgid "WARNING: Your code filename has two extensions\n"
msgstr ""
@@ -1537,10 +1631,18 @@ msgstr ""
msgid "addresses is empty"
msgstr ""
+#: extmod/ulab/code/vectorise.c
+msgid "arctan2 is implemented for scalars and ndarrays only"
+msgstr ""
+
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "argsort argument must be an ndarray"
+msgstr ""
+
#: py/runtime.c
msgid "argument has wrong type"
msgstr ""
@@ -1554,14 +1656,34 @@ msgstr ""
msgid "argument should be a '%q' not a '%q'"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "arguments must be ndarrays"
+msgstr ""
+
#: py/objarray.c shared-bindings/nvm/ByteArray.c
msgid "array/bytes required on right side"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "attempt to get argmin/argmax of an empty sequence"
+msgstr ""
+
#: py/objstr.c
msgid "attributes not supported yet"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "axis must be -1, 0, None, or 1"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "axis must be -1, 0, or 1"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "axis must be None, 0, or 1"
+msgstr ""
+
#: py/builtinevex.c
msgid "bad compile mode"
msgstr ""
@@ -1804,6 +1926,10 @@ msgstr ""
msgid "cannot perform relative import"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "cannot reshape array (incompatible input/output shape)"
+msgstr ""
+
#: py/emitnative.c
msgid "casting"
msgstr ""
@@ -1860,6 +1986,30 @@ msgstr ""
msgid "conversion to object"
msgstr ""
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must be linear arrays"
+msgstr ""
+
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must be ndarrays"
+msgstr ""
+
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must not be empty"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "could not broadast input array from shape"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "could not invert Vandermonde matrix"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "ddof must be smaller than length of data set"
+msgstr ""
+
#: py/parsenum.c
msgid "decimal numbers not supported"
msgstr ""
@@ -1885,6 +2035,10 @@ msgstr ""
msgid "dict update sequence has wrong length"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "diff argument must be an ndarray"
+msgstr ""
+
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@@ -1955,6 +2109,26 @@ msgstr ""
msgid "extra positional arguments given"
msgstr ""
+#: py/parse.c
+msgid "f-string expression part cannot include a '#'"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string expression part cannot include a backslash"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: empty expression not allowed"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: expecting '}'"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: single '}' is not allowed"
+msgstr ""
+
#: shared-bindings/audiocore/WaveFile.c shared-bindings/audiomp3/MP3Decoder.c
#: shared-bindings/displayio/OnDiskBitmap.c
msgid "file must be a file opened in byte mode"
@@ -1964,6 +2138,14 @@ msgstr ""
msgid "filesystem must provide mount method"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "first argument must be an iterable"
+msgstr ""
+
+#: extmod/ulab/code/vectorise.c
+msgid "first argument must be an ndarray"
+msgstr ""
+
#: py/objtype.c
msgid "first argument to super() must be type"
msgstr ""
@@ -1972,6 +2154,14 @@ msgstr ""
msgid "firstbit must be MSB"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "flattening order must be either 'C', or 'F'"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "flip argument must be an ndarray"
+msgstr ""
+
#: py/objint.c
msgid "float too big"
msgstr ""
@@ -2064,9 +2254,14 @@ msgstr ""
msgid "incorrect padding"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "index is out of bounds"
+msgstr ""
+
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
-#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c
+#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c
msgid "index out of range"
msgstr ""
@@ -2074,10 +2269,46 @@ msgstr ""
msgid "indices must be integers"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "indices must be integers, slices, or Boolean lists"
+msgstr ""
+
#: py/compile.c
msgid "inline assembler must be a function"
msgstr ""
+#: extmod/ulab/code/create.c
+msgid "input argument must be an integer or a 2-tuple"
+msgstr ""
+
+#: extmod/ulab/code/fft.c
+msgid "input array length must be power of 2"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "input data must be an iterable"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input matrix is asymmetric"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input matrix is singular"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input must be square matrix"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "input must be tuple, list, range, or ndarray"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "input vectors must be of equal length"
+msgstr ""
+
#: py/parsenum.c
msgid "int() arg 2 must be >= 2 and <= 36"
msgstr ""
@@ -2156,6 +2387,14 @@ msgstr ""
msgid "issubclass() arg 2 must be a class or a tuple of classes"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "iterables are not of the same length"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "iterations did not converge"
+msgstr ""
+
#: py/objstr.c
msgid "join expects a list of str/bytes objects consistent with self object"
msgstr ""
@@ -2204,6 +2443,10 @@ msgstr ""
msgid "long int not supported in this build"
msgstr ""
+#: py/parse.c
+msgid "malformed f-string"
+msgstr ""
+
#: shared-bindings/_stage/Layer.c
msgid "map buffer too small"
msgstr ""
@@ -2212,6 +2455,14 @@ msgstr ""
msgid "math domain error"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "matrix dimensions do not match"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "matrix is not positive definite"
+msgstr ""
+
#: ports/nrf/common-hal/_bleio/Characteristic.c
#: ports/nrf/common-hal/_bleio/Descriptor.c
#, c-format
@@ -2235,6 +2486,10 @@ msgstr ""
msgid "module not found"
msgstr ""
+#: extmod/ulab/code/poly.c
+msgid "more degrees of freedom than data points"
+msgstr ""
+
#: py/compile.c
msgid "multiple *x in assignment"
msgstr ""
@@ -2259,6 +2514,10 @@ msgstr ""
msgid "must use keyword argument for key function"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "n must be between 0, and 9"
+msgstr ""
+
#: py/runtime.c
msgid "name '%q' is not defined"
msgstr ""
@@ -2345,6 +2604,14 @@ msgstr ""
msgid "not enough arguments for format string"
msgstr ""
+#: extmod/ulab/code/poly.c
+msgid "number of arguments must be 2, or 3"
+msgstr ""
+
+#: extmod/ulab/code/create.c
+msgid "number of points must be at least 2"
+msgstr ""
+
#: py/obj.c
#, c-format
msgid "object '%s' is not a tuple or list"
@@ -2412,6 +2679,18 @@ msgstr ""
msgid "only slices with step=1 (aka None) are supported"
msgstr ""
+#: extmod/ulab/code/ndarray.c extmod/ulab/code/vectorise.c
+msgid "operands could not be broadcast together"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "operation is not implemented on ndarrays"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "operation is not supported for given type"
+msgstr ""
+
#: py/modbuiltins.c
msgid "ord expects a character"
msgstr ""
@@ -2460,6 +2739,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "pop from an empty PulseIn"
msgstr ""
@@ -2487,6 +2767,14 @@ msgstr ""
msgid "queue overflow"
msgstr ""
+#: py/parse.c
+msgid "raw f-strings are not implemented"
+msgstr ""
+
+#: extmod/ulab/code/fft.c
+msgid "real and imaginary parts must be of equal length"
+msgstr ""
+
#: py/builtinimport.c
msgid "relative import"
msgstr ""
@@ -2504,6 +2792,20 @@ msgstr ""
msgid "return expected '%q' but got '%q'"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "rgb_pins[%d] duplicates another pin assignment"
+msgstr ""
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "rgb_pins[%d] is not on the same port as clock"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "right hand side must be an ndarray, or a scalar"
+msgstr ""
+
#: py/objstr.c
msgid "rsplit(None,n)"
msgstr ""
@@ -2526,6 +2828,10 @@ msgstr ""
msgid "script compilation not supported"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "shape must be a 2-tuple"
+msgstr ""
+
#: py/objstr.c
msgid "sign not allowed in string format specifier"
msgstr ""
@@ -2538,6 +2844,10 @@ msgstr ""
msgid "single '}' encountered in format string"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "size is defined for ndarrays only"
+msgstr ""
+
#: shared-bindings/time/__init__.c
msgid "sleep length must be non-negative"
msgstr ""
@@ -2554,6 +2864,10 @@ msgstr ""
msgid "soft reboot\n"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "sort argument must be an ndarray"
+msgstr ""
+
#: py/objstr.c
msgid "start/end indices"
msgstr ""
@@ -2643,12 +2957,16 @@ msgstr ""
msgid "too many arguments provided with the given format"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "too many indices"
+msgstr ""
+
#: py/runtime.c
#, c-format
msgid "too many values to unpack (expected %d)"
msgstr ""
-#: py/objstr.c
+#: extmod/ulab/code/linalg.c py/objstr.c
msgid "tuple index out of range"
msgstr ""
@@ -2662,6 +2980,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
+#: shared-bindings/busio/UART.c
msgid "tx and rx cannot both be None"
msgstr ""
@@ -2779,6 +3098,14 @@ msgstr ""
msgid "window must be <= interval"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "wrong argument type"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "wrong index type"
+msgstr ""
+
#: py/objstr.c
msgid "wrong number of arguments"
msgstr ""
@@ -2787,6 +3114,10 @@ msgstr ""
msgid "wrong number of values to unpack"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "wrong operand type"
+msgstr ""
+
#: shared-module/displayio/Shape.c
msgid "x value out of bounds"
msgstr ""
diff --git a/locale/en_x_pirate.po b/locale/en_x_pirate.po
index 5ff575cdf..c98c0faa7 100644
--- a/locale/en_x_pirate.po
+++ b/locale/en_x_pirate.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-02-05 15:55-0800\n"
+"POT-Creation-Date: 2020-04-15 10:24-0400\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: @sommersoft, @MrCertainly\n"
@@ -55,6 +55,11 @@ msgstr ""
msgid "%%c requires int or char"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "%d address pins and %d rgb pins indicate a height of %d, not %d"
+msgstr ""
+
#: shared-bindings/microcontroller/Pin.c
msgid "%q in use"
msgstr ""
@@ -135,6 +140,10 @@ msgstr ""
msgid "'%s' integer 0x%x does not fit in mask 0x%x"
msgstr ""
+#: py/runtime.c
+msgid "'%s' object cannot assign attribute '%q'"
+msgstr ""
+
#: py/proto.c
msgid "'%s' object does not support '%q'"
msgstr ""
@@ -186,6 +195,10 @@ msgid "'align' requires 1 argument"
msgstr ""
#: py/compile.c
+msgid "'async for' or 'async with' outside async function"
+msgstr ""
+
+#: py/compile.c
msgid "'await' outside function"
msgstr ""
@@ -275,7 +288,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
#: ports/cxd56/common-hal/pulseio/PulseOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
-#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c
+#: ports/nrf/peripherals/nrf/timers.c shared-bindings/pulseio/PWMOut.c
#: shared-module/_pew/PewPew.c
msgid "All timers in use"
msgstr ""
@@ -315,6 +328,10 @@ msgstr ""
msgid "Array values should be single bytes."
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+msgid "At most %d %q may be specified (not %d)"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
@@ -332,6 +349,7 @@ msgstr ""
"t' the REPL t' scuttle.\n"
#: shared-module/displayio/Display.c
+#: shared-module/framebufferio/FramebufferDisplay.c
msgid "Below minimum frame rate"
msgstr ""
@@ -347,7 +365,9 @@ msgstr ""
msgid "Both pins must support hardware interrupts"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness must be 0-1.0"
msgstr ""
@@ -356,6 +376,7 @@ msgid "Brightness must be between 0 and 255"
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness not adjustable"
msgstr ""
@@ -370,10 +391,12 @@ msgid "Buffer incorrect size. Should be %d bytes."
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is not a bytearray."
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is too small"
msgstr ""
@@ -390,6 +413,11 @@ msgstr ""
msgid "Buffer too large and unable to allocate"
msgstr ""
+#: shared-bindings/_bleio/PacketBuffer.c
+#, c-format
+msgid "Buffer too short by %d bytes"
+msgstr ""
+
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
#: ports/nrf/common-hal/displayio/ParallelBus.c
#, c-format
@@ -456,6 +484,10 @@ msgstr ""
msgid "Cannot set value when direction is input."
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Cannot specify RTS or CTS in RS485 mode"
+msgstr ""
+
#: py/objslice.c
msgid "Cannot subclass slice"
msgstr ""
@@ -468,7 +500,7 @@ msgstr ""
msgid "Cannot unambiguously get sizeof scalar"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Cannot vary frequency on a timer that is already in use"
msgstr ""
@@ -529,31 +561,31 @@ msgstr ""
msgid "Could not initialize UART"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not initialize channel"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not initialize timer"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not re-init channel"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not re-init timer"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not restart PWM"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not start PWM"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Could not start interrupt, RX busy"
msgstr ""
@@ -579,11 +611,11 @@ msgstr ""
msgid "Crash into the HardFault_Handler."
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Channel Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Device Init Error"
msgstr ""
@@ -617,11 +649,13 @@ msgid "DigitalInOut not supported on given pin"
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Display must have a 16 bit colorspace."
msgstr ""
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Display rotation must be in 90 degree increments"
msgstr ""
@@ -673,6 +707,10 @@ msgstr ""
msgid "Extended advertisements with scan response not supported."
msgstr ""
+#: extmod/ulab/code/fft.c
+msgid "FFT is defined for ndarrays only"
+msgstr ""
+
#: shared-bindings/ps2io/Ps2.c
msgid "Failed sending command."
msgstr ""
@@ -690,6 +728,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
msgstr ""
@@ -723,7 +762,7 @@ msgstr ""
msgid "Frequency captured is above capability. Capture Paused."
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Frequency must match existing PWMOut using this timer"
msgstr ""
@@ -734,6 +773,7 @@ msgstr ""
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Group already used"
msgstr ""
@@ -741,11 +781,11 @@ msgstr ""
msgid "Group full"
msgstr ""
-#: ports/stm32f4/common-hal/busio/I2C.c ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c
msgid "Hardware busy, try alternative pins"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Hardware in use, try alternative pins"
msgstr ""
@@ -753,7 +793,7 @@ msgstr ""
msgid "I/O operation on closed file"
msgstr ""
-#: ports/stm32f4/common-hal/busio/I2C.c
+#: ports/stm/common-hal/busio/I2C.c
msgid "I2C Init Error"
msgstr ""
@@ -783,7 +823,7 @@ msgstr ""
msgid "Insufficient encryption"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr ""
@@ -792,7 +832,7 @@ msgstr ""
msgid "Invalid %q pin"
msgstr "Avast! %q pin be invalid"
-#: ports/stm32f4/common-hal/analogio/AnalogIn.c
+#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Invalid ADC Unit value"
msgstr ""
@@ -800,11 +840,11 @@ msgstr ""
msgid "Invalid BMP file"
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "Invalid DAC pin supplied"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/stm32f4/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c
msgid "Invalid I2C pin selection"
msgstr ""
@@ -814,16 +854,15 @@ msgstr ""
msgid "Invalid PWM frequency"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm32f4/common-hal/busio/SPI.c
+#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c
msgid "Invalid SPI pin selection"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
msgid "Invalid UART pin selection"
msgstr ""
-#: py/moduerrno.c
+#: py/moduerrno.c shared-module/_protomatter/Protomatter.c
msgid "Invalid argument"
msgstr ""
@@ -831,7 +870,7 @@ msgstr ""
msgid "Invalid bits per value"
msgstr ""
-#: ports/nrf/common-hal/busio/UART.c ports/stm32f4/common-hal/busio/UART.c
+#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
msgid "Invalid buffer size"
msgstr ""
@@ -859,7 +898,7 @@ msgstr ""
msgid "Invalid format chunk size"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Invalid frequency supplied"
msgstr ""
@@ -872,12 +911,13 @@ msgid "Invalid number of bits"
msgstr ""
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
+#: shared-bindings/displayio/FourWire.c
msgid "Invalid phase"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/atmel-samd/common-hal/touchio/TouchIn.c
-#: shared-bindings/pulseio/PWMOut.c
+#: shared-bindings/pulseio/PWMOut.c shared-module/_protomatter/Protomatter.c
msgid "Invalid pin"
msgstr ""
@@ -895,11 +935,15 @@ msgstr "Belay that! Invalid pin for starboard-side channel"
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c
#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c
#: ports/cxd56/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
msgid "Invalid pins"
msgstr ""
+#: ports/stm/common-hal/pulseio/PWMOut.c
+msgid "Invalid pins for PWMOut"
+msgstr ""
+
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
+#: shared-bindings/displayio/FourWire.c
msgid "Invalid polarity"
msgstr ""
@@ -927,7 +971,7 @@ msgstr ""
msgid "Invalid wave file"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Invalid word/bit length"
msgstr ""
@@ -976,7 +1020,7 @@ msgstr ""
msgid "Microphone startup delay must be in range 0.0 to 1.0"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "Missing MISO or MOSI Pin"
msgstr ""
@@ -984,10 +1028,19 @@ msgstr ""
msgid "Must be a %q subclass."
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "Must provide MISO or MOSI pin"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "Must use a multiple of 6 rgb pins, not %d"
+msgstr ""
+
+#: py/parse.c
+msgid "Name too long"
+msgstr ""
+
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Negative step not supported"
msgstr ""
@@ -997,7 +1050,7 @@ msgid "No CCCD for this Characteristic"
msgstr ""
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "No DAC on chip"
msgstr "Shiver me timbers! There be no DAC on this chip"
@@ -1006,23 +1059,23 @@ msgstr "Shiver me timbers! There be no DAC on this chip"
msgid "No DMA channel found"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "No MISO Pin"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "No MOSI Pin"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "No RX pin"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "No TX pin"
msgstr ""
@@ -1051,7 +1104,7 @@ msgstr ""
msgid "No hardware support on pin"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "No more timers available on this pin."
msgstr ""
@@ -1067,6 +1120,10 @@ msgstr ""
msgid "No such file/directory"
msgstr ""
+#: shared-module/_protomatter/Protomatter.c
+msgid "No timer available"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid "Nordic Soft Device failure assertion."
msgstr ""
@@ -1121,7 +1178,8 @@ msgid ""
"PWM frequency not writable when variable_frequency is False on construction."
msgstr ""
-#: ports/stm32f4/common-hal/displayio/ParallelBus.c
+#: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c
+#: ports/stm/common-hal/displayio/ParallelBus.c
msgid "ParallelBus not yet supported"
msgstr ""
@@ -1133,10 +1191,22 @@ msgstr ""
#: ports/cxd56/common-hal/analogio/AnalogIn.c
#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c
#: ports/nrf/common-hal/analogio/AnalogIn.c
-#: ports/stm32f4/common-hal/analogio/AnalogIn.c
+#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Pin does not have ADC capabilities"
msgstr "Belay that! Th' Pin be not ADC capable"
+#: ports/stm/common-hal/pulseio/PulseIn.c
+msgid "Pin number already reserved by EXTI"
+msgstr ""
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid ""
+"Pinout uses %d bytes per element, which consumes more than the ideal %d "
+"bytes. If this cannot be avoided, pass allow_inefficient=True to the "
+"constructor"
+msgstr ""
+
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr ""
@@ -1153,26 +1223,31 @@ msgstr ""
msgid "Press any key to enter the REPL. Use CTRL-D to reload."
msgstr ""
-#: shared-bindings/digitalio/DigitalInOut.c
-msgid "Pull not used when direction is output."
+#: shared-module/_protomatter/Protomatter.c
+#, c-format
+msgid "Protomatter internal error #%d"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PulseIn.c
-msgid "PulseIn not yet supported"
+#: shared-bindings/digitalio/DigitalInOut.c
+msgid "Pull not used when direction is output."
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PulseOut.c
-msgid "PulseOut not yet supported"
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid "PulseOut not supported on this chip"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/stm/common-hal/os/__init__.c
msgid "RNG Init Error"
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "RS485 inversion specified when not in RS485 mode"
+msgstr ""
+
#: ports/cxd56/common-hal/rtc/RTC.c ports/mimxrt10xx/common-hal/rtc/RTC.c
#: ports/nrf/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
@@ -1182,7 +1257,12 @@ msgstr ""
msgid "RTC is not supported on this board"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
+#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+msgid "RTS/CTS/RS485 Not yet supported on this device"
+msgstr ""
+
+#: ports/stm/common-hal/os/__init__.c
msgid "Random number generation error"
msgstr ""
@@ -1222,11 +1302,11 @@ msgstr "Runnin' in safe mode! Nay runnin' saved code.\n"
msgid "SDA or SCL needs a pull up"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Re-initialization error"
msgstr ""
@@ -1243,6 +1323,14 @@ msgstr ""
msgid "Scan already in progess. Stop with stop_scan."
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Selected CTS pin not valid"
+msgstr ""
+
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Selected RTS pin not valid"
+msgstr ""
+
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "Serializer in use"
@@ -1269,10 +1357,14 @@ msgstr ""
msgid "Stream missing readinto() or write() method."
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Supply at least one UART pin"
msgstr ""
+#: ports/stm/common-hal/microcontroller/Processor.c
+msgid "Temperature read timed out"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid ""
"The CircuitPython heap was corrupted because the stack was too small.\n"
@@ -1328,13 +1420,11 @@ msgstr ""
msgid "Too many channels in sample."
msgstr ""
-#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
-#: shared-bindings/displayio/ParallelBus.c
+#: shared-module/displayio/__init__.c
msgid "Too many display busses"
msgstr ""
-#: shared-bindings/displayio/Display.c
-#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-module/displayio/__init__.c
msgid "Too many displays"
msgstr ""
@@ -1346,23 +1436,23 @@ msgstr ""
msgid "Tuple or struct_time argument required"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Buffer allocation error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART De-init error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Re-init error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART write error"
msgstr ""
@@ -1481,6 +1571,10 @@ msgstr ""
msgid "Viper functions don't currently support more than 4 arguments"
msgstr ""
+#: ports/stm/common-hal/microcontroller/Processor.c
+msgid "Voltage read timed out"
+msgstr ""
+
#: main.c
msgid "WARNING: Your code filename has two extensions\n"
msgstr "Blimey! Yer code filename has two extensions\n"
@@ -1541,10 +1635,18 @@ msgstr ""
msgid "addresses is empty"
msgstr ""
+#: extmod/ulab/code/vectorise.c
+msgid "arctan2 is implemented for scalars and ndarrays only"
+msgstr ""
+
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "argsort argument must be an ndarray"
+msgstr ""
+
#: py/runtime.c
msgid "argument has wrong type"
msgstr ""
@@ -1558,14 +1660,34 @@ msgstr ""
msgid "argument should be a '%q' not a '%q'"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "arguments must be ndarrays"
+msgstr ""
+
#: py/objarray.c shared-bindings/nvm/ByteArray.c
msgid "array/bytes required on right side"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "attempt to get argmin/argmax of an empty sequence"
+msgstr ""
+
#: py/objstr.c
msgid "attributes not supported yet"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "axis must be -1, 0, None, or 1"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "axis must be -1, 0, or 1"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "axis must be None, 0, or 1"
+msgstr ""
+
#: py/builtinevex.c
msgid "bad compile mode"
msgstr ""
@@ -1808,6 +1930,10 @@ msgstr ""
msgid "cannot perform relative import"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "cannot reshape array (incompatible input/output shape)"
+msgstr ""
+
#: py/emitnative.c
msgid "casting"
msgstr ""
@@ -1864,6 +1990,30 @@ msgstr ""
msgid "conversion to object"
msgstr ""
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must be linear arrays"
+msgstr ""
+
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must be ndarrays"
+msgstr ""
+
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must not be empty"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "could not broadast input array from shape"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "could not invert Vandermonde matrix"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "ddof must be smaller than length of data set"
+msgstr ""
+
#: py/parsenum.c
msgid "decimal numbers not supported"
msgstr ""
@@ -1889,6 +2039,10 @@ msgstr ""
msgid "dict update sequence has wrong length"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "diff argument must be an ndarray"
+msgstr ""
+
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@@ -1959,6 +2113,26 @@ msgstr ""
msgid "extra positional arguments given"
msgstr ""
+#: py/parse.c
+msgid "f-string expression part cannot include a '#'"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string expression part cannot include a backslash"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: empty expression not allowed"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: expecting '}'"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: single '}' is not allowed"
+msgstr ""
+
#: shared-bindings/audiocore/WaveFile.c shared-bindings/audiomp3/MP3Decoder.c
#: shared-bindings/displayio/OnDiskBitmap.c
msgid "file must be a file opened in byte mode"
@@ -1968,6 +2142,14 @@ msgstr ""
msgid "filesystem must provide mount method"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "first argument must be an iterable"
+msgstr ""
+
+#: extmod/ulab/code/vectorise.c
+msgid "first argument must be an ndarray"
+msgstr ""
+
#: py/objtype.c
msgid "first argument to super() must be type"
msgstr ""
@@ -1976,6 +2158,14 @@ msgstr ""
msgid "firstbit must be MSB"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "flattening order must be either 'C', or 'F'"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "flip argument must be an ndarray"
+msgstr ""
+
#: py/objint.c
msgid "float too big"
msgstr ""
@@ -2068,9 +2258,14 @@ msgstr ""
msgid "incorrect padding"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "index is out of bounds"
+msgstr ""
+
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
-#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c
+#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c
msgid "index out of range"
msgstr ""
@@ -2078,10 +2273,46 @@ msgstr ""
msgid "indices must be integers"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "indices must be integers, slices, or Boolean lists"
+msgstr ""
+
#: py/compile.c
msgid "inline assembler must be a function"
msgstr ""
+#: extmod/ulab/code/create.c
+msgid "input argument must be an integer or a 2-tuple"
+msgstr ""
+
+#: extmod/ulab/code/fft.c
+msgid "input array length must be power of 2"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "input data must be an iterable"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input matrix is asymmetric"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input matrix is singular"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input must be square matrix"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "input must be tuple, list, range, or ndarray"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "input vectors must be of equal length"
+msgstr ""
+
#: py/parsenum.c
msgid "int() arg 2 must be >= 2 and <= 36"
msgstr ""
@@ -2160,6 +2391,14 @@ msgstr ""
msgid "issubclass() arg 2 must be a class or a tuple of classes"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "iterables are not of the same length"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "iterations did not converge"
+msgstr ""
+
#: py/objstr.c
msgid "join expects a list of str/bytes objects consistent with self object"
msgstr ""
@@ -2208,6 +2447,10 @@ msgstr ""
msgid "long int not supported in this build"
msgstr ""
+#: py/parse.c
+msgid "malformed f-string"
+msgstr ""
+
#: shared-bindings/_stage/Layer.c
msgid "map buffer too small"
msgstr ""
@@ -2216,6 +2459,14 @@ msgstr ""
msgid "math domain error"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "matrix dimensions do not match"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "matrix is not positive definite"
+msgstr ""
+
#: ports/nrf/common-hal/_bleio/Characteristic.c
#: ports/nrf/common-hal/_bleio/Descriptor.c
#, c-format
@@ -2239,6 +2490,10 @@ msgstr ""
msgid "module not found"
msgstr ""
+#: extmod/ulab/code/poly.c
+msgid "more degrees of freedom than data points"
+msgstr ""
+
#: py/compile.c
msgid "multiple *x in assignment"
msgstr ""
@@ -2263,6 +2518,10 @@ msgstr ""
msgid "must use keyword argument for key function"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "n must be between 0, and 9"
+msgstr ""
+
#: py/runtime.c
msgid "name '%q' is not defined"
msgstr ""
@@ -2349,6 +2608,14 @@ msgstr ""
msgid "not enough arguments for format string"
msgstr ""
+#: extmod/ulab/code/poly.c
+msgid "number of arguments must be 2, or 3"
+msgstr ""
+
+#: extmod/ulab/code/create.c
+msgid "number of points must be at least 2"
+msgstr ""
+
#: py/obj.c
#, c-format
msgid "object '%s' is not a tuple or list"
@@ -2416,6 +2683,18 @@ msgstr ""
msgid "only slices with step=1 (aka None) are supported"
msgstr ""
+#: extmod/ulab/code/ndarray.c extmod/ulab/code/vectorise.c
+msgid "operands could not be broadcast together"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "operation is not implemented on ndarrays"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "operation is not supported for given type"
+msgstr ""
+
#: py/modbuiltins.c
msgid "ord expects a character"
msgstr ""
@@ -2464,6 +2743,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "pop from an empty PulseIn"
msgstr ""
@@ -2491,6 +2771,14 @@ msgstr ""
msgid "queue overflow"
msgstr ""
+#: py/parse.c
+msgid "raw f-strings are not implemented"
+msgstr ""
+
+#: extmod/ulab/code/fft.c
+msgid "real and imaginary parts must be of equal length"
+msgstr ""
+
#: py/builtinimport.c
msgid "relative import"
msgstr ""
@@ -2508,6 +2796,20 @@ msgstr ""
msgid "return expected '%q' but got '%q'"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "rgb_pins[%d] duplicates another pin assignment"
+msgstr ""
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "rgb_pins[%d] is not on the same port as clock"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "right hand side must be an ndarray, or a scalar"
+msgstr ""
+
#: py/objstr.c
msgid "rsplit(None,n)"
msgstr ""
@@ -2530,6 +2832,10 @@ msgstr ""
msgid "script compilation not supported"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "shape must be a 2-tuple"
+msgstr ""
+
#: py/objstr.c
msgid "sign not allowed in string format specifier"
msgstr ""
@@ -2542,6 +2848,10 @@ msgstr ""
msgid "single '}' encountered in format string"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "size is defined for ndarrays only"
+msgstr ""
+
#: shared-bindings/time/__init__.c
msgid "sleep length must be non-negative"
msgstr ""
@@ -2558,6 +2868,10 @@ msgstr ""
msgid "soft reboot\n"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "sort argument must be an ndarray"
+msgstr ""
+
#: py/objstr.c
msgid "start/end indices"
msgstr ""
@@ -2647,12 +2961,16 @@ msgstr ""
msgid "too many arguments provided with the given format"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "too many indices"
+msgstr ""
+
#: py/runtime.c
#, c-format
msgid "too many values to unpack (expected %d)"
msgstr ""
-#: py/objstr.c
+#: extmod/ulab/code/linalg.c py/objstr.c
msgid "tuple index out of range"
msgstr ""
@@ -2666,6 +2984,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
+#: shared-bindings/busio/UART.c
msgid "tx and rx cannot both be None"
msgstr ""
@@ -2783,6 +3102,14 @@ msgstr ""
msgid "window must be <= interval"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "wrong argument type"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "wrong index type"
+msgstr ""
+
#: py/objstr.c
msgid "wrong number of arguments"
msgstr ""
@@ -2791,6 +3118,10 @@ msgstr ""
msgid "wrong number of values to unpack"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "wrong operand type"
+msgstr ""
+
#: shared-module/displayio/Shape.c
msgid "x value out of bounds"
msgstr ""
diff --git a/locale/es.po b/locale/es.po
index 873c4d3e7..7cf508644 100644
--- a/locale/es.po
+++ b/locale/es.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-02-05 15:55-0800\n"
+"POT-Creation-Date: 2020-04-15 10:24-0400\n"
"PO-Revision-Date: 2018-08-24 22:56-0500\n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -55,6 +55,11 @@ msgstr " salida:\n"
msgid "%%c requires int or char"
msgstr "%%c requiere int o char"
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "%d address pins and %d rgb pins indicate a height of %d, not %d"
+msgstr ""
+
#: shared-bindings/microcontroller/Pin.c
msgid "%q in use"
msgstr "%q está siendo utilizado"
@@ -135,6 +140,10 @@ msgstr "'%s' entero %d no esta dentro del rango %d..%d"
msgid "'%s' integer 0x%x does not fit in mask 0x%x"
msgstr "'%s' entero 0x%x no cabe en la máscara 0x%x"
+#: py/runtime.c
+msgid "'%s' object cannot assign attribute '%q'"
+msgstr ""
+
#: py/proto.c
msgid "'%s' object does not support '%q'"
msgstr ""
@@ -186,6 +195,10 @@ msgid "'align' requires 1 argument"
msgstr "'align' requiere 1 argumento"
#: py/compile.c
+msgid "'async for' or 'async with' outside async function"
+msgstr ""
+
+#: py/compile.c
msgid "'await' outside function"
msgstr "'await' fuera de la función"
@@ -277,7 +290,7 @@ msgstr "Todos los timers para este pin están siendo utilizados"
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
#: ports/cxd56/common-hal/pulseio/PulseOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
-#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c
+#: ports/nrf/peripherals/nrf/timers.c shared-bindings/pulseio/PWMOut.c
#: shared-module/_pew/PewPew.c
msgid "All timers in use"
msgstr "Todos los timers en uso"
@@ -317,6 +330,10 @@ msgstr "Array debe contener media palabra (type 'H')"
msgid "Array values should be single bytes."
msgstr "Valores del array deben ser bytes individuales."
+#: shared-bindings/_protomatter/Protomatter.c
+msgid "At most %d %q may be specified (not %d)"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
@@ -334,6 +351,7 @@ msgstr ""
"ejecutarlos o entra al REPL para desabilitarlos.\n"
#: shared-module/displayio/Display.c
+#: shared-module/framebufferio/FramebufferDisplay.c
msgid "Below minimum frame rate"
msgstr ""
@@ -349,7 +367,9 @@ msgstr "Bits depth debe ser múltiplo de 8."
msgid "Both pins must support hardware interrupts"
msgstr "Ambos pines deben soportar interrupciones por hardware"
+#: shared-bindings/_protomatter/Protomatter.c
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness must be 0-1.0"
msgstr ""
@@ -358,6 +378,7 @@ msgid "Brightness must be between 0 and 255"
msgstr "El brillo debe estar entro 0 y 255"
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness not adjustable"
msgstr "El brillo no se puede ajustar"
@@ -372,10 +393,12 @@ msgid "Buffer incorrect size. Should be %d bytes."
msgstr "Tamaño de buffer incorrecto. Debe ser de %d bytes."
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is not a bytearray."
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is too small"
msgstr ""
@@ -392,6 +415,11 @@ msgstr "Buffer debe ser de longitud 1 como minimo"
msgid "Buffer too large and unable to allocate"
msgstr ""
+#: shared-bindings/_bleio/PacketBuffer.c
+#, c-format
+msgid "Buffer too short by %d bytes"
+msgstr ""
+
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
#: ports/nrf/common-hal/displayio/ParallelBus.c
#, c-format
@@ -458,6 +486,10 @@ msgstr "No se puede reiniciar a bootloader porque no hay bootloader presente."
msgid "Cannot set value when direction is input."
msgstr "No se puede asignar un valor cuando la dirección es input."
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Cannot specify RTS or CTS in RS485 mode"
+msgstr ""
+
#: py/objslice.c
msgid "Cannot subclass slice"
msgstr "Cannot subclass slice"
@@ -470,7 +502,7 @@ msgstr "No se puede transmitir sin pines MOSI y MISO."
msgid "Cannot unambiguously get sizeof scalar"
msgstr "No se puede obtener inequívocamente sizeof escalar"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Cannot vary frequency on a timer that is already in use"
msgstr ""
@@ -531,31 +563,31 @@ msgstr ""
msgid "Could not initialize UART"
msgstr "No se puede inicializar la UART"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not initialize channel"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not initialize timer"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not re-init channel"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not re-init timer"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not restart PWM"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not start PWM"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Could not start interrupt, RX busy"
msgstr ""
@@ -581,11 +613,11 @@ msgstr "No se pudo asignar el segundo buffer"
msgid "Crash into the HardFault_Handler."
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Channel Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Device Init Error"
msgstr ""
@@ -619,11 +651,13 @@ msgid "DigitalInOut not supported on given pin"
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Display must have a 16 bit colorspace."
msgstr ""
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Display rotation must be in 90 degree increments"
msgstr "Rotación de display debe ser en incrementos de 90 grados"
@@ -675,6 +709,10 @@ msgstr "Se esperaba un tuple de %d, se obtuvo %d"
msgid "Extended advertisements with scan response not supported."
msgstr ""
+#: extmod/ulab/code/fft.c
+msgid "FFT is defined for ndarrays only"
+msgstr ""
+
#: shared-bindings/ps2io/Ps2.c
msgid "Failed sending command."
msgstr "Fallo enviando comando"
@@ -692,6 +730,7 @@ msgstr "Ha fallado la asignación del buffer RX"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
msgstr "Falló la asignación del buffer RX de %d bytes"
@@ -725,7 +764,7 @@ msgstr "El archivo ya existe"
msgid "Frequency captured is above capability. Capture Paused."
msgstr "Frecuencia capturada por encima de la capacidad. Captura en pausa."
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Frequency must match existing PWMOut using this timer"
msgstr ""
@@ -736,6 +775,7 @@ msgstr "La función requiere lock"
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Group already used"
msgstr ""
@@ -743,11 +783,11 @@ msgstr ""
msgid "Group full"
msgstr "Group lleno"
-#: ports/stm32f4/common-hal/busio/I2C.c ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c
msgid "Hardware busy, try alternative pins"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Hardware in use, try alternative pins"
msgstr ""
@@ -755,7 +795,7 @@ msgstr ""
msgid "I/O operation on closed file"
msgstr "Operación I/O en archivo cerrado"
-#: ports/stm32f4/common-hal/busio/I2C.c
+#: ports/stm/common-hal/busio/I2C.c
msgid "I2C Init Error"
msgstr ""
@@ -787,7 +827,7 @@ msgstr ""
msgid "Insufficient encryption"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr ""
@@ -796,7 +836,7 @@ msgstr ""
msgid "Invalid %q pin"
msgstr "Pin %q inválido"
-#: ports/stm32f4/common-hal/analogio/AnalogIn.c
+#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Invalid ADC Unit value"
msgstr ""
@@ -804,11 +844,11 @@ msgstr ""
msgid "Invalid BMP file"
msgstr "Archivo BMP inválido"
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "Invalid DAC pin supplied"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/stm32f4/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c
msgid "Invalid I2C pin selection"
msgstr ""
@@ -818,16 +858,15 @@ msgstr ""
msgid "Invalid PWM frequency"
msgstr "Frecuencia PWM inválida"
-#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm32f4/common-hal/busio/SPI.c
+#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c
msgid "Invalid SPI pin selection"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
msgid "Invalid UART pin selection"
msgstr ""
-#: py/moduerrno.c
+#: py/moduerrno.c shared-module/_protomatter/Protomatter.c
msgid "Invalid argument"
msgstr "Argumento inválido"
@@ -835,7 +874,7 @@ msgstr "Argumento inválido"
msgid "Invalid bits per value"
msgstr "Inválido bits por valor"
-#: ports/nrf/common-hal/busio/UART.c ports/stm32f4/common-hal/busio/UART.c
+#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
msgid "Invalid buffer size"
msgstr "Tamaño de buffer inválido"
@@ -863,7 +902,7 @@ msgstr "Archivo inválido"
msgid "Invalid format chunk size"
msgstr "Formato de fragmento de formato no válido"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Invalid frequency supplied"
msgstr ""
@@ -876,12 +915,13 @@ msgid "Invalid number of bits"
msgstr "Numero inválido de bits"
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
+#: shared-bindings/displayio/FourWire.c
msgid "Invalid phase"
msgstr "Fase inválida"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/atmel-samd/common-hal/touchio/TouchIn.c
-#: shared-bindings/pulseio/PWMOut.c
+#: shared-bindings/pulseio/PWMOut.c shared-module/_protomatter/Protomatter.c
msgid "Invalid pin"
msgstr "Pin inválido"
@@ -899,11 +939,15 @@ msgstr "Pin inválido para canal derecho"
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c
#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c
#: ports/cxd56/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
msgid "Invalid pins"
msgstr "pines inválidos"
+#: ports/stm/common-hal/pulseio/PWMOut.c
+msgid "Invalid pins for PWMOut"
+msgstr ""
+
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
+#: shared-bindings/displayio/FourWire.c
msgid "Invalid polarity"
msgstr "Polaridad inválida"
@@ -931,7 +975,7 @@ msgstr "Cuenta de voces inválida"
msgid "Invalid wave file"
msgstr "Archivo wave inválido"
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Invalid word/bit length"
msgstr ""
@@ -980,7 +1024,7 @@ msgstr ""
msgid "Microphone startup delay must be in range 0.0 to 1.0"
msgstr "Micrófono demora de inicio debe estar en el rango 0.0 a 1.0"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "Missing MISO or MOSI Pin"
msgstr ""
@@ -988,10 +1032,19 @@ msgstr ""
msgid "Must be a %q subclass."
msgstr "Debe de ser una subclase de %q"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "Must provide MISO or MOSI pin"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "Must use a multiple of 6 rgb pins, not %d"
+msgstr ""
+
+#: py/parse.c
+msgid "Name too long"
+msgstr ""
+
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Negative step not supported"
msgstr ""
@@ -1001,7 +1054,7 @@ msgid "No CCCD for this Characteristic"
msgstr ""
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "No DAC on chip"
msgstr "El chip no tiene DAC"
@@ -1010,23 +1063,23 @@ msgstr "El chip no tiene DAC"
msgid "No DMA channel found"
msgstr "No se encontró el canal DMA"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "No MISO Pin"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "No MOSI Pin"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "No RX pin"
msgstr "Sin pin RX"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "No TX pin"
msgstr "Sin pin TX"
@@ -1055,7 +1108,7 @@ msgstr "Sin soporte de hardware en el pin clk"
msgid "No hardware support on pin"
msgstr "Sin soporte de hardware en pin"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "No more timers available on this pin."
msgstr ""
@@ -1071,6 +1124,10 @@ msgstr "No queda espacio en el dispositivo"
msgid "No such file/directory"
msgstr "No existe el archivo/directorio"
+#: shared-module/_protomatter/Protomatter.c
+msgid "No timer available"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid "Nordic Soft Device failure assertion."
msgstr ""
@@ -1131,7 +1188,8 @@ msgstr ""
"PWM frecuencia no esta escrito cuando el variable_frequency es falso en "
"construcion"
-#: ports/stm32f4/common-hal/displayio/ParallelBus.c
+#: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c
+#: ports/stm/common-hal/displayio/ParallelBus.c
msgid "ParallelBus not yet supported"
msgstr ""
@@ -1143,10 +1201,22 @@ msgstr "Permiso denegado"
#: ports/cxd56/common-hal/analogio/AnalogIn.c
#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c
#: ports/nrf/common-hal/analogio/AnalogIn.c
-#: ports/stm32f4/common-hal/analogio/AnalogIn.c
+#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Pin does not have ADC capabilities"
msgstr "Pin no tiene capacidad ADC"
+#: ports/stm/common-hal/pulseio/PulseIn.c
+msgid "Pin number already reserved by EXTI"
+msgstr ""
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid ""
+"Pinout uses %d bytes per element, which consumes more than the ideal %d "
+"bytes. If this cannot be avoided, pass allow_inefficient=True to the "
+"constructor"
+msgstr ""
+
#: py/builtinhelp.c
#, fuzzy
msgid "Plus any modules on the filesystem\n"
@@ -1165,26 +1235,31 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload."
msgstr ""
"Presiona cualquier tecla para entrar al REPL. Usa CTRL-D para recargar."
+#: shared-module/_protomatter/Protomatter.c
+#, c-format
+msgid "Protomatter internal error #%d"
+msgstr ""
+
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Pull not used when direction is output."
msgstr "Pull no se usa cuando la dirección es output."
-#: ports/stm32f4/common-hal/pulseio/PulseIn.c
-msgid "PulseIn not yet supported"
-msgstr ""
-
-#: ports/stm32f4/common-hal/pulseio/PulseOut.c
-msgid "PulseOut not yet supported"
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid "PulseOut not supported on this chip"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/stm/common-hal/os/__init__.c
msgid "RNG Init Error"
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "RS485 inversion specified when not in RS485 mode"
+msgstr ""
+
#: ports/cxd56/common-hal/rtc/RTC.c ports/mimxrt10xx/common-hal/rtc/RTC.c
#: ports/nrf/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
@@ -1194,7 +1269,12 @@ msgstr "Calibración de RTC no es soportada en esta placa"
msgid "RTC is not supported on this board"
msgstr "RTC no soportado en esta placa"
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
+#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+msgid "RTS/CTS/RS485 Not yet supported on this device"
+msgstr ""
+
+#: ports/stm/common-hal/os/__init__.c
msgid "Random number generation error"
msgstr ""
@@ -1235,11 +1315,11 @@ msgstr "Ejecutando en modo seguro! No se esta ejecutando el código guardado.\n"
msgid "SDA or SCL needs a pull up"
msgstr "SDA o SCL necesitan una pull up"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Re-initialization error"
msgstr ""
@@ -1256,6 +1336,14 @@ msgstr "Frecuencia de muestreo demasiado alta. Debe ser menor a %d"
msgid "Scan already in progess. Stop with stop_scan."
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Selected CTS pin not valid"
+msgstr ""
+
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Selected RTS pin not valid"
+msgstr ""
+
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "Serializer in use"
@@ -1282,10 +1370,14 @@ msgstr "El tamaño de la pila debe ser de al menos 256"
msgid "Stream missing readinto() or write() method."
msgstr "A Stream le falta el método readinto() o write()."
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Supply at least one UART pin"
msgstr ""
+#: ports/stm/common-hal/microcontroller/Processor.c
+msgid "Temperature read timed out"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid ""
"The CircuitPython heap was corrupted because the stack was too small.\n"
@@ -1341,13 +1433,11 @@ msgstr "Ancho del Tile debe dividir exactamente el ancho de mapa de bits"
msgid "Too many channels in sample."
msgstr "Demasiados canales en sample."
-#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
-#: shared-bindings/displayio/ParallelBus.c
+#: shared-module/displayio/__init__.c
msgid "Too many display busses"
msgstr "Demasiados buses de pantalla"
-#: shared-bindings/displayio/Display.c
-#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-module/displayio/__init__.c
msgid "Too many displays"
msgstr "Muchos displays"
@@ -1359,23 +1449,23 @@ msgstr "Traceback (ultima llamada reciente):\n"
msgid "Tuple or struct_time argument required"
msgstr "Argumento tuple o struct_time requerido"
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Buffer allocation error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART De-init error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Re-init error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART write error"
msgstr ""
@@ -1495,6 +1585,10 @@ msgstr ""
msgid "Viper functions don't currently support more than 4 arguments"
msgstr "funciones Viper actualmente no soportan más de 4 argumentos."
+#: ports/stm/common-hal/microcontroller/Processor.c
+msgid "Voltage read timed out"
+msgstr ""
+
#: main.c
msgid "WARNING: Your code filename has two extensions\n"
msgstr "ADVERTENCIA: El nombre de archivo de tu código tiene dos extensiones\n"
@@ -1561,10 +1655,18 @@ msgstr "address fuera de límites"
msgid "addresses is empty"
msgstr "addresses esta vacío"
+#: extmod/ulab/code/vectorise.c
+msgid "arctan2 is implemented for scalars and ndarrays only"
+msgstr ""
+
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr "argumento es una secuencia vacía"
+#: extmod/ulab/code/numerical.c
+msgid "argsort argument must be an ndarray"
+msgstr ""
+
#: py/runtime.c
msgid "argument has wrong type"
msgstr "el argumento tiene un tipo erroneo"
@@ -1578,14 +1680,34 @@ msgstr "argumento número/tipos no coinciden"
msgid "argument should be a '%q' not a '%q'"
msgstr "argumento deberia ser un '%q' no un '%q'"
+#: extmod/ulab/code/linalg.c
+msgid "arguments must be ndarrays"
+msgstr ""
+
#: py/objarray.c shared-bindings/nvm/ByteArray.c
msgid "array/bytes required on right side"
msgstr "array/bytes requeridos en el lado derecho"
+#: extmod/ulab/code/numerical.c
+msgid "attempt to get argmin/argmax of an empty sequence"
+msgstr ""
+
#: py/objstr.c
msgid "attributes not supported yet"
msgstr "atributos aún no soportados"
+#: extmod/ulab/code/numerical.c
+msgid "axis must be -1, 0, None, or 1"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "axis must be -1, 0, or 1"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "axis must be None, 0, or 1"
+msgstr ""
+
#: py/builtinevex.c
msgid "bad compile mode"
msgstr "modo de compilación erroneo"
@@ -1833,6 +1955,10 @@ msgstr "no se puede importar name '%q'"
msgid "cannot perform relative import"
msgstr "no se puedo realizar importación relativa"
+#: extmod/ulab/code/ndarray.c
+msgid "cannot reshape array (incompatible input/output shape)"
+msgstr ""
+
#: py/emitnative.c
msgid "casting"
msgstr ""
@@ -1889,6 +2015,30 @@ msgstr "constant debe ser un entero"
msgid "conversion to object"
msgstr "conversión a objeto"
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must be linear arrays"
+msgstr ""
+
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must be ndarrays"
+msgstr ""
+
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must not be empty"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "could not broadast input array from shape"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "could not invert Vandermonde matrix"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "ddof must be smaller than length of data set"
+msgstr ""
+
#: py/parsenum.c
msgid "decimal numbers not supported"
msgstr "números decimales no soportados"
@@ -1916,6 +2066,10 @@ msgstr "destination_length debe ser un int >= 0"
msgid "dict update sequence has wrong length"
msgstr "la secuencia de actualizacion del dict tiene una longitud incorrecta"
+#: extmod/ulab/code/numerical.c
+msgid "diff argument must be an ndarray"
+msgstr ""
+
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@@ -1986,6 +2140,26 @@ msgstr "argumento(s) por palabra clave adicionales fueron dados"
msgid "extra positional arguments given"
msgstr "argumento posicional adicional dado"
+#: py/parse.c
+msgid "f-string expression part cannot include a '#'"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string expression part cannot include a backslash"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: empty expression not allowed"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: expecting '}'"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: single '}' is not allowed"
+msgstr ""
+
#: shared-bindings/audiocore/WaveFile.c shared-bindings/audiomp3/MP3Decoder.c
#: shared-bindings/displayio/OnDiskBitmap.c
msgid "file must be a file opened in byte mode"
@@ -1995,6 +2169,14 @@ msgstr "el archivo deberia ser una archivo abierto en modo byte"
msgid "filesystem must provide mount method"
msgstr "sistema de archivos debe proporcionar método de montaje"
+#: extmod/ulab/code/ndarray.c
+msgid "first argument must be an iterable"
+msgstr ""
+
+#: extmod/ulab/code/vectorise.c
+msgid "first argument must be an ndarray"
+msgstr ""
+
#: py/objtype.c
msgid "first argument to super() must be type"
msgstr "primer argumento para super() debe ser de tipo"
@@ -2003,6 +2185,14 @@ msgstr "primer argumento para super() debe ser de tipo"
msgid "firstbit must be MSB"
msgstr "firstbit debe ser MSB"
+#: extmod/ulab/code/ndarray.c
+msgid "flattening order must be either 'C', or 'F'"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "flip argument must be an ndarray"
+msgstr ""
+
#: py/objint.c
msgid "float too big"
msgstr ""
@@ -2095,9 +2285,14 @@ msgstr ""
msgid "incorrect padding"
msgstr "relleno (padding) incorrecto"
+#: extmod/ulab/code/ndarray.c
+msgid "index is out of bounds"
+msgstr ""
+
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
-#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c
+#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c
msgid "index out of range"
msgstr "index fuera de rango"
@@ -2105,10 +2300,46 @@ msgstr "index fuera de rango"
msgid "indices must be integers"
msgstr "indices deben ser enteros"
+#: extmod/ulab/code/ndarray.c
+msgid "indices must be integers, slices, or Boolean lists"
+msgstr ""
+
#: py/compile.c
msgid "inline assembler must be a function"
msgstr "ensamblador en línea debe ser una función"
+#: extmod/ulab/code/create.c
+msgid "input argument must be an integer or a 2-tuple"
+msgstr ""
+
+#: extmod/ulab/code/fft.c
+msgid "input array length must be power of 2"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "input data must be an iterable"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input matrix is asymmetric"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input matrix is singular"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input must be square matrix"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "input must be tuple, list, range, or ndarray"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "input vectors must be of equal length"
+msgstr ""
+
#: py/parsenum.c
msgid "int() arg 2 must be >= 2 and <= 36"
msgstr "int() arg 2 debe ser >= 2 y <= 36"
@@ -2187,6 +2418,14 @@ msgstr "issubclass() arg 1 debe ser una clase"
msgid "issubclass() arg 2 must be a class or a tuple of classes"
msgstr "issubclass() arg 2 debe ser una clase o tuple de clases"
+#: extmod/ulab/code/ndarray.c
+msgid "iterables are not of the same length"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "iterations did not converge"
+msgstr ""
+
#: py/objstr.c
msgid "join expects a list of str/bytes objects consistent with self object"
msgstr ""
@@ -2238,6 +2477,10 @@ msgstr "variable local referenciada antes de la asignación"
msgid "long int not supported in this build"
msgstr "long int no soportado en esta compilación"
+#: py/parse.c
+msgid "malformed f-string"
+msgstr ""
+
#: shared-bindings/_stage/Layer.c
msgid "map buffer too small"
msgstr "map buffer muy pequeño"
@@ -2246,6 +2489,14 @@ msgstr "map buffer muy pequeño"
msgid "math domain error"
msgstr "error de dominio matemático"
+#: extmod/ulab/code/linalg.c
+msgid "matrix dimensions do not match"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "matrix is not positive definite"
+msgstr ""
+
#: ports/nrf/common-hal/_bleio/Characteristic.c
#: ports/nrf/common-hal/_bleio/Descriptor.c
#, c-format
@@ -2269,6 +2520,10 @@ msgstr "la asignación de memoria falló, el heap está bloqueado"
msgid "module not found"
msgstr "módulo no encontrado"
+#: extmod/ulab/code/poly.c
+msgid "more degrees of freedom than data points"
+msgstr ""
+
#: py/compile.c
msgid "multiple *x in assignment"
msgstr "múltiples *x en la asignación"
@@ -2293,6 +2548,10 @@ msgstr "se deben de especificar sck/mosi/miso"
msgid "must use keyword argument for key function"
msgstr "debe utilizar argumento de palabra clave para la función clave"
+#: extmod/ulab/code/numerical.c
+msgid "n must be between 0, and 9"
+msgstr ""
+
#: py/runtime.c
msgid "name '%q' is not defined"
msgstr "name '%q' no esta definido"
@@ -2382,6 +2641,14 @@ msgstr ""
msgid "not enough arguments for format string"
msgstr "no suficientes argumentos para format string"
+#: extmod/ulab/code/poly.c
+msgid "number of arguments must be 2, or 3"
+msgstr ""
+
+#: extmod/ulab/code/create.c
+msgid "number of points must be at least 2"
+msgstr ""
+
#: py/obj.c
#, c-format
msgid "object '%s' is not a tuple or list"
@@ -2450,6 +2717,18 @@ msgstr ""
msgid "only slices with step=1 (aka None) are supported"
msgstr "solo se admiten segmentos con step=1 (alias None)"
+#: extmod/ulab/code/ndarray.c extmod/ulab/code/vectorise.c
+msgid "operands could not be broadcast together"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "operation is not implemented on ndarrays"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "operation is not supported for given type"
+msgstr ""
+
#: py/modbuiltins.c
msgid "ord expects a character"
msgstr "ord espera un carácter"
@@ -2498,6 +2777,7 @@ msgstr "pixel_shader debe ser displayio.Palette o displayio.ColorConverter"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "pop from an empty PulseIn"
msgstr "pop de un PulseIn vacío"
@@ -2525,6 +2805,14 @@ msgstr "pow() con 3 argumentos requiere enteros"
msgid "queue overflow"
msgstr "desbordamiento de cola(queue)"
+#: py/parse.c
+msgid "raw f-strings are not implemented"
+msgstr ""
+
+#: extmod/ulab/code/fft.c
+msgid "real and imaginary parts must be of equal length"
+msgstr ""
+
#: py/builtinimport.c
msgid "relative import"
msgstr "import relativo"
@@ -2542,6 +2830,20 @@ msgstr "la anotación de retorno debe ser un identificador"
msgid "return expected '%q' but got '%q'"
msgstr "retorno esperado '%q' pero se obtuvo '%q'"
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "rgb_pins[%d] duplicates another pin assignment"
+msgstr ""
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "rgb_pins[%d] is not on the same port as clock"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "right hand side must be an ndarray, or a scalar"
+msgstr ""
+
#: py/objstr.c
msgid "rsplit(None,n)"
msgstr "rsplit(None,n)"
@@ -2566,6 +2868,10 @@ msgstr ""
msgid "script compilation not supported"
msgstr "script de compilación no soportado"
+#: extmod/ulab/code/ndarray.c
+msgid "shape must be a 2-tuple"
+msgstr ""
+
#: py/objstr.c
msgid "sign not allowed in string format specifier"
msgstr "signo no permitido en el espeficador de string format"
@@ -2578,6 +2884,10 @@ msgstr "signo no permitido con el especificador integer format 'c'"
msgid "single '}' encountered in format string"
msgstr "un solo '}' encontrado en format string"
+#: extmod/ulab/code/linalg.c
+msgid "size is defined for ndarrays only"
+msgstr ""
+
#: shared-bindings/time/__init__.c
msgid "sleep length must be non-negative"
msgstr "la longitud de sleep no puede ser negativa"
@@ -2594,6 +2904,10 @@ msgstr "pequeño int desbordamiento"
msgid "soft reboot\n"
msgstr "reinicio suave\n"
+#: extmod/ulab/code/numerical.c
+msgid "sort argument must be an ndarray"
+msgstr ""
+
#: py/objstr.c
msgid "start/end indices"
msgstr "índices inicio/final"
@@ -2684,12 +2998,16 @@ msgstr "timestamp fuera de rango para plataform time_t"
msgid "too many arguments provided with the given format"
msgstr "demasiados argumentos provistos con el formato dado"
+#: extmod/ulab/code/ndarray.c
+msgid "too many indices"
+msgstr ""
+
#: py/runtime.c
#, c-format
msgid "too many values to unpack (expected %d)"
msgstr "demasiados valores para descomprimir (%d esperado)"
-#: py/objstr.c
+#: extmod/ulab/code/linalg.c py/objstr.c
msgid "tuple index out of range"
msgstr "tuple index fuera de rango"
@@ -2703,6 +3021,7 @@ msgstr "tuple/lista se require en RHS"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
+#: shared-bindings/busio/UART.c
msgid "tx and rx cannot both be None"
msgstr "Ambos tx y rx no pueden ser None"
@@ -2820,6 +3139,14 @@ msgstr ""
msgid "window must be <= interval"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "wrong argument type"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "wrong index type"
+msgstr ""
+
#: py/objstr.c
msgid "wrong number of arguments"
msgstr "numero erroneo de argumentos"
@@ -2828,6 +3155,10 @@ msgstr "numero erroneo de argumentos"
msgid "wrong number of values to unpack"
msgstr "numero erroneo de valores a descomprimir"
+#: extmod/ulab/code/ndarray.c
+msgid "wrong operand type"
+msgstr ""
+
#: shared-module/displayio/Shape.c
#, fuzzy
msgid "x value out of bounds"
diff --git a/locale/fil.po b/locale/fil.po
index 63feb3316..3b6fee038 100644
--- a/locale/fil.po
+++ b/locale/fil.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-02-05 15:55-0800\n"
+"POT-Creation-Date: 2020-04-15 10:24-0400\n"
"PO-Revision-Date: 2018-12-20 22:15-0800\n"
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
"Language-Team: fil\n"
@@ -53,6 +53,11 @@ msgstr " output:\n"
msgid "%%c requires int or char"
msgstr "%%c nangangailangan ng int o char"
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "%d address pins and %d rgb pins indicate a height of %d, not %d"
+msgstr ""
+
#: shared-bindings/microcontroller/Pin.c
msgid "%q in use"
msgstr "%q ay ginagamit"
@@ -136,6 +141,10 @@ msgstr "'%s' integer %d ay wala sa sakop ng %d..%d"
msgid "'%s' integer 0x%x does not fit in mask 0x%x"
msgstr "'%s' integer 0x%x ay wala sa mask na sakop ng 0x%x"
+#: py/runtime.c
+msgid "'%s' object cannot assign attribute '%q'"
+msgstr ""
+
#: py/proto.c
msgid "'%s' object does not support '%q'"
msgstr ""
@@ -187,6 +196,10 @@ msgid "'align' requires 1 argument"
msgstr "'align' kailangan ng 1 argument"
#: py/compile.c
+msgid "'async for' or 'async with' outside async function"
+msgstr ""
+
+#: py/compile.c
msgid "'await' outside function"
msgstr "'await' sa labas ng function"
@@ -277,7 +290,7 @@ msgstr "Lahat ng timers para sa pin na ito ay ginagamit"
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
#: ports/cxd56/common-hal/pulseio/PulseOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
-#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c
+#: ports/nrf/peripherals/nrf/timers.c shared-bindings/pulseio/PWMOut.c
#: shared-module/_pew/PewPew.c
msgid "All timers in use"
msgstr "Lahat ng timer ginagamit"
@@ -317,6 +330,10 @@ msgstr "May halfwords (type 'H') dapat ang array"
msgid "Array values should be single bytes."
msgstr "Array values ay dapat single bytes."
+#: shared-bindings/_protomatter/Protomatter.c
+msgid "At most %d %q may be specified (not %d)"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
@@ -334,6 +351,7 @@ msgstr ""
"para patakbuhin sila o pasukin ang REPL para i-disable ito.\n"
#: shared-module/displayio/Display.c
+#: shared-module/framebufferio/FramebufferDisplay.c
msgid "Below minimum frame rate"
msgstr ""
@@ -349,7 +367,9 @@ msgstr "Bit depth ay dapat multiple ng 8."
msgid "Both pins must support hardware interrupts"
msgstr "Ang parehong mga pin ay dapat na sumusuporta sa hardware interrupts"
+#: shared-bindings/_protomatter/Protomatter.c
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness must be 0-1.0"
msgstr ""
@@ -358,6 +378,7 @@ msgid "Brightness must be between 0 and 255"
msgstr "Ang liwanag ay dapat sa gitna ng 0 o 255"
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness not adjustable"
msgstr ""
@@ -372,10 +393,12 @@ msgid "Buffer incorrect size. Should be %d bytes."
msgstr "Mali ang size ng buffer. Dapat %d bytes."
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is not a bytearray."
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is too small"
msgstr ""
@@ -392,6 +415,11 @@ msgstr "Buffer dapat ay hindi baba sa 1 na haba"
msgid "Buffer too large and unable to allocate"
msgstr ""
+#: shared-bindings/_bleio/PacketBuffer.c
+#, c-format
+msgid "Buffer too short by %d bytes"
+msgstr ""
+
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
#: ports/nrf/common-hal/displayio/ParallelBus.c
#, fuzzy, c-format
@@ -460,6 +488,10 @@ msgstr "Hindi ma-reset sa bootloader dahil walang bootloader."
msgid "Cannot set value when direction is input."
msgstr "Hindi ma i-set ang value kapag ang direksyon ay input."
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Cannot specify RTS or CTS in RS485 mode"
+msgstr ""
+
#: py/objslice.c
msgid "Cannot subclass slice"
msgstr "Hindi magawa ang sublcass slice"
@@ -472,7 +504,7 @@ msgstr "Hindi maaaring ilipat kapag walang MOSI at MISO pin."
msgid "Cannot unambiguously get sizeof scalar"
msgstr "Hindi puedeng hindi sigurado ang get sizeof scalar"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Cannot vary frequency on a timer that is already in use"
msgstr ""
@@ -534,31 +566,31 @@ msgstr ""
msgid "Could not initialize UART"
msgstr "Hindi ma-initialize ang UART"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not initialize channel"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not initialize timer"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not re-init channel"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not re-init timer"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not restart PWM"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not start PWM"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Could not start interrupt, RX busy"
msgstr ""
@@ -584,11 +616,11 @@ msgstr "Hindi ma-iallocate ang second buffer"
msgid "Crash into the HardFault_Handler."
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Channel Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Device Init Error"
msgstr ""
@@ -625,11 +657,13 @@ msgid "DigitalInOut not supported on given pin"
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Display must have a 16 bit colorspace."
msgstr ""
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Display rotation must be in 90 degree increments"
msgstr ""
@@ -683,6 +717,10 @@ msgstr ""
msgid "Extended advertisements with scan response not supported."
msgstr ""
+#: extmod/ulab/code/fft.c
+msgid "FFT is defined for ndarrays only"
+msgstr ""
+
#: shared-bindings/ps2io/Ps2.c
msgid "Failed sending command."
msgstr ""
@@ -700,6 +738,7 @@ msgstr "Nabigong ilaan ang RX buffer"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
msgstr "Nabigong ilaan ang RX buffer ng %d bytes"
@@ -733,7 +772,7 @@ msgstr "Mayroong file"
msgid "Frequency captured is above capability. Capture Paused."
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Frequency must match existing PWMOut using this timer"
msgstr ""
@@ -744,6 +783,7 @@ msgstr "Function nangangailangan ng lock"
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Group already used"
msgstr ""
@@ -751,11 +791,11 @@ msgstr ""
msgid "Group full"
msgstr "Puno ang group"
-#: ports/stm32f4/common-hal/busio/I2C.c ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c
msgid "Hardware busy, try alternative pins"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Hardware in use, try alternative pins"
msgstr ""
@@ -763,7 +803,7 @@ msgstr ""
msgid "I/O operation on closed file"
msgstr "I/O operasyon sa saradong file"
-#: ports/stm32f4/common-hal/busio/I2C.c
+#: ports/stm/common-hal/busio/I2C.c
msgid "I2C Init Error"
msgstr ""
@@ -795,7 +835,7 @@ msgstr ""
msgid "Insufficient encryption"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr ""
@@ -804,7 +844,7 @@ msgstr ""
msgid "Invalid %q pin"
msgstr "Mali ang %q pin"
-#: ports/stm32f4/common-hal/analogio/AnalogIn.c
+#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Invalid ADC Unit value"
msgstr ""
@@ -812,11 +852,11 @@ msgstr ""
msgid "Invalid BMP file"
msgstr "Mali ang BMP file"
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "Invalid DAC pin supplied"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/stm32f4/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c
msgid "Invalid I2C pin selection"
msgstr ""
@@ -826,16 +866,15 @@ msgstr ""
msgid "Invalid PWM frequency"
msgstr "Mali ang PWM frequency"
-#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm32f4/common-hal/busio/SPI.c
+#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c
msgid "Invalid SPI pin selection"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
msgid "Invalid UART pin selection"
msgstr ""
-#: py/moduerrno.c
+#: py/moduerrno.c shared-module/_protomatter/Protomatter.c
msgid "Invalid argument"
msgstr "Maling argumento"
@@ -843,7 +882,7 @@ msgstr "Maling argumento"
msgid "Invalid bits per value"
msgstr ""
-#: ports/nrf/common-hal/busio/UART.c ports/stm32f4/common-hal/busio/UART.c
+#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
msgid "Invalid buffer size"
msgstr "Mali ang buffer size"
@@ -871,7 +910,7 @@ msgstr "Mali ang file"
msgid "Invalid format chunk size"
msgstr "Mali ang format ng chunk size"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Invalid frequency supplied"
msgstr ""
@@ -884,12 +923,13 @@ msgid "Invalid number of bits"
msgstr "Mali ang bilang ng bits"
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
+#: shared-bindings/displayio/FourWire.c
msgid "Invalid phase"
msgstr "Mali ang phase"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/atmel-samd/common-hal/touchio/TouchIn.c
-#: shared-bindings/pulseio/PWMOut.c
+#: shared-bindings/pulseio/PWMOut.c shared-module/_protomatter/Protomatter.c
msgid "Invalid pin"
msgstr "Mali ang pin"
@@ -907,11 +947,15 @@ msgstr "Mali ang pin para sa kanang channel"
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c
#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c
#: ports/cxd56/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
msgid "Invalid pins"
msgstr "Mali ang pins"
+#: ports/stm/common-hal/pulseio/PWMOut.c
+msgid "Invalid pins for PWMOut"
+msgstr ""
+
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
+#: shared-bindings/displayio/FourWire.c
msgid "Invalid polarity"
msgstr "Mali ang polarity"
@@ -939,7 +983,7 @@ msgstr "Maling bilang ng voice"
msgid "Invalid wave file"
msgstr "May hindi tama sa wave file"
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Invalid word/bit length"
msgstr ""
@@ -988,7 +1032,7 @@ msgstr ""
msgid "Microphone startup delay must be in range 0.0 to 1.0"
msgstr "Ang delay ng startup ng mikropono ay dapat na nasa 0.0 hanggang 1.0"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "Missing MISO or MOSI Pin"
msgstr ""
@@ -996,10 +1040,19 @@ msgstr ""
msgid "Must be a %q subclass."
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "Must provide MISO or MOSI pin"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "Must use a multiple of 6 rgb pins, not %d"
+msgstr ""
+
+#: py/parse.c
+msgid "Name too long"
+msgstr ""
+
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Negative step not supported"
msgstr ""
@@ -1009,7 +1062,7 @@ msgid "No CCCD for this Characteristic"
msgstr ""
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "No DAC on chip"
msgstr "Walang DAC sa chip"
@@ -1018,23 +1071,23 @@ msgstr "Walang DAC sa chip"
msgid "No DMA channel found"
msgstr "Walang DMA channel na mahanap"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "No MISO Pin"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "No MOSI Pin"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "No RX pin"
msgstr "Walang RX pin"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "No TX pin"
msgstr "Walang TX pin"
@@ -1063,7 +1116,7 @@ msgstr ""
msgid "No hardware support on pin"
msgstr "Walang support sa hardware ang pin"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "No more timers available on this pin."
msgstr ""
@@ -1079,6 +1132,10 @@ msgstr ""
msgid "No such file/directory"
msgstr "Walang file/directory"
+#: shared-module/_protomatter/Protomatter.c
+msgid "No timer available"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid "Nordic Soft Device failure assertion."
msgstr ""
@@ -1137,7 +1194,8 @@ msgid ""
msgstr ""
"PWM frequency hindi writable kapag variable_frequency ay False sa pag buo."
-#: ports/stm32f4/common-hal/displayio/ParallelBus.c
+#: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c
+#: ports/stm/common-hal/displayio/ParallelBus.c
msgid "ParallelBus not yet supported"
msgstr ""
@@ -1149,10 +1207,22 @@ msgstr "Walang pahintulot"
#: ports/cxd56/common-hal/analogio/AnalogIn.c
#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c
#: ports/nrf/common-hal/analogio/AnalogIn.c
-#: ports/stm32f4/common-hal/analogio/AnalogIn.c
+#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Pin does not have ADC capabilities"
msgstr "Ang pin ay walang kakayahan sa ADC"
+#: ports/stm/common-hal/pulseio/PulseIn.c
+msgid "Pin number already reserved by EXTI"
+msgstr ""
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid ""
+"Pinout uses %d bytes per element, which consumes more than the ideal %d "
+"bytes. If this cannot be avoided, pass allow_inefficient=True to the "
+"constructor"
+msgstr ""
+
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr "Kasama ang kung ano pang modules na sa filesystem\n"
@@ -1171,26 +1241,31 @@ msgstr ""
"Pindutin ang anumang key upang pumasok sa REPL. Gamitin ang CTRL-D upang i-"
"reload."
+#: shared-module/_protomatter/Protomatter.c
+#, c-format
+msgid "Protomatter internal error #%d"
+msgstr ""
+
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Pull not used when direction is output."
msgstr "Pull hindi ginagamit kapag ang direksyon ay output."
-#: ports/stm32f4/common-hal/pulseio/PulseIn.c
-msgid "PulseIn not yet supported"
-msgstr ""
-
-#: ports/stm32f4/common-hal/pulseio/PulseOut.c
-msgid "PulseOut not yet supported"
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid "PulseOut not supported on this chip"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/stm/common-hal/os/__init__.c
msgid "RNG Init Error"
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "RS485 inversion specified when not in RS485 mode"
+msgstr ""
+
#: ports/cxd56/common-hal/rtc/RTC.c ports/mimxrt10xx/common-hal/rtc/RTC.c
#: ports/nrf/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
@@ -1200,7 +1275,12 @@ msgstr "RTC calibration ay hindi supportado ng board na ito"
msgid "RTC is not supported on this board"
msgstr "Hindi supportado ang RTC sa board na ito"
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
+#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+msgid "RTS/CTS/RS485 Not yet supported on this device"
+msgstr ""
+
+#: ports/stm/common-hal/os/__init__.c
msgid "Random number generation error"
msgstr ""
@@ -1241,11 +1321,11 @@ msgstr "Tumatakbo sa safe mode! Hindi tumatakbo ang nai-save na code.\n"
msgid "SDA or SCL needs a pull up"
msgstr "Kailangan ng pull up resistors ang SDA o SCL"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Re-initialization error"
msgstr ""
@@ -1262,6 +1342,14 @@ msgstr "Sample rate ay masyadong mataas. Ito ay dapat hindi hiigit sa %d"
msgid "Scan already in progess. Stop with stop_scan."
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Selected CTS pin not valid"
+msgstr ""
+
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Selected RTS pin not valid"
+msgstr ""
+
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "Serializer in use"
@@ -1288,10 +1376,14 @@ msgstr "Ang laki ng stack ay dapat na hindi bababa sa 256"
msgid "Stream missing readinto() or write() method."
msgstr "Stream kulang ng readinto() o write() method."
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Supply at least one UART pin"
msgstr ""
+#: ports/stm/common-hal/microcontroller/Processor.c
+msgid "Temperature read timed out"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid ""
"The CircuitPython heap was corrupted because the stack was too small.\n"
@@ -1347,13 +1439,11 @@ msgstr ""
msgid "Too many channels in sample."
msgstr "Sobra ang channels sa sample."
-#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
-#: shared-bindings/displayio/ParallelBus.c
+#: shared-module/displayio/__init__.c
msgid "Too many display busses"
msgstr ""
-#: shared-bindings/displayio/Display.c
-#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-module/displayio/__init__.c
msgid "Too many displays"
msgstr ""
@@ -1365,23 +1455,23 @@ msgstr "Traceback (pinakahuling huling tawag): \n"
msgid "Tuple or struct_time argument required"
msgstr "Tuple o struct_time argument kailangan"
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Buffer allocation error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART De-init error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Re-init error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART write error"
msgstr ""
@@ -1504,6 +1594,10 @@ msgstr ""
"Ang mga function ng Viper ay kasalukuyang hindi sumusuporta sa higit sa 4 na "
"argumento"
+#: ports/stm/common-hal/microcontroller/Processor.c
+msgid "Voltage read timed out"
+msgstr ""
+
#: main.c
msgid "WARNING: Your code filename has two extensions\n"
msgstr "BABALA: Ang pangalan ng file ay may dalawang extension\n"
@@ -1570,10 +1664,18 @@ msgstr "wala sa sakop ang address"
msgid "addresses is empty"
msgstr "walang laman ang address"
+#: extmod/ulab/code/vectorise.c
+msgid "arctan2 is implemented for scalars and ndarrays only"
+msgstr ""
+
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr "arg ay walang laman na sequence"
+#: extmod/ulab/code/numerical.c
+msgid "argsort argument must be an ndarray"
+msgstr ""
+
#: py/runtime.c
msgid "argument has wrong type"
msgstr "may maling type ang argument"
@@ -1587,14 +1689,34 @@ msgstr "hindi tugma ang argument num/types"
msgid "argument should be a '%q' not a '%q'"
msgstr "argument ay dapat na '%q' hindi '%q'"
+#: extmod/ulab/code/linalg.c
+msgid "arguments must be ndarrays"
+msgstr ""
+
#: py/objarray.c shared-bindings/nvm/ByteArray.c
msgid "array/bytes required on right side"
msgstr "array/bytes kinakailangan sa kanang bahagi"
+#: extmod/ulab/code/numerical.c
+msgid "attempt to get argmin/argmax of an empty sequence"
+msgstr ""
+
#: py/objstr.c
msgid "attributes not supported yet"
msgstr "attributes hindi sinusuportahan"
+#: extmod/ulab/code/numerical.c
+msgid "axis must be -1, 0, None, or 1"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "axis must be -1, 0, or 1"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "axis must be None, 0, or 1"
+msgstr ""
+
#: py/builtinevex.c
msgid "bad compile mode"
msgstr "masamang mode ng compile"
@@ -1844,6 +1966,10 @@ msgstr "hindi ma-import ang name %q"
msgid "cannot perform relative import"
msgstr "hindi maaring isagawa ang relative import"
+#: extmod/ulab/code/ndarray.c
+msgid "cannot reshape array (incompatible input/output shape)"
+msgstr ""
+
#: py/emitnative.c
msgid "casting"
msgstr "casting"
@@ -1900,6 +2026,30 @@ msgstr "constant ay dapat na integer"
msgid "conversion to object"
msgstr "kombersyon to object"
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must be linear arrays"
+msgstr ""
+
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must be ndarrays"
+msgstr ""
+
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must not be empty"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "could not broadast input array from shape"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "could not invert Vandermonde matrix"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "ddof must be smaller than length of data set"
+msgstr ""
+
#: py/parsenum.c
msgid "decimal numbers not supported"
msgstr "decimal numbers hindi sinusuportahan"
@@ -1929,6 +2079,10 @@ msgstr "ang destination_length ay dapat na isang int >= 0"
msgid "dict update sequence has wrong length"
msgstr "may mali sa haba ng dict update sequence"
+#: extmod/ulab/code/numerical.c
+msgid "diff argument must be an ndarray"
+msgstr ""
+
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@@ -2000,6 +2154,26 @@ msgstr "dagdag na keyword argument na ibinigay"
msgid "extra positional arguments given"
msgstr "dagdag na positional argument na ibinigay"
+#: py/parse.c
+msgid "f-string expression part cannot include a '#'"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string expression part cannot include a backslash"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: empty expression not allowed"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: expecting '}'"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: single '}' is not allowed"
+msgstr ""
+
#: shared-bindings/audiocore/WaveFile.c shared-bindings/audiomp3/MP3Decoder.c
#: shared-bindings/displayio/OnDiskBitmap.c
msgid "file must be a file opened in byte mode"
@@ -2009,6 +2183,14 @@ msgstr "file ay dapat buksan sa byte mode"
msgid "filesystem must provide mount method"
msgstr "ang filesystem dapat mag bigay ng mount method"
+#: extmod/ulab/code/ndarray.c
+msgid "first argument must be an iterable"
+msgstr ""
+
+#: extmod/ulab/code/vectorise.c
+msgid "first argument must be an ndarray"
+msgstr ""
+
#: py/objtype.c
msgid "first argument to super() must be type"
msgstr "unang argument ng super() ay dapat type"
@@ -2017,6 +2199,14 @@ msgstr "unang argument ng super() ay dapat type"
msgid "firstbit must be MSB"
msgstr "firstbit ay dapat MSB"
+#: extmod/ulab/code/ndarray.c
+msgid "flattening order must be either 'C', or 'F'"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "flip argument must be an ndarray"
+msgstr ""
+
#: py/objint.c
msgid "float too big"
msgstr "masyadong malaki ang float"
@@ -2110,9 +2300,14 @@ msgstr "hindi kumpleto ang format key"
msgid "incorrect padding"
msgstr "mali ang padding"
+#: extmod/ulab/code/ndarray.c
+msgid "index is out of bounds"
+msgstr ""
+
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
-#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c
+#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c
msgid "index out of range"
msgstr "index wala sa sakop"
@@ -2120,10 +2315,46 @@ msgstr "index wala sa sakop"
msgid "indices must be integers"
msgstr "ang mga indeks ay dapat na integer"
+#: extmod/ulab/code/ndarray.c
+msgid "indices must be integers, slices, or Boolean lists"
+msgstr ""
+
#: py/compile.c
msgid "inline assembler must be a function"
msgstr "inline assembler ay dapat na function"
+#: extmod/ulab/code/create.c
+msgid "input argument must be an integer or a 2-tuple"
+msgstr ""
+
+#: extmod/ulab/code/fft.c
+msgid "input array length must be power of 2"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "input data must be an iterable"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input matrix is asymmetric"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input matrix is singular"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input must be square matrix"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "input must be tuple, list, range, or ndarray"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "input vectors must be of equal length"
+msgstr ""
+
#: py/parsenum.c
msgid "int() arg 2 must be >= 2 and <= 36"
msgstr "int() arg 2 ay dapat >=2 at <= 36"
@@ -2202,6 +2433,14 @@ msgstr "issubclass() arg 1 ay dapat na class"
msgid "issubclass() arg 2 must be a class or a tuple of classes"
msgstr "issubclass() arg 2 ay dapat na class o tuple ng classes"
+#: extmod/ulab/code/ndarray.c
+msgid "iterables are not of the same length"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "iterations did not converge"
+msgstr ""
+
#: py/objstr.c
msgid "join expects a list of str/bytes objects consistent with self object"
msgstr ""
@@ -2254,6 +2493,10 @@ msgstr "local variable na reference bago na i-assign"
msgid "long int not supported in this build"
msgstr "long int hindi sinusuportahan sa build na ito"
+#: py/parse.c
+msgid "malformed f-string"
+msgstr ""
+
#: shared-bindings/_stage/Layer.c
msgid "map buffer too small"
msgstr "masyadong maliit ang buffer map"
@@ -2262,6 +2505,14 @@ msgstr "masyadong maliit ang buffer map"
msgid "math domain error"
msgstr "may pagkakamali sa math domain"
+#: extmod/ulab/code/linalg.c
+msgid "matrix dimensions do not match"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "matrix is not positive definite"
+msgstr ""
+
#: ports/nrf/common-hal/_bleio/Characteristic.c
#: ports/nrf/common-hal/_bleio/Descriptor.c
#, c-format
@@ -2285,6 +2536,10 @@ msgstr "abigo ang paglalaan ng memorya, ang heap ay naka-lock"
msgid "module not found"
msgstr "module hindi nakita"
+#: extmod/ulab/code/poly.c
+msgid "more degrees of freedom than data points"
+msgstr ""
+
#: py/compile.c
msgid "multiple *x in assignment"
msgstr "maramihang *x sa assignment"
@@ -2309,6 +2564,10 @@ msgstr "dapat tukuyin lahat ng SCK/MOSI/MISO"
msgid "must use keyword argument for key function"
msgstr "dapat gumamit ng keyword argument para sa key function"
+#: extmod/ulab/code/numerical.c
+msgid "n must be between 0, and 9"
+msgstr ""
+
#: py/runtime.c
msgid "name '%q' is not defined"
msgstr "name '%q' ay hindi defined"
@@ -2395,6 +2654,14 @@ msgstr "hindi lahat ng arguments na i-convert habang string formatting"
msgid "not enough arguments for format string"
msgstr "kulang sa arguments para sa format string"
+#: extmod/ulab/code/poly.c
+msgid "number of arguments must be 2, or 3"
+msgstr ""
+
+#: extmod/ulab/code/create.c
+msgid "number of points must be at least 2"
+msgstr ""
+
#: py/obj.c
#, c-format
msgid "object '%s' is not a tuple or list"
@@ -2463,6 +2730,18 @@ msgstr ""
msgid "only slices with step=1 (aka None) are supported"
msgstr "ang mga slices lamang na may hakbang = 1 (aka None) ang sinusuportahan"
+#: extmod/ulab/code/ndarray.c extmod/ulab/code/vectorise.c
+msgid "operands could not be broadcast together"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "operation is not implemented on ndarrays"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "operation is not supported for given type"
+msgstr ""
+
#: py/modbuiltins.c
msgid "ord expects a character"
msgstr "ord umaasa ng character"
@@ -2512,6 +2791,7 @@ msgstr "pixel_shader ay dapat displayio.Palette o displayio.ColorConverter"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "pop from an empty PulseIn"
msgstr "pop mula sa walang laman na PulseIn"
@@ -2539,6 +2819,14 @@ msgstr "pow() na may 3 argumento kailangan ng integers"
msgid "queue overflow"
msgstr "puno na ang pila (overflow)"
+#: py/parse.c
+msgid "raw f-strings are not implemented"
+msgstr ""
+
+#: extmod/ulab/code/fft.c
+msgid "real and imaginary parts must be of equal length"
+msgstr ""
+
#: py/builtinimport.c
msgid "relative import"
msgstr "relative import"
@@ -2556,6 +2844,20 @@ msgstr "return annotation ay dapat na identifier"
msgid "return expected '%q' but got '%q'"
msgstr "return umasa ng '%q' pero ang nakuha ay ‘%q’"
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "rgb_pins[%d] duplicates another pin assignment"
+msgstr ""
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "rgb_pins[%d] is not on the same port as clock"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "right hand side must be an ndarray, or a scalar"
+msgstr ""
+
#: py/objstr.c
msgid "rsplit(None,n)"
msgstr "rsplit(None,n)"
@@ -2580,6 +2882,10 @@ msgstr "puno na ang schedule stack"
msgid "script compilation not supported"
msgstr "script kompilasyon hindi supportado"
+#: extmod/ulab/code/ndarray.c
+msgid "shape must be a 2-tuple"
+msgstr ""
+
#: py/objstr.c
msgid "sign not allowed in string format specifier"
msgstr "sign hindi maaring string format specifier"
@@ -2592,6 +2898,10 @@ msgstr "sign hindi maari sa integer format specifier 'c'"
msgid "single '}' encountered in format string"
msgstr "isang '}' nasalubong sa format string"
+#: extmod/ulab/code/linalg.c
+msgid "size is defined for ndarrays only"
+msgstr ""
+
#: shared-bindings/time/__init__.c
msgid "sleep length must be non-negative"
msgstr "sleep length ay dapat hindi negatibo"
@@ -2608,6 +2918,10 @@ msgstr "small int overflow"
msgid "soft reboot\n"
msgstr "malambot na reboot\n"
+#: extmod/ulab/code/numerical.c
+msgid "sort argument must be an ndarray"
+msgstr ""
+
#: py/objstr.c
msgid "start/end indices"
msgstr "start/end indeks"
@@ -2699,12 +3013,16 @@ msgstr "wala sa sakop ng timestamp ang platform time_t"
msgid "too many arguments provided with the given format"
msgstr "masyadong maraming mga argumento na ibinigay sa ibinigay na format"
+#: extmod/ulab/code/ndarray.c
+msgid "too many indices"
+msgstr ""
+
#: py/runtime.c
#, c-format
msgid "too many values to unpack (expected %d)"
msgstr "masyadong maraming values para i-unpact (umaasa ng %d)"
-#: py/objstr.c
+#: extmod/ulab/code/linalg.c py/objstr.c
msgid "tuple index out of range"
msgstr "indeks ng tuple wala sa sakop"
@@ -2718,6 +3036,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
+#: shared-bindings/busio/UART.c
msgid "tx and rx cannot both be None"
msgstr "tx at rx hindi pwedeng parehas na None"
@@ -2835,6 +3154,14 @@ msgstr ""
msgid "window must be <= interval"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "wrong argument type"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "wrong index type"
+msgstr ""
+
#: py/objstr.c
msgid "wrong number of arguments"
msgstr "mali ang bilang ng argumento"
@@ -2843,6 +3170,10 @@ msgstr "mali ang bilang ng argumento"
msgid "wrong number of values to unpack"
msgstr "maling number ng value na i-unpack"
+#: extmod/ulab/code/ndarray.c
+msgid "wrong operand type"
+msgstr ""
+
#: shared-module/displayio/Shape.c
#, fuzzy
msgid "x value out of bounds"
diff --git a/locale/fr.po b/locale/fr.po
index ba1d56211..64c78b57a 100644
--- a/locale/fr.po
+++ b/locale/fr.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-02-05 15:55-0800\n"
+"POT-Creation-Date: 2020-04-15 10:24-0400\n"
"PO-Revision-Date: 2019-04-14 20:05+0100\n"
"Last-Translator: Pierrick Couturier <arofarn@arofarn.info>\n"
"Language-Team: fr\n"
@@ -55,6 +55,11 @@ msgstr " sortie:\n"
msgid "%%c requires int or char"
msgstr "%%c nécessite un entier 'int' ou un caractère 'char'"
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "%d address pins and %d rgb pins indicate a height of %d, not %d"
+msgstr ""
+
#: shared-bindings/microcontroller/Pin.c
msgid "%q in use"
msgstr "%q utilisé"
@@ -137,6 +142,10 @@ msgstr "'%s' l'entier %d n'est pas dans la gamme %d..%d"
msgid "'%s' integer 0x%x does not fit in mask 0x%x"
msgstr "'%s' l'entier 0x%x ne correspond pas au masque 0x%x"
+#: py/runtime.c
+msgid "'%s' object cannot assign attribute '%q'"
+msgstr ""
+
#: py/proto.c
msgid "'%s' object does not support '%q'"
msgstr ""
@@ -188,6 +197,10 @@ msgid "'align' requires 1 argument"
msgstr "'align' nécessite 1 argument"
#: py/compile.c
+msgid "'async for' or 'async with' outside async function"
+msgstr ""
+
+#: py/compile.c
msgid "'await' outside function"
msgstr "'await' en dehors d'une fonction"
@@ -280,7 +293,7 @@ msgstr "Tous les timers pour cette broche sont utilisés"
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
#: ports/cxd56/common-hal/pulseio/PulseOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
-#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c
+#: ports/nrf/peripherals/nrf/timers.c shared-bindings/pulseio/PWMOut.c
#: shared-module/_pew/PewPew.c
msgid "All timers in use"
msgstr "Tous les timers sont utilisés"
@@ -321,6 +334,10 @@ msgstr "Le tableau doit contenir des demi-mots (type 'H')"
msgid "Array values should be single bytes."
msgstr "Les valeurs du tableau doivent être des octets simples 'bytes'."
+#: shared-bindings/_protomatter/Protomatter.c
+msgid "At most %d %q may be specified (not %d)"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
@@ -338,6 +355,7 @@ msgstr ""
"lancer ou entrez sur REPL pour le désactiver.\n"
#: shared-module/displayio/Display.c
+#: shared-module/framebufferio/FramebufferDisplay.c
msgid "Below minimum frame rate"
msgstr ""
@@ -353,7 +371,9 @@ msgstr "La profondeur de bit doit être un multiple de 8."
msgid "Both pins must support hardware interrupts"
msgstr "Les deux entrées doivent supporter les interruptions matérielles"
+#: shared-bindings/_protomatter/Protomatter.c
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness must be 0-1.0"
msgstr ""
@@ -362,6 +382,7 @@ msgid "Brightness must be between 0 and 255"
msgstr "La luminosité doit être entre 0 et 255"
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness not adjustable"
msgstr "Luminosité non-ajustable"
@@ -376,10 +397,12 @@ msgid "Buffer incorrect size. Should be %d bytes."
msgstr "Tampon de taille incorrect. Devrait être de %d octets."
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is not a bytearray."
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is too small"
msgstr ""
@@ -396,6 +419,11 @@ msgstr "Le tampon doit être de longueur au moins 1"
msgid "Buffer too large and unable to allocate"
msgstr ""
+#: shared-bindings/_bleio/PacketBuffer.c
+#, c-format
+msgid "Buffer too short by %d bytes"
+msgstr ""
+
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
#: ports/nrf/common-hal/displayio/ParallelBus.c
#, fuzzy, c-format
@@ -465,6 +493,10 @@ msgstr ""
msgid "Cannot set value when direction is input."
msgstr "Impossible d'affecter une valeur quand la direction est 'input'."
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Cannot specify RTS or CTS in RS485 mode"
+msgstr ""
+
#: py/objslice.c
msgid "Cannot subclass slice"
msgstr "On ne peut faire de sous-classes de tranches"
@@ -477,7 +509,7 @@ msgstr "Pas de transfert sans broches MOSI et MISO."
msgid "Cannot unambiguously get sizeof scalar"
msgstr "Impossible d'obtenir la taille du scalaire sans ambigüité"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Cannot vary frequency on a timer that is already in use"
msgstr ""
@@ -539,31 +571,31 @@ msgstr ""
msgid "Could not initialize UART"
msgstr "L'UART n'a pu être initialisé"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not initialize channel"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not initialize timer"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not re-init channel"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not re-init timer"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not restart PWM"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not start PWM"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Could not start interrupt, RX busy"
msgstr ""
@@ -589,11 +621,11 @@ msgstr "Impossible d'allouer le 2e tampon"
msgid "Crash into the HardFault_Handler."
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Channel Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Device Init Error"
msgstr ""
@@ -628,11 +660,13 @@ msgid "DigitalInOut not supported on given pin"
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Display must have a 16 bit colorspace."
msgstr ""
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Display rotation must be in 90 degree increments"
msgstr "La rotation d'affichage doit se faire par incréments de 90 degrés"
@@ -686,6 +720,10 @@ msgstr "Tuple de longueur %d attendu, obtenu %d"
msgid "Extended advertisements with scan response not supported."
msgstr ""
+#: extmod/ulab/code/fft.c
+msgid "FFT is defined for ndarrays only"
+msgstr ""
+
#: shared-bindings/ps2io/Ps2.c
msgid "Failed sending command."
msgstr ""
@@ -703,6 +741,7 @@ msgstr "Echec de l'allocation du tampon RX"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
msgstr "Echec de l'allocation de %d octets du tampon RX"
@@ -736,7 +775,7 @@ msgstr "Le fichier existe"
msgid "Frequency captured is above capability. Capture Paused."
msgstr "La fréquence capturée est au delà des capacités. Capture en pause."
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Frequency must match existing PWMOut using this timer"
msgstr ""
@@ -747,6 +786,7 @@ msgstr "La fonction nécessite un verrou"
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Group already used"
msgstr ""
@@ -754,11 +794,11 @@ msgstr ""
msgid "Group full"
msgstr "Groupe plein"
-#: ports/stm32f4/common-hal/busio/I2C.c ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c
msgid "Hardware busy, try alternative pins"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Hardware in use, try alternative pins"
msgstr ""
@@ -766,7 +806,7 @@ msgstr ""
msgid "I/O operation on closed file"
msgstr "opération d'E/S sur un fichier fermé"
-#: ports/stm32f4/common-hal/busio/I2C.c
+#: ports/stm/common-hal/busio/I2C.c
msgid "I2C Init Error"
msgstr ""
@@ -798,7 +838,7 @@ msgstr ""
msgid "Insufficient encryption"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr ""
@@ -807,7 +847,7 @@ msgstr ""
msgid "Invalid %q pin"
msgstr "Broche invalide pour '%q'"
-#: ports/stm32f4/common-hal/analogio/AnalogIn.c
+#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Invalid ADC Unit value"
msgstr ""
@@ -816,11 +856,11 @@ msgstr ""
msgid "Invalid BMP file"
msgstr "Fichier BMP invalide"
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "Invalid DAC pin supplied"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/stm32f4/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c
msgid "Invalid I2C pin selection"
msgstr ""
@@ -830,16 +870,15 @@ msgstr ""
msgid "Invalid PWM frequency"
msgstr "Fréquence de PWM invalide"
-#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm32f4/common-hal/busio/SPI.c
+#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c
msgid "Invalid SPI pin selection"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
msgid "Invalid UART pin selection"
msgstr ""
-#: py/moduerrno.c
+#: py/moduerrno.c shared-module/_protomatter/Protomatter.c
msgid "Invalid argument"
msgstr "Argument invalide"
@@ -847,7 +886,7 @@ msgstr "Argument invalide"
msgid "Invalid bits per value"
msgstr "Bits par valeur invalides"
-#: ports/nrf/common-hal/busio/UART.c ports/stm32f4/common-hal/busio/UART.c
+#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
#, fuzzy
msgid "Invalid buffer size"
msgstr "Longueur de tampon invalide"
@@ -877,7 +916,7 @@ msgstr "Fichier invalide"
msgid "Invalid format chunk size"
msgstr "Taille de bloc de formatage invalide"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Invalid frequency supplied"
msgstr ""
@@ -890,12 +929,13 @@ msgid "Invalid number of bits"
msgstr "Nombre de bits invalide"
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
+#: shared-bindings/displayio/FourWire.c
msgid "Invalid phase"
msgstr "Phase invalide"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/atmel-samd/common-hal/touchio/TouchIn.c
-#: shared-bindings/pulseio/PWMOut.c
+#: shared-bindings/pulseio/PWMOut.c shared-module/_protomatter/Protomatter.c
msgid "Invalid pin"
msgstr "Broche invalide"
@@ -913,11 +953,15 @@ msgstr "Broche invalide pour le canal droit"
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c
#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c
#: ports/cxd56/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
msgid "Invalid pins"
msgstr "Broches invalides"
+#: ports/stm/common-hal/pulseio/PWMOut.c
+msgid "Invalid pins for PWMOut"
+msgstr ""
+
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
+#: shared-bindings/displayio/FourWire.c
msgid "Invalid polarity"
msgstr "Polarité invalide"
@@ -946,7 +990,7 @@ msgstr "Nombre de voix invalide"
msgid "Invalid wave file"
msgstr "Fichier WAVE invalide"
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Invalid word/bit length"
msgstr ""
@@ -995,7 +1039,7 @@ msgstr ""
msgid "Microphone startup delay must be in range 0.0 to 1.0"
msgstr "Le délais au démarrage du micro doit être entre 0.0 et 1.0"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "Missing MISO or MOSI Pin"
msgstr ""
@@ -1003,10 +1047,19 @@ msgstr ""
msgid "Must be a %q subclass."
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "Must provide MISO or MOSI pin"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "Must use a multiple of 6 rgb pins, not %d"
+msgstr ""
+
+#: py/parse.c
+msgid "Name too long"
+msgstr ""
+
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Negative step not supported"
msgstr ""
@@ -1016,7 +1069,7 @@ msgid "No CCCD for this Characteristic"
msgstr ""
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "No DAC on chip"
msgstr "Pas de DAC sur la puce"
@@ -1025,23 +1078,23 @@ msgstr "Pas de DAC sur la puce"
msgid "No DMA channel found"
msgstr "Aucun canal DMA trouvé"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "No MISO Pin"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "No MOSI Pin"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "No RX pin"
msgstr "Pas de broche RX"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "No TX pin"
msgstr "Pas de broche TX"
@@ -1070,7 +1123,7 @@ msgstr ""
msgid "No hardware support on pin"
msgstr "Pas de support matériel pour cette broche"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "No more timers available on this pin."
msgstr ""
@@ -1086,6 +1139,10 @@ msgstr "Il n'y a plus d'espace libre sur le périphérique"
msgid "No such file/directory"
msgstr "Fichier/dossier introuvable"
+#: shared-module/_protomatter/Protomatter.c
+msgid "No timer available"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid "Nordic Soft Device failure assertion."
msgstr ""
@@ -1151,7 +1208,8 @@ msgstr ""
"La fréquence de PWM n'est pas modifiable quand variable_frequency est False "
"à la construction."
-#: ports/stm32f4/common-hal/displayio/ParallelBus.c
+#: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c
+#: ports/stm/common-hal/displayio/ParallelBus.c
msgid "ParallelBus not yet supported"
msgstr ""
@@ -1163,10 +1221,22 @@ msgstr "Permission refusée"
#: ports/cxd56/common-hal/analogio/AnalogIn.c
#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c
#: ports/nrf/common-hal/analogio/AnalogIn.c
-#: ports/stm32f4/common-hal/analogio/AnalogIn.c
+#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Pin does not have ADC capabilities"
msgstr "La broche ne peut être utilisée pour l'ADC"
+#: ports/stm/common-hal/pulseio/PulseIn.c
+msgid "Pin number already reserved by EXTI"
+msgstr ""
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid ""
+"Pinout uses %d bytes per element, which consumes more than the ideal %d "
+"bytes. If this cannot be avoided, pass allow_inefficient=True to the "
+"constructor"
+msgstr ""
+
#: py/builtinhelp.c
#, fuzzy
msgid "Plus any modules on the filesystem\n"
@@ -1184,26 +1254,31 @@ msgstr ""
msgid "Press any key to enter the REPL. Use CTRL-D to reload."
msgstr "Appuyez sur une touche pour entrer sur REPL ou CTRL-D pour recharger."
+#: shared-module/_protomatter/Protomatter.c
+#, c-format
+msgid "Protomatter internal error #%d"
+msgstr ""
+
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Pull not used when direction is output."
msgstr "Le tirage 'pull' n'est pas utilisé quand la direction est 'output'."
-#: ports/stm32f4/common-hal/pulseio/PulseIn.c
-msgid "PulseIn not yet supported"
-msgstr ""
-
-#: ports/stm32f4/common-hal/pulseio/PulseOut.c
-msgid "PulseOut not yet supported"
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid "PulseOut not supported on this chip"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/stm/common-hal/os/__init__.c
msgid "RNG Init Error"
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "RS485 inversion specified when not in RS485 mode"
+msgstr ""
+
#: ports/cxd56/common-hal/rtc/RTC.c ports/mimxrt10xx/common-hal/rtc/RTC.c
#: ports/nrf/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
@@ -1213,7 +1288,12 @@ msgstr "étalonnage de la RTC non supportée sur cette carte"
msgid "RTC is not supported on this board"
msgstr "RTC non supportée sur cette carte"
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
+#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+msgid "RTS/CTS/RS485 Not yet supported on this device"
+msgstr ""
+
+#: ports/stm/common-hal/os/__init__.c
msgid "Random number generation error"
msgstr ""
@@ -1254,11 +1334,11 @@ msgstr "Mode sans-échec! Le code sauvegardé n'est pas éxecuté.\n"
msgid "SDA or SCL needs a pull up"
msgstr "SDA ou SCL a besoin d'une résistance de tirage ('pull up')"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Re-initialization error"
msgstr ""
@@ -1276,6 +1356,14 @@ msgstr "Taux d'échantillonage trop élevé. Doit être inf. à %d"
msgid "Scan already in progess. Stop with stop_scan."
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Selected CTS pin not valid"
+msgstr ""
+
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Selected RTS pin not valid"
+msgstr ""
+
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "Serializer in use"
@@ -1302,10 +1390,14 @@ msgstr "La pile doit être au moins de 256"
msgid "Stream missing readinto() or write() method."
msgstr "Il manque une méthode readinto() ou write() au flux."
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Supply at least one UART pin"
msgstr ""
+#: ports/stm/common-hal/microcontroller/Processor.c
+msgid "Temperature read timed out"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid ""
"The CircuitPython heap was corrupted because the stack was too small.\n"
@@ -1362,13 +1454,11 @@ msgstr "La largeur de la tuile doit diviser exactement la largeur de l'image"
msgid "Too many channels in sample."
msgstr "Trop de canaux dans l'échantillon."
-#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
-#: shared-bindings/displayio/ParallelBus.c
+#: shared-module/displayio/__init__.c
msgid "Too many display busses"
msgstr "Trop de bus d'affichage"
-#: shared-bindings/displayio/Display.c
-#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-module/displayio/__init__.c
msgid "Too many displays"
msgstr "Trop d'affichages"
@@ -1380,23 +1470,23 @@ msgstr "Trace (appels les plus récents en dernier):\n"
msgid "Tuple or struct_time argument required"
msgstr "Argument de type tuple ou struct_time nécessaire"
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Buffer allocation error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART De-init error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Re-init error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART write error"
msgstr ""
@@ -1522,6 +1612,10 @@ msgid "Viper functions don't currently support more than 4 arguments"
msgstr ""
"les fonctions de Viper ne supportent pas plus de 4 arguments actuellement"
+#: ports/stm/common-hal/microcontroller/Processor.c
+msgid "Voltage read timed out"
+msgstr ""
+
#: main.c
msgid "WARNING: Your code filename has two extensions\n"
msgstr "ATTENTION: le nom de fichier de votre code a deux extensions\n"
@@ -1587,10 +1681,18 @@ msgstr "adresse hors limites"
msgid "addresses is empty"
msgstr "adresses vides"
+#: extmod/ulab/code/vectorise.c
+msgid "arctan2 is implemented for scalars and ndarrays only"
+msgstr ""
+
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr "l'argument est une séquence vide"
+#: extmod/ulab/code/numerical.c
+msgid "argsort argument must be an ndarray"
+msgstr ""
+
#: py/runtime.c
msgid "argument has wrong type"
msgstr "l'argument est d'un mauvais type"
@@ -1604,14 +1706,34 @@ msgstr "argument num/types ne correspond pas"
msgid "argument should be a '%q' not a '%q'"
msgstr "l'argument devrait être un(e) '%q', pas '%q'"
+#: extmod/ulab/code/linalg.c
+msgid "arguments must be ndarrays"
+msgstr ""
+
#: py/objarray.c shared-bindings/nvm/ByteArray.c
msgid "array/bytes required on right side"
msgstr "tableau/octets requis à droite"
+#: extmod/ulab/code/numerical.c
+msgid "attempt to get argmin/argmax of an empty sequence"
+msgstr ""
+
#: py/objstr.c
msgid "attributes not supported yet"
msgstr "attribut pas encore supporté"
+#: extmod/ulab/code/numerical.c
+msgid "axis must be -1, 0, None, or 1"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "axis must be -1, 0, or 1"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "axis must be None, 0, or 1"
+msgstr ""
+
#: py/builtinevex.c
msgid "bad compile mode"
msgstr "mauvais mode de compilation"
@@ -1867,6 +1989,10 @@ msgstr "ne peut pas importer le nom %q"
msgid "cannot perform relative import"
msgstr "ne peut pas réaliser un import relatif"
+#: extmod/ulab/code/ndarray.c
+msgid "cannot reshape array (incompatible input/output shape)"
+msgstr ""
+
#: py/emitnative.c
msgid "casting"
msgstr "typage"
@@ -1927,6 +2053,30 @@ msgstr "constante doit être un entier"
msgid "conversion to object"
msgstr "conversion en objet"
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must be linear arrays"
+msgstr ""
+
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must be ndarrays"
+msgstr ""
+
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must not be empty"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "could not broadast input array from shape"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "could not invert Vandermonde matrix"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "ddof must be smaller than length of data set"
+msgstr ""
+
#: py/parsenum.c
msgid "decimal numbers not supported"
msgstr "nombres décimaux non supportés"
@@ -1954,6 +2104,10 @@ msgstr "destination_length doit être un entier >= 0"
msgid "dict update sequence has wrong length"
msgstr "la séquence de mise à jour de dict a une mauvaise longueur"
+#: extmod/ulab/code/numerical.c
+msgid "diff argument must be an ndarray"
+msgstr ""
+
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@@ -2025,6 +2179,26 @@ msgstr "argument(s) nommé(s) supplémentaire(s) donné(s)"
msgid "extra positional arguments given"
msgstr "argument(s) positionnel(s) supplémentaire(s) donné(s)"
+#: py/parse.c
+msgid "f-string expression part cannot include a '#'"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string expression part cannot include a backslash"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: empty expression not allowed"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: expecting '}'"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: single '}' is not allowed"
+msgstr ""
+
#: shared-bindings/audiocore/WaveFile.c shared-bindings/audiomp3/MP3Decoder.c
#: shared-bindings/displayio/OnDiskBitmap.c
msgid "file must be a file opened in byte mode"
@@ -2034,6 +2208,14 @@ msgstr "le fichier doit être un fichier ouvert en mode 'byte'"
msgid "filesystem must provide mount method"
msgstr "le system de fichier doit fournir une méthode 'mount'"
+#: extmod/ulab/code/ndarray.c
+msgid "first argument must be an iterable"
+msgstr ""
+
+#: extmod/ulab/code/vectorise.c
+msgid "first argument must be an ndarray"
+msgstr ""
+
#: py/objtype.c
msgid "first argument to super() must be type"
msgstr "le premier argument de super() doit être un type"
@@ -2042,6 +2224,14 @@ msgstr "le premier argument de super() doit être un type"
msgid "firstbit must be MSB"
msgstr "le 1er bit doit être le MSB"
+#: extmod/ulab/code/ndarray.c
+msgid "flattening order must be either 'C', or 'F'"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "flip argument must be an ndarray"
+msgstr ""
+
#: py/objint.c
msgid "float too big"
msgstr "nombre à virgule flottante trop grand"
@@ -2134,9 +2324,14 @@ msgstr "clé de format incomplète"
msgid "incorrect padding"
msgstr "espacement incorrect"
+#: extmod/ulab/code/ndarray.c
+msgid "index is out of bounds"
+msgstr ""
+
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
-#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c
+#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c
msgid "index out of range"
msgstr "index hors gamme"
@@ -2144,10 +2339,46 @@ msgstr "index hors gamme"
msgid "indices must be integers"
msgstr "les indices doivent être des entiers"
+#: extmod/ulab/code/ndarray.c
+msgid "indices must be integers, slices, or Boolean lists"
+msgstr ""
+
#: py/compile.c
msgid "inline assembler must be a function"
msgstr "l'assembleur doit être une fonction"
+#: extmod/ulab/code/create.c
+msgid "input argument must be an integer or a 2-tuple"
+msgstr ""
+
+#: extmod/ulab/code/fft.c
+msgid "input array length must be power of 2"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "input data must be an iterable"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input matrix is asymmetric"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input matrix is singular"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input must be square matrix"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "input must be tuple, list, range, or ndarray"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "input vectors must be of equal length"
+msgstr ""
+
#: py/parsenum.c
msgid "int() arg 2 must be >= 2 and <= 36"
msgstr "l'argument 2 de int() doit être >=2 et <=36"
@@ -2227,6 +2458,14 @@ msgid "issubclass() arg 2 must be a class or a tuple of classes"
msgstr ""
"l'argument 2 de issubclass() doit être une classe ou un tuple de classes"
+#: extmod/ulab/code/ndarray.c
+msgid "iterables are not of the same length"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "iterations did not converge"
+msgstr ""
+
#: py/objstr.c
msgid "join expects a list of str/bytes objects consistent with self object"
msgstr ""
@@ -2278,6 +2517,10 @@ msgstr "variable locale référencée avant d'être assignée"
msgid "long int not supported in this build"
msgstr "entiers longs non supportés dans cette build"
+#: py/parse.c
+msgid "malformed f-string"
+msgstr ""
+
#: shared-bindings/_stage/Layer.c
msgid "map buffer too small"
msgstr "tampon trop petit"
@@ -2286,6 +2529,14 @@ msgstr "tampon trop petit"
msgid "math domain error"
msgstr "erreur de domaine math"
+#: extmod/ulab/code/linalg.c
+msgid "matrix dimensions do not match"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "matrix is not positive definite"
+msgstr ""
+
#: ports/nrf/common-hal/_bleio/Characteristic.c
#: ports/nrf/common-hal/_bleio/Descriptor.c
#, c-format
@@ -2309,6 +2560,10 @@ msgstr "l'allocation de mémoire a échoué, le tas est vérrouillé"
msgid "module not found"
msgstr "module introuvable"
+#: extmod/ulab/code/poly.c
+msgid "more degrees of freedom than data points"
+msgstr ""
+
#: py/compile.c
msgid "multiple *x in assignment"
msgstr "*x multiple dans l'assignement"
@@ -2333,6 +2588,10 @@ msgstr "sck, mosi et miso doivent tous être spécifiés"
msgid "must use keyword argument for key function"
msgstr "doit utiliser un argument nommé pour une fonction key"
+#: extmod/ulab/code/numerical.c
+msgid "n must be between 0, and 9"
+msgstr ""
+
#: py/runtime.c
msgid "name '%q' is not defined"
msgstr "nom '%q' non défini"
@@ -2422,6 +2681,14 @@ msgstr ""
msgid "not enough arguments for format string"
msgstr "pas assez d'arguments pour la chaîne de format"
+#: extmod/ulab/code/poly.c
+msgid "number of arguments must be 2, or 3"
+msgstr ""
+
+#: extmod/ulab/code/create.c
+msgid "number of points must be at least 2"
+msgstr ""
+
#: py/obj.c
#, c-format
msgid "object '%s' is not a tuple or list"
@@ -2490,6 +2757,18 @@ msgstr ""
msgid "only slices with step=1 (aka None) are supported"
msgstr "seules les tranches avec 'step=1' (cad None) sont supportées"
+#: extmod/ulab/code/ndarray.c extmod/ulab/code/vectorise.c
+msgid "operands could not be broadcast together"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "operation is not implemented on ndarrays"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "operation is not supported for given type"
+msgstr ""
+
#: py/modbuiltins.c
msgid "ord expects a character"
msgstr "ord attend un caractère"
@@ -2544,6 +2823,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "pop from an empty PulseIn"
msgstr "'pop' d'une entrée PulseIn vide"
@@ -2571,6 +2851,14 @@ msgstr "pow() avec 3 arguments nécessite des entiers"
msgid "queue overflow"
msgstr "dépassement de file"
+#: py/parse.c
+msgid "raw f-strings are not implemented"
+msgstr ""
+
+#: extmod/ulab/code/fft.c
+msgid "real and imaginary parts must be of equal length"
+msgstr ""
+
#: py/builtinimport.c
msgid "relative import"
msgstr "import relatif"
@@ -2588,6 +2876,20 @@ msgstr "l'annotation de return doit être un identifiant"
msgid "return expected '%q' but got '%q'"
msgstr "return attendait '%q' mais a reçu '%q'"
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "rgb_pins[%d] duplicates another pin assignment"
+msgstr ""
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "rgb_pins[%d] is not on the same port as clock"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "right hand side must be an ndarray, or a scalar"
+msgstr ""
+
#: py/objstr.c
msgid "rsplit(None,n)"
msgstr ""
@@ -2612,6 +2914,10 @@ msgstr "pile de planification pleine"
msgid "script compilation not supported"
msgstr "compilation de script non supportée"
+#: extmod/ulab/code/ndarray.c
+msgid "shape must be a 2-tuple"
+msgstr ""
+
#: py/objstr.c
msgid "sign not allowed in string format specifier"
msgstr "signe non autorisé dans les spéc. de formats de chaînes de caractères"
@@ -2624,6 +2930,10 @@ msgstr "signe non autorisé avec la spéc. de format d'entier 'c'"
msgid "single '}' encountered in format string"
msgstr "'}' seule rencontrée dans une chaîne de format"
+#: extmod/ulab/code/linalg.c
+msgid "size is defined for ndarrays only"
+msgstr ""
+
#: shared-bindings/time/__init__.c
msgid "sleep length must be non-negative"
msgstr "la longueur de sleep ne doit pas être négative"
@@ -2640,6 +2950,10 @@ msgstr "dépassement de capacité d'un entier court"
msgid "soft reboot\n"
msgstr "redémarrage logiciel\n"
+#: extmod/ulab/code/numerical.c
+msgid "sort argument must be an ndarray"
+msgstr ""
+
#: py/objstr.c
msgid "start/end indices"
msgstr "indices de début/fin"
@@ -2732,12 +3046,16 @@ msgstr "'timestamp' hors bornes pour 'time_t' de la plateforme"
msgid "too many arguments provided with the given format"
msgstr "trop d'arguments fournis avec ce format"
+#: extmod/ulab/code/ndarray.c
+msgid "too many indices"
+msgstr ""
+
#: py/runtime.c
#, c-format
msgid "too many values to unpack (expected %d)"
msgstr "trop de valeur à dégrouper (%d attendues)"
-#: py/objstr.c
+#: extmod/ulab/code/linalg.c py/objstr.c
msgid "tuple index out of range"
msgstr "index du tuple hors gamme"
@@ -2751,6 +3069,7 @@ msgstr "tuple ou liste requis en partie droite"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
+#: shared-bindings/busio/UART.c
msgid "tx and rx cannot both be None"
msgstr "tx et rx ne peuvent être 'None' tous les deux"
@@ -2869,6 +3188,14 @@ msgstr "'value_count' doit être > 0"
msgid "window must be <= interval"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "wrong argument type"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "wrong index type"
+msgstr ""
+
#: py/objstr.c
msgid "wrong number of arguments"
msgstr "mauvais nombres d'arguments"
@@ -2877,6 +3204,10 @@ msgstr "mauvais nombres d'arguments"
msgid "wrong number of values to unpack"
msgstr "mauvais nombre de valeurs à dégrouper"
+#: extmod/ulab/code/ndarray.c
+msgid "wrong operand type"
+msgstr ""
+
#: shared-module/displayio/Shape.c
#, fuzzy
msgid "x value out of bounds"
diff --git a/locale/it_IT.po b/locale/it_IT.po
index 6bc116f21..99e99a3cb 100644
--- a/locale/it_IT.po
+++ b/locale/it_IT.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-02-05 15:55-0800\n"
+"POT-Creation-Date: 2020-04-15 10:24-0400\n"
"PO-Revision-Date: 2018-10-02 16:27+0200\n"
"Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n"
"Language-Team: \n"
@@ -53,6 +53,11 @@ msgstr " output:\n"
msgid "%%c requires int or char"
msgstr "%%c necessita di int o char"
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "%d address pins and %d rgb pins indicate a height of %d, not %d"
+msgstr ""
+
#: shared-bindings/microcontroller/Pin.c
msgid "%q in use"
msgstr "%q in uso"
@@ -135,6 +140,10 @@ msgstr "intero '%s' non è nell'intervallo %d..%d"
msgid "'%s' integer 0x%x does not fit in mask 0x%x"
msgstr "intero '%s' non è nell'intervallo %d..%d"
+#: py/runtime.c
+msgid "'%s' object cannot assign attribute '%q'"
+msgstr ""
+
#: py/proto.c
msgid "'%s' object does not support '%q'"
msgstr ""
@@ -186,6 +195,10 @@ msgid "'align' requires 1 argument"
msgstr "'align' richiede 1 argomento"
#: py/compile.c
+msgid "'async for' or 'async with' outside async function"
+msgstr ""
+
+#: py/compile.c
msgid "'await' outside function"
msgstr "'await' al di fuori della funzione"
@@ -276,7 +289,7 @@ msgstr "Tutti i timer per questo pin sono in uso"
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
#: ports/cxd56/common-hal/pulseio/PulseOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
-#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c
+#: ports/nrf/peripherals/nrf/timers.c shared-bindings/pulseio/PWMOut.c
#: shared-module/_pew/PewPew.c
msgid "All timers in use"
msgstr "Tutti i timer utilizzati"
@@ -316,6 +329,10 @@ msgstr "Array deve avere mezzoparole (typo 'H')"
msgid "Array values should be single bytes."
msgstr "Valori di Array dovrebbero essere bytes singulari"
+#: shared-bindings/_protomatter/Protomatter.c
+msgid "At most %d %q may be specified (not %d)"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
@@ -333,6 +350,7 @@ msgstr ""
"per disabilitarlo.\n"
#: shared-module/displayio/Display.c
+#: shared-module/framebufferio/FramebufferDisplay.c
msgid "Below minimum frame rate"
msgstr ""
@@ -349,7 +367,9 @@ msgstr "La profondità di bit deve essere multipla di 8."
msgid "Both pins must support hardware interrupts"
msgstr "Entrambi i pin devono supportare gli interrupt hardware"
+#: shared-bindings/_protomatter/Protomatter.c
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness must be 0-1.0"
msgstr ""
@@ -358,6 +378,7 @@ msgid "Brightness must be between 0 and 255"
msgstr "La luminosità deve essere compreso tra 0 e 255"
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness not adjustable"
msgstr "Illiminazione non è regolabile"
@@ -372,10 +393,12 @@ msgid "Buffer incorrect size. Should be %d bytes."
msgstr "Buffer di lunghezza non valida. Dovrebbe essere di %d bytes."
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is not a bytearray."
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is too small"
msgstr ""
@@ -392,6 +415,11 @@ msgstr "Il buffer deve essere lungo almeno 1"
msgid "Buffer too large and unable to allocate"
msgstr ""
+#: shared-bindings/_bleio/PacketBuffer.c
+#, c-format
+msgid "Buffer too short by %d bytes"
+msgstr ""
+
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
#: ports/nrf/common-hal/displayio/ParallelBus.c
#, fuzzy, c-format
@@ -461,6 +489,10 @@ msgstr ""
msgid "Cannot set value when direction is input."
msgstr "non si può impostare un valore quando direzione è input"
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Cannot specify RTS or CTS in RS485 mode"
+msgstr ""
+
#: py/objslice.c
msgid "Cannot subclass slice"
msgstr "Impossibile subclasare slice"
@@ -473,7 +505,7 @@ msgstr "Impossibile trasferire senza i pin MOSI e MISO."
msgid "Cannot unambiguously get sizeof scalar"
msgstr "Impossibile ricavare la grandezza scalare di sizeof inequivocabilmente"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Cannot vary frequency on a timer that is already in use"
msgstr ""
@@ -535,31 +567,31 @@ msgstr ""
msgid "Could not initialize UART"
msgstr "Impossibile inizializzare l'UART"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not initialize channel"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not initialize timer"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not re-init channel"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not re-init timer"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not restart PWM"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not start PWM"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Could not start interrupt, RX busy"
msgstr ""
@@ -585,11 +617,11 @@ msgstr "Impossibile allocare il secondo buffer"
msgid "Crash into the HardFault_Handler."
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Channel Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Device Init Error"
msgstr ""
@@ -625,11 +657,13 @@ msgid "DigitalInOut not supported on given pin"
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Display must have a 16 bit colorspace."
msgstr ""
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Display rotation must be in 90 degree increments"
msgstr ""
@@ -683,6 +717,10 @@ msgstr ""
msgid "Extended advertisements with scan response not supported."
msgstr ""
+#: extmod/ulab/code/fft.c
+msgid "FFT is defined for ndarrays only"
+msgstr ""
+
#: shared-bindings/ps2io/Ps2.c
msgid "Failed sending command."
msgstr ""
@@ -700,6 +738,7 @@ msgstr "Impossibile allocare buffer RX"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
msgstr "Fallita allocazione del buffer RX di %d byte"
@@ -733,7 +772,7 @@ msgstr "File esistente"
msgid "Frequency captured is above capability. Capture Paused."
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Frequency must match existing PWMOut using this timer"
msgstr ""
@@ -744,6 +783,7 @@ msgstr ""
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Group already used"
msgstr ""
@@ -751,11 +791,11 @@ msgstr ""
msgid "Group full"
msgstr "Gruppo pieno"
-#: ports/stm32f4/common-hal/busio/I2C.c ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c
msgid "Hardware busy, try alternative pins"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Hardware in use, try alternative pins"
msgstr ""
@@ -763,7 +803,7 @@ msgstr ""
msgid "I/O operation on closed file"
msgstr "operazione I/O su file chiuso"
-#: ports/stm32f4/common-hal/busio/I2C.c
+#: ports/stm/common-hal/busio/I2C.c
msgid "I2C Init Error"
msgstr ""
@@ -795,7 +835,7 @@ msgstr ""
msgid "Insufficient encryption"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr ""
@@ -804,7 +844,7 @@ msgstr ""
msgid "Invalid %q pin"
msgstr "Pin %q non valido"
-#: ports/stm32f4/common-hal/analogio/AnalogIn.c
+#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Invalid ADC Unit value"
msgstr ""
@@ -812,11 +852,11 @@ msgstr ""
msgid "Invalid BMP file"
msgstr "File BMP non valido"
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "Invalid DAC pin supplied"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/stm32f4/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c
msgid "Invalid I2C pin selection"
msgstr ""
@@ -826,16 +866,15 @@ msgstr ""
msgid "Invalid PWM frequency"
msgstr "Frequenza PWM non valida"
-#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm32f4/common-hal/busio/SPI.c
+#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c
msgid "Invalid SPI pin selection"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
msgid "Invalid UART pin selection"
msgstr ""
-#: py/moduerrno.c
+#: py/moduerrno.c shared-module/_protomatter/Protomatter.c
msgid "Invalid argument"
msgstr "Argomento non valido"
@@ -843,7 +882,7 @@ msgstr "Argomento non valido"
msgid "Invalid bits per value"
msgstr "bits per valore invalido"
-#: ports/nrf/common-hal/busio/UART.c ports/stm32f4/common-hal/busio/UART.c
+#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
#, fuzzy
msgid "Invalid buffer size"
msgstr "lunghezza del buffer non valida"
@@ -873,7 +912,7 @@ msgstr "File non valido"
msgid "Invalid format chunk size"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Invalid frequency supplied"
msgstr ""
@@ -886,12 +925,13 @@ msgid "Invalid number of bits"
msgstr "Numero di bit non valido"
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
+#: shared-bindings/displayio/FourWire.c
msgid "Invalid phase"
msgstr "Fase non valida"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/atmel-samd/common-hal/touchio/TouchIn.c
-#: shared-bindings/pulseio/PWMOut.c
+#: shared-bindings/pulseio/PWMOut.c shared-module/_protomatter/Protomatter.c
msgid "Invalid pin"
msgstr "Pin non valido"
@@ -909,11 +949,15 @@ msgstr "Pin non valido per il canale destro"
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c
#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c
#: ports/cxd56/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
msgid "Invalid pins"
msgstr "Pin non validi"
+#: ports/stm/common-hal/pulseio/PWMOut.c
+msgid "Invalid pins for PWMOut"
+msgstr ""
+
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
+#: shared-bindings/displayio/FourWire.c
msgid "Invalid polarity"
msgstr "Polarità non valida"
@@ -942,7 +986,7 @@ msgstr "Tipo di servizio non valido"
msgid "Invalid wave file"
msgstr "File wave non valido"
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Invalid word/bit length"
msgstr ""
@@ -992,7 +1036,7 @@ msgid "Microphone startup delay must be in range 0.0 to 1.0"
msgstr ""
"Il ritardo di avvio del microfono deve essere nell'intervallo tra 0.0 e 1.0"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "Missing MISO or MOSI Pin"
msgstr ""
@@ -1000,10 +1044,19 @@ msgstr ""
msgid "Must be a %q subclass."
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "Must provide MISO or MOSI pin"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "Must use a multiple of 6 rgb pins, not %d"
+msgstr ""
+
+#: py/parse.c
+msgid "Name too long"
+msgstr ""
+
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Negative step not supported"
msgstr ""
@@ -1013,7 +1066,7 @@ msgid "No CCCD for this Characteristic"
msgstr ""
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "No DAC on chip"
msgstr "Nessun DAC sul chip"
@@ -1022,23 +1075,23 @@ msgstr "Nessun DAC sul chip"
msgid "No DMA channel found"
msgstr "Nessun canale DMA trovato"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "No MISO Pin"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "No MOSI Pin"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "No RX pin"
msgstr "Nessun pin RX"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "No TX pin"
msgstr "Nessun pin TX"
@@ -1067,7 +1120,7 @@ msgstr ""
msgid "No hardware support on pin"
msgstr "Nessun supporto hardware sul pin"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "No more timers available on this pin."
msgstr ""
@@ -1083,6 +1136,10 @@ msgstr "Non che spazio sul dispositivo"
msgid "No such file/directory"
msgstr "Nessun file/directory esistente"
+#: shared-module/_protomatter/Protomatter.c
+msgid "No timer available"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid "Nordic Soft Device failure assertion."
msgstr ""
@@ -1146,7 +1203,8 @@ msgstr ""
"frequenza PWM frequency non è scrivibile quando variable_frequency è "
"impostato nel costruttore a False."
-#: ports/stm32f4/common-hal/displayio/ParallelBus.c
+#: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c
+#: ports/stm/common-hal/displayio/ParallelBus.c
msgid "ParallelBus not yet supported"
msgstr ""
@@ -1158,10 +1216,22 @@ msgstr "Permesso negato"
#: ports/cxd56/common-hal/analogio/AnalogIn.c
#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c
#: ports/nrf/common-hal/analogio/AnalogIn.c
-#: ports/stm32f4/common-hal/analogio/AnalogIn.c
+#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Pin does not have ADC capabilities"
msgstr "Il pin non ha capacità di ADC"
+#: ports/stm/common-hal/pulseio/PulseIn.c
+msgid "Pin number already reserved by EXTI"
+msgstr ""
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid ""
+"Pinout uses %d bytes per element, which consumes more than the ideal %d "
+"bytes. If this cannot be avoided, pass allow_inefficient=True to the "
+"constructor"
+msgstr ""
+
#: py/builtinhelp.c
#, fuzzy
msgid "Plus any modules on the filesystem\n"
@@ -1180,26 +1250,31 @@ msgid "Press any key to enter the REPL. Use CTRL-D to reload."
msgstr ""
"Premi un qualunque tasto per entrare nel REPL. Usa CTRL-D per ricaricare."
-#: shared-bindings/digitalio/DigitalInOut.c
-msgid "Pull not used when direction is output."
+#: shared-module/_protomatter/Protomatter.c
+#, c-format
+msgid "Protomatter internal error #%d"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PulseIn.c
-msgid "PulseIn not yet supported"
+#: shared-bindings/digitalio/DigitalInOut.c
+msgid "Pull not used when direction is output."
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PulseOut.c
-msgid "PulseOut not yet supported"
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid "PulseOut not supported on this chip"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/stm/common-hal/os/__init__.c
msgid "RNG Init Error"
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "RS485 inversion specified when not in RS485 mode"
+msgstr ""
+
#: ports/cxd56/common-hal/rtc/RTC.c ports/mimxrt10xx/common-hal/rtc/RTC.c
#: ports/nrf/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
@@ -1209,7 +1284,12 @@ msgstr "calibrazione RTC non supportata su questa scheda"
msgid "RTC is not supported on this board"
msgstr "RTC non supportato su questa scheda"
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
+#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+msgid "RTS/CTS/RS485 Not yet supported on this device"
+msgstr ""
+
+#: ports/stm/common-hal/os/__init__.c
msgid "Random number generation error"
msgstr ""
@@ -1250,11 +1330,11 @@ msgstr "Modalità sicura in esecuzione! Codice salvato non in esecuzione.\n"
msgid "SDA or SCL needs a pull up"
msgstr "SDA o SCL necessitano un pull-up"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Re-initialization error"
msgstr ""
@@ -1273,6 +1353,14 @@ msgstr ""
msgid "Scan already in progess. Stop with stop_scan."
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Selected CTS pin not valid"
+msgstr ""
+
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Selected RTS pin not valid"
+msgstr ""
+
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "Serializer in use"
@@ -1299,10 +1387,14 @@ msgstr "La dimensione dello stack deve essere almeno 256"
msgid "Stream missing readinto() or write() method."
msgstr "Metodi mancanti readinto() o write() allo stream."
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Supply at least one UART pin"
msgstr ""
+#: ports/stm/common-hal/microcontroller/Processor.c
+msgid "Temperature read timed out"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid ""
"The CircuitPython heap was corrupted because the stack was too small.\n"
@@ -1358,13 +1450,11 @@ msgstr ""
msgid "Too many channels in sample."
msgstr ""
-#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
-#: shared-bindings/displayio/ParallelBus.c
+#: shared-module/displayio/__init__.c
msgid "Too many display busses"
msgstr ""
-#: shared-bindings/displayio/Display.c
-#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-module/displayio/__init__.c
msgid "Too many displays"
msgstr "Troppi schermi"
@@ -1376,23 +1466,23 @@ msgstr "Traceback (chiamata più recente per ultima):\n"
msgid "Tuple or struct_time argument required"
msgstr "Tupla o struct_time richiesto come argomento"
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Buffer allocation error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART De-init error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Re-init error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART write error"
msgstr ""
@@ -1513,6 +1603,10 @@ msgstr ""
msgid "Viper functions don't currently support more than 4 arguments"
msgstr "Le funzioni Viper non supportano più di 4 argomenti al momento"
+#: ports/stm/common-hal/microcontroller/Processor.c
+msgid "Voltage read timed out"
+msgstr ""
+
#: main.c
msgid "WARNING: Your code filename has two extensions\n"
msgstr "ATTENZIONE: Il nome del sorgente ha due estensioni\n"
@@ -1573,10 +1667,18 @@ msgstr "indirizzo fuori limite"
msgid "addresses is empty"
msgstr "gli indirizzi sono vuoti"
+#: extmod/ulab/code/vectorise.c
+msgid "arctan2 is implemented for scalars and ndarrays only"
+msgstr ""
+
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr "l'argomento è una sequenza vuota"
+#: extmod/ulab/code/numerical.c
+msgid "argsort argument must be an ndarray"
+msgstr ""
+
#: py/runtime.c
msgid "argument has wrong type"
msgstr "il tipo dell'argomento è errato"
@@ -1590,14 +1692,34 @@ msgstr "discrepanza di numero/tipo di argomenti"
msgid "argument should be a '%q' not a '%q'"
msgstr "l'argomento dovrebbe essere un '%q' e non un '%q'"
+#: extmod/ulab/code/linalg.c
+msgid "arguments must be ndarrays"
+msgstr ""
+
#: py/objarray.c shared-bindings/nvm/ByteArray.c
msgid "array/bytes required on right side"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "attempt to get argmin/argmax of an empty sequence"
+msgstr ""
+
#: py/objstr.c
msgid "attributes not supported yet"
msgstr "attributi non ancora supportati"
+#: extmod/ulab/code/numerical.c
+msgid "axis must be -1, 0, None, or 1"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "axis must be -1, 0, or 1"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "axis must be None, 0, or 1"
+msgstr ""
+
#: py/builtinevex.c
msgid "bad compile mode"
msgstr ""
@@ -1844,6 +1966,10 @@ msgstr "impossibile imporate il nome %q"
msgid "cannot perform relative import"
msgstr "impossibile effettuare l'importazione relativa"
+#: extmod/ulab/code/ndarray.c
+msgid "cannot reshape array (incompatible input/output shape)"
+msgstr ""
+
#: py/emitnative.c
msgid "casting"
msgstr "casting"
@@ -1902,6 +2028,30 @@ msgstr "la costante deve essere un intero"
msgid "conversion to object"
msgstr "conversione in oggetto"
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must be linear arrays"
+msgstr ""
+
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must be ndarrays"
+msgstr ""
+
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must not be empty"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "could not broadast input array from shape"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "could not invert Vandermonde matrix"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "ddof must be smaller than length of data set"
+msgstr ""
+
#: py/parsenum.c
msgid "decimal numbers not supported"
msgstr "numeri decimali non supportati"
@@ -1930,6 +2080,10 @@ msgstr "destination_length deve essere un int >= 0"
msgid "dict update sequence has wrong length"
msgstr "sequanza di aggiornamento del dizionario ha la lunghezza errata"
+#: extmod/ulab/code/numerical.c
+msgid "diff argument must be an ndarray"
+msgstr ""
+
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@@ -2001,6 +2155,26 @@ msgstr "argomento nominato aggiuntivo fornito"
msgid "extra positional arguments given"
msgstr "argomenti posizonali extra dati"
+#: py/parse.c
+msgid "f-string expression part cannot include a '#'"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string expression part cannot include a backslash"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: empty expression not allowed"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: expecting '}'"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: single '}' is not allowed"
+msgstr ""
+
#: shared-bindings/audiocore/WaveFile.c shared-bindings/audiomp3/MP3Decoder.c
#: shared-bindings/displayio/OnDiskBitmap.c
msgid "file must be a file opened in byte mode"
@@ -2010,6 +2184,14 @@ msgstr ""
msgid "filesystem must provide mount method"
msgstr "il filesystem deve fornire un metodo di mount"
+#: extmod/ulab/code/ndarray.c
+msgid "first argument must be an iterable"
+msgstr ""
+
+#: extmod/ulab/code/vectorise.c
+msgid "first argument must be an ndarray"
+msgstr ""
+
#: py/objtype.c
msgid "first argument to super() must be type"
msgstr ""
@@ -2018,6 +2200,14 @@ msgstr ""
msgid "firstbit must be MSB"
msgstr "il primo bit deve essere il più significativo (MSB)"
+#: extmod/ulab/code/ndarray.c
+msgid "flattening order must be either 'C', or 'F'"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "flip argument must be an ndarray"
+msgstr ""
+
#: py/objint.c
msgid "float too big"
msgstr "float troppo grande"
@@ -2111,9 +2301,14 @@ msgstr ""
msgid "incorrect padding"
msgstr "padding incorretto"
+#: extmod/ulab/code/ndarray.c
+msgid "index is out of bounds"
+msgstr ""
+
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
-#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c
+#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c
msgid "index out of range"
msgstr "indice fuori intervallo"
@@ -2121,10 +2316,46 @@ msgstr "indice fuori intervallo"
msgid "indices must be integers"
msgstr "gli indici devono essere interi"
+#: extmod/ulab/code/ndarray.c
+msgid "indices must be integers, slices, or Boolean lists"
+msgstr ""
+
#: py/compile.c
msgid "inline assembler must be a function"
msgstr "inline assembler deve essere una funzione"
+#: extmod/ulab/code/create.c
+msgid "input argument must be an integer or a 2-tuple"
+msgstr ""
+
+#: extmod/ulab/code/fft.c
+msgid "input array length must be power of 2"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "input data must be an iterable"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input matrix is asymmetric"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input matrix is singular"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input must be square matrix"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "input must be tuple, list, range, or ndarray"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "input vectors must be of equal length"
+msgstr ""
+
#: py/parsenum.c
msgid "int() arg 2 must be >= 2 and <= 36"
msgstr "il secondo argomanto di int() deve essere >= 2 e <= 36"
@@ -2205,6 +2436,14 @@ msgstr ""
"il secondo argomento di issubclass() deve essere una classe o una tupla di "
"classi"
+#: extmod/ulab/code/ndarray.c
+msgid "iterables are not of the same length"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "iterations did not converge"
+msgstr ""
+
#: py/objstr.c
msgid "join expects a list of str/bytes objects consistent with self object"
msgstr ""
@@ -2256,6 +2495,10 @@ msgstr "variabile locale richiamata prima di un assegnamento"
msgid "long int not supported in this build"
msgstr "long int non supportata in questa build"
+#: py/parse.c
+msgid "malformed f-string"
+msgstr ""
+
#: shared-bindings/_stage/Layer.c
msgid "map buffer too small"
msgstr "map buffer troppo piccolo"
@@ -2264,6 +2507,14 @@ msgstr "map buffer troppo piccolo"
msgid "math domain error"
msgstr "errore di dominio matematico"
+#: extmod/ulab/code/linalg.c
+msgid "matrix dimensions do not match"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "matrix is not positive definite"
+msgstr ""
+
#: ports/nrf/common-hal/_bleio/Characteristic.c
#: ports/nrf/common-hal/_bleio/Descriptor.c
#, c-format
@@ -2287,6 +2538,10 @@ msgstr "allocazione di memoria fallita, l'heap è bloccato"
msgid "module not found"
msgstr "modulo non trovato"
+#: extmod/ulab/code/poly.c
+msgid "more degrees of freedom than data points"
+msgstr ""
+
#: py/compile.c
msgid "multiple *x in assignment"
msgstr "*x multipli nell'assegnamento"
@@ -2311,6 +2566,10 @@ msgstr "è necessario specificare tutte le sck/mosi/miso"
msgid "must use keyword argument for key function"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "n must be between 0, and 9"
+msgstr ""
+
#: py/runtime.c
msgid "name '%q' is not defined"
msgstr "nome '%q'non definito"
@@ -2400,6 +2659,14 @@ msgstr ""
msgid "not enough arguments for format string"
msgstr "argomenti non sufficienti per la stringa di formattazione"
+#: extmod/ulab/code/poly.c
+msgid "number of arguments must be 2, or 3"
+msgstr ""
+
+#: extmod/ulab/code/create.c
+msgid "number of points must be at least 2"
+msgstr ""
+
#: py/obj.c
#, c-format
msgid "object '%s' is not a tuple or list"
@@ -2468,6 +2735,18 @@ msgstr ""
msgid "only slices with step=1 (aka None) are supported"
msgstr "solo slice con step=1 (aka None) sono supportate"
+#: extmod/ulab/code/ndarray.c extmod/ulab/code/vectorise.c
+msgid "operands could not be broadcast together"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "operation is not implemented on ndarrays"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "operation is not supported for given type"
+msgstr ""
+
#: py/modbuiltins.c
msgid "ord expects a character"
msgstr "ord() aspetta un carattere"
@@ -2519,6 +2798,7 @@ msgstr "pixel_shader deve essere displayio.Palette o displayio.ColorConverter"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "pop from an empty PulseIn"
msgstr "pop sun un PulseIn vuoto"
@@ -2546,6 +2826,14 @@ msgstr "pow() con 3 argomenti richiede interi"
msgid "queue overflow"
msgstr "overflow della coda"
+#: py/parse.c
+msgid "raw f-strings are not implemented"
+msgstr ""
+
+#: extmod/ulab/code/fft.c
+msgid "real and imaginary parts must be of equal length"
+msgstr ""
+
#: py/builtinimport.c
msgid "relative import"
msgstr "importazione relativa"
@@ -2563,6 +2851,20 @@ msgstr ""
msgid "return expected '%q' but got '%q'"
msgstr "return aspettava '%q' ma ha ottenuto '%q'"
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "rgb_pins[%d] duplicates another pin assignment"
+msgstr ""
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "rgb_pins[%d] is not on the same port as clock"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "right hand side must be an ndarray, or a scalar"
+msgstr ""
+
#: py/objstr.c
msgid "rsplit(None,n)"
msgstr ""
@@ -2587,6 +2889,10 @@ msgstr ""
msgid "script compilation not supported"
msgstr "compilazione dello scrip non suportata"
+#: extmod/ulab/code/ndarray.c
+msgid "shape must be a 2-tuple"
+msgstr ""
+
#: py/objstr.c
msgid "sign not allowed in string format specifier"
msgstr "segno non permesso nello spcificatore di formato della stringa"
@@ -2599,6 +2905,10 @@ msgstr "segno non permesso nello spcificatore di formato 'c' della stringa"
msgid "single '}' encountered in format string"
msgstr "'}' singolo presente nella stringa di formattazione"
+#: extmod/ulab/code/linalg.c
+msgid "size is defined for ndarrays only"
+msgstr ""
+
#: shared-bindings/time/__init__.c
msgid "sleep length must be non-negative"
msgstr "la lunghezza di sleed deve essere non negativa"
@@ -2615,6 +2925,10 @@ msgstr "small int overflow"
msgid "soft reboot\n"
msgstr "soft reboot\n"
+#: extmod/ulab/code/numerical.c
+msgid "sort argument must be an ndarray"
+msgstr ""
+
#: py/objstr.c
msgid "start/end indices"
msgstr ""
@@ -2706,12 +3020,16 @@ msgstr "timestamp è fuori intervallo per il time_t della piattaforma"
msgid "too many arguments provided with the given format"
msgstr "troppi argomenti forniti con il formato specificato"
+#: extmod/ulab/code/ndarray.c
+msgid "too many indices"
+msgstr ""
+
#: py/runtime.c
#, c-format
msgid "too many values to unpack (expected %d)"
msgstr "troppi valori da scompattare (%d attesi)"
-#: py/objstr.c
+#: extmod/ulab/code/linalg.c py/objstr.c
msgid "tuple index out of range"
msgstr "indice della tupla fuori intervallo"
@@ -2725,6 +3043,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
+#: shared-bindings/busio/UART.c
msgid "tx and rx cannot both be None"
msgstr "tx e rx non possono essere entrambi None"
@@ -2842,6 +3161,14 @@ msgstr ""
msgid "window must be <= interval"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "wrong argument type"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "wrong index type"
+msgstr ""
+
#: py/objstr.c
msgid "wrong number of arguments"
msgstr "numero di argomenti errato"
@@ -2850,6 +3177,10 @@ msgstr "numero di argomenti errato"
msgid "wrong number of values to unpack"
msgstr "numero di valori da scompattare non corretto"
+#: extmod/ulab/code/ndarray.c
+msgid "wrong operand type"
+msgstr ""
+
#: shared-module/displayio/Shape.c
#, fuzzy
msgid "x value out of bounds"
diff --git a/locale/ko.po b/locale/ko.po
index 64bd2e9dd..d232133e2 100644
--- a/locale/ko.po
+++ b/locale/ko.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-02-05 15:55-0800\n"
+"POT-Creation-Date: 2020-04-15 10:24-0400\n"
"PO-Revision-Date: 2019-05-06 14:22-0700\n"
"Last-Translator: \n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -55,6 +55,11 @@ msgstr " 산출:\n"
msgid "%%c requires int or char"
msgstr "%%c 전수(int)또는 캐릭터(char)필요합니다"
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "%d address pins and %d rgb pins indicate a height of %d, not %d"
+msgstr ""
+
#: shared-bindings/microcontroller/Pin.c
msgid "%q in use"
msgstr "%q 사용 중입니다"
@@ -135,6 +140,10 @@ msgstr ""
msgid "'%s' integer 0x%x does not fit in mask 0x%x"
msgstr ""
+#: py/runtime.c
+msgid "'%s' object cannot assign attribute '%q'"
+msgstr ""
+
#: py/proto.c
msgid "'%s' object does not support '%q'"
msgstr ""
@@ -186,6 +195,10 @@ msgid "'align' requires 1 argument"
msgstr "'align' 에는 1 개의 독립변수가 필요합니다"
#: py/compile.c
+msgid "'async for' or 'async with' outside async function"
+msgstr ""
+
+#: py/compile.c
msgid "'await' outside function"
msgstr "'await' 는 펑크션 외부에 있습니다"
@@ -275,7 +288,7 @@ msgstr "핀의 모든 타이머가 사용 중입니다"
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
#: ports/cxd56/common-hal/pulseio/PulseOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
-#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c
+#: ports/nrf/peripherals/nrf/timers.c shared-bindings/pulseio/PWMOut.c
#: shared-module/_pew/PewPew.c
msgid "All timers in use"
msgstr "모든 타이머가 사용 중입니다"
@@ -315,6 +328,10 @@ msgstr ""
msgid "Array values should be single bytes."
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+msgid "At most %d %q may be specified (not %d)"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
@@ -332,6 +349,7 @@ msgstr ""
"성화하려면 REPL을 입력하십시오.\n"
#: shared-module/displayio/Display.c
+#: shared-module/framebufferio/FramebufferDisplay.c
msgid "Below minimum frame rate"
msgstr ""
@@ -347,7 +365,9 @@ msgstr ""
msgid "Both pins must support hardware interrupts"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness must be 0-1.0"
msgstr ""
@@ -356,6 +376,7 @@ msgid "Brightness must be between 0 and 255"
msgstr "밝기는 0에서 255 사이 여야합니다"
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness not adjustable"
msgstr "밝기를 조절할 수 없습니다"
@@ -370,10 +391,12 @@ msgid "Buffer incorrect size. Should be %d bytes."
msgstr "잘못된 크기의 버퍼. %d 바이트 여야합니다."
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is not a bytearray."
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is too small"
msgstr ""
@@ -390,6 +413,11 @@ msgstr "잘못된 크기의 버퍼. >1 여야합니다"
msgid "Buffer too large and unable to allocate"
msgstr ""
+#: shared-bindings/_bleio/PacketBuffer.c
+#, c-format
+msgid "Buffer too short by %d bytes"
+msgstr ""
+
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
#: ports/nrf/common-hal/displayio/ParallelBus.c
#, c-format
@@ -456,6 +484,10 @@ msgstr ""
msgid "Cannot set value when direction is input."
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Cannot specify RTS or CTS in RS485 mode"
+msgstr ""
+
#: py/objslice.c
msgid "Cannot subclass slice"
msgstr ""
@@ -468,7 +500,7 @@ msgstr ""
msgid "Cannot unambiguously get sizeof scalar"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Cannot vary frequency on a timer that is already in use"
msgstr ""
@@ -529,31 +561,31 @@ msgstr ""
msgid "Could not initialize UART"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not initialize channel"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not initialize timer"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not re-init channel"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not re-init timer"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not restart PWM"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not start PWM"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Could not start interrupt, RX busy"
msgstr ""
@@ -579,11 +611,11 @@ msgstr ""
msgid "Crash into the HardFault_Handler."
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Channel Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Device Init Error"
msgstr ""
@@ -617,11 +649,13 @@ msgid "DigitalInOut not supported on given pin"
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Display must have a 16 bit colorspace."
msgstr ""
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Display rotation must be in 90 degree increments"
msgstr ""
@@ -673,6 +707,10 @@ msgstr ""
msgid "Extended advertisements with scan response not supported."
msgstr ""
+#: extmod/ulab/code/fft.c
+msgid "FFT is defined for ndarrays only"
+msgstr ""
+
#: shared-bindings/ps2io/Ps2.c
msgid "Failed sending command."
msgstr ""
@@ -690,6 +728,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
msgstr ""
@@ -723,7 +762,7 @@ msgstr ""
msgid "Frequency captured is above capability. Capture Paused."
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Frequency must match existing PWMOut using this timer"
msgstr ""
@@ -734,6 +773,7 @@ msgstr ""
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Group already used"
msgstr ""
@@ -741,11 +781,11 @@ msgstr ""
msgid "Group full"
msgstr ""
-#: ports/stm32f4/common-hal/busio/I2C.c ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c
msgid "Hardware busy, try alternative pins"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Hardware in use, try alternative pins"
msgstr ""
@@ -753,7 +793,7 @@ msgstr ""
msgid "I/O operation on closed file"
msgstr ""
-#: ports/stm32f4/common-hal/busio/I2C.c
+#: ports/stm/common-hal/busio/I2C.c
msgid "I2C Init Error"
msgstr ""
@@ -783,7 +823,7 @@ msgstr ""
msgid "Insufficient encryption"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr ""
@@ -792,7 +832,7 @@ msgstr ""
msgid "Invalid %q pin"
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogIn.c
+#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Invalid ADC Unit value"
msgstr ""
@@ -800,11 +840,11 @@ msgstr ""
msgid "Invalid BMP file"
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "Invalid DAC pin supplied"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/stm32f4/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c
msgid "Invalid I2C pin selection"
msgstr ""
@@ -814,16 +854,15 @@ msgstr ""
msgid "Invalid PWM frequency"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm32f4/common-hal/busio/SPI.c
+#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c
msgid "Invalid SPI pin selection"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
msgid "Invalid UART pin selection"
msgstr ""
-#: py/moduerrno.c
+#: py/moduerrno.c shared-module/_protomatter/Protomatter.c
msgid "Invalid argument"
msgstr ""
@@ -831,7 +870,7 @@ msgstr ""
msgid "Invalid bits per value"
msgstr ""
-#: ports/nrf/common-hal/busio/UART.c ports/stm32f4/common-hal/busio/UART.c
+#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
msgid "Invalid buffer size"
msgstr ""
@@ -859,7 +898,7 @@ msgstr "파일이 유효하지 않습니다"
msgid "Invalid format chunk size"
msgstr "형식 청크 크기가 잘못되었습니다"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Invalid frequency supplied"
msgstr ""
@@ -872,12 +911,13 @@ msgid "Invalid number of bits"
msgstr "비트 수가 유효하지 않습니다"
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
+#: shared-bindings/displayio/FourWire.c
msgid "Invalid phase"
msgstr "단계가 잘못되었습니다"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/atmel-samd/common-hal/touchio/TouchIn.c
-#: shared-bindings/pulseio/PWMOut.c
+#: shared-bindings/pulseio/PWMOut.c shared-module/_protomatter/Protomatter.c
msgid "Invalid pin"
msgstr "핀이 잘못되었습니다"
@@ -895,11 +935,15 @@ msgstr "오른쪽 채널 핀이 잘못되었습니다"
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c
#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c
#: ports/cxd56/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
msgid "Invalid pins"
msgstr "핀이 유효하지 않습니다"
+#: ports/stm/common-hal/pulseio/PWMOut.c
+msgid "Invalid pins for PWMOut"
+msgstr ""
+
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
+#: shared-bindings/displayio/FourWire.c
msgid "Invalid polarity"
msgstr ""
@@ -927,7 +971,7 @@ msgstr ""
msgid "Invalid wave file"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Invalid word/bit length"
msgstr ""
@@ -976,7 +1020,7 @@ msgstr ""
msgid "Microphone startup delay must be in range 0.0 to 1.0"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "Missing MISO or MOSI Pin"
msgstr ""
@@ -984,10 +1028,19 @@ msgstr ""
msgid "Must be a %q subclass."
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "Must provide MISO or MOSI pin"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "Must use a multiple of 6 rgb pins, not %d"
+msgstr ""
+
+#: py/parse.c
+msgid "Name too long"
+msgstr ""
+
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Negative step not supported"
msgstr ""
@@ -997,7 +1050,7 @@ msgid "No CCCD for this Characteristic"
msgstr ""
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "No DAC on chip"
msgstr ""
@@ -1006,23 +1059,23 @@ msgstr ""
msgid "No DMA channel found"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "No MISO Pin"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "No MOSI Pin"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "No RX pin"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "No TX pin"
msgstr ""
@@ -1051,7 +1104,7 @@ msgstr ""
msgid "No hardware support on pin"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "No more timers available on this pin."
msgstr ""
@@ -1067,6 +1120,10 @@ msgstr ""
msgid "No such file/directory"
msgstr ""
+#: shared-module/_protomatter/Protomatter.c
+msgid "No timer available"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid "Nordic Soft Device failure assertion."
msgstr ""
@@ -1121,7 +1178,8 @@ msgid ""
"PWM frequency not writable when variable_frequency is False on construction."
msgstr ""
-#: ports/stm32f4/common-hal/displayio/ParallelBus.c
+#: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c
+#: ports/stm/common-hal/displayio/ParallelBus.c
msgid "ParallelBus not yet supported"
msgstr ""
@@ -1133,10 +1191,22 @@ msgstr ""
#: ports/cxd56/common-hal/analogio/AnalogIn.c
#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c
#: ports/nrf/common-hal/analogio/AnalogIn.c
-#: ports/stm32f4/common-hal/analogio/AnalogIn.c
+#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Pin does not have ADC capabilities"
msgstr ""
+#: ports/stm/common-hal/pulseio/PulseIn.c
+msgid "Pin number already reserved by EXTI"
+msgstr ""
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid ""
+"Pinout uses %d bytes per element, which consumes more than the ideal %d "
+"bytes. If this cannot be avoided, pass allow_inefficient=True to the "
+"constructor"
+msgstr ""
+
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr ""
@@ -1153,26 +1223,31 @@ msgstr ""
msgid "Press any key to enter the REPL. Use CTRL-D to reload."
msgstr ""
-#: shared-bindings/digitalio/DigitalInOut.c
-msgid "Pull not used when direction is output."
+#: shared-module/_protomatter/Protomatter.c
+#, c-format
+msgid "Protomatter internal error #%d"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PulseIn.c
-msgid "PulseIn not yet supported"
+#: shared-bindings/digitalio/DigitalInOut.c
+msgid "Pull not used when direction is output."
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PulseOut.c
-msgid "PulseOut not yet supported"
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid "PulseOut not supported on this chip"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/stm/common-hal/os/__init__.c
msgid "RNG Init Error"
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "RS485 inversion specified when not in RS485 mode"
+msgstr ""
+
#: ports/cxd56/common-hal/rtc/RTC.c ports/mimxrt10xx/common-hal/rtc/RTC.c
#: ports/nrf/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
@@ -1182,7 +1257,12 @@ msgstr ""
msgid "RTC is not supported on this board"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
+#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+msgid "RTS/CTS/RS485 Not yet supported on this device"
+msgstr ""
+
+#: ports/stm/common-hal/os/__init__.c
msgid "Random number generation error"
msgstr ""
@@ -1222,11 +1302,11 @@ msgstr ""
msgid "SDA or SCL needs a pull up"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Re-initialization error"
msgstr ""
@@ -1243,6 +1323,14 @@ msgstr ""
msgid "Scan already in progess. Stop with stop_scan."
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Selected CTS pin not valid"
+msgstr ""
+
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Selected RTS pin not valid"
+msgstr ""
+
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "Serializer in use"
@@ -1269,10 +1357,14 @@ msgstr ""
msgid "Stream missing readinto() or write() method."
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Supply at least one UART pin"
msgstr ""
+#: ports/stm/common-hal/microcontroller/Processor.c
+msgid "Temperature read timed out"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid ""
"The CircuitPython heap was corrupted because the stack was too small.\n"
@@ -1328,13 +1420,11 @@ msgstr ""
msgid "Too many channels in sample."
msgstr ""
-#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
-#: shared-bindings/displayio/ParallelBus.c
+#: shared-module/displayio/__init__.c
msgid "Too many display busses"
msgstr ""
-#: shared-bindings/displayio/Display.c
-#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-module/displayio/__init__.c
msgid "Too many displays"
msgstr ""
@@ -1346,23 +1436,23 @@ msgstr ""
msgid "Tuple or struct_time argument required"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Buffer allocation error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART De-init error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Re-init error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART write error"
msgstr ""
@@ -1482,6 +1572,10 @@ msgstr ""
msgid "Viper functions don't currently support more than 4 arguments"
msgstr ""
+#: ports/stm/common-hal/microcontroller/Processor.c
+msgid "Voltage read timed out"
+msgstr ""
+
#: main.c
msgid "WARNING: Your code filename has two extensions\n"
msgstr ""
@@ -1542,10 +1636,18 @@ msgstr ""
msgid "addresses is empty"
msgstr ""
+#: extmod/ulab/code/vectorise.c
+msgid "arctan2 is implemented for scalars and ndarrays only"
+msgstr ""
+
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "argsort argument must be an ndarray"
+msgstr ""
+
#: py/runtime.c
msgid "argument has wrong type"
msgstr ""
@@ -1559,14 +1661,34 @@ msgstr ""
msgid "argument should be a '%q' not a '%q'"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "arguments must be ndarrays"
+msgstr ""
+
#: py/objarray.c shared-bindings/nvm/ByteArray.c
msgid "array/bytes required on right side"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "attempt to get argmin/argmax of an empty sequence"
+msgstr ""
+
#: py/objstr.c
msgid "attributes not supported yet"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "axis must be -1, 0, None, or 1"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "axis must be -1, 0, or 1"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "axis must be None, 0, or 1"
+msgstr ""
+
#: py/builtinevex.c
msgid "bad compile mode"
msgstr ""
@@ -1809,6 +1931,10 @@ msgstr ""
msgid "cannot perform relative import"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "cannot reshape array (incompatible input/output shape)"
+msgstr ""
+
#: py/emitnative.c
msgid "casting"
msgstr ""
@@ -1865,6 +1991,30 @@ msgstr ""
msgid "conversion to object"
msgstr ""
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must be linear arrays"
+msgstr ""
+
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must be ndarrays"
+msgstr ""
+
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must not be empty"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "could not broadast input array from shape"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "could not invert Vandermonde matrix"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "ddof must be smaller than length of data set"
+msgstr ""
+
#: py/parsenum.c
msgid "decimal numbers not supported"
msgstr ""
@@ -1890,6 +2040,10 @@ msgstr ""
msgid "dict update sequence has wrong length"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "diff argument must be an ndarray"
+msgstr ""
+
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@@ -1960,6 +2114,26 @@ msgstr ""
msgid "extra positional arguments given"
msgstr ""
+#: py/parse.c
+msgid "f-string expression part cannot include a '#'"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string expression part cannot include a backslash"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: empty expression not allowed"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: expecting '}'"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: single '}' is not allowed"
+msgstr ""
+
#: shared-bindings/audiocore/WaveFile.c shared-bindings/audiomp3/MP3Decoder.c
#: shared-bindings/displayio/OnDiskBitmap.c
msgid "file must be a file opened in byte mode"
@@ -1969,6 +2143,14 @@ msgstr ""
msgid "filesystem must provide mount method"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "first argument must be an iterable"
+msgstr ""
+
+#: extmod/ulab/code/vectorise.c
+msgid "first argument must be an ndarray"
+msgstr ""
+
#: py/objtype.c
msgid "first argument to super() must be type"
msgstr ""
@@ -1977,6 +2159,14 @@ msgstr ""
msgid "firstbit must be MSB"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "flattening order must be either 'C', or 'F'"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "flip argument must be an ndarray"
+msgstr ""
+
#: py/objint.c
msgid "float too big"
msgstr "float이 너무 큽니다"
@@ -2069,9 +2259,14 @@ msgstr ""
msgid "incorrect padding"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "index is out of bounds"
+msgstr ""
+
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
-#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c
+#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c
msgid "index out of range"
msgstr ""
@@ -2079,10 +2274,46 @@ msgstr ""
msgid "indices must be integers"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "indices must be integers, slices, or Boolean lists"
+msgstr ""
+
#: py/compile.c
msgid "inline assembler must be a function"
msgstr ""
+#: extmod/ulab/code/create.c
+msgid "input argument must be an integer or a 2-tuple"
+msgstr ""
+
+#: extmod/ulab/code/fft.c
+msgid "input array length must be power of 2"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "input data must be an iterable"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input matrix is asymmetric"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input matrix is singular"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input must be square matrix"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "input must be tuple, list, range, or ndarray"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "input vectors must be of equal length"
+msgstr ""
+
#: py/parsenum.c
msgid "int() arg 2 must be >= 2 and <= 36"
msgstr ""
@@ -2161,6 +2392,14 @@ msgstr ""
msgid "issubclass() arg 2 must be a class or a tuple of classes"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "iterables are not of the same length"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "iterations did not converge"
+msgstr ""
+
#: py/objstr.c
msgid "join expects a list of str/bytes objects consistent with self object"
msgstr ""
@@ -2209,6 +2448,10 @@ msgstr ""
msgid "long int not supported in this build"
msgstr ""
+#: py/parse.c
+msgid "malformed f-string"
+msgstr ""
+
#: shared-bindings/_stage/Layer.c
msgid "map buffer too small"
msgstr ""
@@ -2217,6 +2460,14 @@ msgstr ""
msgid "math domain error"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "matrix dimensions do not match"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "matrix is not positive definite"
+msgstr ""
+
#: ports/nrf/common-hal/_bleio/Characteristic.c
#: ports/nrf/common-hal/_bleio/Descriptor.c
#, c-format
@@ -2240,6 +2491,10 @@ msgstr ""
msgid "module not found"
msgstr ""
+#: extmod/ulab/code/poly.c
+msgid "more degrees of freedom than data points"
+msgstr ""
+
#: py/compile.c
msgid "multiple *x in assignment"
msgstr ""
@@ -2264,6 +2519,10 @@ msgstr ""
msgid "must use keyword argument for key function"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "n must be between 0, and 9"
+msgstr ""
+
#: py/runtime.c
msgid "name '%q' is not defined"
msgstr ""
@@ -2350,6 +2609,14 @@ msgstr ""
msgid "not enough arguments for format string"
msgstr ""
+#: extmod/ulab/code/poly.c
+msgid "number of arguments must be 2, or 3"
+msgstr ""
+
+#: extmod/ulab/code/create.c
+msgid "number of points must be at least 2"
+msgstr ""
+
#: py/obj.c
#, c-format
msgid "object '%s' is not a tuple or list"
@@ -2417,6 +2684,18 @@ msgstr ""
msgid "only slices with step=1 (aka None) are supported"
msgstr ""
+#: extmod/ulab/code/ndarray.c extmod/ulab/code/vectorise.c
+msgid "operands could not be broadcast together"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "operation is not implemented on ndarrays"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "operation is not supported for given type"
+msgstr ""
+
#: py/modbuiltins.c
msgid "ord expects a character"
msgstr ""
@@ -2465,6 +2744,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "pop from an empty PulseIn"
msgstr ""
@@ -2492,6 +2772,14 @@ msgstr ""
msgid "queue overflow"
msgstr ""
+#: py/parse.c
+msgid "raw f-strings are not implemented"
+msgstr ""
+
+#: extmod/ulab/code/fft.c
+msgid "real and imaginary parts must be of equal length"
+msgstr ""
+
#: py/builtinimport.c
msgid "relative import"
msgstr ""
@@ -2509,6 +2797,20 @@ msgstr ""
msgid "return expected '%q' but got '%q'"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "rgb_pins[%d] duplicates another pin assignment"
+msgstr ""
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "rgb_pins[%d] is not on the same port as clock"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "right hand side must be an ndarray, or a scalar"
+msgstr ""
+
#: py/objstr.c
msgid "rsplit(None,n)"
msgstr ""
@@ -2531,6 +2833,10 @@ msgstr ""
msgid "script compilation not supported"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "shape must be a 2-tuple"
+msgstr ""
+
#: py/objstr.c
msgid "sign not allowed in string format specifier"
msgstr ""
@@ -2543,6 +2849,10 @@ msgstr ""
msgid "single '}' encountered in format string"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "size is defined for ndarrays only"
+msgstr ""
+
#: shared-bindings/time/__init__.c
msgid "sleep length must be non-negative"
msgstr ""
@@ -2559,6 +2869,10 @@ msgstr ""
msgid "soft reboot\n"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "sort argument must be an ndarray"
+msgstr ""
+
#: py/objstr.c
msgid "start/end indices"
msgstr ""
@@ -2648,12 +2962,16 @@ msgstr ""
msgid "too many arguments provided with the given format"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "too many indices"
+msgstr ""
+
#: py/runtime.c
#, c-format
msgid "too many values to unpack (expected %d)"
msgstr ""
-#: py/objstr.c
+#: extmod/ulab/code/linalg.c py/objstr.c
msgid "tuple index out of range"
msgstr ""
@@ -2667,6 +2985,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
+#: shared-bindings/busio/UART.c
msgid "tx and rx cannot both be None"
msgstr ""
@@ -2784,6 +3103,14 @@ msgstr ""
msgid "window must be <= interval"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "wrong argument type"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "wrong index type"
+msgstr ""
+
#: py/objstr.c
msgid "wrong number of arguments"
msgstr ""
@@ -2792,6 +3119,10 @@ msgstr ""
msgid "wrong number of values to unpack"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "wrong operand type"
+msgstr ""
+
#: shared-module/displayio/Shape.c
msgid "x value out of bounds"
msgstr ""
diff --git a/locale/pl.po b/locale/pl.po
index 77357d05d..6b58cbc4e 100644
--- a/locale/pl.po
+++ b/locale/pl.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-02-05 15:55-0800\n"
+"POT-Creation-Date: 2020-04-15 10:24-0400\n"
"PO-Revision-Date: 2019-03-19 18:37-0700\n"
"Last-Translator: Radomir Dopieralski <circuitpython@sheep.art.pl>\n"
"Language-Team: pl\n"
@@ -54,6 +54,11 @@ msgstr " wyjście:\n"
msgid "%%c requires int or char"
msgstr "%%c wymaga int lub char"
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "%d address pins and %d rgb pins indicate a height of %d, not %d"
+msgstr ""
+
#: shared-bindings/microcontroller/Pin.c
msgid "%q in use"
msgstr "%q w użyciu"
@@ -134,6 +139,10 @@ msgstr "'%s' liczba %d poza zakresem %d..%d"
msgid "'%s' integer 0x%x does not fit in mask 0x%x"
msgstr "'%s' liczba 0x%x nie pasuje do maski 0x%x"
+#: py/runtime.c
+msgid "'%s' object cannot assign attribute '%q'"
+msgstr ""
+
#: py/proto.c
msgid "'%s' object does not support '%q'"
msgstr ""
@@ -185,6 +194,10 @@ msgid "'align' requires 1 argument"
msgstr "'align' wymaga 1 argumentu"
#: py/compile.c
+msgid "'async for' or 'async with' outside async function"
+msgstr ""
+
+#: py/compile.c
msgid "'await' outside function"
msgstr "'await' poza funkcją"
@@ -274,7 +287,7 @@ msgstr "Wszystkie timery tej nóżki w użyciu"
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
#: ports/cxd56/common-hal/pulseio/PulseOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
-#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c
+#: ports/nrf/peripherals/nrf/timers.c shared-bindings/pulseio/PWMOut.c
#: shared-module/_pew/PewPew.c
msgid "All timers in use"
msgstr "Wszystkie timery w użyciu"
@@ -314,6 +327,10 @@ msgstr "Tablica musi zawierać pół-słowa (typ 'H')"
msgid "Array values should be single bytes."
msgstr "Wartości powinny być bajtami."
+#: shared-bindings/_protomatter/Protomatter.c
+msgid "At most %d %q may be specified (not %d)"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
@@ -331,6 +348,7 @@ msgstr ""
"uruchomić, albo wejdź w konsolę aby wyłączyć.\n"
#: shared-module/displayio/Display.c
+#: shared-module/framebufferio/FramebufferDisplay.c
msgid "Below minimum frame rate"
msgstr ""
@@ -346,7 +364,9 @@ msgstr "Głębia musi być wielokrotnością 8."
msgid "Both pins must support hardware interrupts"
msgstr "Obie nóżki muszą wspierać przerwania sprzętowe"
+#: shared-bindings/_protomatter/Protomatter.c
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness must be 0-1.0"
msgstr ""
@@ -355,6 +375,7 @@ msgid "Brightness must be between 0 and 255"
msgstr "Jasność musi być pomiędzy 0 a 255"
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness not adjustable"
msgstr "Jasność nie jest regulowana"
@@ -369,10 +390,12 @@ msgid "Buffer incorrect size. Should be %d bytes."
msgstr "Zła wielkość bufora. Powinno być %d bajtów."
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is not a bytearray."
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is too small"
msgstr ""
@@ -389,6 +412,11 @@ msgstr "Bufor musi mieć długość 1 lub więcej"
msgid "Buffer too large and unable to allocate"
msgstr ""
+#: shared-bindings/_bleio/PacketBuffer.c
+#, c-format
+msgid "Buffer too short by %d bytes"
+msgstr ""
+
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
#: ports/nrf/common-hal/displayio/ParallelBus.c
#, c-format
@@ -455,6 +483,10 @@ msgstr "Nie można zrestartować -- nie ma bootloadera."
msgid "Cannot set value when direction is input."
msgstr "Nie można ustawić wartości w trybie wejścia"
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Cannot specify RTS or CTS in RS485 mode"
+msgstr ""
+
#: py/objslice.c
msgid "Cannot subclass slice"
msgstr "Nie można dziedziczyć ze slice"
@@ -467,7 +499,7 @@ msgstr "Nie można przesyłać bez nóżek MOSI i MISO."
msgid "Cannot unambiguously get sizeof scalar"
msgstr "Wielkość skalara jest niejednoznaczna"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Cannot vary frequency on a timer that is already in use"
msgstr ""
@@ -528,31 +560,31 @@ msgstr ""
msgid "Could not initialize UART"
msgstr "Ustawienie UART nie powiodło się"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not initialize channel"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not initialize timer"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not re-init channel"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not re-init timer"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not restart PWM"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not start PWM"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Could not start interrupt, RX busy"
msgstr ""
@@ -578,11 +610,11 @@ msgstr "Nie udała się alokacja drugiego bufora"
msgid "Crash into the HardFault_Handler."
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Channel Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Device Init Error"
msgstr ""
@@ -616,11 +648,13 @@ msgid "DigitalInOut not supported on given pin"
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Display must have a 16 bit colorspace."
msgstr ""
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Display rotation must be in 90 degree increments"
msgstr "Wyświetlacz można obracać co 90 stopni"
@@ -672,6 +706,10 @@ msgstr "Oczekiwano krotkę długości %d, otrzymano %d"
msgid "Extended advertisements with scan response not supported."
msgstr ""
+#: extmod/ulab/code/fft.c
+msgid "FFT is defined for ndarrays only"
+msgstr ""
+
#: shared-bindings/ps2io/Ps2.c
msgid "Failed sending command."
msgstr ""
@@ -689,6 +727,7 @@ msgstr "Nie udała się alokacja bufora RX"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
msgstr "Nie udała się alokacja %d bajtów na bufor RX"
@@ -722,7 +761,7 @@ msgstr "Plik istnieje"
msgid "Frequency captured is above capability. Capture Paused."
msgstr "Uzyskana częstotliwość jest niemożliwa. Spauzowano."
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Frequency must match existing PWMOut using this timer"
msgstr ""
@@ -733,6 +772,7 @@ msgstr "Funkcja wymaga blokady"
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Group already used"
msgstr ""
@@ -740,11 +780,11 @@ msgstr ""
msgid "Group full"
msgstr "Grupa pełna"
-#: ports/stm32f4/common-hal/busio/I2C.c ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c
msgid "Hardware busy, try alternative pins"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Hardware in use, try alternative pins"
msgstr ""
@@ -752,7 +792,7 @@ msgstr ""
msgid "I/O operation on closed file"
msgstr "Operacja I/O na zamkniętym pliku"
-#: ports/stm32f4/common-hal/busio/I2C.c
+#: ports/stm/common-hal/busio/I2C.c
msgid "I2C Init Error"
msgstr ""
@@ -784,7 +824,7 @@ msgstr ""
msgid "Insufficient encryption"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr ""
@@ -793,7 +833,7 @@ msgstr ""
msgid "Invalid %q pin"
msgstr "Zła nóżka %q"
-#: ports/stm32f4/common-hal/analogio/AnalogIn.c
+#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Invalid ADC Unit value"
msgstr ""
@@ -801,11 +841,11 @@ msgstr ""
msgid "Invalid BMP file"
msgstr "Zły BMP"
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "Invalid DAC pin supplied"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/stm32f4/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c
msgid "Invalid I2C pin selection"
msgstr ""
@@ -815,16 +855,15 @@ msgstr ""
msgid "Invalid PWM frequency"
msgstr "Zła częstotliwość PWM"
-#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm32f4/common-hal/busio/SPI.c
+#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c
msgid "Invalid SPI pin selection"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
msgid "Invalid UART pin selection"
msgstr ""
-#: py/moduerrno.c
+#: py/moduerrno.c shared-module/_protomatter/Protomatter.c
msgid "Invalid argument"
msgstr "Zły argument"
@@ -832,7 +871,7 @@ msgstr "Zły argument"
msgid "Invalid bits per value"
msgstr "Zła liczba bitów wartości"
-#: ports/nrf/common-hal/busio/UART.c ports/stm32f4/common-hal/busio/UART.c
+#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
msgid "Invalid buffer size"
msgstr "Zła wielkość bufora"
@@ -860,7 +899,7 @@ msgstr "Zły plik"
msgid "Invalid format chunk size"
msgstr "Zła wielkość fragmentu formatu"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Invalid frequency supplied"
msgstr ""
@@ -873,12 +912,13 @@ msgid "Invalid number of bits"
msgstr "Zła liczba bitów"
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
+#: shared-bindings/displayio/FourWire.c
msgid "Invalid phase"
msgstr "Zła faza"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/atmel-samd/common-hal/touchio/TouchIn.c
-#: shared-bindings/pulseio/PWMOut.c
+#: shared-bindings/pulseio/PWMOut.c shared-module/_protomatter/Protomatter.c
msgid "Invalid pin"
msgstr "Zła nóżka"
@@ -896,11 +936,15 @@ msgstr "Zła nóżka dla prawego kanału"
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c
#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c
#: ports/cxd56/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
msgid "Invalid pins"
msgstr "Złe nóżki"
+#: ports/stm/common-hal/pulseio/PWMOut.c
+msgid "Invalid pins for PWMOut"
+msgstr ""
+
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
+#: shared-bindings/displayio/FourWire.c
msgid "Invalid polarity"
msgstr "Zła polaryzacja"
@@ -928,7 +972,7 @@ msgstr "Zła liczba głosów"
msgid "Invalid wave file"
msgstr "Zły plik wave"
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Invalid word/bit length"
msgstr ""
@@ -977,7 +1021,7 @@ msgstr ""
msgid "Microphone startup delay must be in range 0.0 to 1.0"
msgstr "Opóźnienie włączenia mikrofonu musi być w zakresie od 0.0 do 1.0"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "Missing MISO or MOSI Pin"
msgstr ""
@@ -985,10 +1029,19 @@ msgstr ""
msgid "Must be a %q subclass."
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "Must provide MISO or MOSI pin"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "Must use a multiple of 6 rgb pins, not %d"
+msgstr ""
+
+#: py/parse.c
+msgid "Name too long"
+msgstr ""
+
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Negative step not supported"
msgstr ""
@@ -998,7 +1051,7 @@ msgid "No CCCD for this Characteristic"
msgstr ""
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "No DAC on chip"
msgstr "Brak DAC"
@@ -1007,23 +1060,23 @@ msgstr "Brak DAC"
msgid "No DMA channel found"
msgstr "Nie znaleziono kanału DMA"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "No MISO Pin"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "No MOSI Pin"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "No RX pin"
msgstr "Brak nóżki RX"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "No TX pin"
msgstr "Brak nóżki TX"
@@ -1052,7 +1105,7 @@ msgstr ""
msgid "No hardware support on pin"
msgstr "Brak sprzętowej obsługi na nóżce"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "No more timers available on this pin."
msgstr ""
@@ -1068,6 +1121,10 @@ msgstr "Brak miejsca"
msgid "No such file/directory"
msgstr "Brak pliku/katalogu"
+#: shared-module/_protomatter/Protomatter.c
+msgid "No timer available"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid "Nordic Soft Device failure assertion."
msgstr ""
@@ -1122,7 +1179,8 @@ msgid ""
"PWM frequency not writable when variable_frequency is False on construction."
msgstr "Nie można zmienić częstotliwości PWM gdy variable_frequency=False."
-#: ports/stm32f4/common-hal/displayio/ParallelBus.c
+#: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c
+#: ports/stm/common-hal/displayio/ParallelBus.c
msgid "ParallelBus not yet supported"
msgstr ""
@@ -1134,10 +1192,22 @@ msgstr "Odmowa dostępu"
#: ports/cxd56/common-hal/analogio/AnalogIn.c
#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c
#: ports/nrf/common-hal/analogio/AnalogIn.c
-#: ports/stm32f4/common-hal/analogio/AnalogIn.c
+#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Pin does not have ADC capabilities"
msgstr "Nóżka nie obsługuje ADC"
+#: ports/stm/common-hal/pulseio/PulseIn.c
+msgid "Pin number already reserved by EXTI"
+msgstr ""
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid ""
+"Pinout uses %d bytes per element, which consumes more than the ideal %d "
+"bytes. If this cannot be avoided, pass allow_inefficient=True to the "
+"constructor"
+msgstr ""
+
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr "Oraz moduły w systemie plików\n"
@@ -1154,26 +1224,31 @@ msgstr ""
msgid "Press any key to enter the REPL. Use CTRL-D to reload."
msgstr "Dowolny klawisz aby uruchomić konsolę. CTRL-D aby przeładować."
+#: shared-module/_protomatter/Protomatter.c
+#, c-format
+msgid "Protomatter internal error #%d"
+msgstr ""
+
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Pull not used when direction is output."
msgstr "Podciągnięcie nieużywane w trybie wyjścia."
-#: ports/stm32f4/common-hal/pulseio/PulseIn.c
-msgid "PulseIn not yet supported"
-msgstr ""
-
-#: ports/stm32f4/common-hal/pulseio/PulseOut.c
-msgid "PulseOut not yet supported"
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid "PulseOut not supported on this chip"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/stm/common-hal/os/__init__.c
msgid "RNG Init Error"
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "RS485 inversion specified when not in RS485 mode"
+msgstr ""
+
#: ports/cxd56/common-hal/rtc/RTC.c ports/mimxrt10xx/common-hal/rtc/RTC.c
#: ports/nrf/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
@@ -1183,7 +1258,12 @@ msgstr "Brak obsługi kalibracji RTC"
msgid "RTC is not supported on this board"
msgstr "Brak obsługi RTC"
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
+#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+msgid "RTS/CTS/RS485 Not yet supported on this device"
+msgstr ""
+
+#: ports/stm/common-hal/os/__init__.c
msgid "Random number generation error"
msgstr ""
@@ -1223,11 +1303,11 @@ msgstr "Uruchomiony tryb bezpieczeństwa! Zapisany kod nie jest uruchamiany.\n"
msgid "SDA or SCL needs a pull up"
msgstr "SDA lub SCL wymagają podciągnięcia"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Re-initialization error"
msgstr ""
@@ -1244,6 +1324,14 @@ msgstr "Zbyt wysoka częstotliwość próbkowania. Musi być mniejsza niż %d"
msgid "Scan already in progess. Stop with stop_scan."
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Selected CTS pin not valid"
+msgstr ""
+
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Selected RTS pin not valid"
+msgstr ""
+
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "Serializer in use"
@@ -1270,10 +1358,14 @@ msgstr "Stos musi mieć co najmniej 256 bajtów"
msgid "Stream missing readinto() or write() method."
msgstr "Strumień nie ma metod readinto() lub write()."
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Supply at least one UART pin"
msgstr ""
+#: ports/stm/common-hal/microcontroller/Processor.c
+msgid "Temperature read timed out"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid ""
"The CircuitPython heap was corrupted because the stack was too small.\n"
@@ -1329,13 +1421,11 @@ msgstr "Szerokość bitmapy musi być wielokrotnością szerokości kafelka"
msgid "Too many channels in sample."
msgstr "Zbyt wiele kanałów."
-#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
-#: shared-bindings/displayio/ParallelBus.c
+#: shared-module/displayio/__init__.c
msgid "Too many display busses"
msgstr "Zbyt wiele magistrali"
-#: shared-bindings/displayio/Display.c
-#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-module/displayio/__init__.c
msgid "Too many displays"
msgstr "Zbyt wiele wyświetlaczy"
@@ -1347,23 +1437,23 @@ msgstr "Ślad wyjątku (najnowsze wywołanie na końcu):\n"
msgid "Tuple or struct_time argument required"
msgstr "Wymagana krotka lub struct_time"
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Buffer allocation error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART De-init error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Re-init error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART write error"
msgstr ""
@@ -1482,6 +1572,10 @@ msgstr ""
msgid "Viper functions don't currently support more than 4 arguments"
msgstr "Funkcje Viper nie obsługują obecnie więcej niż 4 argumentów"
+#: ports/stm/common-hal/microcontroller/Processor.c
+msgid "Voltage read timed out"
+msgstr ""
+
#: main.c
msgid "WARNING: Your code filename has two extensions\n"
msgstr "UWAGA: Nazwa pliku ma dwa rozszerzenia\n"
@@ -1545,10 +1639,18 @@ msgstr "adres poza zakresem"
msgid "addresses is empty"
msgstr "adres jest pusty"
+#: extmod/ulab/code/vectorise.c
+msgid "arctan2 is implemented for scalars and ndarrays only"
+msgstr ""
+
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr "arg jest puste"
+#: extmod/ulab/code/numerical.c
+msgid "argsort argument must be an ndarray"
+msgstr ""
+
#: py/runtime.c
msgid "argument has wrong type"
msgstr "argument ma zły typ"
@@ -1562,14 +1664,34 @@ msgstr "zła liczba lub typ argumentów"
msgid "argument should be a '%q' not a '%q'"
msgstr "argument powinien być '%q' a nie '%q'"
+#: extmod/ulab/code/linalg.c
+msgid "arguments must be ndarrays"
+msgstr ""
+
#: py/objarray.c shared-bindings/nvm/ByteArray.c
msgid "array/bytes required on right side"
msgstr "tablica/bytes wymagane po prawej stronie"
+#: extmod/ulab/code/numerical.c
+msgid "attempt to get argmin/argmax of an empty sequence"
+msgstr ""
+
#: py/objstr.c
msgid "attributes not supported yet"
msgstr "atrybuty nie są jeszcze obsługiwane"
+#: extmod/ulab/code/numerical.c
+msgid "axis must be -1, 0, None, or 1"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "axis must be -1, 0, or 1"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "axis must be None, 0, or 1"
+msgstr ""
+
#: py/builtinevex.c
msgid "bad compile mode"
msgstr "zły tryb kompilacji"
@@ -1812,6 +1934,10 @@ msgstr "nie można zaimportować nazwy %q"
msgid "cannot perform relative import"
msgstr "nie można wykonać relatywnego importu"
+#: extmod/ulab/code/ndarray.c
+msgid "cannot reshape array (incompatible input/output shape)"
+msgstr ""
+
#: py/emitnative.c
msgid "casting"
msgstr "rzutowanie"
@@ -1868,6 +1994,30 @@ msgstr "stała musi być liczbą całkowitą"
msgid "conversion to object"
msgstr "konwersja do obiektu"
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must be linear arrays"
+msgstr ""
+
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must be ndarrays"
+msgstr ""
+
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must not be empty"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "could not broadast input array from shape"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "could not invert Vandermonde matrix"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "ddof must be smaller than length of data set"
+msgstr ""
+
#: py/parsenum.c
msgid "decimal numbers not supported"
msgstr "liczby dziesiętne nieobsługiwane"
@@ -1894,6 +2044,10 @@ msgstr "destination_length musi być nieujemną liczbą całkowitą"
msgid "dict update sequence has wrong length"
msgstr "sekwencja ma złą długość"
+#: extmod/ulab/code/numerical.c
+msgid "diff argument must be an ndarray"
+msgstr ""
+
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@@ -1964,6 +2118,26 @@ msgstr "nadmiarowe argumenty nazwane"
msgid "extra positional arguments given"
msgstr "nadmiarowe argumenty pozycyjne"
+#: py/parse.c
+msgid "f-string expression part cannot include a '#'"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string expression part cannot include a backslash"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: empty expression not allowed"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: expecting '}'"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: single '}' is not allowed"
+msgstr ""
+
#: shared-bindings/audiocore/WaveFile.c shared-bindings/audiomp3/MP3Decoder.c
#: shared-bindings/displayio/OnDiskBitmap.c
msgid "file must be a file opened in byte mode"
@@ -1973,6 +2147,14 @@ msgstr "file musi być otwarte w trybie bajtowym"
msgid "filesystem must provide mount method"
msgstr "system plików musi mieć metodę mount"
+#: extmod/ulab/code/ndarray.c
+msgid "first argument must be an iterable"
+msgstr ""
+
+#: extmod/ulab/code/vectorise.c
+msgid "first argument must be an ndarray"
+msgstr ""
+
#: py/objtype.c
msgid "first argument to super() must be type"
msgstr "pierwszy argument super() musi być typem"
@@ -1981,6 +2163,14 @@ msgstr "pierwszy argument super() musi być typem"
msgid "firstbit must be MSB"
msgstr "firstbit musi być MSB"
+#: extmod/ulab/code/ndarray.c
+msgid "flattening order must be either 'C', or 'F'"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "flip argument must be an ndarray"
+msgstr ""
+
#: py/objint.c
msgid "float too big"
msgstr "float zbyt wielki"
@@ -2073,9 +2263,14 @@ msgstr "niepełny klucz formatu"
msgid "incorrect padding"
msgstr "złe wypełnienie"
+#: extmod/ulab/code/ndarray.c
+msgid "index is out of bounds"
+msgstr ""
+
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
-#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c
+#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c
msgid "index out of range"
msgstr "indeks poza zakresem"
@@ -2083,10 +2278,46 @@ msgstr "indeks poza zakresem"
msgid "indices must be integers"
msgstr "indeksy muszą być całkowite"
+#: extmod/ulab/code/ndarray.c
+msgid "indices must be integers, slices, or Boolean lists"
+msgstr ""
+
#: py/compile.c
msgid "inline assembler must be a function"
msgstr "wtrącony asembler musi być funkcją"
+#: extmod/ulab/code/create.c
+msgid "input argument must be an integer or a 2-tuple"
+msgstr ""
+
+#: extmod/ulab/code/fft.c
+msgid "input array length must be power of 2"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "input data must be an iterable"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input matrix is asymmetric"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input matrix is singular"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input must be square matrix"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "input must be tuple, list, range, or ndarray"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "input vectors must be of equal length"
+msgstr ""
+
#: py/parsenum.c
msgid "int() arg 2 must be >= 2 and <= 36"
msgstr "argument 2 do int() busi być pomiędzy 2 a 36"
@@ -2165,6 +2396,14 @@ msgstr "argument 1 dla issubclass() musi być klasą"
msgid "issubclass() arg 2 must be a class or a tuple of classes"
msgstr "argument 2 dla issubclass() musi być klasą lub krotką klas"
+#: extmod/ulab/code/ndarray.c
+msgid "iterables are not of the same length"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "iterations did not converge"
+msgstr ""
+
#: py/objstr.c
msgid "join expects a list of str/bytes objects consistent with self object"
msgstr "join oczekuje listy str/bytes zgodnych z self"
@@ -2213,6 +2452,10 @@ msgstr "zmienna lokalna użyta przed przypisaniem"
msgid "long int not supported in this build"
msgstr "long int jest nieobsługiwany"
+#: py/parse.c
+msgid "malformed f-string"
+msgstr ""
+
#: shared-bindings/_stage/Layer.c
msgid "map buffer too small"
msgstr "bufor mapy zbyt mały"
@@ -2221,6 +2464,14 @@ msgstr "bufor mapy zbyt mały"
msgid "math domain error"
msgstr "błąd domeny"
+#: extmod/ulab/code/linalg.c
+msgid "matrix dimensions do not match"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "matrix is not positive definite"
+msgstr ""
+
#: ports/nrf/common-hal/_bleio/Characteristic.c
#: ports/nrf/common-hal/_bleio/Descriptor.c
#, c-format
@@ -2244,6 +2495,10 @@ msgstr "alokacja pamięci nie powiodła się, sterta zablokowana"
msgid "module not found"
msgstr "brak modułu"
+#: extmod/ulab/code/poly.c
+msgid "more degrees of freedom than data points"
+msgstr ""
+
#: py/compile.c
msgid "multiple *x in assignment"
msgstr "wiele *x w przypisaniu"
@@ -2268,6 +2523,10 @@ msgstr "sck/mosi/miso muszą być podane"
msgid "must use keyword argument for key function"
msgstr "funkcja key musi być podana jako argument nazwany"
+#: extmod/ulab/code/numerical.c
+msgid "n must be between 0, and 9"
+msgstr ""
+
#: py/runtime.c
msgid "name '%q' is not defined"
msgstr "nazwa '%q' niezdefiniowana"
@@ -2354,6 +2613,14 @@ msgstr "nie wszystkie argumenty wykorzystane w formatowaniu"
msgid "not enough arguments for format string"
msgstr "nie dość argumentów przy formatowaniu"
+#: extmod/ulab/code/poly.c
+msgid "number of arguments must be 2, or 3"
+msgstr ""
+
+#: extmod/ulab/code/create.c
+msgid "number of points must be at least 2"
+msgstr ""
+
#: py/obj.c
#, c-format
msgid "object '%s' is not a tuple or list"
@@ -2421,6 +2688,18 @@ msgstr ""
msgid "only slices with step=1 (aka None) are supported"
msgstr "tylko fragmenty ze step=1 (lub None) są wspierane"
+#: extmod/ulab/code/ndarray.c extmod/ulab/code/vectorise.c
+msgid "operands could not be broadcast together"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "operation is not implemented on ndarrays"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "operation is not supported for given type"
+msgstr ""
+
#: py/modbuiltins.c
msgid "ord expects a character"
msgstr "ord oczekuje znaku"
@@ -2470,6 +2749,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "pop from an empty PulseIn"
msgstr "pop z pustego PulseIn"
@@ -2497,6 +2777,14 @@ msgstr "trzyargumentowe pow() wymaga liczb całkowitych"
msgid "queue overflow"
msgstr "przepełnienie kolejki"
+#: py/parse.c
+msgid "raw f-strings are not implemented"
+msgstr ""
+
+#: extmod/ulab/code/fft.c
+msgid "real and imaginary parts must be of equal length"
+msgstr ""
+
#: py/builtinimport.c
msgid "relative import"
msgstr "relatywny import"
@@ -2514,6 +2802,20 @@ msgstr "anotacja wartości musi być identyfikatorem"
msgid "return expected '%q' but got '%q'"
msgstr "return oczekiwał '%q', a jest '%q'"
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "rgb_pins[%d] duplicates another pin assignment"
+msgstr ""
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "rgb_pins[%d] is not on the same port as clock"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "right hand side must be an ndarray, or a scalar"
+msgstr ""
+
#: py/objstr.c
msgid "rsplit(None,n)"
msgstr "rsplit(None,n)"
@@ -2537,6 +2839,10 @@ msgstr "stos planu pełen"
msgid "script compilation not supported"
msgstr "kompilowanie skryptów nieobsługiwane"
+#: extmod/ulab/code/ndarray.c
+msgid "shape must be a 2-tuple"
+msgstr ""
+
#: py/objstr.c
msgid "sign not allowed in string format specifier"
msgstr "znak jest niedopuszczalny w specyfikacji formatu łańcucha"
@@ -2549,6 +2855,10 @@ msgstr "znak jest niedopuszczalny w specyfikacji 'c'"
msgid "single '}' encountered in format string"
msgstr "pojedynczy '}' w specyfikacji formatu"
+#: extmod/ulab/code/linalg.c
+msgid "size is defined for ndarrays only"
+msgstr ""
+
#: shared-bindings/time/__init__.c
msgid "sleep length must be non-negative"
msgstr "okres snu musi być nieujemny"
@@ -2565,6 +2875,10 @@ msgstr "przepełnienie small int"
msgid "soft reboot\n"
msgstr "programowy reset\n"
+#: extmod/ulab/code/numerical.c
+msgid "sort argument must be an ndarray"
+msgstr ""
+
#: py/objstr.c
msgid "start/end indices"
msgstr "początkowe/końcowe indeksy"
@@ -2654,12 +2968,16 @@ msgstr "timestamp poza zakresem dla time_t na tej platformie"
msgid "too many arguments provided with the given format"
msgstr "zbyt wiele argumentów podanych dla tego formatu"
+#: extmod/ulab/code/ndarray.c
+msgid "too many indices"
+msgstr ""
+
#: py/runtime.c
#, c-format
msgid "too many values to unpack (expected %d)"
msgstr "zbyt wiele wartości do rozpakowania (oczekiwano %d)"
-#: py/objstr.c
+#: extmod/ulab/code/linalg.c py/objstr.c
msgid "tuple index out of range"
msgstr "indeks krotki poza zakresem"
@@ -2673,6 +2991,7 @@ msgstr "wymagana krotka/lista po prawej stronie"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
+#: shared-bindings/busio/UART.c
msgid "tx and rx cannot both be None"
msgstr "tx i rx nie mogą być oba None"
@@ -2790,6 +3109,14 @@ msgstr "value_count musi być > 0"
msgid "window must be <= interval"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "wrong argument type"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "wrong index type"
+msgstr ""
+
#: py/objstr.c
msgid "wrong number of arguments"
msgstr "zła liczba argumentów"
@@ -2798,6 +3125,10 @@ msgstr "zła liczba argumentów"
msgid "wrong number of values to unpack"
msgstr "zła liczba wartości do rozpakowania"
+#: extmod/ulab/code/ndarray.c
+msgid "wrong operand type"
+msgstr ""
+
#: shared-module/displayio/Shape.c
msgid "x value out of bounds"
msgstr "x poza zakresem"
diff --git a/locale/pt_BR.po b/locale/pt_BR.po
index e5dde29f4..6ef31ef4a 100644
--- a/locale/pt_BR.po
+++ b/locale/pt_BR.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-02-05 15:55-0800\n"
+"POT-Creation-Date: 2020-04-15 10:24-0400\n"
"PO-Revision-Date: 2018-10-02 21:14-0000\n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -53,6 +53,11 @@ msgstr " saída:\n"
msgid "%%c requires int or char"
msgstr "%%c requer int ou char"
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "%d address pins and %d rgb pins indicate a height of %d, not %d"
+msgstr ""
+
#: shared-bindings/microcontroller/Pin.c
msgid "%q in use"
msgstr "%q em uso"
@@ -135,6 +140,10 @@ msgstr ""
msgid "'%s' integer 0x%x does not fit in mask 0x%x"
msgstr ""
+#: py/runtime.c
+msgid "'%s' object cannot assign attribute '%q'"
+msgstr ""
+
#: py/proto.c
msgid "'%s' object does not support '%q'"
msgstr ""
@@ -186,6 +195,10 @@ msgid "'align' requires 1 argument"
msgstr ""
#: py/compile.c
+msgid "'async for' or 'async with' outside async function"
+msgstr ""
+
+#: py/compile.c
msgid "'await' outside function"
msgstr ""
@@ -276,7 +289,7 @@ msgstr "Todos os temporizadores para este pino estão em uso"
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
#: ports/cxd56/common-hal/pulseio/PulseOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
-#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c
+#: ports/nrf/peripherals/nrf/timers.c shared-bindings/pulseio/PWMOut.c
#: shared-module/_pew/PewPew.c
msgid "All timers in use"
msgstr "Todos os temporizadores em uso"
@@ -316,6 +329,10 @@ msgstr "Array deve conter meias palavras (tipo 'H')"
msgid "Array values should be single bytes."
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+msgid "At most %d %q may be specified (not %d)"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
@@ -331,6 +348,7 @@ msgid ""
msgstr ""
#: shared-module/displayio/Display.c
+#: shared-module/framebufferio/FramebufferDisplay.c
msgid "Below minimum frame rate"
msgstr ""
@@ -346,7 +364,9 @@ msgstr ""
msgid "Both pins must support hardware interrupts"
msgstr "Ambos os pinos devem suportar interrupções de hardware"
+#: shared-bindings/_protomatter/Protomatter.c
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness must be 0-1.0"
msgstr ""
@@ -355,6 +375,7 @@ msgid "Brightness must be between 0 and 255"
msgstr "O brilho deve estar entre 0 e 255"
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness not adjustable"
msgstr ""
@@ -369,10 +390,12 @@ msgid "Buffer incorrect size. Should be %d bytes."
msgstr "Buffer de tamanho incorreto. Deve ser %d bytes."
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is not a bytearray."
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is too small"
msgstr ""
@@ -389,6 +412,11 @@ msgstr ""
msgid "Buffer too large and unable to allocate"
msgstr ""
+#: shared-bindings/_bleio/PacketBuffer.c
+#, c-format
+msgid "Buffer too short by %d bytes"
+msgstr ""
+
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
#: ports/nrf/common-hal/displayio/ParallelBus.c
#, fuzzy, c-format
@@ -457,6 +485,10 @@ msgstr ""
msgid "Cannot set value when direction is input."
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Cannot specify RTS or CTS in RS485 mode"
+msgstr ""
+
#: py/objslice.c
msgid "Cannot subclass slice"
msgstr ""
@@ -469,7 +501,7 @@ msgstr "Não é possível transferir sem os pinos MOSI e MISO."
msgid "Cannot unambiguously get sizeof scalar"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Cannot vary frequency on a timer that is already in use"
msgstr ""
@@ -531,31 +563,31 @@ msgstr ""
msgid "Could not initialize UART"
msgstr "Não foi possível inicializar o UART"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not initialize channel"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not initialize timer"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not re-init channel"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not re-init timer"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not restart PWM"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not start PWM"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Could not start interrupt, RX busy"
msgstr ""
@@ -581,11 +613,11 @@ msgstr "Não pôde alocar segundo buffer"
msgid "Crash into the HardFault_Handler."
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Channel Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Device Init Error"
msgstr ""
@@ -620,11 +652,13 @@ msgid "DigitalInOut not supported on given pin"
msgstr ""
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Display must have a 16 bit colorspace."
msgstr ""
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Display rotation must be in 90 degree increments"
msgstr ""
@@ -678,6 +712,10 @@ msgstr ""
msgid "Extended advertisements with scan response not supported."
msgstr ""
+#: extmod/ulab/code/fft.c
+msgid "FFT is defined for ndarrays only"
+msgstr ""
+
#: shared-bindings/ps2io/Ps2.c
msgid "Failed sending command."
msgstr "Falha ao enviar comando."
@@ -695,6 +733,7 @@ msgstr "Falha ao alocar buffer RX"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
msgstr "Falha ao alocar buffer RX de %d bytes"
@@ -728,7 +767,7 @@ msgstr "Arquivo já existe"
msgid "Frequency captured is above capability. Capture Paused."
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Frequency must match existing PWMOut using this timer"
msgstr ""
@@ -739,6 +778,7 @@ msgstr ""
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Group already used"
msgstr ""
@@ -746,11 +786,11 @@ msgstr ""
msgid "Group full"
msgstr "Grupo cheio"
-#: ports/stm32f4/common-hal/busio/I2C.c ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c
msgid "Hardware busy, try alternative pins"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Hardware in use, try alternative pins"
msgstr ""
@@ -758,7 +798,7 @@ msgstr ""
msgid "I/O operation on closed file"
msgstr "Operação I/O no arquivo fechado"
-#: ports/stm32f4/common-hal/busio/I2C.c
+#: ports/stm/common-hal/busio/I2C.c
msgid "I2C Init Error"
msgstr ""
@@ -788,7 +828,7 @@ msgstr ""
msgid "Insufficient encryption"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr ""
@@ -797,7 +837,7 @@ msgstr ""
msgid "Invalid %q pin"
msgstr "Pino do %q inválido"
-#: ports/stm32f4/common-hal/analogio/AnalogIn.c
+#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Invalid ADC Unit value"
msgstr ""
@@ -805,11 +845,11 @@ msgstr ""
msgid "Invalid BMP file"
msgstr "Arquivo BMP inválido"
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "Invalid DAC pin supplied"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/stm32f4/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c
msgid "Invalid I2C pin selection"
msgstr ""
@@ -819,16 +859,15 @@ msgstr ""
msgid "Invalid PWM frequency"
msgstr "Frequência PWM inválida"
-#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm32f4/common-hal/busio/SPI.c
+#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c
msgid "Invalid SPI pin selection"
msgstr ""
-#: ports/mimxrt10xx/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
msgid "Invalid UART pin selection"
msgstr ""
-#: py/moduerrno.c
+#: py/moduerrno.c shared-module/_protomatter/Protomatter.c
msgid "Invalid argument"
msgstr "Argumento inválido"
@@ -836,7 +875,7 @@ msgstr "Argumento inválido"
msgid "Invalid bits per value"
msgstr ""
-#: ports/nrf/common-hal/busio/UART.c ports/stm32f4/common-hal/busio/UART.c
+#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
#, fuzzy
msgid "Invalid buffer size"
msgstr "Arquivo inválido"
@@ -866,7 +905,7 @@ msgstr "Arquivo inválido"
msgid "Invalid format chunk size"
msgstr "Tamanho do pedaço de formato inválido"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Invalid frequency supplied"
msgstr ""
@@ -879,12 +918,13 @@ msgid "Invalid number of bits"
msgstr "Número inválido de bits"
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
+#: shared-bindings/displayio/FourWire.c
msgid "Invalid phase"
msgstr "Fase Inválida"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/atmel-samd/common-hal/touchio/TouchIn.c
-#: shared-bindings/pulseio/PWMOut.c
+#: shared-bindings/pulseio/PWMOut.c shared-module/_protomatter/Protomatter.c
msgid "Invalid pin"
msgstr "Pino inválido"
@@ -902,11 +942,15 @@ msgstr "Pino inválido para canal direito"
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c
#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c
#: ports/cxd56/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
msgid "Invalid pins"
msgstr "Pinos inválidos"
+#: ports/stm/common-hal/pulseio/PWMOut.c
+msgid "Invalid pins for PWMOut"
+msgstr ""
+
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
+#: shared-bindings/displayio/FourWire.c
msgid "Invalid polarity"
msgstr ""
@@ -935,7 +979,7 @@ msgstr "certificado inválido"
msgid "Invalid wave file"
msgstr "Aqruivo de ondas inválido"
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Invalid word/bit length"
msgstr ""
@@ -984,7 +1028,7 @@ msgstr ""
msgid "Microphone startup delay must be in range 0.0 to 1.0"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "Missing MISO or MOSI Pin"
msgstr ""
@@ -992,10 +1036,19 @@ msgstr ""
msgid "Must be a %q subclass."
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "Must provide MISO or MOSI pin"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "Must use a multiple of 6 rgb pins, not %d"
+msgstr ""
+
+#: py/parse.c
+msgid "Name too long"
+msgstr ""
+
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Negative step not supported"
msgstr ""
@@ -1005,7 +1058,7 @@ msgid "No CCCD for this Characteristic"
msgstr ""
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "No DAC on chip"
msgstr "Nenhum DAC no chip"
@@ -1014,23 +1067,23 @@ msgstr "Nenhum DAC no chip"
msgid "No DMA channel found"
msgstr "Nenhum canal DMA encontrado"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "No MISO Pin"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "No MOSI Pin"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "No RX pin"
msgstr "Nenhum pino RX"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "No TX pin"
msgstr "Nenhum pino TX"
@@ -1059,7 +1112,7 @@ msgstr "Sem suporte de hardware no pino de clock"
msgid "No hardware support on pin"
msgstr "Nenhum suporte de hardware no pino"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "No more timers available on this pin."
msgstr ""
@@ -1075,6 +1128,10 @@ msgstr ""
msgid "No such file/directory"
msgstr ""
+#: shared-module/_protomatter/Protomatter.c
+msgid "No timer available"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid "Nordic Soft Device failure assertion."
msgstr ""
@@ -1132,7 +1189,8 @@ msgid ""
"PWM frequency not writable when variable_frequency is False on construction."
msgstr ""
-#: ports/stm32f4/common-hal/displayio/ParallelBus.c
+#: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c
+#: ports/stm/common-hal/displayio/ParallelBus.c
msgid "ParallelBus not yet supported"
msgstr ""
@@ -1144,10 +1202,22 @@ msgstr "Permissão negada"
#: ports/cxd56/common-hal/analogio/AnalogIn.c
#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c
#: ports/nrf/common-hal/analogio/AnalogIn.c
-#: ports/stm32f4/common-hal/analogio/AnalogIn.c
+#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Pin does not have ADC capabilities"
msgstr "O pino não tem recursos de ADC"
+#: ports/stm/common-hal/pulseio/PulseIn.c
+msgid "Pin number already reserved by EXTI"
+msgstr ""
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid ""
+"Pinout uses %d bytes per element, which consumes more than the ideal %d "
+"bytes. If this cannot be avoided, pass allow_inefficient=True to the "
+"constructor"
+msgstr ""
+
#: py/builtinhelp.c
#, fuzzy
msgid "Plus any modules on the filesystem\n"
@@ -1165,26 +1235,31 @@ msgstr ""
msgid "Press any key to enter the REPL. Use CTRL-D to reload."
msgstr ""
-#: shared-bindings/digitalio/DigitalInOut.c
-msgid "Pull not used when direction is output."
+#: shared-module/_protomatter/Protomatter.c
+#, c-format
+msgid "Protomatter internal error #%d"
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PulseIn.c
-msgid "PulseIn not yet supported"
+#: shared-bindings/digitalio/DigitalInOut.c
+msgid "Pull not used when direction is output."
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PulseOut.c
-msgid "PulseOut not yet supported"
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid "PulseOut not supported on this chip"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/stm/common-hal/os/__init__.c
msgid "RNG Init Error"
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "RS485 inversion specified when not in RS485 mode"
+msgstr ""
+
#: ports/cxd56/common-hal/rtc/RTC.c ports/mimxrt10xx/common-hal/rtc/RTC.c
#: ports/nrf/common-hal/rtc/RTC.c
msgid "RTC calibration is not supported on this board"
@@ -1194,7 +1269,12 @@ msgstr "A calibração RTC não é suportada nesta placa"
msgid "RTC is not supported on this board"
msgstr "O RTC não é suportado nesta placa"
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
+#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+msgid "RTS/CTS/RS485 Not yet supported on this device"
+msgstr ""
+
+#: ports/stm/common-hal/os/__init__.c
msgid "Random number generation error"
msgstr ""
@@ -1235,11 +1315,11 @@ msgstr "Rodando em modo seguro! Não está executando o código salvo.\n"
msgid "SDA or SCL needs a pull up"
msgstr "SDA ou SCL precisa de um pull up"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Re-initialization error"
msgstr ""
@@ -1256,6 +1336,14 @@ msgstr "Taxa de amostragem muito alta. Deve ser menor que %d"
msgid "Scan already in progess. Stop with stop_scan."
msgstr ""
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Selected CTS pin not valid"
+msgstr ""
+
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Selected RTS pin not valid"
+msgstr ""
+
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "Serializer in use"
@@ -1282,10 +1370,14 @@ msgstr "O tamanho da pilha deve ser pelo menos 256"
msgid "Stream missing readinto() or write() method."
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Supply at least one UART pin"
msgstr ""
+#: ports/stm/common-hal/microcontroller/Processor.c
+msgid "Temperature read timed out"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid ""
"The CircuitPython heap was corrupted because the stack was too small.\n"
@@ -1341,13 +1433,11 @@ msgstr ""
msgid "Too many channels in sample."
msgstr "Muitos canais na amostra."
-#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
-#: shared-bindings/displayio/ParallelBus.c
+#: shared-module/displayio/__init__.c
msgid "Too many display busses"
msgstr ""
-#: shared-bindings/displayio/Display.c
-#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-module/displayio/__init__.c
msgid "Too many displays"
msgstr ""
@@ -1359,23 +1449,23 @@ msgstr ""
msgid "Tuple or struct_time argument required"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Buffer allocation error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART De-init error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Init Error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Re-init error"
msgstr ""
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART write error"
msgstr ""
@@ -1495,6 +1585,10 @@ msgstr ""
msgid "Viper functions don't currently support more than 4 arguments"
msgstr ""
+#: ports/stm/common-hal/microcontroller/Processor.c
+msgid "Voltage read timed out"
+msgstr ""
+
#: main.c
msgid "WARNING: Your code filename has two extensions\n"
msgstr "AVISO: Seu arquivo de código tem duas extensões\n"
@@ -1555,10 +1649,18 @@ msgstr ""
msgid "addresses is empty"
msgstr ""
+#: extmod/ulab/code/vectorise.c
+msgid "arctan2 is implemented for scalars and ndarrays only"
+msgstr ""
+
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "argsort argument must be an ndarray"
+msgstr ""
+
#: py/runtime.c
msgid "argument has wrong type"
msgstr "argumento tem tipo errado"
@@ -1572,14 +1674,34 @@ msgstr ""
msgid "argument should be a '%q' not a '%q'"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "arguments must be ndarrays"
+msgstr ""
+
#: py/objarray.c shared-bindings/nvm/ByteArray.c
msgid "array/bytes required on right side"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "attempt to get argmin/argmax of an empty sequence"
+msgstr ""
+
#: py/objstr.c
msgid "attributes not supported yet"
msgstr "atributos ainda não suportados"
+#: extmod/ulab/code/numerical.c
+msgid "axis must be -1, 0, None, or 1"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "axis must be -1, 0, or 1"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "axis must be None, 0, or 1"
+msgstr ""
+
#: py/builtinevex.c
msgid "bad compile mode"
msgstr ""
@@ -1825,6 +1947,10 @@ msgstr "não pode importar nome %q"
msgid "cannot perform relative import"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "cannot reshape array (incompatible input/output shape)"
+msgstr ""
+
#: py/emitnative.c
msgid "casting"
msgstr ""
@@ -1881,6 +2007,30 @@ msgstr "constante deve ser um inteiro"
msgid "conversion to object"
msgstr ""
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must be linear arrays"
+msgstr ""
+
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must be ndarrays"
+msgstr ""
+
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must not be empty"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "could not broadast input array from shape"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "could not invert Vandermonde matrix"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "ddof must be smaller than length of data set"
+msgstr ""
+
#: py/parsenum.c
msgid "decimal numbers not supported"
msgstr ""
@@ -1906,6 +2056,10 @@ msgstr "destination_length deve ser um int >= 0"
msgid "dict update sequence has wrong length"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "diff argument must be an ndarray"
+msgstr ""
+
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@@ -1977,6 +2131,26 @@ msgstr "argumentos extras de palavras-chave passados"
msgid "extra positional arguments given"
msgstr "argumentos extra posicionais passados"
+#: py/parse.c
+msgid "f-string expression part cannot include a '#'"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string expression part cannot include a backslash"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: empty expression not allowed"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: expecting '}'"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: single '}' is not allowed"
+msgstr ""
+
#: shared-bindings/audiocore/WaveFile.c shared-bindings/audiomp3/MP3Decoder.c
#: shared-bindings/displayio/OnDiskBitmap.c
msgid "file must be a file opened in byte mode"
@@ -1986,6 +2160,14 @@ msgstr ""
msgid "filesystem must provide mount method"
msgstr "sistema de arquivos deve fornecer método de montagem"
+#: extmod/ulab/code/ndarray.c
+msgid "first argument must be an iterable"
+msgstr ""
+
+#: extmod/ulab/code/vectorise.c
+msgid "first argument must be an ndarray"
+msgstr ""
+
#: py/objtype.c
msgid "first argument to super() must be type"
msgstr ""
@@ -1994,6 +2176,14 @@ msgstr ""
msgid "firstbit must be MSB"
msgstr "firstbit devem ser MSB"
+#: extmod/ulab/code/ndarray.c
+msgid "flattening order must be either 'C', or 'F'"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "flip argument must be an ndarray"
+msgstr ""
+
#: py/objint.c
msgid "float too big"
msgstr "float muito grande"
@@ -2086,9 +2276,14 @@ msgstr ""
msgid "incorrect padding"
msgstr "preenchimento incorreto"
+#: extmod/ulab/code/ndarray.c
+msgid "index is out of bounds"
+msgstr ""
+
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
-#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c
+#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c
msgid "index out of range"
msgstr "Índice fora do intervalo"
@@ -2096,10 +2291,46 @@ msgstr "Índice fora do intervalo"
msgid "indices must be integers"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "indices must be integers, slices, or Boolean lists"
+msgstr ""
+
#: py/compile.c
msgid "inline assembler must be a function"
msgstr ""
+#: extmod/ulab/code/create.c
+msgid "input argument must be an integer or a 2-tuple"
+msgstr ""
+
+#: extmod/ulab/code/fft.c
+msgid "input array length must be power of 2"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "input data must be an iterable"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input matrix is asymmetric"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input matrix is singular"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input must be square matrix"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "input must be tuple, list, range, or ndarray"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "input vectors must be of equal length"
+msgstr ""
+
#: py/parsenum.c
msgid "int() arg 2 must be >= 2 and <= 36"
msgstr ""
@@ -2178,6 +2409,14 @@ msgstr ""
msgid "issubclass() arg 2 must be a class or a tuple of classes"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "iterables are not of the same length"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "iterations did not converge"
+msgstr ""
+
#: py/objstr.c
msgid "join expects a list of str/bytes objects consistent with self object"
msgstr ""
@@ -2226,6 +2465,10 @@ msgstr ""
msgid "long int not supported in this build"
msgstr ""
+#: py/parse.c
+msgid "malformed f-string"
+msgstr ""
+
#: shared-bindings/_stage/Layer.c
msgid "map buffer too small"
msgstr ""
@@ -2234,6 +2477,14 @@ msgstr ""
msgid "math domain error"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "matrix dimensions do not match"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "matrix is not positive definite"
+msgstr ""
+
#: ports/nrf/common-hal/_bleio/Characteristic.c
#: ports/nrf/common-hal/_bleio/Descriptor.c
#, c-format
@@ -2257,6 +2508,10 @@ msgstr ""
msgid "module not found"
msgstr ""
+#: extmod/ulab/code/poly.c
+msgid "more degrees of freedom than data points"
+msgstr ""
+
#: py/compile.c
msgid "multiple *x in assignment"
msgstr ""
@@ -2281,6 +2536,10 @@ msgstr "deve especificar todos sck/mosi/miso"
msgid "must use keyword argument for key function"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "n must be between 0, and 9"
+msgstr ""
+
#: py/runtime.c
msgid "name '%q' is not defined"
msgstr ""
@@ -2367,6 +2626,14 @@ msgstr ""
msgid "not enough arguments for format string"
msgstr ""
+#: extmod/ulab/code/poly.c
+msgid "number of arguments must be 2, or 3"
+msgstr ""
+
+#: extmod/ulab/code/create.c
+msgid "number of points must be at least 2"
+msgstr ""
+
#: py/obj.c
#, c-format
msgid "object '%s' is not a tuple or list"
@@ -2434,6 +2701,18 @@ msgstr ""
msgid "only slices with step=1 (aka None) are supported"
msgstr ""
+#: extmod/ulab/code/ndarray.c extmod/ulab/code/vectorise.c
+msgid "operands could not be broadcast together"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "operation is not implemented on ndarrays"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "operation is not supported for given type"
+msgstr ""
+
#: py/modbuiltins.c
msgid "ord expects a character"
msgstr ""
@@ -2482,6 +2761,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "pop from an empty PulseIn"
msgstr ""
@@ -2509,6 +2789,14 @@ msgstr ""
msgid "queue overflow"
msgstr "estouro de fila"
+#: py/parse.c
+msgid "raw f-strings are not implemented"
+msgstr ""
+
+#: extmod/ulab/code/fft.c
+msgid "real and imaginary parts must be of equal length"
+msgstr ""
+
#: py/builtinimport.c
msgid "relative import"
msgstr ""
@@ -2526,6 +2814,20 @@ msgstr ""
msgid "return expected '%q' but got '%q'"
msgstr ""
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "rgb_pins[%d] duplicates another pin assignment"
+msgstr ""
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "rgb_pins[%d] is not on the same port as clock"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "right hand side must be an ndarray, or a scalar"
+msgstr ""
+
#: py/objstr.c
msgid "rsplit(None,n)"
msgstr ""
@@ -2548,6 +2850,10 @@ msgstr ""
msgid "script compilation not supported"
msgstr "compilação de script não suportada"
+#: extmod/ulab/code/ndarray.c
+msgid "shape must be a 2-tuple"
+msgstr ""
+
#: py/objstr.c
msgid "sign not allowed in string format specifier"
msgstr ""
@@ -2560,6 +2866,10 @@ msgstr ""
msgid "single '}' encountered in format string"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "size is defined for ndarrays only"
+msgstr ""
+
#: shared-bindings/time/__init__.c
msgid "sleep length must be non-negative"
msgstr ""
@@ -2576,6 +2886,10 @@ msgstr ""
msgid "soft reboot\n"
msgstr ""
+#: extmod/ulab/code/numerical.c
+msgid "sort argument must be an ndarray"
+msgstr ""
+
#: py/objstr.c
msgid "start/end indices"
msgstr ""
@@ -2667,12 +2981,16 @@ msgstr "timestamp fora do intervalo para a plataforma time_t"
msgid "too many arguments provided with the given format"
msgstr "Muitos argumentos fornecidos com o formato dado"
+#: extmod/ulab/code/ndarray.c
+msgid "too many indices"
+msgstr ""
+
#: py/runtime.c
#, c-format
msgid "too many values to unpack (expected %d)"
msgstr ""
-#: py/objstr.c
+#: extmod/ulab/code/linalg.c py/objstr.c
msgid "tuple index out of range"
msgstr ""
@@ -2686,6 +3004,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
+#: shared-bindings/busio/UART.c
msgid "tx and rx cannot both be None"
msgstr "TX e RX não podem ser ambos"
@@ -2803,6 +3122,14 @@ msgstr ""
msgid "window must be <= interval"
msgstr ""
+#: extmod/ulab/code/linalg.c
+msgid "wrong argument type"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "wrong index type"
+msgstr ""
+
#: py/objstr.c
msgid "wrong number of arguments"
msgstr ""
@@ -2811,6 +3138,10 @@ msgstr ""
msgid "wrong number of values to unpack"
msgstr ""
+#: extmod/ulab/code/ndarray.c
+msgid "wrong operand type"
+msgstr ""
+
#: shared-module/displayio/Shape.c
msgid "x value out of bounds"
msgstr ""
diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po
index dbe1605b6..253760ff5 100644
--- a/locale/zh_Latn_pinyin.po
+++ b/locale/zh_Latn_pinyin.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: circuitpython-cn\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-02-05 15:55-0800\n"
+"POT-Creation-Date: 2020-04-15 10:24-0400\n"
"PO-Revision-Date: 2019-04-13 10:10-0700\n"
"Last-Translator: hexthat\n"
"Language-Team: Chinese Hanyu Pinyin\n"
@@ -31,12 +31,17 @@ msgid ""
"Please file an issue with the contents of your CIRCUITPY drive at \n"
"https://github.com/adafruit/circuitpython/issues\n"
msgstr ""
+"\n"
+"Qǐng tōngguò https://github.com/adafruit/circuitpython/issues\n"
+"tíjiāo yǒuguān nín de CIRCUITPY qūdòngqì nèiróng de wèntí \n"
#: supervisor/shared/safe_mode.c
msgid ""
"\n"
"To exit, please reset the board without "
msgstr ""
+"\n"
+"Qǐng zài méiyǒu _ de qíngkuàng xià chóng zhì bǎn zǐ yǐ tuìchū "
#: py/obj.c
msgid " File \"%q\""
@@ -55,6 +60,11 @@ msgstr " shūchū:\n"
msgid "%%c requires int or char"
msgstr "%%c xūyào zhěngshù huò char"
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "%d address pins and %d rgb pins indicate a height of %d, not %d"
+msgstr ""
+
#: shared-bindings/microcontroller/Pin.c
msgid "%q in use"
msgstr "%q zhèngzài shǐyòng"
@@ -135,9 +145,13 @@ msgstr "'%s' zhěngshù %d bùzài fànwéi nèi %d.%d"
msgid "'%s' integer 0x%x does not fit in mask 0x%x"
msgstr "'%s' zhěngshù 0x%x bù shìyòng yú yǎn mǎ 0x%x"
+#: py/runtime.c
+msgid "'%s' object cannot assign attribute '%q'"
+msgstr ""
+
#: py/proto.c
msgid "'%s' object does not support '%q'"
-msgstr ""
+msgstr "'%s' duì xiàng bù zhīchí '%q'"
#: py/obj.c
#, c-format
@@ -186,6 +200,10 @@ msgid "'align' requires 1 argument"
msgstr "'align' xūyào 1 gè cānshù"
#: py/compile.c
+msgid "'async for' or 'async with' outside async function"
+msgstr ""
+
+#: py/compile.c
msgid "'await' outside function"
msgstr "'await' wàibù gōngnéng"
@@ -275,18 +293,18 @@ msgstr "Cǐ yǐn jiǎo de suǒyǒu jìshí qì zhèngzài shǐyòng"
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
#: ports/cxd56/common-hal/pulseio/PulseOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
-#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c
+#: ports/nrf/peripherals/nrf/timers.c shared-bindings/pulseio/PWMOut.c
#: shared-module/_pew/PewPew.c
msgid "All timers in use"
msgstr "Suǒyǒu jìshí qì shǐyòng"
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Already advertising."
-msgstr ""
+msgstr "Mùqián zhèngzài guǎngbò"
#: ports/cxd56/common-hal/analogio/AnalogIn.c
msgid "AnalogIn not supported on given pin"
-msgstr ""
+msgstr "Gěi dìng de yǐn jiǎo bù zhīchí AnalogIn"
#: ports/cxd56/common-hal/analogio/AnalogOut.c
#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c
@@ -315,9 +333,13 @@ msgstr "Shùzǔ bìxū bāohán bàn zìshù (type 'H')"
msgid "Array values should be single bytes."
msgstr "Shùzǔ zhí yīnggāi shì dāngè zì jié."
+#: shared-bindings/_protomatter/Protomatter.c
+msgid "At most %d %q may be specified (not %d)"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
-msgstr ""
+msgstr "MicroPython VM zài wèi yùnxíng shí chángshì fēnpèi duī."
#: main.c
msgid "Auto-reload is off.\n"
@@ -332,6 +354,7 @@ msgstr ""
"huò shūrù REPL jìnyòng.\n"
#: shared-module/displayio/Display.c
+#: shared-module/framebufferio/FramebufferDisplay.c
msgid "Below minimum frame rate"
msgstr "Dī yú zuìdī zhèng sùlǜ"
@@ -347,7 +370,9 @@ msgstr "Bǐtè shēndù bìxū shì 8 bèi yǐshàng."
msgid "Both pins must support hardware interrupts"
msgstr "Liǎng gè yǐn jiǎo dōu bìxū zhīchí yìngjiàn zhōngduàn"
+#: shared-bindings/_protomatter/Protomatter.c
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness must be 0-1.0"
msgstr "Liàngdù bìxū wèi 0-1.0"
@@ -356,13 +381,14 @@ msgid "Brightness must be between 0 and 255"
msgstr "Liàngdù bìxū jiè yú 0 dào 255 zhī jiān"
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness not adjustable"
msgstr "Liàngdù wúfǎ tiáozhěng"
#: shared-bindings/_bleio/UUID.c
#, c-format
msgid "Buffer + offset too small %d %d %d"
-msgstr ""
+msgstr "Huǎnchōng qū hé piān yí liàng tài xiǎo %d %d %d"
#: shared-module/usb_hid/Device.c
#, c-format
@@ -370,10 +396,12 @@ msgid "Buffer incorrect size. Should be %d bytes."
msgstr "Huǎnchōng qū dàxiǎo bù zhèngquè. Yīnggāi shì %d zì jié."
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is not a bytearray."
msgstr "Huǎnchōng qū bùshì bytearray"
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is too small"
msgstr "Huǎnchōng qū tài xiǎo"
@@ -388,6 +416,11 @@ msgstr "Huǎnchōng qū bìxū zhìshǎo chángdù 1"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Buffer too large and unable to allocate"
+msgstr "huǎn chōng qū tài dà , wú fǎ fēn pèi"
+
+#: shared-bindings/_bleio/PacketBuffer.c
+#, c-format
+msgid "Buffer too short by %d bytes"
msgstr ""
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
@@ -410,7 +443,7 @@ msgstr "Zài fǎngwèn běn jī wùjiàn zhīqián diàoyòng super().__init__()
#: ports/nrf/common-hal/_bleio/Characteristic.c
msgid "Can't set CCCD on local Characteristic"
-msgstr ""
+msgstr "Wúfǎ jiāng CCCD shèzhì wéi běndì tèzhēng"
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
msgid "Cannot delete values"
@@ -428,7 +461,7 @@ msgstr "Wúfǎ huòqǔ wēndù"
#: shared-bindings/_bleio/Adapter.c
msgid "Cannot have scan responses for extended, connectable advertisements."
-msgstr ""
+msgstr "Nín wúfǎ sǎomiáo kuòzhǎn de, kě liánjiē de guǎnggào."
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
msgid "Cannot output both channels on the same pin"
@@ -456,6 +489,10 @@ msgstr "Wúfǎ chóng zhì wèi bootloader, yīnwèi méiyǒu bootloader cúnzà
msgid "Cannot set value when direction is input."
msgstr "Dāng fāngxiàng xiàng nèi shí, bùnéng shèzhì gāi zhí."
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Cannot specify RTS or CTS in RS485 mode"
+msgstr ""
+
#: py/objslice.c
msgid "Cannot subclass slice"
msgstr "Wúfǎ zi fēnlèi"
@@ -468,9 +505,9 @@ msgstr "Méiyǒu MOSI/MISO jiù wúfǎ zhuǎnyí."
msgid "Cannot unambiguously get sizeof scalar"
msgstr "Wúfǎ míngquè de huòdé biāoliàng de dàxiǎo"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Cannot vary frequency on a timer that is already in use"
-msgstr ""
+msgstr "Wúfǎ gēnggǎi yǐ zài shǐyòng de jìshí qì shàng de pínlǜ"
#: shared-module/bitbangio/SPI.c
msgid "Cannot write without MOSI pin."
@@ -482,13 +519,15 @@ msgstr "Wèi tígōng zìfú huǎncún xiě rù"
#: supervisor/shared/safe_mode.c
msgid "CircuitPython core code crashed hard. Whoops!\n"
-msgstr ""
+msgstr "CircuitPython de héxīn chūxiàn gùzhàng. Āiyā!\n"
#: supervisor/shared/safe_mode.c
msgid ""
"CircuitPython is in safe mode because you pressed the reset button during "
"boot. Press again to exit safe mode.\n"
msgstr ""
+"CircuitPython chǔyú ānquán móshì, yīnwèi zài yǐndǎo guòchéng zhōng àn xiàle "
+"chóng zhì ànniǔ. Zài àn yīcì tuìchū ānquán móshì.\n"
#: shared-module/bitbangio/SPI.c
msgid "Clock pin init failed."
@@ -515,7 +554,7 @@ msgstr "Mìnglìng bìxū shì 0 dào 255 zhī jiān de int"
msgid ""
"Connection has been disconnected and can no longer be used. Create a new "
"connection."
-msgstr ""
+msgstr "Liánjiē yǐ duàn kāi, wúfǎ zài shǐyòng. Chuàngjiàn yīgè xīn de liánjiē."
#: py/persistentcode.c
msgid "Corrupt .mpy file"
@@ -529,37 +568,37 @@ msgstr "Sǔnhuài de yuánshǐ dàimǎ"
msgid "Could not initialize UART"
msgstr "Wúfǎ chūshǐhuà UART"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not initialize channel"
-msgstr ""
+msgstr "Wúfǎ chūshǐhuà píndào"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not initialize timer"
-msgstr ""
+msgstr "Wúfǎ chūshǐhuà jìshí qì"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not re-init channel"
-msgstr ""
+msgstr "Wúfǎ chóngxīn chūshǐhuà píndào"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not re-init timer"
-msgstr ""
+msgstr "Wúfǎ chóngxīn qǐdòng jìshí qì"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not restart PWM"
-msgstr ""
+msgstr "Wúfǎ chóngqǐ PWM"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Could not start PWM"
-msgstr ""
+msgstr "Wúfǎ qǐdòng PWM"
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Could not start interrupt, RX busy"
-msgstr ""
+msgstr "Wúfǎ qǐdòng zhōngduàn,RX máng"
#: shared-module/audiomp3/MP3Decoder.c
msgid "Couldn't allocate decoder"
-msgstr ""
+msgstr "Zhǎo bù dào jiěmǎ qì"
#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c
#: shared-module/audiomp3/MP3Decoder.c
@@ -568,7 +607,7 @@ msgstr "Wúfǎ fēnpèi dì yī gè huǎnchōng qū"
#: shared-module/audiomp3/MP3Decoder.c
msgid "Couldn't allocate input buffer"
-msgstr ""
+msgstr "Wúfǎ fēnpèi shūrù huǎnchōng qū"
#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c
#: shared-module/audiomp3/MP3Decoder.c
@@ -577,15 +616,15 @@ msgstr "Wúfǎ fēnpèi dì èr gè huǎnchōng qū"
#: supervisor/shared/safe_mode.c
msgid "Crash into the HardFault_Handler."
-msgstr ""
+msgstr "Zhuìhuǐ. Shūrù HardFault_Handler."
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Channel Init Error"
-msgstr ""
+msgstr "DAC tōngdào chūshǐhuà cuòwù"
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Device Init Error"
-msgstr ""
+msgstr "DAC shèbèi chūshǐhuà cuòwù"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
msgid "DAC already in use"
@@ -614,14 +653,16 @@ msgstr "Zhèngzài shǐyòng de shèbèi"
#: ports/cxd56/common-hal/digitalio/DigitalInOut.c
msgid "DigitalInOut not supported on given pin"
-msgstr ""
+msgstr "Gěi dìng de yǐn jiǎo bù zhīchí DigitalInOut"
#: shared-bindings/displayio/Display.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Display must have a 16 bit colorspace."
msgstr "Xiǎnshì bìxū jùyǒu 16 wèi yánsè kōngjiān."
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Display rotation must be in 90 degree increments"
msgstr "Xiǎnshì xuánzhuǎn bìxū 90 dù jiā xīn"
@@ -671,6 +712,10 @@ msgstr "Qīwàng de chángdù wèi %d de yuán zǔ, dédào %d"
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Extended advertisements with scan response not supported."
+msgstr "Bù zhīchí dài yǒu sǎomiáo xiǎngyìng de kuòzhǎn guǎngbò."
+
+#: extmod/ulab/code/fft.c
+msgid "FFT is defined for ndarrays only"
msgstr ""
#: shared-bindings/ps2io/Ps2.c
@@ -690,13 +735,14 @@ msgstr "Fēnpèi RX huǎnchōng shībài"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
msgstr "Fēnpèi RX huǎnchōng qū%d zì jié shībài"
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Failed to connect: internal error"
-msgstr ""
+msgstr "Liánjiē shībài: Nèibù cuòwù"
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Failed to connect: timeout"
@@ -704,7 +750,7 @@ msgstr "Liánjiē shībài: Chāoshí"
#: shared-module/audiomp3/MP3Decoder.c
msgid "Failed to parse MP3 file"
-msgstr ""
+msgstr "Wúfǎ jiěxī MP3 wénjiàn"
#: ports/nrf/sd_mutex.c
#, c-format
@@ -713,7 +759,7 @@ msgstr "Wúfǎ shìfàng mutex, err 0x%04x"
#: supervisor/shared/safe_mode.c
msgid "Failed to write internal flash."
-msgstr ""
+msgstr "Wúfǎ xiě rù nèibù shǎncún."
#: py/moduerrno.c
msgid "File exists"
@@ -723,9 +769,9 @@ msgstr "Wénjiàn cúnzài"
msgid "Frequency captured is above capability. Capture Paused."
msgstr "Pínlǜ bǔhuò gāo yú nénglì. Bǔhuò zàntíng."
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Frequency must match existing PWMOut using this timer"
-msgstr ""
+msgstr "Pínlǜ bìxū yǔ shǐyòng cǐ jìshí qì de xiàn yǒu PWMOut xiāng pǐpèi"
#: shared-bindings/bitbangio/I2C.c shared-bindings/bitbangio/SPI.c
#: shared-bindings/busio/I2C.c shared-bindings/busio/SPI.c
@@ -734,6 +780,7 @@ msgstr "Hánshù xūyào suǒdìng"
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Group already used"
msgstr "Jítuán yǐjīng shǐyòngguò"
@@ -741,21 +788,21 @@ msgstr "Jítuán yǐjīng shǐyòngguò"
msgid "Group full"
msgstr "Fēnzǔ yǐ mǎn"
-#: ports/stm32f4/common-hal/busio/I2C.c ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c
msgid "Hardware busy, try alternative pins"
-msgstr ""
+msgstr "Yìngjiàn máng, qǐng chángshì qítā zhēnjiǎo"
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Hardware in use, try alternative pins"
-msgstr ""
+msgstr "Shǐyòng de yìngjiàn, qǐng chángshì qítā yǐn jiǎo"
#: extmod/vfs_posix_file.c py/objstringio.c
msgid "I/O operation on closed file"
msgstr "Wénjiàn shàng de I/ O cāozuò"
-#: ports/stm32f4/common-hal/busio/I2C.c
+#: ports/stm/common-hal/busio/I2C.c
msgid "I2C Init Error"
-msgstr ""
+msgstr "I2C chūshǐhuà cuòwù"
#: extmod/machine_i2c.c
msgid "I2C operation not supported"
@@ -785,30 +832,30 @@ msgstr "Rènzhèng bùzú"
msgid "Insufficient encryption"
msgstr "Jiāmì bùzú"
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
-msgstr ""
+msgstr "Nèibù dìngyì cuòwù"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "Invalid %q pin"
msgstr "Wúxiào de %q yǐn jiǎo"
-#: ports/stm32f4/common-hal/analogio/AnalogIn.c
+#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Invalid ADC Unit value"
-msgstr ""
+msgstr "Wúxiào de ADC dānwèi zhí"
#: shared-module/displayio/OnDiskBitmap.c
msgid "Invalid BMP file"
msgstr "Wúxiào de BMP wénjiàn"
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "Invalid DAC pin supplied"
-msgstr ""
+msgstr "Tí gōng liǎo wúxiào de DAC yǐn jiǎo"
-#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/stm32f4/common-hal/busio/I2C.c
+#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c
msgid "Invalid I2C pin selection"
-msgstr ""
+msgstr "Wúxiào de I2C yǐn jiǎo xuǎnzé"
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c
#: ports/cxd56/common-hal/pulseio/PWMOut.c
@@ -816,16 +863,15 @@ msgstr ""
msgid "Invalid PWM frequency"
msgstr "Wúxiào de PWM pínlǜ"
-#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm32f4/common-hal/busio/SPI.c
+#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c
msgid "Invalid SPI pin selection"
-msgstr ""
+msgstr "Wúxiào de SPI yǐn jiǎo xuǎnzé"
-#: ports/mimxrt10xx/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
msgid "Invalid UART pin selection"
-msgstr ""
+msgstr "Wúxiào de UART yǐn jiǎo xuǎnzé"
-#: py/moduerrno.c
+#: py/moduerrno.c shared-module/_protomatter/Protomatter.c
msgid "Invalid argument"
msgstr "Wúxiào de cānshù"
@@ -833,13 +879,13 @@ msgstr "Wúxiào de cānshù"
msgid "Invalid bits per value"
msgstr "Měi gè zhí de wèi wúxiào"
-#: ports/nrf/common-hal/busio/UART.c ports/stm32f4/common-hal/busio/UART.c
+#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
msgid "Invalid buffer size"
msgstr "Wúxiào de huǎnchōng qū dàxiǎo"
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Invalid byteorder string"
-msgstr ""
+msgstr "Wúxiào de zì jié shùnxù zìfú chuàn"
#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c
msgid "Invalid capture period. Valid range: 1 - 500"
@@ -861,25 +907,26 @@ msgstr "Wúxiào de wénjiàn"
msgid "Invalid format chunk size"
msgstr "Géshì kuài dàxiǎo wúxiào"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "Invalid frequency supplied"
-msgstr ""
+msgstr "Tígōng de pínlǜ wúxiào"
#: supervisor/shared/safe_mode.c
msgid "Invalid memory access."
-msgstr ""
+msgstr "Wúxiào de nèicún fǎngwèn."
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
msgid "Invalid number of bits"
msgstr "Wèi shù wúxiào"
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
+#: shared-bindings/displayio/FourWire.c
msgid "Invalid phase"
msgstr "Jiēduàn wúxiào"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/atmel-samd/common-hal/touchio/TouchIn.c
-#: shared-bindings/pulseio/PWMOut.c
+#: shared-bindings/pulseio/PWMOut.c shared-module/_protomatter/Protomatter.c
msgid "Invalid pin"
msgstr "Wúxiào de yǐn jiǎo"
@@ -897,11 +944,15 @@ msgstr "Yòuxián tōngdào yǐn jiǎo wúxiào"
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c
#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c
#: ports/cxd56/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
msgid "Invalid pins"
msgstr "Wúxiào de yǐn jiǎo"
+#: ports/stm/common-hal/pulseio/PWMOut.c
+msgid "Invalid pins for PWMOut"
+msgstr ""
+
#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c
+#: shared-bindings/displayio/FourWire.c
msgid "Invalid polarity"
msgstr "Wúxiào liǎng jí zhí"
@@ -929,9 +980,9 @@ msgstr "Wúxiào de yǔyīn jìshù"
msgid "Invalid wave file"
msgstr "Wúxiào de làng làngcháo wénjiàn"
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Invalid word/bit length"
-msgstr ""
+msgstr "Wúxiào de zì/wèi chángdù"
#: py/compile.c
msgid "LHS of keyword arg must be an id"
@@ -968,38 +1019,47 @@ msgstr "Jìngxiàng shí de zuìdà X zhí wèi%d"
#: supervisor/shared/safe_mode.c
msgid "MicroPython NLR jump failed. Likely memory corruption."
-msgstr ""
+msgstr "MicroPython NLR tiào zhuǎn shībài. Kěnéng shì nèicún sǔnhuài."
#: supervisor/shared/safe_mode.c
msgid "MicroPython fatal error."
-msgstr ""
+msgstr "MicroPython zhìmìng cuòwù."
#: shared-bindings/audiobusio/PDMIn.c
msgid "Microphone startup delay must be in range 0.0 to 1.0"
msgstr "Màikèfēng qǐdòng yánchí bìxū zài 0.0 Dào 1.0 De fànwéi nèi"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "Missing MISO or MOSI Pin"
-msgstr ""
+msgstr "Quēshǎo MISO huò MOSI yǐn jiǎo"
#: shared-bindings/displayio/Group.c
msgid "Must be a %q subclass."
msgstr "Bìxū shì %q zi lèi."
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "Must provide MISO or MOSI pin"
+msgstr "Bìxū tígōng MISO huò MOSI yǐn jiǎo"
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "Must use a multiple of 6 rgb pins, not %d"
+msgstr ""
+
+#: py/parse.c
+msgid "Name too long"
msgstr ""
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Negative step not supported"
-msgstr ""
+msgstr "Bù zhīchí fù bù"
#: ports/nrf/common-hal/_bleio/Characteristic.c
msgid "No CCCD for this Characteristic"
msgstr "Zhège tèzhēng méiyǒu CCCD"
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c
-#: ports/stm32f4/common-hal/analogio/AnalogOut.c
+#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "No DAC on chip"
msgstr "Méiyǒu DAC zài xīnpiàn shàng de"
@@ -1008,23 +1068,23 @@ msgstr "Méiyǒu DAC zài xīnpiàn shàng de"
msgid "No DMA channel found"
msgstr "Wèi zhǎodào DMA píndào"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "No MISO Pin"
-msgstr ""
+msgstr "Méiyǒu MISO yǐn jiǎo"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "No MOSI Pin"
-msgstr ""
+msgstr "Méiyǒu MOSI yǐn jiǎo"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "No RX pin"
msgstr "Wèi zhǎodào RX yǐn jiǎo"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "No TX pin"
msgstr "Wèi zhǎodào TX yǐn jiǎo"
@@ -1053,9 +1113,9 @@ msgstr "Shízhōng yǐn jiǎo wú yìngjiàn zhīchí"
msgid "No hardware support on pin"
msgstr "Méiyǒu zài yǐn jiǎo shàng de yìngjiàn zhīchí"
-#: ports/stm32f4/common-hal/pulseio/PWMOut.c
+#: ports/stm/common-hal/pulseio/PWMOut.c
msgid "No more timers available on this pin."
-msgstr ""
+msgstr "Gāi yǐn jiǎo shàng méiyǒu kěyòng de dìngshí qì."
#: shared-module/touchio/TouchIn.c
msgid "No pulldown on pin; 1Mohm recommended"
@@ -1069,9 +1129,13 @@ msgstr "Shèbèi shàng méiyǒu kònggé"
msgid "No such file/directory"
msgstr "Méiyǒu cǐ lèi wénjiàn/mùlù"
+#: shared-module/_protomatter/Protomatter.c
+msgid "No timer available"
+msgstr ""
+
#: supervisor/shared/safe_mode.c
msgid "Nordic Soft Device failure assertion."
-msgstr ""
+msgstr "Nordic ruǎn shèbèi gùzhàng shēngmíng."
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
@@ -1111,6 +1175,8 @@ msgid ""
"Only monochrome, indexed 4bpp or 8bpp, and 16bpp or greater BMPs supported: "
"%d bpp given"
msgstr ""
+"Jǐn zhīchí dān sè, suǒyǐn wéi 4bpp huò 8bpp yǐjí 16bpp huò gèng gāo de BMP: "
+"Gěi chū %d bpp"
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
@@ -1127,9 +1193,10 @@ msgid ""
"PWM frequency not writable when variable_frequency is False on construction."
msgstr "Dāng biànliàng_pínlǜ shì False zài jiànzhú shí PWM pínlǜ bùkě xiě."
-#: ports/stm32f4/common-hal/displayio/ParallelBus.c
+#: ports/mimxrt10xx/common-hal/displayio/ParallelBus.c
+#: ports/stm/common-hal/displayio/ParallelBus.c
msgid "ParallelBus not yet supported"
-msgstr ""
+msgstr "Shàng bù zhīchí ParallelBus"
#: py/moduerrno.c
msgid "Permission denied"
@@ -1139,10 +1206,22 @@ msgstr "Quánxiàn bèi jùjué"
#: ports/cxd56/common-hal/analogio/AnalogIn.c
#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c
#: ports/nrf/common-hal/analogio/AnalogIn.c
-#: ports/stm32f4/common-hal/analogio/AnalogIn.c
+#: ports/stm/common-hal/analogio/AnalogIn.c
msgid "Pin does not have ADC capabilities"
msgstr "Pin méiyǒu ADC nénglì"
+#: ports/stm/common-hal/pulseio/PulseIn.c
+msgid "Pin number already reserved by EXTI"
+msgstr ""
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid ""
+"Pinout uses %d bytes per element, which consumes more than the ideal %d "
+"bytes. If this cannot be avoided, pass allow_inefficient=True to the "
+"constructor"
+msgstr ""
+
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr "Zài wénjiàn xìtǒng shàng tiānjiā rènhé mókuài\n"
@@ -1153,30 +1232,35 @@ msgstr "Cóng kōng de Ps2 huǎnchōng qū dànchū"
#: shared-bindings/_bleio/Adapter.c
msgid "Prefix buffer must be on the heap"
-msgstr ""
+msgstr "Qiánzhuì huǎnchōng qū bìxū zài duī shàng"
#: main.c
msgid "Press any key to enter the REPL. Use CTRL-D to reload."
msgstr "Àn xià rènhé jiàn jìnrù REPL. Shǐyòng CTRL-D chóngxīn jiāzài."
+#: shared-module/_protomatter/Protomatter.c
+#, c-format
+msgid "Protomatter internal error #%d"
+msgstr ""
+
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Pull not used when direction is output."
msgstr "Fāngxiàng shūchū shí Pull méiyǒu shǐyòng."
-#: ports/stm32f4/common-hal/pulseio/PulseIn.c
-msgid "PulseIn not yet supported"
-msgstr ""
-
-#: ports/stm32f4/common-hal/pulseio/PulseOut.c
-msgid "PulseOut not yet supported"
+#: ports/stm/common-hal/pulseio/PulseOut.c
+msgid "PulseOut not supported on this chip"
msgstr ""
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
-msgstr ""
+msgstr "RNG qǔxiāo chūshǐhuà cuòwù"
-#: ports/stm32f4/common-hal/os/__init__.c
+#: ports/stm/common-hal/os/__init__.c
msgid "RNG Init Error"
+msgstr "RNG chūshǐhuà cuòwù"
+
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "RS485 inversion specified when not in RS485 mode"
msgstr ""
#: ports/cxd56/common-hal/rtc/RTC.c ports/mimxrt10xx/common-hal/rtc/RTC.c
@@ -1188,10 +1272,15 @@ msgstr "Cǐ bǎn bù zhīchí RTC jiàozhǔn"
msgid "RTC is not supported on this board"
msgstr "Cǐ bǎn bù zhīchí RTC"
-#: ports/stm32f4/common-hal/os/__init__.c
-msgid "Random number generation error"
+#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
+#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c
+msgid "RTS/CTS/RS485 Not yet supported on this device"
msgstr ""
+#: ports/stm/common-hal/os/__init__.c
+msgid "Random number generation error"
+msgstr "Suíjī shù shēngchéng cuòwù"
+
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr "Zhǐ dú"
@@ -1228,13 +1317,13 @@ msgstr "Zài ānquán móshì xià yùnxíng! Bù yùnxíng yǐ bǎocún de dài
msgid "SDA or SCL needs a pull up"
msgstr "SDA huò SCL xūyào lādòng"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Init Error"
-msgstr ""
+msgstr "SPI chūshǐhuà cuòwù"
-#: ports/stm32f4/common-hal/busio/SPI.c
+#: ports/stm/common-hal/busio/SPI.c
msgid "SPI Re-initialization error"
-msgstr ""
+msgstr "SPI chóngxīn chūshǐhuà cuòwù"
#: shared-bindings/audiomixer/Mixer.c
msgid "Sample rate must be positive"
@@ -1247,6 +1336,14 @@ msgstr "Cǎiyàng lǜ tài gāo. Tā bìxū xiǎoyú %d"
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Scan already in progess. Stop with stop_scan."
+msgstr "Zhèngzài jìn háng sǎomiáo. Shǐyòng stop_scan tíngzhǐ."
+
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Selected CTS pin not valid"
+msgstr ""
+
+#: ports/mimxrt10xx/common-hal/busio/UART.c
+msgid "Selected RTS pin not valid"
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
@@ -1275,8 +1372,12 @@ msgstr "Duīzhàn dàxiǎo bìxū zhìshǎo 256"
msgid "Stream missing readinto() or write() method."
msgstr "Liú quēshǎo readinto() huò write() fāngfǎ."
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "Supply at least one UART pin"
+msgstr "Dìngyì zhìshǎo yīgè UART yǐn jiǎo"
+
+#: ports/stm/common-hal/microcontroller/Processor.c
+msgid "Temperature read timed out"
msgstr ""
#: supervisor/shared/safe_mode.c
@@ -1284,6 +1385,8 @@ msgid ""
"The CircuitPython heap was corrupted because the stack was too small.\n"
"Please increase the stack size if you know how, or if not:"
msgstr ""
+"Yóuyú duīzhàn tài xiǎo,CircuitPython duī yǐ sǔnhuài.\n"
+"Rúguǒ nín zhīdào rúhé zēngjiā duīzhàn dàxiǎo, fǒuzé:"
#: supervisor/shared/safe_mode.c
msgid ""
@@ -1299,6 +1402,9 @@ msgid ""
"enough power for the whole circuit and press reset (after ejecting "
"CIRCUITPY).\n"
msgstr ""
+"wēi kòng zhì qì de gōng lǜ jiàng dī. Quèbǎo nín de diànyuán wèi zhěnggè\n"
+"diànlù tígōng zúgòu de diànyuán, bìng àn xià fùwèi (Dànchū CIRCUITPY "
+"zhīhòu).\n"
#: shared-module/audiomixer/MixerVoice.c
msgid "The sample's bits_per_sample does not match the mixer's"
@@ -1336,13 +1442,11 @@ msgstr "Píng pū kuāndù bìxū huàfēn wèi tú kuāndù"
msgid "Too many channels in sample."
msgstr "Chōuyàng zhōng de píndào tài duō."
-#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
-#: shared-bindings/displayio/ParallelBus.c
+#: shared-module/displayio/__init__.c
msgid "Too many display busses"
msgstr "Xiǎnshì zǒngxiàn tài duōle"
-#: shared-bindings/displayio/Display.c
-#: shared-bindings/displayio/EPaperDisplay.c
+#: shared-module/displayio/__init__.c
msgid "Too many displays"
msgstr "Xiǎnshì tài duō"
@@ -1354,25 +1458,25 @@ msgstr "Traceback (Zuìjìn yīcì dǎ diànhuà):\n"
msgid "Tuple or struct_time argument required"
msgstr "Xūyào Tuple huò struct_time cānshù"
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Buffer allocation error"
-msgstr ""
+msgstr "UART huǎnchōng qū fēnpèi cuòwù"
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART De-init error"
-msgstr ""
+msgstr "UART qǔxiāo chūshǐhuà cuòwù"
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Init Error"
-msgstr ""
+msgstr "UART chūshǐhuà cuòwù"
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART Re-init error"
-msgstr ""
+msgstr "UART chóngxīn chūshǐhuà cuòwù"
-#: ports/stm32f4/common-hal/busio/UART.c
+#: ports/stm/common-hal/busio/UART.c
msgid "UART write error"
-msgstr ""
+msgstr "UART xiě cuòwù"
#: shared-module/usb_hid/Device.c
msgid "USB Busy"
@@ -1428,21 +1532,21 @@ msgstr "Yìwài de nrfx uuid lèixíng"
#: ports/nrf/common-hal/_bleio/__init__.c
#, c-format
msgid "Unknown gatt error: 0x%04x"
-msgstr ""
+msgstr "Wèizhī de gatt cuòwù: 0x%04x"
#: supervisor/shared/safe_mode.c
msgid "Unknown reason."
-msgstr ""
+msgstr "Yuányīn bùmíng."
#: ports/nrf/common-hal/_bleio/__init__.c
#, c-format
msgid "Unknown security error: 0x%04x"
-msgstr ""
+msgstr "Wèizhī de ānquán cuòwù: 0x%04x"
#: ports/nrf/common-hal/_bleio/__init__.c
#, c-format
msgid "Unknown soft device error: %04x"
-msgstr ""
+msgstr "Wèizhī de ruǎn shèbèi cuòwù: %04x"
#: shared-bindings/_pixelbuf/PixelBuf.c
#, c-format
@@ -1454,6 +1558,8 @@ msgid ""
"Unspecified issue. Can be that the pairing prompt on the other device was "
"declined or ignored."
msgstr ""
+"Wèi zhǐdìng de wèntí. Kěnéng shì qítā shèbèi shàng de pèiduì tíshì bèi jùjué "
+"huò hūlüè."
#: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c
msgid "Unsupported baudrate"
@@ -1489,6 +1595,10 @@ msgstr "Zhí chángdù > zuìdà chángdù"
msgid "Viper functions don't currently support more than 4 arguments"
msgstr "Viper hánshù mùqián bù zhīchí chāoguò 4 gè cānshù"
+#: ports/stm/common-hal/microcontroller/Processor.c
+msgid "Voltage read timed out"
+msgstr ""
+
#: main.c
msgid "WARNING: Your code filename has two extensions\n"
msgstr "Jǐnggào: Nǐ de dàimǎ wénjiàn míng yǒu liǎng gè kuòzhǎn míng\n"
@@ -1510,11 +1620,11 @@ msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Writes not supported on Characteristic"
-msgstr ""
+msgstr "Tèzhēng bù zhīchí xiě rù"
#: supervisor/shared/safe_mode.c
msgid "You are in safe mode: something unanticipated happened.\n"
-msgstr ""
+msgstr "Nín chǔyú ānquán móshì: Chū hū yìliào de shìqíng fāshēngle.\n"
#: supervisor/shared/safe_mode.c
msgid "You requested starting safe mode by "
@@ -1554,10 +1664,18 @@ msgstr "dìzhǐ chāochū biānjiè"
msgid "addresses is empty"
msgstr "dìzhǐ wèi kōng"
+#: extmod/ulab/code/vectorise.c
+msgid "arctan2 is implemented for scalars and ndarrays only"
+msgstr ""
+
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr "cānshù shì yīgè kōng de xùliè"
+#: extmod/ulab/code/numerical.c
+msgid "argsort argument must be an ndarray"
+msgstr ""
+
#: py/runtime.c
msgid "argument has wrong type"
msgstr "cānshù lèixíng cuòwù"
@@ -1571,14 +1689,34 @@ msgstr "cānshù biānhào/lèixíng bù pǐpèi"
msgid "argument should be a '%q' not a '%q'"
msgstr "cānshù yīnggāi shì '%q', 'bùshì '%q'"
+#: extmod/ulab/code/linalg.c
+msgid "arguments must be ndarrays"
+msgstr ""
+
#: py/objarray.c shared-bindings/nvm/ByteArray.c
msgid "array/bytes required on right side"
msgstr "yòu cè xūyào shùzǔ/zì jié"
+#: extmod/ulab/code/numerical.c
+msgid "attempt to get argmin/argmax of an empty sequence"
+msgstr ""
+
#: py/objstr.c
msgid "attributes not supported yet"
msgstr "shǔxìng shàngwèi zhīchí"
+#: extmod/ulab/code/numerical.c
+msgid "axis must be -1, 0, None, or 1"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "axis must be -1, 0, or 1"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "axis must be None, 0, or 1"
+msgstr ""
+
#: py/builtinevex.c
msgid "bad compile mode"
msgstr "biānyì móshì cuòwù"
@@ -1646,7 +1784,7 @@ msgstr "zì jié dàimǎ wèi zhíxíng"
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "byteorder is not a string"
-msgstr ""
+msgstr "byteorder bùshì zìfú chuàn"
#: ports/atmel-samd/common-hal/busio/UART.c
msgid "bytes > 8 bits not supported"
@@ -1821,6 +1959,10 @@ msgstr "wúfǎ dǎorù míngchēng %q"
msgid "cannot perform relative import"
msgstr "wúfǎ zhíxíng xiāngguān dǎorù"
+#: extmod/ulab/code/ndarray.c
+msgid "cannot reshape array (incompatible input/output shape)"
+msgstr ""
+
#: py/emitnative.c
msgid "casting"
msgstr "tóuyǐng"
@@ -1845,6 +1987,7 @@ msgstr ""
#: shared-bindings/displayio/Palette.c
msgid "color buffer must be a buffer, tuple, list, or int"
msgstr ""
+"Yánsè huǎnchōng qū bìxū shì huǎnchōng qū, yuán zǔ, lièbiǎo huò zhěngshù"
#: shared-bindings/displayio/Palette.c
msgid "color buffer must be a bytearray or array of type 'b' or 'B'"
@@ -1879,6 +2022,30 @@ msgstr "chángshù bìxū shì yīgè zhěngshù"
msgid "conversion to object"
msgstr "zhuǎnhuàn wèi duìxiàng"
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must be linear arrays"
+msgstr ""
+
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must be ndarrays"
+msgstr ""
+
+#: extmod/ulab/code/filter.c
+msgid "convolve arguments must not be empty"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "could not broadast input array from shape"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "could not invert Vandermonde matrix"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "ddof must be smaller than length of data set"
+msgstr ""
+
#: py/parsenum.c
msgid "decimal numbers not supported"
msgstr "bù zhīchí xiǎoshù shù"
@@ -1905,6 +2072,10 @@ msgstr "mùbiāo chángdù bìxū shì > = 0 de zhěngshù"
msgid "dict update sequence has wrong length"
msgstr "yǔfǎ gēngxīn xùliè de chángdù cuòwù"
+#: extmod/ulab/code/numerical.c
+msgid "diff argument must be an ndarray"
+msgstr ""
+
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
msgid "division by zero"
@@ -1975,6 +2146,26 @@ msgstr "éwài de guānjiàn cí cānshù"
msgid "extra positional arguments given"
msgstr "gěi chūle éwài de wèizhì cānshù"
+#: py/parse.c
+msgid "f-string expression part cannot include a '#'"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string expression part cannot include a backslash"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: empty expression not allowed"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: expecting '}'"
+msgstr ""
+
+#: py/parse.c
+msgid "f-string: single '}' is not allowed"
+msgstr ""
+
#: shared-bindings/audiocore/WaveFile.c shared-bindings/audiomp3/MP3Decoder.c
#: shared-bindings/displayio/OnDiskBitmap.c
msgid "file must be a file opened in byte mode"
@@ -1984,6 +2175,14 @@ msgstr "wénjiàn bìxū shì zài zì jié móshì xià dǎkāi de wénjiàn"
msgid "filesystem must provide mount method"
msgstr "wénjiàn xìtǒng bìxū tígōng guà zài fāngfǎ"
+#: extmod/ulab/code/ndarray.c
+msgid "first argument must be an iterable"
+msgstr ""
+
+#: extmod/ulab/code/vectorise.c
+msgid "first argument must be an ndarray"
+msgstr ""
+
#: py/objtype.c
msgid "first argument to super() must be type"
msgstr "chāojí () de dì yī gè cānshù bìxū shì lèixíng"
@@ -1992,6 +2191,14 @@ msgstr "chāojí () de dì yī gè cānshù bìxū shì lèixíng"
msgid "firstbit must be MSB"
msgstr "dì yī wèi bìxū shì MSB"
+#: extmod/ulab/code/ndarray.c
+msgid "flattening order must be either 'C', or 'F'"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "flip argument must be an ndarray"
+msgstr ""
+
#: py/objint.c
msgid "float too big"
msgstr "fú diǎn tài dà"
@@ -2084,9 +2291,14 @@ msgstr "géshì bù wánzhěng de mì yào"
msgid "incorrect padding"
msgstr "bù zhèngquè de tiánchōng"
+#: extmod/ulab/code/ndarray.c
+msgid "index is out of bounds"
+msgstr ""
+
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
-#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c
+#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c
msgid "index out of range"
msgstr "suǒyǐn chāochū fànwéi"
@@ -2094,10 +2306,46 @@ msgstr "suǒyǐn chāochū fànwéi"
msgid "indices must be integers"
msgstr "suǒyǐn bìxū shì zhěngshù"
+#: extmod/ulab/code/ndarray.c
+msgid "indices must be integers, slices, or Boolean lists"
+msgstr ""
+
#: py/compile.c
msgid "inline assembler must be a function"
msgstr "nèi lián jíhé bìxū shì yīgè hánshù"
+#: extmod/ulab/code/create.c
+msgid "input argument must be an integer or a 2-tuple"
+msgstr ""
+
+#: extmod/ulab/code/fft.c
+msgid "input array length must be power of 2"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "input data must be an iterable"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input matrix is asymmetric"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input matrix is singular"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "input must be square matrix"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "input must be tuple, list, range, or ndarray"
+msgstr ""
+
+#: extmod/ulab/code/poly.c
+msgid "input vectors must be of equal length"
+msgstr ""
+
#: py/parsenum.c
msgid "int() arg 2 must be >= 2 and <= 36"
msgstr "zhěngshù() cānshù 2 bìxū > = 2 qiě <= 36"
@@ -2176,6 +2424,14 @@ msgstr "issubclass() cānshù 1 bìxū shì yīgè lèi"
msgid "issubclass() arg 2 must be a class or a tuple of classes"
msgstr "issubclass() cānshù 2 bìxū shì lèi de lèi huò yuán zǔ"
+#: extmod/ulab/code/ndarray.c
+msgid "iterables are not of the same length"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "iterations did not converge"
+msgstr ""
+
#: py/objstr.c
msgid "join expects a list of str/bytes objects consistent with self object"
msgstr ""
@@ -2225,6 +2481,10 @@ msgstr "fùzhí qián yǐnyòng de júbù biànliàng"
msgid "long int not supported in this build"
msgstr "cǐ bǎnběn bù zhīchí zhǎng zhěngshù"
+#: py/parse.c
+msgid "malformed f-string"
+msgstr ""
+
#: shared-bindings/_stage/Layer.c
msgid "map buffer too small"
msgstr "dìtú huǎnchōng qū tài xiǎo"
@@ -2233,6 +2493,14 @@ msgstr "dìtú huǎnchōng qū tài xiǎo"
msgid "math domain error"
msgstr "shùxué yù cuòwù"
+#: extmod/ulab/code/linalg.c
+msgid "matrix dimensions do not match"
+msgstr ""
+
+#: extmod/ulab/code/linalg.c
+msgid "matrix is not positive definite"
+msgstr ""
+
#: ports/nrf/common-hal/_bleio/Characteristic.c
#: ports/nrf/common-hal/_bleio/Descriptor.c
#, c-format
@@ -2256,6 +2524,10 @@ msgstr "jìyì tǐ fēnpèi shībài, duī bèi suǒdìng"
msgid "module not found"
msgstr "zhǎo bù dào mókuài"
+#: extmod/ulab/code/poly.c
+msgid "more degrees of freedom than data points"
+msgstr ""
+
#: py/compile.c
msgid "multiple *x in assignment"
msgstr "duō gè*x zài zuòyè zhōng"
@@ -2280,6 +2552,10 @@ msgstr "bìxū zhǐdìng suǒyǒu sck/mosi/misco"
msgid "must use keyword argument for key function"
msgstr "bìxū shǐyòng guānjiàn cí cānshù"
+#: extmod/ulab/code/numerical.c
+msgid "n must be between 0, and 9"
+msgstr ""
+
#: py/runtime.c
msgid "name '%q' is not defined"
msgstr "míngchēng '%q' wèi dìngyì"
@@ -2367,6 +2643,14 @@ msgstr "bùshì zì chuàn géshì huà guòchéng zhōng zhuǎnhuàn de suǒyǒ
msgid "not enough arguments for format string"
msgstr "géshì zìfú chuàn cān shǔ bùzú"
+#: extmod/ulab/code/poly.c
+msgid "number of arguments must be 2, or 3"
+msgstr ""
+
+#: extmod/ulab/code/create.c
+msgid "number of points must be at least 2"
+msgstr ""
+
#: py/obj.c
#, c-format
msgid "object '%s' is not a tuple or list"
@@ -2434,6 +2718,18 @@ msgstr "Jǐn zhīchí cǎiyàng lǜ = 16000"
msgid "only slices with step=1 (aka None) are supported"
msgstr "jǐn zhīchí bù zhǎng = 1(jí wú) de qiēpiàn"
+#: extmod/ulab/code/ndarray.c extmod/ulab/code/vectorise.c
+msgid "operands could not be broadcast together"
+msgstr ""
+
+#: extmod/ulab/code/numerical.c
+msgid "operation is not implemented on ndarrays"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "operation is not supported for given type"
+msgstr ""
+
#: py/modbuiltins.c
msgid "ord expects a character"
msgstr "ord yùqí zìfú"
@@ -2482,6 +2778,7 @@ msgstr "pixel_shader bìxū shì displayio.Palette huò displayio.ColorConverter
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm/common-hal/pulseio/PulseIn.c
msgid "pop from an empty PulseIn"
msgstr "cóng kōng de PulseIn dànchū dànchū"
@@ -2509,6 +2806,14 @@ msgstr "pow() yǒu 3 cānshù xūyào zhěngshù"
msgid "queue overflow"
msgstr "duìliè yìchū"
+#: py/parse.c
+msgid "raw f-strings are not implemented"
+msgstr ""
+
+#: extmod/ulab/code/fft.c
+msgid "real and imaginary parts must be of equal length"
+msgstr ""
+
#: py/builtinimport.c
msgid "relative import"
msgstr "xiāngduì dǎorù"
@@ -2526,6 +2831,20 @@ msgstr "fǎnhuí zhùshì bìxū shì biāozhì fú"
msgid "return expected '%q' but got '%q'"
msgstr "fǎnhuí yùqí de '%q' dàn huòdéle '%q'"
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "rgb_pins[%d] duplicates another pin assignment"
+msgstr ""
+
+#: shared-bindings/_protomatter/Protomatter.c
+#, c-format
+msgid "rgb_pins[%d] is not on the same port as clock"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "right hand side must be an ndarray, or a scalar"
+msgstr ""
+
#: py/objstr.c
msgid "rsplit(None,n)"
msgstr ""
@@ -2550,6 +2869,10 @@ msgstr "jìhuà duīzhàn yǐ mǎn"
msgid "script compilation not supported"
msgstr "bù zhīchí jiǎoběn biānyì"
+#: extmod/ulab/code/ndarray.c
+msgid "shape must be a 2-tuple"
+msgstr ""
+
#: py/objstr.c
msgid "sign not allowed in string format specifier"
msgstr "zìfú chuàn géshì shuōmíng fú zhōng bù yǔnxǔ shǐyòng fúhào"
@@ -2562,6 +2885,10 @@ msgstr "zhěngshù géshì shuōmíng fú 'c' bù yǔnxǔ shǐyòng fúhào"
msgid "single '}' encountered in format string"
msgstr "zài géshì zìfú chuàn zhōng yù dào de dāngè '}'"
+#: extmod/ulab/code/linalg.c
+msgid "size is defined for ndarrays only"
+msgstr ""
+
#: shared-bindings/time/__init__.c
msgid "sleep length must be non-negative"
msgstr "shuìmián chángdù bìxū shìfēi fùshù"
@@ -2578,6 +2905,10 @@ msgstr "xiǎo zhěngshù yìchū"
msgid "soft reboot\n"
msgstr "ruǎn chóngqǐ\n"
+#: extmod/ulab/code/numerical.c
+msgid "sort argument must be an ndarray"
+msgstr ""
+
#: py/objstr.c
msgid "start/end indices"
msgstr "kāishǐ/jiéshù zhǐshù"
@@ -2667,12 +2998,16 @@ msgstr "time_t shíjiān chuō chāochū píngtái fànwéi"
msgid "too many arguments provided with the given format"
msgstr "tígōng jǐ dìng géshì de cānshù tài duō"
+#: extmod/ulab/code/ndarray.c
+msgid "too many indices"
+msgstr ""
+
#: py/runtime.c
#, c-format
msgid "too many values to unpack (expected %d)"
msgstr "dǎkāi tài duō zhí (yùqí %d)"
-#: py/objstr.c
+#: extmod/ulab/code/linalg.c py/objstr.c
msgid "tuple index out of range"
msgstr "yuán zǔ suǒyǐn chāochū fànwéi"
@@ -2686,6 +3021,7 @@ msgstr "RHS yāoqiú de yuán zǔ/lièbiǎo"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
+#: shared-bindings/busio/UART.c
msgid "tx and rx cannot both be None"
msgstr "tx hé rx bùnéng dōu shì wú"
@@ -2803,6 +3139,14 @@ msgstr "zhí jìshù bìxū wèi > 0"
msgid "window must be <= interval"
msgstr "Chuāngkǒu bìxū shì <= jiàngé"
+#: extmod/ulab/code/linalg.c
+msgid "wrong argument type"
+msgstr ""
+
+#: extmod/ulab/code/ndarray.c
+msgid "wrong index type"
+msgstr ""
+
#: py/objstr.c
msgid "wrong number of arguments"
msgstr "cānshù shù cuòwù"
@@ -2811,6 +3155,10 @@ msgstr "cānshù shù cuòwù"
msgid "wrong number of values to unpack"
msgstr "wúfǎ jiě bāo de zhí shù"
+#: extmod/ulab/code/ndarray.c
+msgid "wrong operand type"
+msgstr ""
+
#: shared-module/displayio/Shape.c
msgid "x value out of bounds"
msgstr "x zhí chāochū biānjiè"
@@ -3035,6 +3383,12 @@ msgstr "líng bù"
#~ msgid "Pixel beyond bounds of buffer"
#~ msgstr "Xiàngsù chāochū huǎnchōng qū biānjiè"
+#~ msgid "PulseIn not yet supported"
+#~ msgstr "Shàng bù zhīchí PulseIn"
+
+#~ msgid "PulseOut not yet supported"
+#~ msgstr "Shàng bù zhīchí PulseOut"
+
#~ msgid "Range out of bounds"
#~ msgstr "Fànwéi chāochū biānjiè"
diff --git a/mpy-cross/.gitignore b/mpy-cross/.gitignore
index 0681b685f..80d7acd42 100644
--- a/mpy-cross/.gitignore
+++ b/mpy-cross/.gitignore
@@ -3,4 +3,5 @@
/mpy-cross.static
/mpy-cross.static.exe
/mpy-cross.static-raspbian
+/mpy-cross.fuzz
/pitools
diff --git a/mpy-cross/Makefile.fuzz b/mpy-cross/Makefile.fuzz
new file mode 100644
index 000000000..ca59788f4
--- /dev/null
+++ b/mpy-cross/Makefile.fuzz
@@ -0,0 +1,6 @@
+
+PROG=mpy-cross.fuzz
+BUILD=build-static
+STATIC_BUILD=1
+CC=afl-clang-fast
+include mpy-cross.mk
diff --git a/ports/atmel-samd/README.rst b/ports/atmel-samd/README.rst
index 9afa19b83..b4d208577 100644
--- a/ports/atmel-samd/README.rst
+++ b/ports/atmel-samd/README.rst
@@ -11,6 +11,7 @@ CircuitPython. Supported boards include:
- Adafruit M0 Bluefruit LE
- Arduino Zero
- Arduino MKR Zero
+- Arduino Nano 33 IoT
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
boards use smaller version.
-===================== =================== =============== =========================== ====================== ================ ================== ========================= ================ ================================ ====================== ================
+===================== =================== =================== =============== =========================== ====================== ================ ================== ========================= ================ ================================ ====================== ================
`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
-===================== =================== =============== =========================== ====================== ================ ================== ========================= ================ ================================ ====================== ================
-PA00 ``ACCELEROMETER_SDA`` ``APA102_MOSI`` ``APA102_MOSI``
-PA01 ``ACCELEROMETER_SCL`` ``APA102_SCK`` ``APA102_SCK``
-PA02 ``A0`` ``A0`` ``A0`` / ``SPEAKER`` ``A0`` ``A0`` ``A0`` ``A0`` / ``D1`` ``A0`` ``A0`` ``A0`` ``D1`` / ``A0``
+--------------------- -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+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``
+PA01 ``ACCELEROMETER_SCL`` ``APA102_SCK`` ``APA102_SCK``
+PA02 ``A0`` ``A0`` ``A0`` ``A0`` / ``SPEAKER`` ``A0`` ``A0`` ``A0`` ``A0`` / ``D1`` ``A0`` ``A0`` ``A0`` ``D1`` / ``A0``
PA03
-PB08 ``L`` ``A1`` ``A7`` / ``TX`` ``A1`` ``A1`` ``A1`` ``A1`` ``A1`` ``A1``
-PB09 ``BATTERY`` ``A2`` ``A6`` / ``RX`` ``A2`` ``A2`` ``A2`` ``A2`` ``A2`` ``A2``
-PA04 ``A3`` ``A3`` ``IR_PROXIMITY`` ``A3`` ``A3`` ``A3`` ``D0`` / ``TX`` / ``SDA`` ``A3`` ``A3`` ``A3``
-PA05 ``A4`` ``A4`` ``A1`` ``A4`` ``A4`` ``A4`` ``D2`` / ``RX`` / ``SCL`` ``A4`` ``A4``
-PA06 ``A5`` ``D8`` ``A2`` ``D8`` / ``GREEN_LED`` ``NEOPIXEL`` ``D8`` ``D8`` ``D8`` ``D4`` / ``TX``
-PA07 ``A6`` ``D9`` ``A3`` ``D9`` ``D9`` ``D9`` ``D9`` ``D9`` ``D9`` ``D3`` / ``RX``
-PA08 ``D11`` / ``SDA`` ``D4`` ``MICROPHONE_DO`` ``D4`` / ``SD_CS`` ``D4`` ``D4`` ``D4`` ``D0`` / ``SDA``
-PA09 ``D12`` / ``SCL`` ``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``
-PA11 ``D3`` ``D0`` / ``RX`` ``LIGHT`` / ``A8`` ``D0`` / ``RX`` ``D0`` / ``RX`` ``D0`` / ``RX`` ``D0`` / ``RX`` ``D0`` / ``RX`` ``D0`` / ``RX``
-PB10 ``D4`` ``MOSI`` ``MOSI`` ``MOSI`` ``MOSI`` ``MOSI`` ``MOSI``
-PB11 ``D5`` ``SCK`` ``SCK`` ``SCK`` ``SCK`` ``SCK`` ``SCK``
-PA12 ``SD_MOSI`` ``MISO`` ``REMOTEIN`` / ``IR_RX`` ``MISO`` ``MISO`` ``MISO`` ``MISO`` ``MISO``
-PA13 ``SD_SCK`` ``ACCELEROMETER_INTERRUPT`` ``FLASH_CS`` ``D38``
-PA14 ``SD_CS`` ``D2`` ``BUTTON_B`` / ``D5`` ``D2`` ``D2`` ``D2``
-PA15 ``SD_MISO`` ``D5`` ``SLIDE_SWITCH`` / ``D7`` ``D5`` ``D5`` ``D5`` ``D5`` ``D5`` ``D5``
-PA16 ``D8`` / ``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``
-PA18 ``D10`` ``D10`` ``D10`` ``D10`` ``D10`` ``D10`` ``D10``
-PA19 ``D10`` / ``MISO`` ``D12`` ``D12`` ``D12`` ``D12`` ``D12`` ``D12`` / ``MISO`` ``D12``
-PA20 ``D6`` ``D6`` ``MOSI`` ``D6`` ``D6`` ``D6`` ``D6`` ``D6`` ``D6``
-PA21 ``D7`` ``D7`` ``SCK`` ``D7`` / ``SD_CD`` ``D7`` ``D7`` ``D7``
-PA22 ``D0`` ``SDA`` ``SDA`` ``SDA`` ``SDA`` ``SDA`` ``SDA`` ``SDA``
-PA23 ``D1`` ``SCL`` ``REMOTEOUT`` / ``IR_TX`` ``SCL`` ``SCL`` ``SCL`` ``L`` / ``D13`` ``SCL`` ``SCL`` ``SCL``
+PB08 ``L`` ``A4`` / ``SDA`` ``A1`` ``A7`` / ``TX`` ``A1`` ``A1`` ``A1`` ``A1`` ``A1`` ``A1``
+PB09 ``BATTERY`` ``A5`` / ``SCL`` ``A2`` ``A6`` / ``RX`` ``A2`` ``A2`` ``A2`` ``A2`` ``A2`` ``A2``
+PA04 ``A3`` ``D6`` ``A3`` ``IR_PROXIMITY`` ``A3`` ``A3`` ``A3`` ``D0`` / ``TX`` / ``SDA`` ``A3`` ``A3`` ``A3``
+PA05 ``A4`` ``D5`` ``A4`` ``A1`` ``A4`` ``A4`` ``A4`` ``D2`` / ``RX`` / ``SCL`` ``A4`` ``A4``
+PA06 ``A5`` ``D7`` ``D8`` ``A2`` ``D8`` / ``GREEN_LED`` ``NEOPIXEL`` ``D8`` ``D8`` ``D8`` ``D4`` / ``TX``
+PA07 ``A6`` ``D4`` ``D9`` ``A3`` ``D9`` ``D9`` ``D9`` ``D9`` ``D9`` ``D9`` ``D3`` / ``RX``
+PA08 ``D11`` / ``SDA`` ``ESP_RESET`` ``D4`` ``MICROPHONE_DO`` ``D4`` / ``SD_CS`` ``D4`` ``D4`` ``D4`` ``D0`` / ``SDA``
+PA09 ``D12`` / ``SCL`` ``A6`` ``D3`` ``TEMPERATURE`` / ``A9`` ``D3`` ``D3`` ``D3`` ``D2`` / ``SCL``
+PA10 ``D2`` ``A3`` ``D1`` / ``TX`` ``MICROPHONE_SCK`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D13``
+PA11 ``D3`` ``A2`` ``D0`` / ``RX`` ``LIGHT`` / ``A8`` ``D0`` / ``RX`` ``D0`` / ``RX`` ``D0`` / ``RX`` ``D0`` / ``RX`` ``D0`` / ``RX`` ``D0`` / ``RX``
+PB10 ``D4`` ``D2`` ``MOSI`` ``MOSI`` ``MOSI`` ``MOSI`` ``MOSI`` ``MOSI``
+PB11 ``D5`` ``D3`` ``SCK`` ``SCK`` ``SCK`` ``SCK`` ``SCK`` ``SCK``
+PA12 ``SD_MOSI`` ``ESP_MOSI`` ``MISO`` ``REMOTEIN`` / ``IR_RX`` ``MISO`` ``MISO`` ``MISO`` ``MISO`` ``MISO``
+PA13 ``SD_SCK`` ``ESP_MISO`` ``ACCELEROMETER_INTERRUPT`` ``FLASH_CS`` ``D38``
+PA14 ``SD_CS`` ``ESP_CS`` ``D2`` ``BUTTON_B`` / ``D5`` ``D2`` ``D2`` ``D2``
+PA15 ``SD_MISO`` ``ESP_SCK`` ``D5`` ``SLIDE_SWITCH`` / ``D7`` ``D5`` ``D5`` ``D5`` ``D5`` ``D5`` ``D5``
+PA16 ``D8`` / ``MOSI`` ``D11`` / ``MOSI`` ``D11`` ``MISO`` ``D11`` ``D11`` ``D11`` ``D11`` ``D11`` / ``MOSI`` ``D11``
+PA17 ``D9`` / ``SCK`` ``D13`` / ``SCK`` ``D13`` ``D13`` ``D13`` / ``RED_LED`` ``D13`` ``D13`` ``D13`` ``D13`` / ``SCK`` / ``BLUE_LED`` ``D13`` / ``BLUE_LED``
+PA18 ``D8`` ``D10`` ``D10`` ``D10`` ``D10`` ``D10`` ``D10`` ``D10``
+PA19 ``D10`` / ``MISO`` ``D12`` / ``MISO`` ``D12`` ``D12`` ``D12`` ``D12`` ``D12`` ``D12`` / ``MISO`` ``D12``
+PA20 ``D6`` ``D9`` ``D6`` ``MOSI`` ``D6`` ``D6`` ``D6`` ``D6`` ``D6`` ``D6``
+PA21 ``D7`` ``D10`` ``D7`` ``SCK`` ``D7`` / ``SD_CD`` ``D7`` ``D7`` ``D7``
+PA22 ``D0`` ``ESP_TX`` ``SDA`` ``SDA`` ``SDA`` ``SDA`` ``SDA`` ``SDA`` ``SDA``
+PA23 ``D1`` ``ESP_RX`` ``SCL`` ``REMOTEOUT`` / ``IR_TX`` ``SCL`` ``SCL`` ``SCL`` ``L`` / ``D13`` ``SCL`` ``SCL`` ``SCL``
PA24
PA25
-PB22 ``D14`` / ``TX`` ``FLASH_CS`` ``D30`` / ``TX1``
-PB23 ``D13`` / ``RX`` ``NEOPIXEL`` / ``D8`` ``D31`` / ``RX1``
-PA27 ``SD_CD`` ``GREEN_LED`` ``GREEN_LED``
-PA28 ``BUTTON_A`` / ``D4``
+PB22 ``D14`` / ``TX`` ``D1`` / ``TX`` ``FLASH_CS`` ``D30`` / ``TX1``
+PB23 ``D13`` / ``RX`` ``D0`` / ``RX`` ``NEOPIXEL`` / ``D8`` ``D31`` / ``RX1``
+PA27 ``SD_CD`` ``ESP_GPIO0`` ``GREEN_LED`` ``GREEN_LED``
+PA28 ``ESP_BUSY`` ``BUTTON_A`` / ``D4``
PA29
-PA30 ``SPEAKER_ENABLE`` ``NEOPIXEL``
+PA30 ``SPEAKER_ENABLE`` ``NEOPIXEL``
PA31
-PB02 ``A1`` ``A5`` ``A5`` / ``SDA`` ``A5`` ``A5`` ``A5`` ``A5`` ``A5``
-PB03 ``A2`` ``A4`` / ``SCL`` ``YELLOW_LED`` ``YELLOW_LED``
-===================== =================== =============== =========================== ====================== ================ ================== ========================= ================ ================================ ====================== ================
+PB02 ``A1`` ``A1`` ``A5`` ``A5`` / ``SDA`` ``A5`` ``A5`` ``A5`` ``A5`` ``A5``
+PB03 ``A2`` ``A7`` ``A4`` / ``SCL`` ``YELLOW_LED`` ``YELLOW_LED``
+===================== =================== =================== =============== =========================== ====================== ================ ================== ========================= ================ ================================ ====================== ================
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
diff --git a/ports/atmel-samd/boards/8086_commander/board.c b/ports/atmel-samd/boards/8086_commander/board.c
new file mode 100644
index 000000000..d7e856d61
--- /dev/null
+++ b/ports/atmel-samd/boards/8086_commander/board.c
@@ -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) {
+}
diff --git a/ports/atmel-samd/boards/8086_commander/mpconfigboard.h b/ports/atmel-samd/boards/8086_commander/mpconfigboard.h
new file mode 100644
index 000000000..9e3be4e6a
--- /dev/null
+++ b/ports/atmel-samd/boards/8086_commander/mpconfigboard.h
@@ -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)
diff --git a/ports/atmel-samd/boards/8086_commander/mpconfigboard.mk b/ports/atmel-samd/boards/8086_commander/mpconfigboard.mk
new file mode 100644
index 000000000..3e865657a
--- /dev/null
+++ b/ports/atmel-samd/boards/8086_commander/mpconfigboard.mk
@@ -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
diff --git a/ports/atmel-samd/boards/8086_commander/pins.c b/ports/atmel-samd/boards/8086_commander/pins.c
new file mode 100644
index 000000000..3eea4009e
--- /dev/null
+++ b/ports/atmel-samd/boards/8086_commander/pins.c
@@ -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);
diff --git a/ports/atmel-samd/boards/arduino_nano_33_iot/board.c b/ports/atmel-samd/boards/arduino_nano_33_iot/board.c
new file mode 100644
index 000000000..770bc8259
--- /dev/null
+++ b/ports/atmel-samd/boards/arduino_nano_33_iot/board.c
@@ -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) {
+}
diff --git a/ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.h b/ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.h
new file mode 100644
index 000000000..847e1a679
--- /dev/null
+++ b/ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.h
@@ -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
diff --git a/ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.mk b/ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.mk
new file mode 100644
index 000000000..8a29b0ace
--- /dev/null
+++ b/ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.mk
@@ -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
diff --git a/ports/atmel-samd/boards/arduino_nano_33_iot/pins.c b/ports/atmel-samd/boards/arduino_nano_33_iot/pins.c
new file mode 100644
index 000000000..6b23cbf09
--- /dev/null
+++ b/ports/atmel-samd/boards/arduino_nano_33_iot/pins.c
@@ -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);
diff --git a/ports/atmel-samd/boards/bdmicro_vina_m0/board.c b/ports/atmel-samd/boards/bdmicro_vina_m0/board.c
new file mode 100644
index 000000000..bd63baa6f
--- /dev/null
+++ b/ports/atmel-samd/boards/bdmicro_vina_m0/board.c
@@ -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) {
+}
diff --git a/ports/atmel-samd/boards/bdmicro_vina_m0/mpconfigboard.h b/ports/atmel-samd/boards/bdmicro_vina_m0/mpconfigboard.h
new file mode 100644
index 000000000..458b1e12a
--- /dev/null
+++ b/ports/atmel-samd/boards/bdmicro_vina_m0/mpconfigboard.h
@@ -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
diff --git a/ports/atmel-samd/boards/bdmicro_vina_m0/mpconfigboard.mk b/ports/atmel-samd/boards/bdmicro_vina_m0/mpconfigboard.mk
new file mode 100644
index 000000000..153754042
--- /dev/null
+++ b/ports/atmel-samd/boards/bdmicro_vina_m0/mpconfigboard.mk
@@ -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
diff --git a/ports/atmel-samd/boards/bdmicro_vina_m0/pins.c b/ports/atmel-samd/boards/bdmicro_vina_m0/pins.c
new file mode 100644
index 000000000..0ebceb28d
--- /dev/null
+++ b/ports/atmel-samd/boards/bdmicro_vina_m0/pins.c
@@ -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);
diff --git a/ports/atmel-samd/boards/circuitbrains_basic_m0/board.c b/ports/atmel-samd/boards/circuitbrains_basic_m0/board.c
new file mode 100755
index 000000000..efafd152d
--- /dev/null
+++ b/ports/atmel-samd/boards/circuitbrains_basic_m0/board.c
@@ -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) {
+}
diff --git a/ports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.h b/ports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.h
new file mode 100755
index 000000000..592160b84
--- /dev/null
+++ b/ports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.h
@@ -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 \ No newline at end of file
diff --git a/ports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.mk b/ports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.mk
new file mode 100755
index 000000000..3587f1a33
--- /dev/null
+++ b/ports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.mk
@@ -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
diff --git a/ports/atmel-samd/boards/circuitbrains_basic_m0/pins.c b/ports/atmel-samd/boards/circuitbrains_basic_m0/pins.c
new file mode 100755
index 000000000..5acad5e98
--- /dev/null
+++ b/ports/atmel-samd/boards/circuitbrains_basic_m0/pins.c
@@ -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);
diff --git a/ports/atmel-samd/boards/circuitbrains_deluxe_m4/board.c b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/board.c
new file mode 100755
index 000000000..efafd152d
--- /dev/null
+++ b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/board.c
@@ -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) {
+}
diff --git a/ports/atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.h b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.h
new file mode 100755
index 000000000..687e97a5a
--- /dev/null
+++ b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.h
@@ -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
diff --git a/ports/atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.mk b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.mk
new file mode 100755
index 000000000..7a9e5a780
--- /dev/null
+++ b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.mk
@@ -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
diff --git a/ports/atmel-samd/boards/circuitbrains_deluxe_m4/pins.c b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/pins.c
new file mode 100755
index 000000000..45fcd0464
--- /dev/null
+++ b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/pins.c
@@ -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);
diff --git a/ports/atmel-samd/boards/hallowing_m0_express/board.c b/ports/atmel-samd/boards/hallowing_m0_express/board.c
index b4c54062f..9a1db9ca9 100644
--- a/ports/atmel-samd/boards/hallowing_m0_express/board.c
+++ b/ports/atmel-samd/boards/hallowing_m0_express/board.c
@@ -79,7 +79,9 @@ void board_init(void) {
&pin_PA28, // Command or data
&pin_PA01, // Chip select
&pin_PA27, // Reset
- 12000000);
+ 12000000, // Baudrate
+ 0, // Polarity
+ 0); // Phase
displayio_display_obj_t* display = &displays[0].display;
display->base.type = &displayio_display_type;
@@ -95,6 +97,7 @@ void board_init(void) {
false, // Pixels in a byte share a row. Only used for depth < 8
1, // bytes per cell. Only valid for depths < 8
false, // reverse_pixels_in_byte. Only valid for depths < 8
+ true, // reverse_pixels_in_word
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command
MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command
@@ -108,7 +111,8 @@ void board_init(void) {
false, // single_byte_bounds
false, // data_as_commands
true, // auto_refresh
- 60); // native_frames_per_second
+ 60, // native_frames_per_second
+ true); // backlight_on_high
}
bool board_requests_safe_mode(void) {
diff --git a/ports/atmel-samd/boards/hallowing_m4_express/board.c b/ports/atmel-samd/boards/hallowing_m4_express/board.c
index 5d1ef6d9b..3e4a04ae2 100644
--- a/ports/atmel-samd/boards/hallowing_m4_express/board.c
+++ b/ports/atmel-samd/boards/hallowing_m4_express/board.c
@@ -49,7 +49,7 @@ uint8_t display_init_sequence[] = {
void board_init(void) {
busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus;
- common_hal_busio_spi_construct(spi, &pin_PA01, &pin_PA00, mp_const_none);
+ common_hal_busio_spi_construct(spi, &pin_PA01, &pin_PA00, NULL);
common_hal_busio_spi_never_reset(spi);
displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus;
@@ -59,7 +59,9 @@ void board_init(void) {
&pin_PB31, // TFT_DC Command or data
&pin_PA27, // TFT_CS Chip select
&pin_PB30, // TFT_RST Reset
- 60000000);
+ 60000000, // Baudrate
+ 0, // Polarity
+ 0); // Phase
displayio_display_obj_t* display = &displays[0].display;
display->base.type = &displayio_display_type;
@@ -75,6 +77,7 @@ void board_init(void) {
false, // Pixels in a byte share a row. Only used for depth < 8
1, // bytes per cell. Only valid for depths < 8
false, // reverse_pixels_in_byte. Only valid for depths < 8
+ true, // reverse_pixels_in_word
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command
MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command
@@ -88,7 +91,8 @@ void board_init(void) {
false, // single_byte_bounds
false, // data_as_commands
true, // auto_refresh
- 60); // native_frames_per_second
+ 60, // native_frames_per_second
+ true); // backlight_on_high
}
bool board_requests_safe_mode(void) {
diff --git a/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk b/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk
index df1a2d8eb..f7223790a 100644
--- a/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk
@@ -11,7 +11,11 @@ LONGINT_IMPL = MPZ
# Not needed.
CIRCUITPY_AUDIOBUSIO = 0
+CIRCUITPY_FRAMEBUFFERIO = 0
CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_NETWORK = 0
+CIRCUITPY_PROTOMATTER = 0
CIRCUITPY_PS2IO = 0
CIRCUITPY_AUDIOMP3 = 0
+
+CIRCUITPY_ULAB = 0
diff --git a/ports/atmel-samd/boards/metro_m4_express/mpconfigboard.mk b/ports/atmel-samd/boards/metro_m4_express/mpconfigboard.mk
index 62e6b7c72..c2603002c 100644
--- a/ports/atmel-samd/boards/metro_m4_express/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/metro_m4_express/mpconfigboard.mk
@@ -10,3 +10,5 @@ QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 3
EXTERNAL_FLASH_DEVICES = "S25FL116K, S25FL216K, GD25Q16C"
LONGINT_IMPL = MPZ
+
+CIRCUITPY__EVE = 1
diff --git a/ports/atmel-samd/boards/monster_m4sk/board.c b/ports/atmel-samd/boards/monster_m4sk/board.c
index 40141ca15..55d6f80c9 100644
--- a/ports/atmel-samd/boards/monster_m4sk/board.c
+++ b/ports/atmel-samd/boards/monster_m4sk/board.c
@@ -50,7 +50,7 @@ uint8_t display_init_sequence[] = {
void board_init(void) {
busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus;
- common_hal_busio_spi_construct(spi, &pin_PA13, &pin_PA12, mp_const_none);
+ common_hal_busio_spi_construct(spi, &pin_PA13, &pin_PA12, NULL);
common_hal_busio_spi_never_reset(spi);
displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus;
@@ -60,7 +60,9 @@ void board_init(void) {
&pin_PA07, // TFT_DC Command or data
&pin_PA06, // TFT_CS Chip select
&pin_PA04, // TFT_RST Reset
- 60000000);
+ 60000000, // Baudrate
+ 0, // Polarity
+ 0); // Phase
displayio_display_obj_t* display = &displays[0].display;
display->base.type = &displayio_display_type;
@@ -76,6 +78,7 @@ void board_init(void) {
false, // pixels in a byte share a row. Only valid for depths < 8
1, // bytes per cell. Only valid for depths < 8
false, // reverse_pixels_in_byte. Only valid for depths < 8
+ true, // reverse_pixels_in_word
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command
MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command
@@ -89,7 +92,8 @@ void board_init(void) {
false, // single_byte_bounds
false, // data_as_commands
true, // auto_refresh
- 60); // native_frames_per_second
+ 60, // native_frames_per_second
+ true); // backlight_on_high
}
bool board_requests_safe_mode(void) {
diff --git a/ports/atmel-samd/boards/nfc_copy_cat/board.c b/ports/atmel-samd/boards/nfc_copy_cat/board.c
new file mode 100644
index 000000000..c8e20206a
--- /dev/null
+++ b/ports/atmel-samd/boards/nfc_copy_cat/board.c
@@ -0,0 +1,38 @@
+/*
+ * 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) {
+}
diff --git a/ports/atmel-samd/boards/nfc_copy_cat/mpconfigboard.h b/ports/atmel-samd/boards/nfc_copy_cat/mpconfigboard.h
new file mode 100644
index 000000000..3790d23ff
--- /dev/null
+++ b/ports/atmel-samd/boards/nfc_copy_cat/mpconfigboard.h
@@ -0,0 +1,51 @@
+#define MICROPY_HW_BOARD_NAME "Electronic Cats NFC Copy Cat"
+#define MICROPY_HW_MCU_NAME "samd21e18"
+
+#define MICROPY_HW_LED_STATUS (&pin_PA14)
+
+#define MICROPY_PORT_A (0)
+#define MICROPY_PORT_B (0)
+#define MICROPY_PORT_C (0)
+
+#define SPI_FLASH_MOSI_PIN &pin_PA08
+#define SPI_FLASH_MISO_PIN &pin_PA11
+#define SPI_FLASH_SCK_PIN &pin_PA09
+#define SPI_FLASH_CS_PIN &pin_PA10
+
+// No microcontroller.nvm
+#define CIRCUITPY_INTERNAL_NVM_SIZE 0
+
+#define DEFAULT_SPI_BUS_SCK (&pin_PA17)
+#define DEFAULT_SPI_BUS_MOSI (&pin_PA16)
+#define DEFAULT_SPI_BUS_MISO (&pin_PA19)
+
+#define IGNORE_PIN_PA03 1
+#define IGNORE_PIN_PA20 1
+#define IGNORE_PIN_PA21 1
+// USB is always used.
+#define IGNORE_PIN_PA24 1
+#define IGNORE_PIN_PA25 1
+#define IGNORE_PIN_PA30 1
+#define IGNORE_PIN_PA31 1
+#define IGNORE_PIN_PB01 1
+#define IGNORE_PIN_PB02 1
+#define IGNORE_PIN_PB03 1
+#define IGNORE_PIN_PB04 1
+#define IGNORE_PIN_PB05 1
+#define IGNORE_PIN_PB06 1
+#define IGNORE_PIN_PB07 1
+#define IGNORE_PIN_PB08 1
+#define IGNORE_PIN_PB09 1
+#define IGNORE_PIN_PB10 1
+#define IGNORE_PIN_PB11 1
+#define IGNORE_PIN_PB12 1
+#define IGNORE_PIN_PB13 1
+#define IGNORE_PIN_PB14 1
+#define IGNORE_PIN_PB15 1
+#define IGNORE_PIN_PB16 1
+#define IGNORE_PIN_PB17 1
+#define IGNORE_PIN_PB22 1
+#define IGNORE_PIN_PB23 1
+#define IGNORE_PIN_PB30 1
+#define IGNORE_PIN_PB31 1
+#define IGNORE_PIN_PB00 1
diff --git a/ports/atmel-samd/boards/nfc_copy_cat/mpconfigboard.mk b/ports/atmel-samd/boards/nfc_copy_cat/mpconfigboard.mk
new file mode 100644
index 000000000..4f6d1e70d
--- /dev/null
+++ b/ports/atmel-samd/boards/nfc_copy_cat/mpconfigboard.mk
@@ -0,0 +1,14 @@
+USB_VID = 0x1209
+USB_PID = 0xBAB8
+USB_PRODUCT = "NFC Copy Cat"
+USB_MANUFACTURER = "Electronic Cats"
+
+CHIP_VARIANT = SAMD21E18A
+CHIP_FAMILY = samd21
+
+SPI_FLASH_FILESYSTEM = 1
+EXTERNAL_FLASH_DEVICE_COUNT = 1
+EXTERNAL_FLASH_DEVICES = "GD25Q16C"
+LONGINT_IMPL = NONE
+
+CIRCUITPY_SMALL_BUILD = 1
diff --git a/ports/atmel-samd/boards/nfc_copy_cat/pins.c b/ports/atmel-samd/boards/nfc_copy_cat/pins.c
new file mode 100644
index 000000000..ebe6e89e4
--- /dev/null
+++ b/ports/atmel-samd/boards/nfc_copy_cat/pins.c
@@ -0,0 +1,20 @@
+#include "shared-bindings/board/__init__.h"
+
+STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA02) }, // IRQ
+ { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA06) }, // IN_A
+ { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA07) }, // IN_B
+ { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA05) }, // LED
+ { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA04) }, // LED
+ { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA14) }, // LED
+ { MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_PA27) }, // Switch
+ { MP_ROM_QSTR(MP_QSTR_D28), MP_ROM_PTR(&pin_PA28) }, // Switch
+ { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA08) },
+ { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA09) },
+ { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA17) },
+ { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA16) },
+ { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA19) },
+ { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_PA18) }, // CS
+ { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
+};
+MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
diff --git a/ports/atmel-samd/boards/openbook_m4/board.c b/ports/atmel-samd/boards/openbook_m4/board.c
index 85a588879..02270e7e5 100644
--- a/ports/atmel-samd/boards/openbook_m4/board.c
+++ b/ports/atmel-samd/boards/openbook_m4/board.c
@@ -55,7 +55,7 @@ uint8_t stop_sequence[] = {
void board_init(void) {
busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus;
- common_hal_busio_spi_construct(spi, &pin_PB13, &pin_PB15, mp_const_none);
+ common_hal_busio_spi_construct(spi, &pin_PB13, &pin_PB15, NULL);
common_hal_busio_spi_never_reset(spi);
displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus;
@@ -65,7 +65,9 @@ void board_init(void) {
&pin_PB05, // EPD_DC Command or data
&pin_PB07, // EPD_CS Chip select
&pin_PA00, // EPD_RST Reset
- 1000000);
+ 1000000, // Baudrate
+ 0, // Polarity
+ 0); // Phase
displayio_epaperdisplay_obj_t* display = &displays[0].epaper_display;
display->base.type = &displayio_epaperdisplay_type;
diff --git a/ports/atmel-samd/boards/pewpew_m4/board.c b/ports/atmel-samd/boards/pewpew_m4/board.c
index 1872d1876..cf8439cf0 100644
--- a/ports/atmel-samd/boards/pewpew_m4/board.c
+++ b/ports/atmel-samd/boards/pewpew_m4/board.c
@@ -97,7 +97,7 @@ uint8_t display_init_sequence[] = {
void board_init(void) {
busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus;
- common_hal_busio_spi_construct(spi, &pin_PA13, &pin_PA15, mp_const_none);
+ common_hal_busio_spi_construct(spi, &pin_PA13, &pin_PA15, NULL);
common_hal_busio_spi_never_reset(spi);
displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus;
@@ -107,7 +107,9 @@ void board_init(void) {
&pin_PA16, // TFT_DC Command or data
&pin_PA11, // TFT_CS Chip select
&pin_PA17, // TFT_RST Reset
- 60000000);
+ 60000000, // Baudrate
+ 0, // Polarity
+ 0); // Phase
uint32_t cfg0 = lookupCfg(CFG_DISPLAY_CFG0, 0x000000);
uint32_t offX = (cfg0 >> 8) & 0xff;
@@ -126,6 +128,7 @@ void board_init(void) {
false, // pixels in byte share row. only used for depth < 8
1, // bytes per cell. Only valid for depths < 8
false, // reverse_pixels_in_byte. Only valid for depths < 8
+ true, // reverse_pixels_in_word
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command
MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command
@@ -139,7 +142,8 @@ void board_init(void) {
false, // single_byte_bounds
false, // data_as_commands
false, // auto_refresh
- 20); // native_frames_per_second
+ 20, // native_frames_per_second
+ true); // backlight_on_high
}
bool board_requests_safe_mode(void) {
diff --git a/ports/atmel-samd/boards/pybadge/board.c b/ports/atmel-samd/boards/pybadge/board.c
index 3725f0ec3..ffddf0397 100644
--- a/ports/atmel-samd/boards/pybadge/board.c
+++ b/ports/atmel-samd/boards/pybadge/board.c
@@ -52,7 +52,7 @@ uint8_t display_init_sequence[] = {
0xc4, 2, 0x8a, 0xee,
0xc5, 1, 0x0e, // _VMCTR1 VCOMH = 4V, VOML = -1.1V
0x2a, 0, // _INVOFF
- 0x36, 1, 0x00, // _MADCTL top to bottom refresh in vsync aligned order.
+ 0x36, 1, 0b10100000, // _MADCTL for rotation 0
// 1 clk cycle nonoverlap, 2 cycle gate rise, 3 sycle osc equalie,
// fix on VTL
0x3a, 1, 0x05, // COLMOD - 16bit color
@@ -72,7 +72,7 @@ uint8_t display_init_sequence[] = {
void board_init(void) {
busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus;
- common_hal_busio_spi_construct(spi, &pin_PB13, &pin_PB15, mp_const_none);
+ common_hal_busio_spi_construct(spi, &pin_PB13, &pin_PB15, NULL);
common_hal_busio_spi_never_reset(spi);
displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus;
@@ -82,7 +82,9 @@ void board_init(void) {
&pin_PB05, // TFT_DC Command or data
&pin_PB07, // TFT_CS Chip select
&pin_PA00, // TFT_RST Reset
- 60000000);
+ 60000000, // Baudrate
+ 0, // Polarity
+ 0); // Phase
displayio_display_obj_t* display = &displays[0].display;
display->base.type = &displayio_display_type;
@@ -92,12 +94,13 @@ void board_init(void) {
128, // Height (after rotation)
0, // column start
0, // row start
- 270, // rotation
+ 0, // rotation
16, // Color depth
false, // grayscale
false, // pixels in byte share row. only used for depth < 8
1, // bytes per cell. Only valid for depths < 8
false, // reverse_pixels_in_byte. Only valid for depths < 8
+ true, // reverse_pixels_in_word
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command
MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command
@@ -111,7 +114,8 @@ void board_init(void) {
false, // single_byte_bounds
false, // data_as_commands
true, // auto_refresh
- 60); // native_frames_per_second
+ 60, // native_frames_per_second
+ true); // backlight_on_high
}
bool board_requests_safe_mode(void) {
diff --git a/ports/atmel-samd/boards/pybadge_airlift/board.c b/ports/atmel-samd/boards/pybadge_airlift/board.c
index fbb4441f0..8274d0ebe 100644
--- a/ports/atmel-samd/boards/pybadge_airlift/board.c
+++ b/ports/atmel-samd/boards/pybadge_airlift/board.c
@@ -50,7 +50,7 @@ uint8_t display_init_sequence[] = {
void board_init(void) {
busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus;
- common_hal_busio_spi_construct(spi, &pin_PB13, &pin_PB15, mp_const_none);
+ common_hal_busio_spi_construct(spi, &pin_PB13, &pin_PB15, NULL);
common_hal_busio_spi_never_reset(spi);
displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus;
@@ -60,7 +60,9 @@ void board_init(void) {
&pin_PB05, // TFT_DC Command or data
&pin_PB06, // TFT_CS Chip select
&pin_PB07, // TFT_RST Reset
- 60000000);
+ 60000000, // Baudrate
+ 0, // Polarity
+ 0); // Phase
displayio_display_obj_t* display = &displays[0].display;
display->base.type = &displayio_display_type;
@@ -76,6 +78,7 @@ void board_init(void) {
false, // pixels in byte share row. Only used for depth < 8
1, // bytes per cell. Only valid for depths < 8
false, // reverse_pixels_in_byte. Only valid for depths < 8
+ true, // reverse_pixels_in_word
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command
MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command
@@ -89,7 +92,8 @@ void board_init(void) {
false, // single_byte_bounds
false, // data_as_commands
true, // auto_refresh
- 60); // native_frames_per_second
+ 60, // native_frames_per_second
+ true); // backlight_on_high
}
bool board_requests_safe_mode(void) {
diff --git a/ports/stm32f4/common-hal/pulseio/PulseOut.c b/ports/atmel-samd/boards/pycubed/board.c
index d393afc5c..31b081209 100644
--- a/ports/stm32f4/common-hal/pulseio/PulseOut.c
+++ b/ports/atmel-samd/boards/pycubed/board.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2019 Lucian Copeland for Adafruit Industries
+ * 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
@@ -24,32 +24,38 @@
* THE SOFTWARE.
*/
-#include "common-hal/pulseio/PulseOut.h"
-#include <stdint.h>
+#include <string.h>
+#include "boards/board.h"
#include "py/mpconfig.h"
-#include "py/gc.h"
-#include "py/runtime.h"
-#include "shared-bindings/pulseio/PulseOut.h"
+#include "shared-bindings/nvm/ByteArray.h"
+#include "common-hal/microcontroller/Pin.h"
+#include "hal/include/hal_gpio.h"
#include "shared-bindings/pulseio/PWMOut.h"
-#include "supervisor/shared/translate.h"
+nvm_bytearray_obj_t bootcnt = {
+ .base = {
+ .type = &nvm_bytearray_type
+ },
+ .len = ( uint32_t) 8192,
+ .start_address = (uint8_t*) (0x00080000 - 8192)
+ };
-void pulseout_reset() {
-}
-
-void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self,
- const pulseio_pwmout_obj_t* carrier) {
- mp_raise_NotImplementedError(translate("PulseOut not yet supported"));
-}
-bool common_hal_pulseio_pulseout_deinited(pulseio_pulseout_obj_t* self) {
- return true;
+void board_init(void) {
+ pulseio_pwmout_obj_t pwm;
+ common_hal_pulseio_pwmout_construct(&pwm, &pin_PA23, 4096, 2, false);
+ common_hal_pulseio_pwmout_never_reset(&pwm);
}
-void common_hal_pulseio_pulseout_deinit(pulseio_pulseout_obj_t* self) {
+bool board_requests_safe_mode(void) {
+ return false;
}
-void common_hal_pulseio_pulseout_send(pulseio_pulseout_obj_t* self, uint16_t* pulses, uint16_t length) {
-}
+void reset_board(void) {
+ uint8_t value_out = 0;
+ common_hal_nvm_bytearray_get_bytes(&bootcnt,0,1,&value_out);
+ ++value_out;
+ common_hal_nvm_bytearray_set_bytes(&bootcnt,0,&value_out,1);
+} \ No newline at end of file
diff --git a/ports/atmel-samd/boards/pycubed/mpconfigboard.h b/ports/atmel-samd/boards/pycubed/mpconfigboard.h
new file mode 100644
index 000000000..49a98e8d4
--- /dev/null
+++ b/ports/atmel-samd/boards/pycubed/mpconfigboard.h
@@ -0,0 +1,34 @@
+
+#define MICROPY_HW_BOARD_NAME "PyCubedv04"
+#define MICROPY_HW_MCU_NAME "samd51j19"
+#define CIRCUITPY_MCU_FAMILY samd51
+
+#define MICROPY_HW_NEOPIXEL (&pin_PA21)
+
+#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11)
+#define MICROPY_PORT_B ( PORT_PB10 | PORT_PB11)
+#define MICROPY_PORT_C (0)
+#define MICROPY_PORT_D (0)
+
+#define AUTORESET_DELAY_MS 500
+
+#define CIRCUITPY_INTERNAL_NVM_SIZE 8192
+
+#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE)
+
+#define EXTERNAL_FLASH_QSPI_DUAL
+
+#define BOARD_HAS_CRYSTAL 1
+
+#define DEFAULT_I2C_BUS_SCL (&pin_PB13)
+#define DEFAULT_I2C_BUS_SDA (&pin_PB12)
+
+#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_TX (&pin_PB02)
+#define DEFAULT_UART_BUS_RX (&pin_PB03)
+
+#define IGNORE_PIN_PA24 1
+#define IGNORE_PIN_PA25 1
diff --git a/ports/atmel-samd/boards/pycubed/mpconfigboard.mk b/ports/atmel-samd/boards/pycubed/mpconfigboard.mk
new file mode 100644
index 000000000..c14a29615
--- /dev/null
+++ b/ports/atmel-samd/boards/pycubed/mpconfigboard.mk
@@ -0,0 +1,26 @@
+LD_FILE = boards/samd51x19-bootloader-external-flash.ld
+USB_VID = 0x04D8
+USB_PID = 0xEC44
+USB_PRODUCT = "PyCubed"
+USB_MANUFACTURER = "maholli"
+
+CHIP_VARIANT = SAMD51J19A
+CHIP_FAMILY = samd51
+
+QSPI_FLASH_FILESYSTEM = 1
+EXTERNAL_FLASH_DEVICE_COUNT = 1
+EXTERNAL_FLASH_DEVICES = W25Q80DV
+LONGINT_IMPL = MPZ
+
+# Not needed.
+CIRCUITPY_AUDIOBUSIO = 0
+CIRCUITPY_DISPLAYIO = 0
+CIRCUITPY_FRAMEBUFFERIO = 0
+CIRCUITPY_GAMEPAD = 0
+CIRCUITPY_PROTOMATTER = 0
+CIRCUITPY_PS2IO = 0
+
+FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice
+FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
+FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register
+FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD
diff --git a/ports/atmel-samd/boards/pycubed/pins.c b/ports/atmel-samd/boards/pycubed/pins.c
new file mode 100644
index 000000000..4c97f58a8
--- /dev/null
+++ b/ports/atmel-samd/boards/pycubed/pins.c
@@ -0,0 +1,55 @@
+#include "shared-bindings/board/__init__.h"
+#include "boards/board.h"
+
+STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA13) },
+ { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA12) },
+ { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA14) },
+ { MP_ROM_QSTR(MP_QSTR_xSDCS), MP_ROM_PTR(&pin_PA27) },
+
+ { MP_ROM_QSTR(MP_QSTR_RELAY_A), MP_ROM_PTR(&pin_PB15) },
+ { MP_ROM_QSTR(MP_QSTR_BURN1), MP_ROM_PTR(&pin_PB31) },
+ { MP_ROM_QSTR(MP_QSTR_BURN2), MP_ROM_PTR(&pin_PA15) },
+
+ { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PA06) },
+ { MP_ROM_QSTR(MP_QSTR_L1PROG), MP_ROM_PTR(&pin_PA07) },
+ { MP_ROM_QSTR(MP_QSTR_AIN4), MP_ROM_PTR(&pin_PA04) },
+ { MP_ROM_QSTR(MP_QSTR_AIN5), MP_ROM_PTR(&pin_PA05) },
+ { MP_ROM_QSTR(MP_QSTR_CHRG), MP_ROM_PTR(&pin_PB08) },
+ { MP_ROM_QSTR(MP_QSTR_DAC0), MP_ROM_PTR(&pin_PA02) },
+ { MP_ROM_QSTR(MP_QSTR_PA17), MP_ROM_PTR(&pin_PA17) },
+ { MP_ROM_QSTR(MP_QSTR_PA18), MP_ROM_PTR(&pin_PA18) },
+ { MP_ROM_QSTR(MP_QSTR_PA19), MP_ROM_PTR(&pin_PA19) },
+ { MP_ROM_QSTR(MP_QSTR_PA20), MP_ROM_PTR(&pin_PA20) },
+ { MP_ROM_QSTR(MP_QSTR_PA22), MP_ROM_PTR(&pin_PA22) },
+ { MP_ROM_QSTR(MP_QSTR_PB16), MP_ROM_PTR(&pin_PB16) },
+ { MP_ROM_QSTR(MP_QSTR_PB17), MP_ROM_PTR(&pin_PB17) },
+ { MP_ROM_QSTR(MP_QSTR_PB22), MP_ROM_PTR(&pin_PB22) },
+ { MP_ROM_QSTR(MP_QSTR_PB23), MP_ROM_PTR(&pin_PB23) },
+
+ { MP_ROM_QSTR(MP_QSTR_RF1_RST), MP_ROM_PTR(&pin_PB00) },
+ { MP_ROM_QSTR(MP_QSTR_RF1_CS), MP_ROM_PTR(&pin_PB30) },
+ { MP_ROM_QSTR(MP_QSTR_RF1_IO0), MP_ROM_PTR(&pin_PB05) },
+ { MP_ROM_QSTR(MP_QSTR_RF1_IO4), MP_ROM_PTR(&pin_PB04) },
+
+ { MP_ROM_QSTR(MP_QSTR_RF2_RST), MP_ROM_PTR(&pin_PB14) },
+ { MP_ROM_QSTR(MP_QSTR_RF2_CS), MP_ROM_PTR(&pin_PB09) },
+ { MP_ROM_QSTR(MP_QSTR_RF2_IO1), MP_ROM_PTR(&pin_PB06) },
+ { MP_ROM_QSTR(MP_QSTR_RF2_BSY), MP_ROM_PTR(&pin_PB07) },
+
+ { MP_ROM_QSTR(MP_QSTR_EN_GPS), MP_ROM_PTR(&pin_PB01) },
+ { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB02) },
+ { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB03) },
+
+ { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB12) },
+ { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB13) },
+
+ { MP_ROM_QSTR(MP_QSTR_WDT_WDI), MP_ROM_PTR(&pin_PA23) },
+ { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA21) },
+
+ { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
+ { 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_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); \ No newline at end of file
diff --git a/ports/atmel-samd/boards/pygamer/board.c b/ports/atmel-samd/boards/pygamer/board.c
index b364ffccf..c7f2f6e1d 100644
--- a/ports/atmel-samd/boards/pygamer/board.c
+++ b/ports/atmel-samd/boards/pygamer/board.c
@@ -52,7 +52,7 @@ uint8_t display_init_sequence[] = {
0xc4, 2, 0x8a, 0xee,
0xc5, 1, 0x0e, // _VMCTR1 VCOMH = 4V, VOML = -1.1V
0x2a, 0, // _INVOFF
- 0x36, 1, 0x00, // _MADCTL top to bottom refresh in vsync aligned order.
+ 0x36, 1, 0b10100000, // _MADCTL for rotation 0
// 1 clk cycle nonoverlap, 2 cycle gate rise, 3 sycle osc equalie,
// fix on VTL
0x3a, 1, 0x05, // COLMOD - 16bit color
@@ -72,7 +72,7 @@ uint8_t display_init_sequence[] = {
void board_init(void) {
busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus;
- common_hal_busio_spi_construct(spi, &pin_PB13, &pin_PB15, mp_const_none);
+ common_hal_busio_spi_construct(spi, &pin_PB13, &pin_PB15, NULL);
common_hal_busio_spi_never_reset(spi);
displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus;
@@ -82,7 +82,9 @@ void board_init(void) {
&pin_PB05, // TFT_DC Command or data
&pin_PB12, // TFT_CS Chip select
&pin_PA00, // TFT_RST Reset
- 60000000);
+ 60000000, // Baudrate
+ 0, // Polarity
+ 0); // Phase
displayio_display_obj_t* display = &displays[0].display;
display->base.type = &displayio_display_type;
@@ -92,12 +94,13 @@ void board_init(void) {
128, // Height
0, // column start
0, // row start
- 270, // rotation
+ 0, // rotation
16, // Color depth
false, // Grayscale
false, // pixels in a byte share a row. Only valid for depths < 8
1, // bytes per cell. Only valid for depths < 8
false, // reverse_pixels_in_byte. Only valid for depths < 8
+ true, // reverse_pixels_in_word
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command
MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command
@@ -111,7 +114,8 @@ void board_init(void) {
false, // single_byte_bounds
false, // data_as_commands
true, // auto_refresh
- 60); // native_frames_per_second
+ 60, // native_frames_per_second
+ true); // backlight_on_high
}
bool board_requests_safe_mode(void) {
diff --git a/ports/atmel-samd/boards/pygamer_advance/board.c b/ports/atmel-samd/boards/pygamer_advance/board.c
index a138c7e50..6053fedb0 100644
--- a/ports/atmel-samd/boards/pygamer_advance/board.c
+++ b/ports/atmel-samd/boards/pygamer_advance/board.c
@@ -50,7 +50,7 @@ uint8_t display_init_sequence[] = {
void board_init(void) {
busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus;
- common_hal_busio_spi_construct(spi, &pin_PB13, &pin_PB12, mp_const_none);
+ 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;
@@ -60,7 +60,9 @@ void board_init(void) {
&pin_PA00, // TFT_DC Command or data
&pin_PB15, // TFT_CS Chip select
&pin_PB05, // TFT_RST Reset
- 60000000);
+ 60000000, // Baudrate
+ 0, // Polarity
+ 0); // Phase
displayio_display_obj_t* display = &displays[0].display;
display->base.type = &displayio_display_type;
@@ -76,6 +78,7 @@ void board_init(void) {
false, // pixels in a byte share a row. Only valid for depths < 8
1, // bytes per cell. Only valid for depths < 8
false, // reverse_pixels_in_byte. Only valid for depths < 8
+ true, // reverse_pixels_in_word
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command
MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command
@@ -89,7 +92,8 @@ void board_init(void) {
false, // single_byte_bounds
false, // data_as_commands
true, // auto_refresh
- 60); // native_frames_per_second
+ 60, // native_frames_per_second
+ true); // backlight_on_high
}
bool board_requests_safe_mode(void) {
diff --git a/ports/atmel-samd/boards/pyportal/board.c b/ports/atmel-samd/boards/pyportal/board.c
index 2a7289778..ed3006e3c 100644
--- a/ports/atmel-samd/boards/pyportal/board.c
+++ b/ports/atmel-samd/boards/pyportal/board.c
@@ -87,6 +87,7 @@ void board_init(void) {
false, // pixels_in_byte_share_row (unused for depths > 8)
1, // bytes per cell. Only valid for depths < 8
false, // reverse_pixels_in_byte. Only valid for depths < 8
+ true, // reverse_pixels_in_word
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command
MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command
@@ -100,7 +101,8 @@ void board_init(void) {
false, // single_byte_bounds
false, // data_as_commands
true, // auto_refresh
- 60); // native_frames_per_second
+ 60, // native_frames_per_second
+ true); // backlight_on_high
}
bool board_requests_safe_mode(void) {
diff --git a/ports/atmel-samd/boards/pyportal_titano/board.c b/ports/atmel-samd/boards/pyportal_titano/board.c
index 828ceebc4..e7763b6e5 100644
--- a/ports/atmel-samd/boards/pyportal_titano/board.c
+++ b/ports/atmel-samd/boards/pyportal_titano/board.c
@@ -104,6 +104,7 @@ void board_init(void) {
false, // pixels_in_byte_share_row (unused for depths > 8)
1, // bytes per cell. Only valid for depths < 8
false, // reverse_pixels_in_byte. Only valid for depths < 8
+ true, // reverse_pixels_in_word
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command
MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command
@@ -117,7 +118,8 @@ void board_init(void) {
false, // single_byte_bounds
false, // data_as_commands
true, // auto_refresh
- 60); // native_frames_per_second
+ 60, // native_frames_per_second
+ true); // backlight_on_high
}
bool board_requests_safe_mode(void) {
diff --git a/ports/atmel-samd/boards/robohatmm1_m4/mpconfigboard.mk b/ports/atmel-samd/boards/robohatmm1_m4/mpconfigboard.mk
index fd4f22230..57eb7f1b9 100644
--- a/ports/atmel-samd/boards/robohatmm1_m4/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/robohatmm1_m4/mpconfigboard.mk
@@ -17,7 +17,9 @@ LONGINT_IMPL = MPZ
CIRCUITPY_AUDIOBUSIO = 0
# Make room for more stuff
CIRCUITPY_DISPLAYIO = 0
+CIRCUITPY_FRAMEBUFFERIO = 0
CIRCUITPY_FREQUENCYIO = 0
+CIRCUITPY_PROTOMATTER = 0
# Include these Python libraries in firmware.
#FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice
diff --git a/ports/atmel-samd/boards/sam32/mpconfigboard.h b/ports/atmel-samd/boards/sam32/mpconfigboard.h
index bd9f5e398..364d380d1 100644
--- a/ports/atmel-samd/boards/sam32/mpconfigboard.h
+++ b/ports/atmel-samd/boards/sam32/mpconfigboard.h
@@ -1,23 +1,22 @@
-
-#define MICROPY_HW_BOARD_NAME "SAM32v2a"
+#define MICROPY_HW_BOARD_NAME "SAM32v26"
#define MICROPY_HW_MCU_NAME "samd51j20"
#define CIRCUITPY_MCU_FAMILY samd51
#define MICROPY_HW_LED_STATUS (&pin_PA27)
-#define MICROPY_HW_NEOPIXEL (&pin_PA15)
+#define MICROPY_HW_NEOPIXEL (&pin_PA15)
#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
-#define MICROPY_PORT_D (0)
+#define MICROPY_PORT_D (0)
-// No microcontroller.nvm
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
+#define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE (128*1024)
#define BOARD_HAS_CRYSTAL 1
-#define DEFAULT_I2C_BUS_SCL (&pin_PA04)
-#define DEFAULT_I2C_BUS_SDA (&pin_PA07)
+#define DEFAULT_I2C_BUS_SCL (&pin_PA09)
+#define DEFAULT_I2C_BUS_SDA (&pin_PA08)
#define DEFAULT_SPI_BUS_SCK (&pin_PB13)
#define DEFAULT_SPI_BUS_MOSI (&pin_PB12)
diff --git a/ports/atmel-samd/boards/sam32/mpconfigboard.mk b/ports/atmel-samd/boards/sam32/mpconfigboard.mk
index 0d6be6437..118744935 100644
--- a/ports/atmel-samd/boards/sam32/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/sam32/mpconfigboard.mk
@@ -8,3 +8,10 @@ CHIP_FAMILY = samd51
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = MPZ
+
+# No I2S on SAMD51
+CIRCUITPY_AUDIOBUSIO = 0
+CIRCUITPY_USTACK = 1
+
+FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice
+FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel \ No newline at end of file
diff --git a/ports/atmel-samd/boards/sam32/pins.c b/ports/atmel-samd/boards/sam32/pins.c
index f32057d75..f0a5b2b62 100644
--- a/ports/atmel-samd/boards/sam32/pins.c
+++ b/ports/atmel-samd/boards/sam32/pins.c
@@ -1,10 +1,8 @@
#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_PB08) },
- { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB09) },
- { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA08) },
- { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA09) },
+ { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_PB08) },
+ { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_PB09) },
{ MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PB04) },
{ MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PB05) },
{ MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PB06) },
@@ -13,15 +11,14 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB13) },
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB12) },
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PB14) },
- { MP_ROM_QSTR(MP_QSTR_xSDCS),MP_ROM_PTR(&pin_PB15) },
+ { MP_ROM_QSTR(MP_QSTR_xSDCS),MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_DAC0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_DAC1), MP_ROM_PTR(&pin_PA05) },
+ { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_PA10) },
{ MP_ROM_QSTR(MP_QSTR_D20), MP_ROM_PTR(&pin_PA11) },
- { MP_ROM_QSTR(MP_QSTR_D29), MP_ROM_PTR(&pin_PA12) },
- { MP_ROM_QSTR(MP_QSTR_D30), MP_ROM_PTR(&pin_PA13) },
{ MP_ROM_QSTR(MP_QSTR_D31), MP_ROM_PTR(&pin_PA14) },
{ MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_PA16) },
{ MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_PA17) },
@@ -35,12 +32,24 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D50), MP_ROM_PTR(&pin_PB23) },
{ MP_ROM_QSTR(MP_QSTR_D59), MP_ROM_PTR(&pin_PB30) },
{ MP_ROM_QSTR(MP_QSTR_D60), MP_ROM_PTR(&pin_PB31) },
- { MP_ROM_QSTR(MP_QSTR_D64), MP_ROM_PTR(&pin_PB03) },
+ { MP_ROM_QSTR(MP_QSTR_D61), MP_ROM_PTR(&pin_PB00) },
+
+ { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_PB01) },
+ { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_PB02) },
+ { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_PB03) },
+
+ { MP_ROM_QSTR(MP_QSTR_TCK), MP_ROM_PTR(&pin_PB01) },
+ { MP_ROM_QSTR(MP_QSTR_TDI), MP_ROM_PTR(&pin_PB02) },
+ { MP_ROM_QSTR(MP_QSTR_TMS), MP_ROM_PTR(&pin_PB03) },
+ { MP_ROM_QSTR(MP_QSTR_ESP_CS),MP_ROM_PTR(&pin_PB15) },
+
+ { MP_ROM_QSTR(MP_QSTR_TX1), MP_ROM_PTR(&pin_PA12) },
+ { MP_ROM_QSTR(MP_QSTR_RX1), MP_ROM_PTR(&pin_PA13) },
+ { MP_ROM_QSTR(MP_QSTR_TX2), MP_ROM_PTR(&pin_PB16) },
+ { MP_ROM_QSTR(MP_QSTR_RX2), MP_ROM_PTR(&pin_PB17) },
- { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB16) },
- { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB17) },
- { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA07) },
- { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA04) },
+ { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA08) },
+ { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA09) },
{ MP_ROM_QSTR(MP_QSTR_RTS), MP_ROM_PTR(&pin_PB11) },
{ MP_ROM_QSTR(MP_QSTR_DTR), MP_ROM_PTR(&pin_PB10) },
diff --git a/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/board.c b/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/board.c
new file mode 100644
index 000000000..8096b9b8e
--- /dev/null
+++ b/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/board.c
@@ -0,0 +1,38 @@
+/*
+ * 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) {
+}
+
+bool board_requests_safe_mode(void) {
+ return false;
+}
+
+void reset_board(void) {
+}
diff --git a/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/mpconfigboard.h b/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/mpconfigboard.h
new file mode 100644
index 000000000..a5dee295b
--- /dev/null
+++ b/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/mpconfigboard.h
@@ -0,0 +1,33 @@
+#define MICROPY_HW_BOARD_NAME "SparkFun Thing Plus - SAMD51"
+#define MICROPY_HW_MCU_NAME "samd51j20"
+
+#define CIRCUITPY_MCU_FAMILY samd51
+
+// On-board flash
+#define SPI_FLASH_MOSI_PIN &pin_PA08
+#define SPI_FLASH_MISO_PIN &pin_PA11
+#define SPI_FLASH_SCK_PIN &pin_PA09
+#define SPI_FLASH_CS_PIN &pin_PA10
+
+// These are pins not to reset.
+// SPI Data pins
+#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11)
+#define MICROPY_PORT_B (0)
+#define MICROPY_PORT_C (0)
+#define MICROPY_PORT_D (0)
+
+#define BOARD_HAS_CRYSTAL 1
+
+#define DEFAULT_I2C_BUS_SCL (&pin_PA22)
+#define DEFAULT_I2C_BUS_SDA (&pin_PA23)
+
+#define DEFAULT_SPI_BUS_SCK (&pin_PB13)
+#define DEFAULT_SPI_BUS_MOSI (&pin_PB12)
+#define DEFAULT_SPI_BUS_MISO (&pin_PB11)
+
+#define DEFAULT_UART_BUS_RX (&pin_PA13)
+#define DEFAULT_UART_BUS_TX (&pin_PA12)
+
+// USB is always used internally so skip the pin objects for it.
+#define IGNORE_PIN_PA24 1
+#define IGNORE_PIN_PA25 1
diff --git a/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/mpconfigboard.mk b/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/mpconfigboard.mk
new file mode 100644
index 000000000..13863e565
--- /dev/null
+++ b/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/mpconfigboard.mk
@@ -0,0 +1,17 @@
+LD_FILE = boards/samd51x20-bootloader-external-flash.ld
+USB_VID = 0x1b4f
+USB_PID = 0x0016 # Used by uf2 bootloader
+USB_PRODUCT = "SparkFun SAMD51 Thing+"
+USB_MANUFACTURER = "SparkFun Electronics"
+
+CHIP_VARIANT = SAMD51J20A
+CHIP_FAMILY = samd51
+
+SPI_FLASH_FILESYSTEM = 1
+EXTERNAL_FLASH_DEVICE_COUNT = 1
+EXTERNAL_FLASH_DEVICES = AT25SF041A
+LONGINT_IMPL = MPZ
+
+CIRCUITPY_NETWORK = 1
+MICROPY_PY_WIZNET5K = 5500
+CIRCUITPY_PS2IO = 1
diff --git a/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/pins.c b/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/pins.c
new file mode 100644
index 000000000..a9ac6d98a
--- /dev/null
+++ b/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/pins.c
@@ -0,0 +1,37 @@
+#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_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_SCK), MP_ROM_PTR(&pin_PB13) },
+ { MP_ROM_QSTR(MP_QSTR_D24), MP_ROM_PTR(&pin_PB13) },
+ { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB12) },
+ { MP_ROM_QSTR(MP_QSTR_D23), MP_ROM_PTR(&pin_PB12) },
+ { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PB11) },
+ { MP_ROM_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_PB11) },
+ { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA13) },
+ { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA12) },
+ { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA13) }, // D0 == RX
+ { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA12) }, // D1 == TX
+ { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA06) },
+ { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA22) },
+ { MP_ROM_QSTR(MP_QSTR_D20), MP_ROM_PTR(&pin_PA22) },
+ { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA23) },
+ { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_PA23) },
+ { 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_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_LED), 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) },
+};
+MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
diff --git a/ports/atmel-samd/boards/uartlogger2/board.c b/ports/atmel-samd/boards/uartlogger2/board.c
new file mode 100644
index 000000000..0f60736a2
--- /dev/null
+++ b/ports/atmel-samd/boards/uartlogger2/board.c
@@ -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) {
+}
diff --git a/ports/atmel-samd/boards/uartlogger2/mpconfigboard.h b/ports/atmel-samd/boards/uartlogger2/mpconfigboard.h
new file mode 100644
index 000000000..bd341d303
--- /dev/null
+++ b/ports/atmel-samd/boards/uartlogger2/mpconfigboard.h
@@ -0,0 +1,35 @@
+#define MICROPY_HW_BOARD_NAME "UARTLogger II"
+#define MICROPY_HW_MCU_NAME "samd51j19"
+
+#define CIRCUITPY_MCU_FAMILY samd51
+
+#define MICROPY_HW_LED_TX (&pin_PB07)
+#define MICROPY_HW_LED_RX (&pin_PB06)
+
+#define MICROPY_HW_LED_STATUS (&pin_PA16)
+
+#define MICROPY_HW_NEOPIXEL (&pin_PB22)
+
+// 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 and NeoPixel pin
+#define MICROPY_PORT_B (PORT_PB11 | PORT_PB10 | PORT_PB22)
+#define MICROPY_PORT_C (0)
+#define MICROPY_PORT_D (0)
+
+#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
diff --git a/ports/atmel-samd/boards/uartlogger2/mpconfigboard.mk b/ports/atmel-samd/boards/uartlogger2/mpconfigboard.mk
new file mode 100644
index 000000000..498429c9e
--- /dev/null
+++ b/ports/atmel-samd/boards/uartlogger2/mpconfigboard.mk
@@ -0,0 +1,12 @@
+USB_VID = 0x239A
+USB_PID = 0x8096
+USB_PRODUCT = "UARTLogger II"
+USB_MANUFACTURER = "Szymon Klause"
+
+CHIP_VARIANT = SAMD51J19A
+CHIP_FAMILY = samd51
+
+QSPI_FLASH_FILESYSTEM = 1
+EXTERNAL_FLASH_DEVICE_COUNT = 1
+EXTERNAL_FLASH_DEVICES = "W25Q32JV_IQ"
+LONGINT_IMPL = MPZ
diff --git a/ports/atmel-samd/boards/uartlogger2/pins.c b/ports/atmel-samd/boards/uartlogger2/pins.c
new file mode 100644
index 000000000..4e90870c4
--- /dev/null
+++ b/ports/atmel-samd/boards/uartlogger2/pins.c
@@ -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_PA05) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA06) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PB00) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PB08) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB09) },
+
+ { 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_PB17) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PB16) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PB13) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PB14) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PB15) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PB12) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA21) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA20) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA19) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA17) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D13),MP_ROM_PTR(&pin_PA16) },
+
+ // ESP control
+ { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_CS), MP_ROM_PTR(&pin_PA15) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_GPIO0), MP_ROM_PTR(&pin_PB01) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_BUSY), MP_ROM_PTR(&pin_PB04) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RESET), MP_ROM_PTR(&pin_PB05) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RTS), MP_ROM_PTR(&pin_PB23) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_TX), MP_ROM_PTR(&pin_PA04) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RX), MP_ROM_PTR(&pin_PA07) },
+
+ { 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_NEOPIXEL),MP_ROM_PTR(&pin_PB22) },
+
+ { 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_OBJ_NEW_QSTR(MP_QSTR_LED_RX),MP_ROM_PTR(&pin_PB06) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_LED_TX),MP_ROM_PTR(&pin_PB07) },
+ { 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);
diff --git a/ports/atmel-samd/boards/ugame10/board.c b/ports/atmel-samd/boards/ugame10/board.c
index ce389a2b1..38661950f 100644
--- a/ports/atmel-samd/boards/ugame10/board.c
+++ b/ports/atmel-samd/boards/ugame10/board.c
@@ -79,7 +79,9 @@ void board_init(void) {
&pin_PA09, // Command or data
&pin_PA08, // Chip select
NULL, // Reset
- 24000000);
+ 24000000, // Baudrate
+ 0, // Polarity
+ 0); // Phase
displayio_display_obj_t* display = &displays[0].display;
display->base.type = &displayio_display_type;
@@ -95,6 +97,7 @@ void board_init(void) {
false, // pixels in byte share row. Only used with depth < 8
1, // bytes per cell. Only valid for depths < 8
false, // reverse_pixels_in_byte. Only valid for depths < 8
+ true, // reverse_pixels_in_word
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command
MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command
@@ -108,7 +111,8 @@ void board_init(void) {
false, // single_byte_bounds
false, // data as commands
true, // auto_refresh
- 60); // native_frames_per_second
+ 60, // native_frames_per_second
+ true); // backlight_on_high
}
bool board_requests_safe_mode(void) {
diff --git a/ports/atmel-samd/boards/winterbloom_big_honking_button/board.c b/ports/atmel-samd/boards/winterbloom_big_honking_button/board.c
new file mode 100644
index 000000000..c8e20206a
--- /dev/null
+++ b/ports/atmel-samd/boards/winterbloom_big_honking_button/board.c
@@ -0,0 +1,38 @@
+/*
+ * 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) {
+}
diff --git a/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.h b/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.h
new file mode 100644
index 000000000..8d520f675
--- /dev/null
+++ b/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.h
@@ -0,0 +1,20 @@
+#define MICROPY_HW_BOARD_NAME "Winterbloom Big Honking Button"
+#define MICROPY_HW_MCU_NAME "samd21g18"
+
+#define MICROPY_HW_LED_STATUS (&pin_PA17)
+
+#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_PA27
+
+// These are pins not to reset.
+#define MICROPY_PORT_A (PORT_PA00 | PORT_PA01)
+#define MICROPY_PORT_B ( 0 )
+#define MICROPY_PORT_C ( 0 )
+
+#define BOARD_HAS_CRYSTAL 0
+
+// USB is always used internally so skip the pin objects for it.
+#define IGNORE_PIN_PA24 1
+#define IGNORE_PIN_PA25 1
diff --git a/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk b/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk
new file mode 100644
index 000000000..691c1c136
--- /dev/null
+++ b/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk
@@ -0,0 +1,34 @@
+# Adafruit
+USB_VID = 0x239A
+# Allocated for Big Honking Button at https://github.com/adafruit/circuitpython/issues/2715
+USB_PID = 0x6005
+USB_PRODUCT = "Big Honking Button"
+USB_MANUFACTURER = "Winterbloom"
+USB_DEVICES = "CDC,MSC"
+
+CHIP_VARIANT = SAMD21G18A
+CHIP_FAMILY = samd21
+
+SPI_FLASH_FILESYSTEM = 1
+EXTERNAL_FLASH_DEVICE_COUNT = 1
+EXTERNAL_FLASH_DEVICES = "GD25Q16C"
+LONGINT_IMPL = MPZ
+
+CIRCUITPY_AUDIOIO = 1
+
+# Disable modules that are unusable on this special-purpose board.
+CIRCUITPY_BITBANGIO = 0
+CIRCUITPY_FRAMEBUFFERIO = 0
+CIRCUITPY_FREQUENCYIO = 0
+CIRCUITPY_I2CSLAVE = 0
+CIRCUITPY_AUDIOBUSIO = 0
+CIRCUITPY_BLEIO = 0
+CIRCUITPY_DISPLAYIO = 0
+CIRCUITPY_GAMEPAD = 0
+CIRCUITPY_I2CSLAVE = 0
+CIRCUITPY_NETWORK = 0
+CIRCUITPY_TOUCHIO = 0
+CIRCUITPY_PROTOMATTER = 0
+CIRCUITPY_PS2IO = 0
+CIRCUITPY_USB_HID = 0
+CIRCUITPY_RTC = 0
diff --git a/ports/atmel-samd/boards/winterbloom_big_honking_button/pins.c b/ports/atmel-samd/boards/winterbloom_big_honking_button/pins.c
new file mode 100644
index 000000000..f325529f3
--- /dev/null
+++ b/ports/atmel-samd/boards/winterbloom_big_honking_button/pins.c
@@ -0,0 +1,10 @@
+#include "shared-bindings/board/__init__.h"
+
+STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_PA07) },
+ { MP_ROM_QSTR(MP_QSTR_HONK_OUT), MP_ROM_PTR(&pin_PA02) },
+ { MP_ROM_QSTR(MP_QSTR_GATE_OUT), MP_ROM_PTR(&pin_PA11) },
+ { MP_ROM_QSTR(MP_QSTR_GATE_IN), MP_ROM_PTR(&pin_PA14) },
+ { MP_ROM_QSTR(MP_QSTR_PITCH_IN), MP_ROM_PTR(&pin_PB08) },
+};
+MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
diff --git a/ports/atmel-samd/boards/winterbloom_sol/mpconfigboard.mk b/ports/atmel-samd/boards/winterbloom_sol/mpconfigboard.mk
index a0449d7bb..ed97aef4c 100644
--- a/ports/atmel-samd/boards/winterbloom_sol/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/winterbloom_sol/mpconfigboard.mk
@@ -6,13 +6,14 @@ USB_PID = 0x8062
USB_PRODUCT = "Sol"
USB_MANUFACTURER = "Winterbloom"
USB_INTERFACE_NAME = "Sol"
+USB_DEVICES = "CDC,MSC,AUDIO"
CHIP_VARIANT = SAMD51J20A
CHIP_FAMILY = samd51
QSPI_FLASH_FILESYSTEM = 1
-EXTERNAL_FLASH_DEVICE_COUNT = 1
-EXTERNAL_FLASH_DEVICES = W25Q32JV_IQ
+EXTERNAL_FLASH_DEVICE_COUNT = 2
+EXTERNAL_FLASH_DEVICES = "GD25Q64C, W25Q32JV_IQ"
LONGINT_IMPL = MPZ
# Disable modules that are unusable on this special-purpose board.
@@ -20,11 +21,14 @@ CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_AUDIOIO = 0
CIRCUITPY_BLEIO = 0
CIRCUITPY_DISPLAYIO = 0
+CIRCUITPY_FRAMEBUFFERIO = 0
CIRCUITPY_GAMEPAD = 0
CIRCUITPY_I2CSLAVE = 0
CIRCUITPY_NETWORK = 0
CIRCUITPY_TOUCHIO = 0
+CIRCUITPY_PROTOMATTER = 0
CIRCUITPY_PS2IO = 0
+CIRCUITPY_USB_HID = 0
# Enable micropython.native
CIRCUITPY_ENABLE_MPY_NATIVE = 1
diff --git a/ports/atmel-samd/common-hal/_protomatter/Protomatter.c b/ports/atmel-samd/common-hal/_protomatter/Protomatter.c
new file mode 100644
index 000000000..bf9cafb6b
--- /dev/null
+++ b/ports/atmel-samd/common-hal/_protomatter/Protomatter.c
@@ -0,0 +1,78 @@
+/*
+ * This file is part of the Micro Python project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Jeff Epler 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 <stddef.h>
+
+#include "common-hal/_protomatter/Protomatter.h"
+
+#include "samd/timers.h"
+#include "timer_handler.h"
+
+void *common_hal_protomatter_timer_allocate() {
+ uint8_t timer_index = find_free_timer();
+ if (timer_index == 0xff) {
+ return NULL;
+ }
+ timer_never_reset(timer_index, true);
+ return tc_insts[timer_index];
+}
+
+static uint8_t tc_index_from_ptr(void* ptr) {
+ for (uint8_t i = TC_INST_NUM; i > 0; i--) {
+ if (tc_insts[i] == ptr) {
+ return i;
+ }
+ }
+ return 0xff;
+}
+
+void common_hal_protomatter_timer_enable(void* ptr) {
+ uint8_t timer_index = tc_index_from_ptr(ptr);
+ if (timer_index == 0xff) {
+ return;
+ }
+ set_timer_handler(true, timer_index, TC_HANDLER_PROTOMATTER);
+ turn_on_clocks(true, timer_index, 1);
+}
+
+void common_hal_protomatter_timer_disable(void* ptr) {
+ uint8_t timer_index = tc_index_from_ptr(ptr);
+ if (timer_index == 0xff) {
+ return;
+ }
+ set_timer_handler(true, timer_index, TC_HANDLER_NO_INTERRUPT);
+ tc_set_enable(ptr, false);
+}
+
+void common_hal_protomatter_timer_free(void* ptr) {
+ uint8_t timer_index = tc_index_from_ptr(ptr);
+ if (timer_index == 0xff) {
+ return;
+ }
+ tc_set_enable(ptr, false);
+ tc_reset(ptr);
+ timer_reset_ok(timer_index, true);
+}
diff --git a/ports/atmel-samd/common-hal/_protomatter/Protomatter.h b/ports/atmel-samd/common-hal/_protomatter/Protomatter.h
new file mode 100644
index 000000000..8185bed0e
--- /dev/null
+++ b/ports/atmel-samd/common-hal/_protomatter/Protomatter.h
@@ -0,0 +1,35 @@
+/*
+ * This file is part of the Micro Python project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Jeff Epler 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.
+ */
+
+#ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PROTOMATTER_PROTOMATTER_H
+#define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PROTOMATTER_PROTOMATTER_H
+
+void *common_hal_protomatter_timer_allocate(void);
+void common_hal_protomatter_timer_enable(void*);
+void common_hal_protomatter_timer_disable(void*);
+void common_hal_protomatter_timer_free(void*);
+
+#endif
diff --git a/ports/atmel-samd/common-hal/_protomatter/__init__.c b/ports/atmel-samd/common-hal/_protomatter/__init__.c
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ports/atmel-samd/common-hal/_protomatter/__init__.c
diff --git a/ports/atmel-samd/common-hal/analogio/AnalogIn.c b/ports/atmel-samd/common-hal/analogio/AnalogIn.c
index fc11d5d19..2bd218cdd 100644
--- a/ports/atmel-samd/common-hal/analogio/AnalogIn.c
+++ b/ports/atmel-samd/common-hal/analogio/AnalogIn.c
@@ -73,7 +73,7 @@ void common_hal_analogio_analogin_construct(analogio_analogin_obj_t* self,
}
bool common_hal_analogio_analogin_deinited(analogio_analogin_obj_t *self) {
- return self->pin == mp_const_none;
+ return self->pin == NULL;
}
void common_hal_analogio_analogin_deinit(analogio_analogin_obj_t *self) {
@@ -81,7 +81,7 @@ void common_hal_analogio_analogin_deinit(analogio_analogin_obj_t *self) {
return;
}
reset_pin_number(self->pin->number);
- self->pin = mp_const_none;
+ self->pin = NULL;
}
void analogin_reset() {
diff --git a/ports/atmel-samd/common-hal/audiobusio/I2SOut.c b/ports/atmel-samd/common-hal/audiobusio/I2SOut.c
index 05a6aaf7b..8f827e7fb 100644
--- a/ports/atmel-samd/common-hal/audiobusio/I2SOut.c
+++ b/ports/atmel-samd/common-hal/audiobusio/I2SOut.c
@@ -89,6 +89,7 @@ void i2sout_reset(void) {
#endif
}
+// Caller validates that pins are free.
void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t* self,
const mcu_pin_obj_t* bit_clock, const mcu_pin_obj_t* word_select,
const mcu_pin_obj_t* data, bool left_justified) {
@@ -182,9 +183,6 @@ void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t* self,
#ifdef SAMD21
#define GPIO_I2S_FUNCTION GPIO_PIN_FUNCTION_G
#endif
- assert_pin_free(bit_clock);
- assert_pin_free(word_select);
- assert_pin_free(data);
self->bit_clock = bit_clock;
self->word_select = word_select;
@@ -204,7 +202,7 @@ void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t* self,
}
bool common_hal_audiobusio_i2sout_deinited(audiobusio_i2sout_obj_t* self) {
- return self->bit_clock == mp_const_none;
+ return self->bit_clock == NULL;
}
void common_hal_audiobusio_i2sout_deinit(audiobusio_i2sout_obj_t* self) {
@@ -213,11 +211,11 @@ void common_hal_audiobusio_i2sout_deinit(audiobusio_i2sout_obj_t* self) {
}
reset_pin_number(self->bit_clock->number);
- self->bit_clock = mp_const_none;
+ self->bit_clock = NULL;
reset_pin_number(self->word_select->number);
- self->word_select = mp_const_none;
+ self->word_select = NULL;
reset_pin_number(self->data->number);
- self->data = mp_const_none;
+ self->data = NULL;
}
void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t* self,
diff --git a/ports/atmel-samd/common-hal/audiobusio/PDMIn.c b/ports/atmel-samd/common-hal/audiobusio/PDMIn.c
index 3a51cce8f..76e66ab45 100644
--- a/ports/atmel-samd/common-hal/audiobusio/PDMIn.c
+++ b/ports/atmel-samd/common-hal/audiobusio/PDMIn.c
@@ -74,6 +74,7 @@ void pdmin_reset(void) {
I2S->CTRLA.reg = I2S_CTRLA_SWRST;
}
+// Caller validates that pins are free.
void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self,
const mcu_pin_obj_t* clock_pin,
const mcu_pin_obj_t* data_pin,
@@ -157,8 +158,6 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self,
#ifdef SAMD21
#define GPIO_I2S_FUNCTION GPIO_PIN_FUNCTION_G
#endif
- assert_pin_free(clock_pin);
- assert_pin_free(data_pin);
uint32_t clock_divisor = (uint32_t) roundf( 48000000.0f / sample_rate / oversample);
float mic_clock_freq = 48000000.0f / clock_divisor;
@@ -219,7 +218,7 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self,
}
bool common_hal_audiobusio_pdmin_deinited(audiobusio_pdmin_obj_t* self) {
- return self->clock_pin == mp_const_none;
+ return self->clock_pin == NULL;
}
void common_hal_audiobusio_pdmin_deinit(audiobusio_pdmin_obj_t* self) {
@@ -237,8 +236,8 @@ void common_hal_audiobusio_pdmin_deinit(audiobusio_pdmin_obj_t* self) {
reset_pin_number(self->clock_pin->number);
reset_pin_number(self->data_pin->number);
- self->clock_pin = mp_const_none;
- self->data_pin = mp_const_none;
+ self->clock_pin = NULL;
+ self->data_pin = NULL;
}
uint8_t common_hal_audiobusio_pdmin_get_bit_depth(audiobusio_pdmin_obj_t* self) {
diff --git a/ports/atmel-samd/common-hal/audioio/AudioOut.c b/ports/atmel-samd/common-hal/audioio/AudioOut.c
index b75c2b335..75621b361 100644
--- a/ports/atmel-samd/common-hal/audioio/AudioOut.c
+++ b/ports/atmel-samd/common-hal/audioio/AudioOut.c
@@ -115,6 +115,7 @@ void audioout_reset(void) {
// TODO(tannewt): Turn off the DAC clocks to save power.
}
+// Caller validates that pins are free.
void common_hal_audioio_audioout_construct(audioio_audioout_obj_t* self,
const mcu_pin_obj_t* left_channel, const mcu_pin_obj_t* right_channel, uint16_t quiescent_value) {
#ifdef SAMD51
@@ -135,7 +136,6 @@ void common_hal_audioio_audioout_construct(audioio_audioout_obj_t* self,
if (left_channel != &pin_PA02) {
mp_raise_ValueError(translate("Invalid pin"));
}
- assert_pin_free(left_channel);
claim_pin(left_channel);
#endif
#ifdef SAMD51
@@ -143,7 +143,6 @@ void common_hal_audioio_audioout_construct(audioio_audioout_obj_t* self,
if (left_channel != &pin_PA02 && left_channel != &pin_PA05) {
mp_raise_ValueError(translate("Invalid pin for left channel"));
}
- assert_pin_free(left_channel);
if (right_channel != NULL && right_channel != &pin_PA02 && right_channel != &pin_PA05) {
mp_raise_ValueError(translate("Invalid pin for right channel"));
}
@@ -304,7 +303,7 @@ void common_hal_audioio_audioout_construct(audioio_audioout_obj_t* self,
}
bool common_hal_audioio_audioout_deinited(audioio_audioout_obj_t* self) {
- return self->left_channel == mp_const_none;
+ return self->left_channel == NULL;
}
void common_hal_audioio_audioout_deinit(audioio_audioout_obj_t* self) {
@@ -332,10 +331,10 @@ void common_hal_audioio_audioout_deinit(audioio_audioout_obj_t* self) {
tc_set_enable(tc_insts[self->tc_index], false);
reset_pin_number(self->left_channel->number);
- self->left_channel = mp_const_none;
+ self->left_channel = NULL;
#ifdef SAMD51
reset_pin_number(self->right_channel->number);
- self->right_channel = mp_const_none;
+ self->right_channel = NULL;
#endif
}
diff --git a/ports/atmel-samd/common-hal/busio/SPI.c b/ports/atmel-samd/common-hal/busio/SPI.c
index 7a1426bed..1dc389027 100644
--- a/ports/atmel-samd/common-hal/busio/SPI.c
+++ b/ports/atmel-samd/common-hal/busio/SPI.c
@@ -89,8 +89,8 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
Sercom* sercom = NULL;
uint8_t sercom_index;
uint32_t clock_pinmux = 0;
- bool mosi_none = mosi == mp_const_none || mosi == NULL;
- bool miso_none = miso == mp_const_none || miso == NULL;
+ bool mosi_none = mosi == NULL;
+ bool miso_none = miso == NULL;
uint32_t mosi_pinmux = 0;
uint32_t miso_pinmux = 0;
uint8_t clock_pad = 0;
diff --git a/ports/atmel-samd/common-hal/busio/UART.c b/ports/atmel-samd/common-hal/busio/UART.c
index 70857de6d..1f6b75f97 100644
--- a/ports/atmel-samd/common-hal/busio/UART.c
+++ b/ports/atmel-samd/common-hal/busio/UART.c
@@ -52,9 +52,12 @@ static void usart_async_rxc_callback(const struct usart_async_descriptor *const
}
void common_hal_busio_uart_construct(busio_uart_obj_t *self,
- const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx, uint32_t baudrate,
- uint8_t bits, uart_parity_t parity, uint8_t stop, mp_float_t timeout,
- uint16_t receiver_buffer_size) {
+ const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx,
+ const mcu_pin_obj_t * rts, const mcu_pin_obj_t * cts,
+ const mcu_pin_obj_t * rs485_dir, bool rs485_invert,
+ uint32_t baudrate, uint8_t bits, uart_parity_t parity, uint8_t stop,
+ mp_float_t timeout, uint16_t receiver_buffer_size) {
+
Sercom* sercom = NULL;
uint8_t sercom_index = 255; // Unset index
uint32_t rx_pinmux = 0;
@@ -62,12 +65,16 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
uint32_t tx_pinmux = 0;
uint8_t tx_pad = 255; // Unset pad
+ if ((rts != NULL) || (cts != NULL) || (rs485_dir != NULL) || (rs485_invert)) {
+ mp_raise_ValueError(translate("RTS/CTS/RS485 Not yet supported on this device"));
+ }
+
if (bits > 8) {
mp_raise_NotImplementedError(translate("bytes > 8 bits not supported"));
}
- bool have_tx = tx != mp_const_none;
- bool have_rx = rx != mp_const_none;
+ bool have_tx = tx != NULL;
+ bool have_rx = rx != NULL;
if (!have_tx && !have_rx) {
mp_raise_ValueError(translate("tx and rx cannot both be None"));
}
@@ -102,7 +109,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
#endif
tx_pinmux = PINMUX(tx->number, (i == 0) ? MUX_C : MUX_D);
tx_pad = tx->sercom[i].pad;
- if (rx == mp_const_none) {
+ if (rx == NULL) {
sercom = potential_sercom;
break;
}
diff --git a/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c b/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c
index e167cbb69..68d3da806 100644
--- a/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c
+++ b/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c
@@ -55,7 +55,7 @@ void common_hal_digitalio_digitalinout_never_reset(
}
bool common_hal_digitalio_digitalinout_deinited(digitalio_digitalinout_obj_t* self) {
- return self->pin == mp_const_none;
+ return self->pin == NULL;
}
void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t* self) {
@@ -63,7 +63,7 @@ void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t* self
return;
}
reset_pin_number(self->pin->number);
- self->pin = mp_const_none;
+ self->pin = NULL;
}
void common_hal_digitalio_digitalinout_switch_to_input(
diff --git a/ports/atmel-samd/common-hal/microcontroller/Pin.c b/ports/atmel-samd/common-hal/microcontroller/Pin.c
index 9719ea5b1..cf78673b2 100644
--- a/ports/atmel-samd/common-hal/microcontroller/Pin.c
+++ b/ports/atmel-samd/common-hal/microcontroller/Pin.c
@@ -240,3 +240,15 @@ bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t* pin) {
return pin_number_is_free(pin->number);
}
+
+uint8_t common_hal_mcu_pin_number(const mcu_pin_obj_t* pin) {
+ return pin->number;
+}
+
+void common_hal_mcu_pin_claim(const mcu_pin_obj_t* pin) {
+ return claim_pin(pin);
+}
+
+void common_hal_mcu_pin_reset_number(uint8_t pin_no) {
+ reset_pin_number(pin_no);
+}
diff --git a/ports/atmel-samd/common-hal/pulseio/PWMOut.c b/ports/atmel-samd/common-hal/pulseio/PWMOut.c
index 0adb23fc5..1da0da844 100644
--- a/ports/atmel-samd/common-hal/pulseio/PWMOut.c
+++ b/ports/atmel-samd/common-hal/pulseio/PWMOut.c
@@ -61,22 +61,31 @@ uint8_t tcc_channels[5]; // Set by pwmout_reset() to {0xc0, 0xf0, 0xf8, 0xfc,
static uint8_t never_reset_tc_or_tcc[TC_INST_NUM + TCC_INST_NUM];
-void common_hal_pulseio_pwmout_never_reset(pulseio_pwmout_obj_t *self) {
- if (self->timer->is_tc) {
- never_reset_tc_or_tcc[self->timer->index] += 1;
+STATIC void timer_refcount(int index, bool is_tc, int increment) {
+ if (is_tc) {
+ never_reset_tc_or_tcc[index] += increment;
} else {
- never_reset_tc_or_tcc[TC_INST_NUM + self->timer->index] += 1;
+ never_reset_tc_or_tcc[TC_INST_NUM + index] += increment;
}
+}
+
+void timer_never_reset(int index, bool is_tc) {
+ timer_refcount(index, is_tc, 1);
+}
+
+void timer_reset_ok(int index, bool is_tc) {
+ timer_refcount(index, is_tc, -1);
+}
+
+
+void common_hal_pulseio_pwmout_never_reset(pulseio_pwmout_obj_t *self) {
+ timer_never_reset(self->timer->index, self->timer->is_tc);
never_reset_pin_number(self->pin->number);
}
void common_hal_pulseio_pwmout_reset_ok(pulseio_pwmout_obj_t *self) {
- if (self->timer->is_tc) {
- never_reset_tc_or_tcc[self->timer->index] -= 1;
- } else {
- never_reset_tc_or_tcc[TC_INST_NUM + self->timer->index] -= 1;
- }
+ timer_reset_ok(self->timer->index, self->timer->is_tc);
}
void pwmout_reset(void) {
@@ -292,7 +301,7 @@ pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self,
}
bool common_hal_pulseio_pwmout_deinited(pulseio_pwmout_obj_t* self) {
- return self->pin == mp_const_none;
+ return self->pin == NULL;
}
void common_hal_pulseio_pwmout_deinit(pulseio_pwmout_obj_t* self) {
@@ -319,7 +328,7 @@ void common_hal_pulseio_pwmout_deinit(pulseio_pwmout_obj_t* self) {
}
}
reset_pin_number(self->pin->number);
- self->pin = mp_const_none;
+ self->pin = NULL;
}
extern void common_hal_pulseio_pwmout_set_duty_cycle(pulseio_pwmout_obj_t* self, uint16_t duty) {
diff --git a/ports/atmel-samd/common-hal/time/__init__.c b/ports/atmel-samd/common-hal/time/__init__.c
index 2d82b3d1a..652e455fc 100644
--- a/ports/atmel-samd/common-hal/time/__init__.c
+++ b/ports/atmel-samd/common-hal/time/__init__.c
@@ -29,11 +29,20 @@
#include "shared-bindings/time/__init__.h"
#include "supervisor/shared/tick.h"
+#include "tick.h"
-inline uint64_t common_hal_time_monotonic() {
+inline uint64_t common_hal_time_monotonic(void) {
return supervisor_ticks_ms64();
}
+uint64_t common_hal_time_monotonic_ns(void) {
+ uint64_t ms;
+ uint32_t us_until_ms;
+ current_tick(&ms, &us_until_ms);
+ // us counts down.
+ return 1000 * (ms * 1000 + (1000 - us_until_ms));
+}
+
void common_hal_time_delay_ms(uint32_t delay) {
mp_hal_delay_ms(delay);
}
diff --git a/ports/atmel-samd/mpconfigport.h b/ports/atmel-samd/mpconfigport.h
index 28a844ffc..04ad98c22 100644
--- a/ports/atmel-samd/mpconfigport.h
+++ b/ports/atmel-samd/mpconfigport.h
@@ -109,6 +109,9 @@
#define CIRCUITPY_DEFAULT_STACK_SIZE 4096
#endif
+// Smallest unit of flash that can be erased.
+#define FLASH_ERASE_SIZE NVMCTRL_ROW_SIZE
+
#endif // SAMD21
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -123,6 +126,9 @@
#define CIRCUITPY_DEFAULT_STACK_SIZE (24*1024)
#endif
+// Smallest unit of flash that can be erased.
+#define FLASH_ERASE_SIZE NVMCTRL_BLOCK_SIZE
+
// If CIRCUITPY is internal, use half of flash for it.
#if INTERNAL_FLASH_FILESYSTEM
#ifndef CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE
@@ -187,25 +193,25 @@
#error BOOTLOADER_START_ADDR must be on a flash page boundary.
#endif
-#if CIRCUITPY_INTERNAL_NVM_START_ADDR % FLASH_PAGE_SIZE != 0
-#error CIRCUITPY_INTERNAL_NVM_START_ADDR must be on a flash page boundary.
+#if CIRCUITPY_INTERNAL_NVM_START_ADDR % FLASH_ERASE_SIZE != 0
+#error CIRCUITPY_INTERNAL_NVM_START_ADDR must be on a flash erase (row or block) boundary.
#endif
-#if CIRCUITPY_INTERNAL_NVM_SIZE % FLASH_PAGE_SIZE != 0
-#error CIRCUITPY_INTERNAL_NVM_SIZE must be a multiple of FLASH_PAGE_SIZE.
+#if CIRCUITPY_INTERNAL_NVM_SIZE % FLASH_ERASE_SIZE != 0
+#error CIRCUITPY_INTERNAL_NVM_SIZE must be a multiple of FLASH_ERASE_SIZE.
#endif
-#if CIRCUITPY_INTERNAL_CONFIG_START_ADDR % FLASH_PAGE_SIZE != 0
-#error CIRCUITPY_INTERNAL_CONFIG_SIZE must be on a flash page boundary.
+#if CIRCUITPY_INTERNAL_CONFIG_START_ADDR % FLASH_ERASE_SIZE != 0
+#error CIRCUITPY_INTERNAL_CONFIG_SIZE must be on a flash erase (row or block) boundary.
#endif
-#if CIRCUITPY_INTERNAL_CONFIG_SIZE % FLASH_PAGE_SIZE != 0
-#error CIRCUITPY_INTERNAL_CONFIG_SIZE must be a multiple of FLASH_PAGE_SIZE.
+#if CIRCUITPY_INTERNAL_CONFIG_SIZE % FLASH_ERASE_SIZE != 0
+#error CIRCUITPY_INTERNAL_CONFIG_SIZE must be a multiple of FLASH_ERASE_SIZE.
#endif
-#if CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_START_ADDR % FLASH_PAGE_SIZE != 0
-#error CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE must be on a flash page boundary.
+#if CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_START_ADDR % FLASH_ERASE_SIZE != 0
+#error CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE must be on a flash erase (row or block) boundary.
#endif
-#if CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE % FLASH_PAGE_SIZE != 0
-#error CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE must be a multiple of FLASH_PAGE_SIZE.
+#if CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE % FLASH_ERASE_SIZE != 0
+#error CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE must be a multiple of FLASH_ERASE_SIZE.
#endif
#if CIRCUITPY_FIRMWARE_SIZE < 0
diff --git a/ports/atmel-samd/mpconfigport.mk b/ports/atmel-samd/mpconfigport.mk
index 354745a2c..61f7c206a 100644
--- a/ports/atmel-samd/mpconfigport.mk
+++ b/ports/atmel-samd/mpconfigport.mk
@@ -40,6 +40,8 @@ endif
# SAMD21 needs separate endpoint pairs for MSC BULK IN and BULK OUT, otherwise it's erratic.
USB_MSC_EP_NUM_OUT = 1
+CIRCUITPY_ULAB = 0
+
endif # samd21
# Put samd51-only choices here.
@@ -62,6 +64,24 @@ ifndef CIRCUITPY_SAMD
CIRCUITPY_SAMD = 1
endif
+ifndef CIRCUITPY_ULAB
+ifneq ($(CIRCUITPY_SMALL_BUILD),1)
+CIRCUITPY_ULAB = 1
+endif
+endif
+
+ifndef CIRCUITPY_PROTOMATTER
+ifneq ($(CIRCUITPY_SMALL_BUILD),1)
+CIRCUITPY_PROTOMATTER = 1
+endif
+endif
+
+ifndef CIRCUITPY_FRAMEBUFFERIO
+ifneq ($(CIRCUITPY_SMALL_BUILD),1)
+CIRCUITPY_FRAMEBUFFERIO = 1
+endif
+endif
+
endif # samd51
INTERNAL_LIBM = 1
diff --git a/ports/atmel-samd/peripherals b/ports/atmel-samd/peripherals
-Subproject b89811f22a24ac350079ceaf0cdf0e62aa03f4f
+Subproject f528240c2a4c2d7a39de786f1aa56895c12227b
diff --git a/ports/atmel-samd/timer_handler.c b/ports/atmel-samd/timer_handler.c
index 5d6de3093..598fad564 100644
--- a/ports/atmel-samd/timer_handler.c
+++ b/ports/atmel-samd/timer_handler.c
@@ -33,6 +33,8 @@
#include "shared-module/_pew/PewPew.h"
#include "common-hal/frequencyio/FrequencyIn.h"
+extern void _PM_IRQ_HANDLER(void);
+
static uint8_t tc_handler[TC_INST_NUM];
void set_timer_handler(bool is_tc, uint8_t index, uint8_t timer_handler) {
@@ -62,6 +64,11 @@ void shared_timer_handler(bool is_tc, uint8_t index) {
frequencyin_interrupt_handler(index);
#endif
break;
+ case TC_HANDLER_PROTOMATTER:
+ #if CIRCUITPY_PROTOMATTER
+ _PM_IRQ_HANDLER();
+ #endif
+ break;
default:
break;
}
diff --git a/ports/atmel-samd/timer_handler.h b/ports/atmel-samd/timer_handler.h
index 4a7adb58c..646cd54ec 100644
--- a/ports/atmel-samd/timer_handler.h
+++ b/ports/atmel-samd/timer_handler.h
@@ -30,8 +30,13 @@
#define TC_HANDLER_PULSEOUT 0x1
#define TC_HANDLER_PEW 0x2
#define TC_HANDLER_FREQUENCYIN 0x3
+#define TC_HANDLER_PROTOMATTER 0x4
void set_timer_handler(bool is_tc, uint8_t index, uint8_t timer_handler);
void shared_timer_handler(bool is_tc, uint8_t index);
+// implementation of these functions is in PWMOut.c
+void timer_never_reset(int index, bool is_tc);
+void timer_reset_ok(int index, bool is_tc);
+
#endif // MICROPY_INCLUDED_ATMEL_SAMD_TIMER_HANDLER_H
diff --git a/ports/cxd56/Makefile b/ports/cxd56/Makefile
index a0782c4e9..e2fce976d 100644
--- a/ports/cxd56/Makefile
+++ b/ports/cxd56/Makefile
@@ -176,6 +176,10 @@ OBJ = $(PY_O) $(SUPERVISOR_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.o))
OBJ += $(addprefix $(BUILD)/, $(SRC_COMMON_HAL_EXPANDED:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(SRC_SHARED_MODULE_EXPANDED:.c=.o))
+ifeq ($(INTERNAL_LIBM),1)
+OBJ += $(addprefix $(BUILD)/, $(SRC_LIBM:.c=.o))
+endif
+OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o))
# List of sources for qstr extraction
SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED)
diff --git a/ports/cxd56/boards/spresense/mpconfigboard.h b/ports/cxd56/boards/spresense/mpconfigboard.h
index 0245e2045..c53f6b418 100644
--- a/ports/cxd56/boards/spresense/mpconfigboard.h
+++ b/ports/cxd56/boards/spresense/mpconfigboard.h
@@ -36,3 +36,6 @@
#define DEFAULT_UART_BUS_RX (&pin_UART2_RXD)
#define DEFAULT_UART_BUS_TX (&pin_UART2_TXD)
+
+#define MICROPY_PY_REVERSE_SPECIAL_METHODS (1)
+
diff --git a/ports/cxd56/common-hal/analogio/AnalogIn.c b/ports/cxd56/common-hal/analogio/AnalogIn.c
index e2ca5e4a4..cdf37c06a 100644
--- a/ports/cxd56/common-hal/analogio/AnalogIn.c
+++ b/ports/cxd56/common-hal/analogio/AnalogIn.c
@@ -83,7 +83,7 @@ void common_hal_analogio_analogin_construct(analogio_analogin_obj_t *self, const
// start ADC
ioctl(analogin_dev[self->number].fd, ANIOC_CXD56_START, 0);
-
+
self->pin = pin;
}
@@ -97,7 +97,7 @@ void common_hal_analogio_analogin_deinit(analogio_analogin_obj_t *self) {
close(analogin_dev[self->number].fd);
analogin_dev[self->number].fd = -1;
- self->pin = mp_const_none;
+ self->pin = NULL;
}
bool common_hal_analogio_analogin_deinited(analogio_analogin_obj_t *self) {
diff --git a/ports/cxd56/common-hal/busio/UART.c b/ports/cxd56/common-hal/busio/UART.c
index 40ae3b761..3bca240e0 100644
--- a/ports/cxd56/common-hal/busio/UART.c
+++ b/ports/cxd56/common-hal/busio/UART.c
@@ -53,11 +53,17 @@ STATIC busio_uart_dev_t busio_uart_dev[] = {
};
void common_hal_busio_uart_construct(busio_uart_obj_t *self,
- const mcu_pin_obj_t *tx, const mcu_pin_obj_t *rx, uint32_t baudrate,
- uint8_t bits, uart_parity_t parity, uint8_t stop, mp_float_t timeout,
- uint16_t receiver_buffer_size) {
+ const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx,
+ const mcu_pin_obj_t * rts, const mcu_pin_obj_t * cts,
+ const mcu_pin_obj_t * rs485_dir, bool rs485_invert,
+ uint32_t baudrate, uint8_t bits, uart_parity_t parity, uint8_t stop,
+ mp_float_t timeout, uint16_t receiver_buffer_size) {
struct termios tio;
+ if ((rts != NULL) || (cts != NULL) || (rs485_dir != NULL) || (rs485_invert)) {
+ mp_raise_ValueError(translate("RTS/CTS/RS485 Not yet supported on this device"));
+ }
+
if (bits != 8) {
mp_raise_ValueError(translate("Could not initialize UART"));
}
diff --git a/ports/cxd56/common-hal/digitalio/DigitalInOut.c b/ports/cxd56/common-hal/digitalio/DigitalInOut.c
index 7b1f6cc03..c9af12e44 100644
--- a/ports/cxd56/common-hal/digitalio/DigitalInOut.c
+++ b/ports/cxd56/common-hal/digitalio/DigitalInOut.c
@@ -56,11 +56,11 @@ void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t *self
board_gpio_config(self->pin->number, 0, false, true, PIN_FLOAT);
reset_pin_number(self->pin->number);
- self->pin = mp_const_none;
+ self->pin = NULL;
}
bool common_hal_digitalio_digitalinout_deinited(digitalio_digitalinout_obj_t *self) {
- return self->pin == mp_const_none;
+ return self->pin == NULL;
}
void common_hal_digitalio_digitalinout_switch_to_input(digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) {
diff --git a/ports/cxd56/common-hal/pulseio/PWMOut.c b/ports/cxd56/common-hal/pulseio/PWMOut.c
index a0b4e79c6..7e0be566b 100644
--- a/ports/cxd56/common-hal/pulseio/PWMOut.c
+++ b/ports/cxd56/common-hal/pulseio/PWMOut.c
@@ -50,7 +50,7 @@ pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t *self,
const mcu_pin_obj_t *pin, uint16_t duty, uint32_t frequency,
bool variable_frequency) {
self->number = -1;
-
+
for (int i = 0; i < MP_ARRAY_SIZE(pwmout_dev); i++) {
if (pin->number == pwmout_dev[i].pin->number) {
self->number = i;
@@ -95,7 +95,7 @@ void common_hal_pulseio_pwmout_deinit(pulseio_pwmout_obj_t *self) {
pwmout_dev[self->number].fd = -1;
reset_pin_number(self->pin->number);
- self->pin = mp_const_none;
+ self->pin = NULL;
}
bool common_hal_pulseio_pwmout_deinited(pulseio_pwmout_obj_t *self) {
@@ -131,11 +131,11 @@ bool common_hal_pulseio_pwmout_get_variable_frequency(pulseio_pwmout_obj_t *self
void common_hal_pulseio_pwmout_never_reset(pulseio_pwmout_obj_t *self) {
never_reset_pin_number(self->pin->number);
- pwmout_dev[self->number].reset = false;
+ pwmout_dev[self->number].reset = false;
}
void common_hal_pulseio_pwmout_reset_ok(pulseio_pwmout_obj_t *self) {
- pwmout_dev[self->number].reset = true;
+ pwmout_dev[self->number].reset = true;
}
void pwmout_reset(void) {
diff --git a/ports/cxd56/common-hal/pulseio/PulseIn.c b/ports/cxd56/common-hal/pulseio/PulseIn.c
index dd2773d1d..65ca1d97e 100644
--- a/ports/cxd56/common-hal/pulseio/PulseIn.c
+++ b/ports/cxd56/common-hal/pulseio/PulseIn.c
@@ -106,7 +106,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self,
board_gpio_int(self->pin->number, true);
}
-
+
void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t *self) {
if (common_hal_pulseio_pulsein_deinited(self)) {
return;
@@ -116,18 +116,18 @@ void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t *self) {
board_gpio_intconfig(self->pin->number, 0, false, NULL);
reset_pin_number(self->pin->number);
- self->pin = mp_const_none;
+ self->pin = NULL;
}
-
+
bool common_hal_pulseio_pulsein_deinited(pulseio_pulsein_obj_t *self) {
- return self->pin == mp_const_none;
+ return self->pin == NULL;
}
-
+
void common_hal_pulseio_pulsein_pause(pulseio_pulsein_obj_t *self) {
board_gpio_int(self->pin->number, false);
self->paused = true;
}
-
+
void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t *self, uint16_t trigger_duration) {
// Make sure we're paused.
common_hal_pulseio_pulsein_pause(self);
@@ -147,14 +147,14 @@ void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t *self, uint16_t tri
pulsein_set_config(self, true);
board_gpio_int(self->pin->number, true);
}
-
+
void common_hal_pulseio_pulsein_clear(pulseio_pulsein_obj_t *self) {
common_hal_mcu_disable_interrupts();
self->start = 0;
self->len = 0;
common_hal_mcu_enable_interrupts();
}
-
+
uint16_t common_hal_pulseio_pulsein_popleft(pulseio_pulsein_obj_t *self) {
if (self->len == 0) {
mp_raise_IndexError(translate("pop from an empty PulseIn"));
@@ -167,19 +167,19 @@ uint16_t common_hal_pulseio_pulsein_popleft(pulseio_pulsein_obj_t *self) {
return value;
}
-
+
uint16_t common_hal_pulseio_pulsein_get_maxlen(pulseio_pulsein_obj_t *self) {
return self->maxlen;
}
-
+
bool common_hal_pulseio_pulsein_get_paused(pulseio_pulsein_obj_t *self) {
return self->paused;
}
-
+
uint16_t common_hal_pulseio_pulsein_get_len(pulseio_pulsein_obj_t *self) {
return self->len;
}
-
+
uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t *self, int16_t index) {
common_hal_mcu_disable_interrupts();
if (index < 0) {
@@ -193,4 +193,3 @@ uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t *self, int16_
common_hal_mcu_enable_interrupts();
return value;
}
- \ No newline at end of file
diff --git a/ports/cxd56/common-hal/time/__init__.c b/ports/cxd56/common-hal/time/__init__.c
index 6f5eedd41..31c63cbb2 100644
--- a/ports/cxd56/common-hal/time/__init__.c
+++ b/ports/cxd56/common-hal/time/__init__.c
@@ -24,6 +24,8 @@
* THE SOFTWARE.
*/
+#include <sys/time.h>
+
#include "py/mphal.h"
#include "supervisor/shared/tick.h"
@@ -32,6 +34,12 @@ uint64_t common_hal_time_monotonic(void) {
return supervisor_ticks_ms64();
}
+uint64_t common_hal_time_monotonic_ns(void) {
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ return 1000 * ((uint64_t) tv.tv_sec * 1000000 + (uint64_t) tv.tv_usec);
+}
+
void common_hal_time_delay_ms(uint32_t delay) {
mp_hal_delay_ms(delay);
}
diff --git a/ports/cxd56/mpconfigport.mk b/ports/cxd56/mpconfigport.mk
index a418ae8e9..ad3d0e72d 100644
--- a/ports/cxd56/mpconfigport.mk
+++ b/ports/cxd56/mpconfigport.mk
@@ -18,3 +18,5 @@ CIRCUITPY_NEOPIXEL_WRITE = 0
CIRCUITPY_NVM = 0
CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_FREQUENCYIO = 0
+
+INTERNAL_LIBM = 1
diff --git a/ports/litex/Makefile b/ports/litex/Makefile
new file mode 100644
index 000000000..51cb18635
--- /dev/null
+++ b/ports/litex/Makefile
@@ -0,0 +1,200 @@
+# This file is part of the MicroPython project, http://micropython.org/
+#
+# The MIT License (MIT)
+#
+# 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
+# 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.
+
+# Select the board to build for.
+ifeq ($(BOARD),)
+ $(error You must provide a BOARD parameter)
+else
+ ifeq ($(wildcard boards/$(BOARD)/.),)
+ $(error Invalid BOARD specified)
+ endif
+endif
+
+# If the build directory is not given, make it reflect the board name.
+BUILD ?= build-$(BOARD)
+
+include ../../py/mkenv.mk
+# Board-specific
+include boards/$(BOARD)/mpconfigboard.mk
+# Port-specific
+include mpconfigport.mk
+
+# CircuitPython-specific
+include $(TOP)/py/circuitpy_mpconfig.mk
+
+# qstr definitions (must come before including py.mk)
+QSTR_DEFS = qstrdefsport.h
+
+# include py core make definitions
+include $(TOP)/py/py.mk
+
+include $(TOP)/supervisor/supervisor.mk
+
+# Include make rules and variables common across CircuitPython builds.
+include $(TOP)/py/circuitpy_defns.mk
+
+CROSS_COMPILE = riscv64-unknown-elf-
+
+#######################################
+# CFLAGS
+#######################################
+
+INC += -I.
+INC += -I../..
+INC += -I$(BUILD)
+INC += -I$(BUILD)/genhdr
+INC += -I./boards
+INC += -I./boards/$(BOARD)
+INC += -I./peripherals
+INC += -I../../lib/mp-readline
+INC += -I../../lib/tinyusb/src
+INC += -I../../supervisor/shared/usb
+
+
+#Debugging/Optimization
+ifeq ($(DEBUG), 1)
+ CFLAGS += -ggdb
+ # You may want to enable these flags to make setting breakpoints easier.
+ CFLAGS += -fno-inline -fno-ipa-sra
+else
+ CFLAGS += -Os -DNDEBUG -ggdb3
+ # TODO: Test with -flto
+ ### CFLAGS += -flto
+endif
+
+CFLAGS += $(INC) -Werror -Wall -std=gnu11 -nostdlib $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT)
+
+# TODO: check this
+CFLAGS += -D__START=main -DFOMU
+
+LD_FILE := boards/$(BOARD)/$(BOARD)-spi.ld
+
+LDFLAGS = $(CFLAGS) -fshort-enums -Wl,-nostdlib -Wl,-T,$(LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nano.specs -Wl,-melf32lriscv
+LIBS := -lgcc -lc
+
+
+LDFLAGS += -flto -ffreestanding -nostartfiles -Wl,--gc-section -Wl,-Bstatic -Wl,-melf32lriscv -nostartfiles \
+ -Wl,--no-warn-mismatch \
+ -Wl,--build-id=none
+
+# Use toolchain libm if we're not using our own.
+ifndef INTERNAL_LIBM
+LIBS += -lm
+endif
+
+# TinyUSB defines
+CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_VALENTYUSB_EPTRI -DCFG_TUD_CDC_RX_BUFSIZE=1024 -DCFG_TUD_CDC_TX_BUFSIZE=1024 -DCFG_TUD_MSC_BUFSIZE=4096 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_MIDI_TX_BUFSIZE=128
+
+
+######################################
+# source
+######################################
+
+
+SRC_C += \
+ background.c \
+ fatfs_port.c \
+ mphalport.c \
+ tick.c \
+ boards/$(BOARD)/board.c \
+ boards/$(BOARD)/pins.c \
+ lib/libc/string0.c \
+ lib/mp-readline/readline.c \
+ lib/oofatfs/ff.c \
+ lib/oofatfs/option/ccsbcs.c \
+ lib/timeutils/timeutils.c \
+ lib/utils/buffer_helper.c \
+ lib/utils/context_manager_helpers.c \
+ lib/utils/interrupt_char.c \
+ lib/utils/pyexec.c \
+ lib/utils/stdout_helpers.c \
+ lib/utils/sys_stdio_mphal.c \
+ supervisor/shared/memory.c
+
+ifneq ($(USB),FALSE)
+SRC_C += lib/tinyusb/src/portable/valentyusb/eptri/dcd_eptri.c
+endif
+
+SRC_S = \
+ crt0-vexriscv.S
+
+SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \
+ $(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \
+ $(addprefix common-hal/, $(SRC_COMMON_HAL))
+
+SRC_SHARED_MODULE_EXPANDED = $(addprefix shared-bindings/, $(SRC_SHARED_MODULE)) \
+ $(addprefix shared-module/, $(SRC_SHARED_MODULE)) \
+ $(addprefix shared-module/, $(SRC_SHARED_MODULE_INTERNAL))
+
+
+ifneq ($(FROZEN_MPY_DIR),)
+FROZEN_MPY_PY_FILES := $(shell find -L $(FROZEN_MPY_DIR) -type f -name '*.py')
+FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/,$(FROZEN_MPY_PY_FILES:.py=.mpy))
+endif
+
+OBJ += $(PY_O) $(SUPERVISOR_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
+OBJ += $(addprefix $(BUILD)/, $(SRC_COMMON_HAL_EXPANDED:.c=.o))
+OBJ += $(addprefix $(BUILD)/, $(SRC_SHARED_MODULE_EXPANDED:.c=.o))
+ifeq ($(INTERNAL_LIBM),1)
+OBJ += $(addprefix $(BUILD)/, $(SRC_LIBM:.c=.o))
+endif
+OBJ += $(addprefix $(BUILD)/, $(SRC_S:.S=.o))
+OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o))
+
+$(BUILD)/$(FATFS_DIR)/ff.o: COPT += -Os
+$(filter $(PY_BUILD)/../extmod/vfs_fat_%.o, $(PY_O)): COPT += -Os
+
+# List of sources for qstr extraction
+SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_MOD) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED)
+# Sources that only hold QSTRs after pre-processing.
+SRC_QSTR_PREPROCESSOR +=
+
+
+all: $(BUILD)/firmware.bin $(BUILD)/firmware.dfu
+
+$(BUILD)/firmware.elf: $(OBJ)
+ $(STEPECHO) "LINK $@"
+ $(Q)$(CC) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(LIBS) -Wl,--end-group
+ $(Q)$(SIZE) $@ | $(PYTHON3) $(TOP)/tools/build_memory_info.py $(LD_FILE)
+
+$(BUILD)/firmware.bin: $(BUILD)/firmware.elf
+ $(STEPECHO) "Create $@"
+ $(Q)$(OBJCOPY) -O binary $^ $@
+# $(Q)$(OBJCOPY) -O binary -j .vectors -j .text -j .data $^ $@
+
+$(BUILD)/firmware.hex: $(BUILD)/firmware.elf
+ $(STEPECHO) "Create $@"
+ $(Q)$(OBJCOPY) -O ihex $^ $@
+# $(Q)$(OBJCOPY) -O ihex -j .vectors -j .text -j .data $^ $@
+
+$(BUILD)/firmware.dfu: $(BUILD)/firmware.bin
+ $(ECHO) "Create $@"
+ $(PYTHON3) $(TOP)/tools/dfu.py -b $^ -D 0x1209:0x5bf0 "$(BUILD)/firmware.dfu"
+
+include $(TOP)/py/mkrules.mk
+
+# Print out the value of a make variable.
+# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile
+print-%:
+ @echo $* = $($*)
diff --git a/ports/stm32f4/background.c b/ports/litex/background.c
index 8c1897043..8c1897043 100644
--- a/ports/stm32f4/background.c
+++ b/ports/litex/background.c
diff --git a/ports/stm32f4/background.h b/ports/litex/background.h
index 05a4f894a..09551c7fb 100644
--- a/ports/stm32f4/background.h
+++ b/ports/litex/background.h
@@ -24,12 +24,12 @@
* THE SOFTWARE.
*/
-#ifndef MICROPY_INCLUDED_STM32F4_BACKGROUND_H
-#define MICROPY_INCLUDED_STM32F4_BACKGROUND_H
+#ifndef MICROPY_INCLUDED_LITEX_BACKGROUND_H
+#define MICROPY_INCLUDED_LITEX_BACKGROUND_H
#include <stdbool.h>
void background_tasks_reset(void);
void run_background_tasks(void);
-#endif // MICROPY_INCLUDED_STM32F4_BACKGROUND_H
+#endif // MICROPY_INCLUDED_LITEX_BACKGROUND_H
diff --git a/ports/litex/boards/board.h b/ports/litex/boards/board.h
new file mode 100644
index 000000000..837b37190
--- /dev/null
+++ b/ports/litex/boards/board.h
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+// This file defines board specific functions.
+
+#ifndef MICROPY_INCLUDED_LITEX_BOARDS_BOARD_H
+#define MICROPY_INCLUDED_LITEX_BOARDS_BOARD_H
+
+#include <stdbool.h>
+
+// Initializes board related state once on start up.
+void board_init(void);
+
+// Returns true if the user initiates safe mode in a board specific way.
+// Also add BOARD_USER_SAFE_MODE in mpconfigboard.h to explain the board specific
+// way.
+bool board_requests_safe_mode(void);
+
+// Reset the state of off MCU components such as neopixels.
+void reset_board(void);
+
+#endif // MICROPY_INCLUDED_LITEX_BOARDS_BOARD_H
diff --git a/ports/litex/boards/fomu/board.c b/ports/litex/boards/fomu/board.c
new file mode 100644
index 000000000..97e1ecadd
--- /dev/null
+++ b/ports/litex/boards/fomu/board.c
@@ -0,0 +1,75 @@
+/*
+ * 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 "csr.h"
+
+// ICE40 LED Driver hard macro.
+// See http://www.latticesemi.com/-/media/LatticeSemi/Documents/ApplicationNotes/IK/ICE40LEDDriverUsageGuide.ashx?document_id=50668
+enum led_registers {
+ LEDDCR0 = 8,
+ LEDDBR = 9,
+ LEDDONR = 10,
+ LEDDOFR = 11,
+ LEDDBCRR = 5,
+ LEDDBCFR = 6,
+ LEDDPWRR = 1,
+ LEDDPWRG = 2,
+ LEDDPWRB = 3,
+};
+
+#define BREATHE_ENABLE (1 << 7)
+#define BREATHE_EDGE_ON (0 << 6)
+#define BREATHE_EDGE_BOTH (1 << 6)
+#define BREATHE_MODE_MODULATE (1 << 5)
+#define BREATHE_RATE(x) ((x & 7) << 0)
+
+// Write a value into the LEDDA_IP register.
+static void ledda_write(uint8_t value, uint8_t addr) {
+ rgb_addr_write(addr);
+ rgb_dat_write(value);
+}
+
+void board_init(void) {
+ uint8_t onrate = 15;
+ uint8_t offrate = 1;
+
+ ledda_write(BREATHE_ENABLE | BREATHE_MODE_MODULATE | BREATHE_RATE(onrate), LEDDBCRR);
+ ledda_write(BREATHE_ENABLE | BREATHE_MODE_MODULATE | BREATHE_RATE(offrate), LEDDBCFR);
+
+ ledda_write(123, LEDDPWRR); // Red
+ ledda_write(3, LEDDPWRG); // Green
+ ledda_write(98, LEDDPWRB); // Blue
+}
+
+bool board_requests_safe_mode(void) {
+ return false;
+}
+
+void reset_board(void) {
+
+}
diff --git a/ports/litex/boards/fomu/csr.h b/ports/litex/boards/fomu/csr.h
new file mode 100644
index 000000000..bf66fe3a1
--- /dev/null
+++ b/ports/litex/boards/fomu/csr.h
@@ -0,0 +1,647 @@
+//--------------------------------------------------------------------------------
+// Auto-generated by Migen (f4fcd10) & LiteX (de205d4a) on 2019-11-25 14:57:34
+//--------------------------------------------------------------------------------
+#include <generated/soc.h>
+#ifndef __GENERATED_CSR_H
+#define __GENERATED_CSR_H
+#include <stdint.h>
+#ifdef CSR_ACCESSORS_DEFINED
+extern void csr_writeb(uint8_t value, unsigned long addr);
+extern uint8_t csr_readb(unsigned long addr);
+extern void csr_writew(uint16_t value, unsigned long addr);
+extern uint16_t csr_readw(unsigned long addr);
+extern void csr_writel(uint32_t value, unsigned long addr);
+extern uint32_t csr_readl(unsigned long addr);
+#else /* ! CSR_ACCESSORS_DEFINED */
+#include <hw/common.h>
+#endif /* ! CSR_ACCESSORS_DEFINED */
+
+/* ctrl */
+#define CSR_CTRL_BASE 0xe0000000L
+#define CSR_CTRL_RESET_ADDR 0xe0000000L
+#define CSR_CTRL_RESET_SIZE 1
+static inline unsigned char ctrl_reset_read(void) {
+ unsigned char r = csr_readl(0xe0000000L);
+ return r;
+}
+static inline void ctrl_reset_write(unsigned char value) {
+ csr_writel(value, 0xe0000000L);
+}
+#define CSR_CTRL_SCRATCH_ADDR 0xe0000004L
+#define CSR_CTRL_SCRATCH_SIZE 4
+static inline unsigned int ctrl_scratch_read(void) {
+ unsigned int r = csr_readl(0xe0000004L);
+ r <<= 8;
+ r |= csr_readl(0xe0000008L);
+ r <<= 8;
+ r |= csr_readl(0xe000000cL);
+ r <<= 8;
+ r |= csr_readl(0xe0000010L);
+ return r;
+}
+static inline void ctrl_scratch_write(unsigned int value) {
+ csr_writel(value >> 24, 0xe0000004L);
+ csr_writel(value >> 16, 0xe0000008L);
+ csr_writel(value >> 8, 0xe000000cL);
+ csr_writel(value, 0xe0000010L);
+}
+#define CSR_CTRL_BUS_ERRORS_ADDR 0xe0000014L
+#define CSR_CTRL_BUS_ERRORS_SIZE 4
+static inline unsigned int ctrl_bus_errors_read(void) {
+ unsigned int r = csr_readl(0xe0000014L);
+ r <<= 8;
+ r |= csr_readl(0xe0000018L);
+ r <<= 8;
+ r |= csr_readl(0xe000001cL);
+ r <<= 8;
+ r |= csr_readl(0xe0000020L);
+ return r;
+}
+
+/* lxspi */
+#define CSR_LXSPI_BASE 0xe0007800L
+#define CSR_LXSPI_BITBANG_ADDR 0xe0007800L
+#define CSR_LXSPI_BITBANG_SIZE 1
+static inline unsigned char lxspi_bitbang_read(void) {
+ unsigned char r = csr_readl(0xe0007800L);
+ return r;
+}
+static inline void lxspi_bitbang_write(unsigned char value) {
+ csr_writel(value, 0xe0007800L);
+}
+#define CSR_LXSPI_BITBANG_MOSI_OFFSET 0
+#define CSR_LXSPI_BITBANG_MOSI_SIZE 1
+#define CSR_LXSPI_BITBANG_CLK_OFFSET 1
+#define CSR_LXSPI_BITBANG_CLK_SIZE 1
+#define CSR_LXSPI_BITBANG_CS_N_OFFSET 2
+#define CSR_LXSPI_BITBANG_CS_N_SIZE 1
+#define CSR_LXSPI_BITBANG_DIR_OFFSET 3
+#define CSR_LXSPI_BITBANG_DIR_SIZE 1
+#define CSR_LXSPI_MISO_ADDR 0xe0007804L
+#define CSR_LXSPI_MISO_SIZE 1
+static inline unsigned char lxspi_miso_read(void) {
+ unsigned char r = csr_readl(0xe0007804L);
+ return r;
+}
+#define CSR_LXSPI_BITBANG_EN_ADDR 0xe0007808L
+#define CSR_LXSPI_BITBANG_EN_SIZE 1
+static inline unsigned char lxspi_bitbang_en_read(void) {
+ unsigned char r = csr_readl(0xe0007808L);
+ return r;
+}
+static inline void lxspi_bitbang_en_write(unsigned char value) {
+ csr_writel(value, 0xe0007808L);
+}
+
+/* messible */
+#define CSR_MESSIBLE_BASE 0xe0008000L
+#define CSR_MESSIBLE_IN_ADDR 0xe0008000L
+#define CSR_MESSIBLE_IN_SIZE 1
+static inline unsigned char messible_in_read(void) {
+ unsigned char r = csr_readl(0xe0008000L);
+ return r;
+}
+static inline void messible_in_write(unsigned char value) {
+ csr_writel(value, 0xe0008000L);
+}
+#define CSR_MESSIBLE_OUT_ADDR 0xe0008004L
+#define CSR_MESSIBLE_OUT_SIZE 1
+static inline unsigned char messible_out_read(void) {
+ unsigned char r = csr_readl(0xe0008004L);
+ return r;
+}
+#define CSR_MESSIBLE_STATUS_ADDR 0xe0008008L
+#define CSR_MESSIBLE_STATUS_SIZE 1
+static inline unsigned char messible_status_read(void) {
+ unsigned char r = csr_readl(0xe0008008L);
+ return r;
+}
+#define CSR_MESSIBLE_STATUS_FULL_OFFSET 0
+#define CSR_MESSIBLE_STATUS_FULL_SIZE 1
+#define CSR_MESSIBLE_STATUS_HAVE_OFFSET 1
+#define CSR_MESSIBLE_STATUS_HAVE_SIZE 1
+
+/* reboot */
+#define CSR_REBOOT_BASE 0xe0006000L
+#define CSR_REBOOT_CTRL_ADDR 0xe0006000L
+#define CSR_REBOOT_CTRL_SIZE 1
+static inline unsigned char reboot_ctrl_read(void) {
+ unsigned char r = csr_readl(0xe0006000L);
+ return r;
+}
+static inline void reboot_ctrl_write(unsigned char value) {
+ csr_writel(value, 0xe0006000L);
+}
+#define CSR_REBOOT_CTRL_IMAGE_OFFSET 0
+#define CSR_REBOOT_CTRL_IMAGE_SIZE 2
+#define CSR_REBOOT_CTRL_KEY_OFFSET 2
+#define CSR_REBOOT_CTRL_KEY_SIZE 6
+#define CSR_REBOOT_ADDR_ADDR 0xe0006004L
+#define CSR_REBOOT_ADDR_SIZE 4
+static inline unsigned int reboot_addr_read(void) {
+ unsigned int r = csr_readl(0xe0006004L);
+ r <<= 8;
+ r |= csr_readl(0xe0006008L);
+ r <<= 8;
+ r |= csr_readl(0xe000600cL);
+ r <<= 8;
+ r |= csr_readl(0xe0006010L);
+ return r;
+}
+static inline void reboot_addr_write(unsigned int value) {
+ csr_writel(value >> 24, 0xe0006004L);
+ csr_writel(value >> 16, 0xe0006008L);
+ csr_writel(value >> 8, 0xe000600cL);
+ csr_writel(value, 0xe0006010L);
+}
+
+/* rgb */
+#define CSR_RGB_BASE 0xe0006800L
+#define CSR_RGB_DAT_ADDR 0xe0006800L
+#define CSR_RGB_DAT_SIZE 1
+static inline unsigned char rgb_dat_read(void) {
+ unsigned char r = csr_readl(0xe0006800L);
+ return r;
+}
+static inline void rgb_dat_write(unsigned char value) {
+ csr_writel(value, 0xe0006800L);
+}
+#define CSR_RGB_ADDR_ADDR 0xe0006804L
+#define CSR_RGB_ADDR_SIZE 1
+static inline unsigned char rgb_addr_read(void) {
+ unsigned char r = csr_readl(0xe0006804L);
+ return r;
+}
+static inline void rgb_addr_write(unsigned char value) {
+ csr_writel(value, 0xe0006804L);
+}
+#define CSR_RGB_CTRL_ADDR 0xe0006808L
+#define CSR_RGB_CTRL_SIZE 1
+static inline unsigned char rgb_ctrl_read(void) {
+ unsigned char r = csr_readl(0xe0006808L);
+ return r;
+}
+static inline void rgb_ctrl_write(unsigned char value) {
+ csr_writel(value, 0xe0006808L);
+}
+#define CSR_RGB_CTRL_EXE_OFFSET 0
+#define CSR_RGB_CTRL_EXE_SIZE 1
+#define CSR_RGB_CTRL_CURREN_OFFSET 1
+#define CSR_RGB_CTRL_CURREN_SIZE 1
+#define CSR_RGB_CTRL_RGBLEDEN_OFFSET 2
+#define CSR_RGB_CTRL_RGBLEDEN_SIZE 1
+#define CSR_RGB_CTRL_RRAW_OFFSET 3
+#define CSR_RGB_CTRL_RRAW_SIZE 1
+#define CSR_RGB_CTRL_GRAW_OFFSET 4
+#define CSR_RGB_CTRL_GRAW_SIZE 1
+#define CSR_RGB_CTRL_BRAW_OFFSET 5
+#define CSR_RGB_CTRL_BRAW_SIZE 1
+#define CSR_RGB_RAW_ADDR 0xe000680cL
+#define CSR_RGB_RAW_SIZE 1
+static inline unsigned char rgb_raw_read(void) {
+ unsigned char r = csr_readl(0xe000680cL);
+ return r;
+}
+static inline void rgb_raw_write(unsigned char value) {
+ csr_writel(value, 0xe000680cL);
+}
+#define CSR_RGB_RAW_R_OFFSET 0
+#define CSR_RGB_RAW_R_SIZE 1
+#define CSR_RGB_RAW_G_OFFSET 1
+#define CSR_RGB_RAW_G_SIZE 1
+#define CSR_RGB_RAW_B_OFFSET 2
+#define CSR_RGB_RAW_B_SIZE 1
+
+/* timer0 */
+#define CSR_TIMER0_BASE 0xe0002800L
+#define CSR_TIMER0_LOAD_ADDR 0xe0002800L
+#define CSR_TIMER0_LOAD_SIZE 4
+static inline unsigned int timer0_load_read(void) {
+ unsigned int r = csr_readl(0xe0002800L);
+ r <<= 8;
+ r |= csr_readl(0xe0002804L);
+ r <<= 8;
+ r |= csr_readl(0xe0002808L);
+ r <<= 8;
+ r |= csr_readl(0xe000280cL);
+ return r;
+}
+static inline void timer0_load_write(unsigned int value) {
+ csr_writel(value >> 24, 0xe0002800L);
+ csr_writel(value >> 16, 0xe0002804L);
+ csr_writel(value >> 8, 0xe0002808L);
+ csr_writel(value, 0xe000280cL);
+}
+#define CSR_TIMER0_RELOAD_ADDR 0xe0002810L
+#define CSR_TIMER0_RELOAD_SIZE 4
+static inline unsigned int timer0_reload_read(void) {
+ unsigned int r = csr_readl(0xe0002810L);
+ r <<= 8;
+ r |= csr_readl(0xe0002814L);
+ r <<= 8;
+ r |= csr_readl(0xe0002818L);
+ r <<= 8;
+ r |= csr_readl(0xe000281cL);
+ return r;
+}
+static inline void timer0_reload_write(unsigned int value) {
+ csr_writel(value >> 24, 0xe0002810L);
+ csr_writel(value >> 16, 0xe0002814L);
+ csr_writel(value >> 8, 0xe0002818L);
+ csr_writel(value, 0xe000281cL);
+}
+#define CSR_TIMER0_EN_ADDR 0xe0002820L
+#define CSR_TIMER0_EN_SIZE 1
+static inline unsigned char timer0_en_read(void) {
+ unsigned char r = csr_readl(0xe0002820L);
+ return r;
+}
+static inline void timer0_en_write(unsigned char value) {
+ csr_writel(value, 0xe0002820L);
+}
+#define CSR_TIMER0_UPDATE_VALUE_ADDR 0xe0002824L
+#define CSR_TIMER0_UPDATE_VALUE_SIZE 1
+static inline unsigned char timer0_update_value_read(void) {
+ unsigned char r = csr_readl(0xe0002824L);
+ return r;
+}
+static inline void timer0_update_value_write(unsigned char value) {
+ csr_writel(value, 0xe0002824L);
+}
+#define CSR_TIMER0_VALUE_ADDR 0xe0002828L
+#define CSR_TIMER0_VALUE_SIZE 4
+static inline unsigned int timer0_value_read(void) {
+ unsigned int r = csr_readl(0xe0002828L);
+ r <<= 8;
+ r |= csr_readl(0xe000282cL);
+ r <<= 8;
+ r |= csr_readl(0xe0002830L);
+ r <<= 8;
+ r |= csr_readl(0xe0002834L);
+ return r;
+}
+#define CSR_TIMER0_EV_STATUS_ADDR 0xe0002838L
+#define CSR_TIMER0_EV_STATUS_SIZE 1
+static inline unsigned char timer0_ev_status_read(void) {
+ unsigned char r = csr_readl(0xe0002838L);
+ return r;
+}
+static inline void timer0_ev_status_write(unsigned char value) {
+ csr_writel(value, 0xe0002838L);
+}
+#define CSR_TIMER0_EV_PENDING_ADDR 0xe000283cL
+#define CSR_TIMER0_EV_PENDING_SIZE 1
+static inline unsigned char timer0_ev_pending_read(void) {
+ unsigned char r = csr_readl(0xe000283cL);
+ return r;
+}
+static inline void timer0_ev_pending_write(unsigned char value) {
+ csr_writel(value, 0xe000283cL);
+}
+#define CSR_TIMER0_EV_ENABLE_ADDR 0xe0002840L
+#define CSR_TIMER0_EV_ENABLE_SIZE 1
+static inline unsigned char timer0_ev_enable_read(void) {
+ unsigned char r = csr_readl(0xe0002840L);
+ return r;
+}
+static inline void timer0_ev_enable_write(unsigned char value) {
+ csr_writel(value, 0xe0002840L);
+}
+
+/* touch */
+#define CSR_TOUCH_BASE 0xe0005800L
+#define CSR_TOUCH_O_ADDR 0xe0005800L
+#define CSR_TOUCH_O_SIZE 1
+static inline unsigned char touch_o_read(void) {
+ unsigned char r = csr_readl(0xe0005800L);
+ return r;
+}
+static inline void touch_o_write(unsigned char value) {
+ csr_writel(value, 0xe0005800L);
+}
+#define CSR_TOUCH_OE_ADDR 0xe0005804L
+#define CSR_TOUCH_OE_SIZE 1
+static inline unsigned char touch_oe_read(void) {
+ unsigned char r = csr_readl(0xe0005804L);
+ return r;
+}
+static inline void touch_oe_write(unsigned char value) {
+ csr_writel(value, 0xe0005804L);
+}
+#define CSR_TOUCH_I_ADDR 0xe0005808L
+#define CSR_TOUCH_I_SIZE 1
+static inline unsigned char touch_i_read(void) {
+ unsigned char r = csr_readl(0xe0005808L);
+ return r;
+}
+
+/* usb */
+#define CSR_USB_BASE 0xe0004800L
+#define CSR_USB_PULLUP_OUT_ADDR 0xe0004800L
+#define CSR_USB_PULLUP_OUT_SIZE 1
+static inline unsigned char usb_pullup_out_read(void) {
+ unsigned char r = csr_readl(0xe0004800L);
+ return r;
+}
+static inline void usb_pullup_out_write(unsigned char value) {
+ csr_writel(value, 0xe0004800L);
+}
+#define CSR_USB_ADDRESS_ADDR 0xe0004804L
+#define CSR_USB_ADDRESS_SIZE 1
+static inline unsigned char usb_address_read(void) {
+ unsigned char r = csr_readl(0xe0004804L);
+ return r;
+}
+static inline void usb_address_write(unsigned char value) {
+ csr_writel(value, 0xe0004804L);
+}
+#define CSR_USB_ADDRESS_ADDR_OFFSET 0
+#define CSR_USB_ADDRESS_ADDR_SIZE 7
+#define CSR_USB_NEXT_EV_ADDR 0xe0004808L
+#define CSR_USB_NEXT_EV_SIZE 1
+static inline unsigned char usb_next_ev_read(void) {
+ unsigned char r = csr_readl(0xe0004808L);
+ return r;
+}
+#define CSR_USB_NEXT_EV_IN_OFFSET 0
+#define CSR_USB_NEXT_EV_IN_SIZE 1
+#define CSR_USB_NEXT_EV_OUT_OFFSET 1
+#define CSR_USB_NEXT_EV_OUT_SIZE 1
+#define CSR_USB_NEXT_EV_SETUP_OFFSET 2
+#define CSR_USB_NEXT_EV_SETUP_SIZE 1
+#define CSR_USB_NEXT_EV_RESET_OFFSET 3
+#define CSR_USB_NEXT_EV_RESET_SIZE 1
+#define CSR_USB_SETUP_DATA_ADDR 0xe000480cL
+#define CSR_USB_SETUP_DATA_SIZE 1
+static inline unsigned char usb_setup_data_read(void) {
+ unsigned char r = csr_readl(0xe000480cL);
+ return r;
+}
+#define CSR_USB_SETUP_DATA_DATA_OFFSET 0
+#define CSR_USB_SETUP_DATA_DATA_SIZE 8
+#define CSR_USB_SETUP_CTRL_ADDR 0xe0004810L
+#define CSR_USB_SETUP_CTRL_SIZE 1
+static inline unsigned char usb_setup_ctrl_read(void) {
+ unsigned char r = csr_readl(0xe0004810L);
+ return r;
+}
+static inline void usb_setup_ctrl_write(unsigned char value) {
+ csr_writel(value, 0xe0004810L);
+}
+#define CSR_USB_SETUP_CTRL_RESET_OFFSET 5
+#define CSR_USB_SETUP_CTRL_RESET_SIZE 1
+#define CSR_USB_SETUP_STATUS_ADDR 0xe0004814L
+#define CSR_USB_SETUP_STATUS_SIZE 1
+static inline unsigned char usb_setup_status_read(void) {
+ unsigned char r = csr_readl(0xe0004814L);
+ return r;
+}
+#define CSR_USB_SETUP_STATUS_EPNO_OFFSET 0
+#define CSR_USB_SETUP_STATUS_EPNO_SIZE 4
+#define CSR_USB_SETUP_STATUS_HAVE_OFFSET 4
+#define CSR_USB_SETUP_STATUS_HAVE_SIZE 1
+#define CSR_USB_SETUP_STATUS_PEND_OFFSET 5
+#define CSR_USB_SETUP_STATUS_PEND_SIZE 1
+#define CSR_USB_SETUP_STATUS_IS_IN_OFFSET 6
+#define CSR_USB_SETUP_STATUS_IS_IN_SIZE 1
+#define CSR_USB_SETUP_STATUS_DATA_OFFSET 7
+#define CSR_USB_SETUP_STATUS_DATA_SIZE 1
+#define CSR_USB_SETUP_EV_STATUS_ADDR 0xe0004818L
+#define CSR_USB_SETUP_EV_STATUS_SIZE 1
+static inline unsigned char usb_setup_ev_status_read(void) {
+ unsigned char r = csr_readl(0xe0004818L);
+ return r;
+}
+static inline void usb_setup_ev_status_write(unsigned char value) {
+ csr_writel(value, 0xe0004818L);
+}
+#define CSR_USB_SETUP_EV_PENDING_ADDR 0xe000481cL
+#define CSR_USB_SETUP_EV_PENDING_SIZE 1
+static inline unsigned char usb_setup_ev_pending_read(void) {
+ unsigned char r = csr_readl(0xe000481cL);
+ return r;
+}
+static inline void usb_setup_ev_pending_write(unsigned char value) {
+ csr_writel(value, 0xe000481cL);
+}
+#define CSR_USB_SETUP_EV_ENABLE_ADDR 0xe0004820L
+#define CSR_USB_SETUP_EV_ENABLE_SIZE 1
+static inline unsigned char usb_setup_ev_enable_read(void) {
+ unsigned char r = csr_readl(0xe0004820L);
+ return r;
+}
+static inline void usb_setup_ev_enable_write(unsigned char value) {
+ csr_writel(value, 0xe0004820L);
+}
+#define CSR_USB_IN_DATA_ADDR 0xe0004824L
+#define CSR_USB_IN_DATA_SIZE 1
+static inline unsigned char usb_in_data_read(void) {
+ unsigned char r = csr_readl(0xe0004824L);
+ return r;
+}
+static inline void usb_in_data_write(unsigned char value) {
+ csr_writel(value, 0xe0004824L);
+}
+#define CSR_USB_IN_DATA_DATA_OFFSET 0
+#define CSR_USB_IN_DATA_DATA_SIZE 8
+#define CSR_USB_IN_CTRL_ADDR 0xe0004828L
+#define CSR_USB_IN_CTRL_SIZE 1
+static inline unsigned char usb_in_ctrl_read(void) {
+ unsigned char r = csr_readl(0xe0004828L);
+ return r;
+}
+static inline void usb_in_ctrl_write(unsigned char value) {
+ csr_writel(value, 0xe0004828L);
+}
+#define CSR_USB_IN_CTRL_EPNO_OFFSET 0
+#define CSR_USB_IN_CTRL_EPNO_SIZE 4
+#define CSR_USB_IN_CTRL_RESET_OFFSET 5
+#define CSR_USB_IN_CTRL_RESET_SIZE 1
+#define CSR_USB_IN_CTRL_STALL_OFFSET 6
+#define CSR_USB_IN_CTRL_STALL_SIZE 1
+#define CSR_USB_IN_STATUS_ADDR 0xe000482cL
+#define CSR_USB_IN_STATUS_SIZE 1
+static inline unsigned char usb_in_status_read(void) {
+ unsigned char r = csr_readl(0xe000482cL);
+ return r;
+}
+#define CSR_USB_IN_STATUS_IDLE_OFFSET 0
+#define CSR_USB_IN_STATUS_IDLE_SIZE 1
+#define CSR_USB_IN_STATUS_HAVE_OFFSET 4
+#define CSR_USB_IN_STATUS_HAVE_SIZE 1
+#define CSR_USB_IN_STATUS_PEND_OFFSET 5
+#define CSR_USB_IN_STATUS_PEND_SIZE 1
+#define CSR_USB_IN_EV_STATUS_ADDR 0xe0004830L
+#define CSR_USB_IN_EV_STATUS_SIZE 1
+static inline unsigned char usb_in_ev_status_read(void) {
+ unsigned char r = csr_readl(0xe0004830L);
+ return r;
+}
+static inline void usb_in_ev_status_write(unsigned char value) {
+ csr_writel(value, 0xe0004830L);
+}
+#define CSR_USB_IN_EV_PENDING_ADDR 0xe0004834L
+#define CSR_USB_IN_EV_PENDING_SIZE 1
+static inline unsigned char usb_in_ev_pending_read(void) {
+ unsigned char r = csr_readl(0xe0004834L);
+ return r;
+}
+static inline void usb_in_ev_pending_write(unsigned char value) {
+ csr_writel(value, 0xe0004834L);
+}
+#define CSR_USB_IN_EV_ENABLE_ADDR 0xe0004838L
+#define CSR_USB_IN_EV_ENABLE_SIZE 1
+static inline unsigned char usb_in_ev_enable_read(void) {
+ unsigned char r = csr_readl(0xe0004838L);
+ return r;
+}
+static inline void usb_in_ev_enable_write(unsigned char value) {
+ csr_writel(value, 0xe0004838L);
+}
+#define CSR_USB_OUT_DATA_ADDR 0xe000483cL
+#define CSR_USB_OUT_DATA_SIZE 1
+static inline unsigned char usb_out_data_read(void) {
+ unsigned char r = csr_readl(0xe000483cL);
+ return r;
+}
+#define CSR_USB_OUT_DATA_DATA_OFFSET 0
+#define CSR_USB_OUT_DATA_DATA_SIZE 8
+#define CSR_USB_OUT_CTRL_ADDR 0xe0004840L
+#define CSR_USB_OUT_CTRL_SIZE 1
+static inline unsigned char usb_out_ctrl_read(void) {
+ unsigned char r = csr_readl(0xe0004840L);
+ return r;
+}
+static inline void usb_out_ctrl_write(unsigned char value) {
+ csr_writel(value, 0xe0004840L);
+}
+#define CSR_USB_OUT_CTRL_EPNO_OFFSET 0
+#define CSR_USB_OUT_CTRL_EPNO_SIZE 4
+#define CSR_USB_OUT_CTRL_ENABLE_OFFSET 4
+#define CSR_USB_OUT_CTRL_ENABLE_SIZE 1
+#define CSR_USB_OUT_CTRL_RESET_OFFSET 5
+#define CSR_USB_OUT_CTRL_RESET_SIZE 1
+#define CSR_USB_OUT_CTRL_STALL_OFFSET 6
+#define CSR_USB_OUT_CTRL_STALL_SIZE 1
+#define CSR_USB_OUT_STATUS_ADDR 0xe0004844L
+#define CSR_USB_OUT_STATUS_SIZE 1
+static inline unsigned char usb_out_status_read(void) {
+ unsigned char r = csr_readl(0xe0004844L);
+ return r;
+}
+#define CSR_USB_OUT_STATUS_EPNO_OFFSET 0
+#define CSR_USB_OUT_STATUS_EPNO_SIZE 4
+#define CSR_USB_OUT_STATUS_HAVE_OFFSET 4
+#define CSR_USB_OUT_STATUS_HAVE_SIZE 1
+#define CSR_USB_OUT_STATUS_PEND_OFFSET 5
+#define CSR_USB_OUT_STATUS_PEND_SIZE 1
+#define CSR_USB_OUT_EV_STATUS_ADDR 0xe0004848L
+#define CSR_USB_OUT_EV_STATUS_SIZE 1
+static inline unsigned char usb_out_ev_status_read(void) {
+ unsigned char r = csr_readl(0xe0004848L);
+ return r;
+}
+static inline void usb_out_ev_status_write(unsigned char value) {
+ csr_writel(value, 0xe0004848L);
+}
+#define CSR_USB_OUT_EV_PENDING_ADDR 0xe000484cL
+#define CSR_USB_OUT_EV_PENDING_SIZE 1
+static inline unsigned char usb_out_ev_pending_read(void) {
+ unsigned char r = csr_readl(0xe000484cL);
+ return r;
+}
+static inline void usb_out_ev_pending_write(unsigned char value) {
+ csr_writel(value, 0xe000484cL);
+}
+#define CSR_USB_OUT_EV_ENABLE_ADDR 0xe0004850L
+#define CSR_USB_OUT_EV_ENABLE_SIZE 1
+static inline unsigned char usb_out_ev_enable_read(void) {
+ unsigned char r = csr_readl(0xe0004850L);
+ return r;
+}
+static inline void usb_out_ev_enable_write(unsigned char value) {
+ csr_writel(value, 0xe0004850L);
+}
+#define CSR_USB_OUT_ENABLE_STATUS_ADDR 0xe0004854L
+#define CSR_USB_OUT_ENABLE_STATUS_SIZE 1
+static inline unsigned char usb_out_enable_status_read(void) {
+ unsigned char r = csr_readl(0xe0004854L);
+ return r;
+}
+#define CSR_USB_OUT_STALL_STATUS_ADDR 0xe0004858L
+#define CSR_USB_OUT_STALL_STATUS_SIZE 1
+static inline unsigned char usb_out_stall_status_read(void) {
+ unsigned char r = csr_readl(0xe0004858L);
+ return r;
+}
+
+/* version */
+#define CSR_VERSION_BASE 0xe0007000L
+#define CSR_VERSION_MAJOR_ADDR 0xe0007000L
+#define CSR_VERSION_MAJOR_SIZE 1
+static inline unsigned char version_major_read(void) {
+ unsigned char r = csr_readl(0xe0007000L);
+ return r;
+}
+#define CSR_VERSION_MINOR_ADDR 0xe0007004L
+#define CSR_VERSION_MINOR_SIZE 1
+static inline unsigned char version_minor_read(void) {
+ unsigned char r = csr_readl(0xe0007004L);
+ return r;
+}
+#define CSR_VERSION_REVISION_ADDR 0xe0007008L
+#define CSR_VERSION_REVISION_SIZE 1
+static inline unsigned char version_revision_read(void) {
+ unsigned char r = csr_readl(0xe0007008L);
+ return r;
+}
+#define CSR_VERSION_GITREV_ADDR 0xe000700cL
+#define CSR_VERSION_GITREV_SIZE 4
+static inline unsigned int version_gitrev_read(void) {
+ unsigned int r = csr_readl(0xe000700cL);
+ r <<= 8;
+ r |= csr_readl(0xe0007010L);
+ r <<= 8;
+ r |= csr_readl(0xe0007014L);
+ r <<= 8;
+ r |= csr_readl(0xe0007018L);
+ return r;
+}
+#define CSR_VERSION_GITEXTRA_ADDR 0xe000701cL
+#define CSR_VERSION_GITEXTRA_SIZE 2
+static inline unsigned short int version_gitextra_read(void) {
+ unsigned short int r = csr_readl(0xe000701cL);
+ r <<= 8;
+ r |= csr_readl(0xe0007020L);
+ return r;
+}
+#define CSR_VERSION_DIRTY_ADDR 0xe0007024L
+#define CSR_VERSION_DIRTY_SIZE 1
+static inline unsigned char version_dirty_read(void) {
+ unsigned char r = csr_readl(0xe0007024L);
+ return r;
+}
+#define CSR_VERSION_DIRTY_DIRTY_OFFSET 0
+#define CSR_VERSION_DIRTY_DIRTY_SIZE 1
+#define CSR_VERSION_MODEL_ADDR 0xe0007028L
+#define CSR_VERSION_MODEL_SIZE 1
+static inline unsigned char version_model_read(void) {
+ unsigned char r = csr_readl(0xe0007028L);
+ return r;
+}
+#define CSR_VERSION_MODEL_MODEL_OFFSET 0
+#define CSR_VERSION_MODEL_MODEL_SIZE 8
+#define CSR_VERSION_SEED_ADDR 0xe000702cL
+#define CSR_VERSION_SEED_SIZE 4
+static inline unsigned int version_seed_read(void) {
+ unsigned int r = csr_readl(0xe000702cL);
+ r <<= 8;
+ r |= csr_readl(0xe0007030L);
+ r <<= 8;
+ r |= csr_readl(0xe0007034L);
+ r <<= 8;
+ r |= csr_readl(0xe0007038L);
+ return r;
+}
+
+#endif
diff --git a/ports/litex/boards/fomu/fomu-spi.ld b/ports/litex/boards/fomu/fomu-spi.ld
new file mode 100644
index 000000000..486c3cad1
--- /dev/null
+++ b/ports/litex/boards/fomu/fomu-spi.ld
@@ -0,0 +1,116 @@
+/*
+ GNU linker script for Fomu
+*/
+
+ENTRY(_start)
+
+/* Specify the memory areas */
+MEMORY
+{
+ FLASH (rx) : ORIGIN = 0x20040000, LENGTH = 0x100000 /* entire flash, 1 MiB */
+ RAM (xrw) : ORIGIN = 0x10000000, LENGTH = 0x00020000 /* 128 KiB */
+}
+
+/* top end of the stack */
+_estack = ORIGIN(RAM) + LENGTH(RAM);
+
+/* define output sections */
+SECTIONS
+{
+ /* This is the initialized data section
+ The program executes knowing that the data is in the RAM
+ but the loader puts the initial values in the FLASH (inidata).
+ It is one task of the startup to copy the initial values from FLASH to RAM. */
+ .data : AT ( _sidata )
+ {
+ . = ALIGN(4);
+ _sdata = .; /* create a global symbol at data start; used by startup code in order to initialise the .data section in RAM */
+
+ *(.itcm.*) /* Instruction Tightly Coupled Memory */
+ *(.dtcm_data.*) /* Data Tightly Coupled Memory */
+
+ *(.text.cmp_lfn)
+ *(.text.qstr_find_strn)
+ *(.text.dcd_edpt_xfer)
+ *(.text.pop_rule)
+ *(.text.ff_wtoupper)
+ *(.text.dir_find)
+ *(.text.push_rule)
+ *(.text.csr_writel)
+ *(.text.csr_readl)
+ *(.text.timer0_ev_pending_write)
+ *(.text.autoreload_tick)
+ *(.text.filesystem_tick)
+ *(.text.usb_background)
+
+ *(.text.dcd_*)
+ *(.text.tud_control_*)
+ *(.text.tud_cdc_n_write_flush)
+ *(.text.tud_task)
+ *(.text.tu_edpt_dir)
+ *(.text.tu_fifo_empty)
+ *(.text.usbd_edpt_busy)
+ *(.text.irq_getmask)
+ *(.text.irq_setmask)
+ *(.text.irq_pending)
+ *(.text._osal_q_lock)
+ *(.text.osal_queue_receive)
+
+ *(.text.mp_obj_get_type)
+ *(.text.mp_parse)
+ *(.text.parse_compile_execute)
+ *(.text.mp_map_lookup)
+ *(.text.mp_execute_bytecode) /* Note: this function is 7kb */
+
+ *(.ramtext) /* .text* sections (code) */
+ *(.ramtext*) /* .text* sections (code) */
+ *(.data) /* .data sections */
+ *(.data*) /* .data* sections */
+ *(.sdata) /* .data sections */
+ *(.sdata*) /* .data* sections */
+
+ . = ALIGN(4);
+ _edata = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */
+ } >RAM
+
+ /* The program code and other data goes into FLASH */
+ .text :
+ {
+ . = ALIGN(4);
+ KEEP(*(.text.start)) /* isr vector table */
+ *(.text) /* .text sections (code) */
+ *(.text*) /* .text* sections (code) */
+ *(.rodata) /* .rodata sections (constants, strings, etc.) */
+ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
+ *(.srodata) /* .rodata sections (constants, strings, etc.) */
+ *(.srodata*) /* .rodata* sections (constants, strings, etc.) */
+
+ . = ALIGN(4);
+ _etext = .; /* define a global symbol at end of code */
+ _sidata = _etext; /* This is used by the startup in order to initialize the .data secion */
+ } >FLASH
+
+ /* Uninitialized data section */
+ .bss :
+ {
+ . = ALIGN(4);
+ _sbss = .; /* define a global symbol at bss start; used by startup code */
+ *(.bss)
+ *(.bss*)
+ *(.dtcm_bss.*) /* Data Tightly Coupled Memory */
+ *(.sbss)
+ *(.sbss*)
+ *(COMMON)
+
+ . = ALIGN(4);
+ _ebss = .; /* define a global symbol at bss end; used by startup code */
+ } >RAM
+
+
+ /* this is to define the start of the heap, and make sure we have a minimum size */
+ .heap :
+ {
+ . = ALIGN(4);
+ _heap_start = .; /* define a global symbol at heap start */
+ } >RAM
+}
diff --git a/ports/litex/boards/fomu/generated/soc.h b/ports/litex/boards/fomu/generated/soc.h
new file mode 100644
index 000000000..91b2f1a31
--- /dev/null
+++ b/ports/litex/boards/fomu/generated/soc.h
@@ -0,0 +1,58 @@
+//--------------------------------------------------------------------------------
+// Auto-generated by Migen (f4fcd10) & LiteX (de205d4a) on 2019-11-25 15:17:59
+//--------------------------------------------------------------------------------
+#ifndef __GENERATED_SOC_H
+#define __GENERATED_SOC_H
+#define CONFIG_BITSTREAM_SYNC_HEADER1 2123999870
+static inline int config_bitstream_sync_header1_read(void) {
+ return 2123999870;
+}
+#define CONFIG_BITSTREAM_SYNC_HEADER2 2125109630
+static inline int config_bitstream_sync_header2_read(void) {
+ return 2125109630;
+}
+#define CONFIG_CLOCK_FREQUENCY 12000000
+static inline int config_clock_frequency_read(void) {
+ return 12000000;
+}
+#define CONFIG_CPU_RESET_ADDR 0
+static inline int config_cpu_reset_addr_read(void) {
+ return 0;
+}
+#define CONFIG_CPU_TYPE "VEXRISCV"
+static inline const char * config_cpu_type_read(void) {
+ return "VEXRISCV";
+}
+#define CONFIG_CPU_TYPE_VEXRISCV
+#define CONFIG_CPU_VARIANT "MIN"
+static inline const char * config_cpu_variant_read(void) {
+ return "MIN";
+}
+#define CONFIG_CPU_VARIANT_MIN
+#define CONFIG_CSR_ALIGNMENT 32
+static inline int config_csr_alignment_read(void) {
+ return 32;
+}
+#define CONFIG_CSR_DATA_WIDTH 8
+static inline int config_csr_data_width_read(void) {
+ return 8;
+}
+#define CONFIG_FOMU_REV "HACKER"
+static inline const char * config_fomu_rev_read(void) {
+ return "HACKER";
+}
+#define CONFIG_FOMU_REV_HACKER
+#define CONFIG_SHADOW_BASE 2147483648
+static inline int config_shadow_base_read(void) {
+ return 2147483648;
+}
+#define TIMER0_INTERRUPT 2
+static inline int timer0_interrupt_read(void) {
+ return 2;
+}
+#define USB_INTERRUPT 3
+static inline int usb_interrupt_read(void) {
+ return 3;
+}
+
+#endif
diff --git a/ports/litex/boards/fomu/mpconfigboard.h b/ports/litex/boards/fomu/mpconfigboard.h
new file mode 100644
index 000000000..127301eee
--- /dev/null
+++ b/ports/litex/boards/fomu/mpconfigboard.h
@@ -0,0 +1,37 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * 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
+ * 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.
+ */
+
+//Micropython setup
+
+#define MICROPY_HW_BOARD_NAME "Fomu"
+#define MICROPY_HW_MCU_NAME "VexRiscv"
+
+#define FLASH_SIZE (0x100000)
+#define FLASH_PAGE_SIZE (0x1000)
+#define FLASH_PARTITION_OFFSET_BYTES (1024*1024)
+
+#define AUTORESET_DELAY_MS 500
+#define BOARD_FLASH_SIZE (FLASH_SIZE)
diff --git a/ports/litex/boards/fomu/mpconfigboard.mk b/ports/litex/boards/fomu/mpconfigboard.mk
new file mode 100644
index 000000000..4787803cc
--- /dev/null
+++ b/ports/litex/boards/fomu/mpconfigboard.mk
@@ -0,0 +1,20 @@
+USB_VID = 0x1209
+USB_PID = 0x5BF0
+USB_PRODUCT = "Fomu"
+USB_MANUFACTURER = "Foosn"
+USB_DEVICES = "CDC,MSC,AUDIO,HID"
+
+INTERNAL_FLASH_FILESYSTEM = 1
+LONGINT_IMPL = MPZ
+
+# The default queue depth of 16 overflows on release builds,
+# so increase it to 32.
+CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
+
+# Fomu only implements rv32i
+CFLAGS += -march=rv32i -mabi=ilp32
+LDFLAGS += -march=rv32i -mabi=ilp32
+
+CIRCUITPY_NEOPIXEL_WRITE = 1
+CIRCUITPY_DIGITALIO = 1
+CIRCUITPY_MICROCONTROLLER = 1
diff --git a/ports/litex/boards/fomu/pins.c b/ports/litex/boards/fomu/pins.c
new file mode 100644
index 000000000..6be495c33
--- /dev/null
+++ b/ports/litex/boards/fomu/pins.c
@@ -0,0 +1,9 @@
+#include "shared-bindings/board/__init__.h"
+
+STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_TOUCH1), MP_ROM_PTR(&pin_TOUCH1) },
+ { MP_ROM_QSTR(MP_QSTR_TOUCH2), MP_ROM_PTR(&pin_TOUCH2) },
+ { MP_ROM_QSTR(MP_QSTR_TOUCH3), MP_ROM_PTR(&pin_TOUCH3) },
+ { MP_ROM_QSTR(MP_QSTR_TOUCH4), MP_ROM_PTR(&pin_TOUCH4) },
+};
+MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
diff --git a/ports/litex/boards/fomu/profiling.gdb.txt b/ports/litex/boards/fomu/profiling.gdb.txt
new file mode 100644
index 000000000..28faf45b7
--- /dev/null
+++ b/ports/litex/boards/fomu/profiling.gdb.txt
@@ -0,0 +1,16 @@
+set pagination 0
+set logging file profile.txt
+set logging overwrite
+
+server define poor_profile
+set $total = $arg0
+set $i = 0
+ set logging on
+ while($i<$total)
+ set $i = $i + 1
+ cont
+ p $pc
+ bt
+ end
+ set logging off
+end
diff --git a/ports/litex/common-hal/digitalio/DigitalInOut.c b/ports/litex/common-hal/digitalio/DigitalInOut.c
new file mode 100644
index 000000000..574d0de56
--- /dev/null
+++ b/ports/litex/common-hal/digitalio/DigitalInOut.c
@@ -0,0 +1,119 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
+ * Copyright (c) 2019 Lucian Copeland 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 "shared-bindings/digitalio/DigitalInOut.h"
+#include "py/runtime.h"
+#include "supervisor/shared/translate.h"
+
+#include "csr.h"
+
+void common_hal_digitalio_digitalinout_never_reset(
+ digitalio_digitalinout_obj_t *self) {
+ (void)self;
+}
+
+digitalinout_result_t common_hal_digitalio_digitalinout_construct(
+ digitalio_digitalinout_obj_t *self, const mcu_pin_obj_t *pin) {
+
+ // claim_pin(pin);
+ self->pin = pin;
+
+ return DIGITALINOUT_OK;
+}
+
+bool common_hal_digitalio_digitalinout_deinited(digitalio_digitalinout_obj_t *self) {
+ return self->pin == mp_const_none;
+}
+
+void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t *self) {
+ if (common_hal_digitalio_digitalinout_deinited(self)) {
+ return;
+ }
+
+ // reset_pin_number(0, self->pin->number);
+ self->pin = mp_const_none;
+}
+
+void common_hal_digitalio_digitalinout_switch_to_input(
+ digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) {
+ (void)pull;
+ touch_oe_write(touch_oe_read() & ~(1 << self->pin->number));
+}
+
+void common_hal_digitalio_digitalinout_switch_to_output(
+ digitalio_digitalinout_obj_t *self, bool value,
+ digitalio_drive_mode_t drive_mode) {
+ (void)drive_mode;
+ common_hal_digitalio_digitalinout_set_value(self, value);
+ touch_oe_write(touch_oe_read() | (1 << self->pin->number));
+}
+
+digitalio_direction_t common_hal_digitalio_digitalinout_get_direction(
+ digitalio_digitalinout_obj_t *self) {
+
+ return (touch_oe_read() & (1 << self->pin->number))
+ ? DIRECTION_OUTPUT : DIRECTION_INPUT;
+}
+
+void common_hal_digitalio_digitalinout_set_value(
+ digitalio_digitalinout_obj_t *self, bool value) {
+ if (value)
+ touch_o_write(touch_o_read() | (1 << self->pin->number));
+ else
+ touch_o_write(touch_o_read() & ~(1 << self->pin->number));
+}
+
+bool common_hal_digitalio_digitalinout_get_value(
+ digitalio_digitalinout_obj_t *self) {
+ return !!(touch_i_read() & (1 << self->pin->number));
+}
+
+void common_hal_digitalio_digitalinout_set_drive_mode(
+ digitalio_digitalinout_obj_t *self,
+ digitalio_drive_mode_t drive_mode) {
+ (void)self;
+ (void)drive_mode;
+}
+
+digitalio_drive_mode_t common_hal_digitalio_digitalinout_get_drive_mode(
+ digitalio_digitalinout_obj_t *self) {
+ if (common_hal_digitalio_digitalinout_get_direction(self) == DIRECTION_OUTPUT)
+ return DRIVE_MODE_PUSH_PULL;
+ else
+ return DRIVE_MODE_OPEN_DRAIN;
+}
+
+void common_hal_digitalio_digitalinout_set_pull(
+ digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) {
+ (void)self;
+ (void)pull;
+}
+
+digitalio_pull_t common_hal_digitalio_digitalinout_get_pull(
+ digitalio_digitalinout_obj_t *self) {
+ return PULL_NONE;
+}
diff --git a/ports/litex/common-hal/digitalio/DigitalInOut.h b/ports/litex/common-hal/digitalio/DigitalInOut.h
new file mode 100644
index 000000000..3c5bdafaf
--- /dev/null
+++ b/ports/litex/common-hal/digitalio/DigitalInOut.h
@@ -0,0 +1,38 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
+ * Copyright (c) 2019 Lucian Copeland 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.
+ */
+
+#ifndef MICROPY_INCLUDED_FOMU_COMMON_HAL_DIGITALIO_DIGITALINOUT_H
+#define MICROPY_INCLUDED_FOMU_COMMON_HAL_DIGITALIO_DIGITALINOUT_H
+
+#include "common-hal/microcontroller/Pin.h"
+
+typedef struct {
+ mp_obj_base_t base;
+ const mcu_pin_obj_t *pin;
+} digitalio_digitalinout_obj_t;
+
+#endif // MICROPY_INCLUDED_FOMU_COMMON_HAL_DIGITALIO_DIGITALINOUT_H
diff --git a/ports/stm32f4/common-hal/digitalio/__init__.c b/ports/litex/common-hal/digitalio/__init__.c
index 20fad4595..20fad4595 100644
--- a/ports/stm32f4/common-hal/digitalio/__init__.c
+++ b/ports/litex/common-hal/digitalio/__init__.c
diff --git a/ports/litex/common-hal/microcontroller/Pin.c b/ports/litex/common-hal/microcontroller/Pin.c
new file mode 100644
index 000000000..632468f6d
--- /dev/null
+++ b/ports/litex/common-hal/microcontroller/Pin.c
@@ -0,0 +1,56 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016 Scott Shawcroft for Adafruit Industries
+ * Copyright (c) 2019 Lucian Copeland 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 "shared-bindings/microcontroller/Pin.h"
+
+#include "py/mphal.h"
+
+STATIC uint8_t claimed_pins[1];
+
+// Mark pin as free and return it to a quiescent state.
+void reset_pin_number(uint8_t pin_port, uint8_t pin_number) {
+ if (pin_port == 0x0F) {
+ return;
+ }
+
+ // Clear claimed bit.
+ claimed_pins[pin_port] &= ~(1<<pin_number);
+}
+
+
+void claim_pin(const mcu_pin_obj_t* pin) {
+ // Set bit in claimed_pins bitmask.
+ claimed_pins[0] |= 1<<pin->number;
+}
+
+bool pin_number_is_free(uint8_t pin_port, uint8_t pin_number) {
+ return !(claimed_pins[pin_port] & 1<<pin_number);
+}
+
+bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t *pin) {
+ return pin_number_is_free(0, pin->number);
+}
diff --git a/ports/litex/common-hal/microcontroller/Pin.h b/ports/litex/common-hal/microcontroller/Pin.h
new file mode 100644
index 000000000..186e120a2
--- /dev/null
+++ b/ports/litex/common-hal/microcontroller/Pin.h
@@ -0,0 +1,59 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016 Scott Shawcroft
+ *
+ * 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_FOMU_COMMON_HAL_MICROCONTROLLER_PIN_H
+#define MICROPY_INCLUDED_FOMU_COMMON_HAL_MICROCONTROLLER_PIN_H
+
+#include "py/mphal.h"
+
+
+typedef struct {
+ mp_obj_base_t base;
+ uint8_t number;
+} mcu_pin_obj_t;
+
+#define PIN(p_number) \
+{ \
+ { &mcu_pin_type }, \
+ .number = p_number \
+}
+
+extern const mcu_pin_obj_t pin_TOUCH1;
+extern const mcu_pin_obj_t pin_TOUCH2;
+extern const mcu_pin_obj_t pin_TOUCH3;
+extern const mcu_pin_obj_t pin_TOUCH4;
+
+void reset_all_pins(void);
+// reset_pin_number takes the pin number instead of the pointer so that objects don't
+// need to store a full pointer.
+void reset_pin_number(uint8_t pin_port, uint8_t pin_number);
+void claim_pin(const mcu_pin_obj_t* pin);
+bool pin_number_is_free(uint8_t pin_port, uint8_t pin_number);
+void never_reset_pin_number(uint8_t pin_port, uint8_t pin_number);
+// GPIO_TypeDef * pin_port(uint8_t pin_port);
+uint16_t pin_mask(uint8_t pin_number);
+
+#endif // MICROPY_INCLUDED_FOMU_COMMON_HAL_MICROCONTROLLER_PIN_H
diff --git a/ports/stm32f4/common-hal/microcontroller/Processor.c b/ports/litex/common-hal/microcontroller/Processor.c
index 3ab746685..9d2b05aad 100644
--- a/ports/stm32f4/common-hal/microcontroller/Processor.c
+++ b/ports/litex/common-hal/microcontroller/Processor.c
@@ -30,9 +30,8 @@
#include "py/runtime.h"
#include "supervisor/shared/translate.h"
-#include "stm32f4xx_hal.h"
-
-#define STM32_UUID ((uint32_t *)0x1FFF7A10)
+#include "csr.h"
+#include "generated/soc.h"
float common_hal_mcu_processor_get_temperature(void) {
return NAN;
@@ -43,11 +42,23 @@ float common_hal_mcu_processor_get_voltage(void) {
}
uint32_t common_hal_mcu_processor_get_frequency(void) {
- return SystemCoreClock;
+ return CONFIG_CLOCK_FREQUENCY;
}
void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) {
- for (int i=0; i<3; i++) {
- ((uint32_t*) raw_id)[i] = STM32_UUID[i];
- }
+ raw_id[0] = csr_readl(CSR_VERSION_MAJOR_ADDR);
+ raw_id[1] = csr_readl(CSR_VERSION_MINOR_ADDR);
+ raw_id[2] = csr_readl(CSR_VERSION_REVISION_ADDR);
+ raw_id[3] = csr_readl(CSR_VERSION_GITREV_ADDR + 0);
+ raw_id[4] = csr_readl(CSR_VERSION_GITREV_ADDR + 4);
+ raw_id[5] = csr_readl(CSR_VERSION_GITREV_ADDR + 8);
+ raw_id[6] = csr_readl(CSR_VERSION_GITREV_ADDR + 12);
+ raw_id[7] = csr_readl(CSR_VERSION_GITEXTRA_ADDR + 0);
+ raw_id[8] = csr_readl(CSR_VERSION_GITEXTRA_ADDR + 4);
+ raw_id[9] = csr_readl(CSR_VERSION_DIRTY_ADDR);
+ raw_id[10] = csr_readl(CSR_VERSION_MODEL_ADDR);
+ raw_id[11] = csr_readl(CSR_VERSION_SEED_ADDR + 0);
+ raw_id[12] = csr_readl(CSR_VERSION_SEED_ADDR + 4);
+ raw_id[13] = csr_readl(CSR_VERSION_SEED_ADDR + 8);
+ raw_id[14] = csr_readl(CSR_VERSION_SEED_ADDR + 12);
}
diff --git a/ports/litex/common-hal/microcontroller/Processor.h b/ports/litex/common-hal/microcontroller/Processor.h
new file mode 100644
index 000000000..a2ea261c8
--- /dev/null
+++ b/ports/litex/common-hal/microcontroller/Processor.h
@@ -0,0 +1,39 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Dan Halbert 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.
+ */
+
+#ifndef MICROPY_INCLUDED_LITEX_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H
+#define MICROPY_INCLUDED_LITEX_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H
+
+#define COMMON_HAL_MCU_PROCESSOR_UID_LENGTH 15
+
+#include "py/obj.h"
+
+typedef struct {
+ mp_obj_base_t base;
+ // Stores no state currently.
+} mcu_processor_obj_t;
+
+#endif // MICROPY_INCLUDED_LITEX_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H
diff --git a/ports/litex/common-hal/microcontroller/__init__.c b/ports/litex/common-hal/microcontroller/__init__.c
new file mode 100644
index 000000000..3c9166114
--- /dev/null
+++ b/ports/litex/common-hal/microcontroller/__init__.c
@@ -0,0 +1,111 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016 Scott Shawcroft for Adafruit Industries
+ * Copyright (c) 2019 Lucian Copeland 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 "py/mphal.h"
+#include "py/obj.h"
+#include "py/runtime.h"
+
+#include "common-hal/microcontroller/Pin.h"
+#include "common-hal/microcontroller/Processor.h"
+
+#include "shared-bindings/microcontroller/__init__.h"
+#include "shared-bindings/microcontroller/Pin.h"
+#include "shared-bindings/microcontroller/Processor.h"
+
+#include "supervisor/filesystem.h"
+#include "supervisor/shared/safe_mode.h"
+
+#include "csr.h"
+#include "irq.h"
+
+void common_hal_mcu_delay_us(uint32_t delay) {
+ // if (__get_PRIMASK() == 0x00000000) {
+ // //by default use ticks_ms
+ // uint32_t start = get_us();
+ // while (get_us()-start < delay) {
+ // __asm__ __volatile__("nop");
+ // }
+ // } else {
+ // //when SysTick is disabled, approximate with busy loop
+ // const uint32_t ucount = HAL_RCC_GetSysClockFreq() / 1000000 * delay / LOOP_TICKS;
+ // for (uint32_t count = 0; ++count <= ucount;) {
+ // }
+ // }
+}
+
+volatile uint32_t nesting_count = 0;
+
+void common_hal_mcu_disable_interrupts(void) {
+ irq_setie(0);
+ // __DMB();
+ nesting_count++;
+}
+
+void common_hal_mcu_enable_interrupts(void) {
+ if (nesting_count == 0) {
+ // This is very very bad because it means there was mismatched disable/enables so we
+ // "HardFault".
+ asm("ebreak");
+ }
+ nesting_count--;
+ if (nesting_count > 0) {
+ return;
+ }
+ irq_setie(1);
+}
+
+void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) {
+ if(runmode == RUNMODE_SAFE_MODE)
+ safe_mode_on_next_reset(PROGRAMMATIC_SAFE_MODE);
+}
+
+void common_hal_mcu_reset(void) {
+ filesystem_flush(); //TODO: implement as part of flash improvements
+ // NVIC_SystemReset();
+ while(1);
+}
+
+// The singleton microcontroller.Processor object, bound to microcontroller.cpu
+// It currently only has properties, and no state.
+const mcu_processor_obj_t common_hal_mcu_processor_obj = {
+ .base = {
+ .type = &mcu_processor_type,
+ },
+};
+
+const mcu_pin_obj_t pin_TOUCH1 = PIN(0);
+const mcu_pin_obj_t pin_TOUCH2 = PIN(1);
+const mcu_pin_obj_t pin_TOUCH3 = PIN(2);
+const mcu_pin_obj_t pin_TOUCH4 = PIN(3);
+
+STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_TOUCH1), MP_ROM_PTR(&pin_TOUCH1) },
+ { MP_ROM_QSTR(MP_QSTR_TOUCH2), MP_ROM_PTR(&pin_TOUCH2) },
+ { MP_ROM_QSTR(MP_QSTR_TOUCH3), MP_ROM_PTR(&pin_TOUCH3) },
+ { MP_ROM_QSTR(MP_QSTR_TOUCH4), MP_ROM_PTR(&pin_TOUCH4) },
+};
+MP_DEFINE_CONST_DICT(mcu_pin_globals, mcu_pin_globals_table);
diff --git a/ports/litex/common-hal/neopixel_write/__init__.c b/ports/litex/common-hal/neopixel_write/__init__.c
new file mode 100644
index 000000000..29fd318d4
--- /dev/null
+++ b/ports/litex/common-hal/neopixel_write/__init__.c
@@ -0,0 +1,93 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2018 hathach 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 "py/mphal.h"
+#include "shared-bindings/neopixel_write/__init__.h"
+#include "csr.h"
+
+// ICE40 LED Driver hard macro.
+// See http://www.latticesemi.com/-/media/LatticeSemi/Documents/ApplicationNotes/IK/ICE40LEDDriverUsageGuide.ashx?document_id=50668
+enum led_registers {
+ LEDDCR0 = 8,
+ LEDDBR = 9,
+ LEDDONR = 10,
+ LEDDOFR = 11,
+ LEDDBCRR = 5,
+ LEDDBCFR = 6,
+ LEDDPWRR = 1,
+ LEDDPWRG = 2,
+ LEDDPWRB = 3,
+};
+
+// Control register definitions
+#define LEDDCR0_LEDDEN (1 << 7)
+#define LEDDCR0_FR250 (1 << 6)
+#define LEDDCR0_OUTPOL (1 << 5)
+#define LEDDCR0_OUTSKEW (1 << 4)
+#define LEDDCR0_QUICKSTOP (1 << 3)
+#define LEDDCR0_PWM_MODE (1 << 2)
+#define LEDDCR0_BRMSBEXT (1 << 0)
+
+// Write a value into the LEDDA_IP register.
+static void ledda_write(uint8_t value, uint8_t addr) {
+ rgb_addr_write(addr);
+ rgb_dat_write(value);
+}
+
+static int ledda_init_done;
+
+static void ledda_init(void) {
+ if (ledda_init_done)
+ return;
+
+ // Enable the driver
+ rgb_ctrl_write((1 << CSR_RGB_CTRL_EXE_OFFSET) | (1 << CSR_RGB_CTRL_CURREN_OFFSET) | (1 << CSR_RGB_CTRL_RGBLEDEN_OFFSET));
+
+ ledda_write(LEDDCR0_LEDDEN | LEDDCR0_FR250 | LEDDCR0_QUICKSTOP, LEDDCR0);
+
+ // Set clock register to 12 MHz / 64 kHz - 1
+ ledda_write((12000000/64000)-1, LEDDBR);
+
+ // Ensure LED "breathe" effect is diabled
+ ledda_write(0, LEDDBCRR);
+ ledda_write(0, LEDDBCFR);
+
+ // Also disable the LED blink time
+ ledda_write(0, LEDDONR);
+ ledda_write(0, LEDDOFR);
+
+ ledda_init_done = 1;
+}
+
+void common_hal_neopixel_write (const digitalio_digitalinout_obj_t* digitalinout, uint8_t *pixels, uint32_t numBytes) {
+ (void)digitalinout;
+ (void)numBytes;
+ ledda_init();
+
+ ledda_write(pixels[0], LEDDPWRR); // Red
+ ledda_write(pixels[1], LEDDPWRG); // Green
+ ledda_write(pixels[2], LEDDPWRB); // Blue
+}
diff --git a/ports/litex/common-hal/os/__init__.c b/ports/litex/common-hal/os/__init__.c
new file mode 100644
index 000000000..578f3e8c6
--- /dev/null
+++ b/ports/litex/common-hal/os/__init__.c
@@ -0,0 +1,61 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Sean Cross
+ *
+ * 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 "genhdr/mpversion.h"
+#include "py/mpconfig.h"
+#include "py/objstr.h"
+#include "py/objtuple.h"
+#include "py/qstr.h"
+
+STATIC const qstr os_uname_info_fields[] = {
+ MP_QSTR_sysname, MP_QSTR_nodename,
+ MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
+};
+STATIC const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, "litex");
+STATIC const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, "litex");
+STATIC const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
+STATIC const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
+STATIC const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
+
+
+STATIC MP_DEFINE_ATTRTUPLE(
+ os_uname_info_obj,
+ os_uname_info_fields,
+ 5,
+ (mp_obj_t)&os_uname_info_sysname_obj,
+ (mp_obj_t)&os_uname_info_nodename_obj,
+ (mp_obj_t)&os_uname_info_release_obj,
+ (mp_obj_t)&os_uname_info_version_obj,
+ (mp_obj_t)&os_uname_info_machine_obj
+);
+
+mp_obj_t common_hal_os_uname(void) {
+ return (mp_obj_t)&os_uname_info_obj;
+}
+
+bool common_hal_os_urandom(uint8_t* buffer, uint32_t length) {
+ return false;
+}
diff --git a/ports/stm32f4/common-hal/supervisor/Runtime.c b/ports/litex/common-hal/supervisor/Runtime.c
index feab6987d..feab6987d 100755..100644
--- a/ports/stm32f4/common-hal/supervisor/Runtime.c
+++ b/ports/litex/common-hal/supervisor/Runtime.c
diff --git a/ports/stm32f4/common-hal/supervisor/Runtime.h b/ports/litex/common-hal/supervisor/Runtime.h
index 9a798e056..d1fe24621 100755..100644
--- a/ports/stm32f4/common-hal/supervisor/Runtime.h
+++ b/ports/litex/common-hal/supervisor/Runtime.h
@@ -24,8 +24,8 @@
* THE SOFTWARE.
*/
-#ifndef MICROPY_INCLUDED_STM32F4_COMMON_HAL_SUPERVISOR_RUNTIME_H
-#define MICROPY_INCLUDED_STM32F4_COMMON_HAL_SUPERVISOR_RUNTIME_H
+#ifndef MICROPY_INCLUDED_LITEX_COMMON_HAL_SUPERVISOR_RUNTIME_H
+#define MICROPY_INCLUDED_LITEX_COMMON_HAL_SUPERVISOR_RUNTIME_H
#include "py/obj.h"
@@ -34,4 +34,4 @@ typedef struct {
// Stores no state currently.
} super_runtime_obj_t;
-#endif // MICROPY_INCLUDED_STM32F4_COMMON_HAL_SUPERVISOR_RUNTIME_H
+#endif // MICROPY_INCLUDED_LITEX_COMMON_HAL_SUPERVISOR_RUNTIME_H
diff --git a/ports/stm32f4/common-hal/supervisor/__init__.c b/ports/litex/common-hal/supervisor/__init__.c
index ac88556b4..ac88556b4 100755..100644
--- a/ports/stm32f4/common-hal/supervisor/__init__.c
+++ b/ports/litex/common-hal/supervisor/__init__.c
diff --git a/ports/stm32f4/common-hal/time/__init__.c b/ports/litex/common-hal/time/__init__.c
index 976f519db..c85077868 100644
--- a/ports/stm32f4/common-hal/time/__init__.c
+++ b/ports/litex/common-hal/time/__init__.c
@@ -32,6 +32,14 @@ uint64_t common_hal_time_monotonic(void) {
return supervisor_ticks_ms64();
}
+uint64_t common_hal_time_monotonic_ns(void) {
+ uint64_t ms;
+ uint32_t us_until_ms;
+ current_tick(&ms, &us_until_ms);
+ // us counts down.
+ return 1000 * (ms * 1000 + (1000 - us_until_ms));
+}
+
void common_hal_time_delay_ms(uint32_t delay) {
mp_hal_delay_ms(delay);
}
diff --git a/ports/litex/crt0-vexriscv.S b/ports/litex/crt0-vexriscv.S
new file mode 100644
index 000000000..0419acf85
--- /dev/null
+++ b/ports/litex/crt0-vexriscv.S
@@ -0,0 +1,94 @@
+.global main
+.global isr
+
+.section .text.start
+.global _start
+
+_start:
+ j crt_init
+ # This sentinal ensures that this program is loaded
+ # to RAM when loaded using dfu-util.
+ #.word 0x17ab0f23
+ #.word 0x10001000
+
+.section .ramtext
+.global trap_entry
+.align 4
+trap_entry:
+ sw x1, - 1*4(sp)
+ sw x5, - 2*4(sp)
+ sw x6, - 3*4(sp)
+ sw x7, - 4*4(sp)
+ sw x10, - 5*4(sp)
+ sw x11, - 6*4(sp)
+ sw x12, - 7*4(sp)
+ sw x13, - 8*4(sp)
+ sw x14, - 9*4(sp)
+ sw x15, -10*4(sp)
+ sw x16, -11*4(sp)
+ sw x17, -12*4(sp)
+ sw x28, -13*4(sp)
+ sw x29, -14*4(sp)
+ sw x30, -15*4(sp)
+ sw x31, -16*4(sp)
+ addi sp,sp,-16*4
+ call isr
+ lw x1 , 15*4(sp)
+ lw x5, 14*4(sp)
+ lw x6, 13*4(sp)
+ lw x7, 12*4(sp)
+ lw x10, 11*4(sp)
+ lw x11, 10*4(sp)
+ lw x12, 9*4(sp)
+ lw x13, 8*4(sp)
+ lw x14, 7*4(sp)
+ lw x15, 6*4(sp)
+ lw x16, 5*4(sp)
+ lw x17, 4*4(sp)
+ lw x28, 3*4(sp)
+ lw x29, 2*4(sp)
+ lw x30, 1*4(sp)
+ lw x31, 0*4(sp)
+ addi sp,sp,16*4
+ mret
+
+.text
+
+crt_init:
+ # # Flush the caches
+ # .word 16399
+ # .word 19
+ # .word 19
+ # .word 19
+ la sp, _estack - 4
+ la a0, trap_entry
+ csrw mtvec, a0
+
+bss_init:
+ la a0, _sbss
+ la a1, _ebss
+bss_loop:
+ beq a0,a1,bss_done
+ sw zero,0(a0)
+ add a0,a0,4
+ j bss_loop
+bss_done:
+
+ /* Load DATA */
+ la t0, _sidata
+ la t1, _sdata
+ la t2, _edata
+3:
+ lw t3, 0(t0)
+ sw t3, 0(t1)
+ /* _edata is aligned to 16 bytes. Use word-xfers. */
+ addi t0, t0, 4
+ addi t1, t1, 4
+ bltu t1, t2, 3b
+
+ li a0, 0x880 //880 enable timer + external interrupt sources (until mstatus.MIE is set, they will never trigger an interrupt)
+ csrw mie,a0
+
+ call main
+infinite_loop:
+ j infinite_loop
diff --git a/ports/stm32f4/fatfs_port.c b/ports/litex/fatfs_port.c
index 13ac21fb1..13ac21fb1 100644
--- a/ports/stm32f4/fatfs_port.c
+++ b/ports/litex/fatfs_port.c
diff --git a/ports/litex/hw/common.h b/ports/litex/hw/common.h
new file mode 100644
index 000000000..6a97ca2e9
--- /dev/null
+++ b/ports/litex/hw/common.h
@@ -0,0 +1,33 @@
+#ifndef _HW_COMMON_H_
+#define _HW_COMMON_H_
+#include <stdint.h>
+static inline void csr_writeb(uint8_t value, uint32_t addr)
+{
+ *((volatile uint8_t *)addr) = value;
+}
+
+static inline uint8_t csr_readb(uint32_t addr)
+{
+ return *(volatile uint8_t *)addr;
+}
+
+static inline void csr_writew(uint16_t value, uint32_t addr)
+{
+ *((volatile uint16_t *)addr) = value;
+}
+
+static inline uint16_t csr_readw(uint32_t addr)
+{
+ return *(volatile uint16_t *)addr;
+}
+
+static inline void csr_writel(uint32_t value, uint32_t addr)
+{
+ *((volatile uint32_t *)addr) = value;
+}
+
+static inline uint32_t csr_readl(uint32_t addr)
+{
+ return *(volatile uint32_t *)addr;
+}
+#endif /* _HW_COMMON_H_ */ \ No newline at end of file
diff --git a/ports/litex/irq.h b/ports/litex/irq.h
new file mode 100644
index 000000000..a82218907
--- /dev/null
+++ b/ports/litex/irq.h
@@ -0,0 +1,71 @@
+#ifndef __IRQ_H
+#define __IRQ_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define CSR_MSTATUS_MIE 0x8
+
+#define CSR_IRQ_MASK 0xBC0
+#define CSR_IRQ_PENDING 0xFC0
+
+#define CSR_DCACHE_INFO 0xCC0
+
+#define csrr(reg) ({ unsigned long __tmp; \
+ asm volatile ("csrr %0, " #reg : "=r"(__tmp)); \
+ __tmp; })
+
+#define csrw(reg, val) ({ \
+ if (__builtin_constant_p(val) && (unsigned long)(val) < 32) \
+ asm volatile ("csrw " #reg ", %0" :: "i"(val)); \
+ else \
+ asm volatile ("csrw " #reg ", %0" :: "r"(val)); })
+
+#define csrs(reg, bit) ({ \
+ if (__builtin_constant_p(bit) && (unsigned long)(bit) < 32) \
+ asm volatile ("csrrs x0, " #reg ", %0" :: "i"(bit)); \
+ else \
+ asm volatile ("csrrs x0, " #reg ", %0" :: "r"(bit)); })
+
+#define csrc(reg, bit) ({ \
+ if (__builtin_constant_p(bit) && (unsigned long)(bit) < 32) \
+ asm volatile ("csrrc x0, " #reg ", %0" :: "i"(bit)); \
+ else \
+ asm volatile ("csrrc x0, " #reg ", %0" :: "r"(bit)); })
+
+static inline unsigned int irq_getie(void)
+{
+ return (csrr(mstatus) & CSR_MSTATUS_MIE) != 0;
+}
+
+static inline void irq_setie(unsigned int ie)
+{
+ if(ie) csrs(mstatus,CSR_MSTATUS_MIE); else csrc(mstatus,CSR_MSTATUS_MIE);
+}
+
+static inline unsigned int irq_getmask(void)
+{
+ unsigned int mask;
+ asm volatile ("csrr %0, %1" : "=r"(mask) : "i"(CSR_IRQ_MASK));
+ return mask;
+}
+
+static inline void irq_setmask(unsigned int mask)
+{
+ asm volatile ("csrw %0, %1" :: "i"(CSR_IRQ_MASK), "r"(mask));
+}
+
+static inline unsigned int irq_pending(void)
+{
+ unsigned int pending;
+ asm volatile ("csrr %0, %1" : "=r"(pending) : "i"(CSR_IRQ_PENDING));
+ return pending;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __IRQ_H */ \ No newline at end of file
diff --git a/ports/stm32f4/mpconfigport.h b/ports/litex/mpconfigport.h
index 7737bda8d..fcf9d3b73 100644
--- a/ports/stm32f4/mpconfigport.h
+++ b/ports/litex/mpconfigport.h
@@ -25,24 +25,22 @@
* THE SOFTWARE.
*/
-#ifndef STM32F4_MPCONFIGPORT_H__
-#define STM32F4_MPCONFIGPORT_H__
+#ifndef FPGA_MPCONFIGPORT_H__
+#define FPGA_MPCONFIGPORT_H__
-#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (1)
-#define MICROPY_PY_FUNCTION_ATTRS (1)
-#define MICROPY_PY_IO (1)
-#define MICROPY_PY_REVERSE_SPECIAL_METHODS (1)
-#define MICROPY_PY_UJSON (1)
-
-// 24kiB stack
-#define CIRCUITPY_DEFAULT_STACK_SIZE 0x6000
+#define CIRCUITPY_INTERNAL_NVM_SIZE (0)
+#define MICROPY_NLR_THUMB (0)
+#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (1)
+#define MICROPY_PY_REVERSE_SPECIAL_METHODS (1)
+#define MICROPY_PY_UBINASCII (1)
+#define MICROPY_PY_UJSON (1)
#include "py/circuitpy_mpconfig.h"
-#define MAX_UART 10 //how many UART are implemented
-
#define MICROPY_PORT_ROOT_POINTERS \
- void *cpy_uart_obj_all[MAX_UART]; \
CIRCUITPY_COMMON_ROOT_POINTERS
+#define MICROPY_NLR_SETJMP (1)
+#define CIRCUITPY_DEFAULT_STACK_SIZE 0x6000
+
-#endif // __INCLUDED_MPCONFIGPORT_H
+#endif // __INCLUDED_FPGA_MPCONFIGPORT_H
diff --git a/ports/litex/mpconfigport.mk b/ports/litex/mpconfigport.mk
new file mode 100644
index 000000000..0a82f4161
--- /dev/null
+++ b/ports/litex/mpconfigport.mk
@@ -0,0 +1,31 @@
+# Define an equivalent for MICROPY_LONGINT_IMPL, to pass to $(MPY-TOOL) in py/mkrules.mk
+# $(MPY-TOOL) needs to know what kind of longint to use (if any) to freeze long integers.
+# This should correspond to the MICROPY_LONGINT_IMPL definition in mpconfigport.h.
+MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz
+
+# Internal math library is substantially smaller than toolchain one
+INTERNAL_LIBM = 1
+
+# Chip supplied serial number, in bytes
+USB_SERIAL_NUMBER_LENGTH = 30
+
+# Longints can be implemented as mpz, as longlong, or not
+LONGINT_IMPL = MPZ
+
+CIRCUITPY_ANALOGIO = 0
+CIRCUITPY_AUDIOBUSIO = 0
+CIRCUITPY_AUDIOIO = 0
+CIRCUITPY_BITBANGIO = 0
+CIRCUITPY_BOARD = 0
+CIRCUITPY_BUSIO = 0
+CIRCUITPY_DISPLAYIO = 0
+CIRCUITPY_FREQUENCYIO = 0
+CIRCUITPY_I2CSLAVE = 0
+CIRCUITPY_NVM = 0
+CIRCUITPY_PULSEIO = 0
+CIRCUITPY_ROTARYIO = 0
+CIRCUITPY_RTC = 0
+
+# Enable USB support
+CIRCUITPY_USB_HID = 1
+CIRCUITPY_USB_MIDI = 1
diff --git a/ports/litex/mphalport.c b/ports/litex/mphalport.c
new file mode 100644
index 000000000..0b8f01298
--- /dev/null
+++ b/ports/litex/mphalport.c
@@ -0,0 +1,85 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2015 Glenn Ruben Bakke
+ * Copyright (c) 2018 Artur Pacholec
+ *
+ * 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 <string.h>
+
+#include "py/mphal.h"
+#include "py/mpstate.h"
+#include "py/gc.h"
+
+#include "csr.h"
+#include "generated/soc.h"
+
+#include "irq.h"
+
+#ifdef CFG_TUSB_MCU
+ void hal_dcd_isr(uint8_t rhport);
+#endif
+
+/*------------------------------------------------------------------*/
+/* delay
+ *------------------------------------------------------------------*/
+void mp_hal_delay_ms(mp_uint_t delay) {
+ uint64_t start_tick = supervisor_ticks_ms64();
+ uint64_t duration = 0;
+ while (duration < delay) {
+ #ifdef MICROPY_VM_HOOK_LOOP
+ MICROPY_VM_HOOK_LOOP
+ #endif
+ // Check to see if we've been CTRL-Ced by autoreload or the user.
+ if(MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception)) ||
+ MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception))) {
+ break;
+ }
+ duration = (supervisor_ticks_ms64() - start_tick);
+ // TODO(tannewt): Go to sleep for a little while while we wait.
+ }
+}
+
+void mp_hal_delay_us(mp_uint_t delay) {
+ mp_hal_delay_ms(delay / 1000);
+}
+
+extern void SysTick_Handler(void);
+
+__attribute__((section(".ramtext")))
+void isr(void) {
+ uint8_t irqs = irq_pending() & irq_getmask();
+
+#ifdef CFG_TUSB_MCU
+ if (irqs & (1 << USB_INTERRUPT))
+ hal_dcd_isr(0);
+#endif
+ if (irqs & (1 << TIMER0_INTERRUPT))
+ SysTick_Handler();
+}
+
+mp_uint_t cpu_get_regs_and_sp(mp_uint_t *regs) {
+ unsigned long __tmp;
+ asm volatile ("mv %0, x2" :"=r"(__tmp));
+ return __tmp;
+}
diff --git a/ports/stm32f4/mphalport.h b/ports/litex/mphalport.h
index df2f0ca65..540575c58 100644
--- a/ports/stm32f4/mphalport.h
+++ b/ports/litex/mphalport.h
@@ -24,8 +24,8 @@
* THE SOFTWARE.
*/
-#ifndef __STM32F4_HAL
-#define __STM32F4_HAL
+#ifndef __FOMU_HAL
+#define __FOMU_HAL
#include <stdbool.h>
#include <stdint.h>
@@ -34,7 +34,6 @@
#include "py/mpconfig.h"
#include "supervisor/shared/tick.h"
-
#define mp_hal_ticks_ms() ((mp_uint_t) supervisor_ticks_ms32())
//#define mp_hal_delay_us(us) NRFX_DELAY_US((uint32_t) (us))
diff --git a/ports/stm32f4/qstrdefsport.h b/ports/litex/qstrdefsport.h
index 3ba897069..3ba897069 100644
--- a/ports/stm32f4/qstrdefsport.h
+++ b/ports/litex/qstrdefsport.h
diff --git a/ports/litex/supervisor/internal_flash.c b/ports/litex/supervisor/internal_flash.c
new file mode 100644
index 000000000..93aeda8cb
--- /dev/null
+++ b/ports/litex/supervisor/internal_flash.c
@@ -0,0 +1,350 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2013, 2014 Damien P. George
+ * Copyright (c) 2019 Lucian Copeland 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 "supervisor/internal_flash.h"
+
+#include <stdint.h>
+#include <string.h>
+#include <stdbool.h>
+
+#include "extmod/vfs.h"
+#include "extmod/vfs_fat.h"
+#include "py/mphal.h"
+#include "py/obj.h"
+#include "py/runtime.h"
+#include "lib/oofatfs/ff.h"
+
+#include "supervisor/usb.h"
+
+#include "csr.h"
+#include "irq.h"
+
+enum pin {
+ PIN_MOSI = 0,
+ PIN_CLK = 1,
+ PIN_CS = 2,
+ PIN_MISO_EN = 3,
+ PIN_MISO = 4, // Value is ignored
+};
+
+#define NO_CACHE 0xffffffff
+
+static uint8_t _flash_cache[FLASH_PAGE_SIZE] __attribute__((aligned(4)));
+static uint32_t _flash_page_addr = NO_CACHE;
+static bool _flash_cache_dirty;
+// -------------------------------------------------------------------------
+// When performing SPI operations, the flash cannot be accessed. Since we
+// normally execute directly from SPI, this can cause problems.
+// To work around this, we execute from RAM. This is accomplished by marking
+// functions as being in the section ".ramtext".
+// When building under GCC with -O0 or -Od, the `inline` attribute is ignored.
+// Therefore, we must re-implement these functions here and explicitly mark
+// them as being in `.ramtext`, even though they really ought to be inlined.
+__attribute__((section(".ramtext")))
+static inline void spi_writel(uint32_t value, uint32_t addr)
+{
+ *((volatile uint32_t *)addr) = value;
+}
+
+__attribute__((section(".ramtext")))
+static inline uint32_t spi_readl(uint32_t addr)
+{
+ return *(volatile uint32_t *)addr;
+}
+
+__attribute__((section(".ramtext")))
+static inline void bb_spi_write(unsigned char value) {
+ spi_writel(value, CSR_LXSPI_BITBANG_ADDR);
+}
+
+__attribute__((section(".ramtext")))
+static inline uint32_t bb_read(void) {
+ return spi_readl(CSR_LXSPI_MISO_ADDR);
+}
+
+__attribute__((section(".ramtext")))
+static inline void bb_spi_en(unsigned int en) {
+ spi_writel(en, CSR_LXSPI_BITBANG_EN_ADDR);
+}
+
+__attribute__((section(".ramtext")))
+static inline void bb_spi_irq_setie(unsigned int ie)
+{
+ if(ie) csrs(mstatus,CSR_MSTATUS_MIE); else csrc(mstatus,CSR_MSTATUS_MIE);
+}
+
+__attribute__((section(".ramtext")))
+static inline void bb_spi_begin(void) {
+ bb_spi_write((0 << PIN_CLK) | (0 << PIN_CS));
+}
+
+__attribute__((section(".ramtext")))
+static inline void bb_spi_end(void) {
+ bb_spi_write((0 << PIN_CLK) | (1 << PIN_CS));
+}
+
+__attribute__((section(".ramtext")))
+static void spi_single_tx(uint8_t out) {
+ int bit;
+
+ for (bit = 7; bit >= 0; bit--) {
+ if (out & (1 << bit)) {
+ bb_spi_write((0 << PIN_CLK) | (1 << PIN_MOSI));
+ bb_spi_write((1 << PIN_CLK) | (1 << PIN_MOSI));
+ bb_spi_write((0 << PIN_CLK) | (1 << PIN_MOSI));
+ } else {
+ bb_spi_write((0 << PIN_CLK) | (0 << PIN_MOSI));
+ bb_spi_write((1 << PIN_CLK) | (0 << PIN_MOSI));
+ bb_spi_write((0 << PIN_CLK) | (0 << PIN_MOSI));
+ }
+ }
+}
+
+__attribute__((section(".ramtext")))
+static uint8_t spi_single_rx(void) {
+ int bit = 0;
+ uint8_t in = 0;
+
+ bb_spi_write((1 << PIN_MISO_EN) | (0 << PIN_CLK));
+
+ while (bit++ < 8) {
+ bb_spi_write((1 << PIN_MISO_EN) | (1 << PIN_CLK));
+ in = (in << 1) | bb_read();
+ bb_spi_write((1 << PIN_MISO_EN) | (0 << PIN_CLK));
+ }
+
+ return in;
+}
+
+__attribute__((section(".ramtext")))
+static int bb_spi_beginErase4(uint32_t erase_addr) {
+ // Enable Write-Enable Latch (WEL)
+ bb_spi_begin();
+ spi_single_tx(0x06);
+ bb_spi_end();
+
+ bb_spi_begin();
+ spi_single_tx(0x20);
+ spi_single_tx(erase_addr >> 16);
+ spi_single_tx(erase_addr >> 8);
+ spi_single_tx(erase_addr >> 0);
+ bb_spi_end();
+ return 0;
+}
+
+__attribute__((section(".ramtext")))
+static int bb_spi_beginWrite(uint32_t addr, const void *v_data, unsigned int count) {
+ const uint8_t write_cmd = 0x02;
+ const uint8_t *data = v_data;
+ unsigned int i;
+
+#ifdef NDEBUG
+ if (v_data < (const void *)_flash_cache) {
+ asm("ebreak");
+ }
+ if ((v_data+count) > (const void *)&_flash_cache[4096]) {
+ asm("ebreak");
+ }
+#endif
+
+ // Enable Write-Enable Latch (WEL)
+ bb_spi_begin();
+ spi_single_tx(0x06);
+ bb_spi_end();
+
+ bb_spi_begin();
+ spi_single_tx(write_cmd);
+ spi_single_tx(addr >> 16);
+ spi_single_tx(addr >> 8);
+ spi_single_tx(addr >> 0);
+ for (i = 0; (i < count) && (i < 256); i++)
+ spi_single_tx(*data++);
+ bb_spi_end();
+
+ return 0;
+}
+
+__attribute__((section(".ramtext")))
+static uint8_t spi_read_status(void) {
+ uint8_t val;
+
+ bb_spi_begin();
+ spi_single_tx(0x05);
+ val = spi_single_rx();
+ bb_spi_end();
+ return val;
+}
+
+__attribute__((section(".ramtext")))
+static int bb_spi_is_busy(void) {
+ return spi_read_status() & (1 << 0);
+}
+
+__attribute__((used))
+uint32_t page_write_log[128];
+__attribute__((used))
+uint32_t page_write_log_offset;
+
+__attribute__((section(".ramtext")))
+static void bb_spi_write_page(uint32_t flash_address, const uint8_t *data) {
+ const uint32_t flash_address_end = flash_address + FLASH_PAGE_SIZE;
+
+ // Ensure we're within the target flash address range.
+ if ((flash_address - FLASH_PARTITION_OFFSET_BYTES) > FLASH_SIZE) {
+ asm("ebreak");
+ return;
+ }
+ if (flash_address < FLASH_PARTITION_OFFSET_BYTES) {
+ asm("ebreak");
+ return;
+ }
+
+ if ((flash_address_end - FLASH_PARTITION_OFFSET_BYTES) > FLASH_SIZE) {
+ asm("ebreak");
+ return;
+ }
+ if (flash_address_end < FLASH_PARTITION_OFFSET_BYTES) {
+ asm("ebreak");
+ return;
+ }
+
+ // Ensure we're not erasing the middle of a flash bank
+ if ((flash_address & 0xfff) != 0) {
+ asm("ebreak");
+ return;
+ }
+
+ page_write_log[page_write_log_offset++] = flash_address;
+ if (page_write_log_offset > sizeof(page_write_log)/sizeof(*page_write_log)) page_write_log_offset=0;
+
+ while (bb_spi_is_busy())
+ ; // relax
+ bb_spi_beginErase4(flash_address);
+ while (bb_spi_is_busy())
+ ; // relax
+ while (flash_address < flash_address_end) {
+ bb_spi_beginWrite(flash_address, data, 256);
+ while (bb_spi_is_busy())
+ ; // relax
+ flash_address += 256;
+ data += 256;
+ }
+}
+
+static inline uint32_t lba2addr(uint32_t block) {
+ return (0x20000000 + FLASH_PARTITION_OFFSET_BYTES) + (block * FILESYSTEM_BLOCK_SIZE);
+}
+
+void supervisor_flash_init(void) {
+}
+
+uint32_t supervisor_flash_get_block_size(void) {
+ return FILESYSTEM_BLOCK_SIZE;
+}
+
+uint32_t supervisor_flash_get_block_count(void) {
+ return FLASH_SIZE/FILESYSTEM_BLOCK_SIZE;
+}
+
+__attribute__((section(".ramtext")))
+void supervisor_flash_flush(void) {
+ // Skip if data is the same, or if there is no data in the cache
+ if (_flash_page_addr == NO_CACHE)
+ return;
+ if (!_flash_cache_dirty)
+ return;
+
+ // Disable interrupts and enable bit-bang mode on the SPI flash.
+ // This function is running from RAM -- otherwise enabling bitbang mode
+ // would crash the CPU as the program suddenly became an endless stream
+ // of `0xffffffff`.
+ bb_spi_irq_setie(0);
+ bb_spi_write((0 << PIN_CLK) | (1 << PIN_CS));
+ bb_spi_en(1);
+
+ bb_spi_write_page(_flash_page_addr & 0x00ffffff, (const uint8_t *)_flash_cache);
+
+ bb_spi_en(0);
+ bb_spi_irq_setie(1);
+
+ _flash_cache_dirty = false;
+}
+
+mp_uint_t supervisor_flash_read_blocks(uint8_t *dest, uint32_t block, uint32_t num_blocks) {
+ // Must write out anything in cache before trying to read.
+ supervisor_flash_flush();
+
+ uint32_t src = lba2addr(block);
+ memcpy(dest, (uint8_t*) src, FILESYSTEM_BLOCK_SIZE*num_blocks);
+
+ #if USB_AVAILABLE
+ usb_background();
+ #endif
+
+ return 0;
+}
+
+mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t lba, uint32_t num_blocks) {
+ while (num_blocks) {
+ uint32_t const addr = lba2addr(lba);
+ uint32_t const page_addr = addr & ~(FLASH_PAGE_SIZE - 1);
+
+ uint32_t count = 8 - (lba % 8); // up to page boundary
+ count = MIN(num_blocks, count);
+
+ if (page_addr != _flash_page_addr) {
+ // Write out anything in cache before overwriting it.
+ supervisor_flash_flush();
+
+ _flash_page_addr = page_addr;
+ _flash_cache_dirty = false;
+
+ // Copy the current contents of the entire page into the cache.
+ memcpy(_flash_cache, (void *)page_addr, FLASH_PAGE_SIZE);
+ }
+
+ // Overwrite part or all of the page cache with the src data, but only if it's changed.
+ if (_flash_cache_dirty || memcmp(_flash_cache + (addr & (FLASH_PAGE_SIZE - 1)), src, count * FILESYSTEM_BLOCK_SIZE)) {
+ memcpy(_flash_cache + (addr & (FLASH_PAGE_SIZE - 1)), src, count * FILESYSTEM_BLOCK_SIZE);
+ _flash_cache_dirty = true;
+ }
+
+ // adjust for next run
+ lba += count;
+ src += count * FILESYSTEM_BLOCK_SIZE;
+ num_blocks -= count;
+
+ #if USB_AVAILABLE
+ usb_background();
+ #endif
+ }
+
+ return 0; // success
+}
+
+void supervisor_flash_release_cache(void) {
+}
+
diff --git a/ports/litex/supervisor/internal_flash.h b/ports/litex/supervisor/internal_flash.h
new file mode 100644
index 000000000..41a69e2ab
--- /dev/null
+++ b/ports/litex/supervisor/internal_flash.h
@@ -0,0 +1,38 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2013, 2014 Damien P. George
+ * Copyright (c) 2019 Lucian Copeland 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.
+ */
+#ifndef MICROPY_INCLUDED_LITEX_INTERNAL_FLASH_H
+#define MICROPY_INCLUDED_LITEX_INTERNAL_FLASH_H
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#include "py/mpconfig.h"
+
+#define INTERNAL_FLASH_SYSTICK_MASK (0x1ff) // 512ms
+#define INTERNAL_FLASH_IDLE_TICK(tick) (((tick) & INTERNAL_FLASH_SYSTICK_MASK) == 2)
+
+#endif // MICROPY_INCLUDED_LITEX_INTERNAL_FLASH_H
diff --git a/ports/litex/supervisor/internal_flash_root_pointers.h b/ports/litex/supervisor/internal_flash_root_pointers.h
new file mode 100644
index 000000000..ae3e45e14
--- /dev/null
+++ b/ports/litex/supervisor/internal_flash_root_pointers.h
@@ -0,0 +1,31 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2018 Scott Shawcroft for Adafruit Industries 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.
+ */
+#ifndef MICROPY_INCLUDED_LITEX_INTERNAL_FLASH_ROOT_POINTERS_H
+#define MICROPY_INCLUDED_LITEX_INTERNAL_FLASH_ROOT_POINTERS_H
+
+#define FLASH_ROOT_POINTERS
+
+#endif // MICROPY_INCLUDED_LITEX_INTERNAL_FLASH_ROOT_POINTERS_H
diff --git a/ports/stm32f4/supervisor/port.c b/ports/litex/supervisor/port.c
index e9e4720d7..9688c7bae 100644
--- a/ports/stm32f4/supervisor/port.c
+++ b/ports/litex/supervisor/port.c
@@ -29,45 +29,34 @@
#include "supervisor/port.h"
#include "boards/board.h"
#include "tick.h"
-
-#include "common-hal/microcontroller/Pin.h"
-#include "common-hal/busio/I2C.h"
-#include "common-hal/busio/SPI.h"
-#include "common-hal/busio/UART.h"
-#include "common-hal/pulseio/PWMOut.h"
-
-#include "stm32f4/clocks.h"
-#include "stm32f4/gpio.h"
-
-#include "stm32f4xx_hal.h"
+#include "irq.h"
+#include "csr.h"
safe_mode_t port_init(void) {
- HAL_Init();
- __HAL_RCC_SYSCFG_CLK_ENABLE();
- __HAL_RCC_PWR_CLK_ENABLE();
-
- stm32f4_peripherals_clocks_init();
- stm32f4_peripherals_gpio_init();
-
+ irq_setmask(0);
+ irq_setie(1);
tick_init();
-
+ board_init();
return NO_SAFE_MODE;
}
+extern uint32_t _ebss;
+extern uint32_t _heap_start;
+extern uint32_t _estack;
+
void reset_port(void) {
- reset_all_pins();
- i2c_reset();
- spi_reset();
- uart_reset();
- pwmout_reset();
+ // reset_all_pins();
+ // i2c_reset();
+ // spi_reset();
+ // uart_reset();
+ // pwmout_reset();
}
void reset_to_bootloader(void) {
-
+ reboot_ctrl_write(0xac);
}
void reset_cpu(void) {
- NVIC_SystemReset();
}
uint32_t *port_heap_get_bottom(void) {
@@ -86,7 +75,6 @@ uint32_t *port_stack_get_top(void) {
return &_estack;
}
-extern uint32_t _ebss;
// Place the word to save just after our BSS section that gets blanked.
void port_set_saved_word(uint32_t value) {
_ebss = value;
@@ -95,10 +83,3 @@ void port_set_saved_word(uint32_t value) {
uint32_t port_get_saved_word(void) {
return _ebss;
}
-
-void HardFault_Handler(void) {
- reset_into_safe_mode(HARD_CRASH);
- while (true) {
- asm("nop;");
- }
-}
diff --git a/ports/litex/supervisor/usb.c b/ports/litex/supervisor/usb.c
new file mode 100644
index 000000000..182360b71
--- /dev/null
+++ b/ports/litex/supervisor/usb.c
@@ -0,0 +1,36 @@
+/*
+ * This file is part of the Micro Python project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2018 hathach for Adafruit Industries
+ * Copyright (c) 2019 Lucian Copeland 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 "tick.h"
+#include "supervisor/usb.h"
+#include "lib/utils/interrupt_char.h"
+#include "lib/mp-readline/readline.h"
+
+void init_usb_hardware(void) {
+
+}
diff --git a/ports/litex/tick.c b/ports/litex/tick.c
new file mode 100644
index 000000000..8ba06044a
--- /dev/null
+++ b/ports/litex/tick.c
@@ -0,0 +1,82 @@
+/*
+ * 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 "csr.h"
+#include "tick.h"
+#include "irq.h"
+
+#include "supervisor/shared/autoreload.h"
+#include "supervisor/filesystem.h"
+#include "supervisor/shared/tick.h"
+#include "shared-module/gamepad/__init__.h"
+#include "shared-bindings/microcontroller/Processor.h"
+
+// Global millisecond tick count
+// volatile uint64_t ticks_ms = 0;
+
+__attribute__((section(".ramtext")))
+void SysTick_Handler(void) {
+ timer0_ev_pending_write(1);
+ supervisor_tick();
+}
+
+void tick_init() {
+ int t;
+
+ timer0_en_write(0);
+ t = CONFIG_CLOCK_FREQUENCY / 1000; // 1000 kHz tick
+ timer0_reload_write(t);
+ timer0_load_write(t);
+ timer0_en_write(1);
+ timer0_ev_enable_write(1);
+ timer0_ev_pending_write(1);
+ irq_setmask(irq_getmask() | (1 << TIMER0_INTERRUPT));
+}
+
+void tick_delay(uint32_t us) {
+ // uint32_t ticks_per_us = SystemCoreClock / 1000 / 1000;
+ // uint32_t us_between_ticks = SysTick->VAL / ticks_per_us;
+ // uint64_t start_ms = ticks_ms;
+ // while (us > 1000) {
+ // while (ticks_ms == start_ms) {}
+ // us -= us_between_ticks;
+ // start_ms = ticks_ms;
+ // us_between_ticks = 1000;
+ // }
+ // while (SysTick->VAL > ((us_between_ticks - us) * ticks_per_us)) {}
+}
+
+// us counts down!
+void current_tick(uint64_t* ms, uint32_t* us_until_ms) {
+ // uint32_t ticks_per_us = SystemCoreClock / 1000 / 1000;
+ // *ms = ticks_ms;
+ // *us_until_ms = SysTick->VAL / ticks_per_us;
+}
+
+void wait_until(uint64_t ms, uint32_t us_until_ms) {
+ // uint32_t ticks_per_us = SystemCoreClock / 1000 / 1000;
+ // while(ticks_ms <= ms && SysTick->VAL / ticks_per_us >= us_until_ms) {}
+}
diff --git a/ports/litex/tick.h b/ports/litex/tick.h
new file mode 100644
index 000000000..b4d27b841
--- /dev/null
+++ b/ports/litex/tick.h
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+#ifndef MICROPY_INCLUDED_LITEX_TICK_H
+#define MICROPY_INCLUDED_LITEX_TICK_H
+
+#include "py/mpconfig.h"
+
+#include <stdint.h>
+
+extern volatile uint64_t ticks_ms;
+
+extern struct timer_descriptor ms_timer;
+
+void tick_init(void);
+
+void tick_delay(uint32_t us);
+
+void current_tick(uint64_t* ms, uint32_t* us_until_ms);
+// Do not call this with interrupts disabled because it may be waiting for
+// ticks_ms to increment.
+void wait_until(uint64_t ms, uint32_t us_until_ms);
+
+#endif // MICROPY_INCLUDED_LITEX_TICK_H
diff --git a/ports/mimxrt10xx/Makefile b/ports/mimxrt10xx/Makefile
index 66a540a40..80d1da1aa 100644
--- a/ports/mimxrt10xx/Makefile
+++ b/ports/mimxrt10xx/Makefile
@@ -228,11 +228,13 @@ $(BUILD)/firmware.elf: $(OBJ) $(LD_FILES)
$(BUILD)/firmware.bin: $(BUILD)/firmware.elf
$(STEPECHO) "Create $@"
- $(Q)$(OBJCOPY) -O binary -j .text -j .ARM.exidx -j .data -j .itcm -j .dtcm_data $^ $@
+ $(Q)$(OBJCOPY) -O binary -j .flash_config -j .ivt -j .text -j .ARM.exidx -j .data -j .itcm -j .dtcm_data $^ $@
-$(BUILD)/firmware.uf2: $(BUILD)/firmware.bin
+$(BUILD)/firmware.uf2: $(BUILD)/firmware.elf
$(STEPECHO) "Create $@"
- $(Q)$(PYTHON3) $(TOP)/tools/uf2/utils/uf2conv.py -b $(BOOTLOADER_SIZE) -f MIMXRT10XX -c -o $@ $^
+ $(Q)$(OBJCOPY) -O binary -j .text -j .ARM.exidx -j .data -j .itcm -j .dtcm_data $^ $@-binpart
+ $(Q)$(PYTHON3) $(TOP)/tools/uf2/utils/uf2conv.py -b $(BOOTLOADER_SIZE) -f MIMXRT10XX -c -o $@ $@-binpart
+ $(Q)rm $@-binpart
$(BUILD)/firmware.hex: $(BUILD)/firmware.elf
$(Q)$(OBJCOPY) -O ihex -j .flash_config -j .ivt -j .text -j .ARM.exidx -j .data -j .itcm -j .dtcm_data $< $@
diff --git a/ports/mimxrt10xx/background.c b/ports/mimxrt10xx/background.c
index c0b217685..71dd79521 100644
--- a/ports/mimxrt10xx/background.c
+++ b/ports/mimxrt10xx/background.c
@@ -37,9 +37,8 @@
#include "supervisor/linker.h"
#include "supervisor/shared/stack.h"
-// TODO
#ifdef CIRCUITPY_DISPLAYIO
-//#include "shared-module/displayio/__init__.h"
+#include "shared-module/displayio/__init__.h"
#endif
volatile uint64_t last_finished_tick = 0;
diff --git a/ports/mimxrt10xx/boards/feather_m7_1011/board.c b/ports/mimxrt10xx/boards/feather_m7_1011/board.c
new file mode 100644
index 000000000..52dd498b3
--- /dev/null
+++ b/ports/mimxrt10xx/boards/feather_m7_1011/board.c
@@ -0,0 +1,39 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
+ * Copyright (c) 2019 Artur Pacholec
+ *
+ * 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) {
+}
+
+bool board_requests_safe_mode(void) {
+ return false;
+}
+
+void reset_board(void) {
+}
diff --git a/ports/mimxrt10xx/boards/feather_m7_1011/flash_config.c b/ports/mimxrt10xx/boards/feather_m7_1011/flash_config.c
new file mode 100644
index 000000000..b74c0b151
--- /dev/null
+++ b/ports/mimxrt10xx/boards/feather_m7_1011/flash_config.c
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2017 NXP
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include "fsl_flexspi_nor_boot.h"
+#include "fsl_flexspi_nor_config.h"
+
+
+__attribute__((section(".boot_hdr.ivt")))
+/*************************************
+ * IVT Data
+ *************************************/
+const ivt image_vector_table = {
+ IVT_HEADER, /* IVT Header */
+ IMAGE_ENTRY_ADDRESS, /* Image Entry Function */
+ IVT_RSVD, /* Reserved = 0 */
+ (uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */
+ (uint32_t)BOOT_DATA_ADDRESS, /* Address where BOOT Data Structure is stored */
+ (uint32_t)&image_vector_table, /* Pointer to IVT Self (absolute address */
+ (uint32_t)CSF_ADDRESS, /* Address where CSF file is stored */
+ IVT_RSVD /* Reserved = 0 */
+};
+
+__attribute__((section(".boot_hdr.boot_data")))
+/*************************************
+ * Boot Data
+ *************************************/
+const BOOT_DATA_T boot_data = {
+ FLASH_BASE, /* boot start location */
+ FLASH_SIZE, /* size */
+ PLUGIN_FLAG, /* Plugin flag*/
+ 0xFFFFFFFF /* empty - extra data word */
+};
+
+__attribute__((section(".boot_hdr.conf")))
+// Values copied from https://github.com/PaulStoffregen/cores/blob/ddb23fa5d97dac763bc06e11b9b41f026bd51f0a/teensy4/bootdata.c#L39
+const flexspi_nor_config_t qspiflash_config = {
+ .memConfig =
+ {
+ .tag = FLEXSPI_CFG_BLK_TAG,
+ .version = FLEXSPI_CFG_BLK_VERSION,
+ .readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackFromDqsPad,
+ .csHoldTime = 1u,
+ .csSetupTime = 2u,
+ // Enable DDR mode, Wordaddressable, Safe configuration, Differential clock
+ .deviceType = kFlexSpiDeviceType_SerialNOR,
+ .sflashPadType = kSerialFlash_4Pads,
+ .serialClkFreq = kFlexSpiSerialClk_60MHz, // 03
+ .sflashA1Size = FLASH_SIZE,
+ .lookupTable =
+ {
+ // FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1)
+ // (FLEXSPI_LUT_OPERAND0(op0) | FLEXSPI_LUT_NUM_PADS0(pad0) | FLEXSPI_LUT_OPCODE0(cmd0) | FLEXSPI_LUT_OPERAND1(op1) |
+ // FLEXSPI_LUT_NUM_PADS1(pad1) | FLEXSPI_LUT_OPCODE1(cmd1))
+ // Read LUTs
+ FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB, RADDR_SDR, FLEXSPI_4PAD, 0x18),
+ FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 0x06, READ_SDR, FLEXSPI_4PAD, 0x04),
+ 0,
+ 0,
+
+ 0x24040405,
+ 0,
+ 0,
+ 0,
+
+ 0,
+ 0,
+ 0,
+ 0,
+
+ 0x00000406,
+ 0,
+ 0,
+ 0,
+
+ 0,
+ 0,
+ 0,
+ 0,
+
+ 0x08180420,
+ 0,
+ 0,
+ 0,
+
+ 0,
+ 0,
+ 0,
+ 0,
+
+ 0,
+ 0,
+ 0,
+ 0,
+
+ 0x081804D8,
+ 0,
+ 0,
+ 0,
+
+ 0x08180402,
+ 0x00002004,
+ 0,
+ 0,
+
+ 0,
+ 0,
+ 0,
+ 0,
+
+ 0x00000460,
+ },
+ },
+ .pageSize = 256u,
+ .sectorSize = 4u * 1024u,
+ .ipcmdSerialClkFreq = kFlexSpiSerialClk_30MHz,
+ .blockSize = 0x00010000,
+ .isUniformBlockSize = false,
+};
diff --git a/ports/mimxrt10xx/boards/feather_m7_1011/mpconfigboard.h b/ports/mimxrt10xx/boards/feather_m7_1011/mpconfigboard.h
new file mode 100644
index 000000000..e96ec13dd
--- /dev/null
+++ b/ports/mimxrt10xx/boards/feather_m7_1011/mpconfigboard.h
@@ -0,0 +1,20 @@
+#define MICROPY_HW_BOARD_NAME "Feather MIMXRT1011"
+#define MICROPY_HW_MCU_NAME "IMXRT1011DAE5A"
+
+#define MICROPY_HW_NEOPIXEL (&pin_GPIO_00)
+
+// If you change this, then make sure to update the linker scripts as well to
+// make sure you don't overwrite code
+#define CIRCUITPY_INTERNAL_NVM_SIZE 0
+
+#define BOARD_FLASH_SIZE (4 * 1024 * 1024)
+
+#define DEFAULT_I2C_BUS_SCL (&pin_GPIO_12)
+#define DEFAULT_I2C_BUS_SDA (&pin_GPIO_11)
+
+#define DEFAULT_SPI_BUS_SCK (&pin_GPIO_AD_06)
+#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO_AD_04)
+#define DEFAULT_SPI_BUS_MISO (&pin_GPIO_AD_03)
+
+#define DEFAULT_UART_BUS_RX (&pin_GPIO_AD_01)
+#define DEFAULT_UART_BUS_TX (&pin_GPIO_AD_02)
diff --git a/ports/mimxrt10xx/boards/feather_m7_1011/mpconfigboard.mk b/ports/mimxrt10xx/boards/feather_m7_1011/mpconfigboard.mk
new file mode 100644
index 000000000..fbaf5d399
--- /dev/null
+++ b/ports/mimxrt10xx/boards/feather_m7_1011/mpconfigboard.mk
@@ -0,0 +1,12 @@
+USB_VID = 0x239A
+USB_PID = 0x8092
+USB_PRODUCT = "Feather M7 1011"
+USB_MANUFACTURER = "Adafruit"
+
+CHIP_VARIANT = MIMXRT1011DAE5A
+CHIP_FAMILY = MIMXRT1011
+FLASH = W25Q32JV
+
+# Include these Python libraries in the firmware
+FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_ESP32SPI
+FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests
diff --git a/ports/mimxrt10xx/boards/feather_m7_1011/pins.c b/ports/mimxrt10xx/boards/feather_m7_1011/pins.c
new file mode 100644
index 000000000..09e321761
--- /dev/null
+++ b/ports/mimxrt10xx/boards/feather_m7_1011/pins.c
@@ -0,0 +1,43 @@
+#include "shared-bindings/board/__init__.h"
+
+#include "boards/board.h"
+
+STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
+ // Analog
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO_AD_11) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO_AD_10) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO_AD_09) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO_AD_08) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO_AD_07) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO_AD_05) },
+
+ // Digital
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO_10) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO_09) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO_08) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO_07) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO_06) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO_05) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO_04) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO_AD_00) },
+
+ // SPI
+ { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO_AD_06) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO_AD_03) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO_AD_04) },
+
+ // UART
+ { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO_AD_02) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO_AD_01) },
+
+ // I2C
+ { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO_11) },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO_12) },
+
+ { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO_00) },
+
+ { 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);
diff --git a/ports/mimxrt10xx/boards/feather_mimxrt1011/mpconfigboard.mk b/ports/mimxrt10xx/boards/feather_mimxrt1011/mpconfigboard.mk
index 08164b140..60eed8a80 100644
--- a/ports/mimxrt10xx/boards/feather_mimxrt1011/mpconfigboard.mk
+++ b/ports/mimxrt10xx/boards/feather_mimxrt1011/mpconfigboard.mk
@@ -6,3 +6,7 @@ USB_MANUFACTURER = "arturo182"
CHIP_VARIANT = MIMXRT1011DAE5A
CHIP_FAMILY = MIMXRT1011
FLASH = W25Q64JV
+
+# Include these Python libraries in the firmware
+FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_ESP32SPI
+FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests
diff --git a/ports/mimxrt10xx/boards/imxrt1020_evk/flash_config.c b/ports/mimxrt10xx/boards/imxrt1020_evk/flash_config.c
index b74c0b151..80a57f17b 100644
--- a/ports/mimxrt10xx/boards/imxrt1020_evk/flash_config.c
+++ b/ports/mimxrt10xx/boards/imxrt1020_evk/flash_config.c
@@ -42,7 +42,11 @@ const flexspi_nor_config_t qspiflash_config = {
{
.tag = FLEXSPI_CFG_BLK_TAG,
.version = FLEXSPI_CFG_BLK_VERSION,
- .readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackFromDqsPad,
+#ifdef BOARD_USING_SECONDARY_QSPI_PINMUX
+ .readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackFromInternally,
+#else
+ .readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackFromDqsPad,
+#endif
.csHoldTime = 1u,
.csSetupTime = 2u,
// Enable DDR mode, Wordaddressable, Safe configuration, Differential clock
diff --git a/ports/mimxrt10xx/common-hal/analogio/AnalogIn.c b/ports/mimxrt10xx/common-hal/analogio/AnalogIn.c
index d714001f3..2cc2681b4 100644
--- a/ports/mimxrt10xx/common-hal/analogio/AnalogIn.c
+++ b/ports/mimxrt10xx/common-hal/analogio/AnalogIn.c
@@ -58,7 +58,7 @@ void common_hal_analogio_analogin_construct(analogio_analogin_obj_t* self,
}
bool common_hal_analogio_analogin_deinited(analogio_analogin_obj_t *self) {
- return self->pin == mp_const_none;
+ return self->pin == NULL;
}
void common_hal_analogio_analogin_deinit(analogio_analogin_obj_t *self) {
@@ -66,7 +66,7 @@ void common_hal_analogio_analogin_deinit(analogio_analogin_obj_t *self) {
return;
}
reset_pin_number(self->pin->number);
- self->pin = mp_const_none;
+ self->pin = NULL;
}
uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) {
diff --git a/ports/mimxrt10xx/common-hal/busio/I2C.c b/ports/mimxrt10xx/common-hal/busio/I2C.c
index 2de996f9a..0bb7dcc6c 100644
--- a/ports/mimxrt10xx/common-hal/busio/I2C.c
+++ b/ports/mimxrt10xx/common-hal/busio/I2C.c
@@ -34,10 +34,8 @@
#include "fsl_lpi2c.h"
-//TODO
+#define I2C_CLOCK_FREQ (CLOCK_GetFreq(kCLOCK_Usb1PllClk) / 8 / (1+CLOCK_GetDiv(kCLOCK_Lpi2cDiv)))
-#define I2C_CLOCK_SOURCE_DIVIDER (5U)
-#define I2C_CLOCK_FREQ (CLOCK_GetFreq(kCLOCK_Usb1PllClk) / 8 / (I2C_CLOCK_SOURCE_DIVIDER + 1U))
static void config_periph_pin(const mcu_periph_obj_t *periph) {
IOMUXC_SetPinMux(
diff --git a/ports/mimxrt10xx/common-hal/busio/SPI.c b/ports/mimxrt10xx/common-hal/busio/SPI.c
index 5ff94bcf8..24a6dbff6 100644
--- a/ports/mimxrt10xx/common-hal/busio/SPI.c
+++ b/ports/mimxrt10xx/common-hal/busio/SPI.c
@@ -95,8 +95,7 @@ static void config_periph_pin(const mcu_periph_obj_t *periph) {
| IOMUXC_SW_PAD_CTL_PAD_SRE(0));
}
-#define LPSPI_CLOCK_SOURCE_DIVIDER (7U)
-#define LPSPI_MASTER_CLK_FREQ (CLOCK_GetFreq(kCLOCK_Usb1PllPfd0Clk) / (LPSPI_CLOCK_SOURCE_DIVIDER + 1U))
+#define LPSPI_MASTER_CLK_FREQ (CLOCK_GetFreq(kCLOCK_Usb1PllPfd0Clk) / (CLOCK_GetDiv(kCLOCK_LpspiDiv)))
void common_hal_busio_spi_construct(busio_spi_obj_t *self,
const mcu_pin_obj_t *clock, const mcu_pin_obj_t *mosi,
@@ -211,6 +210,18 @@ void common_hal_busio_spi_deinit(busio_spi_obj_t *self) {
bool common_hal_busio_spi_configure(busio_spi_obj_t *self,
uint32_t baudrate, uint8_t polarity, uint8_t phase, uint8_t bits) {
+
+ LPSPI_Enable(self->spi, false);
+ uint32_t tcrPrescaleValue;
+ self->baudrate = LPSPI_MasterSetBaudRate(self->spi, baudrate, LPSPI_MASTER_CLK_FREQ, &tcrPrescaleValue);
+ LPSPI_Enable(self->spi, true);
+
+ if ((polarity == common_hal_busio_spi_get_polarity(self)) &&
+ (phase == common_hal_busio_spi_get_phase(self)) &&
+ (bits == ((self->spi->TCR & LPSPI_TCR_FRAMESZ_MASK) >> LPSPI_TCR_FRAMESZ_SHIFT)) + 1) {
+ return true;
+ }
+
lpspi_master_config_t config = { 0 };
LPSPI_MasterGetDefaultConfig(&config);
@@ -222,11 +233,6 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self,
LPSPI_Deinit(self->spi);
LPSPI_MasterInit(self->spi, &config, LPSPI_MASTER_CLK_FREQ);
- LPSPI_Enable(self->spi, false);
- uint32_t tcrPrescaleValue;
- self->baudrate = LPSPI_MasterSetBaudRate(self->spi, config.baudRate, LPSPI_MASTER_CLK_FREQ, &tcrPrescaleValue);
- LPSPI_Enable(self->spi, true);
-
return true;
}
diff --git a/ports/mimxrt10xx/common-hal/busio/UART.c b/ports/mimxrt10xx/common-hal/busio/UART.c
index a4819798b..4633507d8 100644
--- a/ports/mimxrt10xx/common-hal/busio/UART.c
+++ b/ports/mimxrt10xx/common-hal/busio/UART.c
@@ -53,8 +53,8 @@ static void config_periph_pin(const mcu_periph_obj_t *periph) {
IOMUXC_SetPinConfig(0, 0, 0, 0,
periph->pin->cfg_reg,
IOMUXC_SW_PAD_CTL_PAD_HYS(0)
- | IOMUXC_SW_PAD_CTL_PAD_PUS(0)
- | IOMUXC_SW_PAD_CTL_PAD_PUE(0)
+ | IOMUXC_SW_PAD_CTL_PAD_PUS(1)
+ | IOMUXC_SW_PAD_CTL_PAD_PUE(1)
| IOMUXC_SW_PAD_CTL_PAD_PKE(1)
| IOMUXC_SW_PAD_CTL_PAD_ODE(0)
| IOMUXC_SW_PAD_CTL_PAD_SPEED(1)
@@ -72,14 +72,16 @@ void LPUART_UserCallback(LPUART_Type *base, lpuart_handle_t *handle, status_t st
}
void common_hal_busio_uart_construct(busio_uart_obj_t *self,
- const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx, uint32_t baudrate,
- uint8_t bits, uart_parity_t parity, uint8_t stop, mp_float_t timeout,
- uint16_t receiver_buffer_size) {
+ const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx,
+ const mcu_pin_obj_t * rts, const mcu_pin_obj_t * cts,
+ const mcu_pin_obj_t * rs485_dir, bool rs485_invert,
+ uint32_t baudrate, uint8_t bits, uart_parity_t parity, uint8_t stop,
+ mp_float_t timeout, uint16_t receiver_buffer_size) {
// TODO: Allow none rx or tx
- bool have_tx = tx != mp_const_none;
- bool have_rx = rx != mp_const_none;
+ bool have_tx = tx != NULL;
+ bool have_rx = rx != NULL;
if (!have_tx && !have_rx) {
mp_raise_ValueError(translate("tx and rx cannot both be None"));
}
@@ -111,12 +113,60 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
if(self->rx_pin == NULL || self->tx_pin == NULL) {
mp_raise_RuntimeError(translate("Invalid UART pin selection"));
- } else {
- self->uart = mcu_uart_banks[self->tx_pin->bank_idx - 1];
}
+ // Filter for sane settings for RS485
+ if (rs485_dir != NULL) {
+ if ((rts != NULL) || (cts != NULL)) {
+ mp_raise_ValueError(translate("Cannot specify RTS or CTS in RS485 mode"));
+ }
+ // For IMXRT the RTS pin is used for RS485 direction
+ rts = rs485_dir;
+ }
+ else {
+ if (rs485_invert) {
+ mp_raise_ValueError(translate("RS485 inversion specified when not in RS485 mode"));
+ }
+ }
+
+ // Now check for RTS/CTS (or overloaded RS485 direction) pin(s)
+ const uint32_t rts_count = sizeof(mcu_uart_rts_list) / sizeof(mcu_periph_obj_t);
+ const uint32_t cts_count = sizeof(mcu_uart_cts_list) / sizeof(mcu_periph_obj_t);
+
+ if (rts != NULL) {
+ for (uint32_t i=0; i < rts_count; ++i) {
+ if (mcu_uart_rts_list[i].bank_idx == self->rx_pin->bank_idx) {
+ if (mcu_uart_rts_list[i].pin == rts) {
+ self->rts_pin = &mcu_uart_rts_list[i];
+ break;
+ }
+ }
+ }
+ if (self->rts_pin == NULL)
+ mp_raise_ValueError(translate("Selected RTS pin not valid"));
+ }
+
+ if (cts != NULL) {
+ for (uint32_t i=0; i < cts_count; ++i) {
+ if (mcu_uart_cts_list[i].bank_idx == self->rx_pin->bank_idx) {
+ if (mcu_uart_cts_list[i].pin == cts) {
+ self->cts_pin = &mcu_uart_cts_list[i];
+ break;
+ }
+ }
+ }
+ if (self->cts_pin == NULL)
+ mp_raise_ValueError(translate("Selected CTS pin not valid"));
+ }
+
+ self->uart = mcu_uart_banks[self->tx_pin->bank_idx - 1];
+
config_periph_pin(self->rx_pin);
config_periph_pin(self->tx_pin);
+ if (self->rts_pin)
+ config_periph_pin(self->rts_pin);
+ if (self->cts_pin)
+ config_periph_pin(self->cts_pin);
lpuart_config_t config = { 0 };
LPUART_GetDefaultConfig(&config);
@@ -125,10 +175,27 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
config.baudRate_Bps = self->baudrate;
config.enableTx = self->tx_pin != NULL;
config.enableRx = self->rx_pin != NULL;
+ config.enableRxRTS = self->rts_pin != NULL;
+ config.enableTxCTS = self->cts_pin != NULL;
+ if (self->rts_pin != NULL)
+ claim_pin(self->rts_pin->pin);
+ if (self->cts_pin != NULL)
+ claim_pin(self->cts_pin->pin);
LPUART_Init(self->uart, &config, UART_CLOCK_FREQ);
- claim_pin(self->tx_pin->pin);
+ // Before we init, setup RS485 direction pin
+ // ..unfortunately this isn't done by the driver library
+ uint32_t modir = (self->uart->MODIR) & ~(LPUART_MODIR_TXRTSPOL_MASK | LPUART_MODIR_TXRTSE_MASK);
+ if (rs485_dir != NULL) {
+ modir |= LPUART_MODIR_TXRTSE_MASK;
+ if (rs485_invert)
+ modir |= LPUART_MODIR_TXRTSPOL_MASK;
+ }
+ self->uart->MODIR = modir;
+
+ if (self->tx_pin != NULL)
+ claim_pin(self->tx_pin->pin);
if (self->rx_pin != NULL) {
ringbuf_alloc(&self->rbuf, receiver_buffer_size, true);
@@ -203,7 +270,14 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t
LPUART_TransferAbortReceive(self->uart, &self->handle);
}
- return len - self->handle.rxDataSize;
+ // No data left, we got it all
+ if (self->handle.rxData == NULL) {
+ return len;
+ }
+
+ // The only place we can reliably tell how many bytes have been received is from the current
+ // wp in the handle (because the abort nukes rxDataSize, and reading it before abort is a race.)
+ return self->handle.rxData - data;
}
// Write characters.
diff --git a/ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c b/ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c
index d69a18d96..603515764 100644
--- a/ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c
+++ b/ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c
@@ -78,7 +78,7 @@ void common_hal_digitalio_digitalinout_never_reset(
}
bool common_hal_digitalio_digitalinout_deinited(digitalio_digitalinout_obj_t* self) {
- return self->pin == mp_const_none;
+ return self->pin == NULL;
}
void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t* self) {
@@ -86,7 +86,7 @@ void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t* self
return;
}
reset_pin_number(self->pin->number);
- self->pin = mp_const_none;
+ self->pin = NULL;
}
void common_hal_digitalio_digitalinout_switch_to_input(
diff --git a/ports/mimxrt10xx/common-hal/displayio/ParallelBus.c b/ports/mimxrt10xx/common-hal/displayio/ParallelBus.c
new file mode 100644
index 000000000..87fc511af
--- /dev/null
+++ b/ports/mimxrt10xx/common-hal/displayio/ParallelBus.c
@@ -0,0 +1,68 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Artur Pacholec
+ *
+ * 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 "shared-bindings/displayio/ParallelBus.h"
+
+#include <stdint.h>
+
+#include "common-hal/microcontroller/Pin.h"
+#include "py/runtime.h"
+#include "shared-bindings/digitalio/DigitalInOut.h"
+#include "shared-bindings/microcontroller/__init__.h"
+
+#include "tick.h"
+
+void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* self,
+ const mcu_pin_obj_t* data0, const mcu_pin_obj_t* command, const mcu_pin_obj_t* chip_select,
+ const mcu_pin_obj_t* write, const mcu_pin_obj_t* read, const mcu_pin_obj_t* reset) {
+
+ mp_raise_NotImplementedError(translate("ParallelBus not yet supported"));
+}
+
+void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t* self) {
+
+}
+
+bool common_hal_displayio_parallelbus_reset(mp_obj_t obj) {
+ return false;
+}
+
+bool common_hal_displayio_parallelbus_bus_free(mp_obj_t obj) {
+ return false;
+}
+
+bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) {
+
+ return false;
+}
+
+void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length) {
+
+}
+
+void common_hal_displayio_parallelbus_end_transaction(mp_obj_t obj) {
+
+}
diff --git a/ports/mimxrt10xx/common-hal/displayio/ParallelBus.h b/ports/mimxrt10xx/common-hal/displayio/ParallelBus.h
new file mode 100644
index 000000000..845e44df0
--- /dev/null
+++ b/ports/mimxrt10xx/common-hal/displayio/ParallelBus.h
@@ -0,0 +1,36 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Artur Pacholec
+ *
+ * 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_MIMXRT10XX_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
+#define MICROPY_INCLUDED_MIMXRT10XX_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
+
+#include "common-hal/digitalio/DigitalInOut.h"
+
+typedef struct {
+ mp_obj_base_t base;
+} displayio_parallelbus_obj_t;
+
+#endif // MICROPY_INCLUDED_MIMXRT10XX_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
diff --git a/ports/mimxrt10xx/common-hal/microcontroller/Pin.c b/ports/mimxrt10xx/common-hal/microcontroller/Pin.c
index 04dd99739..21e61d29d 100644
--- a/ports/mimxrt10xx/common-hal/microcontroller/Pin.c
+++ b/ports/mimxrt10xx/common-hal/microcontroller/Pin.c
@@ -224,3 +224,7 @@ bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t* pin) {
void common_hal_reset_pin(const mcu_pin_obj_t* pin) {
// reset_pin_number(pin->number);
}
+
+void common_hal_never_reset_pin(const mcu_pin_obj_t* pin) {
+// never_reset_pin_number(pin->port, pin->number);
+}
diff --git a/ports/mimxrt10xx/common-hal/microcontroller/Processor.c b/ports/mimxrt10xx/common-hal/microcontroller/Processor.c
index 23493f766..0c8131ef4 100644
--- a/ports/mimxrt10xx/common-hal/microcontroller/Processor.c
+++ b/ports/mimxrt10xx/common-hal/microcontroller/Processor.c
@@ -58,8 +58,13 @@ void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) {
OCOTP_Init(OCOTP, CLOCK_GetFreq(kCLOCK_IpgClk));
// Reads shadow registers 0x01 - 0x04 (Configuration and Manufacturing Info)
- for (int i = 0; i < 4; ++i)
- ((uint32_t*) raw_id)[i] = OCOTP_ReadFuseShadowRegister(OCOTP, i + 1);
-
+ // into 8 bit wide destination, avoiding punning.
+ for (int i = 0; i < 4; ++i) {
+ uint32_t wr = OCOTP_ReadFuseShadowRegister(OCOTP, i + 1);
+ for (int j = 0; j < 4; j++) {
+ raw_id[i*4+j] = wr & 0xff;
+ wr >>= 8;
+ }
+ }
OCOTP_Deinit(OCOTP);
}
diff --git a/ports/mimxrt10xx/common-hal/neopixel_write/__init__.c b/ports/mimxrt10xx/common-hal/neopixel_write/__init__.c
index 9ea233502..3e1d343ec 100644
--- a/ports/mimxrt10xx/common-hal/neopixel_write/__init__.c
+++ b/ports/mimxrt10xx/common-hal/neopixel_write/__init__.c
@@ -32,7 +32,6 @@
#include "py/mperrno.h"
#include "py/runtime.h"
#include "common-hal/microcontroller/Pin.h"
-#include "fsl_gpio.h"
uint64_t next_start_tick_ms = 0;
uint32_t next_start_tick_us = 1000;
@@ -45,7 +44,7 @@ uint32_t next_start_tick_us = 1000;
#pragma GCC push_options
#pragma GCC optimize ("Os")
-void common_hal_neopixel_write (const digitalio_digitalinout_obj_t* digitalinout, uint8_t *pixels,
+void PLACE_IN_ITCM(common_hal_neopixel_write)(const digitalio_digitalinout_obj_t* digitalinout, uint8_t *pixels,
uint32_t numBytes) {
uint8_t *p = pixels, *end = p + numBytes, pix = *p++, mask = 0x80;
uint32_t start = 0;
@@ -54,14 +53,10 @@ void common_hal_neopixel_write (const digitalio_digitalinout_obj_t* digitalinout
//assumes 800_000Hz frequency
//Theoretical values here are 800_000 -> 1.25us, 2500000->0.4us, 1250000->0.8us
//TODO: try to get dynamic weighting working again
-#ifdef MIMXRT1011_SERIES
- uint32_t sys_freq = CLOCK_GetCoreFreq();
-#else
- uint32_t sys_freq = CLOCK_GetAhbFreq();
-#endif
- uint32_t interval = sys_freq/MAGIC_800_INT;
- uint32_t t0 = (sys_freq/MAGIC_800_T0H);
- uint32_t t1 = (sys_freq/MAGIC_800_T1H);
+ const uint32_t sys_freq = SystemCoreClock;
+ const uint32_t interval = (sys_freq / MAGIC_800_INT);
+ const uint32_t t0 = (sys_freq / MAGIC_800_T0H);
+ const uint32_t t1 = (sys_freq / MAGIC_800_T1H);
// This must be called while interrupts are on in case we're waiting for a
// future ms tick.
@@ -79,9 +74,9 @@ void common_hal_neopixel_write (const digitalio_digitalinout_obj_t* digitalinout
for(;;) {
cyc = (pix & mask) ? t1 : t0;
start = DWT->CYCCNT;
- GPIO_PinWrite(gpio, pin, 1);
+ gpio->DR |= (1U << pin);
while((DWT->CYCCNT - start) < cyc);
- GPIO_PinWrite(gpio, pin, 0);
+ gpio->DR &= ~(1U << pin);
while((DWT->CYCCNT - start) < interval);
if(!(mask >>= 1)) {
if(p >= end) break;
diff --git a/ports/mimxrt10xx/common-hal/time/__init__.c b/ports/mimxrt10xx/common-hal/time/__init__.c
index 2d82b3d1a..524e31d1a 100644
--- a/ports/mimxrt10xx/common-hal/time/__init__.c
+++ b/ports/mimxrt10xx/common-hal/time/__init__.c
@@ -30,10 +30,20 @@
#include "supervisor/shared/tick.h"
-inline uint64_t common_hal_time_monotonic() {
+#include "tick.h"
+
+inline uint64_t common_hal_time_monotonic(void) {
return supervisor_ticks_ms64();
}
+uint64_t common_hal_time_monotonic_ns(void) {
+ uint64_t ms;
+ uint32_t us_until_ms;
+ current_tick(&ms, &us_until_ms);
+ // us counts down.
+ return 1000 * (ms * 1000 + (1000 - us_until_ms));
+}
+
void common_hal_time_delay_ms(uint32_t delay) {
mp_hal_delay_ms(delay);
}
diff --git a/ports/mimxrt10xx/linking/flash/W25Q32JV.ld b/ports/mimxrt10xx/linking/flash/W25Q32JV.ld
new file mode 100644
index 000000000..3fa395c66
--- /dev/null
+++ b/ports/mimxrt10xx/linking/flash/W25Q32JV.ld
@@ -0,0 +1 @@
+_ld_flash_size = 4M;
diff --git a/ports/mimxrt10xx/mpconfigport.h b/ports/mimxrt10xx/mpconfigport.h
index 745c12f7d..7e7df0123 100644
--- a/ports/mimxrt10xx/mpconfigport.h
+++ b/ports/mimxrt10xx/mpconfigport.h
@@ -44,7 +44,7 @@ extern uint8_t _ld_default_stack_size;
#define MICROPY_PY_FUNCTION_ATTRS (0)
#define MICROPY_PY_IO (1)
#define MICROPY_PY_UJSON (1)
-#define MICROPY_PY_REVERSE_SPECIAL_METHODS (0)
+#define MICROPY_PY_REVERSE_SPECIAL_METHODS (1)
#define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_START_ADDR ((uint32_t) &_ld_filesystem_start)
diff --git a/ports/mimxrt10xx/mpconfigport.mk b/ports/mimxrt10xx/mpconfigport.mk
index b928ce3bb..5881ac302 100644
--- a/ports/mimxrt10xx/mpconfigport.mk
+++ b/ports/mimxrt10xx/mpconfigport.mk
@@ -20,7 +20,6 @@ USB_MSC_MAX_PACKET_SIZE = 512
INTERNAL_FLASH_FILESYSTEM = 1
-CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_AUDIOIO = 0
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_FREQUENCYIO = 0
diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.c
index e9d735830..2fed6dfc6 100644
--- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.c
+++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.c
@@ -113,6 +113,26 @@ const mcu_periph_obj_t mcu_uart_tx_list[9] = {
PERIPH_PIN(4, 3, kIOMUXC_LPUART4_TXD_SELECT_INPUT, 1, &pin_GPIO_06),
};
+const mcu_periph_obj_t mcu_uart_rts_list[4] = {
+ PERIPH_PIN(1, 6, 0, 0, &pin_GPIO_07),
+
+ PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_AD_07),
+
+ PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_AD_13),
+
+ PERIPH_PIN(4, 3, 0, 0, &pin_GPIO_AD_13)
+};
+
+const mcu_periph_obj_t mcu_uart_cts_list[4] = {
+ PERIPH_PIN(1, 6, 0, 0, &pin_GPIO_08),
+
+ PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_AD_08),
+
+ PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_AD_14),
+
+ PERIPH_PIN(4, 3, 0, 0, &pin_GPIO_AD_14),
+};
+
const mcu_pwm_obj_t mcu_pwm_list[20] = {
PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmA, 2, &pin_GPIO_02),
PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmA, 2, &pin_GPIO_SD_02),
diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.h
index c91d5808a..d6d489537 100644
--- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.h
+++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.h
@@ -36,6 +36,8 @@ extern const mcu_periph_obj_t mcu_spi_miso_list[4];
extern const mcu_periph_obj_t mcu_uart_rx_list[9];
extern const mcu_periph_obj_t mcu_uart_tx_list[9];
+extern const mcu_periph_obj_t mcu_uart_rts_list[4];
+extern const mcu_periph_obj_t mcu_uart_cts_list[4];
extern const mcu_pwm_obj_t mcu_pwm_list[20];
diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.c
index 39e4f0131..60f301668 100644
--- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.c
+++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.c
@@ -33,28 +33,28 @@
LPI2C_Type *mcu_i2c_banks[] = { LPI2C1, LPI2C2, LPI2C3, LPI2C4 };
const mcu_periph_obj_t mcu_i2c_sda_list[8] = {
- PERIPH_PIN(1, 0, kIOMUXC_LPI2C1_SDA_SELECT_INPUT, 0, &pin_GPIO_AD_B1_15),
- PERIPH_PIN(1, 6, kIOMUXC_LPI2C1_SDA_SELECT_INPUT, 1, &pin_GPIO_EMC_03),
+ PERIPH_PIN(1, 6, kIOMUXC_LPI2C1_SDA_SELECT_INPUT, 0, &pin_GPIO_EMC_03),
+ PERIPH_PIN(1, 0, kIOMUXC_LPI2C1_SDA_SELECT_INPUT, 1, &pin_GPIO_AD_B1_15),
PERIPH_PIN(2, 0, kIOMUXC_LPI2C2_SDA_SELECT_INPUT, 0, &pin_GPIO_AD_B1_09),
PERIPH_PIN(2, 2, kIOMUXC_LPI2C2_SDA_SELECT_INPUT, 1, &pin_GPIO_EMC_18),
- PERIPH_PIN(3, 1, kIOMUXC_LPI2C3_SDA_SELECT_INPUT, 0, &pin_GPIO_AD_B0_09),
- PERIPH_PIN(3, 4, kIOMUXC_LPI2C3_SDA_SELECT_INPUT, 1, &pin_GPIO_SD_B0_01),
+ PERIPH_PIN(3, 4, kIOMUXC_LPI2C3_SDA_SELECT_INPUT, 0, &pin_GPIO_SD_B0_01),
+ PERIPH_PIN(3, 1, kIOMUXC_LPI2C3_SDA_SELECT_INPUT, 1, &pin_GPIO_AD_B0_09),
PERIPH_PIN(4, 2, kIOMUXC_LPI2C4_SDA_SELECT_INPUT, 0, &pin_GPIO_EMC_10),
PERIPH_PIN(4, 3, kIOMUXC_LPI2C4_SDA_SELECT_INPUT, 1, &pin_GPIO_SD_B1_03),
};
const mcu_periph_obj_t mcu_i2c_scl_list[8] = {
- PERIPH_PIN(1, 0, kIOMUXC_LPI2C1_SCL_SELECT_INPUT, 0, &pin_GPIO_AD_B1_14),
- PERIPH_PIN(1, 6, kIOMUXC_LPI2C1_SCL_SELECT_INPUT, 1, &pin_GPIO_EMC_02),
+ PERIPH_PIN(1, 6, kIOMUXC_LPI2C1_SCL_SELECT_INPUT, 0, &pin_GPIO_EMC_02),
+ PERIPH_PIN(1, 0, kIOMUXC_LPI2C1_SCL_SELECT_INPUT, 1, &pin_GPIO_AD_B1_14),
PERIPH_PIN(2, 0, kIOMUXC_LPI2C2_SCL_SELECT_INPUT, 0, &pin_GPIO_AD_B1_08),
PERIPH_PIN(2, 2, kIOMUXC_LPI2C2_SCL_SELECT_INPUT, 1, &pin_GPIO_EMC_19),
- PERIPH_PIN(3, 1, kIOMUXC_LPI2C3_SCL_SELECT_INPUT, 0, &pin_GPIO_AD_B0_08),
- PERIPH_PIN(3, 4, kIOMUXC_LPI2C3_SCL_SELECT_INPUT, 1, &pin_GPIO_SD_B0_00),
+ PERIPH_PIN(3, 4, kIOMUXC_LPI2C3_SCL_SELECT_INPUT, 0, &pin_GPIO_SD_B0_00),
+ PERIPH_PIN(3, 1, kIOMUXC_LPI2C3_SCL_SELECT_INPUT, 1, &pin_GPIO_AD_B0_08),
PERIPH_PIN(4, 2, kIOMUXC_LPI2C4_SCL_SELECT_INPUT, 0, &pin_GPIO_EMC_11),
PERIPH_PIN(4, 3, kIOMUXC_LPI2C4_SCL_SELECT_INPUT, 1, &pin_GPIO_SD_B1_02),
@@ -63,8 +63,8 @@ const mcu_periph_obj_t mcu_i2c_scl_list[8] = {
LPSPI_Type *mcu_spi_banks[] = { LPSPI1, LPSPI2, LPSPI3, LPSPI4 };
const mcu_periph_obj_t mcu_spi_sck_list[8] = {
- PERIPH_PIN(1, 1, kIOMUXC_LPSPI1_SCK_SELECT_INPUT, 0, &pin_GPIO_AD_B0_10),
- PERIPH_PIN(1, 4, kIOMUXC_LPSPI1_SCK_SELECT_INPUT, 1, &pin_GPIO_SD_B0_02),
+ PERIPH_PIN(1, 4, kIOMUXC_LPSPI1_SCK_SELECT_INPUT, 0, &pin_GPIO_SD_B0_02),
+ PERIPH_PIN(1, 1, kIOMUXC_LPSPI1_SCK_SELECT_INPUT, 1, &pin_GPIO_AD_B0_10),
PERIPH_PIN(2, 4, kIOMUXC_LPSPI2_SCK_SELECT_INPUT, 0, &pin_GPIO_EMC_00),
PERIPH_PIN(2, 4, kIOMUXC_LPSPI2_SCK_SELECT_INPUT, 1, &pin_GPIO_EMC_10),
@@ -77,31 +77,31 @@ const mcu_periph_obj_t mcu_spi_sck_list[8] = {
};
const mcu_periph_obj_t mcu_spi_mosi_list[8] = {
- PERIPH_PIN(1, 1, kIOMUXC_LPSPI1_SDO_SELECT_INPUT, 0, &pin_GPIO_AD_B0_13),
- PERIPH_PIN(1, 4, kIOMUXC_LPSPI1_SDO_SELECT_INPUT, 1, &pin_GPIO_SD_B0_05),
+ PERIPH_PIN(1, 4, kIOMUXC_LPSPI1_SDO_SELECT_INPUT, 0, &pin_GPIO_SD_B0_04),
+ PERIPH_PIN(1, 1, kIOMUXC_LPSPI1_SDO_SELECT_INPUT, 1, &pin_GPIO_AD_B0_12),
- PERIPH_PIN(2, 4, kIOMUXC_LPSPI2_SDO_SELECT_INPUT, 0, &pin_GPIO_EMC_03),
- PERIPH_PIN(2, 4, kIOMUXC_LPSPI2_SDO_SELECT_INPUT, 1, &pin_GPIO_EMC_13),
- PERIPH_PIN(2, 4, kIOMUXC_LPSPI2_SDO_SELECT_INPUT, 2, &pin_GPIO_SD_B1_09),
+ PERIPH_PIN(2, 4, kIOMUXC_LPSPI2_SDO_SELECT_INPUT, 0, &pin_GPIO_EMC_02),
+ PERIPH_PIN(2, 4, kIOMUXC_LPSPI2_SDO_SELECT_INPUT, 1, &pin_GPIO_EMC_12),
+ PERIPH_PIN(2, 4, kIOMUXC_LPSPI2_SDO_SELECT_INPUT, 2, &pin_GPIO_SD_B1_08),
- PERIPH_PIN(3, 2, kIOMUXC_LPSPI2_SDO_SELECT_INPUT, 0, &pin_GPIO_AD_B1_15),
+ PERIPH_PIN(3, 2, kIOMUXC_LPSPI2_SDO_SELECT_INPUT, 0, &pin_GPIO_AD_B1_14),
- PERIPH_PIN(4, 2, kIOMUXC_LPSPI2_SDO_SELECT_INPUT, 0, &pin_GPIO_AD_B1_05),
- PERIPH_PIN(4, 4, kIOMUXC_LPSPI2_SDO_SELECT_INPUT, 1, &pin_GPIO_EMC_35),
+ PERIPH_PIN(4, 2, kIOMUXC_LPSPI2_SDO_SELECT_INPUT, 0, &pin_GPIO_AD_B1_04),
+ PERIPH_PIN(4, 4, kIOMUXC_LPSPI2_SDO_SELECT_INPUT, 1, &pin_GPIO_EMC_34),
};
const mcu_periph_obj_t mcu_spi_miso_list[8] = {
- PERIPH_PIN(1, 1, kIOMUXC_LPSPI1_SDI_SELECT_INPUT, 0, &pin_GPIO_AD_B0_12),
- PERIPH_PIN(1, 4, kIOMUXC_LPSPI1_SDI_SELECT_INPUT, 1, &pin_GPIO_SD_B0_04),
+ PERIPH_PIN(1, 4, kIOMUXC_LPSPI1_SDI_SELECT_INPUT, 0, &pin_GPIO_SD_B0_05),
+ PERIPH_PIN(1, 1, kIOMUXC_LPSPI1_SDI_SELECT_INPUT, 1, &pin_GPIO_AD_B0_13),
- PERIPH_PIN(2, 4, kIOMUXC_LPSPI2_SDI_SELECT_INPUT, 0, &pin_GPIO_EMC_02),
- PERIPH_PIN(2, 4, kIOMUXC_LPSPI2_SDI_SELECT_INPUT, 1, &pin_GPIO_EMC_12),
- PERIPH_PIN(2, 4, kIOMUXC_LPSPI2_SDI_SELECT_INPUT, 2, &pin_GPIO_SD_B1_08),
+ PERIPH_PIN(2, 4, kIOMUXC_LPSPI2_SDI_SELECT_INPUT, 0, &pin_GPIO_EMC_03),
+ PERIPH_PIN(2, 4, kIOMUXC_LPSPI2_SDI_SELECT_INPUT, 1, &pin_GPIO_EMC_13),
+ PERIPH_PIN(2, 4, kIOMUXC_LPSPI2_SDI_SELECT_INPUT, 2, &pin_GPIO_SD_B1_09),
- PERIPH_PIN(3, 2, kIOMUXC_LPSPI2_SDI_SELECT_INPUT, 0, &pin_GPIO_AD_B1_14),
+ PERIPH_PIN(3, 2, kIOMUXC_LPSPI2_SDI_SELECT_INPUT, 0, &pin_GPIO_AD_B1_15),
- PERIPH_PIN(4, 2, kIOMUXC_LPSPI2_SDI_SELECT_INPUT, 0, &pin_GPIO_AD_B1_04),
- PERIPH_PIN(4, 4, kIOMUXC_LPSPI2_SDI_SELECT_INPUT, 1, &pin_GPIO_EMC_34),
+ PERIPH_PIN(4, 2, kIOMUXC_LPSPI2_SDI_SELECT_INPUT, 0, &pin_GPIO_AD_B1_05),
+ PERIPH_PIN(4, 4, kIOMUXC_LPSPI2_SDI_SELECT_INPUT, 1, &pin_GPIO_EMC_35),
};
LPUART_Type *mcu_uart_banks[] = { LPUART1, LPUART2, LPUART3, LPUART4, LPUART5, LPUART6, LPUART7, LPUART8 };
@@ -109,53 +109,93 @@ LPUART_Type *mcu_uart_banks[] = { LPUART1, LPUART2, LPUART3, LPUART4, LPUART5, L
const mcu_periph_obj_t mcu_uart_rx_list[16] = {
PERIPH_PIN(1, 2, 0, 0, &pin_GPIO_AD_B0_07),
- PERIPH_PIN(2, 2, kIOMUXC_LPUART2_RX_SELECT_INPUT, 0, &pin_GPIO_EMC_23),
- PERIPH_PIN(2, 2, kIOMUXC_LPUART2_RX_SELECT_INPUT, 1, &pin_GPIO_AD_B1_09),
+ PERIPH_PIN(2, 2, kIOMUXC_LPUART2_RX_SELECT_INPUT, 0, &pin_GPIO_AD_B1_09),
+ PERIPH_PIN(2, 2, kIOMUXC_LPUART2_RX_SELECT_INPUT, 1, &pin_GPIO_EMC_23),
PERIPH_PIN(3, 2, kIOMUXC_LPUART3_RX_SELECT_INPUT, 0, &pin_GPIO_EMC_07),
PERIPH_PIN(3, 2, kIOMUXC_LPUART3_RX_SELECT_INPUT, 1, &pin_GPIO_AD_B0_15),
PERIPH_PIN(4, 2, kIOMUXC_LPUART4_RX_SELECT_INPUT, 0, &pin_GPIO_EMC_03),
- PERIPH_PIN(4, 2, kIOMUXC_LPUART4_RX_SELECT_INPUT, 1, &pin_GPIO_EMC_33),
- PERIPH_PIN(4, 2, kIOMUXC_LPUART4_RX_SELECT_INPUT, 2, &pin_GPIO_AD_B1_11),
+ PERIPH_PIN(4, 2, kIOMUXC_LPUART4_RX_SELECT_INPUT, 1, &pin_GPIO_AD_B1_11),
+ PERIPH_PIN(4, 2, kIOMUXC_LPUART4_RX_SELECT_INPUT, 2, &pin_GPIO_EMC_33),
- PERIPH_PIN(5, 2, kIOMUXC_LPUART5_RX_SELECT_INPUT, 0, &pin_GPIO_EMC_39),
- PERIPH_PIN(5, 2, kIOMUXC_LPUART5_RX_SELECT_INPUT, 1, &pin_GPIO_AD_B0_11),
+ PERIPH_PIN(5, 2, kIOMUXC_LPUART5_RX_SELECT_INPUT, 0, &pin_GPIO_AD_B0_11),
+ PERIPH_PIN(5, 2, kIOMUXC_LPUART5_RX_SELECT_INPUT, 1, &pin_GPIO_EMC_39),
PERIPH_PIN(6, 2, kIOMUXC_LPUART6_RX_SELECT_INPUT, 0, &pin_GPIO_EMC_13),
PERIPH_PIN(6, 2, kIOMUXC_LPUART6_RX_SELECT_INPUT, 1, &pin_GPIO_SD_B1_01),
- PERIPH_PIN(7, 2, kIOMUXC_LPUART7_RX_SELECT_INPUT, 0, &pin_GPIO_EMC_35),
- PERIPH_PIN(7, 2, kIOMUXC_LPUART7_RX_SELECT_INPUT, 1, &pin_GPIO_SD_B0_05),
+ PERIPH_PIN(7, 2, kIOMUXC_LPUART7_RX_SELECT_INPUT, 0, &pin_GPIO_SD_B0_05),
+ PERIPH_PIN(7, 2, kIOMUXC_LPUART7_RX_SELECT_INPUT, 1, &pin_GPIO_EMC_35),
- PERIPH_PIN(8, 2, kIOMUXC_LPUART8_RX_SELECT_INPUT, 0, &pin_GPIO_EMC_27),
- PERIPH_PIN(8, 2, kIOMUXC_LPUART8_RX_SELECT_INPUT, 1, &pin_GPIO_SD_B1_03),
+ PERIPH_PIN(8, 2, kIOMUXC_LPUART8_RX_SELECT_INPUT, 0, &pin_GPIO_SD_B1_03),
+ PERIPH_PIN(8, 2, kIOMUXC_LPUART8_RX_SELECT_INPUT, 1, &pin_GPIO_EMC_27),
};
const mcu_periph_obj_t mcu_uart_tx_list[16] = {
PERIPH_PIN(1, 2, 0, 0, &pin_GPIO_AD_B0_06),
- PERIPH_PIN(2, 2, kIOMUXC_LPUART2_TX_SELECT_INPUT, 0, &pin_GPIO_EMC_22),
- PERIPH_PIN(2, 2, kIOMUXC_LPUART2_TX_SELECT_INPUT, 1, &pin_GPIO_AD_B1_08),
+ PERIPH_PIN(2, 2, kIOMUXC_LPUART2_TX_SELECT_INPUT, 0, &pin_GPIO_AD_B1_08),
+ PERIPH_PIN(2, 2, kIOMUXC_LPUART2_TX_SELECT_INPUT, 1, &pin_GPIO_EMC_22),
PERIPH_PIN(3, 2, kIOMUXC_LPUART3_TX_SELECT_INPUT, 0, &pin_GPIO_EMC_06),
PERIPH_PIN(3, 2, kIOMUXC_LPUART3_TX_SELECT_INPUT, 1, &pin_GPIO_AD_B0_14),
PERIPH_PIN(4, 2, kIOMUXC_LPUART4_TX_SELECT_INPUT, 0, &pin_GPIO_EMC_02),
- PERIPH_PIN(4, 2, kIOMUXC_LPUART4_TX_SELECT_INPUT, 1, &pin_GPIO_EMC_32),
- PERIPH_PIN(4, 2, kIOMUXC_LPUART4_TX_SELECT_INPUT, 2, &pin_GPIO_AD_B1_10),
+ PERIPH_PIN(4, 2, kIOMUXC_LPUART4_TX_SELECT_INPUT, 1, &pin_GPIO_AD_B1_10),
+ PERIPH_PIN(4, 2, kIOMUXC_LPUART4_TX_SELECT_INPUT, 2, &pin_GPIO_EMC_32),
- PERIPH_PIN(5, 2, kIOMUXC_LPUART5_TX_SELECT_INPUT, 0, &pin_GPIO_EMC_38),
- PERIPH_PIN(5, 2, kIOMUXC_LPUART5_TX_SELECT_INPUT, 1, &pin_GPIO_AD_B0_10),
+ PERIPH_PIN(5, 2, kIOMUXC_LPUART5_TX_SELECT_INPUT, 0, &pin_GPIO_AD_B0_10),
+ PERIPH_PIN(5, 2, kIOMUXC_LPUART5_TX_SELECT_INPUT, 1, &pin_GPIO_EMC_38),
PERIPH_PIN(6, 2, kIOMUXC_LPUART6_TX_SELECT_INPUT, 0, &pin_GPIO_EMC_12),
PERIPH_PIN(6, 2, kIOMUXC_LPUART6_TX_SELECT_INPUT, 1, &pin_GPIO_SD_B1_00),
- PERIPH_PIN(7, 2, kIOMUXC_LPUART7_TX_SELECT_INPUT, 0, &pin_GPIO_EMC_34),
- PERIPH_PIN(7, 2, kIOMUXC_LPUART7_TX_SELECT_INPUT, 1, &pin_GPIO_SD_B0_04),
+ PERIPH_PIN(7, 2, kIOMUXC_LPUART7_TX_SELECT_INPUT, 0, &pin_GPIO_SD_B0_04),
+ PERIPH_PIN(7, 2, kIOMUXC_LPUART7_TX_SELECT_INPUT, 1, &pin_GPIO_EMC_34),
- PERIPH_PIN(8, 2, kIOMUXC_LPUART8_TX_SELECT_INPUT, 0, &pin_GPIO_EMC_26),
- PERIPH_PIN(8, 2, kIOMUXC_LPUART8_TX_SELECT_INPUT, 1, &pin_GPIO_SD_B1_02),
+ PERIPH_PIN(8, 2, kIOMUXC_LPUART8_TX_SELECT_INPUT, 0, &pin_GPIO_SD_B1_02),
+ PERIPH_PIN(8, 2, kIOMUXC_LPUART8_TX_SELECT_INPUT, 1, &pin_GPIO_EMC_26),
+};
+
+const mcu_periph_obj_t mcu_uart_rts_list[10] = {
+ PERIPH_PIN(1, 2, 0, 0, &pin_GPIO_AD_B0_09),
+
+ PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_EMC_21),
+ PERIPH_PIN(2, 2, 0, 1, &pin_GPIO_AD_B1_07),
+
+ PERIPH_PIN(3, 2, 0, 1, &pin_GPIO_AD_B0_13),
+
+ PERIPH_PIN(4, 2, 0, 0, &pin_GPIO_EMC_01),
+ PERIPH_PIN(4, 2, 0, 1, &pin_GPIO_EMC_31),
+
+ PERIPH_PIN(5, 2, 0, 0, &pin_GPIO_EMC_37),
+
+ PERIPH_PIN(6, 2, 0, 0, &pin_GPIO_EMC_15),
+
+ PERIPH_PIN(7, 2, 0, 1, &pin_GPIO_SD_B0_03),
+
+ PERIPH_PIN(8, 2, 0, 0, &pin_GPIO_EMC_25),
+};
+
+const mcu_periph_obj_t mcu_uart_cts_list[10] = {
+ PERIPH_PIN(1, 2, 0, 0, &pin_GPIO_AD_B0_08),
+
+ PERIPH_PIN(2, 2, kIOMUXC_LPUART2_CTS_B_SELECT_INPUT, 0, &pin_GPIO_AD_B1_06),
+ PERIPH_PIN(2, 2, kIOMUXC_LPUART2_CTS_B_SELECT_INPUT, 1, &pin_GPIO_EMC_20),
+
+ PERIPH_PIN(3, 2, 0, 1, &pin_GPIO_AD_B0_12),
+
+ PERIPH_PIN(4, 2, kIOMUXC_LPUART4_CTS_B_SELECT_INPUT, 0, &pin_GPIO_EMC_00),
+ PERIPH_PIN(4, 2, kIOMUXC_LPUART4_CTS_B_SELECT_INPUT, 0, &pin_GPIO_EMC_30),
+
+ PERIPH_PIN(5, 2, 0, 0, &pin_GPIO_EMC_36),
+
+ PERIPH_PIN(6, 2, 0, 0, &pin_GPIO_EMC_14),
+
+ PERIPH_PIN(7, 2, 0, 0, &pin_GPIO_SD_B0_02),
+
+ PERIPH_PIN(8, 2, 0, 0, &pin_GPIO_EMC_24),
};
const mcu_pwm_obj_t mcu_pwm_list[39] = {
diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.h
index 1d720f633..ba88ef4c6 100644
--- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.h
+++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.h
@@ -37,6 +37,8 @@ extern const mcu_periph_obj_t mcu_spi_miso_list[8];
extern const mcu_periph_obj_t mcu_uart_rx_list[16];
extern const mcu_periph_obj_t mcu_uart_tx_list[16];
+extern const mcu_periph_obj_t mcu_uart_rts_list[10];
+extern const mcu_periph_obj_t mcu_uart_cts_list[10];
extern const mcu_pwm_obj_t mcu_pwm_list[39];
diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.c
index 3f0473a88..9a1a4ab65 100644
--- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.c
+++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.c
@@ -127,8 +127,8 @@ const mcu_periph_obj_t mcu_uart_rx_list[18] = {
PERIPH_PIN(6, 2, kIOMUXC_LPUART6_RX_SELECT_INPUT, 0, &pin_GPIO_EMC_26),
PERIPH_PIN(6, 2, kIOMUXC_LPUART6_RX_SELECT_INPUT, 1, &pin_GPIO_AD_B0_03),
- PERIPH_PIN(7, 2, kIOMUXC_LPUART7_RX_SELECT_INPUT, 1, &pin_GPIO_EMC_32),
PERIPH_PIN(7, 2, kIOMUXC_LPUART7_RX_SELECT_INPUT, 0, &pin_GPIO_SD_B1_09),
+ PERIPH_PIN(7, 2, kIOMUXC_LPUART7_RX_SELECT_INPUT, 1, &pin_GPIO_EMC_32),
PERIPH_PIN(8, 2, kIOMUXC_LPUART8_RX_SELECT_INPUT, 0, &pin_GPIO_SD_B0_05),
PERIPH_PIN(8, 2, kIOMUXC_LPUART8_RX_SELECT_INPUT, 1, &pin_GPIO_AD_B1_11),
@@ -163,6 +163,44 @@ const mcu_periph_obj_t mcu_uart_tx_list[18] = {
PERIPH_PIN(8, 2, kIOMUXC_LPUART8_TX_SELECT_INPUT, 2, &pin_GPIO_EMC_38),
};
+const mcu_periph_obj_t mcu_uart_rts_list[9] = {
+ PERIPH_PIN(1, 2, 0, 0, &pin_GPIO_AD_B0_15),
+
+ PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_AD_B1_01),
+
+ PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_AD_B1_05),
+ PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_EMC_16),
+
+ PERIPH_PIN(4, 2, 0, 0, &pin_GPIO_EMC_18),
+
+ PERIPH_PIN(5, 2, 0, 0, &pin_GPIO_EMC_27),
+
+ PERIPH_PIN(6, 2, 0, 0, &pin_GPIO_EMC_29),
+
+ PERIPH_PIN(7, 2, 0, 0, &pin_GPIO_SD_B1_07),
+
+ PERIPH_PIN(8, 2, 0, 0, &pin_GPIO_SD_B0_03),
+};
+
+const mcu_periph_obj_t mcu_uart_cts_list[9] = {
+ PERIPH_PIN(1, 2, 0, 0, &pin_GPIO_AD_B0_14),
+
+ PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_AD_B1_00),
+
+ PERIPH_PIN(3, 2, kIOMUXC_LPUART3_CTS_B_SELECT_INPUT, 0, &pin_GPIO_EMC_15),
+ PERIPH_PIN(3, 2, kIOMUXC_LPUART3_CTS_B_SELECT_INPUT, 1, &pin_GPIO_AD_B1_04),
+
+ PERIPH_PIN(4, 2, 0, 0, &pin_GPIO_EMC_17),
+
+ PERIPH_PIN(5, 2, 0, 0, &pin_GPIO_EMC_28),
+
+ PERIPH_PIN(6, 2, 0, 0, &pin_GPIO_EMC_30),
+
+ PERIPH_PIN(7, 2, 0, 0, &pin_GPIO_SD_B1_06),
+
+ PERIPH_PIN(8, 2, 0, 0, &pin_GPIO_SD_B0_02),
+};
+
const mcu_pwm_obj_t mcu_pwm_list[67] = {
PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmA, 1, &pin_GPIO_EMC_23),
PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmA, 1, &pin_GPIO_SD_B0_00),
diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.h
index b069ca76b..45b92f247 100644
--- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.h
+++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.h
@@ -36,6 +36,8 @@ extern const mcu_periph_obj_t mcu_spi_miso_list[8];
extern const mcu_periph_obj_t mcu_uart_rx_list[18];
extern const mcu_periph_obj_t mcu_uart_tx_list[18];
+extern const mcu_periph_obj_t mcu_uart_rts_list[9];
+extern const mcu_periph_obj_t mcu_uart_cts_list[9];
extern const mcu_pwm_obj_t mcu_pwm_list[67];
diff --git a/ports/mimxrt10xx/supervisor/flexspi_nor_flash_ops.c b/ports/mimxrt10xx/supervisor/flexspi_nor_flash_ops.c
index 71252d677..28d5115ac 100644
--- a/ports/mimxrt10xx/supervisor/flexspi_nor_flash_ops.c
+++ b/ports/mimxrt10xx/supervisor/flexspi_nor_flash_ops.c
@@ -324,7 +324,11 @@ void flexspi_nor_flash_init(FLEXSPI_Type *base)
config.ahbConfig.enableAHBBufferable = true;
config.ahbConfig.enableReadAddressOpt = true;
config.ahbConfig.enableAHBCachable = true;
+#ifdef BOARD_USING_SECONDARY_QSPI_PINMUX
+ config.rxSampleClock = kFLEXSPI_ReadSampleClkLoopbackInternally;
+#else
config.rxSampleClock = kFLEXSPI_ReadSampleClkLoopbackFromDqsPad;
+#endif
FLEXSPI_Init(base, &config);
/* Configure flash settings according to serial flash feature. */
diff --git a/ports/mimxrt10xx/supervisor/port.c b/ports/mimxrt10xx/supervisor/port.c
index b311e8920..7ba7a7701 100644
--- a/ports/mimxrt10xx/supervisor/port.c
+++ b/ports/mimxrt10xx/supervisor/port.c
@@ -154,7 +154,7 @@ __attribute__((used, naked)) void Reset_Handler(void) {
/* Disable MPU */
ARM_MPU_Disable();
- // Copy all of the code to run from ITCM. Do this while the MPU is disabled because we write
+ // Copy all of the itcm code to run from ITCM. Do this while the MPU is disabled because we write
// protect it.
for (uint32_t i = 0; i < ((size_t) &_ld_itcm_size) / 4; i++) {
(&_ld_itcm_destination)[i] = (&_ld_itcm_flash_copy)[i];
diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile
index 47a5b8653..89d88ce36 100755
--- a/ports/nrf/Makefile
+++ b/ports/nrf/Makefile
@@ -102,7 +102,6 @@ CFLAGS += -Wno-undef
CFLAGS += -Wno-cast-align
NRF_DEFINES += -DCONFIG_GPIO_AS_PINRESET
-NRF_DEFINES += -D_FS_DISK_READ_ALIGNED=1
CFLAGS += $(NRF_DEFINES)
CFLAGS += \
diff --git a/ports/stm32f4/boards/pyboard_v11/board.c b/ports/nrf/boards/TG-Watch02A/board.c
index 4421970ee..4421970ee 100644
--- a/ports/stm32f4/boards/pyboard_v11/board.c
+++ b/ports/nrf/boards/TG-Watch02A/board.c
diff --git a/ports/nrf/boards/TG-Watch02A/mpconfigboard.h b/ports/nrf/boards/TG-Watch02A/mpconfigboard.h
new file mode 100644
index 000000000..9b8a31858
--- /dev/null
+++ b/ports/nrf/boards/TG-Watch02A/mpconfigboard.h
@@ -0,0 +1,61 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016 Glenn Ruben Bakke
+ * Copyright (c) 2018 Dan Halbert 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 "nrfx/hal/nrf_gpio.h"
+
+#define MICROPY_HW_BOARD_NAME "TG-Techie's TG-Watch02A"
+#define MICROPY_HW_MCU_NAME "nRF52840"
+
+#define MICROPY_HW_LED_STATUS (&pin_P0_07)
+
+#if QSPI_FLASH_FILESYSTEM
+#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 17)
+#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 22)
+#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 23)
+#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(0, 21)
+#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(0, 19)
+#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 20)
+#endif
+
+#if SPI_FLASH_FILESYSTEM
+#define SPI_FLASH_MOSI_PIN &pin_P0_17
+#define SPI_FLASH_MISO_PIN &pin_P0_22
+#define SPI_FLASH_SCK_PIN &pin_P0_19
+#define SPI_FLASH_CS_PIN &pin_P0_20
+#endif
+
+#define BOARD_HAS_CRYSTAL 0
+
+#define DEFAULT_I2C_BUS_SCL (&pin_P0_11)
+#define DEFAULT_I2C_BUS_SDA (&pin_P0_12)
+
+#define DEFAULT_SPI_BUS_SCK (&pin_P0_14)
+#define DEFAULT_SPI_BUS_MOSI (&pin_P0_13)
+#define DEFAULT_SPI_BUS_MISO (&pin_P0_15)
+
+#define DEFAULT_UART_BUS_RX (&pin_P0_24)
+#define DEFAULT_UART_BUS_TX (&pin_P0_25)
diff --git a/ports/nrf/boards/TG-Watch02A/mpconfigboard.mk b/ports/nrf/boards/TG-Watch02A/mpconfigboard.mk
new file mode 100644
index 000000000..c75c6dd39
--- /dev/null
+++ b/ports/nrf/boards/TG-Watch02A/mpconfigboard.mk
@@ -0,0 +1,11 @@
+USB_VID = 0x239A
+USB_PID = 0x802A
+
+USB_PRODUCT = "TG-Watch02A"
+USB_MANUFACTURER = "TG-Tech"
+
+MCU_CHIP = nrf52840
+
+QSPI_FLASH_FILESYSTEM = 1
+EXTERNAL_FLASH_DEVICE_COUNT = 2
+EXTERNAL_FLASH_DEVICES = "GD25Q16C, W25Q128JV_SQ"
diff --git a/ports/nrf/boards/TG-Watch02A/pins.c b/ports/nrf/boards/TG-Watch02A/pins.c
new file mode 100644
index 000000000..582d954ec
--- /dev/null
+++ b/ports/nrf/boards/TG-Watch02A/pins.c
@@ -0,0 +1,51 @@
+#include "shared-bindings/board/__init__.h"
+
+STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
+
+ /*Port and bus pins*/
+ { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_14) },
+ { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_13) },
+ { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_15) },
+
+ { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_11) },
+ { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_12) },
+
+ { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
+ { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
+ { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
+
+ /*TG-Watch02A specific pins*/
+
+ //tft / display pins
+ { MP_ROM_QSTR(MP_QSTR_BACKLIGHT), MP_ROM_PTR(&pin_P0_07) },
+ { MP_ROM_QSTR(MP_QSTR_DISP_PWR), MP_ROM_PTR(&pin_P0_05) },
+ { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_P1_14) },
+ { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_P1_12) },
+ { MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_P1_01) },
+
+ //cap touch screen
+ { MP_ROM_QSTR(MP_QSTR_CTP_RESET), MP_ROM_PTR(&pin_P1_03) },
+ { MP_ROM_QSTR(MP_QSTR_CTP_INT), MP_ROM_PTR(&pin_P1_05) },
+
+ //power / battery
+ { MP_ROM_QSTR(MP_QSTR_CHRG_STAT), MP_ROM_PTR(&pin_P0_06) },
+ { MP_ROM_QSTR(MP_QSTR_BAT_VDIV), MP_ROM_PTR(&pin_P0_29) },
+ { MP_ROM_QSTR(MP_QSTR_VBUS_PRESENT), MP_ROM_PTR(&pin_P1_04) },
+
+ //sensors / outputs
+ { MP_ROM_QSTR(MP_QSTR_RTC_RESET), MP_ROM_PTR(&pin_P0_26) },
+ { MP_ROM_QSTR(MP_QSTR_RTC_INT), MP_ROM_PTR(&pin_P0_27) },
+
+ { MP_ROM_QSTR(MP_QSTR_ACCEL_INT1), MP_ROM_PTR(&pin_P1_11) },
+ { MP_ROM_QSTR(MP_QSTR_ACCEL_INT2), MP_ROM_PTR(&pin_P1_10) },
+
+ { MP_ROM_QSTR(MP_QSTR_HAPTIC_INT), MP_ROM_PTR(&pin_P1_07) },
+ { MP_ROM_QSTR(MP_QSTR_HAPTIC_ENABLE), MP_ROM_PTR(&pin_P1_06) },
+
+ //smc pins
+ { MP_ROM_QSTR(MP_QSTR_SMC_RESET), MP_ROM_PTR(&pin_P0_08) },
+ { MP_ROM_QSTR(MP_QSTR_BUTTON0), MP_ROM_PTR(&pin_P1_08) },
+ { MP_ROM_QSTR(MP_QSTR_BUTTON1), MP_ROM_PTR(&pin_P1_09) },
+};
+
+MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
diff --git a/ports/nrf/boards/clue_nrf52840_express/board.c b/ports/nrf/boards/clue_nrf52840_express/board.c
index 5f5337a3d..2370a0aa1 100644
--- a/ports/nrf/boards/clue_nrf52840_express/board.c
+++ b/ports/nrf/boards/clue_nrf52840_express/board.c
@@ -49,7 +49,7 @@ uint8_t display_init_sequence[] = {
void board_init(void) {
busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus;
- common_hal_busio_spi_construct(spi, &pin_P0_14, &pin_P0_15, mp_const_none);
+ common_hal_busio_spi_construct(spi, &pin_P0_14, &pin_P0_15, NULL);
common_hal_busio_spi_never_reset(spi);
displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus;
@@ -59,7 +59,9 @@ void board_init(void) {
&pin_P0_13, // TFT_DC Command or data
&pin_P0_12, // TFT_CS Chip select
&pin_P1_03, // TFT_RST Reset
- 60000000);
+ 60000000, // Baudrate
+ 0, // Polarity
+ 0); // Phase
displayio_display_obj_t* display = &displays[0].display;
display->base.type = &displayio_display_type;
@@ -75,6 +77,7 @@ void board_init(void) {
false, // Pixels in a byte share a row. Only used for depth < 8
1, // bytes per cell. Only valid for depths < 8
false, // reverse_pixels_in_byte. Only valid for depths < 8
+ true, // reverse_pixels_in_word
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command
MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command
@@ -88,7 +91,8 @@ void board_init(void) {
false, // single_byte_bounds
false, // data_as_commands
true, // auto_refresh
- 60); // native_frames_per_second
+ 60, // native_frames_per_second
+ true); // backlight_on_high
}
bool board_requests_safe_mode(void) {
diff --git a/ports/nrf/boards/common.template.ld b/ports/nrf/boards/common.template.ld
index 607a1dc93..2fca16707 100644
--- a/ports/nrf/boards/common.template.ld
+++ b/ports/nrf/boards/common.template.ld
@@ -22,7 +22,9 @@ MEMORY
/* SoftDevice 6.1.0 with 5 connections and various increases takes just under 64kiB.
/* To measure the minimum required amount of memory for given configuration, set this number
high enough to work and then check the mutation of the value done by sd_ble_enable. */
- RAM (xrw) : ORIGIN = 0x20000000 + 64K, LENGTH = 256K - 64K
+ SPIM3_RAM (rw) : ORIGIN = 0x20000000 + ${SOFTDEVICE_RAM_SIZE}, LENGTH = ${SPIM3_BUFFER_SIZE}
+ RAM (xrw) : ORIGIN = 0x20000000 + ${SOFTDEVICE_RAM_SIZE} + ${SPIM3_BUFFER_SIZE}, LENGTH = 256K - ${SOFTDEVICE_RAM_SIZE} -${SPIM3_BUFFER_SIZE}
+
}
/* produce a link error if there is not this amount of RAM available */
@@ -37,6 +39,10 @@ _estack = ORIGIN(RAM) + LENGTH(RAM);
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
_heap_end = 0x20020000; /* tunable */
+/* nrf52840 SPIM3 needs its own area to work around hardware problems. Nothing else may use this space. */
+_spim3_ram = ORIGIN(SPIM3_RAM);
+_spim3_ram_end = ORIGIN(SPIM3_RAM) + LENGTH(RAM);
+
/* define output sections */
SECTIONS
{
diff --git a/ports/nrf/boards/feather_bluefruit_sense/mpconfigboard.h b/ports/nrf/boards/feather_bluefruit_sense/mpconfigboard.h
index 4b2b69e7e..65d8a642e 100644
--- a/ports/nrf/boards/feather_bluefruit_sense/mpconfigboard.h
+++ b/ports/nrf/boards/feather_bluefruit_sense/mpconfigboard.h
@@ -32,7 +32,7 @@
#define MICROPY_HW_NEOPIXEL (&pin_P0_16)
-#define MICROPY_HW_LED_STATUS (&pin_P1_11)
+#define MICROPY_HW_LED_STATUS (&pin_P1_09)
// Board does not have a 32kHz crystal. It does have a 32MHz crystal.
#define BOARD_HAS_32KHZ_XTAL (0)
diff --git a/ports/nrf/boards/feather_bluefruit_sense/pins.c b/ports/nrf/boards/feather_bluefruit_sense/pins.c
index 55eb76463..c4863e17f 100644
--- a/ports/nrf/boards/feather_bluefruit_sense/pins.c
+++ b/ports/nrf/boards/feather_bluefruit_sense/pins.c
@@ -19,6 +19,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_NFC2), MP_ROM_PTR(&pin_P0_10) },
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_P0_10) },
+ { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_P1_11) },
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_P1_08) },
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_P0_07) },
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_P0_26) },
@@ -39,9 +40,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_11) },
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_12) },
- { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_P1_11) },
- { MP_ROM_QSTR(MP_QSTR_RED_LED), MP_ROM_PTR(&pin_P1_11) },
- { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_P1_11) },
+ { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_P1_09) },
+ { MP_ROM_QSTR(MP_QSTR_RED_LED), MP_ROM_PTR(&pin_P1_09) },
{ MP_ROM_QSTR(MP_QSTR_BLUE_LED), MP_ROM_PTR(&pin_P1_10) },
@@ -50,6 +50,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_PROXIMITY_LIGHT_INTERRUPT), MP_ROM_PTR(&pin_P1_00) },
+ { MP_ROM_QSTR(MP_QSTR_ACCELEROMETER_GYRO_INTERRUPT), MP_ROM_PTR(&pin_P1_11) },
+
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
diff --git a/ports/nrf/boards/metro_nrf52840_express/mpconfigboard.mk b/ports/nrf/boards/metro_nrf52840_express/mpconfigboard.mk
index d421e5210..b972bcbed 100644
--- a/ports/nrf/boards/metro_nrf52840_express/mpconfigboard.mk
+++ b/ports/nrf/boards/metro_nrf52840_express/mpconfigboard.mk
@@ -8,3 +8,5 @@ MCU_CHIP = nrf52840
QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = "GD25Q16C"
+
+CIRCUITPY__EVE = 1
diff --git a/ports/nrf/boards/ohs2020_badge/board.c b/ports/nrf/boards/ohs2020_badge/board.c
index 7e3e05814..bbb20cc6e 100644
--- a/ports/nrf/boards/ohs2020_badge/board.c
+++ b/ports/nrf/boards/ohs2020_badge/board.c
@@ -49,7 +49,7 @@ uint8_t display_init_sequence[] = {
void board_init(void) {
busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus;
- common_hal_busio_spi_construct(spi, &pin_P0_11, &pin_P0_12, mp_const_none);
+ common_hal_busio_spi_construct(spi, &pin_P0_11, &pin_P0_12, NULL);
common_hal_busio_spi_never_reset(spi);
displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus;
@@ -59,7 +59,9 @@ void board_init(void) {
&pin_P0_08, // TFT_DC Command or data
&pin_P0_14, // TFT_CS Chip select
&pin_P0_13, // TFT_RST Reset
- 60000000);
+ 60000000, // Baudrate
+ 0, // Polarity
+ 0); // Phase
displayio_display_obj_t* display = &displays[0].display;
display->base.type = &displayio_display_type;
@@ -75,20 +77,22 @@ void board_init(void) {
false, // Pixels in a byte share a row. Only used for depth < 8
1, // bytes per cell. Only valid for depths < 8
false, // reverse_pixels_in_byte. Only valid for depths < 8
+ true, // reverse_pixels_in_word
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command
MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command
0x37, // set vertical scroll command
display_init_sequence,
sizeof(display_init_sequence),
- NULL, // backlight pin
+ &pin_P0_02, // backlight pin
NO_BRIGHTNESS_COMMAND,
1.0f, // brightness (ignored)
true, // auto_brightness
false, // single_byte_bounds
false, // data_as_commands
true, // auto_refresh
- 60); // native_frames_per_second
+ 60, // native_frames_per_second
+ false); // backlight_on_high
}
bool board_requests_safe_mode(void) {
diff --git a/ports/nrf/boards/ohs2020_badge/pins.c b/ports/nrf/boards/ohs2020_badge/pins.c
index e984e3070..2cf783cc1 100644
--- a/ports/nrf/boards/ohs2020_badge/pins.c
+++ b/ports/nrf/boards/ohs2020_badge/pins.c
@@ -19,6 +19,11 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display) },
+
+ { MP_ROM_QSTR(MP_QSTR_BUTTON_SW1), MP_ROM_PTR(&pin_P0_29) },
+ { MP_ROM_QSTR(MP_QSTR_BUTTON_SW2), MP_ROM_PTR(&pin_P0_03) },
+ { MP_ROM_QSTR(MP_QSTR_BUTTON_SW3), MP_ROM_PTR(&pin_P0_17) },
+ { MP_ROM_QSTR(MP_QSTR_BUTTON_SW4), MP_ROM_PTR(&pin_P1_03) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
diff --git a/ports/nrf/boards/pca10056/mpconfigboard.h b/ports/nrf/boards/pca10056/mpconfigboard.h
index 5d0d4d3a5..4856a9570 100644
--- a/ports/nrf/boards/pca10056/mpconfigboard.h
+++ b/ports/nrf/boards/pca10056/mpconfigboard.h
@@ -5,6 +5,7 @@
*
* Copyright (c) 2016 Glenn Ruben Bakke
*
+ *
* 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
diff --git a/ports/nrf/common-hal/_bleio/Adapter.c b/ports/nrf/common-hal/_bleio/Adapter.c
index 09b7c95b9..53015364a 100644
--- a/ports/nrf/common-hal/_bleio/Adapter.c
+++ b/ports/nrf/common-hal/_bleio/Adapter.c
@@ -723,7 +723,10 @@ void bleio_adapter_gc_collect(bleio_adapter_obj_t* adapter) {
void bleio_adapter_reset(bleio_adapter_obj_t* adapter) {
common_hal_bleio_adapter_stop_scan(adapter);
- common_hal_bleio_adapter_stop_advertising(adapter);
+ if (adapter->current_advertising_data != NULL) {
+ common_hal_bleio_adapter_stop_advertising(adapter);
+ }
+
adapter->connection_objs = NULL;
for (size_t i = 0; i < BLEIO_TOTAL_CONNECTION_COUNT; i++) {
bleio_connection_internal_t *connection = &bleio_connections[i];
diff --git a/ports/nrf/common-hal/_bleio/Connection.c b/ports/nrf/common-hal/_bleio/Connection.c
index 96e8b8fbe..d4c7308fd 100644
--- a/ports/nrf/common-hal/_bleio/Connection.c
+++ b/ports/nrf/common-hal/_bleio/Connection.c
@@ -162,7 +162,8 @@ bool connection_on_ble_evt(ble_evt_t *ble_evt, void *self_in) {
self->do_bond_cccds = true;
self->do_bond_cccds_request_time = supervisor_ticks_ms64();
}
- break;
+ // Return false so other handlers get this event as well.
+ return false;
case BLE_GATTS_EVT_SYS_ATTR_MISSING:
sd_ble_gatts_sys_attr_set(self->conn_handle, NULL, 0, 0);
diff --git a/ports/nrf/common-hal/_bleio/PacketBuffer.c b/ports/nrf/common-hal/_bleio/PacketBuffer.c
index 27dacb493..6ed6d1451 100644
--- a/ports/nrf/common-hal/_bleio/PacketBuffer.c
+++ b/ports/nrf/common-hal/_bleio/PacketBuffer.c
@@ -148,6 +148,7 @@ STATIC bool packet_buffer_on_ble_server_evt(ble_evt_t *ble_evt, void *param) {
// A client wrote to this server characteristic.
ble_gatts_evt_write_t *evt_write = &ble_evt->evt.gatts_evt.params.write;
+
// Event handle must match the handle for my characteristic.
if (evt_write->handle == self->characteristic->handle) {
if (self->conn_handle == BLE_CONN_HANDLE_INVALID) {
@@ -156,8 +157,7 @@ STATIC bool packet_buffer_on_ble_server_evt(ble_evt_t *ble_evt, void *param) {
return false;
}
write_to_ringbuf(self, evt_write->data, evt_write->len);
- } else if (evt_write->handle == self->characteristic->cccd_handle &&
- self->conn_handle == BLE_CONN_HANDLE_INVALID) {
+ } else if (evt_write->handle == self->characteristic->cccd_handle) {
uint16_t cccd = *((uint16_t*) evt_write->data);
if (cccd & BLE_GATT_HVX_NOTIFICATION) {
self->conn_handle = conn_handle;
@@ -167,6 +167,11 @@ STATIC bool packet_buffer_on_ble_server_evt(ble_evt_t *ble_evt, void *param) {
}
break;
}
+ case BLE_GAP_EVT_DISCONNECTED: {
+ if (self->conn_handle == conn_handle) {
+ self->conn_handle = BLE_CONN_HANDLE_INVALID;
+ }
+ }
case BLE_GATTS_EVT_HVN_TX_COMPLETE: {
queue_next_write(self);
}
@@ -192,6 +197,8 @@ void common_hal_bleio_packet_buffer_construct(
incoming = outgoing;
outgoing = temp;
self->conn_handle = bleio_connection_get_conn_handle(MP_OBJ_TO_PTR(self->characteristic->service->connection));
+ } else {
+ self->conn_handle = BLE_CONN_HANDLE_INVALID;
}
if (incoming) {
@@ -255,8 +262,7 @@ int common_hal_bleio_packet_buffer_readinto(bleio_packet_buffer_obj_t *self, uin
sd_nvic_critical_region_enter(&is_nested_critical_region);
if (packet_length > len) {
- // TODO: raise an exception.
- packet_length = len;
+ return len - packet_length;
}
ringbuf_get_n(&self->ringbuf, data, packet_length);
diff --git a/ports/nrf/common-hal/_bleio/__init__.c b/ports/nrf/common-hal/_bleio/__init__.c
index 58e28c8c1..62a3a9299 100644
--- a/ports/nrf/common-hal/_bleio/__init__.c
+++ b/ports/nrf/common-hal/_bleio/__init__.c
@@ -89,14 +89,15 @@ void check_sec_status(uint8_t sec_status) {
// Turn off BLE on a reset or reload.
void bleio_reset() {
+ if (!common_hal_bleio_adapter_get_enabled(&common_hal_bleio_adapter_obj)) {
+ return;
+ }
bleio_adapter_reset(&common_hal_bleio_adapter_obj);
if (!vm_used_ble) {
// No user-code BLE operations were done, so we can maintain the supervisor state.
return;
}
- if (common_hal_bleio_adapter_get_enabled(&common_hal_bleio_adapter_obj)) {
- common_hal_bleio_adapter_set_enabled(&common_hal_bleio_adapter_obj, false);
- }
+ common_hal_bleio_adapter_set_enabled(&common_hal_bleio_adapter_obj, false);
bonding_reset();
supervisor_start_bluetooth();
}
diff --git a/ports/nrf/common-hal/_protomatter/Protomatter.c b/ports/nrf/common-hal/_protomatter/Protomatter.c
new file mode 100644
index 000000000..b6e55bbd4
--- /dev/null
+++ b/ports/nrf/common-hal/_protomatter/Protomatter.c
@@ -0,0 +1,66 @@
+/*
+ * This file is part of the Micro Python project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Jeff Epler 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 <stddef.h>
+
+#include "common-hal/_protomatter/Protomatter.h"
+
+#include "peripherals/nrf/timers.h"
+
+extern void _PM_IRQ_HANDLER(void);
+
+void *common_hal_protomatter_timer_allocate() {
+ nrfx_timer_t *timer = nrf_peripherals_allocate_timer_or_throw();
+ nrf_peripherals_timer_never_reset(timer);
+ return timer->p_reg;
+}
+
+
+static void protomatter_event_handler(nrf_timer_event_t event_type, void *p_context) {
+ _PM_IRQ_HANDLER();
+}
+
+void common_hal_protomatter_timer_enable(void* ptr) {
+ nrfx_timer_t *timer = nrf_peripherals_timer_from_reg(ptr);
+ static const nrfx_timer_config_t timer_config = {
+ .frequency = NRF_TIMER_FREQ_16MHz,
+ .mode = NRF_TIMER_MODE_TIMER,
+ .bit_width = NRF_TIMER_BIT_WIDTH_16,
+ .interrupt_priority = NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY,
+ .p_context = NULL,
+ };
+ nrfx_timer_init(timer, &timer_config, &protomatter_event_handler);
+}
+
+void common_hal_protomatter_timer_disable(void* ptr) {
+ nrfx_timer_t *timer = nrf_peripherals_timer_from_reg(ptr);
+ nrfx_timer_uninit(timer);
+}
+
+void common_hal_protomatter_timer_free(void* ptr) {
+ nrfx_timer_t *timer = nrf_peripherals_timer_from_reg(ptr);
+ nrf_peripherals_free_timer(timer);
+}
diff --git a/ports/nrf/common-hal/_protomatter/Protomatter.h b/ports/nrf/common-hal/_protomatter/Protomatter.h
new file mode 100644
index 000000000..8185bed0e
--- /dev/null
+++ b/ports/nrf/common-hal/_protomatter/Protomatter.h
@@ -0,0 +1,35 @@
+/*
+ * This file is part of the Micro Python project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Jeff Epler 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.
+ */
+
+#ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PROTOMATTER_PROTOMATTER_H
+#define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PROTOMATTER_PROTOMATTER_H
+
+void *common_hal_protomatter_timer_allocate(void);
+void common_hal_protomatter_timer_enable(void*);
+void common_hal_protomatter_timer_disable(void*);
+void common_hal_protomatter_timer_free(void*);
+
+#endif
diff --git a/ports/nrf/common-hal/_protomatter/__init__.c b/ports/nrf/common-hal/_protomatter/__init__.c
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ports/nrf/common-hal/_protomatter/__init__.c
diff --git a/ports/nrf/common-hal/analogio/AnalogIn.c b/ports/nrf/common-hal/analogio/AnalogIn.c
index 3bc097019..dbcc5281c 100644
--- a/ports/nrf/common-hal/analogio/AnalogIn.c
+++ b/ports/nrf/common-hal/analogio/AnalogIn.c
@@ -55,7 +55,7 @@ void common_hal_analogio_analogin_construct(analogio_analogin_obj_t *self, const
}
bool common_hal_analogio_analogin_deinited(analogio_analogin_obj_t *self) {
- return self->pin == mp_const_none;
+ return self->pin == NULL;
}
void common_hal_analogio_analogin_deinit(analogio_analogin_obj_t *self) {
@@ -65,7 +65,7 @@ void common_hal_analogio_analogin_deinit(analogio_analogin_obj_t *self) {
nrf_gpio_cfg_default(self->pin->number);
reset_pin_number(self->pin->number);
- self->pin = mp_const_none;
+ self->pin = NULL;
}
uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) {
diff --git a/ports/nrf/common-hal/audiobusio/PDMIn.c b/ports/nrf/common-hal/audiobusio/PDMIn.c
index a7f9c9d74..ddd34174b 100644
--- a/ports/nrf/common-hal/audiobusio/PDMIn.c
+++ b/ports/nrf/common-hal/audiobusio/PDMIn.c
@@ -34,6 +34,7 @@ NRF_PDM_Type *nrf_pdm = NRF_PDM;
static uint32_t dummy_buffer[4];
+// Caller validates that pins are free.
void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self,
const mcu_pin_obj_t* clock_pin,
const mcu_pin_obj_t* data_pin,
@@ -41,8 +42,6 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self,
uint8_t bit_depth,
bool mono,
uint8_t oversample) {
- assert_pin_free(clock_pin);
- assert_pin_free(data_pin);
claim_pin(clock_pin);
claim_pin(data_pin);
diff --git a/ports/nrf/common-hal/audiopwmio/PWMAudioOut.c b/ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
index cdb57bbe1..7b99901d5 100644
--- a/ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
+++ b/ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
@@ -155,10 +155,9 @@ void audiopwmout_background() {
}
}
+// Caller validates that pins are free.
void common_hal_audiopwmio_pwmaudioout_construct(audiopwmio_pwmaudioout_obj_t* self,
const mcu_pin_obj_t* left_channel, const mcu_pin_obj_t* right_channel, uint16_t quiescent_value) {
- assert_pin_free(left_channel);
- assert_pin_free(right_channel);
self->pwm = pwmout_allocate(256, PWM_PRESCALER_PRESCALER_DIV_1, true, NULL, NULL);
if (!self->pwm) {
mp_raise_RuntimeError(translate("All timers in use"));
diff --git a/ports/nrf/common-hal/busio/SPI.c b/ports/nrf/common-hal/busio/SPI.c
index 8e1d73bf0..3f205e778 100644
--- a/ports/nrf/common-hal/busio/SPI.c
+++ b/ports/nrf/common-hal/busio/SPI.c
@@ -1,27 +1,32 @@
/*
- * SPI Master library for nRF5x.
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
*
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
* Copyright (c) 2018 Artur Pacholec
- * Copyright (c) 2017 hathach
- * Copyright (c) 2016 Sandeep Mistry All right reserved.
- * Copyright (c) 2015 Arduino LLC
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * 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:
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * 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 <string.h>
+
#include "shared-bindings/busio/SPI.h"
#include "py/mperrno.h"
#include "py/runtime.h"
@@ -29,40 +34,46 @@
#include "nrfx_spim.h"
#include "nrf_gpio.h"
+// These are in order from highest available frequency to lowest (32MHz first, then 8MHz).
STATIC spim_peripheral_t spim_peripherals[] = {
#if NRFX_CHECK(NRFX_SPIM3_ENABLED)
// SPIM3 exists only on nRF52840 and supports 32MHz max. All other SPIM's are only 8MHz max.
// Allocate SPIM3 first.
{ .spim = NRFX_SPIM_INSTANCE(3),
- .max_frequency_MHz = 32,
- .max_xfer_size = SPIM3_EASYDMA_MAXCNT_SIZE,
+ .max_frequency = 32000000,
+ .max_xfer_size = MIN(SPIM3_BUFFER_SIZE, (1UL << SPIM3_EASYDMA_MAXCNT_SIZE) - 1)
},
#endif
#if NRFX_CHECK(NRFX_SPIM2_ENABLED)
// SPIM2 is not shared with a TWIM, so allocate before the shared ones.
{ .spim = NRFX_SPIM_INSTANCE(2),
- .max_frequency_MHz = 8,
- .max_xfer_size = SPIM2_EASYDMA_MAXCNT_SIZE,
+ .max_frequency = 8000000,
+ .max_xfer_size = (1UL << SPIM2_EASYDMA_MAXCNT_SIZE) - 1
},
#endif
#if NRFX_CHECK(NRFX_SPIM1_ENABLED)
// SPIM1 and TWIM1 share an address.
{ .spim = NRFX_SPIM_INSTANCE(1),
- .max_frequency_MHz = 8,
- .max_xfer_size = SPIM1_EASYDMA_MAXCNT_SIZE,
+ .max_frequency = 8000000,
+ .max_xfer_size = (1UL << SPIM1_EASYDMA_MAXCNT_SIZE) - 1
},
#endif
#if NRFX_CHECK(NRFX_SPIM0_ENABLED)
// SPIM0 and TWIM0 share an address.
{ .spim = NRFX_SPIM_INSTANCE(0),
- .max_frequency_MHz = 8,
- .max_xfer_size = SPIM0_EASYDMA_MAXCNT_SIZE,
+ .max_frequency = 8000000,
+ .max_xfer_size = (1UL << SPIM0_EASYDMA_MAXCNT_SIZE) - 1
},
#endif
};
STATIC bool never_reset[MP_ARRAY_SIZE(spim_peripherals)];
+// Separate RAM area for SPIM3 transmit buffer to avoid SPIM3 hardware errata.
+// https://infocenter.nordicsemi.com/index.jsp?topic=%2Ferrata_nRF52840_Rev2%2FERR%2FnRF52840%2FRev2%2Flatest%2Fanomaly_840_198.html
+extern uint32_t _spim3_ram;
+STATIC uint8_t *spim3_transmit_buffer = (uint8_t *) &_spim3_ram;
+
void spi_reset(void) {
for (size_t i = 0 ; i < MP_ARRAY_SIZE(spim_peripherals); i++) {
if (never_reset[i]) {
@@ -122,7 +133,7 @@ static nrf_spim_frequency_t baudrate_to_spim_frequency(const uint32_t baudrate)
}
void common_hal_busio_spi_construct(busio_spi_obj_t *self, const mcu_pin_obj_t * clock, const mcu_pin_obj_t * mosi, const mcu_pin_obj_t * miso) {
- // Find a free instance.
+ // Find a free instance, with most desirable (highest freq and not shared) allocated first.
self->spim_peripheral = NULL;
for (size_t i = 0 ; i < MP_ARRAY_SIZE(spim_peripherals); i++) {
if ((spim_peripherals[i].spim.p_reg->ENABLE & SPIM_ENABLE_ENABLE_Msk) == 0) {
@@ -137,13 +148,14 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, const mcu_pin_obj_t *
nrfx_spim_config_t config = NRFX_SPIM_DEFAULT_CONFIG(NRFX_SPIM_PIN_NOT_USED, NRFX_SPIM_PIN_NOT_USED,
NRFX_SPIM_PIN_NOT_USED, NRFX_SPIM_PIN_NOT_USED);
- config.frequency = NRF_SPIM_FREQ_8M;
+
+ config.frequency = baudrate_to_spim_frequency(self->spim_peripheral->max_frequency);
config.sck_pin = clock->number;
self->clock_pin_number = clock->number;
claim_pin(clock);
- if (mosi != mp_const_none) {
+ if (mosi != NULL) {
config.mosi_pin = mosi->number;
self->MOSI_pin_number = mosi->number;
claim_pin(mosi);
@@ -151,7 +163,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, const mcu_pin_obj_t *
self->MOSI_pin_number = NO_PIN;
}
- if (miso != mp_const_none) {
+ if (miso != NULL) {
config.miso_pin = miso->number;
self->MISO_pin_number = mosi->number;
claim_pin(miso);
@@ -189,8 +201,7 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self, uint32_t baudrate, ui
// Set desired frequency, rounding down, and don't go above available frequency for this SPIM.
nrf_spim_frequency_set(self->spim_peripheral->spim.p_reg,
- baudrate_to_spim_frequency(MIN(baudrate,
- self->spim_peripheral->max_frequency_MHz * 1000000)));
+ baudrate_to_spim_frequency(MIN(baudrate, self->spim_peripheral->max_frequency)));
nrf_spim_mode_t mode = NRF_SPIM_MODE_0;
if (polarity) {
@@ -224,74 +235,66 @@ void common_hal_busio_spi_unlock(busio_spi_obj_t *self) {
}
bool common_hal_busio_spi_write(busio_spi_obj_t *self, const uint8_t *data, size_t len) {
- if (len == 0)
- return true;
-
- const uint32_t max_xfer_size = self->spim_peripheral->max_xfer_size;
- const uint32_t parts = len / max_xfer_size;
- const uint32_t remainder = len % max_xfer_size;
-
- for (uint32_t i = 0; i < parts; ++i) {
- const nrfx_spim_xfer_desc_t xfer = NRFX_SPIM_XFER_TX(data + i * max_xfer_size, max_xfer_size);
- if (nrfx_spim_xfer(&self->spim_peripheral->spim, &xfer, 0) != NRFX_SUCCESS)
- return false;
- }
-
- if (remainder > 0) {
- const nrfx_spim_xfer_desc_t xfer = NRFX_SPIM_XFER_TX(data + parts * max_xfer_size, remainder);
- if (nrfx_spim_xfer(&self->spim_peripheral->spim, &xfer, 0) != NRFX_SUCCESS)
+ const bool is_spim3 = self->spim_peripheral->spim.p_reg == NRF_SPIM3;
+ uint8_t *next_chunk = (uint8_t *) data;
+
+ while (len > 0) {
+ size_t chunk_size = MIN(len, self->spim_peripheral->max_xfer_size);
+ uint8_t *chunk = next_chunk;
+ if (is_spim3) {
+ // If SPIM3, copy into unused RAM block, and do DMA from there.
+ memcpy(spim3_transmit_buffer, chunk, chunk_size);
+ chunk = spim3_transmit_buffer;
+ }
+ const nrfx_spim_xfer_desc_t xfer = NRFX_SPIM_XFER_TX(chunk, chunk_size);
+ if (nrfx_spim_xfer(&self->spim_peripheral->spim, &xfer, 0) != NRFX_SUCCESS) {
return false;
+ }
+ next_chunk += chunk_size;
+ len -= chunk_size;
}
-
return true;
}
bool common_hal_busio_spi_read(busio_spi_obj_t *self, uint8_t *data, size_t len, uint8_t write_value) {
- if (len == 0)
- return true;
-
- const uint32_t max_xfer_size = self->spim_peripheral->max_xfer_size;
- const uint32_t parts = len / max_xfer_size;
- const uint32_t remainder = len % max_xfer_size;
-
- for (uint32_t i = 0; i < parts; ++i) {
- const nrfx_spim_xfer_desc_t xfer = NRFX_SPIM_XFER_RX(data + i * max_xfer_size, max_xfer_size);
- if (nrfx_spim_xfer(&self->spim_peripheral->spim, &xfer, 0) != NRFX_SUCCESS)
- return false;
- }
+ uint8_t *next_chunk = data;
- if (remainder > 0) {
- const nrfx_spim_xfer_desc_t xfer = NRFX_SPIM_XFER_RX(data + parts * max_xfer_size, remainder);
- if (nrfx_spim_xfer(&self->spim_peripheral->spim, &xfer, 0) != NRFX_SUCCESS)
+ while (len > 0) {
+ size_t chunk_size = MIN(len, self->spim_peripheral->max_xfer_size);
+ const nrfx_spim_xfer_desc_t xfer = NRFX_SPIM_XFER_RX(next_chunk, chunk_size);
+ if (nrfx_spim_xfer(&self->spim_peripheral->spim, &xfer, 0) != NRFX_SUCCESS) {
return false;
+ }
+ next_chunk += chunk_size;
+ len -= chunk_size;
}
-
return true;
}
bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, uint8_t *data_out, uint8_t *data_in, size_t len) {
- if (len == 0)
- return true;
-
-
- const uint32_t max_xfer_size = self->spim_peripheral->max_xfer_size;
- const uint32_t parts = len / max_xfer_size;
- const uint32_t remainder = len % max_xfer_size;
-
- for (uint32_t i = 0; i < parts; ++i) {
- const nrfx_spim_xfer_desc_t xfer = NRFX_SPIM_SINGLE_XFER(data_out + i * max_xfer_size, max_xfer_size,
- data_in + i * max_xfer_size, max_xfer_size);
- if (nrfx_spim_xfer(&self->spim_peripheral->spim, &xfer, 0) != NRFX_SUCCESS)
+ const bool is_spim3 = self->spim_peripheral->spim.p_reg == NRF_SPIM3;
+ uint8_t *next_chunk_out = data_out;
+ uint8_t *next_chunk_in = data_in;
+
+ while (len > 0) {
+ uint8_t *chunk_out = next_chunk_out;
+ size_t chunk_size = MIN(len, self->spim_peripheral->max_xfer_size);
+ if (is_spim3) {
+ // If SPIM3, copy into unused RAM block, and do DMA from there.
+ memcpy(spim3_transmit_buffer, chunk_out, chunk_size);
+ chunk_out = spim3_transmit_buffer;
+ }
+ const nrfx_spim_xfer_desc_t xfer =
+ NRFX_SPIM_SINGLE_XFER(next_chunk_out, chunk_size,
+ next_chunk_in, chunk_size);
+ if (nrfx_spim_xfer(&self->spim_peripheral->spim, &xfer, 0) != NRFX_SUCCESS) {
return false;
- }
+ }
- if (remainder > 0) {
- const nrfx_spim_xfer_desc_t xfer = NRFX_SPIM_SINGLE_XFER(data_out + parts * max_xfer_size, remainder,
- data_in + parts * max_xfer_size, remainder);
- if (nrfx_spim_xfer(&self->spim_peripheral->spim, &xfer, 0) != NRFX_SUCCESS)
- return false;
+ next_chunk_out += chunk_size;
+ next_chunk_in += chunk_size;
+ len -= chunk_size;
}
-
return true;
}
@@ -325,9 +328,9 @@ uint32_t common_hal_busio_spi_get_frequency(busio_spi_obj_t* self) {
}
uint8_t common_hal_busio_spi_get_phase(busio_spi_obj_t* self) {
- return 0;
+ return (self->spim_peripheral->spim.p_reg->CONFIG & SPIM_CONFIG_CPHA_Msk) >> SPIM_CONFIG_CPHA_Pos;
}
uint8_t common_hal_busio_spi_get_polarity(busio_spi_obj_t* self) {
- return 0;
+ return (self->spim_peripheral->spim.p_reg->CONFIG & SPIM_CONFIG_CPOL_Msk) >> SPIM_CONFIG_CPOL_Pos;
}
diff --git a/ports/nrf/common-hal/busio/SPI.h b/ports/nrf/common-hal/busio/SPI.h
index 1b0de8acf..ef3ac9531 100644
--- a/ports/nrf/common-hal/busio/SPI.h
+++ b/ports/nrf/common-hal/busio/SPI.h
@@ -32,8 +32,8 @@
typedef struct {
nrfx_spim_t spim;
- uint8_t max_frequency_MHz;
- uint8_t max_xfer_size;
+ uint32_t max_frequency;
+ uint32_t max_xfer_size;
} spim_peripheral_t;
typedef struct {
diff --git a/ports/nrf/common-hal/busio/UART.c b/ports/nrf/common-hal/busio/UART.c
index d79b65ff8..4a3e74c49 100644
--- a/ports/nrf/common-hal/busio/UART.c
+++ b/ports/nrf/common-hal/busio/UART.c
@@ -70,7 +70,9 @@ static uint32_t get_nrf_baud (uint32_t baudrate) {
{ 14400, NRF_UARTE_BAUDRATE_14400 },
{ 19200, NRF_UARTE_BAUDRATE_19200 },
{ 28800, NRF_UARTE_BAUDRATE_28800 },
+ { 31250, NRF_UARTE_BAUDRATE_31250 },
{ 38400, NRF_UARTE_BAUDRATE_38400 },
+ { 56000, NRF_UARTE_BAUDRATE_56000 },
{ 57600, NRF_UARTE_BAUDRATE_57600 },
{ 76800, NRF_UARTE_BAUDRATE_76800 },
{ 115200, NRF_UARTE_BAUDRATE_115200 },
@@ -128,10 +130,17 @@ void uart_reset(void) {
}
}
-void common_hal_busio_uart_construct (busio_uart_obj_t *self,
- const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx, uint32_t baudrate,
- uint8_t bits, uart_parity_t parity, uint8_t stop, mp_float_t timeout,
- uint16_t receiver_buffer_size) {
+void common_hal_busio_uart_construct(busio_uart_obj_t *self,
+ const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx,
+ const mcu_pin_obj_t * rts, const mcu_pin_obj_t * cts,
+ const mcu_pin_obj_t * rs485_dir, bool rs485_invert,
+ uint32_t baudrate, uint8_t bits, uart_parity_t parity, uint8_t stop,
+ mp_float_t timeout, uint16_t receiver_buffer_size) {
+
+ if ((rts != NULL) || (cts != NULL) || (rs485_dir != NULL) || (rs485_invert)) {
+ mp_raise_ValueError(translate("RTS/CTS/RS485 Not yet supported on this device"));
+ }
+
// Find a free UART peripheral.
self->uarte = NULL;
for (size_t i = 0 ; i < MP_ARRAY_SIZE(nrfx_uartes); i++) {
@@ -145,7 +154,7 @@ void common_hal_busio_uart_construct (busio_uart_obj_t *self,
mp_raise_ValueError(translate("All UART peripherals are in use"));
}
- if ( (tx == mp_const_none) && (rx == mp_const_none) ) {
+ if ( (tx == NULL) && (rx == NULL) ) {
mp_raise_ValueError(translate("tx and rx cannot both be None"));
}
@@ -158,8 +167,8 @@ void common_hal_busio_uart_construct (busio_uart_obj_t *self,
}
nrfx_uarte_config_t config = {
- .pseltxd = (tx == mp_const_none) ? NRF_UARTE_PSEL_DISCONNECTED : tx->number,
- .pselrxd = (rx == mp_const_none) ? NRF_UARTE_PSEL_DISCONNECTED : rx->number,
+ .pseltxd = (tx == NULL) ? NRF_UARTE_PSEL_DISCONNECTED : tx->number,
+ .pselrxd = (rx == NULL) ? NRF_UARTE_PSEL_DISCONNECTED : rx->number,
.pselcts = NRF_UARTE_PSEL_DISCONNECTED,
.pselrts = NRF_UARTE_PSEL_DISCONNECTED,
.p_context = self,
@@ -174,7 +183,7 @@ void common_hal_busio_uart_construct (busio_uart_obj_t *self,
_VERIFY_ERR(nrfx_uarte_init(self->uarte, &config, uart_callback_irq));
// Init buffer for rx
- if ( rx != mp_const_none ) {
+ if ( rx != NULL ) {
// Initially allocate the UART's buffer in the long-lived part of the
// heap. UARTs are generally long-lived objects, but the "make long-
// lived" machinery is incapable of moving internal pointers like
@@ -193,7 +202,7 @@ void common_hal_busio_uart_construct (busio_uart_obj_t *self,
claim_pin(rx);
}
- if ( tx != mp_const_none ) {
+ if ( tx != NULL ) {
self->tx_pin_number = tx->number;
claim_pin(tx);
} else {
diff --git a/ports/nrf/common-hal/digitalio/DigitalInOut.c b/ports/nrf/common-hal/digitalio/DigitalInOut.c
index 0836962c6..c5a7a7dfb 100644
--- a/ports/nrf/common-hal/digitalio/DigitalInOut.c
+++ b/ports/nrf/common-hal/digitalio/DigitalInOut.c
@@ -46,7 +46,7 @@ digitalinout_result_t common_hal_digitalio_digitalinout_construct(
}
bool common_hal_digitalio_digitalinout_deinited(digitalio_digitalinout_obj_t *self) {
- return self->pin == mp_const_none;
+ return self->pin == NULL;
}
void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t *self) {
@@ -56,7 +56,7 @@ void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t *self
nrf_gpio_cfg_default(self->pin->number);
reset_pin_number(self->pin->number);
- self->pin = mp_const_none;
+ self->pin = NULL;
}
void common_hal_digitalio_digitalinout_switch_to_input(
diff --git a/ports/nrf/common-hal/microcontroller/Pin.c b/ports/nrf/common-hal/microcontroller/Pin.c
index b7931a2e1..3132c7631 100644
--- a/ports/nrf/common-hal/microcontroller/Pin.c
+++ b/ports/nrf/common-hal/microcontroller/Pin.c
@@ -196,3 +196,15 @@ bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t *pin) {
return pin_number_is_free(pin->number);
}
+
+uint8_t common_hal_mcu_pin_number(const mcu_pin_obj_t* pin) {
+ return pin->number;
+}
+
+void common_hal_mcu_pin_claim(const mcu_pin_obj_t* pin) {
+ claim_pin(pin);
+}
+
+void common_hal_mcu_pin_reset_number(uint8_t pin_no) {
+ reset_pin_number(pin_no);
+}
diff --git a/ports/nrf/common-hal/neopixel_write/__init__.c b/ports/nrf/common-hal/neopixel_write/__init__.c
index 8495a359d..0a4036aae 100644
--- a/ports/nrf/common-hal/neopixel_write/__init__.c
+++ b/ports/nrf/common-hal/neopixel_write/__init__.c
@@ -25,6 +25,7 @@
*/
#include "py/mphal.h"
+#include "py/mpstate.h"
#include "shared-bindings/neopixel_write/__init__.h"
#include "nrf_pwm.h"
@@ -97,6 +98,13 @@ static NRF_PWM_Type* find_free_pwm (void) {
return NULL;
}
+static size_t pixels_pattern_heap_size = 0;
+// Called during reset_port() to free the pattern buffer
+void neopixel_write_reset(void) {
+ MP_STATE_VM(pixels_pattern_heap) = NULL;
+ pixels_pattern_heap_size = 0;
+}
+
uint64_t next_start_tick_ms = 0;
uint32_t next_start_tick_us = 1000;
@@ -119,10 +127,8 @@ void common_hal_neopixel_write (const digitalio_digitalinout_obj_t* digitalinout
// We need space for at least 10 pixels for Circuit Playground, but let's choose 24
// to handle larger NeoPixel rings without malloc'ing.
#define STACK_PIXELS 24
-
uint32_t pattern_size = PATTERN_SIZE(numBytes);
uint16_t* pixels_pattern = NULL;
- bool pattern_on_heap = false;
// Use the stack to store STACK_PIXEL's worth of PWM data. uint32_t to ensure alignment.
// It is 3*STACK_PIXELS to handle RGB.
@@ -138,16 +144,34 @@ void common_hal_neopixel_write (const digitalio_digitalinout_obj_t* digitalinout
} else {
uint8_t sd_en = 0;
(void) sd_softdevice_is_enabled(&sd_en);
- if (sd_en) {
- // If the soft device is enabled then we must use PWM to
- // transmit. This takes a bunch of memory to do so raise an
- // exception if we can't.
- pixels_pattern = (uint16_t *) m_malloc(pattern_size, false);
- } else {
- pixels_pattern = (uint16_t *) m_malloc_maybe(pattern_size, false);
- }
- pattern_on_heap = true;
+ if (pixels_pattern_heap_size < pattern_size) {
+ // Current heap buffer is too small.
+ if (MP_STATE_VM(pixels_pattern_heap)) {
+ // Old pixels_pattern_heap will be gc'd; don't free it.
+ pixels_pattern = NULL;
+ pixels_pattern_heap_size = 0;
+ }
+
+ // realloc routines fall back to a plain malloc if the incoming ptr is NULL.
+ if (sd_en) {
+ // If the soft device is enabled then we must use PWM to
+ // transmit. This takes a bunch of memory to do so raise an
+ // exception if we can't.
+ MP_STATE_VM(pixels_pattern_heap) =
+ (uint16_t *) m_realloc(MP_STATE_VM(pixels_pattern_heap), pattern_size);
+ } else {
+ // Might return NULL.
+ MP_STATE_VM(pixels_pattern_heap) =
+ // true means move if necessary.
+ (uint16_t *) m_realloc_maybe(MP_STATE_VM(pixels_pattern_heap), pattern_size, true);
+ }
+ if (MP_STATE_VM(pixels_pattern_heap)) {
+ pixels_pattern_heap_size = pattern_size;
+ }
+ }
+ // Might be NULL, which means we failed to allocate.
+ pixels_pattern = MP_STATE_VM(pixels_pattern_heap);
}
}
@@ -155,7 +179,7 @@ void common_hal_neopixel_write (const digitalio_digitalinout_obj_t* digitalinout
wait_until(next_start_tick_ms, next_start_tick_us);
// Use the identified device to choose the implementation
- // If a PWM device is available use DMA
+ // If a PWM device is available and we have a buffer, use DMA.
if ( (pixels_pattern != NULL) && (pwm != NULL) ) {
uint16_t pos = 0; // bit position
@@ -229,10 +253,6 @@ void common_hal_neopixel_write (const digitalio_digitalinout_obj_t* digitalinout
nrf_pwm_disable(pwm);
nrf_pwm_pins_set(pwm, (uint32_t[]) {0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL} );
- if (pattern_on_heap) {
- m_free(pixels_pattern);
- }
-
} // End of DMA implementation
// ---------------------------------------------------------------------
else {
diff --git a/ports/nrf/common-hal/neopixel_write/__init__.h b/ports/nrf/common-hal/neopixel_write/__init__.h
new file mode 100644
index 000000000..b8dce85ad
--- /dev/null
+++ b/ports/nrf/common-hal/neopixel_write/__init__.h
@@ -0,0 +1,32 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Lucian Copeland 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.
+ */
+
+#ifndef MICROPY_INCLUDED_STM32F4_COMMON_HAL_NEOPIXEL_WRITE_INIT_H
+#define MICROPY_INCLUDED_STM32F4_COMMON_HAL_NEOPIXEL_WRITE_INIT_H
+
+void neopixel_write_reset(void);
+
+#endif // MICROPY_INCLUDED_STM32F4_COMMON_HAL_NEOPIXEL_WRITE_INIT_H \ No newline at end of file
diff --git a/ports/nrf/common-hal/pulseio/PulseOut.c b/ports/nrf/common-hal/pulseio/PulseOut.c
index d0433247a..270cb45d6 100644
--- a/ports/nrf/common-hal/pulseio/PulseOut.c
+++ b/ports/nrf/common-hal/pulseio/PulseOut.c
@@ -102,10 +102,7 @@ void pulseout_reset() {
void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self,
const pulseio_pwmout_obj_t* carrier) {
if (refcount == 0) {
- timer = nrf_peripherals_allocate_timer();
- if (timer == NULL) {
- mp_raise_RuntimeError(translate("All timers in use"));
- }
+ timer = nrf_peripherals_allocate_timer_or_throw();
}
refcount++;
diff --git a/ports/nrf/common-hal/time/__init__.c b/ports/nrf/common-hal/time/__init__.c
index 976f519db..c85077868 100644
--- a/ports/nrf/common-hal/time/__init__.c
+++ b/ports/nrf/common-hal/time/__init__.c
@@ -32,6 +32,14 @@ uint64_t common_hal_time_monotonic(void) {
return supervisor_ticks_ms64();
}
+uint64_t common_hal_time_monotonic_ns(void) {
+ uint64_t ms;
+ uint32_t us_until_ms;
+ current_tick(&ms, &us_until_ms);
+ // us counts down.
+ return 1000 * (ms * 1000 + (1000 - us_until_ms));
+}
+
void common_hal_time_delay_ms(uint32_t delay) {
mp_hal_delay_ms(delay);
}
diff --git a/ports/nrf/ld_defines.c b/ports/nrf/ld_defines.c
index 0ec6dfdb5..ebe9c4929 100644
--- a/ports/nrf/ld_defines.c
+++ b/ports/nrf/ld_defines.c
@@ -37,3 +37,6 @@
/*BOOTLOADER_SETTINGS_START_ADDR=*/ BOOTLOADER_SETTINGS_START_ADDR;
/*BOOTLOADER_SETTINGS_SIZE=*/ BOOTLOADER_SETTINGS_SIZE;
+
+/*SOFTDEVICE_RAM_SIZE=*/ SOFTDEVICE_RAM_SIZE;
+/*SPIM3_BUFFER_SIZE=*/ SPIM3_BUFFER_SIZE;
diff --git a/ports/nrf/mpconfigport.h b/ports/nrf/mpconfigport.h
index b6635965d..44e51fc5f 100644
--- a/ports/nrf/mpconfigport.h
+++ b/ports/nrf/mpconfigport.h
@@ -34,9 +34,16 @@
#include "nrf_sdm.h" // for SD_FLASH_SIZE
#include "peripherals/nrf/nvm.h" // for FLASH_PAGE_SIZE
+// Max RAM used by SoftDevice. Can be changed when SoftDevice parameters are changed.
+// See common.template.ld.
+#define SOFTDEVICE_RAM_SIZE (64*1024)
+
#ifdef NRF52840
#define MICROPY_PY_SYS_PLATFORM "nRF52840"
#define FLASH_SIZE (0x100000) // 1MiB
+// Special RAM area for SPIM3 transmit buffer, to work around hardware bug.
+// See common.template.ld.
+#define SPIM3_BUFFER_SIZE (8192)
#endif
#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (1)
@@ -97,6 +104,9 @@
#define ISR_START_ADDR (SD_FLASH_START_ADDR + SD_FLASH_SIZE)
#define ISR_SIZE (0x1000) // 4kiB
+// Smallest unit of flash that can be erased.
+#define FLASH_ERASE_SIZE FLASH_PAGE_SIZE
+
#define CIRCUITPY_FIRMWARE_START_ADDR (ISR_START_ADDR + ISR_SIZE)
// Define these regions starting down from the bootloader:
@@ -122,29 +132,29 @@
// The firmware space is the space left over between the fixed lower and upper regions.
#define CIRCUITPY_FIRMWARE_SIZE (CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_START_ADDR - CIRCUITPY_FIRMWARE_START_ADDR)
-#if BOOTLOADER_START_ADDR % FLASH_PAGE_SIZE != 0
-#error BOOTLOADER_START_ADDR must be on a flash page boundary.
+#if BOOTLOADER_START_ADDR % FLASH_ERASE_SIZE != 0
+#error BOOTLOADER_START_ADDR must be on a flash erase boundary.
#endif
-#if CIRCUITPY_INTERNAL_NVM_START_ADDR % FLASH_PAGE_SIZE != 0
-#error CIRCUITPY_INTERNAL_NVM_START_ADDR must be on a flash page boundary.
+#if CIRCUITPY_INTERNAL_NVM_START_ADDR % FLASH_ERASE_SIZE != 0
+#error CIRCUITPY_INTERNAL_NVM_START_ADDR must be on a flash erase boundary.
#endif
-#if CIRCUITPY_INTERNAL_NVM_SIZE % FLASH_PAGE_SIZE != 0
-#error CIRCUITPY_INTERNAL_NVM_SIZE must be a multiple of FLASH_PAGE_SIZE.
+#if CIRCUITPY_INTERNAL_NVM_SIZE % FLASH_ERASE_SIZE != 0
+#error CIRCUITPY_INTERNAL_NVM_SIZE must be a multiple of FLASH_ERASE_SIZE.
#endif
-#if CIRCUITPY_BLE_CONFIG_START_ADDR % FLASH_PAGE_SIZE != 0
-#error CIRCUITPY_BLE_CONFIG_SIZE must be on a flash page boundary.
+#if CIRCUITPY_BLE_CONFIG_START_ADDR % FLASH_ERASE_SIZE != 0
+#error CIRCUITPY_BLE_CONFIG_SIZE must be on a flash erase boundary.
#endif
-#if CIRCUITPY_BLE_CONFIG_SIZE % FLASH_PAGE_SIZE != 0
-#error CIRCUITPY_BLE_CONFIG_SIZE must be a multiple of FLASH_PAGE_SIZE.
+#if CIRCUITPY_BLE_CONFIG_SIZE % FLASH_ERASE_SIZE != 0
+#error CIRCUITPY_BLE_CONFIG_SIZE must be a multiple of FLASH_ERASE_SIZE.
#endif
-#if CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_START_ADDR % FLASH_PAGE_SIZE != 0
-#error CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE must be on a flash page boundary.
+#if CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_START_ADDR % FLASH_ERASE_SIZE != 0
+#error CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE must be on a flash erase boundary.
#endif
-#if CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE % FLASH_PAGE_SIZE != 0
-#error CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE must be a multiple of FLASH_PAGE_SIZE.
+#if CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE % FLASH_ERASE_SIZE != 0
+#error CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE must be a multiple of FLASH_ERASE_SIZE.
#endif
#if CIRCUITPY_FIRMWARE_SIZE < 0
@@ -154,6 +164,7 @@
#define MICROPY_PORT_ROOT_POINTERS \
CIRCUITPY_COMMON_ROOT_POINTERS \
+ uint16_t* pixels_pattern_heap; \
ble_drv_evt_handler_entry_t* ble_drv_evt_handler_entries; \
diff --git a/ports/nrf/mpconfigport.mk b/ports/nrf/mpconfigport.mk
index 9b738d4b3..5ca1f0f35 100644
--- a/ports/nrf/mpconfigport.mk
+++ b/ports/nrf/mpconfigport.mk
@@ -51,6 +51,9 @@ endif
# frequencyio not yet implemented
CIRCUITPY_FREQUENCYIO = 0
+CIRCUITPY_PROTOMATTER = 1
+CIRCUITPY_FRAMEBUFFERIO = 1
+
# nRF52840-specific
ifeq ($(MCU_CHIP),nrf52840)
@@ -69,4 +72,5 @@ NRF_DEFINES += -DNRF52840_XXAA -DNRF52840
# Defined here because system_nrf52840.c doesn't #include any of our own include files.
CFLAGS += -DCONFIG_NFCT_PINS_AS_GPIOS
+CIRCUITPY_ULAB = 1
endif
diff --git a/ports/nrf/nrfx_config.h b/ports/nrf/nrfx_config.h
index 82f6514df..e37c60934 100644
--- a/ports/nrf/nrfx_config.h
+++ b/ports/nrf/nrfx_config.h
@@ -26,10 +26,9 @@
// CIRCUITPY_NRF_NUM_I2C is 1 or 2 to choose how many I2C (TWIM) peripherals
// to provide.
-// This can go away once we have SPIM3 working: then we can have two
-// I2C and two SPI.
+// With SPIM3 working we can have two I2C and two SPI.
#ifndef CIRCUITPY_NRF_NUM_I2C
-#define CIRCUITPY_NRF_NUM_I2C 1
+#define CIRCUITPY_NRF_NUM_I2C 2
#endif
#if CIRCUITPY_NRF_NUM_I2C != 1 && CIRCUITPY_NRF_NUM_I2C != 2
@@ -42,13 +41,12 @@
#define NRFX_SPIM1_ENABLED 1
#endif
#define NRFX_SPIM2_ENABLED 1
-// DON'T ENABLE SPIM3 DUE TO ANOMALY WORKAROUND FAILURE (SEE ABOVE).
-// #ifdef NRF52840_XXAA
-// #define NRFX_SPIM_EXTENDED_ENABLED 1
-// #define NRFX_SPIM3_ENABLED 1
-// #else
-// #define NRFX_SPIM3_ENABLED 0
-// #endif
+#ifdef NRF52840_XXAA
+ #define NRFX_SPIM_EXTENDED_ENABLED 1
+ #define NRFX_SPIM3_ENABLED 1
+#else
+ #define NRFX_SPIM3_ENABLED 0
+#endif
#define NRFX_SPIM_DEFAULT_CONFIG_IRQ_PRIORITY 7
diff --git a/ports/nrf/peripherals/nrf/timers.c b/ports/nrf/peripherals/nrf/timers.c
index 88f3dd468..fd814968d 100644
--- a/ports/nrf/peripherals/nrf/timers.c
+++ b/ports/nrf/peripherals/nrf/timers.c
@@ -25,6 +25,7 @@
*/
#include "common-hal/pulseio/PulseOut.h"
+#include "peripherals/nrf/timers.h"
#include <stdint.h>
@@ -54,14 +55,47 @@ STATIC nrfx_timer_t nrfx_timers[] = {
};
static bool nrfx_timer_allocated[ARRAY_SIZE(nrfx_timers)];
+static bool nrfx_timer_never_reset[ARRAY_SIZE(nrfx_timers)];
void timers_reset(void) {
for (size_t i = 0; i < ARRAY_SIZE(nrfx_timers); i ++) {
+ if (nrfx_timer_never_reset[i]) {
+ continue;
+ }
nrfx_timer_uninit(&nrfx_timers[i]);
nrfx_timer_allocated[i] = false;
}
}
+void nrf_peripherals_timer_never_reset(nrfx_timer_t* timer) {
+ int idx = nrf_peripherals_timer_idx_from_timer(timer);
+ nrfx_timer_never_reset[idx] = true;
+}
+
+void nrf_peripherals_timer_reset_ok(nrfx_timer_t* timer) {
+ int idx = nrf_peripherals_timer_idx_from_timer(timer);
+ nrfx_timer_never_reset[idx] = false;
+}
+
+nrfx_timer_t* nrf_peripherals_timer_from_reg(NRF_TIMER_Type* ptr) {
+ for (size_t i = 0; i < ARRAY_SIZE(nrfx_timers); i ++) {
+ if (nrfx_timers[i].p_reg == ptr) {
+ return &nrfx_timers[i];
+ }
+ }
+ return NULL;
+}
+
+size_t nrf_peripherals_timer_idx_from_timer(nrfx_timer_t* ptr) {
+ for (size_t i = 0; i < ARRAY_SIZE(nrfx_timers); i ++) {
+ if (&nrfx_timers[i] == ptr) {
+ return i;
+ }
+ }
+ return ~(size_t)0;
+}
+
+
// Returns a free nrfx_timer instance, and marks it as allocated.
// The caller should init as with the desired config.
// Returns NULL if no timer is available.
@@ -75,14 +109,21 @@ nrfx_timer_t* nrf_peripherals_allocate_timer(void) {
return NULL;
}
+nrfx_timer_t* nrf_peripherals_allocate_timer_or_throw(void) {
+ nrfx_timer_t* result = nrf_peripherals_allocate_timer();
+ if (!result) {
+ mp_raise_RuntimeError(translate("All timers in use"));
+ }
+ return result;
+}
+
// Free a timer, which may or may not have been initialized.
void nrf_peripherals_free_timer(nrfx_timer_t* timer) {
- for (size_t i = 0; i < ARRAY_SIZE(nrfx_timers); i ++) {
- if (timer == &nrfx_timers[i]) {
- nrfx_timer_allocated[i] = false;
- // Safe to call even if not initialized.
- nrfx_timer_uninit(timer);
- return;
- }
+ size_t idx = nrf_peripherals_timer_idx_from_timer(timer);
+ if (idx != ~(size_t)0) {
+ nrfx_timer_allocated[idx] = false;
+ nrfx_timer_never_reset[idx] = false;
+ // Safe to call even if not initialized.
+ nrfx_timer_uninit(timer);
}
}
diff --git a/ports/nrf/peripherals/nrf/timers.h b/ports/nrf/peripherals/nrf/timers.h
index 7d3815579..cf96c6273 100644
--- a/ports/nrf/peripherals/nrf/timers.h
+++ b/ports/nrf/peripherals/nrf/timers.h
@@ -29,4 +29,9 @@
void timers_reset(void);
nrfx_timer_t* nrf_peripherals_allocate_timer(void);
+nrfx_timer_t* nrf_peripherals_allocate_timer_or_throw(void);
void nrf_peripherals_free_timer(nrfx_timer_t* timer);
+void nrf_peripherals_timer_never_reset(nrfx_timer_t* timer);
+void nrf_peripherals_timer_reset_ok(nrfx_timer_t* timer);
+nrfx_timer_t* nrf_peripherals_timer_from_reg(NRF_TIMER_Type* ptr);
+size_t nrf_peripherals_timer_idx_from_timer(nrfx_timer_t* ptr);
diff --git a/ports/nrf/supervisor/port.c b/ports/nrf/supervisor/port.c
index 6a4813c66..cbe0cec54 100644
--- a/ports/nrf/supervisor/port.c
+++ b/ports/nrf/supervisor/port.c
@@ -47,6 +47,7 @@
#include "common-hal/pulseio/PulseOut.h"
#include "common-hal/pulseio/PulseIn.h"
#include "common-hal/rtc/RTC.h"
+#include "common-hal/neopixel_write/__init__.h"
#include "tick.h"
#include "shared-bindings/rtc/__init__.h"
@@ -103,6 +104,7 @@ void reset_port(void) {
i2c_reset();
spi_reset();
uart_reset();
+ neopixel_write_reset();
#if CIRCUITPY_AUDIOBUSIO
i2s_reset();
diff --git a/ports/nrf/supervisor/qspi_flash.c b/ports/nrf/supervisor/qspi_flash.c
index bb449d881..90260b091 100644
--- a/ports/nrf/supervisor/qspi_flash.c
+++ b/ports/nrf/supervisor/qspi_flash.c
@@ -83,11 +83,52 @@ bool spi_flash_sector_command(uint8_t command, uint32_t address) {
}
bool spi_flash_write_data(uint32_t address, uint8_t* data, uint32_t length) {
+ // TODO: In theory, this also needs to handle unaligned data and
+ // non-multiple-of-4 length. (in practice, I don't think the fat layer
+ // generates such writes)
return nrfx_qspi_write(data, length, address) == NRFX_SUCCESS;
}
bool spi_flash_read_data(uint32_t address, uint8_t* data, uint32_t length) {
- return nrfx_qspi_read(data, length, address) == NRFX_SUCCESS;
+ int misaligned = ((intptr_t)data) & 3;
+ // If the data is misaligned, we need to read 4 bytes
+ // into an aligned buffer, and then copy 1, 2, or 3 bytes from the aligned
+ // buffer to data.
+ if(misaligned) {
+ int sz = 4 - misaligned;
+ __attribute__((aligned(4))) uint8_t buf[4];
+
+ if(nrfx_qspi_read(buf, 4, address) != NRFX_SUCCESS) {
+ return false;
+ }
+ memcpy(data, buf, sz);
+ data += sz;
+ address += sz;
+ length -= sz;
+ }
+
+ // nrfx_qspi_read works in 4 byte increments, though it doesn't
+ // signal an error if sz is not a multiple of 4. Read (directly into data)
+ // all but the last 1, 2, or 3 bytes depending on the (remaining) length.
+ uint32_t sz = length & ~(uint32_t)3;
+ if(nrfx_qspi_read(data, sz, address) != NRFX_SUCCESS) {
+ return false;
+ }
+ data += sz;
+ address += sz;
+ length -= sz;
+
+ // Now, if we have any bytes left over, we must do a final read of 4
+ // bytes and copy 1, 2, or 3 bytes to data.
+ if(length) {
+ __attribute__((aligned(4))) uint8_t buf[4];
+ if(nrfx_qspi_read(buf, 4, address) != NRFX_SUCCESS) {
+ return false;
+ }
+ memcpy(data, buf, length);
+ }
+
+ return true;
}
void spi_flash_init(void) {
diff --git a/ports/stm32f4/.gitignore b/ports/stm/.gitignore
index 3080ece14..3080ece14 100644
--- a/ports/stm32f4/.gitignore
+++ b/ports/stm/.gitignore
diff --git a/ports/stm32f4/Makefile b/ports/stm/Makefile
index 3a6191c85..c152b76f1 100755
--- a/ports/stm32f4/Makefile
+++ b/ports/stm/Makefile
@@ -22,15 +22,14 @@
# 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.
-# DEBUG = 1
# Select the board to build for.
ifeq ($(BOARD),)
- $(error You must provide a BOARD parameter)
+$(error You must provide a BOARD parameter)
else
- ifeq ($(wildcard boards/$(BOARD)/.),)
- $(error Invalid BOARD specified)
- endif
+ifeq ($(wildcard boards/$(BOARD)/.),)
+$(error Invalid BOARD specified)
+endif
endif
# If the build directory is not given, make it reflect the board name.
@@ -58,26 +57,27 @@ include $(TOP)/py/circuitpy_defns.mk
CROSS_COMPILE = arm-none-eabi-
-#######################################
-# CFLAGS
-#######################################
+MCU_SERIES_LOWER = $(shell echo $(MCU_SERIES) | tr '[:upper:]' '[:lower:]')
+MCU_VARIANT_LOWER = $(shell echo $(MCU_VARIANT) | tr '[:upper:]' '[:lower:]')
+
+HAL_DIR=st_driver/STM32$(MCU_SERIES)xx_HAL_Driver
INC += -I.
INC += -I../..
INC += -I$(BUILD)
INC += -I$(BUILD)/genhdr
-INC += -I./stm32f4/STM32F4xx_HAL_Driver/Inc
-INC += -I./stm32f4/STM32F4xx_HAL_Driver/Inc/Legacy
-INC += -I./stm32f4/CMSIS/Device/ST/STM32F4xx/Include
-INC += -I./stm32f4/CMSIS/Include
+INC += -I./$(HAL_DIR)/Inc
+INC += -I./$(HAL_DIR)/Inc/Legacy
+INC += -I./st_driver/CMSIS/Device/ST/STM32$(MCU_SERIES)xx/Include
+INC += -I./st_driver/CMSIS/Include
INC += -I./boards
INC += -I./boards/$(BOARD)
INC += -I./peripherals
+INC += -I./packages
INC += -I../../lib/mp-readline
INC += -I../../lib/tinyusb/src
INC += -I../../supervisor/shared/usb
-
#Debugging/Optimization
ifeq ($(DEBUG), 1)
CFLAGS += -ggdb
@@ -87,32 +87,37 @@ else
CFLAGS += -Os -DNDEBUG
CFLAGS += -ggdb
# TODO: Test with -flto
- ### CFLAGS += -flto
+ # CFLAGS += -flto
endif
+# MCU Series is defined by the HAL package and doesn't need to be specified here
+C_DEFS = -D$(MCU_PACKAGE) -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -D$(MCU_VARIANT)
-C_DEFS = -DMCU_PACKAGE=$(MCU_PACKAGE) -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -D$(CMSIS_MCU)
-
-CFLAGS += $(INC) -Werror -Wall -std=gnu11 -nostdlib $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT)
+CFLAGS += $(INC) -Werror -Wall -std=gnu11 $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT) -nostdlib -nostartfiles
# Undo some warnings.
-# STM32 apparently also uses undefined preprocessor variables quite casually,
-# so we can't do warning checks for these.
-CFLAGS += -Wno-undef
-# STM32 might do casts that increase alignment requirements.
-CFLAGS += -Wno-cast-align
+# STM32 HAL uses undefined preprocessor variables, shadowed variables, casts that change alignment reqs
+CFLAGS += -Wno-undef -Wno-shadow -Wno-cast-align
-CFLAGS += \
- -mthumb \
- -mabi=aapcs-linux \
- -mfloat-abi=hard \
- -mcpu=cortex-m4 \
- -mfpu=fpv4-sp-d16
+CFLAGS += -mthumb -mabi=aapcs-linux
+
+# Arm core selection
+MCU_FLAGS_F4 = -mcpu=cortex-m4
+MCU_FLAGS_F7 = -mcpu=cortex-m7
+MCU_FLAGS_H7 = -mcpu=cortex-m7
+CFLAGS += $(MCU_FLAGS_$(MCU_SERIES))
+
+# Select HAL file for distribution via mpconfigport
+CFLAGS += -DSTM32_HAL_H='<stm32$(MCU_SERIES_LOWER)xx_hal.h>'
-# TODO: check this
-CFLAGS += -D__START=main
+# Floating point settings
+ifeq ($(MCU_VARIANT),$(filter $(MCU_VARIANT),STM32F765xx STM32F767xx STM32F769xx STM32H743xx))
+CFLAGS += -mfpu=fpv5-d16 -mfloat-abi=hard
+else
+CFLAGS += -mfpu=fpv4-sp-d16 -mfloat-abi=hard
+endif
-#need both command and valid file to use uf2 bootloader
+# Need both command and valid file to use uf2 bootloader
ifndef LD_FILE
ifneq ($(and $(UF2_BOOTLOADER),$(LD_BOOT)),)
LD_FILE = $(LD_BOOT)
@@ -128,67 +133,70 @@ ifndef BOOTLOADER_OFFSET
BOOTLOADER_OFFSET := 0x8000000
endif
-LDFLAGS = $(CFLAGS) -fshort-enums -Wl,-nostdlib -Wl,-T,$(LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nano.specs
+LDFLAGS = $(CFLAGS) -fshort-enums -Wl,-nostdlib -Wl,-T,$(LD_FILE) -Wl,-T,$(LD_COMMON) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nano.specs
LIBS := -lgcc -lc
-LDFLAGS += -mthumb -mcpu=cortex-m4
-
# Use toolchain libm if we're not using our own.
ifndef INTERNAL_LIBM
LIBS += -lm
endif
# TinyUSB defines
-CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_STM32F4 -DCFG_TUD_CDC_RX_BUFSIZE=1024 -DCFG_TUD_CDC_TX_BUFSIZE=1024 -DCFG_TUD_MSC_BUFSIZE=4096 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_MIDI_TX_BUFSIZE=128
-
-
-######################################
-# source
-######################################
-
-SRC_STM32 = \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc_ex.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac_ex.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c_ex.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_qspi.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rng.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc_ex.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_usart.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sd.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_gpio.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_adc.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fsmc.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_i2c.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_dma.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_sdmmc.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usart.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_rcc.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_utils.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_exti.c \
- system_stm32f4xx.c
+CFLAGS += \
+ -DCFG_TUSB_MCU=OPT_MCU_STM32$(MCU_SERIES) \
+ -DCFG_TUD_CDC_RX_BUFSIZE=1024 \
+ -DCFG_TUD_CDC_TX_BUFSIZE=1024 \
+ -DCFG_TUD_MSC_BUFSIZE=4096 \
+ -DCFG_TUD_MIDI_RX_BUFSIZE=128 \
+ -DCFG_TUD_MIDI_TX_BUFSIZE=128
+
+SRC_STM32 = $(addprefix $(HAL_DIR)/Src/stm32$(MCU_SERIES_LOWER)xx_,\
+ hal_adc.c \
+ hal_adc_ex.c \
+ hal_dac.c \
+ hal_dac_ex.c \
+ hal_i2c.c \
+ hal_i2c_ex.c \
+ hal_qspi.c \
+ hal_rng.c \
+ hal_rtc.c \
+ hal_rtc_ex.c \
+ hal_spi.c \
+ hal_tim.c \
+ hal_tim_ex.c \
+ hal_uart.c \
+ hal_usart.c \
+ hal_rcc.c \
+ hal_rcc_ex.c \
+ hal_flash.c \
+ hal_flash_ex.c \
+ hal_gpio.c \
+ hal_dma_ex.c \
+ hal_dma.c \
+ hal_pwr.c \
+ hal_pwr_ex.c \
+ hal_cortex.c \
+ hal.c \
+ hal_exti.c \
+ hal_sd.c \
+ ll_gpio.c \
+ ll_adc.c \
+ ll_i2c.c \
+ ll_dma.c \
+ ll_sdmmc.c \
+ ll_usart.c \
+ ll_rcc.c \
+ ll_utils.c \
+ ll_exti.c \
+)
+
+# Need this to avoid UART linker problems. TODO: rewrite to use registered callbacks.
+# Does not exist for F4 and lower
+ifeq ($(MCU_VARIANT),$(filter $(MCU_VARIANT),STM32F765xx STM32F767xx STM32F769xx STM32H743xx))
+ SRC_STM32 += $(HAL_DIR)/Src/stm32$(MCU_SERIES_LOWER)xx_hal_uart_ex.c
+endif
+SRC_STM32 += boards/system_stm32$(MCU_SERIES_LOWER)xx.c
SRC_C += \
background.c \
@@ -197,10 +205,11 @@ SRC_C += \
tick.c \
boards/$(BOARD)/board.c \
boards/$(BOARD)/pins.c \
- peripherals/stm32f4/$(MCU_SUB_VARIANT)/pins.c \
- peripherals/stm32f4/$(MCU_SUB_VARIANT)/clocks.c \
- peripherals/stm32f4/$(MCU_SUB_VARIANT)/gpio.c \
- peripherals/stm32f4/$(MCU_SUB_VARIANT)/periph.c \
+ peripherals/stm32$(MCU_SERIES_LOWER)/$(MCU_VARIANT_LOWER)/pins.c \
+ peripherals/stm32$(MCU_SERIES_LOWER)/$(MCU_VARIANT_LOWER)/clocks.c \
+ peripherals/stm32$(MCU_SERIES_LOWER)/$(MCU_VARIANT_LOWER)/gpio.c \
+ peripherals/stm32$(MCU_SERIES_LOWER)/$(MCU_VARIANT_LOWER)/periph.c \
+ packages/$(MCU_PACKAGE).c\
lib/libc/string0.c \
lib/mp-readline/readline.c \
lib/oofatfs/ff.c \
@@ -220,7 +229,7 @@ endif
SRC_S = \
supervisor/cpu.s \
- boards/startup_$(MCU_SUB_VARIANT).s
+ st_driver/CMSIS/Device/ST/STM32$(MCU_SERIES)xx/Source/Templates/gcc/startup_$(MCU_VARIANT_LOWER).s
SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \
$(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \
@@ -254,6 +263,12 @@ SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_MOD) $(SRC_COMMON_HAL_EXPANDED) $(S
# Sources that only hold QSTRs after pre-processing.
SRC_QSTR_PREPROCESSOR +=
+# Bin section settings specific to the STM32H7
+ifeq ($(MCU_VARIANT),$(filter $(MCU_VARIANT),STM32H743xx))
+MCU_SECTIONS = -j .isr_vector -j .text -j .data -j .itcm -j .dtcm_data $^ $@
+else
+MCU_SECTIONS = $^ $@
+endif
all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2
@@ -264,13 +279,11 @@ $(BUILD)/firmware.elf: $(OBJ)
$(BUILD)/firmware.bin: $(BUILD)/firmware.elf
$(STEPECHO) "Create $@"
- $(Q)$(OBJCOPY) -O binary $^ $@
-# $(Q)$(OBJCOPY) -O binary -j .vectors -j .text -j .data $^ $@
+ $(Q)$(OBJCOPY) -O binary $(MCU_SECTIONS)
$(BUILD)/firmware.hex: $(BUILD)/firmware.elf
$(STEPECHO) "Create $@"
- $(Q)$(OBJCOPY) -O ihex $^ $@
-# $(Q)$(OBJCOPY) -O ihex -j .vectors -j .text -j .data $^ $@
+ $(Q)$(OBJCOPY) -O ihex $(MCU_SECTIONS)
$(BUILD)/firmware.uf2: $(BUILD)/firmware.hex
$(ECHO) "Create $@"
diff --git a/ports/stm/README.md b/ports/stm/README.md
new file mode 100644
index 000000000..f2e3e9b67
--- /dev/null
+++ b/ports/stm/README.md
@@ -0,0 +1,3 @@
+# CircuitPython Port To The ST Microelectronics STM32 Series
+
+This is a port of CircuitPython to the STM32 series of chips.
diff --git a/ports/stm/background.c b/ports/stm/background.c
new file mode 100644
index 000000000..8c1897043
--- /dev/null
+++ b/ports/stm/background.c
@@ -0,0 +1,60 @@
+/*
+ * 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 "py/runtime.h"
+#include "supervisor/filesystem.h"
+#include "supervisor/usb.h"
+#include "supervisor/shared/stack.h"
+
+#if CIRCUITPY_DISPLAYIO
+#include "shared-module/displayio/__init__.h"
+#endif
+
+static bool running_background_tasks = false;
+
+void background_tasks_reset(void) {
+ running_background_tasks = false;
+}
+
+void run_background_tasks(void) {
+ // Don't call ourselves recursively.
+ if (running_background_tasks) {
+ return;
+ }
+ running_background_tasks = true;
+ filesystem_background();
+
+ #if USB_AVAILABLE
+ usb_background();
+ #endif
+
+ #if CIRCUITPY_DISPLAYIO
+ displayio_background();
+ #endif
+ running_background_tasks = false;
+
+ assert_heap_ok();
+}
diff --git a/ports/stm/background.h b/ports/stm/background.h
new file mode 100644
index 000000000..6225429f8
--- /dev/null
+++ b/ports/stm/background.h
@@ -0,0 +1,35 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Dan Halbert 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.
+ */
+
+#ifndef MICROPY_INCLUDED_STM32_BACKGROUND_H
+#define MICROPY_INCLUDED_STM32_BACKGROUND_H
+
+#include <stdbool.h>
+
+void background_tasks_reset(void);
+void run_background_tasks(void);
+
+#endif // MICROPY_INCLUDED_STM32_BACKGROUND_H
diff --git a/ports/stm/boards/STM32F401xd_fs.ld b/ports/stm/boards/STM32F401xd_fs.ld
new file mode 100644
index 000000000..826e1d404
--- /dev/null
+++ b/ports/stm/boards/STM32F401xd_fs.ld
@@ -0,0 +1,26 @@
+/*
+ GNU linker script for STM32F401 with filesystem
+*/
+
+/* Specify the memory areas */
+MEMORY
+{
+ FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 384K /* entire flash */
+ FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */
+ FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 48K /* sectors 1,2,3 are 16K */
+ FLASH_TEXT (rx) : ORIGIN = 0x08010000, LENGTH = 320K /* sector 4 is 64K, sectors 5,6,7 are 128K */
+ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
+}
+
+/* produce a link error if there is not this amount of RAM for these sections */
+_minimum_stack_size = 2K;
+_minimum_heap_size = 16K;
+
+/* Define tho top end of the stack. The stack is full descending so begins just
+ above last byte of RAM. Note that EABI requires the stack to be 8-byte
+ aligned for a call. */
+_estack = ORIGIN(RAM) + LENGTH(RAM);
+
+/* RAM extents for the garbage collector */
+_ram_start = ORIGIN(RAM);
+_ram_end = ORIGIN(RAM) + LENGTH(RAM);
diff --git a/ports/stm/boards/STM32F401xe_boot.ld b/ports/stm/boards/STM32F401xe_boot.ld
new file mode 100644
index 000000000..17dac2f1a
--- /dev/null
+++ b/ports/stm/boards/STM32F401xe_boot.ld
@@ -0,0 +1,26 @@
+/*
+ GNU linker script for STM32F401 with bootloader (such as the Meowbit). No internal fs.
+*/
+
+/* Specify the memory areas */
+MEMORY
+{
+ FLASH (rx) : ORIGIN = 0x08010000, LENGTH = 512K - 64K /* entire flash, sans bootloader region */
+ FLASH_ISR (rx) : ORIGIN = 0x08010000, LENGTH = 64K /* sector 4 */
+ FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 384K /* sectors 5,6,7 are 128K */
+ RAM (xrw) : ORIGIN = 0x20000194, LENGTH = 96K - 0x194
+}
+
+/* produce a link error if there is not this amount of RAM for these sections */
+_minimum_stack_size = 2K;
+_minimum_heap_size = 16K;
+
+/* Define tho top end of the stack. The stack is full descending so begins just
+ above last byte of RAM. Note that EABI requires the stack to be 8-byte
+ aligned for a call. */
+_estack = ORIGIN(RAM) + LENGTH(RAM);
+
+/* RAM extents for the garbage collector */
+_ram_start = ORIGIN(RAM);
+_ram_end = ORIGIN(RAM) + LENGTH(RAM);
+
diff --git a/ports/stm/boards/STM32F401xe_fs.ld b/ports/stm/boards/STM32F401xe_fs.ld
new file mode 100644
index 000000000..f0136943a
--- /dev/null
+++ b/ports/stm/boards/STM32F401xe_fs.ld
@@ -0,0 +1,26 @@
+/*
+ GNU linker script for STM32F401 with bootloader (such as the Meowbit)
+*/
+
+/* Specify the memory areas */
+MEMORY
+{
+ FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K /* entire flash */
+ FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */
+ FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 48K /* sectors 1,2,3 are 16K */
+ FLASH_TEXT (rx) : ORIGIN = 0x08010000, LENGTH = 448K /* sector 4 is 64K, sectors 5,6,7 are 128K */
+ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
+}
+
+/* produce a link error if there is not this amount of RAM for these sections */
+_minimum_stack_size = 2K;
+_minimum_heap_size = 16K;
+
+/* Define tho top end of the stack. The stack is full descending so begins just
+ above last byte of RAM. Note that EABI requires the stack to be 8-byte
+ aligned for a call. */
+_estack = ORIGIN(RAM) + LENGTH(RAM);
+
+/* RAM extents for the garbage collector */
+_ram_start = ORIGIN(RAM);
+_ram_end = ORIGIN(RAM) + LENGTH(RAM);
diff --git a/ports/stm/boards/STM32F405_boot.ld b/ports/stm/boards/STM32F405_boot.ld
new file mode 100644
index 000000000..7e611be9d
--- /dev/null
+++ b/ports/stm/boards/STM32F405_boot.ld
@@ -0,0 +1,27 @@
+/*
+ GNU linker script for STM32F405 with bootloader
+*/
+
+/* Specify the memory areas */
+MEMORY
+{
+ FLASH (rx) : ORIGIN = 0x08010000, LENGTH = 1024K - 64K /* entire flash, sans bootloader region */
+ FLASH_ISR (rx) : ORIGIN = 0x08010000, LENGTH = 64K /* sector 0 */
+ FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 1024K - 64K - 64K /* sectors 5+ */
+ CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
+ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
+}
+
+/* produce a link error if there is not this amount of RAM for these sections */
+_minimum_stack_size = 2K;
+_minimum_heap_size = 16K;
+
+/* Define the top end of the stack. The stack is full descending so begins just
+ above last byte of RAM. Note that EABI requires the stack to be 8-byte
+ aligned for a call. */
+_estack = ORIGIN(RAM) + LENGTH(RAM);
+
+/* RAM extents for the garbage collector */
+_ram_start = ORIGIN(RAM);
+_ram_end = ORIGIN(RAM) + LENGTH(RAM);
+
diff --git a/ports/stm/boards/STM32F405_default.ld b/ports/stm/boards/STM32F405_default.ld
new file mode 100644
index 000000000..6b497356d
--- /dev/null
+++ b/ports/stm/boards/STM32F405_default.ld
@@ -0,0 +1,27 @@
+/*
+ GNU linker script for STM32F405, no filesystem
+*/
+
+/* Specify the memory areas */
+MEMORY
+{
+ FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K /* entire flash */
+ FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */
+ FLASH_TEXT (rx) : ORIGIN = 0x08004000, LENGTH = 1008K /* sectors 0-7*/
+ CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
+ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
+}
+
+/* produce a link error if there is not this amount of RAM for these sections */
+_minimum_stack_size = 2K;
+_minimum_heap_size = 16K;
+
+/* Define tho top end of the stack. The stack is full descending so begins just
+ above last byte of RAM. Note that EABI requires the stack to be 8-byte
+ aligned for a call. */
+_estack = ORIGIN(RAM) + LENGTH(RAM);
+
+/* RAM extents for the garbage collector */
+_ram_start = ORIGIN(RAM);
+_ram_end = ORIGIN(RAM) + LENGTH(RAM);
+
diff --git a/ports/stm/boards/STM32F405_fs.ld b/ports/stm/boards/STM32F405_fs.ld
new file mode 100644
index 000000000..72ee49633
--- /dev/null
+++ b/ports/stm/boards/STM32F405_fs.ld
@@ -0,0 +1,28 @@
+/*
+ GNU linker script for STM32F405 with filesystem
+*/
+
+/* Specify the memory areas */
+MEMORY
+{
+ FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K /* entire flash */
+ FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */
+ FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 48K /* sectors 1,2,3 are 16K */
+ FLASH_TEXT (rx) : ORIGIN = 0x08010000, LENGTH = 960K /* sector 4 is 64K, sectors 5,6,7 are 128K */
+ CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
+ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
+}
+
+/* produce a link error if there is not this amount of RAM for these sections */
+_minimum_stack_size = 2K;
+_minimum_heap_size = 16K;
+
+/* Define tho top end of the stack. The stack is full descending so begins just
+ above last byte of RAM. Note that EABI requires the stack to be 8-byte
+ aligned for a call. */
+_estack = ORIGIN(RAM) + LENGTH(RAM);
+
+/* RAM extents for the garbage collector */
+_ram_start = ORIGIN(RAM);
+_ram_end = ORIGIN(RAM) + LENGTH(RAM);
+
diff --git a/ports/stm/boards/STM32F407_fs.ld b/ports/stm/boards/STM32F407_fs.ld
new file mode 100644
index 000000000..d08cb8972
--- /dev/null
+++ b/ports/stm/boards/STM32F407_fs.ld
@@ -0,0 +1,28 @@
+/*
+ GNU linker script for STM32F407 with filesystem
+*/
+
+/* Specify the memory areas */
+MEMORY
+{
+ FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K /* entire flash */
+ FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */
+ FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 48K /* sectors 1,2,3 are 16K */
+ FLASH_TEXT (rx) : ORIGIN = 0x08010000, LENGTH = 960K /* sector 4 is 64K, sectors 5,6,7 are 128K */
+ CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
+ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
+}
+
+/* produce a link error if there is not this amount of RAM for these sections */
+_minimum_stack_size = 2K;
+_minimum_heap_size = 16K;
+
+/* Define tho top end of the stack. The stack is full descending so begins just
+ above last byte of RAM. Note that EABI requires the stack to be 8-byte
+ aligned for a call. */
+_estack = ORIGIN(RAM) + LENGTH(RAM);
+
+/* RAM extents for the garbage collector */
+_ram_start = ORIGIN(RAM);
+_ram_end = ORIGIN(RAM) + LENGTH(RAM);
+
diff --git a/ports/stm/boards/STM32F411_fs.ld b/ports/stm/boards/STM32F411_fs.ld
new file mode 100644
index 000000000..28667214e
--- /dev/null
+++ b/ports/stm/boards/STM32F411_fs.ld
@@ -0,0 +1,27 @@
+/*
+ GNU linker script for STM32F411 with filesystem
+*/
+
+/* Specify the memory areas */
+MEMORY
+{
+ FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K /* entire flash */
+ FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */
+ FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 48K /* sectors 1,2,3 are 16K */
+ FLASH_TEXT (rx) : ORIGIN = 0x08010000, LENGTH = 448K /* sector 4 is 64K, sectors 5,6,7 are 128K */
+ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
+}
+
+/* produce a link error if there is not this amount of RAM for these sections */
+_minimum_stack_size = 2K;
+_minimum_heap_size = 16K;
+
+/* Define tho top end of the stack. The stack is full descending so begins just
+ above last byte of RAM. Note that EABI requires the stack to be 8-byte
+ aligned for a call. */
+_estack = ORIGIN(RAM) + LENGTH(RAM);
+
+/* RAM extents for the garbage collector */
+_ram_start = ORIGIN(RAM);
+_ram_end = ORIGIN(RAM) + LENGTH(RAM);
+
diff --git a/ports/stm/boards/STM32F411_nvm.ld b/ports/stm/boards/STM32F411_nvm.ld
new file mode 100644
index 000000000..bb37c081b
--- /dev/null
+++ b/ports/stm/boards/STM32F411_nvm.ld
@@ -0,0 +1,27 @@
+/*
+ GNU linker script for STM32F411 with nvm
+*/
+
+/* Specify the memory areas */
+MEMORY
+{
+ FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K /* entire flash */
+ FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */
+ FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 32K /* sectors 1,2 are 16K */
+ FLASH_NVM (rwx) : ORIGIN = 0x0800C000, LENGTH = 16K /* sector 3 is 16K */
+ FLASH_TEXT (rx) : ORIGIN = 0x08010000, LENGTH = 448K /* sector 4 is 64K, sectors 5,6,7 are 128K */
+ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
+}
+
+/* produce a link error if there is not this amount of RAM for these sections */
+_minimum_stack_size = 2K;
+_minimum_heap_size = 16K;
+
+/* Define the top end of the stack. The stack is full descending so begins just
+ above last byte of RAM. Note that EABI requires the stack to be 8-byte
+ aligned for a call. */
+_estack = ORIGIN(RAM) + LENGTH(RAM);
+
+/* RAM extents for the garbage collector */
+_ram_start = ORIGIN(RAM);
+_ram_end = ORIGIN(RAM) + LENGTH(RAM);
diff --git a/ports/stm/boards/STM32F412_fs.ld b/ports/stm/boards/STM32F412_fs.ld
new file mode 100644
index 000000000..5985b209e
--- /dev/null
+++ b/ports/stm/boards/STM32F412_fs.ld
@@ -0,0 +1,27 @@
+/*
+ GNU linker script for STM32F412 with filesystem, tcm
+*/
+
+/* Specify the memory areas */
+MEMORY
+{
+ FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K /* entire flash */
+ FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */
+ FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 48K /* sectors 1,2,3 are 16K */
+ FLASH_TEXT (rx) : ORIGIN = 0x08010000, LENGTH = 960K /* sector 4 is 64K, sectors 5,6,7 are 128K */
+ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 256K
+}
+
+/* produce a link error if there is not this amount of RAM for these sections */
+_minimum_stack_size = 2K;
+_minimum_heap_size = 16K;
+
+/* Define tho top end of the stack. The stack is full descending so begins just
+ above last byte of RAM. Note that EABI requires the stack to be 8-byte
+ aligned for a call. */
+_estack = ORIGIN(RAM) + LENGTH(RAM);
+
+/* RAM extents for the garbage collector */
+_ram_start = ORIGIN(RAM);
+_ram_end = ORIGIN(RAM) + LENGTH(RAM);
+
diff --git a/ports/stm/boards/STM32F767_fs.ld b/ports/stm/boards/STM32F767_fs.ld
new file mode 100644
index 000000000..40f7d740a
--- /dev/null
+++ b/ports/stm/boards/STM32F767_fs.ld
@@ -0,0 +1,27 @@
+/*
+ GNU linker script for STM32F767 with filesystem
+*/
+
+/* Specify the memory areas */
+MEMORY
+{
+ FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048K /* entire flash */
+ FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 32K /* sector 0 */
+ FLASH_FS (rx) : ORIGIN = 0x08008000, LENGTH = 96K /* sectors 1,2,3 are 32K */
+ FLASH_TEXT (rx) : ORIGIN = 0x08010000, LENGTH = 1920K /* sector 4 is 128K, sectors 5,6,7 are 256K */
+ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 512K
+}
+
+/* produce a link error if there is not this amount of RAM for these sections */
+_minimum_stack_size = 2K;
+_minimum_heap_size = 16K;
+
+/* Define tho top end of the stack. The stack is full descending so begins just
+ above last byte of RAM. Note that EABI requires the stack to be 8-byte
+ aligned for a call. */
+_estack = ORIGIN(RAM) + LENGTH(RAM);
+
+/* RAM extents for the garbage collector */
+_ram_start = ORIGIN(RAM);
+_ram_end = ORIGIN(RAM) + LENGTH(RAM);
+
diff --git a/ports/stm/boards/STM32H743_fs.ld b/ports/stm/boards/STM32H743_fs.ld
new file mode 100644
index 000000000..28cc12b4a
--- /dev/null
+++ b/ports/stm/boards/STM32H743_fs.ld
@@ -0,0 +1,39 @@
+/*
+ GNU linker script for STM32H743 with filesystem, tcm
+*/
+
+/* Entry Point */
+ENTRY(Reset_Handler)
+
+_ld_default_stack_size = 24K;
+
+/* Specify the memory areas */
+MEMORY
+{
+ FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048K
+ FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 128K /* sector 0, 128K */
+ FLASH_FS (r) : ORIGIN = 0x08020000, LENGTH = 128K /* sector 1, 128K */
+ FLASH_TEXT (rx) : ORIGIN = 0x08040000, LENGTH = 1792K /* sectors 6*128 + 8*128 */
+ DTCM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
+ RAM (xrw) : ORIGIN = 0x24000000, LENGTH = 512K /* AXI SRAM */
+ SRAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 288K /* AHB1 SRAM */
+ SRAM_D3 (xrw) : ORIGIN = 0x30040000, LENGTH = 64K /* AHB2 SRAM */
+ ITCM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K
+}
+
+/* produce a link error if there is not this amount of RAM for these sections */
+_minimum_stack_size = 2K;
+_minimum_heap_size = 16K;
+
+/* brainless copy paste for stack code. Results in ambiguous hard crash */
+/* _ld_default_stack_size = 20K; */
+
+/* Define tho top end of the stack. The stack is full descending so begins just
+ above last byte of RAM. Note that EABI requires the stack to be 8-byte
+ aligned for a call. */
+_estack = ORIGIN(DTCM) + LENGTH(DTCM);
+
+/* RAM extents for the garbage collector */
+_ram_start = ORIGIN(RAM);
+_ram_end = ORIGIN(RAM) + LENGTH(RAM);
+
diff --git a/ports/stm32f4/boards/board.h b/ports/stm/boards/board.h
index 22d9e99be..22d9e99be 100644
--- a/ports/stm32f4/boards/board.h
+++ b/ports/stm/boards/board.h
diff --git a/ports/stm32f4/boards/STM32F401_boot.ld b/ports/stm/boards/common_default.ld
index 125d785fc..41fe4dfb6 100644
--- a/ports/stm32f4/boards/STM32F401_boot.ld
+++ b/ports/stm/boards/common_default.ld
@@ -1,31 +1,20 @@
-/*
- GNU linker script for STM32F401 with bootloader (such as the Meowbit)
-*/
-
-/* Specify the memory areas */
-MEMORY
-{
- FLASH (rx) : ORIGIN = 0x08010000, LENGTH = 512K - 64K /* entire flash, sans bootloader region */
- FLASH_ISR (rx) : ORIGIN = 0x08010000, LENGTH = 64K /* sector 4 */
- FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 384K /* sectors 5,6,7 are 128K */
- RAM (xrw) : ORIGIN = 0x20000194, LENGTH = 96K - 0x194
-}
-
-/* produce a link error if there is not this amount of RAM for these sections */
-_minimum_stack_size = 2K;
-_minimum_heap_size = 16K;
+/* Memory layout for default case.
-/* Define tho top end of the stack. The stack is full descending so begins just
- above last byte of RAM. Note that EABI requires the stack to be 8-byte
- aligned for a call. */
-_estack = ORIGIN(RAM) + LENGTH(RAM);
+ FLASH_ISR .isr_vector
+ FLASH_TEXT .text
+ FLASH_TEXT .data
+ FLASH_FS // ignored for fs use
-/* RAM extents for the garbage collector */
-_ram_start = ORIGIN(RAM);
-_ram_end = ORIGIN(RAM) + LENGTH(RAM);
+ RAM .data
+ RAM .bss
+ RAM .heap
+ RAM .stack
+*/
ENTRY(Reset_Handler)
+_ld_default_stack_size = _minimum_stack_size;
+
/* define output sections */
SECTIONS
{
@@ -88,19 +77,23 @@ SECTIONS
.heap :
{
. = ALIGN(4);
+ _ld_heap_start = .;
. = . + _minimum_heap_size;
. = ALIGN(4);
} >RAM
+ _ld_heap_end = ORIGIN(RAM) + LENGTH(RAM);
/* this just checks there is enough RAM for the stack */
.stack :
{
. = ALIGN(4);
+ _ld_stack_bottom = .;
. = . + _minimum_stack_size;
. = ALIGN(4);
} >RAM
+ _ld_stack_top = ORIGIN(RAM) + LENGTH(RAM);
+
.ARM.attributes 0 : { *(.ARM.attributes) }
}
-
diff --git a/ports/stm32f4/boards/STM32F405_default.ld b/ports/stm/boards/common_nvm.ld
index c2b8c843e..cee71d194 100644
--- a/ports/stm32f4/boards/STM32F405_default.ld
+++ b/ports/stm/boards/common_nvm.ld
@@ -1,32 +1,22 @@
-/*
- GNU linker script for STM32F405 via Micropython
+/* Memory layout for case with dedicated nvm sector (inefficient)
+TODO: rewrite nvm module, remove this file entirely
+
+ FLASH_ISR .isr_vector
+ FLASH_TEXT .text
+ FLASH_TEXT .data
+ FLASH_NVM .nvm_data
+ FLASH_FS // ignored for fs use
+
+ RAM .data
+ RAM .bss
+ RAM .heap
+ RAM .stack
*/
-/* Specify the memory areas */
-MEMORY
-{
- FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K /* entire flash */
- FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */
- FLASH_TEXT (rx) : ORIGIN = 0x08004000, LENGTH = 1008K /* sectors 0-7*/
- CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
- RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
-}
-
-/* produce a link error if there is not this amount of RAM for these sections */
-_minimum_stack_size = 2K;
-_minimum_heap_size = 16K;
-
-/* Define tho top end of the stack. The stack is full descending so begins just
- above last byte of RAM. Note that EABI requires the stack to be 8-byte
- aligned for a call. */
-_estack = ORIGIN(RAM) + LENGTH(RAM);
-
-/* RAM extents for the garbage collector */
-_ram_start = ORIGIN(RAM);
-_ram_end = ORIGIN(RAM) + LENGTH(RAM);
-
ENTRY(Reset_Handler)
+_ld_default_stack_size = _minimum_stack_size;
+
/* define output sections */
SECTIONS
{
@@ -43,6 +33,14 @@ SECTIONS
. = ALIGN(4);
} >FLASH_ISR
+ /* Non-volitile memory */
+ .nvm_data :
+ {
+ . = ALIGN(4);
+ KEEP(*(.nvm_data))
+ . = ALIGN(4);
+ } >FLASH_NVM
+
/* The program code and other data goes into FLASH */
.text :
{
@@ -89,19 +87,23 @@ SECTIONS
.heap :
{
. = ALIGN(4);
+ _ld_heap_start = .;
. = . + _minimum_heap_size;
. = ALIGN(4);
} >RAM
+ _ld_heap_end = ORIGIN(RAM) + LENGTH(RAM);
/* this just checks there is enough RAM for the stack */
.stack :
{
. = ALIGN(4);
+ _ld_stack_bottom = .;
. = . + _minimum_stack_size;
. = ALIGN(4);
} >RAM
+ _ld_stack_top = ORIGIN(RAM) + LENGTH(RAM);
+
.ARM.attributes 0 : { *(.ARM.attributes) }
}
-
diff --git a/ports/stm32f4/boards/STM32F401_fs.ld b/ports/stm/boards/common_tcm.ld
index fd30e1622..0aab4c7f9 100644
--- a/ports/stm32f4/boards/STM32F401_fs.ld
+++ b/ports/stm/boards/common_tcm.ld
@@ -1,29 +1,19 @@
-/*
- GNU linker script for STM32F401 with bootloader (such as the Meowbit)
-*/
-
-/* Specify the memory areas */
-MEMORY
-{
- FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K /* entire flash */
- FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */
- FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 48K /* sectors 1,2,3 are 16K */
- FLASH_TEXT (rx) : ORIGIN = 0x08010000, LENGTH = 448K /* sector 4 is 64K, sectors 5,6,7 are 128K */
- RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
-}
+/* Memory layout for cases with itcm and dtcm
-/* produce a link error if there is not this amount of RAM for these sections */
-_minimum_stack_size = 2K;
-_minimum_heap_size = 16K;
+ FLASH_ISR .isr_vector
+ FLASH_TEXT .text
+ FLASH_TEXT .data
+ FLASH_FS // ignored for fs use
-/* Define tho top end of the stack. The stack is full descending so begins just
- above last byte of RAM. Note that EABI requires the stack to be 8-byte
- aligned for a call. */
-_estack = ORIGIN(RAM) + LENGTH(RAM);
+ RAM .data
+ RAM .bss
+ RAM .heap
-/* RAM extents for the garbage collector */
-_ram_start = ORIGIN(RAM);
-_ram_end = ORIGIN(RAM) + LENGTH(RAM);
+ ITCM .itcm
+ DTCM .dtcm_data
+ DTCM .dtcm_bss
+ DTCM .stack
+*/
ENTRY(Reset_Handler)
@@ -72,6 +62,9 @@ SECTIONS
. = ALIGN(4);
_edata = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */
} >RAM AT> FLASH_TEXT
+ _ld_d1_ram_data_destination = ADDR(.data);
+ _ld_d1_ram_data_flash_copy = LOADADDR(.data);
+ _ld_d1_ram_data_size = SIZEOF(.data);
/* Uninitialized data section */
.bss :
@@ -84,6 +77,10 @@ SECTIONS
. = ALIGN(4);
_ebss = .; /* define a global symbol at bss end; used by startup code and GC */
} >RAM
+ _ld_d1_ram_bss_start = ADDR(.bss);
+ _ld_d1_ram_bss_size = SIZEOF(.bss);
+ _ld_heap_start = _ld_d1_ram_bss_start + _ld_d1_ram_bss_size;
+ _ld_heap_end = ORIGIN(RAM) + LENGTH(RAM);
/* this is to define the start of the heap, and make sure we have a minimum size */
.heap :
@@ -93,15 +90,50 @@ SECTIONS
. = ALIGN(4);
} >RAM
- /* this just checks there is enough RAM for the stack */
- .stack :
+ /* itcm stuff */
+ .itcm :
{
. = ALIGN(4);
- . = . + _minimum_stack_size;
+
+ *(.itcm.*)
+
. = ALIGN(4);
- } >RAM
+ } > ITCM AT> FLASH_TEXT
+ _ld_itcm_destination = ADDR(.itcm);
+ _ld_itcm_flash_copy = LOADADDR(.itcm);
+ _ld_itcm_size = SIZEOF(.itcm);
- .ARM.attributes 0 : { *(.ARM.attributes) }
-}
+ .dtcm_data :
+ {
+ . = ALIGN(4);
+ *(.dtcm_data.*)
+ . = ALIGN(4);
+ } > DTCM AT> FLASH_TEXT
+ _ld_dtcm_data_destination = ADDR(.dtcm_data);
+ _ld_dtcm_data_flash_copy = LOADADDR(.dtcm_data);
+ _ld_dtcm_data_size = SIZEOF(.dtcm_data);
+
+ .dtcm_bss :
+ {
+ . = ALIGN(4);
+
+ *(.dtcm_bss.*)
+
+ . = ALIGN(4);
+ } > DTCM AT> DTCM
+ _ld_dtcm_bss_start = ADDR(.dtcm_bss);
+ _ld_dtcm_bss_size = SIZEOF(.dtcm_bss);
+
+ .stack :
+ {
+ . = ALIGN(8);
+ _ld_stack_bottom = .;
+ . += _ld_default_stack_size;
+ } > DTCM
+ _ld_stack_top = ORIGIN(DTCM) + LENGTH(DTCM);
+
+
+ .ARM.attributes 0 : { *(.ARM.attributes) }
+}
diff --git a/ports/stm/boards/espruino_pico/README.md b/ports/stm/boards/espruino_pico/README.md
new file mode 100644
index 000000000..9f0321c47
--- /dev/null
+++ b/ports/stm/boards/espruino_pico/README.md
@@ -0,0 +1,15 @@
+# Flashing the Espruino Pico
+
+The Espruino Pico is normally updated via a bootloader activated by the Espruino web app. This approach is not practical for Circuitpython as it takes too much space from the internal filesystem - thus, you will need to follow the instructions for advanced reflashing using the built-in ROM bootloader on all STM32F4 MCUs (instructions sourced from https://www.espruino.com/Pico#advanced-reflashing)
+
+ - Short out the BOOT0/BTN solder jumper on the back of the board - you can do this by drawing over it with a pencil.
+ - Install ST's DFU utility on Windows, or dfu-util for Mac or Linux
+ - **Mac**: install with Homebrew: `brew install dfu-util`
+ - **Linux**: install with apt-get: `sudo apt-get install dfu-util`
+ - **Windows**: download [ST's application](https://www.st.com/en/development-tools/stsw-stm32080.html) or install the Linux subsystem for Windows 10 and follow the linux instructions.
+ - Hold down the Pico's button while plugging it into USB (when overwriting Espruino's default firmware)
+ - Navigate to the same directory as your firmware.bin file for Circuitpython and run the following command: `sudo dfu-util -a 0 -s 0x08000000 -D firmware.bin` or use the ST utility on Windows.
+ - Restart the board.
+
+
+To reinstall Espruino, follow the same steps with the latest Espruino Pico binary from espruino.com/binaries. This will reinstall the usual Espruino bootloader. You must un-short the BOOT0/BTN jumper to re-use the original Espruino Bootloader again. If you used a Pencil mark then you may need to use cleaning fluid and a small brush to totally clear out the graphite. \ No newline at end of file
diff --git a/ports/stm32f4/boards/feather_stm32f405_express/board.c b/ports/stm/boards/espruino_pico/board.c
index 82b0c506e..82b0c506e 100644
--- a/ports/stm32f4/boards/feather_stm32f405_express/board.c
+++ b/ports/stm/boards/espruino_pico/board.c
diff --git a/ports/stm/boards/espruino_pico/mpconfigboard.h b/ports/stm/boards/espruino_pico/mpconfigboard.h
new file mode 100644
index 000000000..d4430380c
--- /dev/null
+++ b/ports/stm/boards/espruino_pico/mpconfigboard.h
@@ -0,0 +1,39 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Lucian Copeland 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.
+ */
+
+//Micropython setup
+
+#define MICROPY_HW_BOARD_NAME "Espruino Pico"
+#define MICROPY_HW_MCU_NAME "STM32F401xD"
+
+#define FLASH_SIZE (0x60000)
+#define FLASH_PAGE_SIZE (0x4000)
+
+#define AUTORESET_DELAY_MS (500)
+#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000)
+
+#define BOARD_OSC_DIV (8)
+
diff --git a/ports/stm/boards/espruino_pico/mpconfigboard.mk b/ports/stm/boards/espruino_pico/mpconfigboard.mk
new file mode 100644
index 000000000..b7937dd04
--- /dev/null
+++ b/ports/stm/boards/espruino_pico/mpconfigboard.mk
@@ -0,0 +1,15 @@
+USB_VID = 0x239A
+USB_PID = 0x808E
+USB_PRODUCT = "Espruino Pico"
+USB_MANUFACTURER = "Espruino"
+USB_DEVICES = "CDC,MSC"
+
+INTERNAL_FLASH_FILESYSTEM = 1
+
+MCU_SERIES = F4
+MCU_VARIANT = STM32F401xE
+MCU_PACKAGE = UFQFPN48
+
+LD_COMMON = boards/common_default.ld
+LD_FILE = boards/STM32F401xd_fs.ld # use for internal flash
+
diff --git a/ports/stm/boards/espruino_pico/pins.c b/ports/stm/boards/espruino_pico/pins.c
new file mode 100644
index 000000000..55c0336c5
--- /dev/null
+++ b/ports/stm/boards/espruino_pico/pins.c
@@ -0,0 +1,33 @@
+#include "shared-bindings/board/__init__.h"
+
+STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_B15), MP_ROM_PTR(&pin_PB15) },
+ { MP_ROM_QSTR(MP_QSTR_B14), MP_ROM_PTR(&pin_PB14) },
+ { MP_ROM_QSTR(MP_QSTR_B13), MP_ROM_PTR(&pin_PB13) },
+ { MP_ROM_QSTR(MP_QSTR_B10), MP_ROM_PTR(&pin_PB10) },
+ { MP_ROM_QSTR(MP_QSTR_B1), MP_ROM_PTR(&pin_PB01) },
+ { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PA07) },
+ { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PA06) },
+ { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA05) },
+
+ { MP_ROM_QSTR(MP_QSTR_B3), MP_ROM_PTR(&pin_PB03) },
+ { MP_ROM_QSTR(MP_QSTR_B4), MP_ROM_PTR(&pin_PB04) },
+ { MP_ROM_QSTR(MP_QSTR_B5), MP_ROM_PTR(&pin_PB05) },
+ { MP_ROM_QSTR(MP_QSTR_B6), MP_ROM_PTR(&pin_PB06) },
+ { MP_ROM_QSTR(MP_QSTR_B7), MP_ROM_PTR(&pin_PB07) },
+ { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PA08) },
+
+ { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA04) },
+ { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA03) },
+ { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA02) },
+ { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA01) },
+ { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA00) },
+ { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_PA10) },
+ { MP_ROM_QSTR(MP_QSTR_B9), MP_ROM_PTR(&pin_PB09) },
+ { MP_ROM_QSTR(MP_QSTR_B8), MP_ROM_PTR(&pin_PB08) },
+
+ { MP_ROM_QSTR(MP_QSTR_BTN), MP_ROM_PTR(&pin_PC13) },
+ { MP_ROM_QSTR(MP_QSTR_LED1), MP_ROM_PTR(&pin_PB02) },
+ { MP_ROM_QSTR(MP_QSTR_LED2), MP_ROM_PTR(&pin_PB12) },
+};
+MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
diff --git a/ports/stm32f4/boards/pyb_nano_v2/stm32f4xx_hal_conf.h b/ports/stm/boards/espruino_pico/stm32f4xx_hal_conf.h
index ab04df318..ab04df318 100644
--- a/ports/stm32f4/boards/pyb_nano_v2/stm32f4xx_hal_conf.h
+++ b/ports/stm/boards/espruino_pico/stm32f4xx_hal_conf.h
diff --git a/ports/stm/boards/espruino_wifi/README.MD b/ports/stm/boards/espruino_wifi/README.MD
new file mode 100644
index 000000000..8c2cd3be2
--- /dev/null
+++ b/ports/stm/boards/espruino_wifi/README.MD
@@ -0,0 +1,15 @@
+# Flashing the Espruino Wifi
+
+The Espruino Wifi is normally updated via a bootloader activated by the Espruino web app. This approach is not practical for Circuitpython as it takes too much space from the internal filesystem - thus, you will need to follow the instructions for advanced reflashing using the built-in ROM bootloader on all STM32F4 MCUs (instructions sourced from https://www.espruino.com/Wifi#advanced-reflashing)
+
+ - Short out the BOOT0/BTN solder jumper on the back of the board - you can do this by drawing over it with a pencil.
+ - Install ST's DFU utility on Windows, or dfu-util for Mac or Linux
+ - **Mac**: install with Homebrew: `brew install dfu-util`
+ - **Linux**: install with apt-get: `sudo apt-get install dfu-util`
+ - **Windows**: download [ST's application](https://www.st.com/en/development-tools/stsw-stm32080.html) or install the Linux subsystem for Windows 10 and follow the linux instructions.
+ - Hold down the Wifi's button while plugging it into USB (when overwriting Espruino's default firmware)
+ - Navigate to the same directory as your firmware.bin file for Circuitpython and run the following command: `sudo dfu-util -a 0 -s 0x08000000 -D firmware.bin` or use the ST utility on Windows.
+ - Restart the board.
+
+
+To reinstall Espruino, follow the same steps with the latest Espruino Wifi binary from espruino.com/binaries. This will reinstall the usual Espruino bootloader. You must un-short the BOOT0/BTN jumper to re-use the original Espruino Bootloader again. If you used a Pencil mark then you may need to use cleaning fluid and a small brush to totally clear out the graphite. \ No newline at end of file
diff --git a/ports/stm32f4/boards/stm32f411ve_discovery/board.c b/ports/stm/boards/espruino_wifi/board.c
index 4421970ee..4421970ee 100644
--- a/ports/stm32f4/boards/stm32f411ve_discovery/board.c
+++ b/ports/stm/boards/espruino_wifi/board.c
diff --git a/ports/stm/boards/espruino_wifi/mpconfigboard.h b/ports/stm/boards/espruino_wifi/mpconfigboard.h
new file mode 100644
index 000000000..abdc9e8fa
--- /dev/null
+++ b/ports/stm/boards/espruino_wifi/mpconfigboard.h
@@ -0,0 +1,36 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Lucian Copeland 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.
+ */
+
+//Micropython setup
+
+#define MICROPY_HW_BOARD_NAME "Espruino Wifi"
+#define MICROPY_HW_MCU_NAME "STM32F411xE"
+
+#define FLASH_SIZE (0x80000) //512K
+#define FLASH_PAGE_SIZE (0x4000) //16K
+
+#define BOARD_OSC_DIV (8)
+#define BOARD_OVERWRITE_SWD (1)
diff --git a/ports/stm/boards/espruino_wifi/mpconfigboard.mk b/ports/stm/boards/espruino_wifi/mpconfigboard.mk
new file mode 100644
index 000000000..70d0ea2bd
--- /dev/null
+++ b/ports/stm/boards/espruino_wifi/mpconfigboard.mk
@@ -0,0 +1,15 @@
+USB_VID = 0x239A
+USB_PID = 0x8090
+USB_PRODUCT = "Espruino Wifi"
+USB_MANUFACTURER = "Espruino"
+USB_DEVICES = "CDC,MSC"
+
+INTERNAL_FLASH_FILESYSTEM = 1
+
+MCU_SERIES = F4
+MCU_VARIANT = STM32F411xE
+MCU_PACKAGE = UFQFPN48
+
+LD_COMMON = boards/common_default.ld
+LD_FILE = boards/STM32F411_fs.ld
+
diff --git a/ports/stm/boards/espruino_wifi/pins.c b/ports/stm/boards/espruino_wifi/pins.c
new file mode 100644
index 000000000..8800317d5
--- /dev/null
+++ b/ports/stm/boards/espruino_wifi/pins.c
@@ -0,0 +1,39 @@
+#include "shared-bindings/board/__init__.h"
+
+STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
+ //P1
+ { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA00) },
+ { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA01) },
+ { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA04) },
+ { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA05) },
+ { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PA06) },
+ { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PA07) },
+ { MP_ROM_QSTR(MP_QSTR_B1), MP_ROM_PTR(&pin_PB01) },
+ { MP_ROM_QSTR(MP_QSTR_B10), MP_ROM_PTR(&pin_PB10) },
+ { MP_ROM_QSTR(MP_QSTR_B13), MP_ROM_PTR(&pin_PB13) },
+ { MP_ROM_QSTR(MP_QSTR_B14), MP_ROM_PTR(&pin_PB14) },
+ { MP_ROM_QSTR(MP_QSTR_B15), MP_ROM_PTR(&pin_PB15) },
+
+ { MP_ROM_QSTR(MP_QSTR_B0), MP_ROM_PTR(&pin_PB00) },
+ { MP_ROM_QSTR(MP_QSTR_B9), MP_ROM_PTR(&pin_PB09) },
+ { MP_ROM_QSTR(MP_QSTR_B8), MP_ROM_PTR(&pin_PB08) },
+ { MP_ROM_QSTR(MP_QSTR_B7), MP_ROM_PTR(&pin_PB07) },
+ { MP_ROM_QSTR(MP_QSTR_B6), MP_ROM_PTR(&pin_PB06) },
+ { MP_ROM_QSTR(MP_QSTR_B5), MP_ROM_PTR(&pin_PB05) },
+ { MP_ROM_QSTR(MP_QSTR_B4), MP_ROM_PTR(&pin_PB04) },
+ { MP_ROM_QSTR(MP_QSTR_B3), MP_ROM_PTR(&pin_PB03) },
+
+ { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_PA10) },
+ { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PA08) },
+
+ { MP_ROM_QSTR(MP_QSTR_LED1), MP_ROM_PTR(&pin_PB02) },
+ { MP_ROM_QSTR(MP_QSTR_LED2), MP_ROM_PTR(&pin_PB12) },
+ { MP_ROM_QSTR(MP_QSTR_BTN), MP_ROM_PTR(&pin_PC13) },
+
+ { MP_ROM_QSTR(MP_QSTR_ESP_RX), MP_ROM_PTR(&pin_PA02) },
+ { MP_ROM_QSTR(MP_QSTR_ESP_TX), MP_ROM_PTR(&pin_PA03) },
+ { MP_ROM_QSTR(MP_QSTR_ESP_GPIO0), MP_ROM_PTR(&pin_PA13) },
+ { MP_ROM_QSTR(MP_QSTR_ESP_CHPD), MP_ROM_PTR(&pin_PA14) },
+ { MP_ROM_QSTR(MP_QSTR_ESP_GPIO13), MP_ROM_PTR(&pin_PA15) },
+};
+MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
diff --git a/ports/stm32f4/boards/stm32f411ve_discovery/stm32f4xx_hal_conf.h b/ports/stm/boards/espruino_wifi/stm32f4xx_hal_conf.h
index 18d9d60eb..18d9d60eb 100644
--- a/ports/stm32f4/boards/stm32f411ve_discovery/stm32f4xx_hal_conf.h
+++ b/ports/stm/boards/espruino_wifi/stm32f4xx_hal_conf.h
diff --git a/ports/stm32f4/boards/pyb_nano_v2/board.c b/ports/stm/boards/feather_stm32f405_express/board.c
index 82b0c506e..82b0c506e 100644
--- a/ports/stm32f4/boards/pyb_nano_v2/board.c
+++ b/ports/stm/boards/feather_stm32f405_express/board.c
diff --git a/ports/stm32f4/boards/feather_stm32f405_express/mpconfigboard.h b/ports/stm/boards/feather_stm32f405_express/mpconfigboard.h
index ad9bba7b0..6600fcf67 100644
--- a/ports/stm32f4/boards/feather_stm32f405_express/mpconfigboard.h
+++ b/ports/stm/boards/feather_stm32f405_express/mpconfigboard.h
@@ -34,6 +34,8 @@
#define MICROPY_HW_NEOPIXEL (&pin_PC00)
+#define BOARD_OSC_DIV (12)
+
// On-board flash
#define SPI_FLASH_MOSI_PIN (&pin_PB05)
#define SPI_FLASH_MISO_PIN (&pin_PB04)
@@ -42,7 +44,7 @@
// Bootloader only
#ifdef UF2_BOOTLOADER_ENABLED
- #define BOARD_VTOR_DEFER //Leave VTOR relocation to bootloader
+ #define BOARD_VTOR_DEFER (1) //Leave VTOR relocation to bootloader
#endif
#define DEFAULT_I2C_BUS_SCL (&pin_PB06)
diff --git a/ports/stm32f4/boards/feather_stm32f405_express/mpconfigboard.mk b/ports/stm/boards/feather_stm32f405_express/mpconfigboard.mk
index 312ca6b48..85ed18f4f 100644
--- a/ports/stm32f4/boards/feather_stm32f405_express/mpconfigboard.mk
+++ b/ports/stm/boards/feather_stm32f405_express/mpconfigboard.mk
@@ -7,15 +7,12 @@ USB_DEVICES = "CDC,MSC"
SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = GD25Q16C
-LONGINT_IMPL = MPZ
-MCU_SERIES = m4
-MCU_VARIANT = stm32f4
-MCU_SUB_VARIANT = stm32f405xx
-MCU_PACKAGE = 64
-CMSIS_MCU = STM32F405xx
+MCU_SERIES = F4
+MCU_VARIANT = STM32F405xx
+MCU_PACKAGE = LQFP64
-# Default includes filesystem, but uses external flash
+LD_COMMON = boards/common_default.ld
LD_DEFAULT = boards/STM32F405_default.ld
LD_BOOT = boards/STM32F405_boot.ld # UF2 boot option
UF2_OFFSET = 0x8010000
diff --git a/ports/stm32f4/boards/feather_stm32f405_express/pins.c b/ports/stm/boards/feather_stm32f405_express/pins.c
index ebc8fa337..ebc8fa337 100644
--- a/ports/stm32f4/boards/feather_stm32f405_express/pins.c
+++ b/ports/stm/boards/feather_stm32f405_express/pins.c
diff --git a/ports/stm32f4/boards/feather_stm32f405_express/stm32f4xx_hal_conf.h b/ports/stm/boards/feather_stm32f405_express/stm32f4xx_hal_conf.h
index 8031403a9..8031403a9 100644
--- a/ports/stm32f4/boards/feather_stm32f405_express/stm32f4xx_hal_conf.h
+++ b/ports/stm/boards/feather_stm32f405_express/stm32f4xx_hal_conf.h
diff --git a/ports/stm32f4/boards/meowbit_v121/board.c b/ports/stm/boards/meowbit_v121/board.c
index a0ae98824..68eed2926 100644
--- a/ports/stm32f4/boards/meowbit_v121/board.c
+++ b/ports/stm/boards/meowbit_v121/board.c
@@ -61,7 +61,7 @@ uint8_t display_init_sequence[] = {
0x3a, 1, 0x05, // COLMOD - 16bit color
0xe0, 0x10, 0x02, 0x1c, 0x07, 0x12,
0x37, 0x32, 0x29, 0x2d,
- 0x29, 0x25, 0x2B, 0x39,
+ 0x29, 0x25, 0x2B, 0x39,
0x00, 0x01, 0x03, 0x10, // _GMCTRP1 Gamma
0xe1, 0x10, 0x03, 0x1d, 0x07, 0x06,
0x2E, 0x2C, 0x29, 0x2D,
@@ -80,7 +80,9 @@ void board_init(void) {
&pin_PA08, // Command or data
&pin_PB12, // Chip select
&pin_PB10, // Reset
- 24000000);
+ 24000000, // Baudrate
+ 0, // Polarity
+ 0); // Phase
displayio_display_obj_t* display = &displays[0].display;
display->base.type = &displayio_display_type;
@@ -96,6 +98,7 @@ void board_init(void) {
false, // Pixels in a byte share a row. Only used for depth < 8
1, // bytes per cell. Only valid for depths < 8
false, // reverse_pixels_in_byte. Only valid for depths < 8
+ true, // reverse_pixels_in_word
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command
MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command
@@ -109,7 +112,8 @@ void board_init(void) {
false, // single_byte_bounds
false, // data_as_commands
true, // auto_refresh
- 60); // native_frames_per_second
+ 60, // native_frames_per_second
+ true); // backlight_on_high
}
bool board_requests_safe_mode(void) {
diff --git a/ports/stm32f4/boards/meowbit_v121/mpconfigboard.h b/ports/stm/boards/meowbit_v121/mpconfigboard.h
index c849e03b6..babf54a3a 100644
--- a/ports/stm32f4/boards/meowbit_v121/mpconfigboard.h
+++ b/ports/stm/boards/meowbit_v121/mpconfigboard.h
@@ -35,9 +35,9 @@
#define AUTORESET_DELAY_MS 500
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000)
-#define BOARD_OSC_DIV 12
-#define BOARD_NO_VBUS_SENSE
-#define BOARD_VTOR_DEFER //Leave VTOR relocation to bootloader
+#define BOARD_OSC_DIV (12)
+#define BOARD_NO_VBUS_SENSE (1)
+#define BOARD_VTOR_DEFER (1) //Leave VTOR relocation to bootloader
#define BOARD_USE_INTERNAL_SPI
// On-board flash
diff --git a/ports/stm32f4/boards/meowbit_v121/mpconfigboard.mk b/ports/stm/boards/meowbit_v121/mpconfigboard.mk
index dce69276d..cd8d3b548 100644
--- a/ports/stm32f4/boards/meowbit_v121/mpconfigboard.mk
+++ b/ports/stm/boards/meowbit_v121/mpconfigboard.mk
@@ -7,18 +7,15 @@ USB_DEVICES = "CDC,MSC"
SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = W25Q16JV_IQ
-LONGINT_IMPL = MPZ
+# INTERNAL_FLASH_FILESYSTEM = 1
BOOTLOADER_OFFSET = 0x8010000
-# INTERNAL_FLASH_FILESYSTEM = 1
-# LONGINT_IMPL = NONE
+MCU_SERIES = F4
+MCU_VARIANT = STM32F401xE
+MCU_PACKAGE = LQFP64
-MCU_SERIES = m4
-MCU_VARIANT = stm32f4
-MCU_SUB_VARIANT = stm32f401xe
-MCU_PACKAGE = 64
-CMSIS_MCU = STM32F401xE
-LD_FILE = boards/STM32F401_boot.ld
-# LD_FILE = boards/STM32F401_fs.ld # use for internal flash
+LD_COMMON = boards/common_default.ld
+LD_FILE = boards/STM32F401xe_boot.ld
+# LD_FILE = boards/STM32F401xe_fs.ld # use for internal flash
diff --git a/ports/stm32f4/boards/meowbit_v121/pins.c b/ports/stm/boards/meowbit_v121/pins.c
index af896fad8..af896fad8 100644
--- a/ports/stm32f4/boards/meowbit_v121/pins.c
+++ b/ports/stm/boards/meowbit_v121/pins.c
diff --git a/ports/stm32f4/boards/meowbit_v121/stm32f4xx_hal_conf.h b/ports/stm/boards/meowbit_v121/stm32f4xx_hal_conf.h
index 68a49b4ba..68a49b4ba 100644
--- a/ports/stm32f4/boards/meowbit_v121/stm32f4xx_hal_conf.h
+++ b/ports/stm/boards/meowbit_v121/stm32f4xx_hal_conf.h
diff --git a/ports/stm32f4/boards/stm32f412zg_discovery/board.c b/ports/stm/boards/nucleo_f767zi/board.c
index 4421970ee..4421970ee 100644
--- a/ports/stm32f4/boards/stm32f412zg_discovery/board.c
+++ b/ports/stm/boards/nucleo_f767zi/board.c
diff --git a/ports/stm/boards/nucleo_f767zi/mpconfigboard.h b/ports/stm/boards/nucleo_f767zi/mpconfigboard.h
new file mode 100644
index 000000000..b481a2835
--- /dev/null
+++ b/ports/stm/boards/nucleo_f767zi/mpconfigboard.h
@@ -0,0 +1,35 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Lucian Copeland 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.
+ */
+
+//Micropython setup
+
+#define MICROPY_HW_BOARD_NAME "NUCLEO STM32F767"
+#define MICROPY_HW_MCU_NAME "STM32F767"
+
+#define FLASH_SIZE (0x200000)
+#define FLASH_PAGE_SIZE (0x4000)
+
+#define BOARD_OSC_DIV (8)
diff --git a/ports/stm/boards/nucleo_f767zi/mpconfigboard.mk b/ports/stm/boards/nucleo_f767zi/mpconfigboard.mk
new file mode 100644
index 000000000..c8c2a3d2b
--- /dev/null
+++ b/ports/stm/boards/nucleo_f767zi/mpconfigboard.mk
@@ -0,0 +1,15 @@
+USB_VID = 0x239A
+USB_PID = 0x809A
+USB_PRODUCT = "Nucleo F767ZI - CPy"
+USB_MANUFACTURER = "STMicroelectronics"
+USB_DEVICES = "CDC,MSC"
+
+INTERNAL_FLASH_FILESYSTEM = 1
+
+MCU_SERIES = F7
+MCU_VARIANT = STM32F767xx
+MCU_PACKAGE = LQFP144
+
+LD_COMMON = boards/common_default.ld
+LD_FILE = boards/STM32F767_fs.ld
+
diff --git a/ports/stm/boards/nucleo_f767zi/pins.c b/ports/stm/boards/nucleo_f767zi/pins.c
new file mode 100644
index 000000000..9ecc38f01
--- /dev/null
+++ b/ports/stm/boards/nucleo_f767zi/pins.c
@@ -0,0 +1,142 @@
+#include "shared-bindings/board/__init__.h"
+
+STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
+{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA03) },
+{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PC00) },
+{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PC03) },
+{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PF03) },
+{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PF05) },
+{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PF10) },
+{ MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PB01) },
+{ MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PC02) },
+{ MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PF04) },
+{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PG09) },
+{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PG14) },
+{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PF15) },
+{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PE13) },
+{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PF14) },
+{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PE11) },
+{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PE09) },
+{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PF13) },
+{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PF12) },
+{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PD15) },
+{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PD14) },
+{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA07) },
+{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA06) },
+{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA05) },
+{ MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PB09) },
+{ MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PB08) },
+{ MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_PC06) },
+{ MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_PB15) },
+{ MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_PB13) },
+{ MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_PB12) },
+{ MP_ROM_QSTR(MP_QSTR_D20), MP_ROM_PTR(&pin_PA15) },
+{ MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_PC07) },
+{ MP_ROM_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_PB05) },
+{ MP_ROM_QSTR(MP_QSTR_D23), MP_ROM_PTR(&pin_PB03) },
+{ MP_ROM_QSTR(MP_QSTR_D24), MP_ROM_PTR(&pin_PA04) },
+{ MP_ROM_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_PB04) },
+{ MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_PB06) },
+{ MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_PB02) },
+{ MP_ROM_QSTR(MP_QSTR_D28), MP_ROM_PTR(&pin_PD13) },
+{ MP_ROM_QSTR(MP_QSTR_D29), MP_ROM_PTR(&pin_PD12) },
+{ MP_ROM_QSTR(MP_QSTR_D30), MP_ROM_PTR(&pin_PD11) },
+{ MP_ROM_QSTR(MP_QSTR_D31), MP_ROM_PTR(&pin_PE02) },
+{ MP_ROM_QSTR(MP_QSTR_D32), MP_ROM_PTR(&pin_PA00) },
+{ MP_ROM_QSTR(MP_QSTR_D33), MP_ROM_PTR(&pin_PB00) },
+{ MP_ROM_QSTR(MP_QSTR_D34), MP_ROM_PTR(&pin_PE00) },
+{ MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_PB11) },
+{ MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_PB10) },
+{ MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_PE15) },
+{ MP_ROM_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_PE14) },
+{ MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_PE12) },
+{ MP_ROM_QSTR(MP_QSTR_D40), MP_ROM_PTR(&pin_PE10) },
+{ MP_ROM_QSTR(MP_QSTR_D41), MP_ROM_PTR(&pin_PE07) },
+{ MP_ROM_QSTR(MP_QSTR_D42), MP_ROM_PTR(&pin_PE08) },
+{ MP_ROM_QSTR(MP_QSTR_D43), MP_ROM_PTR(&pin_PC08) },
+{ MP_ROM_QSTR(MP_QSTR_D44), MP_ROM_PTR(&pin_PC09) },
+{ MP_ROM_QSTR(MP_QSTR_D45), MP_ROM_PTR(&pin_PC10) },
+{ MP_ROM_QSTR(MP_QSTR_D46), MP_ROM_PTR(&pin_PC11) },
+{ MP_ROM_QSTR(MP_QSTR_D47), MP_ROM_PTR(&pin_PC12) },
+{ MP_ROM_QSTR(MP_QSTR_D48), MP_ROM_PTR(&pin_PD02) },
+{ MP_ROM_QSTR(MP_QSTR_D49), MP_ROM_PTR(&pin_PG02) },
+{ MP_ROM_QSTR(MP_QSTR_D50), MP_ROM_PTR(&pin_PG03) },
+{ MP_ROM_QSTR(MP_QSTR_D51), MP_ROM_PTR(&pin_PD07) },
+{ MP_ROM_QSTR(MP_QSTR_D52), MP_ROM_PTR(&pin_PD06) },
+{ MP_ROM_QSTR(MP_QSTR_D53), MP_ROM_PTR(&pin_PD05) },
+{ MP_ROM_QSTR(MP_QSTR_D54), MP_ROM_PTR(&pin_PD04) },
+{ MP_ROM_QSTR(MP_QSTR_D55), MP_ROM_PTR(&pin_PD03) },
+{ MP_ROM_QSTR(MP_QSTR_D56), MP_ROM_PTR(&pin_PE02) },
+{ MP_ROM_QSTR(MP_QSTR_D57), MP_ROM_PTR(&pin_PE04) },
+{ MP_ROM_QSTR(MP_QSTR_D58), MP_ROM_PTR(&pin_PE05) },
+{ MP_ROM_QSTR(MP_QSTR_D59), MP_ROM_PTR(&pin_PE06) },
+{ MP_ROM_QSTR(MP_QSTR_D60), MP_ROM_PTR(&pin_PE03) },
+{ MP_ROM_QSTR(MP_QSTR_D61), MP_ROM_PTR(&pin_PF08) },
+{ MP_ROM_QSTR(MP_QSTR_D62), MP_ROM_PTR(&pin_PF07) },
+{ MP_ROM_QSTR(MP_QSTR_D63), MP_ROM_PTR(&pin_PF09) },
+{ MP_ROM_QSTR(MP_QSTR_D64), MP_ROM_PTR(&pin_PG01) },
+{ MP_ROM_QSTR(MP_QSTR_D65), MP_ROM_PTR(&pin_PG00) },
+{ MP_ROM_QSTR(MP_QSTR_D66), MP_ROM_PTR(&pin_PD01) },
+{ MP_ROM_QSTR(MP_QSTR_D67), MP_ROM_PTR(&pin_PD00) },
+{ MP_ROM_QSTR(MP_QSTR_D68), MP_ROM_PTR(&pin_PF00) },
+{ MP_ROM_QSTR(MP_QSTR_D69), MP_ROM_PTR(&pin_PF01) },
+{ MP_ROM_QSTR(MP_QSTR_D70), MP_ROM_PTR(&pin_PF02) },
+{ MP_ROM_QSTR(MP_QSTR_D71), MP_ROM_PTR(&pin_PA07) },
+{ MP_ROM_QSTR(MP_QSTR_DAC1), MP_ROM_PTR(&pin_PA04) },
+{ MP_ROM_QSTR(MP_QSTR_DAC2), MP_ROM_PTR(&pin_PA05) },
+{ MP_ROM_QSTR(MP_QSTR_LED1), MP_ROM_PTR(&pin_PB00) },
+{ MP_ROM_QSTR(MP_QSTR_LED2), MP_ROM_PTR(&pin_PB07) },
+{ MP_ROM_QSTR(MP_QSTR_LED3), MP_ROM_PTR(&pin_PB14) },
+{ MP_ROM_QSTR(MP_QSTR_SW), MP_ROM_PTR(&pin_PC13) },
+{ MP_ROM_QSTR(MP_QSTR_SD_D0), MP_ROM_PTR(&pin_PC08) },
+{ MP_ROM_QSTR(MP_QSTR_SD_D1), MP_ROM_PTR(&pin_PC09) },
+{ MP_ROM_QSTR(MP_QSTR_SD_D2), MP_ROM_PTR(&pin_PC10) },
+{ MP_ROM_QSTR(MP_QSTR_SD_D3), MP_ROM_PTR(&pin_PC11) },
+{ MP_ROM_QSTR(MP_QSTR_SD_CMD), MP_ROM_PTR(&pin_PD02) },
+{ MP_ROM_QSTR(MP_QSTR_SD_CK), MP_ROM_PTR(&pin_PC12) },
+{ MP_ROM_QSTR(MP_QSTR_SD_SW), MP_ROM_PTR(&pin_PG02) },
+{ MP_ROM_QSTR(MP_QSTR_OTG_FS_POWER), MP_ROM_PTR(&pin_PG06) },
+{ MP_ROM_QSTR(MP_QSTR_OTG_FS_OVER_CURRENT), MP_ROM_PTR(&pin_PG07) },
+{ MP_ROM_QSTR(MP_QSTR_USB_VBUS), MP_ROM_PTR(&pin_PA09) },
+{ MP_ROM_QSTR(MP_QSTR_USB_ID), MP_ROM_PTR(&pin_PA10) },
+{ MP_ROM_QSTR(MP_QSTR_USB_DM), MP_ROM_PTR(&pin_PA11) },
+{ MP_ROM_QSTR(MP_QSTR_USB_DP), MP_ROM_PTR(&pin_PA12) },
+{ MP_ROM_QSTR(MP_QSTR_UART2_TX), MP_ROM_PTR(&pin_PD05) },
+{ MP_ROM_QSTR(MP_QSTR_UART2_RX), MP_ROM_PTR(&pin_PD06) },
+{ MP_ROM_QSTR(MP_QSTR_UART2_RTS), MP_ROM_PTR(&pin_PD04) },
+{ MP_ROM_QSTR(MP_QSTR_UART2_CTS), MP_ROM_PTR(&pin_PD03) },
+{ MP_ROM_QSTR(MP_QSTR_VCP_TX), MP_ROM_PTR(&pin_PD08) },
+{ MP_ROM_QSTR(MP_QSTR_VCP_RX), MP_ROM_PTR(&pin_PD09) },
+{ MP_ROM_QSTR(MP_QSTR_UART3_TX), MP_ROM_PTR(&pin_PD08) },
+{ MP_ROM_QSTR(MP_QSTR_UART3_RX), MP_ROM_PTR(&pin_PD09) },
+{ MP_ROM_QSTR(MP_QSTR_UART5_TX), MP_ROM_PTR(&pin_PB06) },
+{ MP_ROM_QSTR(MP_QSTR_UART5_RX), MP_ROM_PTR(&pin_PB12) },
+{ MP_ROM_QSTR(MP_QSTR_UART6_TX), MP_ROM_PTR(&pin_PC06) },
+{ MP_ROM_QSTR(MP_QSTR_UART6_RX), MP_ROM_PTR(&pin_PC07) },
+{ MP_ROM_QSTR(MP_QSTR_UART7_TX), MP_ROM_PTR(&pin_PF07) },
+{ MP_ROM_QSTR(MP_QSTR_UART7_RX), MP_ROM_PTR(&pin_PF06) },
+{ MP_ROM_QSTR(MP_QSTR_UART8_TX), MP_ROM_PTR(&pin_PE01) },
+{ MP_ROM_QSTR(MP_QSTR_UART8_RX), MP_ROM_PTR(&pin_PE00) },
+{ MP_ROM_QSTR(MP_QSTR_SPI3_NSS), MP_ROM_PTR(&pin_PA04) },
+{ MP_ROM_QSTR(MP_QSTR_SPI3_SCK), MP_ROM_PTR(&pin_PB03) },
+{ MP_ROM_QSTR(MP_QSTR_SPI3_MISO), MP_ROM_PTR(&pin_PB04) },
+{ MP_ROM_QSTR(MP_QSTR_SPI3_MOSI), MP_ROM_PTR(&pin_PB05) },
+{ MP_ROM_QSTR(MP_QSTR_I2C1_SDA), MP_ROM_PTR(&pin_PB09) },
+{ MP_ROM_QSTR(MP_QSTR_I2C1_SCL), MP_ROM_PTR(&pin_PB08) },
+{ MP_ROM_QSTR(MP_QSTR_I2C2_SDA), MP_ROM_PTR(&pin_PF00) },
+{ MP_ROM_QSTR(MP_QSTR_I2C2_SCL), MP_ROM_PTR(&pin_PF01) },
+{ MP_ROM_QSTR(MP_QSTR_I2C4_SCL), MP_ROM_PTR(&pin_PF14) },
+{ MP_ROM_QSTR(MP_QSTR_I2C4_SDA), MP_ROM_PTR(&pin_PF15) },
+{ MP_ROM_QSTR(MP_QSTR_ETH_MDC), MP_ROM_PTR(&pin_PC01) },
+{ MP_ROM_QSTR(MP_QSTR_ETH_MDIO), MP_ROM_PTR(&pin_PA02) },
+{ MP_ROM_QSTR(MP_QSTR_ETH_RMII_REF_CLK), MP_ROM_PTR(&pin_PA01) },
+{ MP_ROM_QSTR(MP_QSTR_ETH_RMII_CRS_DV), MP_ROM_PTR(&pin_PA07) },
+{ MP_ROM_QSTR(MP_QSTR_ETH_RMII_RXD0), MP_ROM_PTR(&pin_PC04) },
+{ MP_ROM_QSTR(MP_QSTR_ETH_RMII_RXD1), MP_ROM_PTR(&pin_PC05) },
+{ MP_ROM_QSTR(MP_QSTR_ETH_RMII_TX_EN), MP_ROM_PTR(&pin_PG11) },
+{ MP_ROM_QSTR(MP_QSTR_ETH_RMII_TXD0), MP_ROM_PTR(&pin_PG13) },
+{ MP_ROM_QSTR(MP_QSTR_ETH_RMII_TXD1), MP_ROM_PTR(&pin_PB13) },
+{ MP_ROM_QSTR(MP_QSTR_SWDIO), MP_ROM_PTR(&pin_PA13) },
+{ MP_ROM_QSTR(MP_QSTR_SWDCLK), MP_ROM_PTR(&pin_PA14) }
+};
+MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
diff --git a/ports/stm/boards/nucleo_f767zi/stm32f7xx_hal_conf.h b/ports/stm/boards/nucleo_f767zi/stm32f7xx_hal_conf.h
new file mode 100644
index 000000000..84699bd78
--- /dev/null
+++ b/ports/stm/boards/nucleo_f767zi/stm32f7xx_hal_conf.h
@@ -0,0 +1,445 @@
+/**
+ ******************************************************************************
+ * @file stm32f7xx_hal_conf_template.h
+ * @author MCD Application Team
+ * @brief HAL configuration template file.
+ * This file should be copied to the application folder and renamed
+ * to stm32f7xx_hal_conf.h.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
+ * All rights reserved.</center></h2>
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __STM32F7xx_HAL_CONF_H
+#define __STM32F7xx_HAL_CONF_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Exported types ------------------------------------------------------------*/
+/* Exported constants --------------------------------------------------------*/
+
+/* ########################## Module Selection ############################## */
+/**
+ * @brief This is the list of modules to be used in the HAL driver
+ */
+#define HAL_MODULE_ENABLED
+
+ #define HAL_ADC_MODULE_ENABLED
+/* #define HAL_CRYP_MODULE_ENABLED */
+/* #define HAL_CAN_MODULE_ENABLED */
+/* #define HAL_CEC_MODULE_ENABLED */
+/* #define HAL_CRC_MODULE_ENABLED */
+/* #define HAL_CRYP_MODULE_ENABLED */
+#define HAL_DAC_MODULE_ENABLED
+/* #define HAL_DCMI_MODULE_ENABLED */
+/* #define HAL_DMA2D_MODULE_ENABLED */
+#define HAL_ETH_MODULE_ENABLED
+/* #define HAL_NAND_MODULE_ENABLED */
+/* #define HAL_NOR_MODULE_ENABLED */
+/* #define HAL_SRAM_MODULE_ENABLED */
+/* #define HAL_SDRAM_MODULE_ENABLED */
+/* #define HAL_HASH_MODULE_ENABLED */
+/* #define HAL_I2S_MODULE_ENABLED */
+/* #define HAL_IWDG_MODULE_ENABLED */
+/* #define HAL_LPTIM_MODULE_ENABLED */
+/* #define HAL_LTDC_MODULE_ENABLED */
+/* #define HAL_QSPI_MODULE_ENABLED */
+/* #define HAL_RNG_MODULE_ENABLED */
+/* #define HAL_RTC_MODULE_ENABLED */
+/* #define HAL_SAI_MODULE_ENABLED */
+/* #define HAL_SD_MODULE_ENABLED */
+/* #define HAL_MMC_MODULE_ENABLED */
+/* #define HAL_SPDIFRX_MODULE_ENABLED */
+#define HAL_SPI_MODULE_ENABLED
+#define HAL_TIM_MODULE_ENABLED
+#define HAL_UART_MODULE_ENABLED
+/* #define HAL_USART_MODULE_ENABLED */
+/* #define HAL_IRDA_MODULE_ENABLED */
+/* #define HAL_SMARTCARD_MODULE_ENABLED */
+/* #define HAL_WWDG_MODULE_ENABLED */
+#define HAL_PCD_MODULE_ENABLED
+/* #define HAL_HCD_MODULE_ENABLED */
+/* #define HAL_DFSDM_MODULE_ENABLED */
+/* #define HAL_DSI_MODULE_ENABLED */
+/* #define HAL_JPEG_MODULE_ENABLED */
+/* #define HAL_MDIOS_MODULE_ENABLED */
+/* #define HAL_SMBUS_MODULE_ENABLED */
+/* #define HAL_EXTI_MODULE_ENABLED */
+#define HAL_GPIO_MODULE_ENABLED
+#define HAL_EXTI_MODULE_ENABLED
+#define HAL_DMA_MODULE_ENABLED
+#define HAL_RCC_MODULE_ENABLED
+#define HAL_FLASH_MODULE_ENABLED
+#define HAL_PWR_MODULE_ENABLED
+#define HAL_I2C_MODULE_ENABLED
+#define HAL_CORTEX_MODULE_ENABLED
+
+/* ########################## HSE/HSI Values adaptation ##################### */
+/**
+ * @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
+ * This value is used by the RCC HAL module to compute the system frequency
+ * (when HSE is used as system clock source, directly or through the PLL).
+ */
+#if !defined (HSE_VALUE)
+ #define HSE_VALUE ((uint32_t)8000000U) /*!< Value of the External oscillator in Hz */
+#endif /* HSE_VALUE */
+
+#if !defined (HSE_STARTUP_TIMEOUT)
+ #define HSE_STARTUP_TIMEOUT ((uint32_t)100U) /*!< Time out for HSE start up, in ms */
+#endif /* HSE_STARTUP_TIMEOUT */
+
+/**
+ * @brief Internal High Speed oscillator (HSI) value.
+ * This value is used by the RCC HAL module to compute the system frequency
+ * (when HSI is used as system clock source, directly or through the PLL).
+ */
+#if !defined (HSI_VALUE)
+ #define HSI_VALUE ((uint32_t)16000000U) /*!< Value of the Internal oscillator in Hz*/
+#endif /* HSI_VALUE */
+
+/**
+ * @brief Internal Low Speed oscillator (LSI) value.
+ */
+#if !defined (LSI_VALUE)
+ #define LSI_VALUE ((uint32_t)32000U) /*!< LSI Typical Value in Hz*/
+#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz
+ The real value may vary depending on the variations
+ in voltage and temperature. */
+/**
+ * @brief External Low Speed oscillator (LSE) value.
+ */
+#if !defined (LSE_VALUE)
+ #define LSE_VALUE ((uint32_t)32768U) /*!< Value of the External Low Speed oscillator in Hz */
+#endif /* LSE_VALUE */
+
+#if !defined (LSE_STARTUP_TIMEOUT)
+ #define LSE_STARTUP_TIMEOUT ((uint32_t)5000U) /*!< Time out for LSE start up, in ms */
+#endif /* LSE_STARTUP_TIMEOUT */
+
+/**
+ * @brief External clock source for I2S peripheral
+ * This value is used by the I2S HAL module to compute the I2S clock source
+ * frequency, this source is inserted directly through I2S_CKIN pad.
+ */
+#if !defined (EXTERNAL_CLOCK_VALUE)
+ #define EXTERNAL_CLOCK_VALUE ((uint32_t)12288000U) /*!< Value of the Internal oscillator in Hz*/
+#endif /* EXTERNAL_CLOCK_VALUE */
+
+/* Tip: To avoid modifying this file each time you need to use different HSE,
+ === you can define the HSE value in your toolchain compiler preprocessor. */
+
+/* ########################### System Configuration ######################### */
+/**
+ * @brief This is the HAL system configuration section
+ */
+#define VDD_VALUE ((uint32_t)3300U) /*!< Value of VDD in mv */
+#define TICK_INT_PRIORITY ((uint32_t)0U) /*!< tick interrupt priority */
+#define USE_RTOS 0U
+#define PREFETCH_ENABLE 0U
+#define ART_ACCLERATOR_ENABLE 0U /* To enable instruction cache and prefetch */
+
+/* ########################## Assert Selection ############################## */
+/**
+ * @brief Uncomment the line below to expanse the "assert_param" macro in the
+ * HAL drivers code
+ */
+/* #define USE_FULL_ASSERT 1U */
+
+/* ################## Ethernet peripheral configuration ##################### */
+
+/* Section 1 : Ethernet peripheral configuration */
+
+/* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */
+#define MAC_ADDR0 2U
+#define MAC_ADDR1 0U
+#define MAC_ADDR2 0U
+#define MAC_ADDR3 0U
+#define MAC_ADDR4 0U
+#define MAC_ADDR5 0U
+
+/* Definition of the Ethernet driver buffers size and count */
+#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */
+#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */
+#define ETH_RXBUFNB ((uint32_t)4U) /* 4 Rx buffers of size ETH_RX_BUF_SIZE */
+#define ETH_TXBUFNB ((uint32_t)4U) /* 4 Tx buffers of size ETH_TX_BUF_SIZE */
+
+/* Section 2: PHY configuration section */
+
+/* LAN8742A_PHY_ADDRESS Address*/
+#define LAN8742A_PHY_ADDRESS 0
+/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/
+#define PHY_RESET_DELAY ((uint32_t)0x000000FFU)
+/* PHY Configuration delay */
+#define PHY_CONFIG_DELAY ((uint32_t)0x00000FFFU)
+
+#define PHY_READ_TO ((uint32_t)0x0000FFFFU)
+#define PHY_WRITE_TO ((uint32_t)0x0000FFFFU)
+
+/* Section 3: Common PHY Registers */
+
+#define PHY_BCR ((uint16_t)0x00U) /*!< Transceiver Basic Control Register */
+#define PHY_BSR ((uint16_t)0x01U) /*!< Transceiver Basic Status Register */
+
+#define PHY_RESET ((uint16_t)0x8000U) /*!< PHY Reset */
+#define PHY_LOOPBACK ((uint16_t)0x4000U) /*!< Select loop-back mode */
+#define PHY_FULLDUPLEX_100M ((uint16_t)0x2100U) /*!< Set the full-duplex mode at 100 Mb/s */
+#define PHY_HALFDUPLEX_100M ((uint16_t)0x2000U) /*!< Set the half-duplex mode at 100 Mb/s */
+#define PHY_FULLDUPLEX_10M ((uint16_t)0x0100U) /*!< Set the full-duplex mode at 10 Mb/s */
+#define PHY_HALFDUPLEX_10M ((uint16_t)0x0000U) /*!< Set the half-duplex mode at 10 Mb/s */
+#define PHY_AUTONEGOTIATION ((uint16_t)0x1000U) /*!< Enable auto-negotiation function */
+#define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200U) /*!< Restart auto-negotiation function */
+#define PHY_POWERDOWN ((uint16_t)0x0800U) /*!< Select the power down mode */
+#define PHY_ISOLATE ((uint16_t)0x0400U) /*!< Isolate PHY from MII */
+
+#define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020U) /*!< Auto-Negotiation process completed */
+#define PHY_LINKED_STATUS ((uint16_t)0x0004U) /*!< Valid link established */
+#define PHY_JABBER_DETECTION ((uint16_t)0x0002U) /*!< Jabber condition detected */
+
+/* Section 4: Extended PHY Registers */
+#define PHY_SR ((uint16_t)0x1FU) /*!< PHY status register Offset */
+
+#define PHY_SPEED_STATUS ((uint16_t)0x0004U) /*!< PHY Speed mask */
+#define PHY_DUPLEX_STATUS ((uint16_t)0x0010U) /*!< PHY Duplex mask */
+
+#define PHY_ISFR ((uint16_t)0x001DU) /*!< PHY Interrupt Source Flag register Offset */
+#define PHY_ISFR_INT4 ((uint16_t)0x000BU) /*!< PHY Link down inturrupt */
+
+/* ################## SPI peripheral configuration ########################## */
+
+/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver
+* Activated: CRC code is present inside driver
+* Deactivated: CRC code cleaned from driver
+*/
+
+#define USE_SPI_CRC 0U
+
+/* Includes ------------------------------------------------------------------*/
+/**
+ * @brief Include module's header file
+ */
+
+#ifdef HAL_RCC_MODULE_ENABLED
+ #include "stm32f7xx_hal_rcc.h"
+#endif /* HAL_RCC_MODULE_ENABLED */
+
+#ifdef HAL_EXTI_MODULE_ENABLED
+ #include "stm32f7xx_hal_exti.h"
+#endif /* HAL_EXTI_MODULE_ENABLED */
+
+#ifdef HAL_GPIO_MODULE_ENABLED
+ #include "stm32f7xx_hal_gpio.h"
+#endif /* HAL_GPIO_MODULE_ENABLED */
+
+#ifdef HAL_DMA_MODULE_ENABLED
+ #include "stm32f7xx_hal_dma.h"
+#endif /* HAL_DMA_MODULE_ENABLED */
+
+#ifdef HAL_CORTEX_MODULE_ENABLED
+ #include "stm32f7xx_hal_cortex.h"
+#endif /* HAL_CORTEX_MODULE_ENABLED */
+
+#ifdef HAL_ADC_MODULE_ENABLED
+ #include "stm32f7xx_hal_adc.h"
+#endif /* HAL_ADC_MODULE_ENABLED */
+
+#ifdef HAL_CAN_MODULE_ENABLED
+ #include "stm32f7xx_hal_can.h"
+#endif /* HAL_CAN_MODULE_ENABLED */
+
+#ifdef HAL_CEC_MODULE_ENABLED
+ #include "stm32f7xx_hal_cec.h"
+#endif /* HAL_CEC_MODULE_ENABLED */
+
+#ifdef HAL_CRC_MODULE_ENABLED
+ #include "stm32f7xx_hal_crc.h"
+#endif /* HAL_CRC_MODULE_ENABLED */
+
+#ifdef HAL_CRYP_MODULE_ENABLED
+ #include "stm32f7xx_hal_cryp.h"
+#endif /* HAL_CRYP_MODULE_ENABLED */
+
+#ifdef HAL_DMA2D_MODULE_ENABLED
+ #include "stm32f7xx_hal_dma2d.h"
+#endif /* HAL_DMA2D_MODULE_ENABLED */
+
+#ifdef HAL_DAC_MODULE_ENABLED
+ #include "stm32f7xx_hal_dac.h"
+#endif /* HAL_DAC_MODULE_ENABLED */
+
+#ifdef HAL_DCMI_MODULE_ENABLED
+ #include "stm32f7xx_hal_dcmi.h"
+#endif /* HAL_DCMI_MODULE_ENABLED */
+
+#ifdef HAL_ETH_MODULE_ENABLED
+ #include "stm32f7xx_hal_eth.h"
+#endif /* HAL_ETH_MODULE_ENABLED */
+
+#ifdef HAL_FLASH_MODULE_ENABLED
+ #include "stm32f7xx_hal_flash.h"
+#endif /* HAL_FLASH_MODULE_ENABLED */
+
+#ifdef HAL_SRAM_MODULE_ENABLED
+ #include "stm32f7xx_hal_sram.h"
+#endif /* HAL_SRAM_MODULE_ENABLED */
+
+#ifdef HAL_NOR_MODULE_ENABLED
+ #include "stm32f7xx_hal_nor.h"
+#endif /* HAL_NOR_MODULE_ENABLED */
+
+#ifdef HAL_NAND_MODULE_ENABLED
+ #include "stm32f7xx_hal_nand.h"
+#endif /* HAL_NAND_MODULE_ENABLED */
+
+#ifdef HAL_SDRAM_MODULE_ENABLED
+ #include "stm32f7xx_hal_sdram.h"
+#endif /* HAL_SDRAM_MODULE_ENABLED */
+
+#ifdef HAL_HASH_MODULE_ENABLED
+ #include "stm32f7xx_hal_hash.h"
+#endif /* HAL_HASH_MODULE_ENABLED */
+
+#ifdef HAL_I2C_MODULE_ENABLED
+ #include "stm32f7xx_hal_i2c.h"
+#endif /* HAL_I2C_MODULE_ENABLED */
+
+#ifdef HAL_I2S_MODULE_ENABLED
+ #include "stm32f7xx_hal_i2s.h"
+#endif /* HAL_I2S_MODULE_ENABLED */
+
+#ifdef HAL_IWDG_MODULE_ENABLED
+ #include "stm32f7xx_hal_iwdg.h"
+#endif /* HAL_IWDG_MODULE_ENABLED */
+
+#ifdef HAL_LPTIM_MODULE_ENABLED
+ #include "stm32f7xx_hal_lptim.h"
+#endif /* HAL_LPTIM_MODULE_ENABLED */
+
+#ifdef HAL_LTDC_MODULE_ENABLED
+ #include "stm32f7xx_hal_ltdc.h"
+#endif /* HAL_LTDC_MODULE_ENABLED */
+
+#ifdef HAL_PWR_MODULE_ENABLED
+ #include "stm32f7xx_hal_pwr.h"
+#endif /* HAL_PWR_MODULE_ENABLED */
+
+#ifdef HAL_QSPI_MODULE_ENABLED
+ #include "stm32f7xx_hal_qspi.h"
+#endif /* HAL_QSPI_MODULE_ENABLED */
+
+#ifdef HAL_RNG_MODULE_ENABLED
+ #include "stm32f7xx_hal_rng.h"
+#endif /* HAL_RNG_MODULE_ENABLED */
+
+#ifdef HAL_RTC_MODULE_ENABLED
+ #include "stm32f7xx_hal_rtc.h"
+#endif /* HAL_RTC_MODULE_ENABLED */
+
+#ifdef HAL_SAI_MODULE_ENABLED
+ #include "stm32f7xx_hal_sai.h"
+#endif /* HAL_SAI_MODULE_ENABLED */
+
+#ifdef HAL_SD_MODULE_ENABLED
+ #include "stm32f7xx_hal_sd.h"
+#endif /* HAL_SD_MODULE_ENABLED */
+
+#ifdef HAL_MMC_MODULE_ENABLED
+ #include "stm32f7xx_hal_mmc.h"
+#endif /* HAL_MMC_MODULE_ENABLED */
+
+#ifdef HAL_SPDIFRX_MODULE_ENABLED
+ #include "stm32f7xx_hal_spdifrx.h"
+#endif /* HAL_SPDIFRX_MODULE_ENABLED */
+
+#ifdef HAL_SPI_MODULE_ENABLED
+ #include "stm32f7xx_hal_spi.h"
+#endif /* HAL_SPI_MODULE_ENABLED */
+
+#ifdef HAL_TIM_MODULE_ENABLED
+ #include "stm32f7xx_hal_tim.h"
+#endif /* HAL_TIM_MODULE_ENABLED */
+
+#ifdef HAL_UART_MODULE_ENABLED
+ #include "stm32f7xx_hal_uart.h"
+#endif /* HAL_UART_MODULE_ENABLED */
+
+#ifdef HAL_USART_MODULE_ENABLED
+ #include "stm32f7xx_hal_usart.h"
+#endif /* HAL_USART_MODULE_ENABLED */
+
+#ifdef HAL_IRDA_MODULE_ENABLED
+ #include "stm32f7xx_hal_irda.h"
+#endif /* HAL_IRDA_MODULE_ENABLED */
+
+#ifdef HAL_SMARTCARD_MODULE_ENABLED
+ #include "stm32f7xx_hal_smartcard.h"
+#endif /* HAL_SMARTCARD_MODULE_ENABLED */
+
+#ifdef HAL_WWDG_MODULE_ENABLED
+ #include "stm32f7xx_hal_wwdg.h"
+#endif /* HAL_WWDG_MODULE_ENABLED */
+
+#ifdef HAL_PCD_MODULE_ENABLED
+ #include "stm32f7xx_hal_pcd.h"
+#endif /* HAL_PCD_MODULE_ENABLED */
+
+#ifdef HAL_HCD_MODULE_ENABLED
+ #include "stm32f7xx_hal_hcd.h"
+#endif /* HAL_HCD_MODULE_ENABLED */
+
+#ifdef HAL_DFSDM_MODULE_ENABLED
+ #include "stm32f7xx_hal_dfsdm.h"
+#endif /* HAL_DFSDM_MODULE_ENABLED */
+
+#ifdef HAL_DSI_MODULE_ENABLED
+ #include "stm32f7xx_hal_dsi.h"
+#endif /* HAL_DSI_MODULE_ENABLED */
+
+#ifdef HAL_JPEG_MODULE_ENABLED
+ #include "stm32f7xx_hal_jpeg.h"
+#endif /* HAL_JPEG_MODULE_ENABLED */
+
+#ifdef HAL_MDIOS_MODULE_ENABLED
+ #include "stm32f7xx_hal_mdios.h"
+#endif /* HAL_MDIOS_MODULE_ENABLED */
+
+#ifdef HAL_SMBUS_MODULE_ENABLED
+ #include "stm32f7xx_hal_smbus.h"
+#endif /* HAL_SMBUS_MODULE_ENABLED */
+
+/* Exported macro ------------------------------------------------------------*/
+#ifdef USE_FULL_ASSERT
+/**
+ * @brief The assert_param macro is used for function's parameters check.
+ * @param expr: If expr is false, it calls assert_failed function
+ * which reports the name of the source file and the source
+ * line number of the call that failed.
+ * If expr is true, it returns no value.
+ * @retval None
+ */
+ #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
+/* Exported functions ------------------------------------------------------- */
+ void assert_failed(uint8_t* file, uint32_t line);
+#else
+ #define assert_param(expr) ((void)0U)
+#endif /* USE_FULL_ASSERT */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STM32F7xx_HAL_CONF_H */
+
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/ports/stm/boards/nucleo_h743zi_2/board.c b/ports/stm/boards/nucleo_h743zi_2/board.c
new file mode 100644
index 000000000..4421970ee
--- /dev/null
+++ b/ports/stm/boards/nucleo_h743zi_2/board.c
@@ -0,0 +1,38 @@
+/*
+ * 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) {
+
+}
diff --git a/ports/stm/boards/nucleo_h743zi_2/mpconfigboard.h b/ports/stm/boards/nucleo_h743zi_2/mpconfigboard.h
new file mode 100644
index 000000000..3678d8a39
--- /dev/null
+++ b/ports/stm/boards/nucleo_h743zi_2/mpconfigboard.h
@@ -0,0 +1,34 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Lucian Copeland 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.
+ */
+
+//Micropython setup
+
+#define MICROPY_HW_BOARD_NAME "NUCLEO STM32H743"
+#define MICROPY_HW_MCU_NAME "STM32H743"
+
+#define FLASH_PAGE_SIZE (0x4000)
+
+#define BOARD_OSC_DIV (8)
diff --git a/ports/stm/boards/nucleo_h743zi_2/mpconfigboard.mk b/ports/stm/boards/nucleo_h743zi_2/mpconfigboard.mk
new file mode 100644
index 000000000..01ace06a2
--- /dev/null
+++ b/ports/stm/boards/nucleo_h743zi_2/mpconfigboard.mk
@@ -0,0 +1,15 @@
+USB_VID = 0x239A
+USB_PID = 0x8098
+USB_PRODUCT = "Nucleo H743ZI - CPy"
+USB_MANUFACTURER = "STMicroelectronics"
+USB_DEVICES = "CDC,MSC"
+
+INTERNAL_FLASH_FILESYSTEM = 1
+
+MCU_SERIES = H7
+MCU_VARIANT = STM32H743xx
+MCU_PACKAGE = LQFP144
+
+LD_COMMON = boards/common_tcm.ld
+LD_FILE = boards/STM32H743_fs.ld
+
diff --git a/ports/stm/boards/nucleo_h743zi_2/pins.c b/ports/stm/boards/nucleo_h743zi_2/pins.c
new file mode 100644
index 000000000..d35f40dd2
--- /dev/null
+++ b/ports/stm/boards/nucleo_h743zi_2/pins.c
@@ -0,0 +1,98 @@
+#include "shared-bindings/board/__init__.h"
+
+STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA03) },
+ { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PC00) },
+ { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PC03) },
+ { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PB01) },
+ { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PC02) },
+ { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PF10) },
+ { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PF04) },
+ { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PF05) },
+ { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PF06) },
+ { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PB07) },
+ { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PB06) },
+ { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PG14) },
+ { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PE13) },
+ { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PE14) },
+ { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PE11) },
+ { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PE09) },
+ { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PG12) },
+ { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PF03) },
+ { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PD15) },
+ { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PD14) },
+ { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PB05) },
+ { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA06) },
+ { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA05) },
+ { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PB09) },
+ { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PB08) },
+ { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_PC06) },
+ { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_PB15) },
+ { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_PB13) },
+ { MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_PB12) },
+ { MP_ROM_QSTR(MP_QSTR_D20), MP_ROM_PTR(&pin_PA15) },
+ { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_PC07) },
+ { MP_ROM_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_PB05) },
+ { MP_ROM_QSTR(MP_QSTR_D23), MP_ROM_PTR(&pin_PB03) },
+ { MP_ROM_QSTR(MP_QSTR_D24), MP_ROM_PTR(&pin_PA04) },
+ { MP_ROM_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_PB04) },
+ { MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_PG06) },
+ { MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_PB02) },
+ { MP_ROM_QSTR(MP_QSTR_D28), MP_ROM_PTR(&pin_PD13) },
+ { MP_ROM_QSTR(MP_QSTR_D29), MP_ROM_PTR(&pin_PD12) },
+ { MP_ROM_QSTR(MP_QSTR_D30), MP_ROM_PTR(&pin_PD11) },
+ { MP_ROM_QSTR(MP_QSTR_D31), MP_ROM_PTR(&pin_PE02) },
+ { MP_ROM_QSTR(MP_QSTR_D32), MP_ROM_PTR(&pin_PA00) },
+ { MP_ROM_QSTR(MP_QSTR_D33), MP_ROM_PTR(&pin_PB00) },
+ { MP_ROM_QSTR(MP_QSTR_D34), MP_ROM_PTR(&pin_PE00) },
+ { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_PB11) },
+ { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_PB10) },
+ { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_PE15) },
+ { MP_ROM_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_PE06) },
+ { MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_PE12) },
+ { MP_ROM_QSTR(MP_QSTR_D40), MP_ROM_PTR(&pin_PE10) },
+ { MP_ROM_QSTR(MP_QSTR_D41), MP_ROM_PTR(&pin_PE07) },
+ { MP_ROM_QSTR(MP_QSTR_D42), MP_ROM_PTR(&pin_PE08) },
+ { MP_ROM_QSTR(MP_QSTR_D43), MP_ROM_PTR(&pin_PC08) },
+ { MP_ROM_QSTR(MP_QSTR_D44), MP_ROM_PTR(&pin_PC09) },
+ { MP_ROM_QSTR(MP_QSTR_D45), MP_ROM_PTR(&pin_PC10) },
+ { MP_ROM_QSTR(MP_QSTR_D46), MP_ROM_PTR(&pin_PC11) },
+ { MP_ROM_QSTR(MP_QSTR_D47), MP_ROM_PTR(&pin_PC12) },
+ { MP_ROM_QSTR(MP_QSTR_D48), MP_ROM_PTR(&pin_PD02) },
+ { MP_ROM_QSTR(MP_QSTR_D49), MP_ROM_PTR(&pin_PG02) },
+ { MP_ROM_QSTR(MP_QSTR_D50), MP_ROM_PTR(&pin_PG03) },
+ { MP_ROM_QSTR(MP_QSTR_D51), MP_ROM_PTR(&pin_PD07) },
+ { MP_ROM_QSTR(MP_QSTR_D52), MP_ROM_PTR(&pin_PD06) },
+ { MP_ROM_QSTR(MP_QSTR_D53), MP_ROM_PTR(&pin_PD05) },
+ { MP_ROM_QSTR(MP_QSTR_D54), MP_ROM_PTR(&pin_PD04) },
+ { MP_ROM_QSTR(MP_QSTR_D55), MP_ROM_PTR(&pin_PD03) },
+ { MP_ROM_QSTR(MP_QSTR_D56), MP_ROM_PTR(&pin_PE02) },
+ { MP_ROM_QSTR(MP_QSTR_D57), MP_ROM_PTR(&pin_PE04) },
+ { MP_ROM_QSTR(MP_QSTR_D58), MP_ROM_PTR(&pin_PE05) },
+ { MP_ROM_QSTR(MP_QSTR_D59), MP_ROM_PTR(&pin_PE06) },
+ { MP_ROM_QSTR(MP_QSTR_D60), MP_ROM_PTR(&pin_PE03) },
+ { MP_ROM_QSTR(MP_QSTR_D61), MP_ROM_PTR(&pin_PF08) },
+ { MP_ROM_QSTR(MP_QSTR_D62), MP_ROM_PTR(&pin_PF07) },
+ { MP_ROM_QSTR(MP_QSTR_D63), MP_ROM_PTR(&pin_PF09) },
+ { MP_ROM_QSTR(MP_QSTR_D64), MP_ROM_PTR(&pin_PG01) },
+ { MP_ROM_QSTR(MP_QSTR_D65), MP_ROM_PTR(&pin_PG00) },
+ { MP_ROM_QSTR(MP_QSTR_D66), MP_ROM_PTR(&pin_PD01) },
+ { MP_ROM_QSTR(MP_QSTR_D67), MP_ROM_PTR(&pin_PD00) },
+ { MP_ROM_QSTR(MP_QSTR_D68), MP_ROM_PTR(&pin_PF00) },
+ { MP_ROM_QSTR(MP_QSTR_D69), MP_ROM_PTR(&pin_PF01) },
+ { MP_ROM_QSTR(MP_QSTR_D70), MP_ROM_PTR(&pin_PF02) },
+ { MP_ROM_QSTR(MP_QSTR_D71), MP_ROM_PTR(&pin_PE00) },
+ { MP_ROM_QSTR(MP_QSTR_D72), MP_ROM_PTR(&pin_PB02) },
+ { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB09) },
+ { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB08) },
+ { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB05) },
+ { 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_RX), MP_ROM_PTR(&pin_PB07) },
+ { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB06) },
+ { MP_ROM_QSTR(MP_QSTR_LED1), MP_ROM_PTR(&pin_PB00) },
+ { MP_ROM_QSTR(MP_QSTR_LED2), MP_ROM_PTR(&pin_PE01) },
+ { MP_ROM_QSTR(MP_QSTR_LED3), MP_ROM_PTR(&pin_PB14) },
+ { MP_ROM_QSTR(MP_QSTR_SW), MP_ROM_PTR(&pin_PC13) },
+};
+MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
diff --git a/ports/stm/boards/nucleo_h743zi_2/stm32h7xx_hal_conf.h b/ports/stm/boards/nucleo_h743zi_2/stm32h7xx_hal_conf.h
new file mode 100644
index 000000000..e6a2dd5f8
--- /dev/null
+++ b/ports/stm/boards/nucleo_h743zi_2/stm32h7xx_hal_conf.h
@@ -0,0 +1,493 @@
+/**
+ ******************************************************************************
+ * @file stm32h7xx_hal_conf.h
+ * @author MCD Application Team
+ * @brief HAL configuration file.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
+ * All rights reserved.</center></h2>
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __STM32H7xx_HAL_CONF_H
+#define __STM32H7xx_HAL_CONF_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Exported types ------------------------------------------------------------*/
+/* Exported constants --------------------------------------------------------*/
+
+/* ########################## Module Selection ############################## */
+/**
+ * @brief This is the list of modules to be used in the HAL driver
+ */
+#define HAL_MODULE_ENABLED
+
+ #define HAL_ADC_MODULE_ENABLED
+/* #define HAL_FDCAN_MODULE_ENABLED */
+/* #define HAL_CEC_MODULE_ENABLED */
+/* #define HAL_COMP_MODULE_ENABLED */
+/* #define HAL_CRC_MODULE_ENABLED */
+/* #define HAL_CRYP_MODULE_ENABLED */
+#define HAL_DAC_MODULE_ENABLED
+/* #define HAL_DCMI_MODULE_ENABLED */
+/* #define HAL_DMA2D_MODULE_ENABLED */
+#define HAL_ETH_MODULE_ENABLED
+/* #define HAL_NAND_MODULE_ENABLED */
+/* #define HAL_NOR_MODULE_ENABLED */
+/* #define HAL_OTFDEC_MODULE_ENABLED */
+/* #define HAL_SRAM_MODULE_ENABLED */
+/* #define HAL_SDRAM_MODULE_ENABLED */
+/* #define HAL_HASH_MODULE_ENABLED */
+/* #define HAL_HRTIM_MODULE_ENABLED */
+/* #define HAL_HSEM_MODULE_ENABLED */
+/* #define HAL_GFXMMU_MODULE_ENABLED */
+/* #define HAL_JPEG_MODULE_ENABLED */
+/* #define HAL_OPAMP_MODULE_ENABLED */
+/* #define HAL_OSPI_MODULE_ENABLED */
+/* #define HAL_OSPI_MODULE_ENABLED */
+/* #define HAL_I2S_MODULE_ENABLED */
+/* #define HAL_SMBUS_MODULE_ENABLED */
+/* #define HAL_IWDG_MODULE_ENABLED */
+/* #define HAL_LPTIM_MODULE_ENABLED */
+/* #define HAL_LTDC_MODULE_ENABLED */
+/* #define HAL_QSPI_MODULE_ENABLED */
+#define HAL_RNG_MODULE_ENABLED
+/* #define HAL_RTC_MODULE_ENABLED */
+/* #define HAL_SAI_MODULE_ENABLED */
+/* #define HAL_SD_MODULE_ENABLED */
+/* #define HAL_MMC_MODULE_ENABLED */
+/* #define HAL_SPDIFRX_MODULE_ENABLED */
+#define HAL_SPI_MODULE_ENABLED
+/* #define HAL_SWPMI_MODULE_ENABLED */
+#define HAL_TIM_MODULE_ENABLED
+#define HAL_UART_MODULE_ENABLED
+/* #define HAL_USART_MODULE_ENABLED */
+/* #define HAL_IRDA_MODULE_ENABLED */
+/* #define HAL_SMARTCARD_MODULE_ENABLED */
+/* #define HAL_WWDG_MODULE_ENABLED */
+#define HAL_PCD_MODULE_ENABLED
+/* #define HAL_HCD_MODULE_ENABLED */
+/* #define HAL_DFSDM_MODULE_ENABLED */
+/* #define HAL_DSI_MODULE_ENABLED */
+/* #define HAL_JPEG_MODULE_ENABLED */
+/* #define HAL_MDIOS_MODULE_ENABLED */
+/* #define HAL_PSSI_MODULE_ENABLED */
+/* #define HAL_DTS_MODULE_ENABLED */
+#define HAL_GPIO_MODULE_ENABLED
+#define HAL_DMA_MODULE_ENABLED
+#define HAL_MDMA_MODULE_ENABLED
+#define HAL_RCC_MODULE_ENABLED
+#define HAL_FLASH_MODULE_ENABLED
+#define HAL_EXTI_MODULE_ENABLED
+#define HAL_PWR_MODULE_ENABLED
+#define HAL_I2C_MODULE_ENABLED
+#define HAL_CORTEX_MODULE_ENABLED
+#define HAL_HSEM_MODULE_ENABLED
+
+/* ########################## Oscillator Values adaptation ####################*/
+/**
+ * @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
+ * This value is used by the RCC HAL module to compute the system frequency
+ * (when HSE is used as system clock source, directly or through the PLL).
+ */
+#if !defined (HSE_VALUE)
+#define HSE_VALUE ((uint32_t)8000000) /*!< Value of the External oscillator in Hz : FPGA case fixed to 60MHZ */
+#endif /* HSE_VALUE */
+
+#if !defined (HSE_STARTUP_TIMEOUT)
+ #define HSE_STARTUP_TIMEOUT ((uint32_t)100U) /*!< Time out for HSE start up, in ms */
+#endif /* HSE_STARTUP_TIMEOUT */
+
+/**
+ * @brief Internal oscillator (CSI) default value.
+ * This value is the default CSI value after Reset.
+ */
+#if !defined (CSI_VALUE)
+ #define CSI_VALUE ((uint32_t)4000000) /*!< Value of the Internal oscillator in Hz*/
+#endif /* CSI_VALUE */
+
+/**
+ * @brief Internal High Speed oscillator (HSI) value.
+ * This value is used by the RCC HAL module to compute the system frequency
+ * (when HSI is used as system clock source, directly or through the PLL).
+ */
+#if !defined (HSI_VALUE)
+ #define HSI_VALUE ((uint32_t)64000000) /*!< Value of the Internal oscillator in Hz*/
+#endif /* HSI_VALUE */
+
+/**
+ * @brief External Low Speed oscillator (LSE) value.
+ * This value is used by the UART, RTC HAL module to compute the system frequency
+ */
+#if !defined (LSE_VALUE)
+ #define LSE_VALUE ((uint32_t)32768U) /*!< Value of the External oscillator in Hz*/
+#endif /* LSE_VALUE */
+
+#if !defined (LSE_STARTUP_TIMEOUT)
+ #define LSE_STARTUP_TIMEOUT ((uint32_t)5000U) /*!< Time out for LSE start up, in ms */
+#endif /* LSE_STARTUP_TIMEOUT */
+
+/**
+ * @brief External clock source for I2S peripheral
+ * This value is used by the I2S HAL module to compute the I2S clock source
+ * frequency, this source is inserted directly through I2S_CKIN pad.
+ */
+#if !defined (EXTERNAL_CLOCK_VALUE)
+ #define EXTERNAL_CLOCK_VALUE 12288000U /*!< Value of the External clock in Hz*/
+#endif /* EXTERNAL_CLOCK_VALUE */
+
+/* Tip: To avoid modifying this file each time you need to use different HSE,
+ === you can define the HSE value in your toolchain compiler preprocessor. */
+
+/* ########################### System Configuration ######################### */
+/**
+ * @brief This is the HAL system configuration section
+ */
+#define VDD_VALUE ((uint32_t)3300U) /*!< Value of VDD in mv */
+#define TICK_INT_PRIORITY ((uint32_t)0U) /*!< tick interrupt priority */
+#define USE_RTOS 0U
+#define USE_SD_TRANSCEIVER 0U /*!< use uSD Transceiver */
+
+#define USE_HAL_ADC_REGISTER_CALLBACKS 0U /* ADC register callback disabled */
+#define USE_HAL_CEC_REGISTER_CALLBACKS 0U /* CEC register callback disabled */
+#define USE_HAL_COMP_REGISTER_CALLBACKS 0U /* COMP register callback disabled */
+#define USE_HAL_CRYP_REGISTER_CALLBACKS 0U /* CRYP register callback disabled */
+#define USE_HAL_DAC_REGISTER_CALLBACKS 0U /* DAC register callback disabled */
+#define USE_HAL_DCMI_REGISTER_CALLBACKS 0U /* DCMI register callback disabled */
+#define USE_HAL_DFSDM_REGISTER_CALLBACKS 0U /* DFSDM register callback disabled */
+#define USE_HAL_DMA2D_REGISTER_CALLBACKS 0U /* DMA2D register callback disabled */
+#define USE_HAL_DSI_REGISTER_CALLBACKS 0U /* DSI register callback disabled */
+#define USE_HAL_DTS_REGISTER_CALLBACKS 0U /* DTS register callback disabled */
+#define USE_HAL_ETH_REGISTER_CALLBACKS 0U /* ETH register callback disabled */
+#define USE_HAL_FDCAN_REGISTER_CALLBACKS 0U /* FDCAN register callback disabled */
+#define USE_HAL_NAND_REGISTER_CALLBACKS 0U /* NAND register callback disabled */
+#define USE_HAL_NOR_REGISTER_CALLBACKS 0U /* NOR register callback disabled */
+#define USE_HAL_SDRAM_REGISTER_CALLBACKS 0U /* SDRAM register callback disabled */
+#define USE_HAL_SRAM_REGISTER_CALLBACKS 0U /* SRAM register callback disabled */
+#define USE_HAL_HASH_REGISTER_CALLBACKS 0U /* HASH register callback disabled */
+#define USE_HAL_HCD_REGISTER_CALLBACKS 0U /* HCD register callback disabled */
+#define USE_HAL_GFXMMU_REGISTER_CALLBACKS 0U /* GFXMMU register callback disabled */
+#define USE_HAL_HRTIM_REGISTER_CALLBACKS 0U /* HRTIM register callback disabled */
+#define USE_HAL_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */
+#define USE_HAL_I2S_REGISTER_CALLBACKS 0U /* I2S register callback disabled */
+#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */
+#define USE_HAL_JPEG_REGISTER_CALLBACKS 0U /* JPEG register callback disabled */
+#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0U /* LPTIM register callback disabled */
+#define USE_HAL_LTDC_REGISTER_CALLBACKS 0U /* LTDC register callback disabled */
+#define USE_HAL_MDIOS_REGISTER_CALLBACKS 0U /* MDIO register callback disabled */
+#define USE_HAL_MMC_REGISTER_CALLBACKS 0U /* MMC register callback disabled */
+#define USE_HAL_OPAMP_REGISTER_CALLBACKS 0U /* MDIO register callback disabled */
+#define USE_HAL_OSPI_REGISTER_CALLBACKS 0U /* OSPI register callback disabled */
+#define USE_HAL_OTFDEC_REGISTER_CALLBACKS 0U /* OTFDEC register callback disabled */
+#define USE_HAL_PCD_REGISTER_CALLBACKS 0U /* PCD register callback disabled */
+#define USE_HAL_QSPI_REGISTER_CALLBACKS 0U /* QSPI register callback disabled */
+#define USE_HAL_RNG_REGISTER_CALLBACKS 0U /* RNG register callback disabled */
+#define USE_HAL_RTC_REGISTER_CALLBACKS 0U /* RTC register callback disabled */
+#define USE_HAL_SAI_REGISTER_CALLBACKS 0U /* SAI register callback disabled */
+#define USE_HAL_SD_REGISTER_CALLBACKS 0U /* SD register callback disabled */
+#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD register callback disabled */
+#define USE_HAL_SPDIFRX_REGISTER_CALLBACKS 0U /* SPDIFRX register callback disabled */
+#define USE_HAL_SMBUS_REGISTER_CALLBACKS 0U /* SMBUS register callback disabled */
+#define USE_HAL_SPI_REGISTER_CALLBACKS 0U /* SPI register callback disabled */
+#define USE_HAL_SWPMI_REGISTER_CALLBACKS 0U /* SWPMI register callback disabled */
+#define USE_HAL_TIM_REGISTER_CALLBACKS 0U /* TIM register callback disabled */
+#define USE_HAL_UART_REGISTER_CALLBACKS 0U /* UART register callback disabled */
+#define USE_HAL_USART_REGISTER_CALLBACKS 0U /* USART register callback disabled */
+#define USE_HAL_WWDG_REGISTER_CALLBACKS 0U /* WWDG register callback disabled */
+
+/* ########################### Ethernet Configuration ######################### */
+#define ETH_TX_DESC_CNT 4 /* number of Ethernet Tx DMA descriptors */
+#define ETH_RX_DESC_CNT 4 /* number of Ethernet Rx DMA descriptors */
+
+#define ETH_MAC_ADDR0 ((uint8_t)0x02)
+#define ETH_MAC_ADDR1 ((uint8_t)0x00)
+#define ETH_MAC_ADDR2 ((uint8_t)0x00)
+#define ETH_MAC_ADDR3 ((uint8_t)0x00)
+#define ETH_MAC_ADDR4 ((uint8_t)0x00)
+#define ETH_MAC_ADDR5 ((uint8_t)0x00)
+
+/* ########################## Assert Selection ############################## */
+/**
+ * @brief Uncomment the line below to expanse the "assert_param" macro in the
+ * HAL drivers code
+ */
+/* #define USE_FULL_ASSERT 1U */
+
+/* Includes ------------------------------------------------------------------*/
+/**
+ * @brief Include module's header file
+ */
+
+#ifdef HAL_RCC_MODULE_ENABLED
+ #include "stm32h7xx_hal_rcc.h"
+#endif /* HAL_RCC_MODULE_ENABLED */
+
+#ifdef HAL_GPIO_MODULE_ENABLED
+ #include "stm32h7xx_hal_gpio.h"
+#endif /* HAL_GPIO_MODULE_ENABLED */
+
+#ifdef HAL_DMA_MODULE_ENABLED
+ #include "stm32h7xx_hal_dma.h"
+#endif /* HAL_DMA_MODULE_ENABLED */
+
+#ifdef HAL_MDMA_MODULE_ENABLED
+ #include "stm32h7xx_hal_mdma.h"
+#endif /* HAL_MDMA_MODULE_ENABLED */
+
+#ifdef HAL_HASH_MODULE_ENABLED
+ #include "stm32h7xx_hal_hash.h"
+#endif /* HAL_HASH_MODULE_ENABLED */
+
+#ifdef HAL_DCMI_MODULE_ENABLED
+ #include "stm32h7xx_hal_dcmi.h"
+#endif /* HAL_DCMI_MODULE_ENABLED */
+
+#ifdef HAL_DMA2D_MODULE_ENABLED
+ #include "stm32h7xx_hal_dma2d.h"
+#endif /* HAL_DMA2D_MODULE_ENABLED */
+
+#ifdef HAL_DSI_MODULE_ENABLED
+ #include "stm32h7xx_hal_dsi.h"
+#endif /* HAL_DSI_MODULE_ENABLED */
+
+#ifdef HAL_DFSDM_MODULE_ENABLED
+ #include "stm32h7xx_hal_dfsdm.h"
+#endif /* HAL_DFSDM_MODULE_ENABLED */
+
+#ifdef HAL_ETH_MODULE_ENABLED
+ #include "stm32h7xx_hal_eth.h"
+#endif /* HAL_ETH_MODULE_ENABLED */
+
+#ifdef HAL_EXTI_MODULE_ENABLED
+ #include "stm32h7xx_hal_exti.h"
+#endif /* HAL_EXTI_MODULE_ENABLED */
+
+#ifdef HAL_CORTEX_MODULE_ENABLED
+ #include "stm32h7xx_hal_cortex.h"
+#endif /* HAL_CORTEX_MODULE_ENABLED */
+
+#ifdef HAL_ADC_MODULE_ENABLED
+ #include "stm32h7xx_hal_adc.h"
+#endif /* HAL_ADC_MODULE_ENABLED */
+
+#ifdef HAL_FDCAN_MODULE_ENABLED
+ #include "stm32h7xx_hal_fdcan.h"
+#endif /* HAL_FDCAN_MODULE_ENABLED */
+
+#ifdef HAL_CEC_MODULE_ENABLED
+ #include "stm32h7xx_hal_cec.h"
+#endif /* HAL_CEC_MODULE_ENABLED */
+
+#ifdef HAL_COMP_MODULE_ENABLED
+ #include "stm32h7xx_hal_comp.h"
+#endif /* HAL_COMP_MODULE_ENABLED */
+
+#ifdef HAL_CRC_MODULE_ENABLED
+ #include "stm32h7xx_hal_crc.h"
+#endif /* HAL_CRC_MODULE_ENABLED */
+
+#ifdef HAL_CRYP_MODULE_ENABLED
+ #include "stm32h7xx_hal_cryp.h"
+#endif /* HAL_CRYP_MODULE_ENABLED */
+
+#ifdef HAL_DAC_MODULE_ENABLED
+ #include "stm32h7xx_hal_dac.h"
+#endif /* HAL_DAC_MODULE_ENABLED */
+
+#ifdef HAL_FLASH_MODULE_ENABLED
+ #include "stm32h7xx_hal_flash.h"
+#endif /* HAL_FLASH_MODULE_ENABLED */
+
+#ifdef HAL_GFXMMU_MODULE_ENABLED
+ #include "stm32h7xx_hal_gfxmmu.h"
+#endif /* HAL_GFXMMU_MODULE_ENABLED */
+
+#ifdef HAL_HRTIM_MODULE_ENABLED
+ #include "stm32h7xx_hal_hrtim.h"
+#endif /* HAL_HRTIM_MODULE_ENABLED */
+
+#ifdef HAL_HSEM_MODULE_ENABLED
+ #include "stm32h7xx_hal_hsem.h"
+#endif /* HAL_HSEM_MODULE_ENABLED */
+
+#ifdef HAL_SRAM_MODULE_ENABLED
+ #include "stm32h7xx_hal_sram.h"
+#endif /* HAL_SRAM_MODULE_ENABLED */
+
+#ifdef HAL_NOR_MODULE_ENABLED
+ #include "stm32h7xx_hal_nor.h"
+#endif /* HAL_NOR_MODULE_ENABLED */
+
+#ifdef HAL_NAND_MODULE_ENABLED
+ #include "stm32h7xx_hal_nand.h"
+#endif /* HAL_NAND_MODULE_ENABLED */
+
+#ifdef HAL_I2C_MODULE_ENABLED
+ #include "stm32h7xx_hal_i2c.h"
+#endif /* HAL_I2C_MODULE_ENABLED */
+
+#ifdef HAL_I2S_MODULE_ENABLED
+ #include "stm32h7xx_hal_i2s.h"
+#endif /* HAL_I2S_MODULE_ENABLED */
+
+#ifdef HAL_IWDG_MODULE_ENABLED
+ #include "stm32h7xx_hal_iwdg.h"
+#endif /* HAL_IWDG_MODULE_ENABLED */
+
+#ifdef HAL_JPEG_MODULE_ENABLED
+ #include "stm32h7xx_hal_jpeg.h"
+#endif /* HAL_JPEG_MODULE_ENABLED */
+
+#ifdef HAL_MDIOS_MODULE_ENABLED
+ #include "stm32h7xx_hal_mdios.h"
+#endif /* HAL_MDIOS_MODULE_ENABLED */
+
+#ifdef HAL_MMC_MODULE_ENABLED
+ #include "stm32h7xx_hal_mmc.h"
+#endif /* HAL_MMC_MODULE_ENABLED */
+
+#ifdef HAL_LPTIM_MODULE_ENABLED
+#include "stm32h7xx_hal_lptim.h"
+#endif /* HAL_LPTIM_MODULE_ENABLED */
+
+#ifdef HAL_LTDC_MODULE_ENABLED
+#include "stm32h7xx_hal_ltdc.h"
+#endif /* HAL_LTDC_MODULE_ENABLED */
+
+#ifdef HAL_OPAMP_MODULE_ENABLED
+#include "stm32h7xx_hal_opamp.h"
+#endif /* HAL_OPAMP_MODULE_ENABLED */
+
+#ifdef HAL_OSPI_MODULE_ENABLED
+ #include "stm32h7xx_hal_ospi.h"
+#endif /* HAL_OSPI_MODULE_ENABLED */
+
+#ifdef HAL_OTFDEC_MODULE_ENABLED
+#include "stm32h7xx_hal_otfdec.h"
+#endif /* HAL_OTFDEC_MODULE_ENABLED */
+
+#ifdef HAL_PWR_MODULE_ENABLED
+ #include "stm32h7xx_hal_pwr.h"
+#endif /* HAL_PWR_MODULE_ENABLED */
+
+#ifdef HAL_QSPI_MODULE_ENABLED
+ #include "stm32h7xx_hal_qspi.h"
+#endif /* HAL_QSPI_MODULE_ENABLED */
+
+#ifdef HAL_RAMECC_MODULE_ENABLED
+ #include "stm32h7xx_hal_ramecc.h"
+#endif /* HAL_HCD_MODULE_ENABLED */
+
+#ifdef HAL_RNG_MODULE_ENABLED
+ #include "stm32h7xx_hal_rng.h"
+#endif /* HAL_RNG_MODULE_ENABLED */
+
+#ifdef HAL_RTC_MODULE_ENABLED
+ #include "stm32h7xx_hal_rtc.h"
+#endif /* HAL_RTC_MODULE_ENABLED */
+
+#ifdef HAL_SAI_MODULE_ENABLED
+ #include "stm32h7xx_hal_sai.h"
+#endif /* HAL_SAI_MODULE_ENABLED */
+
+#ifdef HAL_SD_MODULE_ENABLED
+ #include "stm32h7xx_hal_sd.h"
+#endif /* HAL_SD_MODULE_ENABLED */
+
+#ifdef HAL_SDRAM_MODULE_ENABLED
+ #include "stm32h7xx_hal_sdram.h"
+#endif /* HAL_SDRAM_MODULE_ENABLED */
+
+#ifdef HAL_SPI_MODULE_ENABLED
+ #include "stm32h7xx_hal_spi.h"
+#endif /* HAL_SPI_MODULE_ENABLED */
+
+#ifdef HAL_SPDIFRX_MODULE_ENABLED
+ #include "stm32h7xx_hal_spdifrx.h"
+#endif /* HAL_SPDIFRX_MODULE_ENABLED */
+
+#ifdef HAL_SWPMI_MODULE_ENABLED
+ #include "stm32h7xx_hal_swpmi.h"
+#endif /* HAL_SWPMI_MODULE_ENABLED */
+
+#ifdef HAL_TIM_MODULE_ENABLED
+ #include "stm32h7xx_hal_tim.h"
+#endif /* HAL_TIM_MODULE_ENABLED */
+
+#ifdef HAL_UART_MODULE_ENABLED
+ #include "stm32h7xx_hal_uart.h"
+#endif /* HAL_UART_MODULE_ENABLED */
+
+#ifdef HAL_USART_MODULE_ENABLED
+ #include "stm32h7xx_hal_usart.h"
+#endif /* HAL_USART_MODULE_ENABLED */
+
+#ifdef HAL_IRDA_MODULE_ENABLED
+ #include "stm32h7xx_hal_irda.h"
+#endif /* HAL_IRDA_MODULE_ENABLED */
+
+#ifdef HAL_SMARTCARD_MODULE_ENABLED
+ #include "stm32h7xx_hal_smartcard.h"
+#endif /* HAL_SMARTCARD_MODULE_ENABLED */
+
+#ifdef HAL_SMBUS_MODULE_ENABLED
+ #include "stm32h7xx_hal_smbus.h"
+#endif /* HAL_SMBUS_MODULE_ENABLED */
+
+#ifdef HAL_WWDG_MODULE_ENABLED
+ #include "stm32h7xx_hal_wwdg.h"
+#endif /* HAL_WWDG_MODULE_ENABLED */
+
+#ifdef HAL_PCD_MODULE_ENABLED
+ #include "stm32h7xx_hal_pcd.h"
+#endif /* HAL_PCD_MODULE_ENABLED */
+
+#ifdef HAL_HCD_MODULE_ENABLED
+ #include "stm32h7xx_hal_hcd.h"
+#endif /* HAL_HCD_MODULE_ENABLED */
+
+#ifdef HAL_PSSI_MODULE_ENABLED
+ #include "stm32h7xx_hal_pssi.h"
+#endif /* HAL_PSSI_MODULE_ENABLED */
+
+#ifdef HAL_DTS_MODULE_ENABLED
+ #include "stm32h7xx_hal_dts.h"
+#endif /* HAL_DTS_MODULE_ENABLED */
+
+/* Exported macro ------------------------------------------------------------*/
+#ifdef USE_FULL_ASSERT
+/**
+ * @brief The assert_param macro is used for function's parameters check.
+ * @param expr: If expr is false, it calls assert_failed function
+ * which reports the name of the source file and the source
+ * line number of the call that failed.
+ * If expr is true, it returns no value.
+ * @retval None
+ */
+ #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
+/* Exported functions ------------------------------------------------------- */
+ void assert_failed(uint8_t* file, uint32_t line);
+#else
+ #define assert_param(expr) ((void)0U)
+#endif /* USE_FULL_ASSERT */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STM32H7xx_HAL_CONF_H */
+
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/ports/stm32f4/boards/openocd_stm32f4.cfg b/ports/stm/boards/openocd_stm32f4.cfg
index 19631a7c8..19631a7c8 100644
--- a/ports/stm32f4/boards/openocd_stm32f4.cfg
+++ b/ports/stm/boards/openocd_stm32f4.cfg
diff --git a/ports/stm32f4/boards/stm32f411ce_blackpill/board.c b/ports/stm/boards/pyb_nano_v2/board.c
index 82b0c506e..82b0c506e 100644
--- a/ports/stm32f4/boards/stm32f411ce_blackpill/board.c
+++ b/ports/stm/boards/pyb_nano_v2/board.c
diff --git a/ports/stm32f4/boards/pyb_nano_v2/mpconfigboard.h b/ports/stm/boards/pyb_nano_v2/mpconfigboard.h
index 7980ca93d..965e7d5ff 100644
--- a/ports/stm32f4/boards/pyb_nano_v2/mpconfigboard.h
+++ b/ports/stm/boards/pyb_nano_v2/mpconfigboard.h
@@ -32,7 +32,7 @@
#define FLASH_SIZE (0x80000)
#define FLASH_PAGE_SIZE (0x4000)
-#define BOARD_OSC_DIV 8
+#define BOARD_OSC_DIV (8)
// On-board flash
#define SPI_FLASH_MOSI_PIN (&pin_PB15)
@@ -40,8 +40,8 @@
#define SPI_FLASH_SCK_PIN (&pin_PB13)
#define SPI_FLASH_CS_PIN (&pin_PB12)
-#define CIRCUITPY_AUTORELOAD_DELAY_MS 500
+#define CIRCUITPY_AUTORELOAD_DELAY_MS (500)
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x2000 - 0xC000)
-#define AUTORESET_DELAY_MS 500
+#define AUTORESET_DELAY_MS (500)
diff --git a/ports/stm32f4/boards/pyb_nano_v2/mpconfigboard.mk b/ports/stm/boards/pyb_nano_v2/mpconfigboard.mk
index a8472608b..0a06852fb 100644
--- a/ports/stm32f4/boards/pyb_nano_v2/mpconfigboard.mk
+++ b/ports/stm/boards/pyb_nano_v2/mpconfigboard.mk
@@ -7,12 +7,11 @@ USB_DEVICES = "CDC,MSC"
SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = W25Q64JV_IQ
-LONGINT_IMPL = MPZ
-MCU_SERIES = m4
-MCU_VARIANT = stm32f4
-MCU_SUB_VARIANT = stm32f411xe
-MCU_PACKAGE = 48
-CMSIS_MCU = STM32F411xE
-LD_FILE = boards/STM32F411VETx_FLASH.ld
+MCU_SERIES = F4
+MCU_VARIANT = STM32F411xE
+MCU_PACKAGE = UFQFPN48
+
+LD_COMMON = boards/common_default.ld
+LD_FILE = boards/STM32F411_fs.ld
diff --git a/ports/stm32f4/boards/pyb_nano_v2/pins.c b/ports/stm/boards/pyb_nano_v2/pins.c
index e10124f6a..e10124f6a 100644
--- a/ports/stm32f4/boards/pyb_nano_v2/pins.c
+++ b/ports/stm/boards/pyb_nano_v2/pins.c
diff --git a/ports/stm/boards/pyb_nano_v2/stm32f4xx_hal_conf.h b/ports/stm/boards/pyb_nano_v2/stm32f4xx_hal_conf.h
new file mode 100644
index 000000000..ab04df318
--- /dev/null
+++ b/ports/stm/boards/pyb_nano_v2/stm32f4xx_hal_conf.h
@@ -0,0 +1,440 @@
+/**
+ ******************************************************************************
+ * @file stm32f4xx_hal_conf_template.h
+ * @author MCD Application Team
+ * @brief HAL configuration template file.
+ * This file should be copied to the application folder and renamed
+ * to stm32f4xx_hal_conf.h.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
+ * All rights reserved.</center></h2>
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __STM32F4xx_HAL_CONF_H
+#define __STM32F4xx_HAL_CONF_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Exported types ------------------------------------------------------------*/
+/* Exported constants --------------------------------------------------------*/
+
+/* ########################## Module Selection ############################## */
+/**
+ * @brief This is the list of modules to be used in the HAL driver
+ */
+#define HAL_MODULE_ENABLED
+
+#define HAL_ADC_MODULE_ENABLED
+/* #define HAL_CRYP_MODULE_ENABLED */
+/* #define HAL_CAN_MODULE_ENABLED */
+/* #define HAL_CRC_MODULE_ENABLED */
+/* #define HAL_CRYP_MODULE_ENABLED */
+#define HAL_DAC_MODULE_ENABLED
+/* #define HAL_DCMI_MODULE_ENABLED */
+/* #define HAL_DMA2D_MODULE_ENABLED */
+/* #define HAL_ETH_MODULE_ENABLED */
+/* #define HAL_NAND_MODULE_ENABLED */
+/* #define HAL_NOR_MODULE_ENABLED */
+/* #define HAL_PCCARD_MODULE_ENABLED */
+/* #define HAL_SRAM_MODULE_ENABLED */
+/* #define HAL_SDRAM_MODULE_ENABLED */
+/* #define HAL_HASH_MODULE_ENABLED */
+#define HAL_I2C_MODULE_ENABLED
+#define HAL_I2S_MODULE_ENABLED
+/* #define HAL_IWDG_MODULE_ENABLED */
+/* #define HAL_LTDC_MODULE_ENABLED */
+/* #define HAL_RNG_MODULE_ENABLED */
+/* #define HAL_RTC_MODULE_ENABLED */
+/* #define HAL_SAI_MODULE_ENABLED */
+/* #define HAL_SD_MODULE_ENABLED */
+/* #define HAL_MMC_MODULE_ENABLED */
+#define HAL_SPI_MODULE_ENABLED
+#define HAL_TIM_MODULE_ENABLED
+#define HAL_UART_MODULE_ENABLED
+#define HAL_USART_MODULE_ENABLED
+/* #define HAL_IRDA_MODULE_ENABLED */
+/* #define HAL_SMARTCARD_MODULE_ENABLED */
+/* #define HAL_WWDG_MODULE_ENABLED */
+#define HAL_PCD_MODULE_ENABLED
+/* #define HAL_HCD_MODULE_ENABLED */
+/* #define HAL_DSI_MODULE_ENABLED */
+/* #define HAL_QSPI_MODULE_ENABLED */
+/* #define HAL_QSPI_MODULE_ENABLED */
+/* #define HAL_CEC_MODULE_ENABLED */
+/* #define HAL_FMPI2C_MODULE_ENABLED */
+/* #define HAL_SPDIFRX_MODULE_ENABLED */
+/* #define HAL_DFSDM_MODULE_ENABLED */
+/* #define HAL_LPTIM_MODULE_ENABLED */
+/* #define HAL_EXTI_MODULE_ENABLED */
+#define HAL_GPIO_MODULE_ENABLED
+#define HAL_EXTI_MODULE_ENABLED
+#define HAL_DMA_MODULE_ENABLED
+#define HAL_RCC_MODULE_ENABLED
+#define HAL_FLASH_MODULE_ENABLED
+#define HAL_PWR_MODULE_ENABLED
+#define HAL_CORTEX_MODULE_ENABLED
+
+/* ########################## HSE/HSI Values adaptation ##################### */
+/**
+ * @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
+ * This value is used by the RCC HAL module to compute the system frequency
+ * (when HSE is used as system clock source, directly or through the PLL).
+ */
+#if !defined (HSE_VALUE)
+ #define HSE_VALUE ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */
+#endif /* HSE_VALUE */
+
+#if !defined (HSE_STARTUP_TIMEOUT)
+ #define HSE_STARTUP_TIMEOUT ((uint32_t)100U) /*!< Time out for HSE start up, in ms */
+#endif /* HSE_STARTUP_TIMEOUT */
+
+/**
+ * @brief Internal High Speed oscillator (HSI) value.
+ * This value is used by the RCC HAL module to compute the system frequency
+ * (when HSI is used as system clock source, directly or through the PLL).
+ */
+#if !defined (HSI_VALUE)
+ #define HSI_VALUE ((uint32_t)16000000) /*!< Value of the Internal oscillator in Hz*/
+#endif /* HSI_VALUE */
+
+/**
+ * @brief Internal Low Speed oscillator (LSI) value.
+ */
+#if !defined (LSI_VALUE)
+ #define LSI_VALUE ((uint32_t)40000)
+#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz
+ The real value may vary depending on the variations
+ in voltage and temperature. */
+/**
+ * @brief External Low Speed oscillator (LSE) value.
+ */
+#if !defined (LSE_VALUE)
+ #define LSE_VALUE ((uint32_t)32768) /*!< Value of the External Low Speed oscillator in Hz */
+#endif /* LSE_VALUE */
+
+#if !defined (LSE_STARTUP_TIMEOUT)
+ #define LSE_STARTUP_TIMEOUT ((uint32_t)5000U) /*!< Time out for LSE start up, in ms */
+#endif /* LSE_STARTUP_TIMEOUT */
+
+
+/**
+ * @brief External clock source for I2S peripheral
+ * This value is used by the I2S HAL module to compute the I2S clock source
+ * frequency, this source is inserted directly through I2S_CKIN pad.
+ */
+#if !defined (EXTERNAL_CLOCK_VALUE)
+ #define EXTERNAL_CLOCK_VALUE ((uint32_t)12288000U) /*!< Value of the External audio frequency in Hz*/
+#endif /* EXTERNAL_CLOCK_VALUE */
+
+/* Tip: To avoid modifying this file each time you need to use different HSE,
+ === you can define the HSE value in your toolchain compiler preprocessor. */
+
+/* ########################### System Configuration ######################### */
+/**
+ * @brief This is the HAL system configuration section
+ */
+#define VDD_VALUE ((uint32_t)3300U) /*!< Value of VDD in mv */
+#define TICK_INT_PRIORITY ((uint32_t)0U) /*!< tick interrupt priority */
+#define USE_RTOS 0U
+#define PREFETCH_ENABLE 1U
+#define INSTRUCTION_CACHE_ENABLE 1U
+#define DATA_CACHE_ENABLE 1U
+
+/* ########################## Assert Selection ############################## */
+/**
+ * @brief Uncomment the line below to expanse the "assert_param" macro in the
+ * HAL drivers code
+ */
+/* #define USE_FULL_ASSERT 1U */
+
+/* ################## Ethernet peripheral configuration ##################### */
+
+/* Section 1 : Ethernet peripheral configuration */
+
+/* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */
+#define MAC_ADDR0 2U
+#define MAC_ADDR1 0U
+#define MAC_ADDR2 0U
+#define MAC_ADDR3 0U
+#define MAC_ADDR4 0U
+#define MAC_ADDR5 0U
+
+/* Definition of the Ethernet driver buffers size and count */
+#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */
+#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */
+#define ETH_RXBUFNB ((uint32_t)4U) /* 4 Rx buffers of size ETH_RX_BUF_SIZE */
+#define ETH_TXBUFNB ((uint32_t)4U) /* 4 Tx buffers of size ETH_TX_BUF_SIZE */
+
+/* Section 2: PHY configuration section */
+
+/* DP83848_PHY_ADDRESS Address*/
+#define DP83848_PHY_ADDRESS 0x01U
+/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/
+#define PHY_RESET_DELAY ((uint32_t)0x000000FFU)
+/* PHY Configuration delay */
+#define PHY_CONFIG_DELAY ((uint32_t)0x00000FFFU)
+
+#define PHY_READ_TO ((uint32_t)0x0000FFFFU)
+#define PHY_WRITE_TO ((uint32_t)0x0000FFFFU)
+
+/* Section 3: Common PHY Registers */
+
+#define PHY_BCR ((uint16_t)0x0000U) /*!< Transceiver Basic Control Register */
+#define PHY_BSR ((uint16_t)0x0001U) /*!< Transceiver Basic Status Register */
+
+#define PHY_RESET ((uint16_t)0x8000U) /*!< PHY Reset */
+#define PHY_LOOPBACK ((uint16_t)0x4000U) /*!< Select loop-back mode */
+#define PHY_FULLDUPLEX_100M ((uint16_t)0x2100U) /*!< Set the full-duplex mode at 100 Mb/s */
+#define PHY_HALFDUPLEX_100M ((uint16_t)0x2000U) /*!< Set the half-duplex mode at 100 Mb/s */
+#define PHY_FULLDUPLEX_10M ((uint16_t)0x0100U) /*!< Set the full-duplex mode at 10 Mb/s */
+#define PHY_HALFDUPLEX_10M ((uint16_t)0x0000U) /*!< Set the half-duplex mode at 10 Mb/s */
+#define PHY_AUTONEGOTIATION ((uint16_t)0x1000U) /*!< Enable auto-negotiation function */
+#define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200U) /*!< Restart auto-negotiation function */
+#define PHY_POWERDOWN ((uint16_t)0x0800U) /*!< Select the power down mode */
+#define PHY_ISOLATE ((uint16_t)0x0400U) /*!< Isolate PHY from MII */
+
+#define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020U) /*!< Auto-Negotiation process completed */
+#define PHY_LINKED_STATUS ((uint16_t)0x0004U) /*!< Valid link established */
+#define PHY_JABBER_DETECTION ((uint16_t)0x0002U) /*!< Jabber condition detected */
+
+/* Section 4: Extended PHY Registers */
+#define PHY_SR ((uint16_t)0x10U) /*!< PHY status register Offset */
+
+#define PHY_SPEED_STATUS ((uint16_t)0x0002U) /*!< PHY Speed mask */
+#define PHY_DUPLEX_STATUS ((uint16_t)0x0004U) /*!< PHY Duplex mask */
+
+/* ################## SPI peripheral configuration ########################## */
+
+/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver
+* Activated: CRC code is present inside driver
+* Deactivated: CRC code cleaned from driver
+*/
+
+#define USE_SPI_CRC 0U
+
+/* Includes ------------------------------------------------------------------*/
+/**
+ * @brief Include module's header file
+ */
+
+#ifdef HAL_RCC_MODULE_ENABLED
+ #include "stm32f4xx_hal_rcc.h"
+#endif /* HAL_RCC_MODULE_ENABLED */
+
+#ifdef HAL_EXTI_MODULE_ENABLED
+ #include "stm32f4xx_hal_exti.h"
+#endif /* HAL_EXTI_MODULE_ENABLED */
+
+#ifdef HAL_GPIO_MODULE_ENABLED
+ #include "stm32f4xx_hal_gpio.h"
+#endif /* HAL_GPIO_MODULE_ENABLED */
+
+#ifdef HAL_DMA_MODULE_ENABLED
+ #include "stm32f4xx_hal_dma.h"
+#endif /* HAL_DMA_MODULE_ENABLED */
+
+#ifdef HAL_CORTEX_MODULE_ENABLED
+ #include "stm32f4xx_hal_cortex.h"
+#endif /* HAL_CORTEX_MODULE_ENABLED */
+
+#ifdef HAL_ADC_MODULE_ENABLED
+ #include "stm32f4xx_hal_adc.h"
+#endif /* HAL_ADC_MODULE_ENABLED */
+
+#ifdef HAL_CAN_MODULE_ENABLED
+ #include "stm32f4xx_hal_can.h"
+#endif /* HAL_CAN_MODULE_ENABLED */
+
+#ifdef HAL_CRC_MODULE_ENABLED
+ #include "stm32f4xx_hal_crc.h"
+#endif /* HAL_CRC_MODULE_ENABLED */
+
+#ifdef HAL_CRYP_MODULE_ENABLED
+ #include "stm32f4xx_hal_cryp.h"
+#endif /* HAL_CRYP_MODULE_ENABLED */
+
+#ifdef HAL_DMA2D_MODULE_ENABLED
+ #include "stm32f4xx_hal_dma2d.h"
+#endif /* HAL_DMA2D_MODULE_ENABLED */
+
+#ifdef HAL_DAC_MODULE_ENABLED
+ #include "stm32f4xx_hal_dac.h"
+#endif /* HAL_DAC_MODULE_ENABLED */
+
+#ifdef HAL_DCMI_MODULE_ENABLED
+ #include "stm32f4xx_hal_dcmi.h"
+#endif /* HAL_DCMI_MODULE_ENABLED */
+
+#ifdef HAL_ETH_MODULE_ENABLED
+ #include "stm32f4xx_hal_eth.h"
+#endif /* HAL_ETH_MODULE_ENABLED */
+
+#ifdef HAL_FLASH_MODULE_ENABLED
+ #include "stm32f4xx_hal_flash.h"
+#endif /* HAL_FLASH_MODULE_ENABLED */
+
+#ifdef HAL_SRAM_MODULE_ENABLED
+ #include "stm32f4xx_hal_sram.h"
+#endif /* HAL_SRAM_MODULE_ENABLED */
+
+#ifdef HAL_NOR_MODULE_ENABLED
+ #include "stm32f4xx_hal_nor.h"
+#endif /* HAL_NOR_MODULE_ENABLED */
+
+#ifdef HAL_NAND_MODULE_ENABLED
+ #include "stm32f4xx_hal_nand.h"
+#endif /* HAL_NAND_MODULE_ENABLED */
+
+#ifdef HAL_PCCARD_MODULE_ENABLED
+ #include "stm32f4xx_hal_pccard.h"
+#endif /* HAL_PCCARD_MODULE_ENABLED */
+
+#ifdef HAL_SDRAM_MODULE_ENABLED
+ #include "stm32f4xx_hal_sdram.h"
+#endif /* HAL_SDRAM_MODULE_ENABLED */
+
+#ifdef HAL_HASH_MODULE_ENABLED
+ #include "stm32f4xx_hal_hash.h"
+#endif /* HAL_HASH_MODULE_ENABLED */
+
+#ifdef HAL_I2C_MODULE_ENABLED
+ #include "stm32f4xx_hal_i2c.h"
+#endif /* HAL_I2C_MODULE_ENABLED */
+
+#ifdef HAL_I2S_MODULE_ENABLED
+ #include "stm32f4xx_hal_i2s.h"
+#endif /* HAL_I2S_MODULE_ENABLED */
+
+#ifdef HAL_IWDG_MODULE_ENABLED
+ #include "stm32f4xx_hal_iwdg.h"
+#endif /* HAL_IWDG_MODULE_ENABLED */
+
+#ifdef HAL_LTDC_MODULE_ENABLED
+ #include "stm32f4xx_hal_ltdc.h"
+#endif /* HAL_LTDC_MODULE_ENABLED */
+
+#ifdef HAL_PWR_MODULE_ENABLED
+ #include "stm32f4xx_hal_pwr.h"
+#endif /* HAL_PWR_MODULE_ENABLED */
+
+#ifdef HAL_RNG_MODULE_ENABLED
+ #include "stm32f4xx_hal_rng.h"
+#endif /* HAL_RNG_MODULE_ENABLED */
+
+#ifdef HAL_RTC_MODULE_ENABLED
+ #include "stm32f4xx_hal_rtc.h"
+#endif /* HAL_RTC_MODULE_ENABLED */
+
+#ifdef HAL_SAI_MODULE_ENABLED
+ #include "stm32f4xx_hal_sai.h"
+#endif /* HAL_SAI_MODULE_ENABLED */
+
+#ifdef HAL_SD_MODULE_ENABLED
+ #include "stm32f4xx_hal_sd.h"
+#endif /* HAL_SD_MODULE_ENABLED */
+
+#ifdef HAL_MMC_MODULE_ENABLED
+ #include "stm32f4xx_hal_mmc.h"
+#endif /* HAL_MMC_MODULE_ENABLED */
+
+#ifdef HAL_SPI_MODULE_ENABLED
+ #include "stm32f4xx_hal_spi.h"
+#endif /* HAL_SPI_MODULE_ENABLED */
+
+#ifdef HAL_TIM_MODULE_ENABLED
+ #include "stm32f4xx_hal_tim.h"
+#endif /* HAL_TIM_MODULE_ENABLED */
+
+#ifdef HAL_UART_MODULE_ENABLED
+ #include "stm32f4xx_hal_uart.h"
+#endif /* HAL_UART_MODULE_ENABLED */
+
+#ifdef HAL_USART_MODULE_ENABLED
+ #include "stm32f4xx_hal_usart.h"
+#endif /* HAL_USART_MODULE_ENABLED */
+
+#ifdef HAL_IRDA_MODULE_ENABLED
+ #include "stm32f4xx_hal_irda.h"
+#endif /* HAL_IRDA_MODULE_ENABLED */
+
+#ifdef HAL_SMARTCARD_MODULE_ENABLED
+ #include "stm32f4xx_hal_smartcard.h"
+#endif /* HAL_SMARTCARD_MODULE_ENABLED */
+
+#ifdef HAL_WWDG_MODULE_ENABLED
+ #include "stm32f4xx_hal_wwdg.h"
+#endif /* HAL_WWDG_MODULE_ENABLED */
+
+#ifdef HAL_PCD_MODULE_ENABLED
+ #include "stm32f4xx_hal_pcd.h"
+#endif /* HAL_PCD_MODULE_ENABLED */
+
+#ifdef HAL_HCD_MODULE_ENABLED
+ #include "stm32f4xx_hal_hcd.h"
+#endif /* HAL_HCD_MODULE_ENABLED */
+
+#ifdef HAL_DSI_MODULE_ENABLED
+ #include "stm32f4xx_hal_dsi.h"
+#endif /* HAL_DSI_MODULE_ENABLED */
+
+#ifdef HAL_QSPI_MODULE_ENABLED
+ #include "stm32f4xx_hal_qspi.h"
+#endif /* HAL_QSPI_MODULE_ENABLED */
+
+#ifdef HAL_CEC_MODULE_ENABLED
+ #include "stm32f4xx_hal_cec.h"
+#endif /* HAL_CEC_MODULE_ENABLED */
+
+#ifdef HAL_FMPI2C_MODULE_ENABLED
+ #include "stm32f4xx_hal_fmpi2c.h"
+#endif /* HAL_FMPI2C_MODULE_ENABLED */
+
+#ifdef HAL_SPDIFRX_MODULE_ENABLED
+ #include "stm32f4xx_hal_spdifrx.h"
+#endif /* HAL_SPDIFRX_MODULE_ENABLED */
+
+#ifdef HAL_DFSDM_MODULE_ENABLED
+ #include "stm32f4xx_hal_dfsdm.h"
+#endif /* HAL_DFSDM_MODULE_ENABLED */
+
+#ifdef HAL_LPTIM_MODULE_ENABLED
+ #include "stm32f4xx_hal_lptim.h"
+#endif /* HAL_LPTIM_MODULE_ENABLED */
+
+/* Exported macro ------------------------------------------------------------*/
+#ifdef USE_FULL_ASSERT
+/**
+ * @brief The assert_param macro is used for function's parameters check.
+ * @param expr: If expr is false, it calls assert_failed function
+ * which reports the name of the source file and the source
+ * line number of the call that failed.
+ * If expr is true, it returns no value.
+ * @retval None
+ */
+ #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
+/* Exported functions ------------------------------------------------------- */
+ void assert_failed(uint8_t* file, uint32_t line);
+#else
+ #define assert_param(expr) ((void)0U)
+#endif /* USE_FULL_ASSERT */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STM32F4xx_HAL_CONF_H */
+
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/ports/stm/boards/pyboard_v11/board.c b/ports/stm/boards/pyboard_v11/board.c
new file mode 100644
index 000000000..4421970ee
--- /dev/null
+++ b/ports/stm/boards/pyboard_v11/board.c
@@ -0,0 +1,38 @@
+/*
+ * 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) {
+
+}
diff --git a/ports/stm32f4/boards/pyboard_v11/mpconfigboard.h b/ports/stm/boards/pyboard_v11/mpconfigboard.h
index 7093442d0..398731d30 100644
--- a/ports/stm32f4/boards/pyboard_v11/mpconfigboard.h
+++ b/ports/stm/boards/pyboard_v11/mpconfigboard.h
@@ -32,6 +32,7 @@
#define FLASH_SIZE (0x100000)
#define FLASH_PAGE_SIZE (0x4000)
+#define BOARD_OSC_DIV (12)
#define DEFAULT_I2C_BUS_SCL (&pin_PB06)
#define DEFAULT_I2C_BUS_SDA (&pin_PB07)
diff --git a/ports/stm32f4/boards/pyboard_v11/mpconfigboard.mk b/ports/stm/boards/pyboard_v11/mpconfigboard.mk
index ef1b8f0ca..9d8b0f3f2 100644
--- a/ports/stm32f4/boards/pyboard_v11/mpconfigboard.mk
+++ b/ports/stm/boards/pyboard_v11/mpconfigboard.mk
@@ -5,12 +5,11 @@ USB_MANUFACTURER = "George Robotic"
USB_DEVICES = "CDC,MSC"
INTERNAL_FLASH_FILESYSTEM = 1
-LONGINT_IMPL = NONE
-MCU_SERIES = m4
-MCU_VARIANT = stm32f4
-MCU_SUB_VARIANT = stm32f405xx
-MCU_PACKAGE = 64
-CMSIS_MCU = STM32F405xx
+MCU_SERIES = F4
+MCU_VARIANT = STM32F405xx
+MCU_PACKAGE = LQFP64
+
+LD_COMMON = boards/common_default.ld
LD_FILE = boards/STM32F405_fs.ld
diff --git a/ports/stm32f4/boards/pyboard_v11/pins.c b/ports/stm/boards/pyboard_v11/pins.c
index 8783dfcf1..8783dfcf1 100644
--- a/ports/stm32f4/boards/pyboard_v11/pins.c
+++ b/ports/stm/boards/pyboard_v11/pins.c
diff --git a/ports/stm32f4/boards/pyboard_v11/stm32f4xx_hal_conf.h b/ports/stm/boards/pyboard_v11/stm32f4xx_hal_conf.h
index 4dc18cb7f..4dc18cb7f 100644
--- a/ports/stm32f4/boards/pyboard_v11/stm32f4xx_hal_conf.h
+++ b/ports/stm/boards/pyboard_v11/stm32f4xx_hal_conf.h
diff --git a/ports/stm/boards/stm32f411ce_blackpill/board.c b/ports/stm/boards/stm32f411ce_blackpill/board.c
new file mode 100644
index 000000000..82b0c506e
--- /dev/null
+++ b/ports/stm/boards/stm32f411ce_blackpill/board.c
@@ -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"
+
+void board_init(void) {
+}
+
+bool board_requests_safe_mode(void) {
+ return false;
+}
+
+void reset_board(void) {
+
+}
diff --git a/ports/stm32f4/boards/stm32f411ce_blackpill/mpconfigboard.h b/ports/stm/boards/stm32f411ce_blackpill/mpconfigboard.h
index 05e2a384a..2ae1a2926 100644
--- a/ports/stm32f4/boards/stm32f411ce_blackpill/mpconfigboard.h
+++ b/ports/stm/boards/stm32f411ce_blackpill/mpconfigboard.h
@@ -32,8 +32,8 @@
#define FLASH_SIZE (0x80000)
#define FLASH_PAGE_SIZE (0x4000)
-#define BOARD_OSC_DIV 25
-#define BOARD_NO_VBUS_SENSE
+#define BOARD_OSC_DIV (25)
+#define BOARD_NO_VBUS_SENSE (1)
// On-board flash
// #define SPI_FLASH_MOSI_PIN (&pin_PA07)
@@ -41,8 +41,8 @@
// #define SPI_FLASH_SCK_PIN (&pin_PA05)
// #define SPI_FLASH_CS_PIN (&pin_PA04)
-#define CIRCUITPY_AUTORELOAD_DELAY_MS 500
+#define CIRCUITPY_AUTORELOAD_DELAY_MS (500)
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x2000 - 0xC000)
-#define AUTORESET_DELAY_MS 500
+#define AUTORESET_DELAY_MS (500)
diff --git a/ports/stm32f4/boards/stm32f411ce_blackpill/mpconfigboard.mk b/ports/stm/boards/stm32f411ce_blackpill/mpconfigboard.mk
index 68c6a1eea..62887c028 100644
--- a/ports/stm32f4/boards/stm32f411ce_blackpill/mpconfigboard.mk
+++ b/ports/stm/boards/stm32f411ce_blackpill/mpconfigboard.mk
@@ -10,12 +10,11 @@ USB_DEVICES = "CDC,MSC"
# LONGINT_IMPL = MPZ
INTERNAL_FLASH_FILESYSTEM = 1
-LONGINT_IMPL = NONE
-MCU_SERIES = m4
-MCU_VARIANT = stm32f4
-MCU_SUB_VARIANT = stm32f411xe
-MCU_PACKAGE = 48
-CMSIS_MCU = STM32F411xE
-LD_FILE = boards/STM32F411VETx_FLASH.ld
+MCU_SERIES = F4
+MCU_VARIANT = STM32F411xE
+MCU_PACKAGE = UFQFPN48
+
+LD_COMMON = boards/common_default.ld
+LD_FILE = boards/STM32F411_fs.ld
diff --git a/ports/stm32f4/boards/stm32f411ce_blackpill/pins.c b/ports/stm/boards/stm32f411ce_blackpill/pins.c
index aa9736fc4..aa9736fc4 100644
--- a/ports/stm32f4/boards/stm32f411ce_blackpill/pins.c
+++ b/ports/stm/boards/stm32f411ce_blackpill/pins.c
diff --git a/ports/stm32f4/boards/stm32f411ce_blackpill/stm32f4xx_hal_conf.h b/ports/stm/boards/stm32f411ce_blackpill/stm32f4xx_hal_conf.h
index 81d29f242..81d29f242 100644
--- a/ports/stm32f4/boards/stm32f411ce_blackpill/stm32f4xx_hal_conf.h
+++ b/ports/stm/boards/stm32f411ce_blackpill/stm32f4xx_hal_conf.h
diff --git a/ports/stm/boards/stm32f411ve_discovery/board.c b/ports/stm/boards/stm32f411ve_discovery/board.c
new file mode 100644
index 000000000..4421970ee
--- /dev/null
+++ b/ports/stm/boards/stm32f411ve_discovery/board.c
@@ -0,0 +1,38 @@
+/*
+ * 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) {
+
+}
diff --git a/ports/stm32f4/boards/stm32f411ve_discovery/mpconfigboard.h b/ports/stm/boards/stm32f411ve_discovery/mpconfigboard.h
index 7a5335407..49ef80cdd 100644
--- a/ports/stm32f4/boards/stm32f411ve_discovery/mpconfigboard.h
+++ b/ports/stm/boards/stm32f411ve_discovery/mpconfigboard.h
@@ -32,4 +32,4 @@
#define FLASH_SIZE (0x80000) //512K
#define FLASH_PAGE_SIZE (0x4000) //16K
-#define BOARD_OSC_DIV 8
+#define BOARD_OSC_DIV (8)
diff --git a/ports/stm32f4/boards/stm32f411ve_discovery/mpconfigboard.mk b/ports/stm/boards/stm32f411ve_discovery/mpconfigboard.mk
index 64e2b4dc5..761602acd 100644
--- a/ports/stm32f4/boards/stm32f411ve_discovery/mpconfigboard.mk
+++ b/ports/stm/boards/stm32f411ve_discovery/mpconfigboard.mk
@@ -5,12 +5,11 @@ USB_MANUFACTURER = "STMicroelectronics"
USB_DEVICES = "CDC,MSC"
INTERNAL_FLASH_FILESYSTEM = 1
-LONGINT_IMPL = NONE
-MCU_SERIES = m4
-MCU_VARIANT = stm32f4
-MCU_SUB_VARIANT = stm32f411xe
-MCU_PACKAGE = 100
-CMSIS_MCU = STM32F411xE
-LD_FILE = boards/STM32F411VETx_FLASH.ld
+MCU_SERIES = F4
+MCU_VARIANT = STM32F411xE
+MCU_PACKAGE = LQFP100_f4
+
+LD_COMMON = boards/common_default.ld
+LD_FILE = boards/STM32F411_fs.ld
diff --git a/ports/stm32f4/boards/stm32f411ve_discovery/pins.c b/ports/stm/boards/stm32f411ve_discovery/pins.c
index 673c412d5..673c412d5 100644
--- a/ports/stm32f4/boards/stm32f411ve_discovery/pins.c
+++ b/ports/stm/boards/stm32f411ve_discovery/pins.c
diff --git a/ports/stm/boards/stm32f411ve_discovery/stm32f4xx_hal_conf.h b/ports/stm/boards/stm32f411ve_discovery/stm32f4xx_hal_conf.h
new file mode 100644
index 000000000..18d9d60eb
--- /dev/null
+++ b/ports/stm/boards/stm32f411ve_discovery/stm32f4xx_hal_conf.h
@@ -0,0 +1,439 @@
+/**
+ ******************************************************************************
+ * @file stm32f4xx_hal_conf_template.h
+ * @author MCD Application Team
+ * @brief HAL configuration template file.
+ * This file should be copied to the application folder and renamed
+ * to stm32f4xx_hal_conf.h.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
+ * All rights reserved.</center></h2>
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __STM32F4xx_HAL_CONF_H
+#define __STM32F4xx_HAL_CONF_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Exported types ------------------------------------------------------------*/
+/* Exported constants --------------------------------------------------------*/
+
+/* ########################## Module Selection ############################## */
+/**
+ * @brief This is the list of modules to be used in the HAL driver
+ */
+#define HAL_MODULE_ENABLED
+
+#define HAL_ADC_MODULE_ENABLED
+/* #define HAL_CRYP_MODULE_ENABLED */
+/* #define HAL_CAN_MODULE_ENABLED */
+/* #define HAL_CRC_MODULE_ENABLED */
+/* #define HAL_CRYP_MODULE_ENABLED */
+/* #define HAL_DAC_MODULE_ENABLED */
+/* #define HAL_DCMI_MODULE_ENABLED */
+/* #define HAL_DMA2D_MODULE_ENABLED */
+/* #define HAL_ETH_MODULE_ENABLED */
+/* #define HAL_NAND_MODULE_ENABLED */
+/* #define HAL_NOR_MODULE_ENABLED */
+/* #define HAL_PCCARD_MODULE_ENABLED */
+/* #define HAL_SRAM_MODULE_ENABLED */
+/* #define HAL_SDRAM_MODULE_ENABLED */
+/* #define HAL_HASH_MODULE_ENABLED */
+#define HAL_I2C_MODULE_ENABLED
+#define HAL_I2S_MODULE_ENABLED
+/* #define HAL_IWDG_MODULE_ENABLED */
+/* #define HAL_LTDC_MODULE_ENABLED */
+/* #define HAL_RNG_MODULE_ENABLED */
+/* #define HAL_RTC_MODULE_ENABLED */
+/* #define HAL_SAI_MODULE_ENABLED */
+/* #define HAL_SD_MODULE_ENABLED */
+/* #define HAL_MMC_MODULE_ENABLED */
+#define HAL_SPI_MODULE_ENABLED
+#define HAL_TIM_MODULE_ENABLED
+#define HAL_UART_MODULE_ENABLED
+/* #define HAL_USART_MODULE_ENABLED */
+/* #define HAL_IRDA_MODULE_ENABLED */
+/* #define HAL_SMARTCARD_MODULE_ENABLED */
+/* #define HAL_WWDG_MODULE_ENABLED */
+#define HAL_PCD_MODULE_ENABLED
+/* #define HAL_HCD_MODULE_ENABLED */
+/* #define HAL_DSI_MODULE_ENABLED */
+/* #define HAL_QSPI_MODULE_ENABLED */
+/* #define HAL_QSPI_MODULE_ENABLED */
+/* #define HAL_CEC_MODULE_ENABLED */
+/* #define HAL_FMPI2C_MODULE_ENABLED */
+/* #define HAL_SPDIFRX_MODULE_ENABLED */
+/* #define HAL_DFSDM_MODULE_ENABLED */
+/* #define HAL_LPTIM_MODULE_ENABLED */
+/* #define HAL_EXTI_MODULE_ENABLED */
+#define HAL_GPIO_MODULE_ENABLED
+#define HAL_EXTI_MODULE_ENABLED
+#define HAL_DMA_MODULE_ENABLED
+#define HAL_RCC_MODULE_ENABLED
+#define HAL_FLASH_MODULE_ENABLED
+#define HAL_PWR_MODULE_ENABLED
+#define HAL_CORTEX_MODULE_ENABLED
+
+/* ########################## HSE/HSI Values adaptation ##################### */
+/**
+ * @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
+ * This value is used by the RCC HAL module to compute the system frequency
+ * (when HSE is used as system clock source, directly or through the PLL).
+ */
+#if !defined (HSE_VALUE)
+ #define HSE_VALUE ((uint32_t)8000000U) /*!< Value of the External oscillator in Hz */
+#endif /* HSE_VALUE */
+
+#if !defined (HSE_STARTUP_TIMEOUT)
+ #define HSE_STARTUP_TIMEOUT ((uint32_t)100U) /*!< Time out for HSE start up, in ms */
+#endif /* HSE_STARTUP_TIMEOUT */
+
+/**
+ * @brief Internal High Speed oscillator (HSI) value.
+ * This value is used by the RCC HAL module to compute the system frequency
+ * (when HSI is used as system clock source, directly or through the PLL).
+ */
+#if !defined (HSI_VALUE)
+ #define HSI_VALUE ((uint32_t)16000000U) /*!< Value of the Internal oscillator in Hz*/
+#endif /* HSI_VALUE */
+
+/**
+ * @brief Internal Low Speed oscillator (LSI) value.
+ */
+#if !defined (LSI_VALUE)
+ #define LSI_VALUE ((uint32_t)32000U) /*!< LSI Typical Value in Hz*/
+#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz
+ The real value may vary depending on the variations
+ in voltage and temperature.*/
+/**
+ * @brief External Low Speed oscillator (LSE) value.
+ */
+#if !defined (LSE_VALUE)
+ #define LSE_VALUE ((uint32_t)32768U) /*!< Value of the External Low Speed oscillator in Hz */
+#endif /* LSE_VALUE */
+
+#if !defined (LSE_STARTUP_TIMEOUT)
+ #define LSE_STARTUP_TIMEOUT ((uint32_t)5000U) /*!< Time out for LSE start up, in ms */
+#endif /* LSE_STARTUP_TIMEOUT */
+
+/**
+ * @brief External clock source for I2S peripheral
+ * This value is used by the I2S HAL module to compute the I2S clock source
+ * frequency, this source is inserted directly through I2S_CKIN pad.
+ */
+#if !defined (EXTERNAL_CLOCK_VALUE)
+ #define EXTERNAL_CLOCK_VALUE ((uint32_t)12288000U) /*!< Value of the External audio frequency in Hz*/
+#endif /* EXTERNAL_CLOCK_VALUE */
+
+/* Tip: To avoid modifying this file each time you need to use different HSE,
+ === you can define the HSE value in your toolchain compiler preprocessor. */
+
+/* ########################### System Configuration ######################### */
+/**
+ * @brief This is the HAL system configuration section
+ */
+#define VDD_VALUE ((uint32_t)3300U) /*!< Value of VDD in mv */
+#define TICK_INT_PRIORITY ((uint32_t)0U) /*!< tick interrupt priority */
+#define USE_RTOS 0U
+#define PREFETCH_ENABLE 1U
+#define INSTRUCTION_CACHE_ENABLE 1U
+#define DATA_CACHE_ENABLE 1U
+
+/* ########################## Assert Selection ############################## */
+/**
+ * @brief Uncomment the line below to expanse the "assert_param" macro in the
+ * HAL drivers code
+ */
+/* #define USE_FULL_ASSERT 1U */
+
+/* ################## Ethernet peripheral configuration ##################### */
+
+/* Section 1 : Ethernet peripheral configuration */
+
+/* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */
+#define MAC_ADDR0 2U
+#define MAC_ADDR1 0U
+#define MAC_ADDR2 0U
+#define MAC_ADDR3 0U
+#define MAC_ADDR4 0U
+#define MAC_ADDR5 0U
+
+/* Definition of the Ethernet driver buffers size and count */
+#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */
+#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */
+#define ETH_RXBUFNB ((uint32_t)4U) /* 4 Rx buffers of size ETH_RX_BUF_SIZE */
+#define ETH_TXBUFNB ((uint32_t)4U) /* 4 Tx buffers of size ETH_TX_BUF_SIZE */
+
+/* Section 2: PHY configuration section */
+
+/* DP83848_PHY_ADDRESS Address*/
+#define DP83848_PHY_ADDRESS 0x01U
+/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/
+#define PHY_RESET_DELAY ((uint32_t)0x000000FFU)
+/* PHY Configuration delay */
+#define PHY_CONFIG_DELAY ((uint32_t)0x00000FFFU)
+
+#define PHY_READ_TO ((uint32_t)0x0000FFFFU)
+#define PHY_WRITE_TO ((uint32_t)0x0000FFFFU)
+
+/* Section 3: Common PHY Registers */
+
+#define PHY_BCR ((uint16_t)0x0000U) /*!< Transceiver Basic Control Register */
+#define PHY_BSR ((uint16_t)0x0001U) /*!< Transceiver Basic Status Register */
+
+#define PHY_RESET ((uint16_t)0x8000U) /*!< PHY Reset */
+#define PHY_LOOPBACK ((uint16_t)0x4000U) /*!< Select loop-back mode */
+#define PHY_FULLDUPLEX_100M ((uint16_t)0x2100U) /*!< Set the full-duplex mode at 100 Mb/s */
+#define PHY_HALFDUPLEX_100M ((uint16_t)0x2000U) /*!< Set the half-duplex mode at 100 Mb/s */
+#define PHY_FULLDUPLEX_10M ((uint16_t)0x0100U) /*!< Set the full-duplex mode at 10 Mb/s */
+#define PHY_HALFDUPLEX_10M ((uint16_t)0x0000U) /*!< Set the half-duplex mode at 10 Mb/s */
+#define PHY_AUTONEGOTIATION ((uint16_t)0x1000U) /*!< Enable auto-negotiation function */
+#define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200U) /*!< Restart auto-negotiation function */
+#define PHY_POWERDOWN ((uint16_t)0x0800U) /*!< Select the power down mode */
+#define PHY_ISOLATE ((uint16_t)0x0400U) /*!< Isolate PHY from MII */
+
+#define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020U) /*!< Auto-Negotiation process completed */
+#define PHY_LINKED_STATUS ((uint16_t)0x0004U) /*!< Valid link established */
+#define PHY_JABBER_DETECTION ((uint16_t)0x0002U) /*!< Jabber condition detected */
+
+/* Section 4: Extended PHY Registers */
+#define PHY_SR ((uint16_t)0x10U) /*!< PHY status register Offset */
+
+#define PHY_SPEED_STATUS ((uint16_t)0x0002U) /*!< PHY Speed mask */
+#define PHY_DUPLEX_STATUS ((uint16_t)0x0004U) /*!< PHY Duplex mask */
+
+/* ################## SPI peripheral configuration ########################## */
+
+/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver
+* Activated: CRC code is present inside driver
+* Deactivated: CRC code cleaned from driver
+*/
+
+#define USE_SPI_CRC 0U
+
+/* Includes ------------------------------------------------------------------*/
+/**
+ * @brief Include module's header file
+ */
+
+#ifdef HAL_RCC_MODULE_ENABLED
+ #include "stm32f4xx_hal_rcc.h"
+#endif /* HAL_RCC_MODULE_ENABLED */
+
+#ifdef HAL_EXTI_MODULE_ENABLED
+ #include "stm32f4xx_hal_exti.h"
+#endif /* HAL_EXTI_MODULE_ENABLED */
+
+#ifdef HAL_GPIO_MODULE_ENABLED
+ #include "stm32f4xx_hal_gpio.h"
+#endif /* HAL_GPIO_MODULE_ENABLED */
+
+#ifdef HAL_DMA_MODULE_ENABLED
+ #include "stm32f4xx_hal_dma.h"
+#endif /* HAL_DMA_MODULE_ENABLED */
+
+#ifdef HAL_CORTEX_MODULE_ENABLED
+ #include "stm32f4xx_hal_cortex.h"
+#endif /* HAL_CORTEX_MODULE_ENABLED */
+
+#ifdef HAL_ADC_MODULE_ENABLED
+ #include "stm32f4xx_hal_adc.h"
+#endif /* HAL_ADC_MODULE_ENABLED */
+
+#ifdef HAL_CAN_MODULE_ENABLED
+ #include "stm32f4xx_hal_can.h"
+#endif /* HAL_CAN_MODULE_ENABLED */
+
+#ifdef HAL_CRC_MODULE_ENABLED
+ #include "stm32f4xx_hal_crc.h"
+#endif /* HAL_CRC_MODULE_ENABLED */
+
+#ifdef HAL_CRYP_MODULE_ENABLED
+ #include "stm32f4xx_hal_cryp.h"
+#endif /* HAL_CRYP_MODULE_ENABLED */
+
+#ifdef HAL_DMA2D_MODULE_ENABLED
+ #include "stm32f4xx_hal_dma2d.h"
+#endif /* HAL_DMA2D_MODULE_ENABLED */
+
+#ifdef HAL_DAC_MODULE_ENABLED
+ #include "stm32f4xx_hal_dac.h"
+#endif /* HAL_DAC_MODULE_ENABLED */
+
+#ifdef HAL_DCMI_MODULE_ENABLED
+ #include "stm32f4xx_hal_dcmi.h"
+#endif /* HAL_DCMI_MODULE_ENABLED */
+
+#ifdef HAL_ETH_MODULE_ENABLED
+ #include "stm32f4xx_hal_eth.h"
+#endif /* HAL_ETH_MODULE_ENABLED */
+
+#ifdef HAL_FLASH_MODULE_ENABLED
+ #include "stm32f4xx_hal_flash.h"
+#endif /* HAL_FLASH_MODULE_ENABLED */
+
+#ifdef HAL_SRAM_MODULE_ENABLED
+ #include "stm32f4xx_hal_sram.h"
+#endif /* HAL_SRAM_MODULE_ENABLED */
+
+#ifdef HAL_NOR_MODULE_ENABLED
+ #include "stm32f4xx_hal_nor.h"
+#endif /* HAL_NOR_MODULE_ENABLED */
+
+#ifdef HAL_NAND_MODULE_ENABLED
+ #include "stm32f4xx_hal_nand.h"
+#endif /* HAL_NAND_MODULE_ENABLED */
+
+#ifdef HAL_PCCARD_MODULE_ENABLED
+ #include "stm32f4xx_hal_pccard.h"
+#endif /* HAL_PCCARD_MODULE_ENABLED */
+
+#ifdef HAL_SDRAM_MODULE_ENABLED
+ #include "stm32f4xx_hal_sdram.h"
+#endif /* HAL_SDRAM_MODULE_ENABLED */
+
+#ifdef HAL_HASH_MODULE_ENABLED
+ #include "stm32f4xx_hal_hash.h"
+#endif /* HAL_HASH_MODULE_ENABLED */
+
+#ifdef HAL_I2C_MODULE_ENABLED
+ #include "stm32f4xx_hal_i2c.h"
+#endif /* HAL_I2C_MODULE_ENABLED */
+
+#ifdef HAL_I2S_MODULE_ENABLED
+ #include "stm32f4xx_hal_i2s.h"
+#endif /* HAL_I2S_MODULE_ENABLED */
+
+#ifdef HAL_IWDG_MODULE_ENABLED
+ #include "stm32f4xx_hal_iwdg.h"
+#endif /* HAL_IWDG_MODULE_ENABLED */
+
+#ifdef HAL_LTDC_MODULE_ENABLED
+ #include "stm32f4xx_hal_ltdc.h"
+#endif /* HAL_LTDC_MODULE_ENABLED */
+
+#ifdef HAL_PWR_MODULE_ENABLED
+ #include "stm32f4xx_hal_pwr.h"
+#endif /* HAL_PWR_MODULE_ENABLED */
+
+#ifdef HAL_RNG_MODULE_ENABLED
+ #include "stm32f4xx_hal_rng.h"
+#endif /* HAL_RNG_MODULE_ENABLED */
+
+#ifdef HAL_RTC_MODULE_ENABLED
+ #include "stm32f4xx_hal_rtc.h"
+#endif /* HAL_RTC_MODULE_ENABLED */
+
+#ifdef HAL_SAI_MODULE_ENABLED
+ #include "stm32f4xx_hal_sai.h"
+#endif /* HAL_SAI_MODULE_ENABLED */
+
+#ifdef HAL_SD_MODULE_ENABLED
+ #include "stm32f4xx_hal_sd.h"
+#endif /* HAL_SD_MODULE_ENABLED */
+
+#ifdef HAL_MMC_MODULE_ENABLED
+ #include "stm32f4xx_hal_mmc.h"
+#endif /* HAL_MMC_MODULE_ENABLED */
+
+#ifdef HAL_SPI_MODULE_ENABLED
+ #include "stm32f4xx_hal_spi.h"
+#endif /* HAL_SPI_MODULE_ENABLED */
+
+#ifdef HAL_TIM_MODULE_ENABLED
+ #include "stm32f4xx_hal_tim.h"
+#endif /* HAL_TIM_MODULE_ENABLED */
+
+#ifdef HAL_UART_MODULE_ENABLED
+ #include "stm32f4xx_hal_uart.h"
+#endif /* HAL_UART_MODULE_ENABLED */
+
+#ifdef HAL_USART_MODULE_ENABLED
+ #include "stm32f4xx_hal_usart.h"
+#endif /* HAL_USART_MODULE_ENABLED */
+
+#ifdef HAL_IRDA_MODULE_ENABLED
+ #include "stm32f4xx_hal_irda.h"
+#endif /* HAL_IRDA_MODULE_ENABLED */
+
+#ifdef HAL_SMARTCARD_MODULE_ENABLED
+ #include "stm32f4xx_hal_smartcard.h"
+#endif /* HAL_SMARTCARD_MODULE_ENABLED */
+
+#ifdef HAL_WWDG_MODULE_ENABLED
+ #include "stm32f4xx_hal_wwdg.h"
+#endif /* HAL_WWDG_MODULE_ENABLED */
+
+#ifdef HAL_PCD_MODULE_ENABLED
+ #include "stm32f4xx_hal_pcd.h"
+#endif /* HAL_PCD_MODULE_ENABLED */
+
+#ifdef HAL_HCD_MODULE_ENABLED
+ #include "stm32f4xx_hal_hcd.h"
+#endif /* HAL_HCD_MODULE_ENABLED */
+
+#ifdef HAL_DSI_MODULE_ENABLED
+ #include "stm32f4xx_hal_dsi.h"
+#endif /* HAL_DSI_MODULE_ENABLED */
+
+#ifdef HAL_QSPI_MODULE_ENABLED
+ #include "stm32f4xx_hal_qspi.h"
+#endif /* HAL_QSPI_MODULE_ENABLED */
+
+#ifdef HAL_CEC_MODULE_ENABLED
+ #include "stm32f4xx_hal_cec.h"
+#endif /* HAL_CEC_MODULE_ENABLED */
+
+#ifdef HAL_FMPI2C_MODULE_ENABLED
+ #include "stm32f4xx_hal_fmpi2c.h"
+#endif /* HAL_FMPI2C_MODULE_ENABLED */
+
+#ifdef HAL_SPDIFRX_MODULE_ENABLED
+ #include "stm32f4xx_hal_spdifrx.h"
+#endif /* HAL_SPDIFRX_MODULE_ENABLED */
+
+#ifdef HAL_DFSDM_MODULE_ENABLED
+ #include "stm32f4xx_hal_dfsdm.h"
+#endif /* HAL_DFSDM_MODULE_ENABLED */
+
+#ifdef HAL_LPTIM_MODULE_ENABLED
+ #include "stm32f4xx_hal_lptim.h"
+#endif /* HAL_LPTIM_MODULE_ENABLED */
+
+/* Exported macro ------------------------------------------------------------*/
+#ifdef USE_FULL_ASSERT
+/**
+ * @brief The assert_param macro is used for function's parameters check.
+ * @param expr: If expr is false, it calls assert_failed function
+ * which reports the name of the source file and the source
+ * line number of the call that failed.
+ * If expr is true, it returns no value.
+ * @retval None
+ */
+ #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
+/* Exported functions ------------------------------------------------------- */
+ void assert_failed(uint8_t* file, uint32_t line);
+#else
+ #define assert_param(expr) ((void)0U)
+#endif /* USE_FULL_ASSERT */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STM32F4xx_HAL_CONF_H */
+
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/ports/stm/boards/stm32f412zg_discovery/board.c b/ports/stm/boards/stm32f412zg_discovery/board.c
new file mode 100644
index 000000000..4421970ee
--- /dev/null
+++ b/ports/stm/boards/stm32f412zg_discovery/board.c
@@ -0,0 +1,38 @@
+/*
+ * 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) {
+
+}
diff --git a/ports/stm32f4/boards/stm32f412zg_discovery/mpconfigboard.h b/ports/stm/boards/stm32f412zg_discovery/mpconfigboard.h
index 3ab9a5585..f34b830fb 100644
--- a/ports/stm32f4/boards/stm32f412zg_discovery/mpconfigboard.h
+++ b/ports/stm/boards/stm32f412zg_discovery/mpconfigboard.h
@@ -32,5 +32,7 @@
#define FLASH_SIZE (0x100000)
#define FLASH_PAGE_SIZE (0x4000)
+#define BOARD_OSC_DIV (8)
+
#define DEFAULT_I2C_BUS_SCL (&pin_PB10)
#define DEFAULT_I2C_BUS_SDA (&pin_PB09)
diff --git a/ports/stm32f4/boards/stm32f412zg_discovery/mpconfigboard.mk b/ports/stm/boards/stm32f412zg_discovery/mpconfigboard.mk
index b0205fc73..09e7bda85 100644
--- a/ports/stm32f4/boards/stm32f412zg_discovery/mpconfigboard.mk
+++ b/ports/stm/boards/stm32f412zg_discovery/mpconfigboard.mk
@@ -5,18 +5,17 @@ USB_MANUFACTURER = "STMicroelectronics"
USB_DEVICES = "CDC,MSC,HID"
INTERNAL_FLASH_FILESYSTEM = 1
-LONGINT_IMPL = NONE
# QSPI_FLASH_FILESYSTEM = 1
# EXTERNAL_FLASH_DEVICE_COUNT = 1
# EXTERNAL_FLASH_DEVICES = N25Q128A
# LONGINT_IMPL = MPZ
-MCU_SERIES = m4
-MCU_VARIANT = stm32f4
-MCU_SUB_VARIANT = stm32f412zx
-MCU_PACKAGE = 144
-CMSIS_MCU = STM32F412Zx
-LD_FILE = boards/STM32F412ZGTx_FLASH.ld
+MCU_SERIES = F4
+MCU_VARIANT = STM32F412Zx
+MCU_PACKAGE = LQFP144
+
+LD_COMMON = boards/common_default.ld
+LD_FILE = boards/STM32F412_fs.ld
diff --git a/ports/stm32f4/boards/stm32f412zg_discovery/pins.c b/ports/stm/boards/stm32f412zg_discovery/pins.c
index ab90b0455..ab90b0455 100644
--- a/ports/stm32f4/boards/stm32f412zg_discovery/pins.c
+++ b/ports/stm/boards/stm32f412zg_discovery/pins.c
diff --git a/ports/stm32f4/boards/stm32f412zg_discovery/stm32f4xx_hal_conf.h b/ports/stm/boards/stm32f412zg_discovery/stm32f4xx_hal_conf.h
index f1b401348..f1b401348 100644
--- a/ports/stm32f4/boards/stm32f412zg_discovery/stm32f4xx_hal_conf.h
+++ b/ports/stm/boards/stm32f412zg_discovery/stm32f4xx_hal_conf.h
diff --git a/ports/stm/boards/stm32f4_discovery/board.c b/ports/stm/boards/stm32f4_discovery/board.c
new file mode 100644
index 000000000..4421970ee
--- /dev/null
+++ b/ports/stm/boards/stm32f4_discovery/board.c
@@ -0,0 +1,38 @@
+/*
+ * 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) {
+
+}
diff --git a/ports/stm/boards/stm32f4_discovery/mpconfigboard.h b/ports/stm/boards/stm32f4_discovery/mpconfigboard.h
new file mode 100644
index 000000000..fcd7aa09c
--- /dev/null
+++ b/ports/stm/boards/stm32f4_discovery/mpconfigboard.h
@@ -0,0 +1,35 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Lucian Copeland 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.
+ */
+
+//Micropython setup
+
+#define MICROPY_HW_BOARD_NAME "STM32F4_DISCO"
+#define MICROPY_HW_MCU_NAME "STM32F407VG"
+
+#define FLASH_SIZE (0x100000)
+#define FLASH_PAGE_SIZE (0x4000)
+
+#define BOARD_OSC_DIV (8)
diff --git a/ports/stm/boards/stm32f4_discovery/mpconfigboard.mk b/ports/stm/boards/stm32f4_discovery/mpconfigboard.mk
new file mode 100644
index 000000000..57a65f75a
--- /dev/null
+++ b/ports/stm/boards/stm32f4_discovery/mpconfigboard.mk
@@ -0,0 +1,15 @@
+USB_VID = 0x239A
+USB_PID = 0x808A
+USB_PRODUCT = "STM32F407VG Discovery Board - CPy"
+USB_MANUFACTURER = "STMicroelectronics"
+USB_DEVICES = "CDC,MSC"
+
+INTERNAL_FLASH_FILESYSTEM = 1
+
+MCU_SERIES = F4
+MCU_VARIANT = STM32F407xx
+MCU_PACKAGE = LQFP100_f4
+
+LD_COMMON = boards/common_default.ld
+LD_FILE = boards/STM32F407_fs.ld
+
diff --git a/ports/stm/boards/stm32f4_discovery/pins.c b/ports/stm/boards/stm32f4_discovery/pins.c
new file mode 100644
index 000000000..712932145
--- /dev/null
+++ b/ports/stm/boards/stm32f4_discovery/pins.c
@@ -0,0 +1,107 @@
+#include "shared-bindings/board/__init__.h"
+
+STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
+ //P1
+ { MP_ROM_QSTR(MP_QSTR_PC00), MP_ROM_PTR(&pin_PC00) },
+ { MP_ROM_QSTR(MP_QSTR_PC01), MP_ROM_PTR(&pin_PC01) },
+ { MP_ROM_QSTR(MP_QSTR_PC02), MP_ROM_PTR(&pin_PC02) },
+ { MP_ROM_QSTR(MP_QSTR_PC03), MP_ROM_PTR(&pin_PC03) },
+ { MP_ROM_QSTR(MP_QSTR_PA00), MP_ROM_PTR(&pin_PA00) },
+ { MP_ROM_QSTR(MP_QSTR_PA01), MP_ROM_PTR(&pin_PA01) },
+ { MP_ROM_QSTR(MP_QSTR_PA02), MP_ROM_PTR(&pin_PA02) },
+ { MP_ROM_QSTR(MP_QSTR_PA03), MP_ROM_PTR(&pin_PA03) },
+ { MP_ROM_QSTR(MP_QSTR_PA04), MP_ROM_PTR(&pin_PA04) },
+ { MP_ROM_QSTR(MP_QSTR_PA05), MP_ROM_PTR(&pin_PA05) },
+ { MP_ROM_QSTR(MP_QSTR_PA06), MP_ROM_PTR(&pin_PA06) },
+ { MP_ROM_QSTR(MP_QSTR_PA07), MP_ROM_PTR(&pin_PA07) },
+ { MP_ROM_QSTR(MP_QSTR_PC04), MP_ROM_PTR(&pin_PC04) },
+ { MP_ROM_QSTR(MP_QSTR_PC05), MP_ROM_PTR(&pin_PC05) },
+ { MP_ROM_QSTR(MP_QSTR_PB00), MP_ROM_PTR(&pin_PB00) },
+ { MP_ROM_QSTR(MP_QSTR_PB01), MP_ROM_PTR(&pin_PB01) },
+ { MP_ROM_QSTR(MP_QSTR_PB02), MP_ROM_PTR(&pin_PB02) },
+ { MP_ROM_QSTR(MP_QSTR_PE07), MP_ROM_PTR(&pin_PE07) },
+ { MP_ROM_QSTR(MP_QSTR_PE08), MP_ROM_PTR(&pin_PE08) },
+ { MP_ROM_QSTR(MP_QSTR_PE09), MP_ROM_PTR(&pin_PE09) },
+ { MP_ROM_QSTR(MP_QSTR_PE10), MP_ROM_PTR(&pin_PE10) },
+ { MP_ROM_QSTR(MP_QSTR_PE11), MP_ROM_PTR(&pin_PE11) },
+ { MP_ROM_QSTR(MP_QSTR_PE12), MP_ROM_PTR(&pin_PE12) },
+ { MP_ROM_QSTR(MP_QSTR_PE13), MP_ROM_PTR(&pin_PE13) },
+ { MP_ROM_QSTR(MP_QSTR_PE14), MP_ROM_PTR(&pin_PE14) },
+ { MP_ROM_QSTR(MP_QSTR_PE15), MP_ROM_PTR(&pin_PE15) },
+ { MP_ROM_QSTR(MP_QSTR_PB11), MP_ROM_PTR(&pin_PB11) }, // Differs from F411
+ { MP_ROM_QSTR(MP_QSTR_PB10), MP_ROM_PTR(&pin_PB10) },
+ { MP_ROM_QSTR(MP_QSTR_PB12), MP_ROM_PTR(&pin_PB12) },
+ { MP_ROM_QSTR(MP_QSTR_PB13), MP_ROM_PTR(&pin_PB13) },
+ { MP_ROM_QSTR(MP_QSTR_PB14), MP_ROM_PTR(&pin_PB14) },
+ { MP_ROM_QSTR(MP_QSTR_PB15), MP_ROM_PTR(&pin_PB15) },
+ { MP_ROM_QSTR(MP_QSTR_PD08), MP_ROM_PTR(&pin_PD08) },
+ { MP_ROM_QSTR(MP_QSTR_PD09), MP_ROM_PTR(&pin_PD09) },
+ { MP_ROM_QSTR(MP_QSTR_PD10), MP_ROM_PTR(&pin_PD10) },
+ { MP_ROM_QSTR(MP_QSTR_PD11), MP_ROM_PTR(&pin_PD11) },
+ { MP_ROM_QSTR(MP_QSTR_PD12), MP_ROM_PTR(&pin_PD12) },
+ { MP_ROM_QSTR(MP_QSTR_PD13), MP_ROM_PTR(&pin_PD13) },
+ { MP_ROM_QSTR(MP_QSTR_PD14), MP_ROM_PTR(&pin_PD14) },
+ { MP_ROM_QSTR(MP_QSTR_PD15), MP_ROM_PTR(&pin_PD15) },
+ //P2
+ { MP_ROM_QSTR(MP_QSTR_PC14), MP_ROM_PTR(&pin_PC14) },
+ { MP_ROM_QSTR(MP_QSTR_PC15), MP_ROM_PTR(&pin_PC15) },
+ { MP_ROM_QSTR(MP_QSTR_PC13), MP_ROM_PTR(&pin_PC13) },
+ { MP_ROM_QSTR(MP_QSTR_PE06), MP_ROM_PTR(&pin_PE06) },
+ { MP_ROM_QSTR(MP_QSTR_PE05), MP_ROM_PTR(&pin_PE05) },
+ { MP_ROM_QSTR(MP_QSTR_PE04), MP_ROM_PTR(&pin_PE04) },
+ { MP_ROM_QSTR(MP_QSTR_PE03), MP_ROM_PTR(&pin_PE03) },
+ { MP_ROM_QSTR(MP_QSTR_PE02), MP_ROM_PTR(&pin_PE02) },
+ { MP_ROM_QSTR(MP_QSTR_PE01), MP_ROM_PTR(&pin_PE01) },
+ { MP_ROM_QSTR(MP_QSTR_PE00), MP_ROM_PTR(&pin_PE00) },
+ { MP_ROM_QSTR(MP_QSTR_PB09), MP_ROM_PTR(&pin_PB09) },
+ { MP_ROM_QSTR(MP_QSTR_PB08), MP_ROM_PTR(&pin_PB08) },
+ { MP_ROM_QSTR(MP_QSTR_PB07), MP_ROM_PTR(&pin_PB07) },
+ { MP_ROM_QSTR(MP_QSTR_PB06), MP_ROM_PTR(&pin_PB06) },
+ { MP_ROM_QSTR(MP_QSTR_PB05), MP_ROM_PTR(&pin_PB05) },
+ { MP_ROM_QSTR(MP_QSTR_PB04), MP_ROM_PTR(&pin_PB04) },
+ { MP_ROM_QSTR(MP_QSTR_PB03), MP_ROM_PTR(&pin_PB03) },
+ { MP_ROM_QSTR(MP_QSTR_PD07), MP_ROM_PTR(&pin_PD07) },
+ { MP_ROM_QSTR(MP_QSTR_PD06), MP_ROM_PTR(&pin_PD06) },
+ { MP_ROM_QSTR(MP_QSTR_PD05), MP_ROM_PTR(&pin_PD05) },
+ { MP_ROM_QSTR(MP_QSTR_PD04), MP_ROM_PTR(&pin_PD04) },
+ { MP_ROM_QSTR(MP_QSTR_PD03), MP_ROM_PTR(&pin_PD03) },
+ { MP_ROM_QSTR(MP_QSTR_PD02), MP_ROM_PTR(&pin_PD02) },
+ { MP_ROM_QSTR(MP_QSTR_PD01), MP_ROM_PTR(&pin_PD01) },
+ { MP_ROM_QSTR(MP_QSTR_PD00), MP_ROM_PTR(&pin_PD00) },
+ { MP_ROM_QSTR(MP_QSTR_PC12), MP_ROM_PTR(&pin_PC12) },
+ { MP_ROM_QSTR(MP_QSTR_PC11), MP_ROM_PTR(&pin_PC11) },
+ { MP_ROM_QSTR(MP_QSTR_PC10), MP_ROM_PTR(&pin_PC10) },
+ { MP_ROM_QSTR(MP_QSTR_PA15), MP_ROM_PTR(&pin_PA15) },
+ { MP_ROM_QSTR(MP_QSTR_PA14), MP_ROM_PTR(&pin_PA14) },
+ { MP_ROM_QSTR(MP_QSTR_PA13), MP_ROM_PTR(&pin_PA13) },
+ { MP_ROM_QSTR(MP_QSTR_PA10), MP_ROM_PTR(&pin_PA10) },
+ { MP_ROM_QSTR(MP_QSTR_PA09), MP_ROM_PTR(&pin_PA09) },
+ { MP_ROM_QSTR(MP_QSTR_PA08), MP_ROM_PTR(&pin_PA08) },
+ { MP_ROM_QSTR(MP_QSTR_PC09), MP_ROM_PTR(&pin_PC09) },
+ { MP_ROM_QSTR(MP_QSTR_PC08), MP_ROM_PTR(&pin_PC08) },
+ { MP_ROM_QSTR(MP_QSTR_PC07), MP_ROM_PTR(&pin_PC07) },
+ { MP_ROM_QSTR(MP_QSTR_PC06), MP_ROM_PTR(&pin_PC06) },
+ //ST LED names
+ { MP_ROM_QSTR(MP_QSTR_LD3), MP_ROM_PTR(&pin_PD13) },
+ { MP_ROM_QSTR(MP_QSTR_LD4), MP_ROM_PTR(&pin_PD12) },
+ { MP_ROM_QSTR(MP_QSTR_LD5), MP_ROM_PTR(&pin_PD14) },
+ { MP_ROM_QSTR(MP_QSTR_LD6), MP_ROM_PTR(&pin_PD15) },
+ //more useful LED names
+ { MP_ROM_QSTR(MP_QSTR_LED1), MP_ROM_PTR(&pin_PD13) },
+ { MP_ROM_QSTR(MP_QSTR_LED2), MP_ROM_PTR(&pin_PD12) },
+ { MP_ROM_QSTR(MP_QSTR_LED3), MP_ROM_PTR(&pin_PD14) },
+ { MP_ROM_QSTR(MP_QSTR_LED4), MP_ROM_PTR(&pin_PD15) },
+ //AnalogIO names
+ { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA00) },
+ { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA01) },
+ { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA02) },
+ { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA03) },
+ { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA04) },
+ { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA05) },
+ //actual LED names
+ { MP_ROM_QSTR(MP_QSTR_LED_ORANGE), MP_ROM_PTR(&pin_PD13) },
+ { MP_ROM_QSTR(MP_QSTR_LED_GREEN), MP_ROM_PTR(&pin_PD12) },
+ { MP_ROM_QSTR(MP_QSTR_LED_RED), MP_ROM_PTR(&pin_PD14) },
+ { MP_ROM_QSTR(MP_QSTR_LED_BLUE), MP_ROM_PTR(&pin_PD15) },
+};
+MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
diff --git a/ports/stm/boards/stm32f4_discovery/stm32f4xx_hal_conf.h b/ports/stm/boards/stm32f4_discovery/stm32f4xx_hal_conf.h
new file mode 100644
index 000000000..ee5832d49
--- /dev/null
+++ b/ports/stm/boards/stm32f4_discovery/stm32f4xx_hal_conf.h
@@ -0,0 +1,439 @@
+/**
+ ******************************************************************************
+ * @file stm32f4xx_hal_conf_template.h
+ * @author MCD Application Team
+ * @brief HAL configuration template file.
+ * This file should be copied to the application folder and renamed
+ * to stm32f4xx_hal_conf.h.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
+ * All rights reserved.</center></h2>
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __STM32F4xx_HAL_CONF_H
+#define __STM32F4xx_HAL_CONF_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Exported types ------------------------------------------------------------*/
+/* Exported constants --------------------------------------------------------*/
+
+/* ########################## Module Selection ############################## */
+/**
+ * @brief This is the list of modules to be used in the HAL driver
+ */
+#define HAL_MODULE_ENABLED
+
+#define HAL_ADC_MODULE_ENABLED
+/* #define HAL_CRYP_MODULE_ENABLED */
+/* #define HAL_CAN_MODULE_ENABLED */
+/* #define HAL_CRC_MODULE_ENABLED */
+/* #define HAL_CRYP_MODULE_ENABLED */
+#define HAL_DAC_MODULE_ENABLED
+/* #define HAL_DCMI_MODULE_ENABLED */
+/* #define HAL_DMA2D_MODULE_ENABLED */
+/* #define HAL_ETH_MODULE_ENABLED */
+/* #define HAL_NAND_MODULE_ENABLED */
+/* #define HAL_NOR_MODULE_ENABLED */
+/* #define HAL_PCCARD_MODULE_ENABLED */
+/* #define HAL_SRAM_MODULE_ENABLED */
+/* #define HAL_SDRAM_MODULE_ENABLED */
+/* #define HAL_HASH_MODULE_ENABLED */
+#define HAL_I2C_MODULE_ENABLED
+#define HAL_I2S_MODULE_ENABLED
+/* #define HAL_IWDG_MODULE_ENABLED */
+/* #define HAL_LTDC_MODULE_ENABLED */
+#define HAL_RNG_MODULE_ENABLED
+/* #define HAL_RTC_MODULE_ENABLED */
+/* #define HAL_SAI_MODULE_ENABLED */
+/* #define HAL_SD_MODULE_ENABLED */
+/* #define HAL_MMC_MODULE_ENABLED */
+#define HAL_SPI_MODULE_ENABLED
+#define HAL_TIM_MODULE_ENABLED
+#define HAL_UART_MODULE_ENABLED
+#define HAL_USART_MODULE_ENABLED
+/* #define HAL_IRDA_MODULE_ENABLED */
+/* #define HAL_SMARTCARD_MODULE_ENABLED */
+/* #define HAL_WWDG_MODULE_ENABLED */
+#define HAL_PCD_MODULE_ENABLED
+/* #define HAL_HCD_MODULE_ENABLED */
+/* #define HAL_DSI_MODULE_ENABLED */
+/* #define HAL_QSPI_MODULE_ENABLED */
+/* #define HAL_QSPI_MODULE_ENABLED */
+/* #define HAL_CEC_MODULE_ENABLED */
+/* #define HAL_FMPI2C_MODULE_ENABLED */
+/* #define HAL_SPDIFRX_MODULE_ENABLED */
+/* #define HAL_DFSDM_MODULE_ENABLED */
+/* #define HAL_LPTIM_MODULE_ENABLED */
+/* #define HAL_EXTI_MODULE_ENABLED */
+#define HAL_GPIO_MODULE_ENABLED
+#define HAL_EXTI_MODULE_ENABLED
+#define HAL_DMA_MODULE_ENABLED
+#define HAL_RCC_MODULE_ENABLED
+#define HAL_FLASH_MODULE_ENABLED
+#define HAL_PWR_MODULE_ENABLED
+#define HAL_CORTEX_MODULE_ENABLED
+
+/* ########################## HSE/HSI Values adaptation ##################### */
+/**
+ * @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
+ * This value is used by the RCC HAL module to compute the system frequency
+ * (when HSE is used as system clock source, directly or through the PLL).
+ */
+#if !defined (HSE_VALUE)
+ #define HSE_VALUE ((uint32_t)8000000U) /*!< Value of the External oscillator in Hz */
+#endif /* HSE_VALUE */
+
+#if !defined (HSE_STARTUP_TIMEOUT)
+ #define HSE_STARTUP_TIMEOUT ((uint32_t)100U) /*!< Time out for HSE start up, in ms */
+#endif /* HSE_STARTUP_TIMEOUT */
+
+/**
+ * @brief Internal High Speed oscillator (HSI) value.
+ * This value is used by the RCC HAL module to compute the system frequency
+ * (when HSI is used as system clock source, directly or through the PLL).
+ */
+#if !defined (HSI_VALUE)
+ #define HSI_VALUE ((uint32_t)16000000U) /*!< Value of the Internal oscillator in Hz*/
+#endif /* HSI_VALUE */
+
+/**
+ * @brief Internal Low Speed oscillator (LSI) value.
+ */
+#if !defined (LSI_VALUE)
+ #define LSI_VALUE ((uint32_t)32000U) /*!< LSI Typical Value in Hz*/
+#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz
+ The real value may vary depending on the variations
+ in voltage and temperature.*/
+/**
+ * @brief External Low Speed oscillator (LSE) value.
+ */
+#if !defined (LSE_VALUE)
+ #define LSE_VALUE ((uint32_t)32768U) /*!< Value of the External Low Speed oscillator in Hz */
+#endif /* LSE_VALUE */
+
+#if !defined (LSE_STARTUP_TIMEOUT)
+ #define LSE_STARTUP_TIMEOUT ((uint32_t)5000U) /*!< Time out for LSE start up, in ms */
+#endif /* LSE_STARTUP_TIMEOUT */
+
+/**
+ * @brief External clock source for I2S peripheral
+ * This value is used by the I2S HAL module to compute the I2S clock source
+ * frequency, this source is inserted directly through I2S_CKIN pad.
+ */
+#if !defined (EXTERNAL_CLOCK_VALUE)
+ #define EXTERNAL_CLOCK_VALUE ((uint32_t)12288000U) /*!< Value of the External audio frequency in Hz*/
+#endif /* EXTERNAL_CLOCK_VALUE */
+
+/* Tip: To avoid modifying this file each time you need to use different HSE,
+ === you can define the HSE value in your toolchain compiler preprocessor. */
+
+/* ########################### System Configuration ######################### */
+/**
+ * @brief This is the HAL system configuration section
+ */
+#define VDD_VALUE ((uint32_t)3300U) /*!< Value of VDD in mv */
+#define TICK_INT_PRIORITY ((uint32_t)0U) /*!< tick interrupt priority */
+#define USE_RTOS 0U
+#define PREFETCH_ENABLE 1U
+#define INSTRUCTION_CACHE_ENABLE 1U
+#define DATA_CACHE_ENABLE 1U
+
+/* ########################## Assert Selection ############################## */
+/**
+ * @brief Uncomment the line below to expanse the "assert_param" macro in the
+ * HAL drivers code
+ */
+/* #define USE_FULL_ASSERT 1U */
+
+/* ################## Ethernet peripheral configuration ##################### */
+
+/* Section 1 : Ethernet peripheral configuration */
+
+/* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */
+#define MAC_ADDR0 2U
+#define MAC_ADDR1 0U
+#define MAC_ADDR2 0U
+#define MAC_ADDR3 0U
+#define MAC_ADDR4 0U
+#define MAC_ADDR5 0U
+
+/* Definition of the Ethernet driver buffers size and count */
+#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */
+#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */
+#define ETH_RXBUFNB ((uint32_t)4U) /* 4 Rx buffers of size ETH_RX_BUF_SIZE */
+#define ETH_TXBUFNB ((uint32_t)4U) /* 4 Tx buffers of size ETH_TX_BUF_SIZE */
+
+/* Section 2: PHY configuration section */
+
+/* DP83848_PHY_ADDRESS Address*/
+#define DP83848_PHY_ADDRESS 0x01U
+/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/
+#define PHY_RESET_DELAY ((uint32_t)0x000000FFU)
+/* PHY Configuration delay */
+#define PHY_CONFIG_DELAY ((uint32_t)0x00000FFFU)
+
+#define PHY_READ_TO ((uint32_t)0x0000FFFFU)
+#define PHY_WRITE_TO ((uint32_t)0x0000FFFFU)
+
+/* Section 3: Common PHY Registers */
+
+#define PHY_BCR ((uint16_t)0x0000U) /*!< Transceiver Basic Control Register */
+#define PHY_BSR ((uint16_t)0x0001U) /*!< Transceiver Basic Status Register */
+
+#define PHY_RESET ((uint16_t)0x8000U) /*!< PHY Reset */
+#define PHY_LOOPBACK ((uint16_t)0x4000U) /*!< Select loop-back mode */
+#define PHY_FULLDUPLEX_100M ((uint16_t)0x2100U) /*!< Set the full-duplex mode at 100 Mb/s */
+#define PHY_HALFDUPLEX_100M ((uint16_t)0x2000U) /*!< Set the half-duplex mode at 100 Mb/s */
+#define PHY_FULLDUPLEX_10M ((uint16_t)0x0100U) /*!< Set the full-duplex mode at 10 Mb/s */
+#define PHY_HALFDUPLEX_10M ((uint16_t)0x0000U) /*!< Set the half-duplex mode at 10 Mb/s */
+#define PHY_AUTONEGOTIATION ((uint16_t)0x1000U) /*!< Enable auto-negotiation function */
+#define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200U) /*!< Restart auto-negotiation function */
+#define PHY_POWERDOWN ((uint16_t)0x0800U) /*!< Select the power down mode */
+#define PHY_ISOLATE ((uint16_t)0x0400U) /*!< Isolate PHY from MII */
+
+#define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020U) /*!< Auto-Negotiation process completed */
+#define PHY_LINKED_STATUS ((uint16_t)0x0004U) /*!< Valid link established */
+#define PHY_JABBER_DETECTION ((uint16_t)0x0002U) /*!< Jabber condition detected */
+
+/* Section 4: Extended PHY Registers */
+#define PHY_SR ((uint16_t)0x10U) /*!< PHY status register Offset */
+
+#define PHY_SPEED_STATUS ((uint16_t)0x0002U) /*!< PHY Speed mask */
+#define PHY_DUPLEX_STATUS ((uint16_t)0x0004U) /*!< PHY Duplex mask */
+
+/* ################## SPI peripheral configuration ########################## */
+
+/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver
+* Activated: CRC code is present inside driver
+* Deactivated: CRC code cleaned from driver
+*/
+
+#define USE_SPI_CRC 0U
+
+/* Includes ------------------------------------------------------------------*/
+/**
+ * @brief Include module's header file
+ */
+
+#ifdef HAL_RCC_MODULE_ENABLED
+ #include "stm32f4xx_hal_rcc.h"
+#endif /* HAL_RCC_MODULE_ENABLED */
+
+#ifdef HAL_EXTI_MODULE_ENABLED
+ #include "stm32f4xx_hal_exti.h"
+#endif /* HAL_EXTI_MODULE_ENABLED */
+
+#ifdef HAL_GPIO_MODULE_ENABLED
+ #include "stm32f4xx_hal_gpio.h"
+#endif /* HAL_GPIO_MODULE_ENABLED */
+
+#ifdef HAL_DMA_MODULE_ENABLED
+ #include "stm32f4xx_hal_dma.h"
+#endif /* HAL_DMA_MODULE_ENABLED */
+
+#ifdef HAL_CORTEX_MODULE_ENABLED
+ #include "stm32f4xx_hal_cortex.h"
+#endif /* HAL_CORTEX_MODULE_ENABLED */
+
+#ifdef HAL_ADC_MODULE_ENABLED
+ #include "stm32f4xx_hal_adc.h"
+#endif /* HAL_ADC_MODULE_ENABLED */
+
+#ifdef HAL_CAN_MODULE_ENABLED
+ #include "stm32f4xx_hal_can.h"
+#endif /* HAL_CAN_MODULE_ENABLED */
+
+#ifdef HAL_CRC_MODULE_ENABLED
+ #include "stm32f4xx_hal_crc.h"
+#endif /* HAL_CRC_MODULE_ENABLED */
+
+#ifdef HAL_CRYP_MODULE_ENABLED
+ #include "stm32f4xx_hal_cryp.h"
+#endif /* HAL_CRYP_MODULE_ENABLED */
+
+#ifdef HAL_DMA2D_MODULE_ENABLED
+ #include "stm32f4xx_hal_dma2d.h"
+#endif /* HAL_DMA2D_MODULE_ENABLED */
+
+#ifdef HAL_DAC_MODULE_ENABLED
+ #include "stm32f4xx_hal_dac.h"
+#endif /* HAL_DAC_MODULE_ENABLED */
+
+#ifdef HAL_DCMI_MODULE_ENABLED
+ #include "stm32f4xx_hal_dcmi.h"
+#endif /* HAL_DCMI_MODULE_ENABLED */
+
+#ifdef HAL_ETH_MODULE_ENABLED
+ #include "stm32f4xx_hal_eth.h"
+#endif /* HAL_ETH_MODULE_ENABLED */
+
+#ifdef HAL_FLASH_MODULE_ENABLED
+ #include "stm32f4xx_hal_flash.h"
+#endif /* HAL_FLASH_MODULE_ENABLED */
+
+#ifdef HAL_SRAM_MODULE_ENABLED
+ #include "stm32f4xx_hal_sram.h"
+#endif /* HAL_SRAM_MODULE_ENABLED */
+
+#ifdef HAL_NOR_MODULE_ENABLED
+ #include "stm32f4xx_hal_nor.h"
+#endif /* HAL_NOR_MODULE_ENABLED */
+
+#ifdef HAL_NAND_MODULE_ENABLED
+ #include "stm32f4xx_hal_nand.h"
+#endif /* HAL_NAND_MODULE_ENABLED */
+
+#ifdef HAL_PCCARD_MODULE_ENABLED
+ #include "stm32f4xx_hal_pccard.h"
+#endif /* HAL_PCCARD_MODULE_ENABLED */
+
+#ifdef HAL_SDRAM_MODULE_ENABLED
+ #include "stm32f4xx_hal_sdram.h"
+#endif /* HAL_SDRAM_MODULE_ENABLED */
+
+#ifdef HAL_HASH_MODULE_ENABLED
+ #include "stm32f4xx_hal_hash.h"
+#endif /* HAL_HASH_MODULE_ENABLED */
+
+#ifdef HAL_I2C_MODULE_ENABLED
+ #include "stm32f4xx_hal_i2c.h"
+#endif /* HAL_I2C_MODULE_ENABLED */
+
+#ifdef HAL_I2S_MODULE_ENABLED
+ #include "stm32f4xx_hal_i2s.h"
+#endif /* HAL_I2S_MODULE_ENABLED */
+
+#ifdef HAL_IWDG_MODULE_ENABLED
+ #include "stm32f4xx_hal_iwdg.h"
+#endif /* HAL_IWDG_MODULE_ENABLED */
+
+#ifdef HAL_LTDC_MODULE_ENABLED
+ #include "stm32f4xx_hal_ltdc.h"
+#endif /* HAL_LTDC_MODULE_ENABLED */
+
+#ifdef HAL_PWR_MODULE_ENABLED
+ #include "stm32f4xx_hal_pwr.h"
+#endif /* HAL_PWR_MODULE_ENABLED */
+
+#ifdef HAL_RNG_MODULE_ENABLED
+ #include "stm32f4xx_hal_rng.h"
+#endif /* HAL_RNG_MODULE_ENABLED */
+
+#ifdef HAL_RTC_MODULE_ENABLED
+ #include "stm32f4xx_hal_rtc.h"
+#endif /* HAL_RTC_MODULE_ENABLED */
+
+#ifdef HAL_SAI_MODULE_ENABLED
+ #include "stm32f4xx_hal_sai.h"
+#endif /* HAL_SAI_MODULE_ENABLED */
+
+#ifdef HAL_SD_MODULE_ENABLED
+ #include "stm32f4xx_hal_sd.h"
+#endif /* HAL_SD_MODULE_ENABLED */
+
+#ifdef HAL_MMC_MODULE_ENABLED
+ #include "stm32f4xx_hal_mmc.h"
+#endif /* HAL_MMC_MODULE_ENABLED */
+
+#ifdef HAL_SPI_MODULE_ENABLED
+ #include "stm32f4xx_hal_spi.h"
+#endif /* HAL_SPI_MODULE_ENABLED */
+
+#ifdef HAL_TIM_MODULE_ENABLED
+ #include "stm32f4xx_hal_tim.h"
+#endif /* HAL_TIM_MODULE_ENABLED */
+
+#ifdef HAL_UART_MODULE_ENABLED
+ #include "stm32f4xx_hal_uart.h"
+#endif /* HAL_UART_MODULE_ENABLED */
+
+#ifdef HAL_USART_MODULE_ENABLED
+ #include "stm32f4xx_hal_usart.h"
+#endif /* HAL_USART_MODULE_ENABLED */
+
+#ifdef HAL_IRDA_MODULE_ENABLED
+ #include "stm32f4xx_hal_irda.h"
+#endif /* HAL_IRDA_MODULE_ENABLED */
+
+#ifdef HAL_SMARTCARD_MODULE_ENABLED
+ #include "stm32f4xx_hal_smartcard.h"
+#endif /* HAL_SMARTCARD_MODULE_ENABLED */
+
+#ifdef HAL_WWDG_MODULE_ENABLED
+ #include "stm32f4xx_hal_wwdg.h"
+#endif /* HAL_WWDG_MODULE_ENABLED */
+
+#ifdef HAL_PCD_MODULE_ENABLED
+ #include "stm32f4xx_hal_pcd.h"
+#endif /* HAL_PCD_MODULE_ENABLED */
+
+#ifdef HAL_HCD_MODULE_ENABLED
+ #include "stm32f4xx_hal_hcd.h"
+#endif /* HAL_HCD_MODULE_ENABLED */
+
+#ifdef HAL_DSI_MODULE_ENABLED
+ #include "stm32f4xx_hal_dsi.h"
+#endif /* HAL_DSI_MODULE_ENABLED */
+
+#ifdef HAL_QSPI_MODULE_ENABLED
+ #include "stm32f4xx_hal_qspi.h"
+#endif /* HAL_QSPI_MODULE_ENABLED */
+
+#ifdef HAL_CEC_MODULE_ENABLED
+ #include "stm32f4xx_hal_cec.h"
+#endif /* HAL_CEC_MODULE_ENABLED */
+
+#ifdef HAL_FMPI2C_MODULE_ENABLED
+ #include "stm32f4xx_hal_fmpi2c.h"
+#endif /* HAL_FMPI2C_MODULE_ENABLED */
+
+#ifdef HAL_SPDIFRX_MODULE_ENABLED
+ #include "stm32f4xx_hal_spdifrx.h"
+#endif /* HAL_SPDIFRX_MODULE_ENABLED */
+
+#ifdef HAL_DFSDM_MODULE_ENABLED
+ #include "stm32f4xx_hal_dfsdm.h"
+#endif /* HAL_DFSDM_MODULE_ENABLED */
+
+#ifdef HAL_LPTIM_MODULE_ENABLED
+ #include "stm32f4xx_hal_lptim.h"
+#endif /* HAL_LPTIM_MODULE_ENABLED */
+
+/* Exported macro ------------------------------------------------------------*/
+#ifdef USE_FULL_ASSERT
+/**
+ * @brief The assert_param macro is used for function's parameters check.
+ * @param expr: If expr is false, it calls assert_failed function
+ * which reports the name of the source file and the source
+ * line number of the call that failed.
+ * If expr is true, it returns no value.
+ * @retval None
+ */
+ #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
+/* Exported functions ------------------------------------------------------- */
+ void assert_failed(uint8_t* file, uint32_t line);
+#else
+ #define assert_param(expr) ((void)0U)
+#endif /* USE_FULL_ASSERT */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STM32F4xx_HAL_CONF_H */
+
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/ports/stm32f4/system_stm32f4xx.c b/ports/stm/boards/system_stm32f4xx.c
index bce420056..caa4f9caf 100644
--- a/ports/stm32f4/system_stm32f4xx.c
+++ b/ports/stm/boards/system_stm32f4xx.c
@@ -218,7 +218,7 @@ void SystemInit(void)
#endif /* DATA_IN_ExtSRAM || DATA_IN_ExtSDRAM */
/* Configure the Vector Table location add offset address ------------------*/
-#if !defined(BOARD_VTOR_DEFER) //only set VTOR if the bootloader hasn't already
+#if !(BOARD_VTOR_DEFER) //only set VTOR if the bootloader hasn't already
#ifdef VECT_TAB_SRAM
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
#else
diff --git a/ports/stm/boards/system_stm32f7xx.c b/ports/stm/boards/system_stm32f7xx.c
new file mode 100644
index 000000000..184fefb36
--- /dev/null
+++ b/ports/stm/boards/system_stm32f7xx.c
@@ -0,0 +1,247 @@
+/**
+ ******************************************************************************
+ * @file system_stm32f7xx.c
+ * @author MCD Application Team
+ * @brief CMSIS Cortex-M7 Device Peripheral Access Layer System Source File.
+ *
+ * This file provides two functions and one global variable to be called from
+ * user application:
+ * - SystemInit(): This function is called at startup just after reset and
+ * before branch to main program. This call is made inside
+ * the "startup_stm32f7xx.s" file.
+ *
+ * - SystemCoreClock variable: Contains the core clock (HCLK), it can be used
+ * by the user application to setup the SysTick
+ * timer or configure other parameters.
+ *
+ * - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must
+ * be called whenever the core clock is changed
+ * during program execution.
+ *
+ *
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
+ * All rights reserved.</center></h2>
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+
+/** @addtogroup CMSIS
+ * @{
+ */
+
+/** @addtogroup stm32f7xx_system
+ * @{
+ */
+
+/** @addtogroup STM32F7xx_System_Private_Includes
+ * @{
+ */
+
+#include "stm32f7xx.h"
+
+#if !defined (HSE_VALUE)
+ #define HSE_VALUE ((uint32_t)25000000) /*!< Default value of the External oscillator in Hz */
+#endif /* HSE_VALUE */
+
+#if !defined (HSI_VALUE)
+ #define HSI_VALUE ((uint32_t)16000000) /*!< Value of the Internal oscillator in Hz*/
+#endif /* HSI_VALUE */
+
+/**
+ * @}
+ */
+
+/** @addtogroup STM32F7xx_System_Private_TypesDefinitions
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @addtogroup STM32F7xx_System_Private_Defines
+ * @{
+ */
+
+/************************* Miscellaneous Configuration ************************/
+
+/*!< Uncomment the following line if you need to relocate your vector Table in
+ Internal SRAM. */
+/* #define VECT_TAB_SRAM */
+#define VECT_TAB_OFFSET 0x00 /*!< Vector Table base offset field.
+ This value must be a multiple of 0x200. */
+/******************************************************************************/
+
+/**
+ * @}
+ */
+
+/** @addtogroup STM32F7xx_System_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @addtogroup STM32F7xx_System_Private_Variables
+ * @{
+ */
+
+ /* This variable is updated in three ways:
+ 1) by calling CMSIS function SystemCoreClockUpdate()
+ 2) by calling HAL API function HAL_RCC_GetHCLKFreq()
+ 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
+ Note: If you use this function to configure the system clock; then there
+ is no need to call the 2 first functions listed above, since SystemCoreClock
+ variable is updated automatically.
+ */
+ uint32_t SystemCoreClock = 16000000;
+ const uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
+ const uint8_t APBPrescTable[8] = {0, 0, 0, 0, 1, 2, 3, 4};
+
+/**
+ * @}
+ */
+
+/** @addtogroup STM32F7xx_System_Private_FunctionPrototypes
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @addtogroup STM32F7xx_System_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Setup the microcontroller system
+ * Initialize the Embedded Flash Interface, the PLL and update the
+ * SystemFrequency variable.
+ * @param None
+ * @retval None
+ */
+void SystemInit(void)
+{
+ /* FPU settings ------------------------------------------------------------*/
+#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
+ SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2)); /* set CP10 and CP11 Full Access */
+#endif
+
+ /* Configure the Vector Table location add offset address ------------------*/
+#if !(BOARD_VTOR_DEFER) //only set VTOR if the bootloader hasn't already
+ #ifdef VECT_TAB_SRAM
+ SCB->VTOR = RAMDTCM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
+ #else
+ SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
+ #endif
+#endif
+
+}
+
+/**
+ * @brief Update SystemCoreClock variable according to Clock Register Values.
+ * The SystemCoreClock variable contains the core clock (HCLK), it can
+ * be used by the user application to setup the SysTick timer or configure
+ * other parameters.
+ *
+ * @note Each time the core clock (HCLK) changes, this function must be called
+ * to update SystemCoreClock variable value. Otherwise, any configuration
+ * based on this variable will be incorrect.
+ *
+ * @note - The system frequency computed by this function is not the real
+ * frequency in the chip. It is calculated based on the predefined
+ * constant and the selected clock source:
+ *
+ * - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*)
+ *
+ * - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(**)
+ *
+ * - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**)
+ * or HSI_VALUE(*) multiplied/divided by the PLL factors.
+ *
+ * (*) HSI_VALUE is a constant defined in stm32f7xx_hal_conf.h file (default value
+ * 16 MHz) but the real value may vary depending on the variations
+ * in voltage and temperature.
+ *
+ * (**) HSE_VALUE is a constant defined in stm32f7xx_hal_conf.h file (default value
+ * 25 MHz), user has to ensure that HSE_VALUE is same as the real
+ * frequency of the crystal used. Otherwise, this function may
+ * have wrong result.
+ *
+ * - The result of this function could be not correct when using fractional
+ * value for HSE crystal.
+ *
+ * @param None
+ * @retval None
+ */
+void SystemCoreClockUpdate(void)
+{
+ uint32_t tmp = 0, pllvco = 0, pllp = 2, pllsource = 0, pllm = 2;
+
+ /* Get SYSCLK source -------------------------------------------------------*/
+ tmp = RCC->CFGR & RCC_CFGR_SWS;
+
+ switch (tmp)
+ {
+ case 0x00: /* HSI used as system clock source */
+ SystemCoreClock = HSI_VALUE;
+ break;
+ case 0x04: /* HSE used as system clock source */
+ SystemCoreClock = HSE_VALUE;
+ break;
+ case 0x08: /* PLL used as system clock source */
+
+ /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N
+ SYSCLK = PLL_VCO / PLL_P
+ */
+ pllsource = (RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) >> 22;
+ pllm = RCC->PLLCFGR & RCC_PLLCFGR_PLLM;
+
+ if (pllsource != 0)
+ {
+ /* HSE used as PLL clock source */
+ pllvco = (HSE_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6);
+ }
+ else
+ {
+ /* HSI used as PLL clock source */
+ pllvco = (HSI_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6);
+ }
+
+ pllp = (((RCC->PLLCFGR & RCC_PLLCFGR_PLLP) >>16) + 1 ) *2;
+ SystemCoreClock = pllvco/pllp;
+ break;
+ default:
+ SystemCoreClock = HSI_VALUE;
+ break;
+ }
+ /* Compute HCLK frequency --------------------------------------------------*/
+ /* Get HCLK prescaler */
+ tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4)];
+ /* HCLK frequency */
+ SystemCoreClock >>= tmp;
+}
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/ports/stm/boards/system_stm32h7xx.c b/ports/stm/boards/system_stm32h7xx.c
new file mode 100644
index 000000000..2132f26a0
--- /dev/null
+++ b/ports/stm/boards/system_stm32h7xx.c
@@ -0,0 +1,425 @@
+/*
+ * Taken from ST Cube library and modified. See below for original header.
+ *
+ * Modifications copyright (c) 2020 Lucian Copeland 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.
+ */
+
+/**
+ ******************************************************************************
+ * @file system_stm32h7xx.c
+ * @author MCD Application Team
+ * @brief CMSIS Cortex-Mx Device Peripheral Access Layer System Source File.
+ *
+ * This file provides two functions and one global variable to be called from
+ * user application:
+ * - SystemInit(): This function is called at startup just after reset and
+ * before branch to main program. This call is made inside
+ * the "startup_stm32h7xx.s" file.
+ *
+ * - SystemCoreClock variable: Contains the core clock, it can be used
+ * by the user application to setup the SysTick
+ * timer or configure other parameters.
+ *
+ * - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must
+ * be called whenever the core clock is changed
+ * during program execution.
+ *
+ *
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
+ * All rights reserved.</center></h2>
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+
+/** @addtogroup CMSIS
+ * @{
+ */
+
+/** @addtogroup stm32h7xx_system
+ * @{
+ */
+
+/** @addtogroup STM32H7xx_System_Private_Includes
+ * @{
+ */
+
+#include "stm32h7xx.h"
+#include <math.h>
+#if !defined (HSE_VALUE)
+#define HSE_VALUE ((uint32_t)25000000) /*!< Value of the External oscillator in Hz */
+#endif /* HSE_VALUE */
+
+#if !defined (CSI_VALUE)
+ #define CSI_VALUE ((uint32_t)4000000) /*!< Value of the Internal oscillator in Hz*/
+#endif /* CSI_VALUE */
+
+#if !defined (HSI_VALUE)
+ #define HSI_VALUE ((uint32_t)64000000) /*!< Value of the Internal oscillator in Hz*/
+#endif /* HSI_VALUE */
+
+
+/**
+ * @}
+ */
+
+/** @addtogroup STM32H7xx_System_Private_TypesDefinitions
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @addtogroup STM32H7xx_System_Private_Defines
+ * @{
+ */
+
+/************************* Miscellaneous Configuration ************************/
+/*!< Uncomment the following line if you need to use initialized data in D2 domain SRAM (AHB SRAM) */
+/* #define DATA_IN_D2_SRAM */
+
+/*!< Uncomment the following line if you need to relocate your vector Table in
+ Internal SRAM. */
+/* #define VECT_TAB_SRAM */
+#define VECT_TAB_OFFSET 0x00000000UL /*!< Vector Table base offset field.
+ This value must be a multiple of 0x200. */
+/******************************************************************************/
+
+/**
+ * @}
+ */
+
+/** @addtogroup STM32H7xx_System_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @addtogroup STM32H7xx_System_Private_Variables
+ * @{
+ */
+ /* This variable is updated in three ways:
+ 1) by calling CMSIS function SystemCoreClockUpdate()
+ 2) by calling HAL API function HAL_RCC_GetHCLKFreq()
+ 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
+ Note: If you use this function to configure the system clock; then there
+ is no need to call the 2 first functions listed above, since SystemCoreClock
+ variable is updated automatically.
+ */
+ uint32_t SystemCoreClock = 64000000;
+ uint32_t SystemD2Clock = 64000000;
+ const uint8_t D1CorePrescTable[16] = {0, 0, 0, 0, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8, 9};
+
+/**
+ * @}
+ */
+
+/** @addtogroup STM32H7xx_System_Private_FunctionPrototypes
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @addtogroup STM32H7xx_System_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Setup the microcontroller system
+ * Initialize the FPU setting and vector table location
+ * configuration.
+ * @param None
+ * @retval None
+ */
+void SystemInit (void)
+{
+#if defined (DATA_IN_D2_SRAM)
+ __IO uint32_t tmpreg;
+#endif /* DATA_IN_D2_SRAM */
+
+ /* FPU settings ------------------------------------------------------------*/
+ #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
+ SCB->CPACR |= ((3UL << (10*2))|(3UL << (11*2))); /* set CP10 and CP11 Full Access */
+ #endif
+ /* Reset the RCC clock configuration to the default reset state ------------*/
+ /* Set HSION bit */
+ RCC->CR |= RCC_CR_HSION;
+
+ /* Reset CFGR register */
+ RCC->CFGR = 0x00000000;
+
+ /* Reset HSEON, CSSON , CSION,RC48ON, CSIKERON PLL1ON, PLL2ON and PLL3ON bits */
+ RCC->CR &= 0xEAF6ED7FU;
+
+#if defined(D3_SRAM_BASE)
+ /* Reset D1CFGR register */
+ RCC->D1CFGR = 0x00000000;
+
+ /* Reset D2CFGR register */
+ RCC->D2CFGR = 0x00000000;
+
+ /* Reset D3CFGR register */
+ RCC->D3CFGR = 0x00000000;
+#else
+ /* Reset CDCFGR1 register */
+ RCC->CDCFGR1 = 0x00000000;
+
+ /* Reset CDCFGR2 register */
+ RCC->CDCFGR2 = 0x00000000;
+
+ /* Reset SRDCFGR register */
+ RCC->SRDCFGR = 0x00000000;
+#endif
+ /* Reset PLLCKSELR register */
+ RCC->PLLCKSELR = 0x00000000;
+
+ /* Reset PLLCFGR register */
+ RCC->PLLCFGR = 0x00000000;
+ /* Reset PLL1DIVR register */
+ RCC->PLL1DIVR = 0x00000000;
+ /* Reset PLL1FRACR register */
+ RCC->PLL1FRACR = 0x00000000;
+
+ /* Reset PLL2DIVR register */
+ RCC->PLL2DIVR = 0x00000000;
+
+ /* Reset PLL2FRACR register */
+
+ RCC->PLL2FRACR = 0x00000000;
+ /* Reset PLL3DIVR register */
+ RCC->PLL3DIVR = 0x00000000;
+
+ /* Reset PLL3FRACR register */
+ RCC->PLL3FRACR = 0x00000000;
+
+ /* Reset HSEBYP bit */
+ RCC->CR &= 0xFFFBFFFFU;
+
+ /* Disable all interrupts */
+ RCC->CIER = 0x00000000;
+
+#if (STM32H7_DEV_ID == 0x450UL)
+ /* dual core CM7 or single core line */
+ if((DBGMCU->IDCODE & 0xFFFF0000U) < 0x20000000U)
+ {
+ /* if stm32h7 revY*/
+ /* Change the switch matrix read issuing capability to 1 for the AXI SRAM target (Target 7) */
+ *((__IO uint32_t*)0x51008108) = 0x000000001U;
+ }
+#endif
+
+#if defined (DATA_IN_D2_SRAM)
+ /* in case of initialized data in D2 SRAM (AHB SRAM) , enable the D2 SRAM clock (AHB SRAM clock) */
+#if defined(RCC_AHB2ENR_D2SRAM3EN)
+ RCC->AHB2ENR |= (RCC_AHB2ENR_D2SRAM1EN | RCC_AHB2ENR_D2SRAM2EN | RCC_AHB2ENR_D2SRAM3EN);
+#elif defined(RCC_AHB2ENR_D2SRAM2EN)
+ RCC->AHB2ENR |= (RCC_AHB2ENR_D2SRAM1EN | RCC_AHB2ENR_D2SRAM2EN);
+#else
+ RCC->AHB2ENR |= (RCC_AHB2ENR_AHBSRAM1EN | RCC_AHB2ENR_AHBSRAM2EN);
+#endif /* RCC_AHB2ENR_D2SRAM3EN */
+
+ tmpreg = RCC->AHB2ENR;
+ (void) tmpreg;
+#endif /* DATA_IN_D2_SRAM */
+
+#if defined(DUAL_CORE) && defined(CORE_CM4)
+ /* Configure the Vector Table location add offset address for cortex-M4 ------------------*/
+#ifdef VECT_TAB_SRAM
+ SCB->VTOR = D2_AHBSRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
+#else
+ SCB->VTOR = FLASH_BANK2_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
+#endif /* VECT_TAB_SRAM */
+
+#else
+
+ /* Configure the Vector Table location add offset address for cortex-M7 ------------------*/
+#if !(BOARD_VTOR_DEFER) //only set VTOR if the bootloader hasn't already
+ #ifdef VECT_TAB_SRAM
+ SCB->VTOR = D1_AXISRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal AXI-RAM */
+ #else
+ SCB->VTOR = FLASH_BANK1_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
+ #endif
+#endif
+
+#endif /*DUAL_CORE && CORE_CM4*/
+
+}
+
+/**
+ * @brief Update SystemCoreClock variable according to Clock Register Values.
+ * The SystemCoreClock variable contains the core clock , it can
+ * be used by the user application to setup the SysTick timer or configure
+ * other parameters.
+ *
+ * @note Each time the core clock changes, this function must be called
+ * to update SystemCoreClock variable value. Otherwise, any configuration
+ * based on this variable will be incorrect.
+ *
+ * @note - The system frequency computed by this function is not the real
+ * frequency in the chip. It is calculated based on the predefined
+ * constant and the selected clock source:
+ *
+ * - If SYSCLK source is CSI, SystemCoreClock will contain the CSI_VALUE(*)
+ * - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(**)
+ * - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(***)
+ * - If SYSCLK source is PLL, SystemCoreClock will contain the CSI_VALUE(*),
+ * HSI_VALUE(**) or HSE_VALUE(***) multiplied/divided by the PLL factors.
+ *
+ * (*) CSI_VALUE is a constant defined in stm32h7xx_hal.h file (default value
+ * 4 MHz) but the real value may vary depending on the variations
+ * in voltage and temperature.
+ * (**) HSI_VALUE is a constant defined in stm32h7xx_hal.h file (default value
+ * 64 MHz) but the real value may vary depending on the variations
+ * in voltage and temperature.
+ *
+ * (***)HSE_VALUE is a constant defined in stm32h7xx_hal.h file (default value
+ * 25 MHz), user has to ensure that HSE_VALUE is same as the real
+ * frequency of the crystal used. Otherwise, this function may
+ * have wrong result.
+ *
+ * - The result of this function could be not correct when using fractional
+ * value for HSE crystal.
+ * @param None
+ * @retval None
+ */
+void SystemCoreClockUpdate (void)
+{
+ uint32_t pllp, pllsource, pllm, pllfracen, hsivalue, tmp;
+ uint32_t common_system_clock;
+ float_t fracn1, pllvco;
+
+
+ /* Get SYSCLK source -------------------------------------------------------*/
+
+ switch (RCC->CFGR & RCC_CFGR_SWS)
+ {
+ case RCC_CFGR_SWS_HSI: /* HSI used as system clock source */
+ common_system_clock = (uint32_t) (HSI_VALUE >> ((RCC->CR & RCC_CR_HSIDIV)>> 3));
+ break;
+
+ case RCC_CFGR_SWS_CSI: /* CSI used as system clock source */
+ common_system_clock = CSI_VALUE;
+ break;
+
+ case RCC_CFGR_SWS_HSE: /* HSE used as system clock source */
+ common_system_clock = HSE_VALUE;
+ break;
+
+ case RCC_CFGR_SWS_PLL1: /* PLL1 used as system clock source */
+
+ /* PLL_VCO = (HSE_VALUE or HSI_VALUE or CSI_VALUE/ PLLM) * PLLN
+ SYSCLK = PLL_VCO / PLLR
+ */
+ pllsource = (RCC->PLLCKSELR & RCC_PLLCKSELR_PLLSRC);
+ pllm = ((RCC->PLLCKSELR & RCC_PLLCKSELR_DIVM1)>> 4) ;
+ pllfracen = ((RCC->PLLCFGR & RCC_PLLCFGR_PLL1FRACEN)>>RCC_PLLCFGR_PLL1FRACEN_Pos);
+ fracn1 = (float_t)(uint32_t)(pllfracen* ((RCC->PLL1FRACR & RCC_PLL1FRACR_FRACN1)>> 3));
+
+ if (pllm != 0U)
+ {
+ switch (pllsource)
+ {
+ case RCC_PLLCKSELR_PLLSRC_HSI: /* HSI used as PLL clock source */
+
+ hsivalue = (HSI_VALUE >> ((RCC->CR & RCC_CR_HSIDIV)>> 3)) ;
+ pllvco = ( (float_t)hsivalue / (float_t)pllm) * ((float_t)(uint32_t)(RCC->PLL1DIVR & RCC_PLL1DIVR_N1) + (fracn1/(float_t)0x2000) +(float_t)1 );
+
+ break;
+
+ case RCC_PLLCKSELR_PLLSRC_CSI: /* CSI used as PLL clock source */
+ pllvco = ((float_t)CSI_VALUE / (float_t)pllm) * ((float_t)(uint32_t)(RCC->PLL1DIVR & RCC_PLL1DIVR_N1) + (fracn1/(float_t)0x2000) +(float_t)1 );
+ break;
+
+ case RCC_PLLCKSELR_PLLSRC_HSE: /* HSE used as PLL clock source */
+ pllvco = ((float_t)HSE_VALUE / (float_t)pllm) * ((float_t)(uint32_t)(RCC->PLL1DIVR & RCC_PLL1DIVR_N1) + (fracn1/(float_t)0x2000) +(float_t)1 );
+ break;
+
+ default:
+ pllvco = ((float_t)CSI_VALUE / (float_t)pllm) * ((float_t)(uint32_t)(RCC->PLL1DIVR & RCC_PLL1DIVR_N1) + (fracn1/(float_t)0x2000) +(float_t)1 );
+ break;
+ }
+ pllp = (((RCC->PLL1DIVR & RCC_PLL1DIVR_P1) >>9) + 1U ) ;
+ common_system_clock = (uint32_t)(float_t)(pllvco/(float_t)pllp);
+ }
+ else
+ {
+ common_system_clock = 0U;
+ }
+ break;
+
+ default:
+ common_system_clock = CSI_VALUE;
+ break;
+ }
+
+ /* Compute SystemClock frequency --------------------------------------------------*/
+#if defined (RCC_D1CFGR_D1CPRE)
+ tmp = D1CorePrescTable[(RCC->D1CFGR & RCC_D1CFGR_D1CPRE)>> RCC_D1CFGR_D1CPRE_Pos];
+
+ /* common_system_clock frequency : CM7 CPU frequency */
+ common_system_clock >>= tmp;
+
+ /* SystemD2Clock frequency : CM4 CPU, AXI and AHBs Clock frequency */
+ SystemD2Clock = (common_system_clock >> ((D1CorePrescTable[(RCC->D1CFGR & RCC_D1CFGR_HPRE)>> RCC_D1CFGR_HPRE_Pos]) & 0x1FU));
+
+#else
+ tmp = D1CorePrescTable[(RCC->CDCFGR1 & RCC_CDCFGR1_CDCPRE)>> RCC_CDCFGR1_CDCPRE_Pos];
+
+ /* common_system_clock frequency : CM7 CPU frequency */
+ common_system_clock >>= tmp;
+
+ /* SystemD2Clock frequency : AXI and AHBs Clock frequency */
+ SystemD2Clock = (common_system_clock >> ((D1CorePrescTable[(RCC->CDCFGR1 & RCC_CDCFGR1_HPRE)>> RCC_CDCFGR1_HPRE_Pos]) & 0x1FU));
+
+#endif
+
+#if defined(DUAL_CORE) && defined(CORE_CM4)
+ SystemCoreClock = SystemD2Clock;
+#else
+ SystemCoreClock = common_system_clock;
+#endif /* DUAL_CORE && CORE_CM4 */
+}
+
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/ports/stm/boards/thunderpack/board.c b/ports/stm/boards/thunderpack/board.c
new file mode 100644
index 000000000..4421970ee
--- /dev/null
+++ b/ports/stm/boards/thunderpack/board.c
@@ -0,0 +1,38 @@
+/*
+ * 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) {
+
+}
diff --git a/ports/stm/boards/thunderpack/mpconfigboard.h b/ports/stm/boards/thunderpack/mpconfigboard.h
new file mode 100644
index 000000000..0b3c55819
--- /dev/null
+++ b/ports/stm/boards/thunderpack/mpconfigboard.h
@@ -0,0 +1,51 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Lucian Copeland 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.
+ */
+#define MICROPY_HW_BOARD_NAME "THUNDERPACK"
+#define MICROPY_HW_MCU_NAME "STM32F411CE"
+
+// Non-volatile memory config
+#define CIRCUITPY_INTERNAL_NVM_SIZE (0x4000)
+#define CIRCUITPY_INTERNAL_NVM_START_ADDR (0x0800C000)
+#define CIRCUITPY_INTERNAL_NVM_SECTOR FLASH_SECTOR_3
+
+// Putting the entire flash sector in the NVM byte array buffer
+// would take up too much RAM. This limits how much of the sector we use.
+#define NVM_BYTEARRAY_BUFFER_SIZE 512
+
+// Flash config
+#define FLASH_SIZE (0x80000)
+#define FLASH_PAGE_SIZE (0x4000)
+#define BOARD_FLASH_SIZE (FLASH_SIZE - CIRCUITPY_INTERNAL_NVM_SIZE- 0x2000 - 0xC000)
+
+#define BOARD_OSC_DIV (24)
+#define BOARD_OVERWRITE_SWD (1)
+#define BOARD_NO_VBUS_SENSE (1)
+
+// Status LEDs
+#define MICROPY_HW_LED_STATUS (&pin_PA02)
+
+#define DEFAULT_I2C_BUS_SCL (&pin_PB06)
+#define DEFAULT_I2C_BUS_SDA (&pin_PB07)
diff --git a/ports/stm/boards/thunderpack/mpconfigboard.mk b/ports/stm/boards/thunderpack/mpconfigboard.mk
new file mode 100644
index 000000000..007b00cdd
--- /dev/null
+++ b/ports/stm/boards/thunderpack/mpconfigboard.mk
@@ -0,0 +1,17 @@
+USB_VID = 0x239A
+USB_PID = 0x806A
+USB_PRODUCT = "Thunderpack STM32F411"
+USB_MANUFACTURER = "Jeremy Gillick"
+USB_DEVICES = "CDC,MSC"
+
+INTERNAL_FLASH_FILESYSTEM = 1
+LONGINT_IMPL = NONE
+
+CIRCUITPY_NVM = 1
+
+MCU_SERIES = F4
+MCU_VARIANT = STM32F411xE
+MCU_PACKAGE = UFQFPN48
+
+LD_COMMON = boards/common_nvm.ld
+LD_FILE = boards/STM32F411_nvm.ld
diff --git a/ports/stm/boards/thunderpack/pins.c b/ports/stm/boards/thunderpack/pins.c
new file mode 100644
index 000000000..559d9658e
--- /dev/null
+++ b/ports/stm/boards/thunderpack/pins.c
@@ -0,0 +1,34 @@
+#include "shared-bindings/board/__init__.h"
+
+STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_PA0), MP_ROM_PTR(&pin_PA00) },
+ { MP_ROM_QSTR(MP_QSTR_PA1), MP_ROM_PTR(&pin_PA01) },
+ { MP_ROM_QSTR(MP_QSTR_PA2), MP_ROM_PTR(&pin_PA02) },
+ { MP_ROM_QSTR(MP_QSTR_PA3), MP_ROM_PTR(&pin_PA03) },
+ { MP_ROM_QSTR(MP_QSTR_PA4), MP_ROM_PTR(&pin_PA04) },
+ { MP_ROM_QSTR(MP_QSTR_PA5), MP_ROM_PTR(&pin_PA05) },
+ { MP_ROM_QSTR(MP_QSTR_PA6), MP_ROM_PTR(&pin_PA06) },
+ { MP_ROM_QSTR(MP_QSTR_PA7), MP_ROM_PTR(&pin_PA07) },
+ { MP_ROM_QSTR(MP_QSTR_PA8), MP_ROM_PTR(&pin_PA08) },
+ { MP_ROM_QSTR(MP_QSTR_PA9), MP_ROM_PTR(&pin_PA09) },
+ { MP_ROM_QSTR(MP_QSTR_PA10), MP_ROM_PTR(&pin_PA10) },
+ { MP_ROM_QSTR(MP_QSTR_PA13), MP_ROM_PTR(&pin_PA13) },
+ { MP_ROM_QSTR(MP_QSTR_PA14), MP_ROM_PTR(&pin_PA14) },
+
+ { MP_ROM_QSTR(MP_QSTR_PB5), MP_ROM_PTR(&pin_PB05) },
+ { MP_ROM_QSTR(MP_QSTR_PB6), MP_ROM_PTR(&pin_PB06) },
+ { MP_ROM_QSTR(MP_QSTR_PB7), MP_ROM_PTR(&pin_PB07) },
+
+ { MP_ROM_QSTR(MP_QSTR_LED1), MP_ROM_PTR(&pin_PA00) },
+ { MP_ROM_QSTR(MP_QSTR_LED2), MP_ROM_PTR(&pin_PA01) },
+ { MP_ROM_QSTR(MP_QSTR_LED3), MP_ROM_PTR(&pin_PA02) },
+ { MP_ROM_QSTR(MP_QSTR_LED4), MP_ROM_PTR(&pin_PA03) },
+
+ { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_PB04) },
+
+ { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB06) },
+ { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB07) },
+
+ { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
+};
+MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
diff --git a/ports/stm/boards/thunderpack/stm32f4xx_hal_conf.h b/ports/stm/boards/thunderpack/stm32f4xx_hal_conf.h
new file mode 100644
index 000000000..5cb563422
--- /dev/null
+++ b/ports/stm/boards/thunderpack/stm32f4xx_hal_conf.h
@@ -0,0 +1,440 @@
+/**
+ ******************************************************************************
+ * @file stm32f4xx_hal_conf_template.h
+ * @author MCD Application Team
+ * @brief HAL configuration template file.
+ * This file should be copied to the application folder and renamed
+ * to stm32f4xx_hal_conf.h.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
+ * All rights reserved.</center></h2>
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __STM32F4xx_HAL_CONF_H
+#define __STM32F4xx_HAL_CONF_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Exported types ------------------------------------------------------------*/
+/* Exported constants --------------------------------------------------------*/
+
+/* ########################## Module Selection ############################## */
+/**
+ * @brief This is the list of modules to be used in the HAL driver
+ */
+#define HAL_MODULE_ENABLED
+
+#define HAL_ADC_MODULE_ENABLED
+/* #define HAL_CRYP_MODULE_ENABLED */
+/* #define HAL_CAN_MODULE_ENABLED */
+/* #define HAL_CRC_MODULE_ENABLED */
+/* #define HAL_CRYP_MODULE_ENABLED */
+#define HAL_DAC_MODULE_ENABLED
+/* #define HAL_DCMI_MODULE_ENABLED */
+/* #define HAL_DMA2D_MODULE_ENABLED */
+/* #define HAL_ETH_MODULE_ENABLED */
+/* #define HAL_NAND_MODULE_ENABLED */
+/* #define HAL_NOR_MODULE_ENABLED */
+/* #define HAL_PCCARD_MODULE_ENABLED */
+/* #define HAL_SRAM_MODULE_ENABLED */
+/* #define HAL_SDRAM_MODULE_ENABLED */
+/* #define HAL_HASH_MODULE_ENABLED */
+#define HAL_I2C_MODULE_ENABLED
+#define HAL_I2S_MODULE_ENABLED
+/* #define HAL_IWDG_MODULE_ENABLED */
+/* #define HAL_LTDC_MODULE_ENABLED */
+/* #define HAL_RNG_MODULE_ENABLED */
+/* #define HAL_RTC_MODULE_ENABLED */
+/* #define HAL_SAI_MODULE_ENABLED */
+/* #define HAL_SD_MODULE_ENABLED */
+/* #define HAL_MMC_MODULE_ENABLED */
+#define HAL_SPI_MODULE_ENABLED
+#define HAL_TIM_MODULE_ENABLED
+#define HAL_UART_MODULE_ENABLED
+#define HAL_USART_MODULE_ENABLED
+/* #define HAL_IRDA_MODULE_ENABLED */
+/* #define HAL_SMARTCARD_MODULE_ENABLED */
+/* #define HAL_WWDG_MODULE_ENABLED */
+/* #define HAL_PCD_MODULE_ENABLED */
+/* #define HAL_HCD_MODULE_ENABLED */
+/* #define HAL_DSI_MODULE_ENABLED */
+/* #define HAL_QSPI_MODULE_ENABLED */
+/* #define HAL_QSPI_MODULE_ENABLED */
+/* #define HAL_CEC_MODULE_ENABLED */
+/* #define HAL_FMPI2C_MODULE_ENABLED */
+/* #define HAL_SPDIFRX_MODULE_ENABLED */
+/* #define HAL_DFSDM_MODULE_ENABLED */
+/* #define HAL_LPTIM_MODULE_ENABLED */
+/* #define HAL_EXTI_MODULE_ENABLED */
+#define HAL_GPIO_MODULE_ENABLED
+#define HAL_EXTI_MODULE_ENABLED
+#define HAL_DMA_MODULE_ENABLED
+#define HAL_RCC_MODULE_ENABLED
+#define HAL_FLASH_MODULE_ENABLED
+#define HAL_PWR_MODULE_ENABLED
+#define HAL_CORTEX_MODULE_ENABLED
+
+/* ########################## HSE/HSI Values adaptation ##################### */
+/**
+ * @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
+ * This value is used by the RCC HAL module to compute the system frequency
+ * (when HSE is used as system clock source, directly or through the PLL).
+ */
+#if !defined (HSE_VALUE)
+ #define HSE_VALUE ((uint32_t)24000000) /*!< Value of the External oscillator in Hz */
+#endif /* HSE_VALUE */
+
+#if !defined (HSE_STARTUP_TIMEOUT)
+ #define HSE_STARTUP_TIMEOUT ((uint32_t)100U) /*!< Time out for HSE start up, in ms */
+#endif /* HSE_STARTUP_TIMEOUT */
+
+/**
+ * @brief Internal High Speed oscillator (HSI) value.
+ * This value is used by the RCC HAL module to compute the system frequency
+ * (when HSI is used as system clock source, directly or through the PLL).
+ */
+#if !defined (HSI_VALUE)
+ #define HSI_VALUE ((uint32_t)16000000) /*!< Value of the Internal oscillator in Hz*/
+#endif /* HSI_VALUE */
+
+/**
+ * @brief Internal Low Speed oscillator (LSI) value.
+ */
+#if !defined (LSI_VALUE)
+ #define LSI_VALUE ((uint32_t)40000)
+#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz
+ The real value may vary depending on the variations
+ in voltage and temperature. */
+/**
+ * @brief External Low Speed oscillator (LSE) value.
+ */
+#if !defined (LSE_VALUE)
+ #define LSE_VALUE ((uint32_t)32768) /*!< Value of the External Low Speed oscillator in Hz */
+#endif /* LSE_VALUE */
+
+#if !defined (LSE_STARTUP_TIMEOUT)
+ #define LSE_STARTUP_TIMEOUT ((uint32_t)5000U) /*!< Time out for LSE start up, in ms */
+#endif /* LSE_STARTUP_TIMEOUT */
+
+
+/**
+ * @brief External clock source for I2S peripheral
+ * This value is used by the I2S HAL module to compute the I2S clock source
+ * frequency, this source is inserted directly through I2S_CKIN pad.
+ */
+#if !defined (EXTERNAL_CLOCK_VALUE)
+ #define EXTERNAL_CLOCK_VALUE ((uint32_t)12288000U) /*!< Value of the External audio frequency in Hz*/
+#endif /* EXTERNAL_CLOCK_VALUE */
+
+/* Tip: To avoid modifying this file each time you need to use different HSE,
+ === you can define the HSE value in your toolchain compiler preprocessor. */
+
+/* ########################### System Configuration ######################### */
+/**
+ * @brief This is the HAL system configuration section
+ */
+#define VDD_VALUE ((uint32_t)3300U) /*!< Value of VDD in mv */
+#define TICK_INT_PRIORITY ((uint32_t)0U) /*!< tick interrupt priority */
+#define USE_RTOS 0U
+#define PREFETCH_ENABLE 1U
+#define INSTRUCTION_CACHE_ENABLE 1U
+#define DATA_CACHE_ENABLE 1U
+
+/* ########################## Assert Selection ############################## */
+/**
+ * @brief Uncomment the line below to expanse the "assert_param" macro in the
+ * HAL drivers code
+ */
+/* #define USE_FULL_ASSERT 1U */
+
+/* ################## Ethernet peripheral configuration ##################### */
+
+/* Section 1 : Ethernet peripheral configuration */
+
+/* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */
+#define MAC_ADDR0 2U
+#define MAC_ADDR1 0U
+#define MAC_ADDR2 0U
+#define MAC_ADDR3 0U
+#define MAC_ADDR4 0U
+#define MAC_ADDR5 0U
+
+/* Definition of the Ethernet driver buffers size and count */
+#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */
+#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */
+#define ETH_RXBUFNB ((uint32_t)4U) /* 4 Rx buffers of size ETH_RX_BUF_SIZE */
+#define ETH_TXBUFNB ((uint32_t)4U) /* 4 Tx buffers of size ETH_TX_BUF_SIZE */
+
+/* Section 2: PHY configuration section */
+
+/* DP83848_PHY_ADDRESS Address*/
+#define DP83848_PHY_ADDRESS 0x01U
+/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/
+#define PHY_RESET_DELAY ((uint32_t)0x000000FFU)
+/* PHY Configuration delay */
+#define PHY_CONFIG_DELAY ((uint32_t)0x00000FFFU)
+
+#define PHY_READ_TO ((uint32_t)0x0000FFFFU)
+#define PHY_WRITE_TO ((uint32_t)0x0000FFFFU)
+
+/* Section 3: Common PHY Registers */
+
+#define PHY_BCR ((uint16_t)0x0000U) /*!< Transceiver Basic Control Register */
+#define PHY_BSR ((uint16_t)0x0001U) /*!< Transceiver Basic Status Register */
+
+#define PHY_RESET ((uint16_t)0x8000U) /*!< PHY Reset */
+#define PHY_LOOPBACK ((uint16_t)0x4000U) /*!< Select loop-back mode */
+#define PHY_FULLDUPLEX_100M ((uint16_t)0x2100U) /*!< Set the full-duplex mode at 100 Mb/s */
+#define PHY_HALFDUPLEX_100M ((uint16_t)0x2000U) /*!< Set the half-duplex mode at 100 Mb/s */
+#define PHY_FULLDUPLEX_10M ((uint16_t)0x0100U) /*!< Set the full-duplex mode at 10 Mb/s */
+#define PHY_HALFDUPLEX_10M ((uint16_t)0x0000U) /*!< Set the half-duplex mode at 10 Mb/s */
+#define PHY_AUTONEGOTIATION ((uint16_t)0x1000U) /*!< Enable auto-negotiation function */
+#define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200U) /*!< Restart auto-negotiation function */
+#define PHY_POWERDOWN ((uint16_t)0x0800U) /*!< Select the power down mode */
+#define PHY_ISOLATE ((uint16_t)0x0400U) /*!< Isolate PHY from MII */
+
+#define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020U) /*!< Auto-Negotiation process completed */
+#define PHY_LINKED_STATUS ((uint16_t)0x0004U) /*!< Valid link established */
+#define PHY_JABBER_DETECTION ((uint16_t)0x0002U) /*!< Jabber condition detected */
+
+/* Section 4: Extended PHY Registers */
+#define PHY_SR ((uint16_t)0x10U) /*!< PHY status register Offset */
+
+#define PHY_SPEED_STATUS ((uint16_t)0x0002U) /*!< PHY Speed mask */
+#define PHY_DUPLEX_STATUS ((uint16_t)0x0004U) /*!< PHY Duplex mask */
+
+/* ################## SPI peripheral configuration ########################## */
+
+/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver
+* Activated: CRC code is present inside driver
+* Deactivated: CRC code cleaned from driver
+*/
+
+#define USE_SPI_CRC 0U
+
+/* Includes ------------------------------------------------------------------*/
+/**
+ * @brief Include module's header file
+ */
+
+#ifdef HAL_RCC_MODULE_ENABLED
+ #include "stm32f4xx_hal_rcc.h"
+#endif /* HAL_RCC_MODULE_ENABLED */
+
+#ifdef HAL_EXTI_MODULE_ENABLED
+ #include "stm32f4xx_hal_exti.h"
+#endif /* HAL_EXTI_MODULE_ENABLED */
+
+#ifdef HAL_GPIO_MODULE_ENABLED
+ #include "stm32f4xx_hal_gpio.h"
+#endif /* HAL_GPIO_MODULE_ENABLED */
+
+#ifdef HAL_DMA_MODULE_ENABLED
+ #include "stm32f4xx_hal_dma.h"
+#endif /* HAL_DMA_MODULE_ENABLED */
+
+#ifdef HAL_CORTEX_MODULE_ENABLED
+ #include "stm32f4xx_hal_cortex.h"
+#endif /* HAL_CORTEX_MODULE_ENABLED */
+
+#ifdef HAL_ADC_MODULE_ENABLED
+ #include "stm32f4xx_hal_adc.h"
+#endif /* HAL_ADC_MODULE_ENABLED */
+
+#ifdef HAL_CAN_MODULE_ENABLED
+ #include "stm32f4xx_hal_can.h"
+#endif /* HAL_CAN_MODULE_ENABLED */
+
+#ifdef HAL_CRC_MODULE_ENABLED
+ #include "stm32f4xx_hal_crc.h"
+#endif /* HAL_CRC_MODULE_ENABLED */
+
+#ifdef HAL_CRYP_MODULE_ENABLED
+ #include "stm32f4xx_hal_cryp.h"
+#endif /* HAL_CRYP_MODULE_ENABLED */
+
+#ifdef HAL_DMA2D_MODULE_ENABLED
+ #include "stm32f4xx_hal_dma2d.h"
+#endif /* HAL_DMA2D_MODULE_ENABLED */
+
+#ifdef HAL_DAC_MODULE_ENABLED
+ #include "stm32f4xx_hal_dac.h"
+#endif /* HAL_DAC_MODULE_ENABLED */
+
+#ifdef HAL_DCMI_MODULE_ENABLED
+ #include "stm32f4xx_hal_dcmi.h"
+#endif /* HAL_DCMI_MODULE_ENABLED */
+
+#ifdef HAL_ETH_MODULE_ENABLED
+ #include "stm32f4xx_hal_eth.h"
+#endif /* HAL_ETH_MODULE_ENABLED */
+
+#ifdef HAL_FLASH_MODULE_ENABLED
+ #include "stm32f4xx_hal_flash.h"
+#endif /* HAL_FLASH_MODULE_ENABLED */
+
+#ifdef HAL_SRAM_MODULE_ENABLED
+ #include "stm32f4xx_hal_sram.h"
+#endif /* HAL_SRAM_MODULE_ENABLED */
+
+#ifdef HAL_NOR_MODULE_ENABLED
+ #include "stm32f4xx_hal_nor.h"
+#endif /* HAL_NOR_MODULE_ENABLED */
+
+#ifdef HAL_NAND_MODULE_ENABLED
+ #include "stm32f4xx_hal_nand.h"
+#endif /* HAL_NAND_MODULE_ENABLED */
+
+#ifdef HAL_PCCARD_MODULE_ENABLED
+ #include "stm32f4xx_hal_pccard.h"
+#endif /* HAL_PCCARD_MODULE_ENABLED */
+
+#ifdef HAL_SDRAM_MODULE_ENABLED
+ #include "stm32f4xx_hal_sdram.h"
+#endif /* HAL_SDRAM_MODULE_ENABLED */
+
+#ifdef HAL_HASH_MODULE_ENABLED
+ #include "stm32f4xx_hal_hash.h"
+#endif /* HAL_HASH_MODULE_ENABLED */
+
+#ifdef HAL_I2C_MODULE_ENABLED
+ #include "stm32f4xx_hal_i2c.h"
+#endif /* HAL_I2C_MODULE_ENABLED */
+
+#ifdef HAL_I2S_MODULE_ENABLED
+ #include "stm32f4xx_hal_i2s.h"
+#endif /* HAL_I2S_MODULE_ENABLED */
+
+#ifdef HAL_IWDG_MODULE_ENABLED
+ #include "stm32f4xx_hal_iwdg.h"
+#endif /* HAL_IWDG_MODULE_ENABLED */
+
+#ifdef HAL_LTDC_MODULE_ENABLED
+ #include "stm32f4xx_hal_ltdc.h"
+#endif /* HAL_LTDC_MODULE_ENABLED */
+
+#ifdef HAL_PWR_MODULE_ENABLED
+ #include "stm32f4xx_hal_pwr.h"
+#endif /* HAL_PWR_MODULE_ENABLED */
+
+#ifdef HAL_RNG_MODULE_ENABLED
+ #include "stm32f4xx_hal_rng.h"
+#endif /* HAL_RNG_MODULE_ENABLED */
+
+#ifdef HAL_RTC_MODULE_ENABLED
+ #include "stm32f4xx_hal_rtc.h"
+#endif /* HAL_RTC_MODULE_ENABLED */
+
+#ifdef HAL_SAI_MODULE_ENABLED
+ #include "stm32f4xx_hal_sai.h"
+#endif /* HAL_SAI_MODULE_ENABLED */
+
+#ifdef HAL_SD_MODULE_ENABLED
+ #include "stm32f4xx_hal_sd.h"
+#endif /* HAL_SD_MODULE_ENABLED */
+
+#ifdef HAL_MMC_MODULE_ENABLED
+ #include "stm32f4xx_hal_mmc.h"
+#endif /* HAL_MMC_MODULE_ENABLED */
+
+#ifdef HAL_SPI_MODULE_ENABLED
+ #include "stm32f4xx_hal_spi.h"
+#endif /* HAL_SPI_MODULE_ENABLED */
+
+#ifdef HAL_TIM_MODULE_ENABLED
+ #include "stm32f4xx_hal_tim.h"
+#endif /* HAL_TIM_MODULE_ENABLED */
+
+#ifdef HAL_UART_MODULE_ENABLED
+ #include "stm32f4xx_hal_uart.h"
+#endif /* HAL_UART_MODULE_ENABLED */
+
+#ifdef HAL_USART_MODULE_ENABLED
+ #include "stm32f4xx_hal_usart.h"
+#endif /* HAL_USART_MODULE_ENABLED */
+
+#ifdef HAL_IRDA_MODULE_ENABLED
+ #include "stm32f4xx_hal_irda.h"
+#endif /* HAL_IRDA_MODULE_ENABLED */
+
+#ifdef HAL_SMARTCARD_MODULE_ENABLED
+ #include "stm32f4xx_hal_smartcard.h"
+#endif /* HAL_SMARTCARD_MODULE_ENABLED */
+
+#ifdef HAL_WWDG_MODULE_ENABLED
+ #include "stm32f4xx_hal_wwdg.h"
+#endif /* HAL_WWDG_MODULE_ENABLED */
+
+#ifdef HAL_PCD_MODULE_ENABLED
+ #include "stm32f4xx_hal_pcd.h"
+#endif /* HAL_PCD_MODULE_ENABLED */
+
+#ifdef HAL_HCD_MODULE_ENABLED
+ #include "stm32f4xx_hal_hcd.h"
+#endif /* HAL_HCD_MODULE_ENABLED */
+
+#ifdef HAL_DSI_MODULE_ENABLED
+ #include "stm32f4xx_hal_dsi.h"
+#endif /* HAL_DSI_MODULE_ENABLED */
+
+#ifdef HAL_QSPI_MODULE_ENABLED
+ #include "stm32f4xx_hal_qspi.h"
+#endif /* HAL_QSPI_MODULE_ENABLED */
+
+#ifdef HAL_CEC_MODULE_ENABLED
+ #include "stm32f4xx_hal_cec.h"
+#endif /* HAL_CEC_MODULE_ENABLED */
+
+#ifdef HAL_FMPI2C_MODULE_ENABLED
+ #include "stm32f4xx_hal_fmpi2c.h"
+#endif /* HAL_FMPI2C_MODULE_ENABLED */
+
+#ifdef HAL_SPDIFRX_MODULE_ENABLED
+ #include "stm32f4xx_hal_spdifrx.h"
+#endif /* HAL_SPDIFRX_MODULE_ENABLED */
+
+#ifdef HAL_DFSDM_MODULE_ENABLED
+ #include "stm32f4xx_hal_dfsdm.h"
+#endif /* HAL_DFSDM_MODULE_ENABLED */
+
+#ifdef HAL_LPTIM_MODULE_ENABLED
+ #include "stm32f4xx_hal_lptim.h"
+#endif /* HAL_LPTIM_MODULE_ENABLED */
+
+/* Exported macro ------------------------------------------------------------*/
+#ifdef USE_FULL_ASSERT
+/**
+ * @brief The assert_param macro is used for function's parameters check.
+ * @param expr: If expr is false, it calls assert_failed function
+ * which reports the name of the source file and the source
+ * line number of the call that failed.
+ * If expr is true, it returns no value.
+ * @retval None
+ */
+ #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
+/* Exported functions ------------------------------------------------------- */
+ void assert_failed(uint8_t* file, uint32_t line);
+#else
+ #define assert_param(expr) ((void)0U)
+#endif /* USE_FULL_ASSERT */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STM32F4xx_HAL_CONF_H */
+
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/ports/stm32f4/common-hal/analogio/AnalogIn.c b/ports/stm/common-hal/analogio/AnalogIn.c
index 3ee3c4dbb..1d1b308b6 100644
--- a/ports/stm32f4/common-hal/analogio/AnalogIn.c
+++ b/ports/stm/common-hal/analogio/AnalogIn.c
@@ -45,11 +45,11 @@ void common_hal_analogio_analogin_construct(analogio_analogin_obj_t* self,
}
// TODO: add ADC traits to structure?
- // Note that ADC2 is always bundled pin-to-pin with ADC1 if it exists, and used only
- // for dual conversion. For this basic application it is never used.
+ // Note that ADC2 is always bundled pin-to-pin with ADC1 if it exists, and used only
+ // for dual conversion. For this basic application it is never used.
LL_GPIO_SetPinMode(pin_port(pin->port), (uint32_t)pin_mask(pin->number), LL_GPIO_MODE_ANALOG);
if (pin->adc_unit & 0x01) {
- LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_ADC1);
+ LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_ADC1);
} else if (pin->adc_unit == 0x04) {
#ifdef LL_APB2_GRP1_PERIPH_ADC3
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_ADC3);
@@ -62,7 +62,7 @@ void common_hal_analogio_analogin_construct(analogio_analogin_obj_t* self,
}
bool common_hal_analogio_analogin_deinited(analogio_analogin_obj_t *self) {
- return self->pin == mp_const_none;
+ return self->pin == NULL;
}
void common_hal_analogio_analogin_deinit(analogio_analogin_obj_t *self) {
@@ -70,7 +70,7 @@ void common_hal_analogio_analogin_deinit(analogio_analogin_obj_t *self) {
return;
}
reset_pin_number(self->pin->port,self->pin->number);
- self->pin = mp_const_none;
+ self->pin = NULL;
}
uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) {
@@ -116,10 +116,10 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) {
HAL_ADC_ConfigChannel(&AdcHandle, &sConfig);
HAL_ADC_Start(&AdcHandle);
- HAL_ADC_PollForConversion(&AdcHandle,1);
+ HAL_ADC_PollForConversion(&AdcHandle,1);
uint16_t value = (uint16_t)HAL_ADC_GetValue(&AdcHandle);
HAL_ADC_Stop(&AdcHandle);
-
+
// // Shift the value to be 16 bit.
return value << 4;
}
diff --git a/ports/stm32f4/common-hal/analogio/AnalogIn.h b/ports/stm/common-hal/analogio/AnalogIn.h
index 910092897..910092897 100644
--- a/ports/stm32f4/common-hal/analogio/AnalogIn.h
+++ b/ports/stm/common-hal/analogio/AnalogIn.h
diff --git a/ports/stm32f4/common-hal/analogio/AnalogOut.c b/ports/stm/common-hal/analogio/AnalogOut.c
index 79ced0492..2ea969f50 100644
--- a/ports/stm32f4/common-hal/analogio/AnalogOut.c
+++ b/ports/stm/common-hal/analogio/AnalogOut.c
@@ -39,7 +39,7 @@
#include "stm32f4xx_hal.h"
-//DAC is shared between both channels.
+//DAC is shared between both channels.
#if HAS_DAC
DAC_HandleTypeDef handle;
#endif
@@ -97,7 +97,7 @@ bool common_hal_analogio_analogout_deinited(analogio_analogout_obj_t *self) {
void common_hal_analogio_analogout_deinit(analogio_analogout_obj_t *self) {
#if HAS_DAC
reset_pin_number(self->pin->port,self->pin->number);
- self->pin = mp_const_none;
+ self->pin = NULL;
dac_on[self->dac_index] = false;
//turn off the DAC if both channels are off
diff --git a/ports/stm32f4/common-hal/analogio/AnalogOut.h b/ports/stm/common-hal/analogio/AnalogOut.h
index 61591d0e6..46312b460 100644
--- a/ports/stm32f4/common-hal/analogio/AnalogOut.h
+++ b/ports/stm/common-hal/analogio/AnalogOut.h
@@ -32,7 +32,7 @@
#include "py/obj.h"
#include "stm32f4xx_hal.h"
-#include "stm32f4/periph.h"
+#include "peripherals/periph.h"
typedef struct {
mp_obj_base_t base;
diff --git a/ports/stm32f4/common-hal/analogio/__init__.c b/ports/stm/common-hal/analogio/__init__.c
index eea58c77d..eea58c77d 100644
--- a/ports/stm32f4/common-hal/analogio/__init__.c
+++ b/ports/stm/common-hal/analogio/__init__.c
diff --git a/ports/stm32f4/common-hal/board/__init__.c b/ports/stm/common-hal/board/__init__.c
index 880033ed6..880033ed6 100644
--- a/ports/stm32f4/common-hal/board/__init__.c
+++ b/ports/stm/common-hal/board/__init__.c
diff --git a/ports/stm32f4/common-hal/busio/I2C.c b/ports/stm/common-hal/busio/I2C.c
index 1437e5e78..e3c59e7e0 100644
--- a/ports/stm32f4/common-hal/busio/I2C.c
+++ b/ports/stm/common-hal/busio/I2C.c
@@ -29,14 +29,14 @@
#include "shared-bindings/busio/I2C.h"
#include "py/mperrno.h"
#include "py/runtime.h"
-#include "stm32f4xx_hal.h"
#include "shared-bindings/microcontroller/__init__.h"
#include "supervisor/shared/translate.h"
#include "common-hal/microcontroller/Pin.h"
-//arrays use 0 based numbering: I2C1 is stored at index 0
-#define MAX_I2C 3
+// Arrays use 0 based numbering: I2C1 is stored at index 0
+#define MAX_I2C 4
+
STATIC bool reserved_i2c[MAX_I2C];
STATIC bool never_reset_i2c[MAX_I2C];
@@ -59,7 +59,7 @@ void i2c_reset(void) {
void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
const mcu_pin_obj_t* scl, const mcu_pin_obj_t* sda, uint32_t frequency, uint32_t timeout) {
- //match pins to I2C objects
+ // Match pins to I2C objects
I2C_TypeDef * I2Cx;
uint8_t sda_len = MP_ARRAY_SIZE(mcu_i2c_sda_list);
uint8_t scl_len = MP_ARRAY_SIZE(mcu_i2c_scl_list);
@@ -69,9 +69,9 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
if (mcu_i2c_sda_list[i].pin == sda) {
for (uint j = 0; j < scl_len; j++) {
if ((mcu_i2c_scl_list[j].pin == scl)
- && (mcu_i2c_scl_list[j].i2c_index == mcu_i2c_sda_list[i].i2c_index)) {
- //keep looking if the I2C is taken, could be another SCL that works
- if (reserved_i2c[mcu_i2c_scl_list[i].i2c_index - 1]) {
+ && (mcu_i2c_scl_list[j].periph_index == mcu_i2c_sda_list[i].periph_index)) {
+ // Keep looking if the I2C is taken, could be another SCL that works
+ if (reserved_i2c[mcu_i2c_scl_list[j].periph_index - 1]) {
i2c_taken = true;
continue;
}
@@ -80,12 +80,16 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
break;
}
}
+ if (self->scl != NULL) {
+ // Multi-level break to pick lowest peripheral
+ break;
+ }
}
}
- //handle typedef selection, errors
+ // Handle typedef selection, errors
if (self->sda != NULL && self->scl != NULL ) {
- I2Cx = mcu_i2c_banks[self->sda->i2c_index - 1];
+ I2Cx = mcu_i2c_banks[self->sda->periph_index - 1];
} else {
if (i2c_taken) {
mp_raise_ValueError(translate("Hardware busy, try alternative pins"));
@@ -94,29 +98,35 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
}
}
- //Start GPIO for each pin
+ // Start GPIO for each pin
GPIO_InitTypeDef GPIO_InitStruct = {0};
GPIO_InitStruct.Pin = pin_mask(sda->number);
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
- GPIO_InitStruct.Alternate = self->sda->altfn_index;
+ GPIO_InitStruct.Alternate = self->sda->altfn_index;
HAL_GPIO_Init(pin_port(sda->port), &GPIO_InitStruct);
GPIO_InitStruct.Pin = pin_mask(scl->number);
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
- GPIO_InitStruct.Alternate = self->scl->altfn_index;
+ GPIO_InitStruct.Alternate = self->scl->altfn_index;
HAL_GPIO_Init(pin_port(scl->port), &GPIO_InitStruct);
- //Note: due to I2C soft reboot issue, do not relocate clock init.
- i2c_clock_enable(1 << (self->sda->i2c_index - 1));
- reserved_i2c[self->sda->i2c_index - 1] = true;
+ // Note: due to I2C soft reboot issue, do not relocate clock init.
+ i2c_clock_enable(1 << (self->sda->periph_index - 1));
+ reserved_i2c[self->sda->periph_index - 1] = true;
- self->handle.Instance = I2Cx;
+ // Handle the HAL handle differences
+ #if (CPY_STM32H7 || CPY_STM32F7)
+ self->handle.Init.Timing = 0x40604E73; //Taken from STCube examples
+ #else
self->handle.Init.ClockSpeed = 100000;
self->handle.Init.DutyCycle = I2C_DUTYCYCLE_2;
+ #endif
+
+ self->handle.Instance = I2Cx;
self->handle.Init.OwnAddress1 = 0;
self->handle.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
self->handle.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
@@ -144,7 +154,7 @@ void common_hal_busio_i2c_never_reset(busio_i2c_obj_t *self) {
}
bool common_hal_busio_i2c_deinited(busio_i2c_obj_t *self) {
- return self->sda->pin == mp_const_none;
+ return self->sda == NULL;
}
void common_hal_busio_i2c_deinit(busio_i2c_obj_t *self) {
@@ -152,14 +162,14 @@ void common_hal_busio_i2c_deinit(busio_i2c_obj_t *self) {
return;
}
- i2c_clock_disable(1 << (self->sda->i2c_index - 1));
- reserved_i2c[self->sda->i2c_index - 1] = false;
- never_reset_i2c[self->sda->i2c_index - 1] = false;
+ i2c_clock_disable(1 << (self->sda->periph_index - 1));
+ reserved_i2c[self->sda->periph_index - 1] = false;
+ never_reset_i2c[self->sda->periph_index - 1] = false;
reset_pin_number(self->sda->pin->port,self->sda->pin->number);
reset_pin_number(self->scl->pin->port,self->scl->pin->number);
- self->sda = mp_const_none;
- self->scl = mp_const_none;
+ self->sda = NULL;
+ self->scl = NULL;
}
bool common_hal_busio_i2c_probe(busio_i2c_obj_t *self, uint8_t addr) {
@@ -169,7 +179,7 @@ bool common_hal_busio_i2c_probe(busio_i2c_obj_t *self, uint8_t addr) {
bool common_hal_busio_i2c_try_lock(busio_i2c_obj_t *self) {
bool grabbed_lock = false;
- //Critical section code that may be required at some point.
+ //Critical section code that may be required at some point.
// uint32_t store_primask = __get_PRIMASK();
// __disable_irq();
// __DMB();
@@ -195,19 +205,19 @@ void common_hal_busio_i2c_unlock(busio_i2c_obj_t *self) {
uint8_t common_hal_busio_i2c_write(busio_i2c_obj_t *self, uint16_t addr,
const uint8_t *data, size_t len, bool transmit_stop_bit) {
- HAL_StatusTypeDef result = HAL_I2C_Master_Transmit(&(self->handle), (uint16_t)(addr << 1),
+ HAL_StatusTypeDef result = HAL_I2C_Master_Transmit(&(self->handle), (uint16_t)(addr << 1),
(uint8_t *)data, (uint16_t)len, 500);
return result == HAL_OK ? 0 : MP_EIO;
}
uint8_t common_hal_busio_i2c_read(busio_i2c_obj_t *self, uint16_t addr,
uint8_t *data, size_t len) {
- return HAL_I2C_Master_Receive(&(self->handle), (uint16_t)(addr<<1), data, (uint16_t)len, 500)
+ return HAL_I2C_Master_Receive(&(self->handle), (uint16_t)(addr<<1), data, (uint16_t)len, 500)
== HAL_OK ? 0 : MP_EIO;
}
STATIC void i2c_clock_enable(uint8_t mask) {
- //Note: hard reset required due to soft reboot issue.
+ // Note: hard reset required due to soft reboot issue.
#ifdef I2C1
if (mask & (1 << 0)) {
__HAL_RCC_I2C1_CLK_ENABLE();
@@ -229,6 +239,13 @@ STATIC void i2c_clock_enable(uint8_t mask) {
__HAL_RCC_I2C3_RELEASE_RESET();
}
#endif
+ #ifdef I2C4
+ if (mask & (1 << 3)) {
+ __HAL_RCC_I2C4_CLK_ENABLE();
+ __HAL_RCC_I2C4_FORCE_RESET();
+ __HAL_RCC_I2C4_RELEASE_RESET();
+ }
+ #endif
}
STATIC void i2c_clock_disable(uint8_t mask) {
@@ -247,4 +264,9 @@ STATIC void i2c_clock_disable(uint8_t mask) {
__HAL_RCC_I2C3_CLK_DISABLE();
}
#endif
+ #ifdef I2C4
+ if (mask & (1 << 3)) {
+ __HAL_RCC_I2C4_CLK_DISABLE();
+ }
+ #endif
}
diff --git a/ports/stm32f4/common-hal/busio/I2C.h b/ports/stm/common-hal/busio/I2C.h
index b5c891a98..5ca2854eb 100644
--- a/ports/stm32f4/common-hal/busio/I2C.h
+++ b/ports/stm/common-hal/busio/I2C.h
@@ -25,13 +25,12 @@
* THE SOFTWARE.
*/
-#ifndef MICROPY_INCLUDED_STM32F4_COMMON_HAL_BUSIO_I2C_H
-#define MICROPY_INCLUDED_STM32F4_COMMON_HAL_BUSIO_I2C_H
+#ifndef MICROPY_INCLUDED_STM32_COMMON_HAL_BUSIO_I2C_H
+#define MICROPY_INCLUDED_STM32_COMMON_HAL_BUSIO_I2C_H
#include "common-hal/microcontroller/Pin.h"
-#include "stm32f4xx_hal.h"
-#include "stm32f4/periph.h"
+#include "peripherals/periph.h"
#include "py/obj.h"
@@ -39,10 +38,10 @@ typedef struct {
mp_obj_base_t base;
I2C_HandleTypeDef handle;
bool has_lock;
- const mcu_i2c_scl_obj_t *scl;
- const mcu_i2c_sda_obj_t *sda;
+ const mcu_periph_obj_t *scl;
+ const mcu_periph_obj_t *sda;
} busio_i2c_obj_t;
void i2c_reset(void);
-#endif // MICROPY_INCLUDED_STM32F4_COMMON_HAL_BUSIO_I2C_H
+#endif // MICROPY_INCLUDED_STM32_COMMON_HAL_BUSIO_I2C_H
diff --git a/ports/stm32f4/common-hal/busio/OneWire.h b/ports/stm/common-hal/busio/OneWire.h
index 6e8c82979..0099593f0 100644
--- a/ports/stm32f4/common-hal/busio/OneWire.h
+++ b/ports/stm/common-hal/busio/OneWire.h
@@ -24,10 +24,10 @@
* THE SOFTWARE.
*/
-#ifndef MICROPY_INCLUDED_STM32F4_COMMON_HAL_BUSIO_ONEWIRE_H
-#define MICROPY_INCLUDED_STM32F4_COMMON_HAL_BUSIO_ONEWIRE_H
+#ifndef MICROPY_INCLUDED_STM32_COMMON_HAL_BUSIO_ONEWIRE_H
+#define MICROPY_INCLUDED_STM32_COMMON_HAL_BUSIO_ONEWIRE_H
// Use bitbangio.
#include "shared-module/busio/OneWire.h"
-#endif // MICROPY_INCLUDED_STM32F4_COMMON_HAL_BUSIO_ONEWIRE_H
+#endif // MICROPY_INCLUDED_STM32F_COMMON_HAL_BUSIO_ONEWIRE_H
diff --git a/ports/stm32f4/common-hal/busio/SPI.c b/ports/stm/common-hal/busio/SPI.c
index e00b5e9f0..2572c7f26 100644
--- a/ports/stm32f4/common-hal/busio/SPI.c
+++ b/ports/stm/common-hal/busio/SPI.c
@@ -29,7 +29,6 @@
#include "shared-bindings/busio/SPI.h"
#include "py/mperrno.h"
#include "py/runtime.h"
-#include "stm32f4xx_hal.h"
#include "shared-bindings/microcontroller/__init__.h"
#include "boards/board.h"
@@ -41,6 +40,7 @@
//arrays use 0 based numbering: SPI1 is stored at index 0
#define MAX_SPI 6
+
STATIC bool reserved_spi[MAX_SPI];
STATIC bool never_reset_spi[MAX_SPI];
@@ -49,14 +49,24 @@ STATIC void spi_clock_enable(uint8_t mask);
STATIC void spi_clock_disable(uint8_t mask);
STATIC uint32_t get_busclock(SPI_TypeDef * instance) {
- //SPI2 and 3 are on PCLK1, if they exist.
- #ifdef SPI2
- if (instance == SPI2) return HAL_RCC_GetPCLK1Freq();
- #endif
- #ifdef SPI3
- if (instance == SPI3) return HAL_RCC_GetPCLK1Freq();
+ #if (CPY_STM32H7)
+ if (instance == SPI1 || instance == SPI2 || instance == SPI3) {
+ return HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_SPI123);
+ } else if (instance == SPI4 || instance == SPI5) {
+ return HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_SPI45);
+ } else {
+ return HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_SPI6);
+ }
+ #elif (CPY_STM32F4 || CPY_STM32F7)
+ //SPI2 and 3 are on PCLK1, if they exist.
+ #ifdef SPI2
+ if (instance == SPI2) return HAL_RCC_GetPCLK1Freq();
+ #endif
+ #ifdef SPI3
+ if (instance == SPI3) return HAL_RCC_GetPCLK1Freq();
+ #endif
+ return HAL_RCC_GetPCLK2Freq();
#endif
- return HAL_RCC_GetPCLK2Freq();
}
STATIC uint32_t stm32_baud_to_spi_div(uint32_t baudrate, uint16_t * prescaler, uint32_t busclock) {
@@ -113,17 +123,17 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
for (uint i = 0; i < sck_len; i++) {
if (mcu_spi_sck_list[i].pin == sck) {
//if both MOSI and MISO exist, loop search normally
- if ((mosi != mp_const_none) && (miso != mp_const_none)) {
+ if ((mosi != NULL) && (miso != NULL)) {
//MOSI
for (uint j = 0; j < mosi_len; j++) {
if (mcu_spi_mosi_list[j].pin == mosi) {
//MISO
for (uint k = 0; k < miso_len; k++) {
if ((mcu_spi_miso_list[k].pin == miso) //everything needs the same index
- && (mcu_spi_sck_list[i].spi_index == mcu_spi_mosi_list[j].spi_index)
- && (mcu_spi_sck_list[i].spi_index == mcu_spi_miso_list[k].spi_index)) {
+ && (mcu_spi_sck_list[i].periph_index == mcu_spi_mosi_list[j].periph_index)
+ && (mcu_spi_sck_list[i].periph_index == mcu_spi_miso_list[k].periph_index)) {
//keep looking if the SPI is taken, edge case
- if (reserved_spi[mcu_spi_sck_list[i].spi_index - 1]) {
+ if (reserved_spi[mcu_spi_sck_list[i].periph_index - 1]) {
spi_taken = true;
continue;
}
@@ -133,43 +143,51 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
self->miso = &mcu_spi_miso_list[k];
break;
}
- }
+ }
+ if (self->sck != NULL) {
+ break; // Multi-level break to pick lowest peripheral
+ }
}
}
+ if (self->sck != NULL) {
+ break;
+ }
// if just MISO, reduce search
- } else if (miso != mp_const_none) {
+ } else if (miso != NULL) {
for (uint j = 0; j < miso_len; j++) {
if ((mcu_spi_miso_list[j].pin == miso) //only SCK and MISO need the same index
- && (mcu_spi_sck_list[i].spi_index == mcu_spi_miso_list[j].spi_index)) {
- //keep looking if the SPI is taken, edge case
- if (reserved_spi[mcu_spi_sck_list[i].spi_index - 1]) {
+ && (mcu_spi_sck_list[i].periph_index == mcu_spi_miso_list[j].periph_index)) {
+ if (reserved_spi[mcu_spi_sck_list[i].periph_index - 1]) {
spi_taken = true;
continue;
}
- //store pins if not
self->sck = &mcu_spi_sck_list[i];
self->mosi = NULL;
self->miso = &mcu_spi_miso_list[j];
break;
}
- }
+ }
+ if (self->sck != NULL) {
+ break;
+ }
// if just MOSI, reduce search
- } else if (mosi != mp_const_none) {
+ } else if (mosi != NULL) {
for (uint j = 0; j < mosi_len; j++) {
if ((mcu_spi_mosi_list[j].pin == mosi) //only SCK and MOSI need the same index
- && (mcu_spi_sck_list[i].spi_index == mcu_spi_mosi_list[j].spi_index)) {
- //keep looking if the SPI is taken, edge case
- if (reserved_spi[mcu_spi_sck_list[i].spi_index - 1]) {
+ && (mcu_spi_sck_list[i].periph_index == mcu_spi_mosi_list[j].periph_index)) {
+ if (reserved_spi[mcu_spi_sck_list[i].periph_index - 1]) {
spi_taken = true;
continue;
}
- //store pins if not
self->sck = &mcu_spi_sck_list[i];
self->mosi = &mcu_spi_mosi_list[j];
self->miso = NULL;
break;
}
- }
+ }
+ if (self->sck != NULL) {
+ break;
+ }
} else {
//throw an error immediately
mp_raise_ValueError(translate("Must provide MISO or MOSI pin"));
@@ -179,9 +197,9 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
//handle typedef selection, errors
if ( (self->sck != NULL && self->mosi != NULL && self->miso != NULL) ||
- (self->sck != NULL && self->mosi != NULL && miso == mp_const_none) ||
- (self->sck != NULL && self->miso != NULL && mosi == mp_const_none)) {
- SPIx = mcu_spi_banks[self->sck->spi_index - 1];
+ (self->sck != NULL && self->mosi != NULL && miso == NULL) ||
+ (self->sck != NULL && self->miso != NULL && mosi == NULL)) {
+ SPIx = mcu_spi_banks[self->sck->periph_index - 1];
} else {
if (spi_taken) {
mp_raise_ValueError(translate("Hardware busy, try alternative pins"));
@@ -196,7 +214,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
- GPIO_InitStruct.Alternate = self->sck->altfn_index;
+ GPIO_InitStruct.Alternate = self->sck->altfn_index;
HAL_GPIO_Init(pin_port(sck->port), &GPIO_InitStruct);
if (self->mosi != NULL) {
@@ -204,7 +222,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
- GPIO_InitStruct.Alternate = self->mosi->altfn_index;
+ GPIO_InitStruct.Alternate = self->mosi->altfn_index;
HAL_GPIO_Init(pin_port(mosi->port), &GPIO_InitStruct);
}
@@ -213,17 +231,17 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
- GPIO_InitStruct.Alternate = self->miso->altfn_index;
+ GPIO_InitStruct.Alternate = self->miso->altfn_index;
HAL_GPIO_Init(pin_port(miso->port), &GPIO_InitStruct);
}
- spi_clock_enable(1 << (self->sck->spi_index - 1));
- reserved_spi[self->sck->spi_index - 1] = true;
-
- self->handle.Instance = SPIx;
+ spi_clock_enable(1 << (self->sck->periph_index - 1));
+ reserved_spi[self->sck->periph_index - 1] = true;
+
+ self->handle.Instance = SPIx;
self->handle.Init.Mode = SPI_MODE_MASTER;
// Direction change only required for RX-only, see RefMan RM0090:884
- self->handle.Init.Direction = (self->mosi == NULL) ? SPI_CR1_RXONLY : SPI_DIRECTION_2LINES;
+ self->handle.Init.Direction = (self->mosi == NULL) ? SPI_DIRECTION_2LINES_RXONLY : SPI_DIRECTION_2LINES;
self->handle.Init.DataSize = SPI_DATASIZE_8BIT;
self->handle.Init.CLKPolarity = SPI_POLARITY_LOW;
self->handle.Init.CLKPhase = SPI_PHASE_1EDGE;
@@ -269,16 +287,16 @@ void common_hal_busio_spi_never_reset(busio_spi_obj_t *self) {
}
bool common_hal_busio_spi_deinited(busio_spi_obj_t *self) {
- return self->sck->pin == mp_const_none;
+ return self->sck->pin == NULL;
}
void common_hal_busio_spi_deinit(busio_spi_obj_t *self) {
if (common_hal_busio_spi_deinited(self)) {
return;
}
- spi_clock_disable(1<<(self->sck->spi_index - 1));
- reserved_spi[self->sck->spi_index - 1] = false;
- never_reset_spi[self->sck->spi_index - 1] = false;
+ spi_clock_disable(1<<(self->sck->periph_index - 1));
+ reserved_spi[self->sck->periph_index - 1] = false;
+ never_reset_spi[self->sck->periph_index - 1] = false;
reset_pin_number(self->sck->pin->port,self->sck->pin->number);
if (self->mosi != NULL) {
@@ -287,15 +305,15 @@ void common_hal_busio_spi_deinit(busio_spi_obj_t *self) {
if (self->miso != NULL) {
reset_pin_number(self->miso->pin->port,self->miso->pin->number);
}
- self->sck = mp_const_none;
- self->mosi = mp_const_none;
- self->miso = mp_const_none;
+ self->sck = NULL;
+ self->mosi = NULL;
+ self->miso = NULL;
}
bool common_hal_busio_spi_configure(busio_spi_obj_t *self,
uint32_t baudrate, uint8_t polarity, uint8_t phase, uint8_t bits) {
//This resets the SPI, so check before updating it redundantly
- if (baudrate == self->baudrate && polarity== self->polarity
+ if (baudrate == self->baudrate && polarity== self->polarity
&& phase == self->phase && bits == self->bits) {
return true;
}
@@ -307,7 +325,7 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self,
self->handle.Init.CLKPolarity = (polarity) ? SPI_POLARITY_HIGH : SPI_POLARITY_LOW;
self->handle.Init.CLKPhase = (phase) ? SPI_PHASE_2EDGE : SPI_PHASE_1EDGE;
- self->handle.Init.BaudRatePrescaler = stm32_baud_to_spi_div(baudrate, &self->prescaler,
+ self->handle.Init.BaudRatePrescaler = stm32_baud_to_spi_div(baudrate, &self->prescaler,
get_busclock(self->handle.Instance));
if (HAL_SPI_Init(&self->handle) != HAL_OK)
@@ -325,7 +343,7 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self,
bool common_hal_busio_spi_try_lock(busio_spi_obj_t *self) {
bool grabbed_lock = false;
- //Critical section code that may be required at some point.
+ //Critical section code that may be required at some point.
// uint32_t store_primask = __get_PRIMASK();
// __disable_irq();
// __DMB();
@@ -367,7 +385,7 @@ bool common_hal_busio_spi_read(busio_spi_obj_t *self,
return result == HAL_OK;
}
-bool common_hal_busio_spi_transfer(busio_spi_obj_t *self,
+bool common_hal_busio_spi_transfer(busio_spi_obj_t *self,
uint8_t *data_out, uint8_t *data_in, size_t len) {
if (self->miso == NULL || self->mosi == NULL) {
mp_raise_ValueError(translate("Missing MISO or MOSI Pin"));
diff --git a/ports/stm32f4/common-hal/busio/SPI.h b/ports/stm/common-hal/busio/SPI.h
index 067d2fcb6..648318367 100644
--- a/ports/stm32f4/common-hal/busio/SPI.h
+++ b/ports/stm/common-hal/busio/SPI.h
@@ -25,13 +25,12 @@
* THE SOFTWARE.
*/
-#ifndef MICROPY_INCLUDED_STM32F4_COMMON_HAL_BUSIO_SPI_H
-#define MICROPY_INCLUDED_STM32F4_COMMON_HAL_BUSIO_SPI_H
+#ifndef MICROPY_INCLUDED_STM32_COMMON_HAL_BUSIO_SPI_H
+#define MICROPY_INCLUDED_STM32_COMMON_HAL_BUSIO_SPI_H
#include "common-hal/microcontroller/Pin.h"
-#include "stm32f4xx_hal.h"
-#include "stm32f4/periph.h"
+#include "peripherals/periph.h"
#include "py/obj.h"
@@ -39,10 +38,10 @@ typedef struct {
mp_obj_base_t base;
SPI_HandleTypeDef handle;
bool has_lock;
- const mcu_spi_sck_obj_t *sck;
- const mcu_spi_mosi_obj_t *mosi;
- const mcu_spi_miso_obj_t *miso;
- const mcu_spi_nss_obj_t *nss;
+ const mcu_periph_obj_t *sck;
+ const mcu_periph_obj_t *mosi;
+ const mcu_periph_obj_t *miso;
+ const mcu_periph_obj_t *nss;
uint32_t baudrate;
uint16_t prescaler;
uint8_t polarity;
@@ -52,4 +51,4 @@ typedef struct {
void spi_reset(void);
-#endif // MICROPY_INCLUDED_STM32F4_COMMON_HAL_BUSIO_SPI_H
+#endif // MICROPY_INCLUDED_STM32_COMMON_HAL_BUSIO_SPI_H
diff --git a/ports/stm32f4/common-hal/busio/UART.c b/ports/stm/common-hal/busio/UART.c
index bfa541c17..cb5460c68 100644
--- a/ports/stm32f4/common-hal/busio/UART.c
+++ b/ports/stm/common-hal/busio/UART.c
@@ -36,7 +36,6 @@
#include "supervisor/shared/translate.h"
#include "tick.h"
-#include "stm32f4xx_hal.h"
#define ALL_UARTS 0xFFFF
@@ -49,11 +48,11 @@ STATIC void uart_clock_disable(uint16_t mask);
STATIC void uart_assign_irq(busio_uart_obj_t* self, USART_TypeDef* USARTx);
STATIC USART_TypeDef * assign_uart_or_throw(busio_uart_obj_t* self, bool pin_eval,
- int uart_index, bool uart_taken) {
+ int periph_index, bool uart_taken) {
if (pin_eval) {
//assign a root pointer pointer for IRQ
- MP_STATE_PORT(cpy_uart_obj_all)[uart_index] = self;
- return mcu_uart_banks[uart_index];
+ MP_STATE_PORT(cpy_uart_obj_all)[periph_index] = self;
+ return mcu_uart_banks[periph_index];
} else {
if (uart_taken) {
mp_raise_ValueError(translate("Hardware in use, try alternative pins"));
@@ -71,10 +70,12 @@ void uart_reset(void) {
uart_clock_disable(ALL_UARTS);
}
-void common_hal_busio_uart_construct(busio_uart_obj_t* self,
- const mcu_pin_obj_t* tx, const mcu_pin_obj_t* rx, uint32_t baudrate,
- uint8_t bits, uart_parity_t parity, uint8_t stop, mp_float_t timeout,
- uint16_t receiver_buffer_size) {
+void common_hal_busio_uart_construct(busio_uart_obj_t *self,
+ const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx,
+ const mcu_pin_obj_t * rts, const mcu_pin_obj_t * cts,
+ const mcu_pin_obj_t * rs485_dir, bool rs485_invert,
+ uint32_t baudrate, uint8_t bits, uart_parity_t parity, uint8_t stop,
+ mp_float_t timeout, uint16_t receiver_buffer_size) {
//match pins to UART objects
USART_TypeDef * USARTx;
@@ -82,19 +83,23 @@ void common_hal_busio_uart_construct(busio_uart_obj_t* self,
uint8_t tx_len = MP_ARRAY_SIZE(mcu_uart_tx_list);
uint8_t rx_len = MP_ARRAY_SIZE(mcu_uart_rx_list);
bool uart_taken = false;
- uint8_t uart_index = 0; //origin 0 corrected
+ uint8_t periph_index = 0; //origin 0 corrected
+
+ if ((rts != NULL) || (cts != NULL) || (rs485_dir != NULL) || (rs485_invert == true)) {
+ mp_raise_ValueError(translate("RTS/CTS/RS485 Not yet supported on this device"));
+ }
//Can have both pins, or either
- if ((tx != mp_const_none) && (rx != mp_const_none)) {
+ if ((tx != NULL) && (rx != NULL)) {
//normal find loop if both pins exist
for (uint i = 0; i < tx_len; i++) {
if (mcu_uart_tx_list[i].pin == tx) {
//rx
for (uint j = 0; j < rx_len; j++) {
if (mcu_uart_rx_list[j].pin == rx
- && mcu_uart_rx_list[j].uart_index == mcu_uart_tx_list[i].uart_index) {
+ && mcu_uart_rx_list[j].periph_index == mcu_uart_tx_list[i].periph_index) {
//keep looking if the UART is taken, edge case
- if (reserved_uart[mcu_uart_tx_list[i].uart_index - 1]) {
+ if (reserved_uart[mcu_uart_tx_list[i].periph_index - 1]) {
uart_taken = true;
continue;
}
@@ -104,17 +109,20 @@ void common_hal_busio_uart_construct(busio_uart_obj_t* self,
break;
}
}
+ if (self->tx != NULL) {
+ break;
+ }
}
}
- uart_index = self->tx->uart_index - 1;
+ periph_index = self->tx->periph_index - 1;
USARTx = assign_uart_or_throw(self, (self->tx != NULL && self->rx != NULL),
- uart_index, uart_taken);
- } else if (tx == mp_const_none) {
+ periph_index, uart_taken);
+ } else if (tx == NULL) {
//If there is no tx, run only rx
for (uint i = 0; i < rx_len; i++) {
if (mcu_uart_rx_list[i].pin == rx) {
//keep looking if the UART is taken, edge case
- if (reserved_uart[mcu_uart_rx_list[i].uart_index - 1]) {
+ if (reserved_uart[mcu_uart_rx_list[i].periph_index - 1]) {
uart_taken = true;
continue;
}
@@ -123,15 +131,15 @@ void common_hal_busio_uart_construct(busio_uart_obj_t* self,
break;
}
}
- uart_index = self->rx->uart_index - 1;
+ periph_index = self->rx->periph_index - 1;
USARTx = assign_uart_or_throw(self, (self->rx != NULL),
- uart_index, uart_taken);
- } else if (rx == mp_const_none) {
+ periph_index, uart_taken);
+ } else if (rx == NULL) {
//If there is no rx, run only tx
for (uint i = 0; i < tx_len; i++) {
if (mcu_uart_tx_list[i].pin == tx) {
//keep looking if the UART is taken, edge case
- if (reserved_uart[mcu_uart_tx_list[i].uart_index - 1]) {
+ if (reserved_uart[mcu_uart_tx_list[i].periph_index - 1]) {
uart_taken = true;
continue;
}
@@ -140,9 +148,9 @@ void common_hal_busio_uart_construct(busio_uart_obj_t* self,
break;
}
}
- uart_index = self->tx->uart_index - 1;
+ periph_index = self->tx->periph_index - 1;
USARTx = assign_uart_or_throw(self, (self->tx != NULL),
- uart_index, uart_taken);
+ periph_index, uart_taken);
} else {
//both pins cannot be empty
mp_raise_ValueError(translate("Supply at least one UART pin"));
@@ -179,8 +187,8 @@ void common_hal_busio_uart_construct(busio_uart_obj_t* self,
}
//reserve uart and enable the peripheral
- reserved_uart[uart_index] = true;
- uart_clock_enable(1 << (uart_index));
+ reserved_uart[periph_index] = true;
+ uart_clock_enable(1 << (periph_index));
uart_assign_irq(self, USARTx);
self->handle.Instance = USARTx;
@@ -230,7 +238,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t* self,
}
bool common_hal_busio_uart_deinited(busio_uart_obj_t *self) {
- return self->tx->pin == mp_const_none;
+ return self->tx->pin == NULL;
}
void common_hal_busio_uart_deinit(busio_uart_obj_t *self) {
@@ -238,8 +246,8 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) {
reset_pin_number(self->tx->pin->port,self->tx->pin->number);
reset_pin_number(self->rx->pin->port,self->rx->pin->number);
- self->tx = mp_const_none;
- self->rx = mp_const_none;
+ self->tx = NULL;
+ self->rx = NULL;
gc_free(self->rbuf.buf);
self->rbuf.size = 0;
self->rbuf.iput = self->rbuf.iget = 0;
diff --git a/ports/stm32f4/common-hal/busio/UART.h b/ports/stm/common-hal/busio/UART.h
index cde5fadd0..5ac1d352c 100644
--- a/ports/stm32f4/common-hal/busio/UART.h
+++ b/ports/stm/common-hal/busio/UART.h
@@ -24,12 +24,11 @@
* THE SOFTWARE.
*/
-#ifndef MICROPY_INCLUDED_STM32F4_COMMON_HAL_BUSIO_UART_H
-#define MICROPY_INCLUDED_STM32F4_COMMON_HAL_BUSIO_UART_H
+#ifndef MICROPY_INCLUDED_STM32_COMMON_HAL_BUSIO_UART_H
+#define MICROPY_INCLUDED_STM32_COMMON_HAL_BUSIO_UART_H
#include "common-hal/microcontroller/Pin.h"
-#include "stm32f4/periph.h"
-#include "stm32f4xx_hal.h"
+#include "peripherals/periph.h"
#include "py/obj.h"
#include "py/ringbuf.h"
@@ -45,8 +44,8 @@ typedef struct {
mp_obj_base_t base;
UART_HandleTypeDef handle;
IRQn_Type irq;
- const mcu_uart_tx_obj_t *tx;
- const mcu_uart_rx_obj_t *rx;
+ const mcu_periph_obj_t *tx;
+ const mcu_periph_obj_t *rx;
ringbuf_t rbuf;
uint8_t rx_char;
diff --git a/ports/stm32f4/common-hal/busio/__init__.c b/ports/stm/common-hal/busio/__init__.c
index 41761b674..41761b674 100644
--- a/ports/stm32f4/common-hal/busio/__init__.c
+++ b/ports/stm/common-hal/busio/__init__.c
diff --git a/ports/stm32f4/common-hal/digitalio/DigitalInOut.c b/ports/stm/common-hal/digitalio/DigitalInOut.c
index 36c1075e2..647a46e90 100644
--- a/ports/stm32f4/common-hal/digitalio/DigitalInOut.c
+++ b/ports/stm/common-hal/digitalio/DigitalInOut.c
@@ -29,8 +29,14 @@
#include "py/runtime.h"
#include "supervisor/shared/translate.h"
-#include "stm32f4xx_hal.h"
+// The HAL is sparse on obtaining register information, so we use the LLs here.
+#if (CPY_STM32H7)
+#include "stm32h7xx_ll_gpio.h"
+#elif (CPY_STM32F7)
+#include "stm32f7xx_ll_gpio.h"
+#elif (CPY_STM32F4)
#include "stm32f4xx_ll_gpio.h"
+#endif
void common_hal_digitalio_digitalinout_never_reset(
digitalio_digitalinout_obj_t *self) {
@@ -54,7 +60,7 @@ digitalinout_result_t common_hal_digitalio_digitalinout_construct(
}
bool common_hal_digitalio_digitalinout_deinited(digitalio_digitalinout_obj_t *self) {
- return self->pin == mp_const_none;
+ return self->pin == NULL;
}
void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t *self) {
@@ -63,7 +69,7 @@ void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t *self
}
reset_pin_number(self->pin->port, self->pin->number);
- self->pin = mp_const_none;
+ self->pin = NULL;
}
void common_hal_digitalio_digitalinout_switch_to_input(
@@ -90,7 +96,7 @@ void common_hal_digitalio_digitalinout_switch_to_output(
digitalio_direction_t common_hal_digitalio_digitalinout_get_direction(
digitalio_digitalinout_obj_t *self) {
- return (LL_GPIO_GetPinMode(pin_port(self->pin->port), pin_mask(self->pin->number))
+ return (LL_GPIO_GetPinMode(pin_port(self->pin->port), pin_mask(self->pin->number))
== LL_GPIO_MODE_INPUT) ? DIRECTION_INPUT : DIRECTION_OUTPUT;
}
@@ -111,7 +117,7 @@ void common_hal_digitalio_digitalinout_set_drive_mode(
digitalio_drive_mode_t drive_mode) {
GPIO_InitTypeDef GPIO_InitStruct = {0};
GPIO_InitStruct.Pin = pin_mask(self->pin->number);
- GPIO_InitStruct.Mode = (drive_mode == DRIVE_MODE_OPEN_DRAIN ?
+ GPIO_InitStruct.Mode = (drive_mode == DRIVE_MODE_OPEN_DRAIN ?
GPIO_MODE_OUTPUT_OD : GPIO_MODE_OUTPUT_PP);
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
@@ -121,7 +127,7 @@ void common_hal_digitalio_digitalinout_set_drive_mode(
digitalio_drive_mode_t common_hal_digitalio_digitalinout_get_drive_mode(
digitalio_digitalinout_obj_t *self) {
- return LL_GPIO_GetPinOutputType(pin_port(self->pin->port), pin_mask(self->pin->number))
+ return LL_GPIO_GetPinOutputType(pin_port(self->pin->port), pin_mask(self->pin->number))
== LL_GPIO_OUTPUT_OPENDRAIN ? DRIVE_MODE_OPEN_DRAIN : DRIVE_MODE_PUSH_PULL;
}
@@ -145,7 +151,6 @@ void common_hal_digitalio_digitalinout_set_pull(
digitalio_pull_t common_hal_digitalio_digitalinout_get_pull(
digitalio_digitalinout_obj_t *self) {
-
switch (LL_GPIO_GetPinPull(pin_port(self->pin->port), pin_mask(self->pin->number))) {
case LL_GPIO_PULL_UP:
diff --git a/ports/stm32f4/common-hal/digitalio/DigitalInOut.h b/ports/stm/common-hal/digitalio/DigitalInOut.h
index 76aa2c855..e810ca3c1 100644
--- a/ports/stm32f4/common-hal/digitalio/DigitalInOut.h
+++ b/ports/stm/common-hal/digitalio/DigitalInOut.h
@@ -25,8 +25,8 @@
* THE SOFTWARE.
*/
-#ifndef MICROPY_INCLUDED_STM32F4_COMMON_HAL_DIGITALIO_DIGITALINOUT_H
-#define MICROPY_INCLUDED_STM32F4_COMMON_HAL_DIGITALIO_DIGITALINOUT_H
+#ifndef MICROPY_INCLUDED_STM32_COMMON_HAL_DIGITALIO_DIGITALINOUT_H
+#define MICROPY_INCLUDED_STM32_COMMON_HAL_DIGITALIO_DIGITALINOUT_H
#include "common-hal/microcontroller/Pin.h"
@@ -35,4 +35,4 @@ typedef struct {
const mcu_pin_obj_t *pin;
} digitalio_digitalinout_obj_t;
-#endif // MICROPY_INCLUDED_STM32F4_COMMON_HAL_DIGITALIO_DIGITALINOUT_H
+#endif // MICROPY_INCLUDED_STM32_COMMON_HAL_DIGITALIO_DIGITALINOUT_H
diff --git a/ports/stm/common-hal/digitalio/__init__.c b/ports/stm/common-hal/digitalio/__init__.c
new file mode 100644
index 000000000..20fad4595
--- /dev/null
+++ b/ports/stm/common-hal/digitalio/__init__.c
@@ -0,0 +1 @@
+// No digitalio module functions.
diff --git a/ports/stm32f4/common-hal/displayio/ParallelBus.c b/ports/stm/common-hal/displayio/ParallelBus.c
index 1b808ec02..1b808ec02 100644
--- a/ports/stm32f4/common-hal/displayio/ParallelBus.c
+++ b/ports/stm/common-hal/displayio/ParallelBus.c
diff --git a/ports/stm32f4/common-hal/displayio/ParallelBus.h b/ports/stm/common-hal/displayio/ParallelBus.h
index 85d100715..85d100715 100644
--- a/ports/stm32f4/common-hal/displayio/ParallelBus.h
+++ b/ports/stm/common-hal/displayio/ParallelBus.h
diff --git a/ports/stm32f4/common-hal/microcontroller/Pin.c b/ports/stm/common-hal/microcontroller/Pin.c
index 1d4d45b97..2c513f4aa 100644
--- a/ports/stm32f4/common-hal/microcontroller/Pin.c
+++ b/ports/stm/common-hal/microcontroller/Pin.c
@@ -30,23 +30,22 @@
#include "supervisor/shared/rgb_led_status.h"
#include "py/mphal.h"
-#include "stm32f4/pins.h"
-#include "stm32f4xx_hal.h"
+#include "pins.h"
#ifdef MICROPY_HW_NEOPIXEL
bool neopixel_in_use;
#endif
-#if MCU_PACKAGE == 144
+#if defined(LQFP144)
#define GPIO_PORT_COUNT 7
GPIO_TypeDef * ports[GPIO_PORT_COUNT] = {GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF, GPIOG};
-#elif MCU_PACKAGE == 100
+#elif defined(LQFP100_f4) || (LQFP100_x7)
#define GPIO_PORT_COUNT 5
GPIO_TypeDef * ports[GPIO_PORT_COUNT] = {GPIOA, GPIOB, GPIOC, GPIOD, GPIOE};
-#elif MCU_PACKAGE == 64
+#elif defined(LQFP64)
#define GPIO_PORT_COUNT 3
GPIO_TypeDef * ports[GPIO_PORT_COUNT] = {GPIOA, GPIOB, GPIOC};
-#elif MCU_PACKAGE == 48
+#elif defined(UFQFPN48)
#define GPIO_PORT_COUNT 3
GPIO_TypeDef * ports[GPIO_PORT_COUNT] = {GPIOA, GPIOB, GPIOC};
#endif
diff --git a/ports/stm32f4/common-hal/microcontroller/Pin.h b/ports/stm/common-hal/microcontroller/Pin.h
index c4c9be6a8..d69ddfb1d 100644
--- a/ports/stm32f4/common-hal/microcontroller/Pin.h
+++ b/ports/stm/common-hal/microcontroller/Pin.h
@@ -24,12 +24,12 @@
* THE SOFTWARE.
*/
-#ifndef MICROPY_INCLUDED_STM34F4_COMMON_HAL_MICROCONTROLLER_PIN_H
-#define MICROPY_INCLUDED_STM34F4_COMMON_HAL_MICROCONTROLLER_PIN_H
+#ifndef MICROPY_INCLUDED_STM32_COMMON_HAL_MICROCONTROLLER_PIN_H
+#define MICROPY_INCLUDED_STM32_COMMON_HAL_MICROCONTROLLER_PIN_H
#include "py/mphal.h"
-#include "peripherals/stm32f4/pins.h"
+#include "peripherals/pins.h"
#ifdef MICROPY_HW_NEOPIXEL
extern bool neopixel_in_use;
@@ -49,4 +49,4 @@ void never_reset_pin_number(uint8_t pin_port, uint8_t pin_number);
GPIO_TypeDef * pin_port(uint8_t pin_port);
uint16_t pin_mask(uint8_t pin_number);
-#endif // MICROPY_INCLUDED_STM34F4_COMMON_HAL_MICROCONTROLLER_PIN_H
+#endif // MICROPY_INCLUDED_STM32_COMMON_HAL_MICROCONTROLLER_PIN_H
diff --git a/ports/stm/common-hal/microcontroller/Processor.c b/ports/stm/common-hal/microcontroller/Processor.c
new file mode 100644
index 000000000..c8b07db3f
--- /dev/null
+++ b/ports/stm/common-hal/microcontroller/Processor.c
@@ -0,0 +1,139 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Lucian Copeland 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 <math.h>
+#include "common-hal/microcontroller/Processor.h"
+#include "py/runtime.h"
+#include "supervisor/shared/translate.h"
+
+#if defined(STM32F4)
+
+#define STM32_UUID ((uint32_t *)0x1FFF7A10)
+
+//Factory calibration locations
+#define ADC_CAL_ADDRESS (0x1fff7a2a)
+#define ADC_CAL1 ((uint16_t*)(ADC_CAL_ADDRESS + 2))
+#define ADC_CAL2 ((uint16_t*)(ADC_CAL_ADDRESS + 4))
+#define VREFIN_CAL ((uint16_t *)ADC_CAL_ADDRESS)
+
+// correction factor for reference value
+STATIC volatile float adc_refcor = 1.0f;
+
+STATIC void set_adc_params(ADC_HandleTypeDef *AdcHandle) {
+ AdcHandle->Instance = ADC1;
+ AdcHandle->Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV4;
+ AdcHandle->Init.Resolution = ADC_RESOLUTION_12B;
+ AdcHandle->Init.ScanConvMode = DISABLE;
+ AdcHandle->Init.ContinuousConvMode = DISABLE;
+ AdcHandle->Init.DiscontinuousConvMode = DISABLE;
+ AdcHandle->Init.NbrOfDiscConversion = 0;
+ AdcHandle->Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
+ AdcHandle->Init.ExternalTrigConv = ADC_SOFTWARE_START;
+ AdcHandle->Init.DataAlign = ADC_DATAALIGN_RIGHT;
+ AdcHandle->Init.NbrOfConversion = 1;
+ AdcHandle->Init.DMAContinuousRequests = DISABLE;
+ AdcHandle->Init.EOCSelection = ADC_EOC_SINGLE_CONV;
+}
+
+#endif
+
+float common_hal_mcu_processor_get_temperature(void) {
+ #if defined(STM32F4)
+ __HAL_RCC_ADC1_CLK_ENABLE();
+
+ //HAL Implementation
+ ADC_HandleTypeDef AdcHandle;
+ ADC_ChannelConfTypeDef sConfig;
+ set_adc_params(&AdcHandle);
+ HAL_ADC_Init(&AdcHandle);
+
+ ADC->CCR |= ADC_CCR_TSVREFE;
+ ADC->CCR &= ~ADC_CCR_VBATE; // If this somehow got turned on, it'll return bad values.
+
+ sConfig.Channel = ADC_CHANNEL_TEMPSENSOR; //either 16 or 18, depending on chip
+ sConfig.Rank = 1;
+ sConfig.SamplingTime = ADC_SAMPLETIME_480CYCLES; // Temp sensor likes 10us minimum
+ HAL_ADC_ConfigChannel(&AdcHandle, &sConfig);
+
+ HAL_ADC_Start(&AdcHandle);
+ if (HAL_ADC_PollForConversion(&AdcHandle,1) != HAL_OK) {
+ mp_raise_RuntimeError(translate("Temperature read timed out"));
+ }
+ uint32_t value = (uint32_t)HAL_ADC_GetValue(&AdcHandle);
+ HAL_ADC_Stop(&AdcHandle);
+
+ //There's no F4 specific appnote for this but it works the same as the L1 in AN3964
+ float core_temp_avg_slope = (*ADC_CAL2 - *ADC_CAL1) / 80.0;
+ return (((float)value * adc_refcor - *ADC_CAL1) / core_temp_avg_slope) + 30.0f;
+ #else
+ return false;
+ #endif
+}
+
+float common_hal_mcu_processor_get_voltage(void) {
+ #if defined(STM32F4)
+ __HAL_RCC_ADC1_CLK_ENABLE();
+
+ //HAL Implementation
+ ADC_HandleTypeDef AdcHandle;
+ ADC_ChannelConfTypeDef sConfig;
+ set_adc_params(&AdcHandle);
+ HAL_ADC_Init(&AdcHandle);
+
+ ADC->CCR |= ADC_CCR_TSVREFE;
+
+ sConfig.Channel = ADC_CHANNEL_VREFINT;
+ sConfig.Rank = 1;
+ sConfig.SamplingTime = ADC_SAMPLETIME_480CYCLES;
+ HAL_ADC_ConfigChannel(&AdcHandle, &sConfig);
+
+ HAL_ADC_Start(&AdcHandle);
+ if (HAL_ADC_PollForConversion(&AdcHandle,1) != HAL_OK) {
+ mp_raise_RuntimeError(translate("Voltage read timed out"));
+ }
+ uint32_t value = (uint32_t)HAL_ADC_GetValue(&AdcHandle);
+ HAL_ADC_Stop(&AdcHandle);
+
+ //This value could be used to actively correct ADC values.
+ adc_refcor = ((float)(*VREFIN_CAL)) / ((float)value);
+
+ return adc_refcor * 3.3f;
+ #else
+ return false;
+ #endif
+}
+
+uint32_t common_hal_mcu_processor_get_frequency(void) {
+ return SystemCoreClock;
+}
+
+void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) {
+ #if defined(STM32F4)
+ for (int i=0; i<3; i++) {
+ ((uint32_t*) raw_id)[i] = STM32_UUID[i];
+ }
+ #endif
+}
diff --git a/ports/stm32f4/common-hal/microcontroller/Processor.h b/ports/stm/common-hal/microcontroller/Processor.h
index 311333e7d..1d22aa965 100644
--- a/ports/stm32f4/common-hal/microcontroller/Processor.h
+++ b/ports/stm/common-hal/microcontroller/Processor.h
@@ -24,8 +24,8 @@
* THE SOFTWARE.
*/
-#ifndef MICROPY_INCLUDED_STM32F4_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H
-#define MICROPY_INCLUDED_STM32F4_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H
+#ifndef MICROPY_INCLUDED_STM32_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H
+#define MICROPY_INCLUDED_STM32_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H
#define COMMON_HAL_MCU_PROCESSOR_UID_LENGTH 12
@@ -36,4 +36,4 @@ typedef struct {
// Stores no state currently.
} mcu_processor_obj_t;
-#endif // MICROPY_INCLUDED_STM32F4_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H
+#endif // MICROPY_INCLUDED_STM32_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H
diff --git a/ports/stm/common-hal/microcontroller/__init__.c b/ports/stm/common-hal/microcontroller/__init__.c
new file mode 100644
index 000000000..020c3ee79
--- /dev/null
+++ b/ports/stm/common-hal/microcontroller/__init__.c
@@ -0,0 +1,121 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016 Scott Shawcroft for Adafruit Industries
+ * Copyright (c) 2019 Lucian Copeland 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 "py/mphal.h"
+#include "py/obj.h"
+#include "py/runtime.h"
+
+#include "common-hal/microcontroller/Pin.h"
+#include "common-hal/microcontroller/Processor.h"
+
+#include "shared-bindings/nvm/ByteArray.h"
+#include "shared-bindings/microcontroller/__init__.h"
+#include "shared-bindings/microcontroller/Pin.h"
+#include "shared-bindings/microcontroller/Processor.h"
+
+#include "supervisor/filesystem.h"
+#include "supervisor/shared/safe_mode.h"
+
+//tested divisor value for busy loop in us delay
+#define LOOP_TICKS 12
+
+STATIC uint32_t get_us(void) {
+ uint32_t ticks_per_us = HAL_RCC_GetSysClockFreq()/1000000;
+ uint32_t micros, sys_cycles;
+ do {
+ micros = supervisor_ticks_ms32();
+ sys_cycles = SysTick->VAL; //counts backwards
+ } while (micros != supervisor_ticks_ms32()); //try again if ticks_ms rolled over
+ return (micros * 1000) + (ticks_per_us * 1000 - sys_cycles) / ticks_per_us;
+}
+
+void common_hal_mcu_delay_us(uint32_t delay) {
+ if (__get_PRIMASK() == 0x00000000) {
+ //by default use ticks_ms
+ uint32_t start = get_us();
+ while (get_us()-start < delay) {
+ __asm__ __volatile__("nop");
+ }
+ } else {
+ //when SysTick is disabled, approximate with busy loop
+ const uint32_t ucount = HAL_RCC_GetSysClockFreq() / 1000000 * delay / LOOP_TICKS;
+ for (uint32_t count = 0; ++count <= ucount;) {
+ }
+ }
+}
+
+volatile uint32_t nesting_count = 0;
+
+void common_hal_mcu_disable_interrupts(void) {
+ __disable_irq();
+ __DMB();
+ nesting_count++;
+}
+
+void common_hal_mcu_enable_interrupts(void) {
+ if (nesting_count == 0) {
+ // This is very very bad because it means there was mismatched disable/enables so we
+ // "HardFault".
+ asm("bkpt");
+ }
+ nesting_count--;
+ if (nesting_count > 0) {
+ return;
+ }
+ __DMB();
+ __enable_irq();
+}
+
+void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) {
+ if(runmode == RUNMODE_SAFE_MODE)
+ safe_mode_on_next_reset(PROGRAMMATIC_SAFE_MODE);
+}
+
+void common_hal_mcu_reset(void) {
+ filesystem_flush(); //TODO: implement as part of flash improvements
+ NVIC_SystemReset();
+}
+
+// The singleton microcontroller.Processor object, bound to microcontroller.cpu
+// It currently only has properties, and no state.
+const mcu_processor_obj_t common_hal_mcu_processor_obj = {
+ .base = {
+ .type = &mcu_processor_type,
+ },
+};
+
+#if CIRCUITPY_INTERNAL_NVM_SIZE > 0
+// The singleton nvm.ByteArray object.
+const nvm_bytearray_obj_t common_hal_mcu_nvm_obj = {
+ .base = {
+ .type = &nvm_bytearray_type,
+ },
+ .len = NVM_BYTEARRAY_BUFFER_SIZE,
+ .start_address = (uint8_t*) (CIRCUITPY_INTERNAL_NVM_START_ADDR)
+};
+#endif
+
diff --git a/ports/stm32f4/common-hal/neopixel_write/__init__.c b/ports/stm/common-hal/neopixel_write/__init__.c
index 6740a0d34..6740a0d34 100644
--- a/ports/stm32f4/common-hal/neopixel_write/__init__.c
+++ b/ports/stm/common-hal/neopixel_write/__init__.c
diff --git a/ports/stm/common-hal/nvm/ByteArray.c b/ports/stm/common-hal/nvm/ByteArray.c
new file mode 100644
index 000000000..1aaf54653
--- /dev/null
+++ b/ports/stm/common-hal/nvm/ByteArray.c
@@ -0,0 +1,73 @@
+/*
+ * 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 "common-hal/nvm/ByteArray.h"
+
+#include "stm32f4xx_hal.h"
+
+#include "supervisor/shared/stack.h"
+
+#include <stdint.h>
+#include <string.h>
+
+uint32_t common_hal_nvm_bytearray_get_length(nvm_bytearray_obj_t *self) {
+ return self->len;
+}
+
+bool common_hal_nvm_bytearray_set_bytes(nvm_bytearray_obj_t *self,
+ uint32_t start_index, uint8_t* values, uint32_t len) {
+ // Copy flash to buffer
+ uint8_t buffer[self->len];
+ memcpy(buffer, self->start_address, self->len);
+
+ // Set bytes in buffer
+ memmove(buffer + start_index, values, len);
+
+ // Erase flash sector
+ HAL_FLASH_Unlock();
+ __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGSERR );
+ FLASH_Erase_Sector(CIRCUITPY_INTERNAL_NVM_SECTOR, VOLTAGE_RANGE_3);
+
+ // Write bytes to flash
+ uint32_t i;
+ uint32_t flash_addr = (uint32_t)self->start_address;
+ for (i = 0; i < self->len; i++, flash_addr++) {
+ if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_BYTE, flash_addr, buffer[i]) != HAL_OK) {
+ HAL_FLASH_Lock();
+ return false;
+ }
+ }
+
+ // Finish up
+ HAL_FLASH_Lock();
+ return true;
+}
+
+// NVM memory is memory mapped so reading it is easy.
+void common_hal_nvm_bytearray_get_bytes(nvm_bytearray_obj_t *self,
+ uint32_t start_index, uint32_t len, uint8_t* values) {
+ memcpy(values, self->start_address + start_index, len);
+}
diff --git a/ports/stm/common-hal/nvm/ByteArray.h b/ports/stm/common-hal/nvm/ByteArray.h
new file mode 100644
index 000000000..b6ea36de3
--- /dev/null
+++ b/ports/stm/common-hal/nvm/ByteArray.h
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+#ifndef MICROPY_INCLUDED_STM32_COMMON_HAL_NVM_BYTEARRAY_H
+#define MICROPY_INCLUDED_STM32_COMMON_HAL_NVM_BYTEARRAY_H
+
+#include "py/obj.h"
+
+// STM flash is saved in sectors (not pages), at a minimum size of 16k.
+// To limit the RAM usage during writing, we want to set a smaller
+// maximum value.
+#ifndef NVM_BYTEARRAY_BUFFER_SIZE
+#define NVM_BYTEARRAY_BUFFER_SIZE 512
+#endif
+
+typedef struct {
+ mp_obj_base_t base;
+ uint8_t* start_address;
+ uint32_t len;
+} nvm_bytearray_obj_t;
+
+#endif // MICROPY_INCLUDED_STM32_COMMON_HAL_NVM_BYTEARRAY_H
diff --git a/ports/stm/common-hal/nvm/__init__.c b/ports/stm/common-hal/nvm/__init__.c
new file mode 100644
index 000000000..f0792430f
--- /dev/null
+++ b/ports/stm/common-hal/nvm/__init__.c
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+// No nvm module functions.
diff --git a/ports/stm32f4/common-hal/os/__init__.c b/ports/stm/common-hal/os/__init__.c
index 0b3153286..1a1efef9f 100644
--- a/ports/stm32f4/common-hal/os/__init__.c
+++ b/ports/stm/common-hal/os/__init__.c
@@ -33,7 +33,7 @@
#include "py/mperrno.h"
#include "py/runtime.h"
#include "stm32f4xx_hal.h"
-#include "stm32f4/periph.h"
+#include "peripherals/periph.h"
STATIC const qstr os_uname_info_fields[] = {
MP_QSTR_sysname, MP_QSTR_nodename,
diff --git a/ports/stm32f4/common-hal/pulseio/PWMOut.c b/ports/stm/common-hal/pulseio/PWMOut.c
index 50bacbb51..d62ee2a38 100644
--- a/ports/stm32f4/common-hal/pulseio/PWMOut.c
+++ b/ports/stm/common-hal/pulseio/PWMOut.c
@@ -72,7 +72,7 @@ STATIC uint32_t timer_get_internal_duty(uint16_t duty, uint32_t period) {
return (duty*period) / ((1 << 16) - 1);
}
-STATIC void timer_get_optimal_divisors(uint32_t*period, uint32_t*prescaler,
+STATIC void timer_get_optimal_divisors(uint32_t*period, uint32_t*prescaler,
uint32_t frequency, uint32_t source_freq) {
//Find the largest possible period supported by this frequency
for (int i = 0; i < (1 << 16); i++) {
@@ -139,7 +139,7 @@ pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self,
first_time_setup = false; //skip setting up the timer
}
//No problems taken, so set it up
- self->tim = l_tim;
+ self->tim = l_tim;
break;
}
}
@@ -163,7 +163,7 @@ pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self,
} else if (var_freq_mismatch) {
mp_raise_ValueError(translate("Cannot vary frequency on a timer that is already in use"));
} else {
- mp_raise_ValueError(translate("Invalid pins"));
+ mp_raise_ValueError(translate("Invalid pins for PWMOut"));
}
}
@@ -182,7 +182,7 @@ pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self,
uint32_t prescaler = 0; //prescaler is 15 bit
uint32_t period = 0; //period is 16 bit
- timer_get_optimal_divisors(&period, &prescaler, frequency,
+ timer_get_optimal_divisors(&period, &prescaler, frequency,
timer_get_source_freq(self->tim->tim_index));
//Timer init
@@ -240,7 +240,7 @@ void common_hal_pulseio_pwmout_reset_ok(pulseio_pwmout_obj_t *self) {
}
bool common_hal_pulseio_pwmout_deinited(pulseio_pwmout_obj_t* self) {
- return self->tim == mp_const_none;
+ return self->tim == NULL;
}
void common_hal_pulseio_pwmout_deinit(pulseio_pwmout_obj_t* self) {
@@ -255,7 +255,7 @@ void common_hal_pulseio_pwmout_deinit(pulseio_pwmout_obj_t* self) {
HAL_TIM_PWM_Stop(&self->handle, self->channel);
}
reset_pin_number(self->tim->pin->port,self->tim->pin->number);
- self->tim = mp_const_none;
+ self->tim = NULL;
//if reserved timer has no active channels, we can disable it
if (!reserved_tim[self->tim->tim_index - 1]) {
@@ -276,13 +276,13 @@ uint16_t common_hal_pulseio_pwmout_get_duty_cycle(pulseio_pwmout_obj_t* self) {
void common_hal_pulseio_pwmout_set_frequency(pulseio_pwmout_obj_t* self, uint32_t frequency) {
//don't halt setup for the same frequency
- if (frequency == self->frequency) {
+ if (frequency == self->frequency) {
return;
}
uint32_t prescaler = 0;
uint32_t period = 0;
- timer_get_optimal_divisors(&period, &prescaler, frequency,
+ timer_get_optimal_divisors(&period, &prescaler, frequency,
timer_get_source_freq(self->tim->tim_index));
//shut down
@@ -290,7 +290,7 @@ void common_hal_pulseio_pwmout_set_frequency(pulseio_pwmout_obj_t* self, uint32_
//Only change altered values
self->handle.Init.Period = period - 1;
- self->handle.Init.Prescaler = prescaler - 1;
+ self->handle.Init.Prescaler = prescaler - 1;
//restart everything, adjusting for new speed
if (HAL_TIM_PWM_Init(&self->handle) != HAL_OK) {
diff --git a/ports/stm32f4/common-hal/pulseio/PWMOut.h b/ports/stm/common-hal/pulseio/PWMOut.h
index 59fc04e5f..8519735c6 100644
--- a/ports/stm32f4/common-hal/pulseio/PWMOut.h
+++ b/ports/stm/common-hal/pulseio/PWMOut.h
@@ -30,7 +30,7 @@
#include "common-hal/microcontroller/Pin.h"
#include "stm32f4xx_hal.h"
-#include "stm32f4/periph.h"
+#include "peripherals/periph.h"
#include "py/obj.h"
diff --git a/ports/stm/common-hal/pulseio/PulseIn.c b/ports/stm/common-hal/pulseio/PulseIn.c
new file mode 100644
index 000000000..8428a2278
--- /dev/null
+++ b/ports/stm/common-hal/pulseio/PulseIn.c
@@ -0,0 +1,303 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Lucian Copeland 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 "common-hal/pulseio/PulseIn.h"
+#include <stdint.h>
+#include <string.h>
+#include "py/mpconfig.h"
+#include "py/gc.h"
+#include "py/runtime.h"
+#include "shared-bindings/microcontroller/__init__.h"
+#include "shared-bindings/pulseio/PulseIn.h"
+#include "tick.h"
+
+#include "stm32f4xx_hal.h"
+
+#define STM32_GPIO_PORT_SIZE 16
+
+static pulseio_pulsein_obj_t* _objs[STM32_GPIO_PORT_SIZE];
+
+static void assign_EXTI_Interrupt(pulseio_pulsein_obj_t* self, uint8_t num);
+
+static void pulsein_handler(uint8_t num) {
+ // Interrupt register must be cleared manually
+ EXTI->PR = 1 << num;
+
+ // Grab the current time first.
+ uint32_t current_us;
+ uint64_t current_ms;
+ current_tick(&current_ms, &current_us);
+
+ // current_tick gives us the remaining us until the next tick but we want the number since the last ms.
+ current_us = 1000 - current_us;
+
+ pulseio_pulsein_obj_t* self = _objs[num];
+ if ( !self ) return;
+
+ if (self->first_edge) {
+ // first pulse is opposite state from idle
+ bool state = HAL_GPIO_ReadPin(pin_port(self->pin->port), pin_mask(self->pin->number));
+ if ( self->idle_state != state ) {
+ self->first_edge = false;
+ }
+ } else {
+ uint32_t ms_diff = current_ms - self->last_ms;
+ uint16_t us_diff = current_us - self->last_us;
+ uint32_t total_diff = us_diff;
+
+ if (self->last_us > current_us) {
+ total_diff = 1000 + current_us - self->last_us;
+ if (ms_diff > 1) {
+ total_diff += (ms_diff - 1) * 1000;
+ }
+ } else {
+ total_diff += ms_diff * 1000;
+ }
+ uint16_t duration = 0xffff;
+ if (total_diff < duration) {
+ duration = total_diff;
+ }
+
+ uint16_t i = (self->start + self->len) % self->maxlen;
+ self->buffer[i] = duration;
+ if (self->len < self->maxlen) {
+ self->len++;
+ } else {
+ self->start++;
+ }
+ }
+
+ self->last_ms = current_ms;
+ self->last_us = current_us;
+}
+
+void pulsein_reset(void) {
+ // Disable all active interrupts and clear array
+ for (uint i = 0; i < STM32_GPIO_PORT_SIZE; i++) {
+ if (_objs[i] != NULL) {
+ HAL_NVIC_DisableIRQ(_objs[i]->irq);
+ }
+ }
+ memset(_objs, 0, sizeof(_objs));
+}
+
+void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self, const mcu_pin_obj_t* pin,
+ uint16_t maxlen, bool idle_state) {
+ // STM32 has one shared EXTI for each pin number, 0-15
+ uint8_t p_num = pin->number;
+ if(_objs[p_num]) {
+ mp_raise_ValueError(translate("Pin number already reserved by EXTI"));
+ }
+ _objs[p_num] = self;
+
+ // Allocate pulse buffer
+ self->buffer = (uint16_t *) m_malloc(maxlen * sizeof(uint16_t), false);
+ if (self->buffer == NULL) {
+ mp_raise_msg_varg(&mp_type_MemoryError, translate("Failed to allocate RX buffer of %d bytes"),
+ maxlen * sizeof(uint16_t));
+ }
+
+ // Set internal variables
+ self->pin = pin;
+ self->maxlen = maxlen;
+ self->idle_state = idle_state;
+ self->start = 0;
+ self->len = 0;
+ self->first_edge = true;
+ self->paused = false;
+ self->last_us = 0;
+ self->last_ms = 0;
+
+ // EXTI pins can also be read as an input
+ GPIO_InitTypeDef GPIO_InitStruct = {0};
+ GPIO_InitStruct.Pin = pin_mask(pin->number);
+ GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
+ GPIO_InitStruct.Pull = GPIO_NOPULL;
+ HAL_GPIO_Init(pin_port(pin->port), &GPIO_InitStruct);
+
+ // Interrupt starts immediately
+ assign_EXTI_Interrupt(self, pin->number);
+ HAL_NVIC_EnableIRQ(self->irq);
+ claim_pin(pin);
+}
+
+bool common_hal_pulseio_pulsein_deinited(pulseio_pulsein_obj_t* self) {
+ return (self->pin == NULL);
+}
+
+void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t* self) {
+ if (common_hal_pulseio_pulsein_deinited(self)) {
+ return;
+ }
+ //Remove pulsein slot from shared array
+ HAL_NVIC_DisableIRQ(self->irq);
+ _objs[self->pin->number] = NULL;
+ reset_pin_number(self->pin->port, self->pin->number);
+ self->pin = NULL;
+}
+
+void common_hal_pulseio_pulsein_pause(pulseio_pulsein_obj_t* self) {
+ HAL_NVIC_DisableIRQ(self->irq);
+ self->paused = true;
+}
+
+void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t* self, uint16_t trigger_duration) {
+ // Make sure we're paused.
+ if ( !self->paused ) {
+ common_hal_pulseio_pulsein_pause(self);
+ }
+
+ // Send the trigger pulse.
+ if (trigger_duration > 0) {
+ GPIO_InitTypeDef GPIO_InitStruct = {0};
+ GPIO_InitStruct.Pin = pin_mask(self->pin->number);
+ GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
+ GPIO_InitStruct.Pull = GPIO_NOPULL;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
+ HAL_GPIO_Init(pin_port(self->pin->port), &GPIO_InitStruct);
+
+ HAL_GPIO_WritePin(pin_port(self->pin->port), pin_mask(self->pin->number), !self->idle_state);
+ common_hal_mcu_delay_us((uint32_t)trigger_duration);
+ HAL_GPIO_WritePin(pin_port(self->pin->port), pin_mask(self->pin->number), self->idle_state);
+
+ GPIO_InitStruct.Pin = pin_mask(self->pin->number);
+ GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
+ GPIO_InitStruct.Pull = GPIO_NOPULL;
+ HAL_GPIO_Init(pin_port(self->pin->port), &GPIO_InitStruct);
+ }
+
+ self->first_edge = true;
+ self->paused = false;
+ self->last_ms = 0;
+ self->last_us = 0;
+
+ HAL_NVIC_EnableIRQ(self->irq);
+}
+
+void common_hal_pulseio_pulsein_clear(pulseio_pulsein_obj_t* self) {
+ HAL_NVIC_DisableIRQ(self->irq);
+ self->start = 0;
+ self->len = 0;
+ HAL_NVIC_EnableIRQ(self->irq);
+}
+
+uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t* self, int16_t index) {
+ HAL_NVIC_DisableIRQ(self->irq);
+ if (index < 0) {
+ index += self->len;
+ }
+ if (index < 0 || index >= self->len) {
+ HAL_NVIC_EnableIRQ(self->irq);
+ mp_raise_IndexError(translate("index out of range"));
+ }
+ uint16_t value = self->buffer[(self->start + index) % self->maxlen];
+ HAL_NVIC_EnableIRQ(self->irq);
+ return value;
+}
+
+uint16_t common_hal_pulseio_pulsein_popleft(pulseio_pulsein_obj_t* self) {
+ if (self->len == 0) {
+ mp_raise_IndexError(translate("pop from an empty PulseIn"));
+ }
+ HAL_NVIC_DisableIRQ(self->irq);
+ uint16_t value = self->buffer[self->start];
+ self->start = (self->start + 1) % self->maxlen;
+ self->len--;
+ HAL_NVIC_EnableIRQ(self->irq);
+
+ return value;
+}
+
+uint16_t common_hal_pulseio_pulsein_get_maxlen(pulseio_pulsein_obj_t* self) {
+ return self->maxlen;
+}
+
+bool common_hal_pulseio_pulsein_get_paused(pulseio_pulsein_obj_t* self) {
+ return self->paused;
+}
+
+uint16_t common_hal_pulseio_pulsein_get_len(pulseio_pulsein_obj_t* self) {
+ return self->len;
+}
+
+static void assign_EXTI_Interrupt(pulseio_pulsein_obj_t* self, uint8_t num) {
+ if (num == 0) {
+ self->irq = EXTI0_IRQn;
+ } else if (num == 1) {
+ self->irq = EXTI1_IRQn;
+ } else if (num == 2) {
+ self->irq = EXTI2_IRQn;
+ } else if (num == 3) {
+ self->irq = EXTI3_IRQn;
+ } else if (num == 4) {
+ self->irq = EXTI4_IRQn;
+ } else if (num >= 5 && num <= 9 ) {
+ self->irq = EXTI9_5_IRQn;
+ } else if (num >= 10 && num <= 15) {
+ self->irq = EXTI15_10_IRQn;
+ }
+}
+
+void EXTI0_IRQHandler(void)
+{
+ pulsein_handler(0);
+}
+void EXTI1_IRQHandler(void)
+{
+ pulsein_handler(1);
+}
+void EXTI2_IRQHandler(void)
+{
+ pulsein_handler(2);
+}
+void EXTI3_IRQHandler(void)
+{
+ pulsein_handler(3);
+}
+void EXTI4_IRQHandler(void)
+{
+ pulsein_handler(4);
+}
+
+void EXTI9_5_IRQHandler(void)
+{
+ uint32_t pending = EXTI->PR;
+ for (uint i = 5; i <= 9; i++) {
+ if(pending & (1 << i)) {
+ pulsein_handler(i);
+ }
+ }
+}
+
+void EXTI15_10_IRQHandler(void)
+{
+ uint32_t pending = EXTI->PR;
+ for (uint i = 10; i <= 15; i++) {
+ if(pending & (1 << i)) {
+ pulsein_handler(i);
+ }
+ }
+}
diff --git a/ports/stm32f4/common-hal/pulseio/PulseIn.h b/ports/stm/common-hal/pulseio/PulseIn.h
index 2538b07ab..5456613c6 100644
--- a/ports/stm32f4/common-hal/pulseio/PulseIn.h
+++ b/ports/stm/common-hal/pulseio/PulseIn.h
@@ -34,7 +34,8 @@
typedef struct {
mp_obj_base_t base;
- uint8_t pin;
+ const mcu_pin_obj_t* pin;
+ IRQn_Type irq;
bool idle_state;
bool paused;
volatile bool first_edge;
diff --git a/ports/stm/common-hal/pulseio/PulseOut.c b/ports/stm/common-hal/pulseio/PulseOut.c
new file mode 100644
index 000000000..d82525ea1
--- /dev/null
+++ b/ports/stm/common-hal/pulseio/PulseOut.c
@@ -0,0 +1,214 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Lucian Copeland 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 "common-hal/pulseio/PulseOut.h"
+
+#include <stdint.h>
+
+#include "py/mpconfig.h"
+#include "py/gc.h"
+#include "py/runtime.h"
+#include "shared-bindings/pulseio/PulseOut.h"
+#include "shared-bindings/pulseio/PWMOut.h"
+#include "supervisor/shared/translate.h"
+
+#include "stm32f4xx_hal.h"
+#include "common-hal/microcontroller/Pin.h"
+#include "tick.h"
+
+// A single timer is shared amongst all PulseOut objects under the assumption that
+// the code is single threaded.
+STATIC uint8_t refcount = 0;
+
+STATIC uint16_t *pulse_array = NULL;
+STATIC volatile uint16_t pulse_array_index = 0;
+STATIC uint16_t pulse_array_length;
+
+//Timer is shared, must be accessible by interrupt
+STATIC TIM_HandleTypeDef t7_handle;
+pulseio_pulseout_obj_t *curr_pulseout = NULL;
+
+STATIC void turn_on(pulseio_pulseout_obj_t *pulseout) {
+ // Turn on PWM
+ HAL_TIM_PWM_Start(&(pulseout->pwmout->handle), pulseout->pwmout->channel);
+}
+
+STATIC void turn_off(pulseio_pulseout_obj_t *pulseout) {
+ // Turn off PWM
+ HAL_TIM_PWM_Stop(&(pulseout->pwmout->handle), pulseout->pwmout->channel);
+ // Make sure pin is low.
+ HAL_GPIO_WritePin(pin_port(pulseout->pwmout->tim->pin->port),
+ pin_mask(pulseout->pwmout->tim->pin->number), 0);
+}
+
+STATIC void start_timer(void) {
+ // Set the new period
+ t7_handle.Init.Period = pulse_array[pulse_array_index] - 1;
+ HAL_TIM_Base_Init(&t7_handle);
+
+ // TIM7 has limited HAL support, set registers manually
+ t7_handle.Instance->SR = 0; // Prevent the SR from triggering an interrupt
+ t7_handle.Instance->CR1 |= TIM_CR1_CEN; // Resume timer
+ t7_handle.Instance->CR1 |= TIM_CR1_URS; // Disable non-overflow interrupts
+ __HAL_TIM_ENABLE_IT(&t7_handle, TIM_IT_UPDATE);
+
+}
+
+STATIC void pulseout_event_handler(void) {
+ if (curr_pulseout->pwmout == NULL) {
+ return; //invalid interrupt
+ }
+
+ HAL_GPIO_WritePin(pin_port(2),pin_mask(6), 1);
+ HAL_GPIO_WritePin(pin_port(2),pin_mask(6), 0);
+
+ pulse_array_index++;
+
+ // No more pulses. Turn off output and don't restart.
+ if (pulse_array_index >= pulse_array_length) {
+ turn_off(curr_pulseout);
+ return;
+ }
+
+ // Alternate on and off, starting with on.
+ if (pulse_array_index % 2 == 0) {
+ turn_on(curr_pulseout);
+ } else {
+ turn_off(curr_pulseout);
+ }
+
+ // Count up to the next given value.
+ start_timer();
+}
+
+void pulseout_reset() {
+ #if HAS_BASIC_TIM
+ __HAL_RCC_TIM7_CLK_DISABLE();
+ refcount = 0;
+ #endif
+}
+
+void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self,
+ const pulseio_pwmout_obj_t* carrier) {
+#if !(HAS_BASIC_TIM)
+ mp_raise_NotImplementedError(translate("PulseOut not supported on this chip"));
+#else
+ // Add to active PulseOuts
+ refcount++;
+
+ // Calculate a 1 ms period
+ uint32_t source, clk_div;
+ source = HAL_RCC_GetPCLK1Freq(); // TIM7 is on APB1
+ clk_div = RCC->CFGR & RCC_CFGR_PPRE1;
+ // APB quirk, see See DM00031020 Rev 4, page 115.
+ if (clk_div != 0) {
+ // APB prescaler for this timer is > 1
+ source *= 2;
+ }
+
+ uint32_t prescaler = source/1000000; //1us intervals
+
+ __HAL_RCC_TIM7_CLK_ENABLE();
+ HAL_NVIC_SetPriority(TIM7_IRQn, 4, 0);
+ HAL_NVIC_EnableIRQ(TIM7_IRQn);
+
+ // Timers 6 and 7 have no pins, so using them doesn't affect PWM availability
+ t7_handle.Instance = TIM7;
+ t7_handle.Init.Period = 100; //immediately replaced.
+ t7_handle.Init.Prescaler = prescaler - 1;
+ t7_handle.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
+ t7_handle.Init.CounterMode = TIM_COUNTERMODE_UP;
+ t7_handle.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
+
+ HAL_TIM_Base_Init(&t7_handle);
+ t7_handle.Instance->SR = 0;
+
+ // The HAL can't work with const, recast required.
+ self->pwmout = (pulseio_pwmout_obj_t*)carrier;
+
+ turn_off(self);
+#endif
+}
+
+bool common_hal_pulseio_pulseout_deinited(pulseio_pulseout_obj_t* self) {
+ return self->pwmout == NULL;
+}
+
+void common_hal_pulseio_pulseout_deinit(pulseio_pulseout_obj_t* self) {
+ if (common_hal_pulseio_pulseout_deinited(self)) {
+ return;
+ }
+ turn_on(self);
+ self->pwmout = NULL;
+
+ refcount--;
+ if (refcount == 0) {
+ #if HAS_BASIC_TIM
+ __HAL_RCC_TIM7_CLK_DISABLE();
+ #endif
+ }
+}
+
+void common_hal_pulseio_pulseout_send(pulseio_pulseout_obj_t* self, uint16_t* pulses, uint16_t length) {
+ pulse_array = pulses;
+ pulse_array_index = 0;
+ pulse_array_length = length;
+ curr_pulseout = self;
+
+ turn_on(self);
+
+ // Count up to the next given value.
+ start_timer();
+
+ // Use when debugging, or issues are irrecoverable
+ // uint32_t starttime = supervisor_ticks_ms64();
+ // uint32_t timeout = 10000;
+ while(pulse_array_index < length) {
+ // Do other things while we wait. The interrupts will handle sending the
+ // signal.
+ RUN_BACKGROUND_TASKS;
+
+ // Use when debugging, or issues are irrecoverable
+ // if ((supervisor_ticks_ms64() - starttime ) > timeout ) {
+ // mp_raise_RuntimeError(translate("Error: Send Timeout"));
+ // }
+ }
+ //turn off timer counter.
+ t7_handle.Instance->CR1 &= ~TIM_CR1_CEN;
+}
+
+void TIM7_IRQHandler(void)
+{
+ // Detect TIM Update event
+ if (__HAL_TIM_GET_FLAG(&t7_handle, TIM_FLAG_UPDATE) != RESET)
+ {
+ if (__HAL_TIM_GET_IT_SOURCE(&t7_handle, TIM_IT_UPDATE) != RESET)
+ {
+ __HAL_TIM_CLEAR_IT(&t7_handle, TIM_IT_UPDATE);
+ pulseout_event_handler();
+ }
+ }
+}
diff --git a/ports/stm32f4/common-hal/pulseio/PulseOut.h b/ports/stm/common-hal/pulseio/PulseOut.h
index 45823d28a..aa97396d0 100644
--- a/ports/stm32f4/common-hal/pulseio/PulseOut.h
+++ b/ports/stm/common-hal/pulseio/PulseOut.h
@@ -34,7 +34,7 @@
typedef struct {
mp_obj_base_t base;
- const pulseio_pwmout_obj_t *pwmout;
+ pulseio_pwmout_obj_t *pwmout;
} pulseio_pulseout_obj_t;
void pulseout_reset(void);
diff --git a/ports/stm32f4/common-hal/pulseio/__init__.c b/ports/stm/common-hal/pulseio/__init__.c
index 2bee925bc..2bee925bc 100644
--- a/ports/stm32f4/common-hal/pulseio/__init__.c
+++ b/ports/stm/common-hal/pulseio/__init__.c
diff --git a/ports/stm/common-hal/supervisor/Runtime.c b/ports/stm/common-hal/supervisor/Runtime.c
new file mode 100755
index 000000000..feab6987d
--- /dev/null
+++ b/ports/stm/common-hal/supervisor/Runtime.c
@@ -0,0 +1,38 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2018 Michael Schroeder
+ *
+ * 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 <stdbool.h>
+#include "shared-bindings/supervisor/Runtime.h"
+#include "supervisor/serial.h"
+
+bool common_hal_get_serial_connected(void) {
+ return (bool) serial_connected();
+}
+
+bool common_hal_get_serial_bytes_available(void) {
+ return (bool) serial_bytes_available();
+}
+
diff --git a/ports/stm/common-hal/supervisor/Runtime.h b/ports/stm/common-hal/supervisor/Runtime.h
new file mode 100755
index 000000000..a357eb0c7
--- /dev/null
+++ b/ports/stm/common-hal/supervisor/Runtime.h
@@ -0,0 +1,37 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2018 Michael Schroeder
+ *
+ * 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_STM32_COMMON_HAL_SUPERVISOR_RUNTIME_H
+#define MICROPY_INCLUDED_STM32_COMMON_HAL_SUPERVISOR_RUNTIME_H
+
+#include "py/obj.h"
+
+typedef struct {
+ mp_obj_base_t base;
+ // Stores no state currently.
+} super_runtime_obj_t;
+
+#endif // MICROPY_INCLUDED_STM32_COMMON_HAL_SUPERVISOR_RUNTIME_H
diff --git a/ports/stm/common-hal/supervisor/__init__.c b/ports/stm/common-hal/supervisor/__init__.c
new file mode 100755
index 000000000..ac88556b4
--- /dev/null
+++ b/ports/stm/common-hal/supervisor/__init__.c
@@ -0,0 +1,40 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2018 Michael Schroeder
+ *
+ * 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 "py/obj.h"
+
+#include "shared-bindings/supervisor/__init__.h"
+#include "shared-bindings/supervisor/Runtime.h"
+
+
+// The singleton supervisor.Runtime object, bound to supervisor.runtime
+// It currently only has properties, and no state.
+const super_runtime_obj_t common_hal_supervisor_runtime_obj = {
+ .base = {
+ .type = &supervisor_runtime_type,
+ },
+}; \ No newline at end of file
diff --git a/ports/stm/common-hal/time/__init__.c b/ports/stm/common-hal/time/__init__.c
new file mode 100644
index 000000000..c85077868
--- /dev/null
+++ b/ports/stm/common-hal/time/__init__.c
@@ -0,0 +1,45 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016 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 "py/mphal.h"
+
+#include "tick.h"
+
+uint64_t common_hal_time_monotonic(void) {
+ return supervisor_ticks_ms64();
+}
+
+uint64_t common_hal_time_monotonic_ns(void) {
+ uint64_t ms;
+ uint32_t us_until_ms;
+ current_tick(&ms, &us_until_ms);
+ // us counts down.
+ return 1000 * (ms * 1000 + (1000 - us_until_ms));
+}
+
+void common_hal_time_delay_ms(uint32_t delay) {
+ mp_hal_delay_ms(delay);
+}
diff --git a/ports/stm/fatfs_port.c b/ports/stm/fatfs_port.c
new file mode 100644
index 000000000..6a17f627b
--- /dev/null
+++ b/ports/stm/fatfs_port.c
@@ -0,0 +1,33 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2013, 2014 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 "py/runtime.h"
+#include "lib/oofatfs/ff.h"
+
+DWORD get_fattime(void) {
+ // TODO: Implement this function. For now, fake it.
+ return ((2016 - 1980) << 25) | ((12) << 21) | ((4) << 16) | ((00) << 11) | ((18) << 5) | (23 / 2);
+}
diff --git a/ports/stm/mpconfigport.h b/ports/stm/mpconfigport.h
new file mode 100644
index 000000000..f570d32e5
--- /dev/null
+++ b/ports/stm/mpconfigport.h
@@ -0,0 +1,85 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2015 Glenn Ruben Bakke
+ * Copyright (c) 2019 Dan Halbert 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.
+ */
+
+#ifndef STM32_MPCONFIGPORT_H__
+#define STM32_MPCONFIGPORT_H__
+
+#include <stdint.h>
+
+#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (1)
+#define MICROPY_PY_FUNCTION_ATTRS (1)
+#define MICROPY_PY_IO (1)
+#define MICROPY_PY_REVERSE_SPECIAL_METHODS (1)
+#define MICROPY_PY_UJSON (1)
+
+extern uint8_t _ld_default_stack_size;
+
+// 24kiB stack
+// #define CIRCUITPY_DEFAULT_STACK_SIZE 0x6000
+#define CIRCUITPY_DEFAULT_STACK_SIZE ((uint32_t) &_ld_default_stack_size)
+
+#include "py/circuitpy_mpconfig.h"
+
+// The STM32 HAL file is included virtually everywhere:
+#include STM32_HAL_H
+
+// These prevent you from accidentally omitting a python file that links mpconfigport
+// and having a file accept a lack of chip family as an option.
+#if defined(STM32F4)
+#define CPY_STM32F4 1
+#define CPY_STM32F7 0
+#define CPY_STM32H7 0
+#elif defined(STM32F7)
+#define CPY_STM32F4 0
+#define CPY_STM32F7 1
+#define CPY_STM32H7 0
+#elif defined(STM32H7)
+#define CPY_STM32F4 0
+#define CPY_STM32F7 0
+#define CPY_STM32H7 1
+#else
+#error undefined processor
+#endif
+
+// Board flags:
+#ifndef BOARD_OVERWRITE_SWD
+#define BOARD_OVERWRITE_SWD (0)
+#endif
+#ifndef BOARD_VTOR_DEFER
+#define BOARD_VTOR_DEFER (0)
+#endif
+#ifndef BOARD_NO_VBUS_SENSE
+#define BOARD_NO_VBUS_SENSE (0)
+#endif
+
+#define MAX_UART 10 //how many UART are implemented
+
+#define MICROPY_PORT_ROOT_POINTERS \
+ void *cpy_uart_obj_all[MAX_UART]; \
+ CIRCUITPY_COMMON_ROOT_POINTERS
+
+#endif // __INCLUDED_MPCONFIGPORT_H
diff --git a/ports/stm32f4/mpconfigport.mk b/ports/stm/mpconfigport.mk
index f214282cb..323fd7646 100644
--- a/ports/stm32f4/mpconfigport.mk
+++ b/ports/stm/mpconfigport.mk
@@ -12,7 +12,7 @@ USB_SERIAL_NUMBER_LENGTH = 24
# Longints can be implemented as mpz, as longlong, or not
LONGINT_IMPL = MPZ
-#Reduced feature set for early port
+# Reduced feature set for early port
CIRCUITPY_MINIMAL_BUILD = 1
# The ifndef's allow overriding in mpconfigboard.mk.
@@ -71,5 +71,36 @@ endif
CFLAGS += -DMICROPY_CPYTHON_COMPAT=1
-#ifeq ($(MCU_SUB_VARIANT), stm32f412zx)
-#endif
+CIRCUITPY_ULAB = 1
+
+ifeq ($(MCU_SERIES), H7)
+ CIRCUITPY_BOARD = 1
+ CIRCUITPY_DIGITALIO = 1
+ CIRCUITPY_ANALOGIO = 0
+ CIRCUITPY_MICROCONTROLLER = 1
+ CIRCUITPY_BUSIO = 1
+ CIRCUITPY_PULSEIO = 0
+ CIRCUITPY_OS = 0
+ CIRCUITPY_STORAGE = 0
+ CIRCUITPY_RANDOM = 0
+ CIRCUITPY_USB_HID = 0
+ CIRCUITPY_USB_MIDI = 0
+ CIRCUITPY_NEOPIXEL_WRITE = 0
+ CIRCUITPY_DISPLAYIO = 0
+endif
+
+ifeq ($(MCU_SERIES), F7)
+ CIRCUITPY_BOARD = 1
+ CIRCUITPY_DIGITALIO = 1
+ CIRCUITPY_ANALOGIO = 0
+ CIRCUITPY_MICROCONTROLLER = 1
+ CIRCUITPY_BUSIO = 1
+ CIRCUITPY_PULSEIO = 0
+ CIRCUITPY_OS = 0
+ CIRCUITPY_STORAGE = 0
+ CIRCUITPY_RANDOM = 0
+ CIRCUITPY_USB_HID = 0
+ CIRCUITPY_USB_MIDI = 0
+ CIRCUITPY_NEOPIXEL_WRITE = 0
+ CIRCUITPY_DISPLAYIO = 0
+endif
diff --git a/ports/stm32f4/mphalport.c b/ports/stm/mphalport.c
index f78e9c750..3ee56e22a 100644
--- a/ports/stm32f4/mphalport.c
+++ b/ports/stm/mphalport.c
@@ -31,18 +31,14 @@
#include "py/mpstate.h"
#include "py/gc.h"
+#include "shared-bindings/microcontroller/__init__.h"
#include "supervisor/shared/tick.h"
-/*------------------------------------------------------------------*/
-/* delay
- *------------------------------------------------------------------*/
void mp_hal_delay_ms(mp_uint_t delay) {
uint64_t start_tick = supervisor_ticks_ms64();
uint64_t duration = 0;
while (duration < delay) {
- #ifdef MICROPY_VM_HOOK_LOOP
- MICROPY_VM_HOOK_LOOP
- #endif
+ RUN_BACKGROUND_TASKS;
// Check to see if we've been CTRL-Ced by autoreload or the user.
if(MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception)) ||
MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception))) {
@@ -52,3 +48,15 @@ void mp_hal_delay_ms(mp_uint_t delay) {
// TODO(tannewt): Go to sleep for a little while while we wait.
}
}
+
+void mp_hal_delay_us(mp_uint_t delay) {
+ common_hal_mcu_delay_us(delay);
+}
+
+void mp_hal_disable_all_interrupts(void) {
+ common_hal_mcu_disable_interrupts();
+}
+
+void mp_hal_enable_all_interrupts(void) {
+ common_hal_mcu_enable_interrupts();
+}
diff --git a/ports/stm/mphalport.h b/ports/stm/mphalport.h
new file mode 100644
index 000000000..69f2c489c
--- /dev/null
+++ b/ports/stm/mphalport.h
@@ -0,0 +1,51 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2015 Glenn Ruben Bakke
+ *
+ * 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_STM32_MPHALPORT_H
+#define MICROPY_INCLUDED_STM32_MPHALPORT_H
+
+#include "py/obj.h"
+
+#include "lib/oofatfs/ff.h"
+
+#include "supervisor/shared/tick.h"
+
+// Global millisecond tick count (driven by SysTick interrupt).
+static inline mp_uint_t mp_hal_ticks_ms(void) {
+ return supervisor_ticks_ms32();
+}
+// Number of bytes in receive buffer
+volatile uint8_t usb_rx_count;
+volatile bool mp_cdc_enabled;
+
+int receive_usb(void);
+
+void mp_hal_set_interrupt_char(int c);
+
+void mp_hal_disable_all_interrupts(void);
+void mp_hal_enable_all_interrupts(void);
+
+#endif // MICROPY_INCLUDED_STM32_MPHALPORT_H
diff --git a/ports/stm/packages/LQFP100_f4.c b/ports/stm/packages/LQFP100_f4.c
new file mode 100644
index 000000000..5bc0a5158
--- /dev/null
+++ b/ports/stm/packages/LQFP100_f4.c
@@ -0,0 +1,117 @@
+#include "shared-bindings/microcontroller/__init__.h"
+#include "common-hal/microcontroller/Pin.h"
+#include "py/obj.h"
+
+STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = {
+// Pins 1-25
+ { MP_ROM_QSTR(MP_QSTR_PE02), MP_ROM_PTR(&pin_PE02) },
+ { MP_ROM_QSTR(MP_QSTR_PE03), MP_ROM_PTR(&pin_PE03) },
+ { MP_ROM_QSTR(MP_QSTR_PE04), MP_ROM_PTR(&pin_PE04) },
+ { MP_ROM_QSTR(MP_QSTR_PE05), MP_ROM_PTR(&pin_PE05) },
+ { MP_ROM_QSTR(MP_QSTR_PE06), MP_ROM_PTR(&pin_PE06) },
+ /* VBAT -------------------------------------------*/
+ { MP_ROM_QSTR(MP_QSTR_PC13), MP_ROM_PTR(&pin_PC13) },
+ // PC14 OSC32_IN ----------------------------------*/
+ // PC15 OSC32_OUT ---------------------------------*/
+ // VSS --------------------------------------------*/
+ // VDD --------------------------------------------*/
+ // PH0 OSC_IN -------------------------------------*/
+ // PH1 OSC_OUT ------------------------------------*/
+ // NRST -------------------------------------------*/
+ { MP_ROM_QSTR(MP_QSTR_PC00), MP_ROM_PTR(&pin_PC00) },
+ { MP_ROM_QSTR(MP_QSTR_PC01), MP_ROM_PTR(&pin_PC01) },
+ { MP_ROM_QSTR(MP_QSTR_PC02), MP_ROM_PTR(&pin_PC02) },
+ { MP_ROM_QSTR(MP_QSTR_PC03), MP_ROM_PTR(&pin_PC03) },
+ // VDD --------------------------------------------*/
+ // VSSA -------------------------------------------*/
+ // VREF+ ------------------------------------------*/
+ // VDDA -------------------------------------------*/
+ { MP_ROM_QSTR(MP_QSTR_PA00), MP_ROM_PTR(&pin_PA00) },
+ { MP_ROM_QSTR(MP_QSTR_PA01), MP_ROM_PTR(&pin_PA01) },
+ { MP_ROM_QSTR(MP_QSTR_PA02), MP_ROM_PTR(&pin_PA02) },
+
+// Pins 26-50
+ { MP_ROM_QSTR(MP_QSTR_PA03), MP_ROM_PTR(&pin_PA03) },
+ // VSS --------------------------------------------*/
+ // VDD --------------------------------------------*/
+ { MP_ROM_QSTR(MP_QSTR_PA04), MP_ROM_PTR(&pin_PA04) },
+ { MP_ROM_QSTR(MP_QSTR_PA05), MP_ROM_PTR(&pin_PA05) },
+ { MP_ROM_QSTR(MP_QSTR_PA06), MP_ROM_PTR(&pin_PA06) },
+ { MP_ROM_QSTR(MP_QSTR_PA07), MP_ROM_PTR(&pin_PA07) },
+ { MP_ROM_QSTR(MP_QSTR_PC04), MP_ROM_PTR(&pin_PC04) },
+ { MP_ROM_QSTR(MP_QSTR_PC05), MP_ROM_PTR(&pin_PC05) },
+ { MP_ROM_QSTR(MP_QSTR_PB00), MP_ROM_PTR(&pin_PB00) },
+ { MP_ROM_QSTR(MP_QSTR_PB01), MP_ROM_PTR(&pin_PB01) },
+ { MP_ROM_QSTR(MP_QSTR_PB02), MP_ROM_PTR(&pin_PB02) },
+ { MP_ROM_QSTR(MP_QSTR_PE07), MP_ROM_PTR(&pin_PE07) },
+ { MP_ROM_QSTR(MP_QSTR_PE08), MP_ROM_PTR(&pin_PE08) },
+ { MP_ROM_QSTR(MP_QSTR_PE09), MP_ROM_PTR(&pin_PE09) },
+ { MP_ROM_QSTR(MP_QSTR_PE10), MP_ROM_PTR(&pin_PE10) },
+ { MP_ROM_QSTR(MP_QSTR_PE11), MP_ROM_PTR(&pin_PE11) },
+ { MP_ROM_QSTR(MP_QSTR_PE12), MP_ROM_PTR(&pin_PE12) },
+ { MP_ROM_QSTR(MP_QSTR_PE13), MP_ROM_PTR(&pin_PE13) },
+ { MP_ROM_QSTR(MP_QSTR_PE14), MP_ROM_PTR(&pin_PE14) },
+ { MP_ROM_QSTR(MP_QSTR_PE15), MP_ROM_PTR(&pin_PE15) },
+ { MP_ROM_QSTR(MP_QSTR_PB10), MP_ROM_PTR(&pin_PB10) },
+#if defined(STM32F405xx) || defined(STM32F412Zx) || defined(STM32F407xx) || defined(STM32F767xx)
+ { MP_ROM_QSTR(MP_QSTR_PB11), MP_ROM_PTR(&pin_PB11) },
+#endif //or VCAP1 -----------------------------------*/
+ // VCAP1 or VSS -----------------------------------*/
+ // VDD --------------------------------------------*/
+
+// Pins 51-75
+ { MP_ROM_QSTR(MP_QSTR_PB12), MP_ROM_PTR(&pin_PB12) },
+ { MP_ROM_QSTR(MP_QSTR_PB13), MP_ROM_PTR(&pin_PB13) },
+ { MP_ROM_QSTR(MP_QSTR_PB14), MP_ROM_PTR(&pin_PB14) },
+ { MP_ROM_QSTR(MP_QSTR_PB15), MP_ROM_PTR(&pin_PB15) },
+ { MP_ROM_QSTR(MP_QSTR_PD08), MP_ROM_PTR(&pin_PD08) },
+ { MP_ROM_QSTR(MP_QSTR_PD09), MP_ROM_PTR(&pin_PD09) },
+ { MP_ROM_QSTR(MP_QSTR_PD10), MP_ROM_PTR(&pin_PD10) },
+ { MP_ROM_QSTR(MP_QSTR_PD11), MP_ROM_PTR(&pin_PD11) },
+ { MP_ROM_QSTR(MP_QSTR_PD12), MP_ROM_PTR(&pin_PD12) },
+ { MP_ROM_QSTR(MP_QSTR_PD13), MP_ROM_PTR(&pin_PD13) },
+ { MP_ROM_QSTR(MP_QSTR_PD14), MP_ROM_PTR(&pin_PD14) },
+ { MP_ROM_QSTR(MP_QSTR_PD15), MP_ROM_PTR(&pin_PD15) },
+ { MP_ROM_QSTR(MP_QSTR_PC06), MP_ROM_PTR(&pin_PC06) },
+ { MP_ROM_QSTR(MP_QSTR_PC07), MP_ROM_PTR(&pin_PC07) },
+ { MP_ROM_QSTR(MP_QSTR_PC08), MP_ROM_PTR(&pin_PC08) },
+ { MP_ROM_QSTR(MP_QSTR_PC09), MP_ROM_PTR(&pin_PC09) },
+ { MP_ROM_QSTR(MP_QSTR_PA08), MP_ROM_PTR(&pin_PA08) },
+ { MP_ROM_QSTR(MP_QSTR_PA09), MP_ROM_PTR(&pin_PA09) },
+ { MP_ROM_QSTR(MP_QSTR_PA10), MP_ROM_PTR(&pin_PA10) },
+ { MP_ROM_QSTR(MP_QSTR_PA11), MP_ROM_PTR(&pin_PA11) },
+ { MP_ROM_QSTR(MP_QSTR_PA12), MP_ROM_PTR(&pin_PA12) },
+ { MP_ROM_QSTR(MP_QSTR_PA13), MP_ROM_PTR(&pin_PA13) },
+ // VCAP2 ------------------------------------------*/
+ // VSS --------------------------------------------*/
+ // VDD --------------------------------------------*/
+
+// Pins 76-100
+ { MP_ROM_QSTR(MP_QSTR_PA14), MP_ROM_PTR(&pin_PA14) },
+ { MP_ROM_QSTR(MP_QSTR_PA15), MP_ROM_PTR(&pin_PA15) },
+ { MP_ROM_QSTR(MP_QSTR_PC10), MP_ROM_PTR(&pin_PC10) },
+ { MP_ROM_QSTR(MP_QSTR_PC11), MP_ROM_PTR(&pin_PC11) },
+ { MP_ROM_QSTR(MP_QSTR_PC12), MP_ROM_PTR(&pin_PC12) },
+ { MP_ROM_QSTR(MP_QSTR_PD00), MP_ROM_PTR(&pin_PD00) },
+ { MP_ROM_QSTR(MP_QSTR_PD01), MP_ROM_PTR(&pin_PD01) },
+ { MP_ROM_QSTR(MP_QSTR_PD02), MP_ROM_PTR(&pin_PD02) },
+ { MP_ROM_QSTR(MP_QSTR_PD03), MP_ROM_PTR(&pin_PD03) },
+ { MP_ROM_QSTR(MP_QSTR_PD04), MP_ROM_PTR(&pin_PD04) },
+ { MP_ROM_QSTR(MP_QSTR_PD05), MP_ROM_PTR(&pin_PD05) },
+ { MP_ROM_QSTR(MP_QSTR_PD06), MP_ROM_PTR(&pin_PD06) },
+ { MP_ROM_QSTR(MP_QSTR_PD07), MP_ROM_PTR(&pin_PD07) },
+ { MP_ROM_QSTR(MP_QSTR_PB03), MP_ROM_PTR(&pin_PB03) },
+ { MP_ROM_QSTR(MP_QSTR_PB04), MP_ROM_PTR(&pin_PB04) },
+ { MP_ROM_QSTR(MP_QSTR_PB05), MP_ROM_PTR(&pin_PB05) },
+ { MP_ROM_QSTR(MP_QSTR_PB06), MP_ROM_PTR(&pin_PB06) },
+ { MP_ROM_QSTR(MP_QSTR_PB07), MP_ROM_PTR(&pin_PB07) },
+ // BOOT0 ------------------------------------------*/
+ { MP_ROM_QSTR(MP_QSTR_PB08), MP_ROM_PTR(&pin_PB08) },
+ { MP_ROM_QSTR(MP_QSTR_PB09), MP_ROM_PTR(&pin_PB09) },
+ { MP_ROM_QSTR(MP_QSTR_PE00), MP_ROM_PTR(&pin_PE00) },
+ { MP_ROM_QSTR(MP_QSTR_PE01), MP_ROM_PTR(&pin_PE01) },
+ // VSS --------------------------------------------*/
+ // VDD --------------------------------------------*/
+
+};
+MP_DEFINE_CONST_DICT(mcu_pin_globals, mcu_pin_globals_table); \ No newline at end of file
diff --git a/ports/stm/packages/LQFP100_x7.c b/ports/stm/packages/LQFP100_x7.c
new file mode 100644
index 000000000..23d89a826
--- /dev/null
+++ b/ports/stm/packages/LQFP100_x7.c
@@ -0,0 +1,115 @@
+#include "shared-bindings/microcontroller/__init__.h"
+#include "common-hal/microcontroller/Pin.h"
+#include "py/obj.h"
+
+STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = {
+// Pins 1-25
+ { MP_ROM_QSTR(MP_QSTR_PE02), MP_ROM_PTR(&pin_PE02) },
+ { MP_ROM_QSTR(MP_QSTR_PE03), MP_ROM_PTR(&pin_PE03) },
+ { MP_ROM_QSTR(MP_QSTR_PE04), MP_ROM_PTR(&pin_PE04) },
+ { MP_ROM_QSTR(MP_QSTR_PE05), MP_ROM_PTR(&pin_PE05) },
+ { MP_ROM_QSTR(MP_QSTR_PE06), MP_ROM_PTR(&pin_PE06) },
+ /* VBAT -------------------------------------------*/
+ { MP_ROM_QSTR(MP_QSTR_PC13), MP_ROM_PTR(&pin_PC13) },
+ // PC14 OSC32_IN ----------------------------------*/
+ // PC15 OSC32_OUT ---------------------------------*/
+ // VSS --------------------------------------------*/
+ // VDD --------------------------------------------*/
+ // PH0 OSC_IN -------------------------------------*/
+ // PH1 OSC_OUT ------------------------------------*/
+ // NRST -------------------------------------------*/
+ { MP_ROM_QSTR(MP_QSTR_PC00), MP_ROM_PTR(&pin_PC00) },
+ { MP_ROM_QSTR(MP_QSTR_PC01), MP_ROM_PTR(&pin_PC01) },
+ { MP_ROM_QSTR(MP_QSTR_PC02), MP_ROM_PTR(&pin_PC02) },
+ { MP_ROM_QSTR(MP_QSTR_PC03), MP_ROM_PTR(&pin_PC03) },
+ // VSSA -------------------------------------------*/
+ // VREF+ ------------------------------------------*/
+ // VDDA -------------------------------------------*/
+ { MP_ROM_QSTR(MP_QSTR_PA00), MP_ROM_PTR(&pin_PA00) },
+ { MP_ROM_QSTR(MP_QSTR_PA01), MP_ROM_PTR(&pin_PA01) },
+ { MP_ROM_QSTR(MP_QSTR_PA02), MP_ROM_PTR(&pin_PA02) },
+ { MP_ROM_QSTR(MP_QSTR_PA03), MP_ROM_PTR(&pin_PA03) },
+
+// Pins 26-50
+ // VSS --------------------------------------------*/
+ // VDD --------------------------------------------*/
+ { MP_ROM_QSTR(MP_QSTR_PA04), MP_ROM_PTR(&pin_PA04) },
+ { MP_ROM_QSTR(MP_QSTR_PA05), MP_ROM_PTR(&pin_PA05) },
+ { MP_ROM_QSTR(MP_QSTR_PA06), MP_ROM_PTR(&pin_PA06) },
+ { MP_ROM_QSTR(MP_QSTR_PA07), MP_ROM_PTR(&pin_PA07) },
+ { MP_ROM_QSTR(MP_QSTR_PC04), MP_ROM_PTR(&pin_PC04) },
+ { MP_ROM_QSTR(MP_QSTR_PC05), MP_ROM_PTR(&pin_PC05) },
+ { MP_ROM_QSTR(MP_QSTR_PB00), MP_ROM_PTR(&pin_PB00) },
+ { MP_ROM_QSTR(MP_QSTR_PB01), MP_ROM_PTR(&pin_PB01) },
+ { MP_ROM_QSTR(MP_QSTR_PB02), MP_ROM_PTR(&pin_PB02) },
+ { MP_ROM_QSTR(MP_QSTR_PE07), MP_ROM_PTR(&pin_PE07) },
+ { MP_ROM_QSTR(MP_QSTR_PE08), MP_ROM_PTR(&pin_PE08) },
+ { MP_ROM_QSTR(MP_QSTR_PE09), MP_ROM_PTR(&pin_PE09) },
+ { MP_ROM_QSTR(MP_QSTR_PE10), MP_ROM_PTR(&pin_PE10) },
+ { MP_ROM_QSTR(MP_QSTR_PE11), MP_ROM_PTR(&pin_PE11) },
+ { MP_ROM_QSTR(MP_QSTR_PE12), MP_ROM_PTR(&pin_PE12) },
+ { MP_ROM_QSTR(MP_QSTR_PE13), MP_ROM_PTR(&pin_PE13) },
+ { MP_ROM_QSTR(MP_QSTR_PE14), MP_ROM_PTR(&pin_PE14) },
+ { MP_ROM_QSTR(MP_QSTR_PE15), MP_ROM_PTR(&pin_PE15) },
+ { MP_ROM_QSTR(MP_QSTR_PB10), MP_ROM_PTR(&pin_PB10) },
+ { MP_ROM_QSTR(MP_QSTR_PB11), MP_ROM_PTR(&pin_PB11) },
+ // VCAP1 ------------------------------------------*/
+ // VSS --------------------------------------------*/
+ // VDD --------------------------------------------*/
+
+// Pins 51-75
+ { MP_ROM_QSTR(MP_QSTR_PB12), MP_ROM_PTR(&pin_PB12) },
+ { MP_ROM_QSTR(MP_QSTR_PB13), MP_ROM_PTR(&pin_PB13) },
+ { MP_ROM_QSTR(MP_QSTR_PB14), MP_ROM_PTR(&pin_PB14) },
+ { MP_ROM_QSTR(MP_QSTR_PB15), MP_ROM_PTR(&pin_PB15) },
+ { MP_ROM_QSTR(MP_QSTR_PD08), MP_ROM_PTR(&pin_PD08) },
+ { MP_ROM_QSTR(MP_QSTR_PD09), MP_ROM_PTR(&pin_PD09) },
+ { MP_ROM_QSTR(MP_QSTR_PD10), MP_ROM_PTR(&pin_PD10) },
+ { MP_ROM_QSTR(MP_QSTR_PD11), MP_ROM_PTR(&pin_PD11) },
+ { MP_ROM_QSTR(MP_QSTR_PD12), MP_ROM_PTR(&pin_PD12) },
+ { MP_ROM_QSTR(MP_QSTR_PD13), MP_ROM_PTR(&pin_PD13) },
+ { MP_ROM_QSTR(MP_QSTR_PD14), MP_ROM_PTR(&pin_PD14) },
+ { MP_ROM_QSTR(MP_QSTR_PD15), MP_ROM_PTR(&pin_PD15) },
+ { MP_ROM_QSTR(MP_QSTR_PC06), MP_ROM_PTR(&pin_PC06) },
+ { MP_ROM_QSTR(MP_QSTR_PC07), MP_ROM_PTR(&pin_PC07) },
+ { MP_ROM_QSTR(MP_QSTR_PC08), MP_ROM_PTR(&pin_PC08) },
+ { MP_ROM_QSTR(MP_QSTR_PC09), MP_ROM_PTR(&pin_PC09) },
+ { MP_ROM_QSTR(MP_QSTR_PA08), MP_ROM_PTR(&pin_PA08) },
+ { MP_ROM_QSTR(MP_QSTR_PA09), MP_ROM_PTR(&pin_PA09) },
+ { MP_ROM_QSTR(MP_QSTR_PA10), MP_ROM_PTR(&pin_PA10) },
+ { MP_ROM_QSTR(MP_QSTR_PA11), MP_ROM_PTR(&pin_PA11) },
+ { MP_ROM_QSTR(MP_QSTR_PA12), MP_ROM_PTR(&pin_PA12) },
+ { MP_ROM_QSTR(MP_QSTR_PA13), MP_ROM_PTR(&pin_PA13) },
+ // VCAP2 ------------------------------------------*/
+ // VSS --------------------------------------------*/
+ // VDD --------------------------------------------*/
+
+// Pins 76-100
+ { MP_ROM_QSTR(MP_QSTR_PA14), MP_ROM_PTR(&pin_PA14) },
+ { MP_ROM_QSTR(MP_QSTR_PA15), MP_ROM_PTR(&pin_PA15) },
+ { MP_ROM_QSTR(MP_QSTR_PC10), MP_ROM_PTR(&pin_PC10) },
+ { MP_ROM_QSTR(MP_QSTR_PC11), MP_ROM_PTR(&pin_PC11) },
+ { MP_ROM_QSTR(MP_QSTR_PC12), MP_ROM_PTR(&pin_PC12) },
+ { MP_ROM_QSTR(MP_QSTR_PD00), MP_ROM_PTR(&pin_PD00) },
+ { MP_ROM_QSTR(MP_QSTR_PD01), MP_ROM_PTR(&pin_PD01) },
+ { MP_ROM_QSTR(MP_QSTR_PD02), MP_ROM_PTR(&pin_PD02) },
+ { MP_ROM_QSTR(MP_QSTR_PD03), MP_ROM_PTR(&pin_PD03) },
+ { MP_ROM_QSTR(MP_QSTR_PD04), MP_ROM_PTR(&pin_PD04) },
+ { MP_ROM_QSTR(MP_QSTR_PD05), MP_ROM_PTR(&pin_PD05) },
+ { MP_ROM_QSTR(MP_QSTR_PD06), MP_ROM_PTR(&pin_PD06) },
+ { MP_ROM_QSTR(MP_QSTR_PD07), MP_ROM_PTR(&pin_PD07) },
+ { MP_ROM_QSTR(MP_QSTR_PB03), MP_ROM_PTR(&pin_PB03) },
+ { MP_ROM_QSTR(MP_QSTR_PB04), MP_ROM_PTR(&pin_PB04) },
+ { MP_ROM_QSTR(MP_QSTR_PB05), MP_ROM_PTR(&pin_PB05) },
+ { MP_ROM_QSTR(MP_QSTR_PB06), MP_ROM_PTR(&pin_PB06) },
+ { MP_ROM_QSTR(MP_QSTR_PB07), MP_ROM_PTR(&pin_PB07) },
+ // BOOT0 ------------------------------------------*/
+ { MP_ROM_QSTR(MP_QSTR_PB08), MP_ROM_PTR(&pin_PB08) },
+ { MP_ROM_QSTR(MP_QSTR_PB09), MP_ROM_PTR(&pin_PB09) },
+ { MP_ROM_QSTR(MP_QSTR_PE00), MP_ROM_PTR(&pin_PE00) },
+ { MP_ROM_QSTR(MP_QSTR_PE01), MP_ROM_PTR(&pin_PE01) },
+ // VSS --------------------------------------------*/
+ // VDD --------------------------------------------*/
+
+};
+MP_DEFINE_CONST_DICT(mcu_pin_globals, mcu_pin_globals_table); \ No newline at end of file
diff --git a/ports/stm32f4/common-hal/microcontroller/__init__.c b/ports/stm/packages/LQFP144.c
index 0c680eb05..36683bb64 100644
--- a/ports/stm32f4/common-hal/microcontroller/__init__.c
+++ b/ports/stm/packages/LQFP144.c
@@ -1,144 +1,50 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2016 Scott Shawcroft for Adafruit Industries
- * Copyright (c) 2019 Lucian Copeland 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 "py/mphal.h"
-#include "py/obj.h"
-#include "py/runtime.h"
-
-#include "common-hal/microcontroller/Pin.h"
-#include "common-hal/microcontroller/Processor.h"
-
#include "shared-bindings/microcontroller/__init__.h"
-#include "shared-bindings/microcontroller/Pin.h"
-#include "shared-bindings/microcontroller/Processor.h"
-
-#include "supervisor/filesystem.h"
-#include "supervisor/shared/safe_mode.h"
-
-#include "stm32f4xx_hal.h"
-
-//tested divisor value for busy loop in us delay
-#define LOOP_TICKS 12
-
-STATIC uint32_t get_us(void) {
- uint32_t ticks_per_us = HAL_RCC_GetSysClockFreq()/1000000;
- uint32_t micros, sys_cycles;
- do {
- micros = supervisor_ticks_ms32();
- sys_cycles = SysTick->VAL; //counts backwards
- } while (micros != supervisor_ticks_ms32()); //try again if ticks_ms rolled over
- return (micros * 1000) + (ticks_per_us * 1000 - sys_cycles) / ticks_per_us;
-}
-
-void common_hal_mcu_delay_us(uint32_t delay) {
- if (__get_PRIMASK() == 0x00000000) {
- //by default use ticks_ms
- uint32_t start = get_us();
- while (get_us()-start < delay) {
- __asm__ __volatile__("nop");
- }
- } else {
- //when SysTick is disabled, approximate with busy loop
- const uint32_t ucount = HAL_RCC_GetSysClockFreq() / 1000000 * delay / LOOP_TICKS;
- for (uint32_t count = 0; ++count <= ucount;) {
- }
- }
-}
-
-volatile uint32_t nesting_count = 0;
-
-void common_hal_mcu_disable_interrupts(void) {
- __disable_irq();
- __DMB();
- nesting_count++;
-}
-
-void common_hal_mcu_enable_interrupts(void) {
- if (nesting_count == 0) {
- // This is very very bad because it means there was mismatched disable/enables so we
- // "HardFault".
- asm("bkpt");
- }
- nesting_count--;
- if (nesting_count > 0) {
- return;
- }
- __DMB();
- __enable_irq();
-}
-
-void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) {
- if(runmode == RUNMODE_SAFE_MODE)
- safe_mode_on_next_reset(PROGRAMMATIC_SAFE_MODE);
-}
-
-void common_hal_mcu_reset(void) {
- filesystem_flush(); //TODO: implement as part of flash improvements
- NVIC_SystemReset();
-}
-
-// The singleton microcontroller.Processor object, bound to microcontroller.cpu
-// It currently only has properties, and no state.
-const mcu_processor_obj_t common_hal_mcu_processor_obj = {
- .base = {
- .type = &mcu_processor_type,
- },
-};
+#include "common-hal/microcontroller/Pin.h"
+#include "py/obj.h"
STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = {
-#if MCU_PACKAGE >= 100
+// Pins 1-36
{ MP_ROM_QSTR(MP_QSTR_PE02), MP_ROM_PTR(&pin_PE02) },
{ MP_ROM_QSTR(MP_QSTR_PE03), MP_ROM_PTR(&pin_PE03) },
{ MP_ROM_QSTR(MP_QSTR_PE04), MP_ROM_PTR(&pin_PE04) },
{ MP_ROM_QSTR(MP_QSTR_PE05), MP_ROM_PTR(&pin_PE05) },
{ MP_ROM_QSTR(MP_QSTR_PE06), MP_ROM_PTR(&pin_PE06) },
-#endif
+ /* VBAT -------------------------------------------*/
{ MP_ROM_QSTR(MP_QSTR_PC13), MP_ROM_PTR(&pin_PC13) },
-#if MCU_PACKAGE == 144
+ // PC14 OSC32_IN ----------------------------------*/
+ // PC15 OSC32_OUT ---------------------------------*/
{ MP_ROM_QSTR(MP_QSTR_PF00), MP_ROM_PTR(&pin_PF00) },
{ MP_ROM_QSTR(MP_QSTR_PF01), MP_ROM_PTR(&pin_PF01) },
{ MP_ROM_QSTR(MP_QSTR_PF02), MP_ROM_PTR(&pin_PF02) },
{ MP_ROM_QSTR(MP_QSTR_PF03), MP_ROM_PTR(&pin_PF03) },
{ MP_ROM_QSTR(MP_QSTR_PF04), MP_ROM_PTR(&pin_PF04) },
{ MP_ROM_QSTR(MP_QSTR_PF05), MP_ROM_PTR(&pin_PF05) },
+ // VSS --------------------------------------------*/
+ // VDD --------------------------------------------*/
{ MP_ROM_QSTR(MP_QSTR_PF06), MP_ROM_PTR(&pin_PF06) },
{ MP_ROM_QSTR(MP_QSTR_PF07), MP_ROM_PTR(&pin_PF07) },
{ MP_ROM_QSTR(MP_QSTR_PF08), MP_ROM_PTR(&pin_PF08) },
{ MP_ROM_QSTR(MP_QSTR_PF09), MP_ROM_PTR(&pin_PF09) },
{ MP_ROM_QSTR(MP_QSTR_PF10), MP_ROM_PTR(&pin_PF10) },
-#endif
+ // PH0 OSC_IN -------------------------------------*/
+ // PH1 OSC_OUT ------------------------------------*/
+ // NRST -------------------------------------------*/
{ MP_ROM_QSTR(MP_QSTR_PC00), MP_ROM_PTR(&pin_PC00) },
{ MP_ROM_QSTR(MP_QSTR_PC01), MP_ROM_PTR(&pin_PC01) },
{ MP_ROM_QSTR(MP_QSTR_PC02), MP_ROM_PTR(&pin_PC02) },
{ MP_ROM_QSTR(MP_QSTR_PC03), MP_ROM_PTR(&pin_PC03) },
+ // VDD --------------------------------------------*/
+ // VSSA -------------------------------------------*/
+ // VREF+ ------------------------------------------*/
+ // VDDA -------------------------------------------*/
{ MP_ROM_QSTR(MP_QSTR_PA00), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_PA01), MP_ROM_PTR(&pin_PA01) },
{ MP_ROM_QSTR(MP_QSTR_PA02), MP_ROM_PTR(&pin_PA02) },
+
+// Pins 37-72
{ MP_ROM_QSTR(MP_QSTR_PA03), MP_ROM_PTR(&pin_PA03) },
+ // VSS --------------------------------------------*/
+ // VDD --------------------------------------------*/
{ MP_ROM_QSTR(MP_QSTR_PA04), MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_PA05), MP_ROM_PTR(&pin_PA05) },
{ MP_ROM_QSTR(MP_QSTR_PA06), MP_ROM_PTR(&pin_PA06) },
@@ -148,45 +54,46 @@ STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_PB00), MP_ROM_PTR(&pin_PB00) },
{ MP_ROM_QSTR(MP_QSTR_PB01), MP_ROM_PTR(&pin_PB01) },
{ MP_ROM_QSTR(MP_QSTR_PB02), MP_ROM_PTR(&pin_PB02) },
-#if MCU_PACKAGE == 144
{ MP_ROM_QSTR(MP_QSTR_PF11), MP_ROM_PTR(&pin_PF11) },
{ MP_ROM_QSTR(MP_QSTR_PF12), MP_ROM_PTR(&pin_PF12) },
+ // VSS --------------------------------------------*/
+ // VDD --------------------------------------------*/
{ MP_ROM_QSTR(MP_QSTR_PF13), MP_ROM_PTR(&pin_PF13) },
{ MP_ROM_QSTR(MP_QSTR_PF14), MP_ROM_PTR(&pin_PF14) },
{ MP_ROM_QSTR(MP_QSTR_PF15), MP_ROM_PTR(&pin_PF15) },
{ MP_ROM_QSTR(MP_QSTR_PG00), MP_ROM_PTR(&pin_PG00) },
{ MP_ROM_QSTR(MP_QSTR_PG01), MP_ROM_PTR(&pin_PG01) },
-#endif
-#if MCU_PACKAGE >= 100
{ MP_ROM_QSTR(MP_QSTR_PE07), MP_ROM_PTR(&pin_PE07) },
{ MP_ROM_QSTR(MP_QSTR_PE08), MP_ROM_PTR(&pin_PE08) },
{ MP_ROM_QSTR(MP_QSTR_PE09), MP_ROM_PTR(&pin_PE09) },
+ // VSS --------------------------------------------*/
+ // VDD --------------------------------------------*/
{ MP_ROM_QSTR(MP_QSTR_PE10), MP_ROM_PTR(&pin_PE10) },
{ MP_ROM_QSTR(MP_QSTR_PE11), MP_ROM_PTR(&pin_PE11) },
{ MP_ROM_QSTR(MP_QSTR_PE12), MP_ROM_PTR(&pin_PE12) },
{ MP_ROM_QSTR(MP_QSTR_PE13), MP_ROM_PTR(&pin_PE13) },
{ MP_ROM_QSTR(MP_QSTR_PE14), MP_ROM_PTR(&pin_PE14) },
{ MP_ROM_QSTR(MP_QSTR_PE15), MP_ROM_PTR(&pin_PE15) },
-#endif
{ MP_ROM_QSTR(MP_QSTR_PB10), MP_ROM_PTR(&pin_PB10) },
-#if MCU_PACKAGE == 144 || defined STM32F405xx
{ MP_ROM_QSTR(MP_QSTR_PB11), MP_ROM_PTR(&pin_PB11) },
-#endif
+ // VCAP1 ------------------------------------------*/
+ // VDD --------------------------------------------*/
+
+// Pins 73-108
{ MP_ROM_QSTR(MP_QSTR_PB12), MP_ROM_PTR(&pin_PB12) },
{ MP_ROM_QSTR(MP_QSTR_PB13), MP_ROM_PTR(&pin_PB13) },
{ MP_ROM_QSTR(MP_QSTR_PB14), MP_ROM_PTR(&pin_PB14) },
{ MP_ROM_QSTR(MP_QSTR_PB15), MP_ROM_PTR(&pin_PB15) },
-#if MCU_PACKAGE >= 100
{ MP_ROM_QSTR(MP_QSTR_PD08), MP_ROM_PTR(&pin_PD08) },
{ MP_ROM_QSTR(MP_QSTR_PD09), MP_ROM_PTR(&pin_PD09) },
{ MP_ROM_QSTR(MP_QSTR_PD10), MP_ROM_PTR(&pin_PD10) },
{ MP_ROM_QSTR(MP_QSTR_PD11), MP_ROM_PTR(&pin_PD11) },
{ MP_ROM_QSTR(MP_QSTR_PD12), MP_ROM_PTR(&pin_PD12) },
{ MP_ROM_QSTR(MP_QSTR_PD13), MP_ROM_PTR(&pin_PD13) },
+ // VSS --------------------------------------------*/
+ // VDD --------------------------------------------*/
{ MP_ROM_QSTR(MP_QSTR_PD14), MP_ROM_PTR(&pin_PD14) },
{ MP_ROM_QSTR(MP_QSTR_PD15), MP_ROM_PTR(&pin_PD15) },
-#endif
-#if MCU_PACKAGE == 144
{ MP_ROM_QSTR(MP_QSTR_PG02), MP_ROM_PTR(&pin_PG02) },
{ MP_ROM_QSTR(MP_QSTR_PG03), MP_ROM_PTR(&pin_PG03) },
{ MP_ROM_QSTR(MP_QSTR_PG04), MP_ROM_PTR(&pin_PG04) },
@@ -194,7 +101,8 @@ STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_PG06), MP_ROM_PTR(&pin_PG06) },
{ MP_ROM_QSTR(MP_QSTR_PG07), MP_ROM_PTR(&pin_PG07) },
{ MP_ROM_QSTR(MP_QSTR_PG08), MP_ROM_PTR(&pin_PG08) },
-#endif
+ // VSS --------------------------------------------*/
+ // VDD or VDD_USB (F412, F446) --------------------*/
{ MP_ROM_QSTR(MP_QSTR_PC06), MP_ROM_PTR(&pin_PC06) },
{ MP_ROM_QSTR(MP_QSTR_PC07), MP_ROM_PTR(&pin_PC07) },
{ MP_ROM_QSTR(MP_QSTR_PC08), MP_ROM_PTR(&pin_PC08) },
@@ -205,40 +113,47 @@ STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_PA11), MP_ROM_PTR(&pin_PA11) },
{ MP_ROM_QSTR(MP_QSTR_PA12), MP_ROM_PTR(&pin_PA12) },
{ MP_ROM_QSTR(MP_QSTR_PA13), MP_ROM_PTR(&pin_PA13) },
+ // VCAP2 ------------------------------------------*/
+ // VSS --------------------------------------------*/
+ // VDD --------------------------------------------*/
+
+// Pins 109-144
{ MP_ROM_QSTR(MP_QSTR_PA14), MP_ROM_PTR(&pin_PA14) },
{ MP_ROM_QSTR(MP_QSTR_PA15), MP_ROM_PTR(&pin_PA15) },
{ MP_ROM_QSTR(MP_QSTR_PC10), MP_ROM_PTR(&pin_PC10) },
{ MP_ROM_QSTR(MP_QSTR_PC11), MP_ROM_PTR(&pin_PC11) },
{ MP_ROM_QSTR(MP_QSTR_PC12), MP_ROM_PTR(&pin_PC12) },
-#if MCU_PACKAGE >= 100
{ MP_ROM_QSTR(MP_QSTR_PD00), MP_ROM_PTR(&pin_PD00) },
{ MP_ROM_QSTR(MP_QSTR_PD01), MP_ROM_PTR(&pin_PD01) },
{ MP_ROM_QSTR(MP_QSTR_PD02), MP_ROM_PTR(&pin_PD02) },
{ MP_ROM_QSTR(MP_QSTR_PD03), MP_ROM_PTR(&pin_PD03) },
{ MP_ROM_QSTR(MP_QSTR_PD04), MP_ROM_PTR(&pin_PD04) },
{ MP_ROM_QSTR(MP_QSTR_PD05), MP_ROM_PTR(&pin_PD05) },
+ // VSS --------------------------------------------*/
+ // VDD --------------------------------------------*/
{ MP_ROM_QSTR(MP_QSTR_PD06), MP_ROM_PTR(&pin_PD06) },
{ MP_ROM_QSTR(MP_QSTR_PD07), MP_ROM_PTR(&pin_PD07) },
-#endif
-#if MCU_PACKAGE == 144
{ MP_ROM_QSTR(MP_QSTR_PG09), MP_ROM_PTR(&pin_PG09) },
{ MP_ROM_QSTR(MP_QSTR_PG10), MP_ROM_PTR(&pin_PG10) },
{ MP_ROM_QSTR(MP_QSTR_PG11), MP_ROM_PTR(&pin_PG11) },
{ MP_ROM_QSTR(MP_QSTR_PG12), MP_ROM_PTR(&pin_PG12) },
{ MP_ROM_QSTR(MP_QSTR_PG13), MP_ROM_PTR(&pin_PG13) },
{ MP_ROM_QSTR(MP_QSTR_PG14), MP_ROM_PTR(&pin_PG14) },
+ // VSS --------------------------------------------*/
+ // VDD --------------------------------------------*/
{ MP_ROM_QSTR(MP_QSTR_PG15), MP_ROM_PTR(&pin_PG15) },
-#endif
{ MP_ROM_QSTR(MP_QSTR_PB03), MP_ROM_PTR(&pin_PB03) },
{ MP_ROM_QSTR(MP_QSTR_PB04), MP_ROM_PTR(&pin_PB04) },
{ MP_ROM_QSTR(MP_QSTR_PB05), MP_ROM_PTR(&pin_PB05) },
{ MP_ROM_QSTR(MP_QSTR_PB06), MP_ROM_PTR(&pin_PB06) },
{ MP_ROM_QSTR(MP_QSTR_PB07), MP_ROM_PTR(&pin_PB07) },
+ // BOOT0 ------------------------------------------*/
{ MP_ROM_QSTR(MP_QSTR_PB08), MP_ROM_PTR(&pin_PB08) },
{ MP_ROM_QSTR(MP_QSTR_PB09), MP_ROM_PTR(&pin_PB09) },
-#if MCU_PACKAGE >= 100
{ MP_ROM_QSTR(MP_QSTR_PE00), MP_ROM_PTR(&pin_PE00) },
{ MP_ROM_QSTR(MP_QSTR_PE01), MP_ROM_PTR(&pin_PE01) },
-#endif
+ // PDR_ON -----------------------------------------*/
+ // VDD --------------------------------------------*/
+
};
-MP_DEFINE_CONST_DICT(mcu_pin_globals, mcu_pin_globals_table);
+MP_DEFINE_CONST_DICT(mcu_pin_globals, mcu_pin_globals_table); \ No newline at end of file
diff --git a/ports/stm/packages/LQFP64.c b/ports/stm/packages/LQFP64.c
new file mode 100644
index 000000000..e6a492bc3
--- /dev/null
+++ b/ports/stm/packages/LQFP64.c
@@ -0,0 +1,81 @@
+#include "shared-bindings/microcontroller/__init__.h"
+#include "common-hal/microcontroller/Pin.h"
+#include "py/obj.h"
+
+STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = {
+// Pins 1-16
+ /* VBAT -------------------------------------------*/
+ { MP_ROM_QSTR(MP_QSTR_PC13), MP_ROM_PTR(&pin_PC13) },
+ // PC14 OSC32_IN ----------------------------------*/
+ // PC15 OSC32_OUT ---------------------------------*/
+ // PH0 OSC_IN -------------------------------------*/
+ // PH1 OSC_OUT ------------------------------------*/
+ // NRST -------------------------------------------*/
+ { MP_ROM_QSTR(MP_QSTR_PC00), MP_ROM_PTR(&pin_PC00) },
+ { MP_ROM_QSTR(MP_QSTR_PC01), MP_ROM_PTR(&pin_PC01) },
+ { MP_ROM_QSTR(MP_QSTR_PC02), MP_ROM_PTR(&pin_PC02) },
+ { MP_ROM_QSTR(MP_QSTR_PC03), MP_ROM_PTR(&pin_PC03) },
+ // VSSA -------------------------------------------*/
+ // VDDA -------------------------------------------*/
+ { MP_ROM_QSTR(MP_QSTR_PA00), MP_ROM_PTR(&pin_PA00) },
+ { MP_ROM_QSTR(MP_QSTR_PA01), MP_ROM_PTR(&pin_PA01) },
+ { MP_ROM_QSTR(MP_QSTR_PA02), MP_ROM_PTR(&pin_PA02) },
+
+// Pins 17-32
+ { MP_ROM_QSTR(MP_QSTR_PA03), MP_ROM_PTR(&pin_PA03) },
+ // VSS --------------------------------------------*/
+ // VDD --------------------------------------------*/
+ { MP_ROM_QSTR(MP_QSTR_PA04), MP_ROM_PTR(&pin_PA04) },
+ { MP_ROM_QSTR(MP_QSTR_PA05), MP_ROM_PTR(&pin_PA05) },
+ { MP_ROM_QSTR(MP_QSTR_PA06), MP_ROM_PTR(&pin_PA06) },
+ { MP_ROM_QSTR(MP_QSTR_PA07), MP_ROM_PTR(&pin_PA07) },
+ { MP_ROM_QSTR(MP_QSTR_PC04), MP_ROM_PTR(&pin_PC04) },
+ { MP_ROM_QSTR(MP_QSTR_PC05), MP_ROM_PTR(&pin_PC05) },
+ { MP_ROM_QSTR(MP_QSTR_PB00), MP_ROM_PTR(&pin_PB00) },
+ { MP_ROM_QSTR(MP_QSTR_PB01), MP_ROM_PTR(&pin_PB01) },
+ { MP_ROM_QSTR(MP_QSTR_PB02), MP_ROM_PTR(&pin_PB02) },
+ { MP_ROM_QSTR(MP_QSTR_PB10), MP_ROM_PTR(&pin_PB10) },
+#if defined(STM32F405xx) || defined(STM32F412Zx) || defined(STM32F407xx) || defined(STM32F767xx)
+ { MP_ROM_QSTR(MP_QSTR_PB11), MP_ROM_PTR(&pin_PB11) },
+#endif //or VCAP1 -----------------------------------*/
+ // VCAP1 or VSS -----------------------------------*/
+ // VDD --------------------------------------------*/
+
+// Pins 33-48
+ { MP_ROM_QSTR(MP_QSTR_PB12), MP_ROM_PTR(&pin_PB12) },
+ { MP_ROM_QSTR(MP_QSTR_PB13), MP_ROM_PTR(&pin_PB13) },
+ { MP_ROM_QSTR(MP_QSTR_PB14), MP_ROM_PTR(&pin_PB14) },
+ { MP_ROM_QSTR(MP_QSTR_PB15), MP_ROM_PTR(&pin_PB15) },
+ { MP_ROM_QSTR(MP_QSTR_PC06), MP_ROM_PTR(&pin_PC06) },
+ { MP_ROM_QSTR(MP_QSTR_PC07), MP_ROM_PTR(&pin_PC07) },
+ { MP_ROM_QSTR(MP_QSTR_PC08), MP_ROM_PTR(&pin_PC08) },
+ { MP_ROM_QSTR(MP_QSTR_PC09), MP_ROM_PTR(&pin_PC09) },
+ { MP_ROM_QSTR(MP_QSTR_PA08), MP_ROM_PTR(&pin_PA08) },
+ { MP_ROM_QSTR(MP_QSTR_PA09), MP_ROM_PTR(&pin_PA09) },
+ { MP_ROM_QSTR(MP_QSTR_PA10), MP_ROM_PTR(&pin_PA10) },
+ { MP_ROM_QSTR(MP_QSTR_PA11), MP_ROM_PTR(&pin_PA11) },
+ { MP_ROM_QSTR(MP_QSTR_PA12), MP_ROM_PTR(&pin_PA12) },
+ { MP_ROM_QSTR(MP_QSTR_PA13), MP_ROM_PTR(&pin_PA13) },
+ // VSS or VCAP (F405) -----------------------------*/
+ // VDD --------------------------------------------*/
+
+// Pins 49-64
+ { MP_ROM_QSTR(MP_QSTR_PA14), MP_ROM_PTR(&pin_PA14) },
+ { MP_ROM_QSTR(MP_QSTR_PA15), MP_ROM_PTR(&pin_PA15) },
+ { MP_ROM_QSTR(MP_QSTR_PC10), MP_ROM_PTR(&pin_PC10) },
+ { MP_ROM_QSTR(MP_QSTR_PC11), MP_ROM_PTR(&pin_PC11) },
+ { MP_ROM_QSTR(MP_QSTR_PC12), MP_ROM_PTR(&pin_PC12) },
+ { MP_ROM_QSTR(MP_QSTR_PD02), MP_ROM_PTR(&pin_PD02) },
+ { MP_ROM_QSTR(MP_QSTR_PB03), MP_ROM_PTR(&pin_PB03) },
+ { MP_ROM_QSTR(MP_QSTR_PB04), MP_ROM_PTR(&pin_PB04) },
+ { MP_ROM_QSTR(MP_QSTR_PB05), MP_ROM_PTR(&pin_PB05) },
+ { MP_ROM_QSTR(MP_QSTR_PB06), MP_ROM_PTR(&pin_PB06) },
+ { MP_ROM_QSTR(MP_QSTR_PB07), MP_ROM_PTR(&pin_PB07) },
+ // BOOT0 ------------------------------------------*/
+ { MP_ROM_QSTR(MP_QSTR_PB08), MP_ROM_PTR(&pin_PB08) },
+ { MP_ROM_QSTR(MP_QSTR_PB09), MP_ROM_PTR(&pin_PB09) },
+ // VSS --------------------------------------------*/
+ // VDD --------------------------------------------*/
+
+};
+MP_DEFINE_CONST_DICT(mcu_pin_globals, mcu_pin_globals_table);
diff --git a/ports/stm/packages/UFQFPN48.c b/ports/stm/packages/UFQFPN48.c
new file mode 100644
index 000000000..ae4bcf6cd
--- /dev/null
+++ b/ports/stm/packages/UFQFPN48.c
@@ -0,0 +1,63 @@
+#include "shared-bindings/microcontroller/__init__.h"
+#include "common-hal/microcontroller/Pin.h"
+#include "py/obj.h"
+
+STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = {
+// Pins 1-12
+ /* VBAT -------------------------------------------*/
+ { MP_ROM_QSTR(MP_QSTR_PC13), MP_ROM_PTR(&pin_PC13) },
+ // PC14 OSC32_IN ----------------------------------*/
+ // PC15 OSC32_OUT ---------------------------------*/
+ // PH0 OSC_IN -------------------------------------*/
+ // PH1 OSC_OUT ------------------------------------*/
+ // NRST -------------------------------------------*/
+ // VSSA -------------------------------------------*/
+ // VDDA -------------------------------------------*/
+ { MP_ROM_QSTR(MP_QSTR_PA00), MP_ROM_PTR(&pin_PA00) },
+ { MP_ROM_QSTR(MP_QSTR_PA01), MP_ROM_PTR(&pin_PA01) },
+ { MP_ROM_QSTR(MP_QSTR_PA02), MP_ROM_PTR(&pin_PA02) },
+
+// Pins 13-24
+ { MP_ROM_QSTR(MP_QSTR_PA03), MP_ROM_PTR(&pin_PA03) },
+ { MP_ROM_QSTR(MP_QSTR_PA04), MP_ROM_PTR(&pin_PA04) },
+ { MP_ROM_QSTR(MP_QSTR_PA05), MP_ROM_PTR(&pin_PA05) },
+ { MP_ROM_QSTR(MP_QSTR_PA06), MP_ROM_PTR(&pin_PA06) },
+ { MP_ROM_QSTR(MP_QSTR_PA07), MP_ROM_PTR(&pin_PA07) },
+ { MP_ROM_QSTR(MP_QSTR_PB00), MP_ROM_PTR(&pin_PB00) },
+ { MP_ROM_QSTR(MP_QSTR_PB01), MP_ROM_PTR(&pin_PB01) },
+ { MP_ROM_QSTR(MP_QSTR_PB02), MP_ROM_PTR(&pin_PB02) },
+ { MP_ROM_QSTR(MP_QSTR_PB10), MP_ROM_PTR(&pin_PB10) },
+ // VCAP1 ------------------------------------------*/
+ // VSS --------------------------------------------*/
+ // VDD --------------------------------------------*/
+
+// Pins 25-36
+ { MP_ROM_QSTR(MP_QSTR_PB12), MP_ROM_PTR(&pin_PB12) },
+ { MP_ROM_QSTR(MP_QSTR_PB13), MP_ROM_PTR(&pin_PB13) },
+ { MP_ROM_QSTR(MP_QSTR_PB14), MP_ROM_PTR(&pin_PB14) },
+ { MP_ROM_QSTR(MP_QSTR_PB15), MP_ROM_PTR(&pin_PB15) },
+ { MP_ROM_QSTR(MP_QSTR_PA08), MP_ROM_PTR(&pin_PA08) },
+ { MP_ROM_QSTR(MP_QSTR_PA09), MP_ROM_PTR(&pin_PA09) },
+ { MP_ROM_QSTR(MP_QSTR_PA10), MP_ROM_PTR(&pin_PA10) },
+ { MP_ROM_QSTR(MP_QSTR_PA11), MP_ROM_PTR(&pin_PA11) },
+ { MP_ROM_QSTR(MP_QSTR_PA12), MP_ROM_PTR(&pin_PA12) },
+ { MP_ROM_QSTR(MP_QSTR_PA13), MP_ROM_PTR(&pin_PA13) },
+ // VSS --------------------------------------------*/
+ // VDD --------------------------------------------*/
+
+// Pins 37-48
+ { MP_ROM_QSTR(MP_QSTR_PA14), MP_ROM_PTR(&pin_PA14) },
+ { MP_ROM_QSTR(MP_QSTR_PA15), MP_ROM_PTR(&pin_PA15) },
+ { MP_ROM_QSTR(MP_QSTR_PB03), MP_ROM_PTR(&pin_PB03) },
+ { MP_ROM_QSTR(MP_QSTR_PB04), MP_ROM_PTR(&pin_PB04) },
+ { MP_ROM_QSTR(MP_QSTR_PB05), MP_ROM_PTR(&pin_PB05) },
+ { MP_ROM_QSTR(MP_QSTR_PB06), MP_ROM_PTR(&pin_PB06) },
+ { MP_ROM_QSTR(MP_QSTR_PB07), MP_ROM_PTR(&pin_PB07) },
+ // BOOT0 ------------------------------------------*/
+ { MP_ROM_QSTR(MP_QSTR_PB08), MP_ROM_PTR(&pin_PB08) },
+ { MP_ROM_QSTR(MP_QSTR_PB09), MP_ROM_PTR(&pin_PB09) },
+ // VSS --------------------------------------------*/
+ // VDD --------------------------------------------*/
+
+};
+MP_DEFINE_CONST_DICT(mcu_pin_globals, mcu_pin_globals_table); \ No newline at end of file
diff --git a/ports/stm32f4/peripherals/stm32f4/clocks.h b/ports/stm/peripherals/clocks.h
index c7ba84662..1f837c79e 100644
--- a/ports/stm32f4/peripherals/stm32f4/clocks.h
+++ b/ports/stm/peripherals/clocks.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2019 Lucian Copeland for Adafruit Industries
+ * Copyright (c) 2020 Lucian Copeland 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,4 +24,4 @@
* THE SOFTWARE.
*/
-void stm32f4_peripherals_clocks_init(void);
+void stm32_peripherals_clocks_init(void);
diff --git a/ports/stm32f4/peripherals/stm32f4/gpio.h b/ports/stm/peripherals/gpio.h
index 34f89e792..a5dbe444c 100644
--- a/ports/stm32f4/peripherals/stm32f4/gpio.h
+++ b/ports/stm/peripherals/gpio.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2019 Lucian Copeland for Adafruit Industries
+ * Copyright (c) 2020 Lucian Copeland 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,5 +24,4 @@
* THE SOFTWARE.
*/
-void stm32f4_peripherals_gpio_init(void);
-void stm32f4_peripherals_status_led(uint8_t led, uint8_t state);
+void stm32_peripherals_gpio_init(void);
diff --git a/ports/stm/peripherals/periph.h b/ports/stm/peripherals/periph.h
new file mode 100644
index 000000000..209d35ee9
--- /dev/null
+++ b/ports/stm/peripherals/periph.h
@@ -0,0 +1,127 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Lucian Copeland 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.
+ */
+
+#ifndef __MICROPY_INCLUDED_STM32_PERIPHERALS_PERIPH_H__
+#define __MICROPY_INCLUDED_STM32_PERIPHERALS_PERIPH_H__
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include STM32_HAL_H
+#include "pins.h"
+
+// Comm Peripherals
+
+typedef struct {
+ uint8_t periph_index:4; // Index of the peripheral instance
+ uint8_t altfn_index:4; // Index of the altfn for this pin (0 to 15)
+ const mcu_pin_obj_t * pin; // Pin Object
+} mcu_periph_obj_t;
+
+#define PERIPH(index, alt, p_pin) \
+{ \
+ .periph_index = index, \
+ .altfn_index = alt, \
+ .pin = p_pin, \
+}
+
+// Timer Peripheral
+
+typedef struct {
+ uint8_t tim_index:4;
+ uint8_t altfn_index:4;
+ uint8_t channel_index:4;
+ const mcu_pin_obj_t * pin;
+} mcu_tim_pin_obj_t;
+
+#define TIM(index, alt, channel, tim_pin) \
+{ \
+ .tim_index = index, \
+ .altfn_index = alt, \
+ .channel_index = channel, \
+ .pin = tim_pin, \
+}
+
+// F4 Series
+// Access Lines
+
+#ifdef STM32F401xE
+#define HAS_DAC 0
+#define HAS_TRNG 0
+#define HAS_BASIC_TIM 0
+#include "stm32f4/stm32f401xe/periph.h"
+#endif
+
+#ifdef STM32F411xE
+#define HAS_DAC 0
+#define HAS_TRNG 0
+#define HAS_BASIC_TIM 0
+#include "stm32f4/stm32f411xe/periph.h"
+#endif
+
+#ifdef STM32F412Zx
+#define HAS_DAC 0
+#define HAS_TRNG 1
+#define HAS_BASIC_TIM 1
+#include "stm32f4/stm32f412zx/periph.h"
+#endif
+
+// Foundation Lines
+
+#ifdef STM32F405xx
+#define HAS_DAC 1
+#define HAS_TRNG 1
+#define HAS_BASIC_TIM 1
+#include "stm32f4/stm32f405xx/periph.h"
+#endif
+
+#ifdef STM32F407xx
+#define HAS_DAC 1
+#define HAS_TRNG 1
+#define HAS_BASIC_TIM 1
+#include "stm32f4/stm32f407xx/periph.h"
+#endif
+
+// F7 Series
+
+#ifdef STM32F767xx
+#define HAS_DAC 0
+#define HAS_TRNG 0
+#define HAS_BASIC_TIM 0
+#include "stm32f7/stm32f767xx/periph.h"
+#endif
+
+// H7 Series
+// Single Core
+
+#ifdef STM32H743xx
+#define HAS_DAC 0
+#define HAS_TRNG 0
+#define HAS_BASIC_TIM 0
+#include "stm32h7/stm32h743xx/periph.h"
+#endif
+
+#endif // __MICROPY_INCLUDED_STM32_PERIPHERALS_PERIPH_H__
diff --git a/ports/stm32f4/peripherals/stm32f4/pins.h b/ports/stm/peripherals/pins.h
index e6a32b64e..628e09695 100644
--- a/ports/stm32f4/peripherals/stm32f4/pins.h
+++ b/ports/stm/peripherals/pins.h
@@ -3,8 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2018 Dan Halbert for Adafruit Industries
- * Copyright (c) 2019 Lucian Copeland for Adafruit Industries
+ * Copyright (c) 2020 Lucian Copeland 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
@@ -28,13 +27,13 @@
// DO NOT include this file directly. Use shared-bindings/microcontroller/Pin.h instead to ensure
// that all necessary includes are already included.
-#ifndef __MICROPY_INCLUDED_STM32F4_PERIPHERALS_PINS_H__
-#define __MICROPY_INCLUDED_STM32F4_PERIPHERALS_PINS_H__
+#ifndef __MICROPY_INCLUDED_STM32_PERIPHERALS_PINS_H__
+#define __MICROPY_INCLUDED_STM32_PERIPHERALS_PINS_H__
#include <stdint.h>
#include <stdbool.h>
-#include "stm32f4xx_hal.h"
+#include STM32_HAL_H
typedef struct {
mp_obj_base_t base;
@@ -76,18 +75,31 @@ extern const mp_obj_type_t mcu_pin_type;
// Use illegal pin value to mark unassigned pins.
#define NO_PIN 0xff
-// Choose based on chip
+// F4 Series
#ifdef STM32F401xE
-#include "stm32f401xe/pins.h"
+#include "stm32f4/stm32f401xe/pins.h"
#endif
#ifdef STM32F411xE
-#include "stm32f411xe/pins.h"
+#include "stm32f4/stm32f411xe/pins.h"
#endif
#ifdef STM32F412Zx
-#include "stm32f412zx/pins.h"
+#include "stm32f4/stm32f412zx/pins.h"
#endif
#ifdef STM32F405xx
-#include "stm32f405xx/pins.h"
+#include "stm32f4/stm32f405xx/pins.h"
+#endif
+#ifdef STM32F407xx
+#include "stm32f4/stm32f407xx/pins.h"
+#endif
+
+// F7 Series
+#ifdef STM32F767xx
+#include "stm32f7/stm32f767xx/pins.h"
+#endif
+
+// H7 Series
+#ifdef STM32H743xx
+#include "stm32h7/stm32h743xx/pins.h"
#endif
-#endif // __MICROPY_INCLUDED_STM32F4_PERIPHERALS_PINS_H__
+#endif // __MICROPY_INCLUDED_STM32_PERIPHERALS_PINS_H__
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f411xe/clocks.c b/ports/stm/peripherals/stm32f4/stm32f401xe/clocks.c
index 53810af26..d048d60e8 100644
--- a/ports/stm32f4/peripherals/stm32f4/stm32f411xe/clocks.c
+++ b/ports/stm/peripherals/stm32f4/stm32f401xe/clocks.c
@@ -24,10 +24,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#include "stm32f4xx_hal.h"
+
#include "py/mpconfig.h"
-void stm32f4_peripherals_clocks_init(void) {
+void stm32_peripherals_clocks_init(void) {
//System clock init
RCC_ClkInitTypeDef RCC_ClkInitStruct;
RCC_OscInitTypeDef RCC_OscInitStruct;
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f401xe/gpio.c b/ports/stm/peripherals/stm32f4/stm32f401xe/gpio.c
index 28afee5d8..514bcc506 100644
--- a/ports/stm32f4/peripherals/stm32f4/stm32f401xe/gpio.c
+++ b/ports/stm/peripherals/stm32f4/stm32f401xe/gpio.c
@@ -24,11 +24,10 @@
* THE SOFTWARE.
*/
-#include "stm32f4xx_hal.h"
-#include "stm32f4/gpio.h"
+#include "gpio.h"
#include "common-hal/microcontroller/Pin.h"
-void stm32f4_peripherals_gpio_init(void) {
+void stm32_peripherals_gpio_init(void) {
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
@@ -38,15 +37,9 @@ void stm32f4_peripherals_gpio_init(void) {
__HAL_RCC_GPIOH_CLK_ENABLE();
//Never reset pins
- never_reset_pin_number(2,13); //PC13 anti tamp
never_reset_pin_number(2,14); //PC14 OSC32_IN
never_reset_pin_number(2,15); //PC15 OSC32_OUT
never_reset_pin_number(0,13); //PA13 SWDIO
never_reset_pin_number(0,14); //PA14 SWCLK
}
-//LEDs are inverted on F411 DISCO
-void stm32f4_peripherals_status_led(uint8_t led, uint8_t state) {
-}
-
-
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f401xe/periph.c b/ports/stm/peripherals/stm32f4/stm32f401xe/periph.c
index b12084186..868945ecc 100644
--- a/ports/stm32f4/peripherals/stm32f4/stm32f401xe/periph.c
+++ b/ports/stm/peripherals/stm32f4/stm32f401xe/periph.c
@@ -26,98 +26,98 @@
#include "py/obj.h"
#include "py/mphal.h"
-#include "stm32f4/pins.h"
-#include "stm32f4/periph.h"
+#include "peripherals/pins.h"
+#include "peripherals/periph.h"
// I2C
I2C_TypeDef * mcu_i2c_banks[3] = {I2C1, I2C2, I2C3};
-const mcu_i2c_sda_obj_t mcu_i2c_sda_list[5] = {
- I2C_SDA(1, 4, &pin_PB07),
- I2C_SDA(1, 4, &pin_PB09),
- I2C_SDA(2, 9, &pin_PB03),
- I2C_SDA(3, 4, &pin_PC09),
- I2C_SDA(3, 9, &pin_PB04),
+const mcu_periph_obj_t mcu_i2c_sda_list[5] = {
+ PERIPH(1, 4, &pin_PB07),
+ PERIPH(1, 4, &pin_PB09),
+ PERIPH(2, 9, &pin_PB03),
+ PERIPH(3, 4, &pin_PC09),
+ PERIPH(3, 9, &pin_PB04),
};
-const mcu_i2c_scl_obj_t mcu_i2c_scl_list[4] = {
- I2C_SCL(1, 4, &pin_PB06),
- I2C_SCL(1, 4, &pin_PB08),
- I2C_SCL(2, 4, &pin_PB10),
- I2C_SCL(3, 4, &pin_PA08)
+const mcu_periph_obj_t mcu_i2c_scl_list[4] = {
+ PERIPH(1, 4, &pin_PB06),
+ PERIPH(1, 4, &pin_PB08),
+ PERIPH(2, 4, &pin_PB10),
+ PERIPH(3, 4, &pin_PA08)
};
// SPI
SPI_TypeDef * mcu_spi_banks[4] = {SPI1, SPI2, SPI3, SPI4};
-const mcu_spi_sck_obj_t mcu_spi_sck_list[9] = {
- SPI(1, 5, &pin_PA05),
- SPI(1, 5, &pin_PB03),
- SPI(2, 5, &pin_PB10),
- SPI(2, 5, &pin_PB13),
- SPI(2, 5, &pin_PD03),
- SPI(3, 6, &pin_PB03),
- SPI(3, 6, &pin_PC10),
- SPI(4, 5, &pin_PE02),
- SPI(4, 5, &pin_PE12),
+const mcu_periph_obj_t mcu_spi_sck_list[9] = {
+ PERIPH(1, 5, &pin_PA05),
+ PERIPH(1, 5, &pin_PB03),
+ PERIPH(2, 5, &pin_PB10),
+ PERIPH(2, 5, &pin_PB13),
+ PERIPH(2, 5, &pin_PD03),
+ PERIPH(3, 6, &pin_PB03),
+ PERIPH(3, 6, &pin_PC10),
+ PERIPH(4, 5, &pin_PE02),
+ PERIPH(4, 5, &pin_PE12),
};
-const mcu_spi_mosi_obj_t mcu_spi_mosi_list[9] = {
- SPI(1, 5, &pin_PA07),
- SPI(1, 5, &pin_PB05),
- SPI(2, 5, &pin_PB15),
- SPI(2, 5, &pin_PC03),
- SPI(3, 6, &pin_PB05),
- SPI(3, 6, &pin_PC12),
- SPI(3, 5, &pin_PD06),
- SPI(4, 5, &pin_PE06),
- SPI(4, 5, &pin_PE14),
+const mcu_periph_obj_t mcu_spi_mosi_list[9] = {
+ PERIPH(1, 5, &pin_PA07),
+ PERIPH(1, 5, &pin_PB05),
+ PERIPH(2, 5, &pin_PB15),
+ PERIPH(2, 5, &pin_PC03),
+ PERIPH(3, 6, &pin_PB05),
+ PERIPH(3, 6, &pin_PC12),
+ PERIPH(3, 5, &pin_PD06),
+ PERIPH(4, 5, &pin_PE06),
+ PERIPH(4, 5, &pin_PE14),
};
-const mcu_spi_miso_obj_t mcu_spi_miso_list[8] = {
- SPI(1, 5, &pin_PA06),
- SPI(1, 5, &pin_PB04),
- SPI(2, 5, &pin_PB14),
- SPI(2, 5, &pin_PC02),
- SPI(3, 6, &pin_PB04),
- SPI(3, 6, &pin_PC11),
- SPI(4, 5, &pin_PE05),
- SPI(4, 5, &pin_PE13),
+const mcu_periph_obj_t mcu_spi_miso_list[8] = {
+ PERIPH(1, 5, &pin_PA06),
+ PERIPH(1, 5, &pin_PB04),
+ PERIPH(2, 5, &pin_PB14),
+ PERIPH(2, 5, &pin_PC02),
+ PERIPH(3, 6, &pin_PB04),
+ PERIPH(3, 6, &pin_PC11),
+ PERIPH(4, 5, &pin_PE05),
+ PERIPH(4, 5, &pin_PE13),
};
-const mcu_spi_nss_obj_t mcu_spi_nss_list[9] = {
- SPI(1, 5, &pin_PA04),
- SPI(1, 5, &pin_PA15),
- SPI(2, 5, &pin_PB09),
- SPI(2, 5, &pin_PB12),
- SPI(3, 6, &pin_PA04),
- SPI(3, 6, &pin_PA15),
- SPI(4, 6, &pin_PB12),
- SPI(4, 5, &pin_PE04),
- SPI(4, 5, &pin_PE11),
+const mcu_periph_obj_t mcu_spi_nss_list[9] = {
+ PERIPH(1, 5, &pin_PA04),
+ PERIPH(1, 5, &pin_PA15),
+ PERIPH(2, 5, &pin_PB09),
+ PERIPH(2, 5, &pin_PB12),
+ PERIPH(3, 6, &pin_PA04),
+ PERIPH(3, 6, &pin_PA15),
+ PERIPH(4, 6, &pin_PB12),
+ PERIPH(4, 5, &pin_PE04),
+ PERIPH(4, 5, &pin_PE11),
};
USART_TypeDef * mcu_uart_banks[MAX_UART] = {USART1, USART2, NULL, NULL, NULL, USART6};
bool mcu_uart_has_usart[MAX_UART] = {true, true, false, false, false, true};
-const mcu_uart_tx_obj_t mcu_uart_tx_list[6] = {
- UART(2, 7, &pin_PA02),
- UART(1, 7, &pin_PA09),
- UART(6, 8, &pin_PA11),
- UART(1, 7, &pin_PB06),
- UART(6, 8, &pin_PC06),
- UART(2, 7, &pin_PD05),
+const mcu_periph_obj_t mcu_uart_tx_list[6] = {
+ PERIPH(2, 7, &pin_PA02),
+ PERIPH(1, 7, &pin_PA09),
+ PERIPH(6, 8, &pin_PA11),
+ PERIPH(1, 7, &pin_PB06),
+ PERIPH(6, 8, &pin_PC06),
+ PERIPH(2, 7, &pin_PD05),
};
-const mcu_uart_rx_obj_t mcu_uart_rx_list[6] = {
- UART(2, 7, &pin_PA03),
- UART(1, 7, &pin_PA10),
- UART(6, 8, &pin_PA12),
- UART(1, 7, &pin_PB07),
- UART(6, 8, &pin_PC07),
- UART(2, 7, &pin_PD06),
+const mcu_periph_obj_t mcu_uart_rx_list[6] = {
+ PERIPH(2, 7, &pin_PA03),
+ PERIPH(1, 7, &pin_PA10),
+ PERIPH(6, 8, &pin_PA12),
+ PERIPH(1, 7, &pin_PB07),
+ PERIPH(6, 8, &pin_PC07),
+ PERIPH(2, 7, &pin_PD06),
};
//Timers
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f401xe/periph.h b/ports/stm/peripherals/stm32f4/stm32f401xe/periph.h
index 6085f1ff2..334a14db5 100644
--- a/ports/stm32f4/peripherals/stm32f4/stm32f401xe/periph.h
+++ b/ports/stm/peripherals/stm32f4/stm32f401xe/periph.h
@@ -24,29 +24,29 @@
* THE SOFTWARE.
*/
-#ifndef MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F401XE_PERIPH_H
-#define MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F401XE_PERIPH_H
+#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F401XE_PERIPH_H
+#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F401XE_PERIPH_H
//I2C
extern I2C_TypeDef * mcu_i2c_banks[3];
-extern const mcu_i2c_sda_obj_t mcu_i2c_sda_list[5];
-extern const mcu_i2c_scl_obj_t mcu_i2c_scl_list[4];
+extern const mcu_periph_obj_t mcu_i2c_sda_list[5];
+extern const mcu_periph_obj_t mcu_i2c_scl_list[4];
//SPI
extern SPI_TypeDef * mcu_spi_banks[4];
-extern const mcu_spi_sck_obj_t mcu_spi_sck_list[9];
-extern const mcu_spi_mosi_obj_t mcu_spi_mosi_list[9];
-extern const mcu_spi_miso_obj_t mcu_spi_miso_list[8];
-extern const mcu_spi_nss_obj_t mcu_spi_nss_list[9];
+extern const mcu_periph_obj_t mcu_spi_sck_list[9];
+extern const mcu_periph_obj_t mcu_spi_mosi_list[9];
+extern const mcu_periph_obj_t mcu_spi_miso_list[8];
+extern const mcu_periph_obj_t mcu_spi_nss_list[9];
//UART
extern USART_TypeDef * mcu_uart_banks[MAX_UART];
extern bool mcu_uart_has_usart[MAX_UART];
-extern const mcu_uart_tx_obj_t mcu_uart_tx_list[6];
-extern const mcu_uart_rx_obj_t mcu_uart_rx_list[6];
+extern const mcu_periph_obj_t mcu_uart_tx_list[6];
+extern const mcu_periph_obj_t mcu_uart_rx_list[6];
//Timers
#define TIM_BANK_ARRAY_LEN 14
@@ -54,4 +54,4 @@ extern const mcu_uart_rx_obj_t mcu_uart_rx_list[6];
TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
-#endif // MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F401XE_PERIPH_H \ No newline at end of file
+#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F401XE_PERIPH_H \ No newline at end of file
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f401xe/pins.c b/ports/stm/peripherals/stm32f4/stm32f401xe/pins.c
index 7e88c3dcb..eea2a1a1b 100644
--- a/ports/stm32f4/peripherals/stm32f4/stm32f401xe/pins.c
+++ b/ports/stm/peripherals/stm32f4/stm32f401xe/pins.c
@@ -26,7 +26,7 @@
#include "py/obj.h"
#include "py/mphal.h"
-#include "stm32f4/pins.h"
+#include "peripherals/pins.h"
const mcu_pin_obj_t pin_PE02 = PIN(4, 2, NO_ADC);
const mcu_pin_obj_t pin_PE03 = PIN(4, 3, NO_ADC);
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f401xe/pins.h b/ports/stm/peripherals/stm32f4/stm32f401xe/pins.h
index 09bc8f13e..c836df69a 100644
--- a/ports/stm32f4/peripherals/stm32f4/stm32f401xe/pins.h
+++ b/ports/stm/peripherals/stm32f4/stm32f401xe/pins.h
@@ -24,8 +24,8 @@
* THE SOFTWARE.
*/
-#ifndef MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F401XE_PINS_H
-#define MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F401XE_PINS_H
+#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F401XE_PINS_H
+#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F401XE_PINS_H
//Pins in datasheet order: DocID026289 Rev 7 page 38. LQFP100 only
//pg 38
@@ -118,4 +118,4 @@ extern const mcu_pin_obj_t pin_PE00;
extern const mcu_pin_obj_t pin_PE01;
-#endif // MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F401XE_PINS_H
+#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F401XE_PINS_H
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f405xx/clocks.c b/ports/stm/peripherals/stm32f4/stm32f405xx/clocks.c
index c259f54fa..5f4fd2783 100644
--- a/ports/stm32f4/peripherals/stm32f4/stm32f405xx/clocks.c
+++ b/ports/stm/peripherals/stm32f4/stm32f405xx/clocks.c
@@ -24,11 +24,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#include "stm32f4xx_hal.h"
-void stm32f4_peripherals_clocks_init(void) {
- //TODO: All parameters must be moved to board level, due to relationship with HSE Osc.
+#include "py/mpconfig.h"
+void stm32_peripherals_clocks_init(void) {
//System clock init
RCC_ClkInitTypeDef RCC_ClkInitStruct;
RCC_OscInitTypeDef RCC_OscInitStruct;
@@ -46,7 +45,7 @@ void stm32f4_peripherals_clocks_init(void) {
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
- RCC_OscInitStruct.PLL.PLLM = 12;
+ RCC_OscInitStruct.PLL.PLLM = BOARD_OSC_DIV;
RCC_OscInitStruct.PLL.PLLN = 336;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 7;
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f405xx/gpio.c b/ports/stm/peripherals/stm32f4/stm32f405xx/gpio.c
index f9be3b4ec..a5f4eae78 100644
--- a/ports/stm32f4/peripherals/stm32f4/stm32f405xx/gpio.c
+++ b/ports/stm/peripherals/stm32f4/stm32f405xx/gpio.c
@@ -24,15 +24,18 @@
* THE SOFTWARE.
*/
-#include "stm32f4xx_hal.h"
-#include "stm32f4/gpio.h"
+#include "peripherals/gpio.h"
#include "common-hal/microcontroller/Pin.h"
-void stm32f4_peripherals_gpio_init(void) {
+void stm32_peripherals_gpio_init(void) {
//Enable all GPIO for now
- __HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
+ __HAL_RCC_GPIOC_CLK_ENABLE();
+ __HAL_RCC_GPIOD_CLK_ENABLE();
+ __HAL_RCC_GPIOE_CLK_ENABLE();
+ __HAL_RCC_GPIOF_CLK_ENABLE();
+ __HAL_RCC_GPIOG_CLK_ENABLE();
//Never reset pins
never_reset_pin_number(2,13); //PC13 anti tamp
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f405xx/periph.c b/ports/stm/peripherals/stm32f4/stm32f405xx/periph.c
index bc03f7c7b..e75f0b206 100644
--- a/ports/stm32f4/peripherals/stm32f4/stm32f405xx/periph.c
+++ b/ports/stm/peripherals/stm32f4/stm32f405xx/periph.c
@@ -26,97 +26,97 @@
#include "py/obj.h"
#include "py/mphal.h"
-#include "stm32f4/pins.h"
-#include "stm32f4/periph.h"
+#include "peripherals/pins.h"
+#include "peripherals/periph.h"
// I2C
I2C_TypeDef * mcu_i2c_banks[3] = {I2C1, I2C2, I2C3};
-const mcu_i2c_sda_obj_t mcu_i2c_sda_list[4] = {
- I2C_SDA(1, 4, &pin_PB07),
- I2C_SDA(1, 4, &pin_PB09),
- I2C_SDA(2, 4, &pin_PB11),
- I2C_SDA(3, 4, &pin_PC09),
+const mcu_periph_obj_t mcu_i2c_sda_list[4] = {
+ PERIPH(1, 4, &pin_PB07),
+ PERIPH(1, 4, &pin_PB09),
+ PERIPH(2, 4, &pin_PB11),
+ PERIPH(3, 4, &pin_PC09),
};
-const mcu_i2c_scl_obj_t mcu_i2c_scl_list[4] = {
- I2C_SCL(1, 4, &pin_PB06),
- I2C_SCL(1, 4, &pin_PB08),
- I2C_SCL(2, 4, &pin_PB10),
- I2C_SCL(3, 4, &pin_PA08)
+const mcu_periph_obj_t mcu_i2c_scl_list[4] = {
+ PERIPH(1, 4, &pin_PB06),
+ PERIPH(1, 4, &pin_PB08),
+ PERIPH(2, 4, &pin_PB10),
+ PERIPH(3, 4, &pin_PA08)
};
SPI_TypeDef * mcu_spi_banks[3] = {SPI1, SPI2, SPI3};
-const mcu_spi_sck_obj_t mcu_spi_sck_list[7] = {
- SPI(1, 5, &pin_PA05),
- SPI(1, 5, &pin_PB03),
- SPI(2, 5, &pin_PB10),
- SPI(2, 5, &pin_PB13),
- SPI(2, 5, &pin_PC07),
- SPI(3, 6, &pin_PB03),
- SPI(3, 6, &pin_PC10),
+const mcu_periph_obj_t mcu_spi_sck_list[7] = {
+ PERIPH(1, 5, &pin_PA05),
+ PERIPH(1, 5, &pin_PB03),
+ PERIPH(2, 5, &pin_PB10),
+ PERIPH(2, 5, &pin_PB13),
+ PERIPH(2, 5, &pin_PC07),
+ PERIPH(3, 6, &pin_PB03),
+ PERIPH(3, 6, &pin_PC10),
};
-const mcu_spi_mosi_obj_t mcu_spi_mosi_list[6] = {
- SPI(1, 5, &pin_PA07),
- SPI(1, 5, &pin_PB05),
- SPI(2, 5, &pin_PB15),
- SPI(2, 5, &pin_PC03),
- SPI(3, 6, &pin_PB05),
- SPI(3, 6, &pin_PC12),
+const mcu_periph_obj_t mcu_spi_mosi_list[6] = {
+ PERIPH(1, 5, &pin_PA07),
+ PERIPH(1, 5, &pin_PB05),
+ PERIPH(2, 5, &pin_PB15),
+ PERIPH(2, 5, &pin_PC03),
+ PERIPH(3, 6, &pin_PB05),
+ PERIPH(3, 6, &pin_PC12),
};
-const mcu_spi_miso_obj_t mcu_spi_miso_list[6] = {
- SPI(1, 5, &pin_PA06),
- SPI(1, 5, &pin_PB04),
- SPI(2, 5, &pin_PB14),
- SPI(2, 5, &pin_PC02),
- SPI(3, 6, &pin_PB04),
- SPI(3, 6, &pin_PC11),
+const mcu_periph_obj_t mcu_spi_miso_list[6] = {
+ PERIPH(1, 5, &pin_PA06),
+ PERIPH(1, 5, &pin_PB04),
+ PERIPH(2, 5, &pin_PB14),
+ PERIPH(2, 5, &pin_PC02),
+ PERIPH(3, 6, &pin_PB04),
+ PERIPH(3, 6, &pin_PC11),
};
-const mcu_spi_nss_obj_t mcu_spi_nss_list[6] = {
- SPI(1, 5, &pin_PA04),
- SPI(1, 5, &pin_PA15),
- SPI(2, 5, &pin_PB09),
- SPI(2, 5, &pin_PB12),
- SPI(3, 6, &pin_PA04),
- SPI(3, 6, &pin_PA15),
+const mcu_periph_obj_t mcu_spi_nss_list[6] = {
+ PERIPH(1, 5, &pin_PA04),
+ PERIPH(1, 5, &pin_PA15),
+ PERIPH(2, 5, &pin_PB09),
+ PERIPH(2, 5, &pin_PB12),
+ PERIPH(3, 6, &pin_PA04),
+ PERIPH(3, 6, &pin_PA15),
};
USART_TypeDef * mcu_uart_banks[MAX_UART] = {USART1, USART2, USART3, UART4, UART5, USART6};
bool mcu_uart_has_usart[MAX_UART] = {true, true, true, false, false, true};
-const mcu_uart_tx_obj_t mcu_uart_tx_list[12] = {
- UART(4, 8, &pin_PA00),
- UART(2, 7, &pin_PA02),
- UART(1, 7, &pin_PA09),
- UART(1, 7, &pin_PB06),
- UART(3, 7, &pin_PB10),
- UART(6, 8, &pin_PC06),
- UART(3, 7, &pin_PC10),
- UART(4, 8, &pin_PC10),
- UART(5, 8, &pin_PC12),
- UART(2, 7, &pin_PD05),
- UART(3, 7, &pin_PD08),
- UART(6, 8, &pin_PG14),
+const mcu_periph_obj_t mcu_uart_tx_list[12] = {
+ PERIPH(4, 8, &pin_PA00),
+ PERIPH(2, 7, &pin_PA02),
+ PERIPH(1, 7, &pin_PA09),
+ PERIPH(1, 7, &pin_PB06),
+ PERIPH(3, 7, &pin_PB10),
+ PERIPH(6, 8, &pin_PC06),
+ PERIPH(3, 7, &pin_PC10),
+ PERIPH(4, 8, &pin_PC10),
+ PERIPH(5, 8, &pin_PC12),
+ PERIPH(2, 7, &pin_PD05),
+ PERIPH(3, 7, &pin_PD08),
+ PERIPH(6, 8, &pin_PG14),
};
-const mcu_uart_rx_obj_t mcu_uart_rx_list[12] = {
- UART(4, 8, &pin_PA01),
- UART(2, 7, &pin_PA03),
- UART(1, 7, &pin_PA10),
- UART(1, 7, &pin_PB07),
- UART(3, 7, &pin_PB11),
- UART(6, 8, &pin_PC07),
- UART(3, 7, &pin_PC11),
- UART(4, 8, &pin_PC11),
- UART(5, 8, &pin_PD02),
- UART(2, 7, &pin_PD06),
- UART(3, 7, &pin_PD09),
- UART(6, 8, &pin_PG09),
+const mcu_periph_obj_t mcu_uart_rx_list[12] = {
+ PERIPH(4, 8, &pin_PA01),
+ PERIPH(2, 7, &pin_PA03),
+ PERIPH(1, 7, &pin_PA10),
+ PERIPH(1, 7, &pin_PB07),
+ PERIPH(3, 7, &pin_PB11),
+ PERIPH(6, 8, &pin_PC07),
+ PERIPH(3, 7, &pin_PC11),
+ PERIPH(4, 8, &pin_PC11),
+ PERIPH(5, 8, &pin_PD02),
+ PERIPH(2, 7, &pin_PD06),
+ PERIPH(3, 7, &pin_PD09),
+ PERIPH(6, 8, &pin_PG09),
};
//Timers
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f405xx/periph.h b/ports/stm/peripherals/stm32f4/stm32f405xx/periph.h
index e87e79857..98b4fab9c 100644
--- a/ports/stm32f4/peripherals/stm32f4/stm32f405xx/periph.h
+++ b/ports/stm/peripherals/stm32f4/stm32f405xx/periph.h
@@ -24,29 +24,29 @@
* THE SOFTWARE.
*/
-#ifndef MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F405XX_PERIPH_H
-#define MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F405XX_PERIPH_H
+#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F405XX_PERIPH_H
+#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F405XX_PERIPH_H
//I2C
extern I2C_TypeDef * mcu_i2c_banks[3];
-extern const mcu_i2c_sda_obj_t mcu_i2c_sda_list[4];
-extern const mcu_i2c_scl_obj_t mcu_i2c_scl_list[4];
+extern const mcu_periph_obj_t mcu_i2c_sda_list[4];
+extern const mcu_periph_obj_t mcu_i2c_scl_list[4];
//SPI
extern SPI_TypeDef * mcu_spi_banks[3];
-extern const mcu_spi_sck_obj_t mcu_spi_sck_list[7];
-extern const mcu_spi_mosi_obj_t mcu_spi_mosi_list[6];
-extern const mcu_spi_miso_obj_t mcu_spi_miso_list[6];
-extern const mcu_spi_nss_obj_t mcu_spi_nss_list[6];
+extern const mcu_periph_obj_t mcu_spi_sck_list[7];
+extern const mcu_periph_obj_t mcu_spi_mosi_list[6];
+extern const mcu_periph_obj_t mcu_spi_miso_list[6];
+extern const mcu_periph_obj_t mcu_spi_nss_list[6];
//UART
extern USART_TypeDef * mcu_uart_banks[MAX_UART];
extern bool mcu_uart_has_usart[MAX_UART];
-extern const mcu_uart_tx_obj_t mcu_uart_tx_list[12];
-extern const mcu_uart_rx_obj_t mcu_uart_rx_list[12];
+extern const mcu_periph_obj_t mcu_uart_tx_list[12];
+extern const mcu_periph_obj_t mcu_uart_rx_list[12];
//Timers
#define TIM_BANK_ARRAY_LEN 14
@@ -54,4 +54,4 @@ extern const mcu_uart_rx_obj_t mcu_uart_rx_list[12];
TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
-#endif // MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F405XX_PERIPH_H \ No newline at end of file
+#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F405XX_PERIPH_H \ No newline at end of file
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f405xx/pins.c b/ports/stm/peripherals/stm32f4/stm32f405xx/pins.c
index 86445fe14..0f669f1c6 100644
--- a/ports/stm32f4/peripherals/stm32f4/stm32f405xx/pins.c
+++ b/ports/stm/peripherals/stm32f4/stm32f405xx/pins.c
@@ -26,7 +26,7 @@
#include "py/obj.h"
#include "py/mphal.h"
-#include "stm32f4/pins.h"
+#include "peripherals/pins.h"
const mcu_pin_obj_t pin_PE02 = PIN(4, 2, NO_ADC);
const mcu_pin_obj_t pin_PE03 = PIN(4, 3, NO_ADC);
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f405xx/pins.h b/ports/stm/peripherals/stm32f4/stm32f405xx/pins.h
index 180f5c316..b3e5e3344 100644
--- a/ports/stm32f4/peripherals/stm32f4/stm32f405xx/pins.h
+++ b/ports/stm/peripherals/stm32f4/stm32f405xx/pins.h
@@ -24,8 +24,8 @@
* THE SOFTWARE.
*/
-#ifndef MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F412ZG_PINS_H
-#define MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F412ZG_PINS_H
+#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F405XX_PINS_H
+#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F405XX_PINS_H
//Pins in datasheet order: DocID028087 Rev 7 page 50. LQFP100 only
//pg 50
@@ -155,4 +155,4 @@ extern const mcu_pin_obj_t pin_PB09;
extern const mcu_pin_obj_t pin_PE00;
extern const mcu_pin_obj_t pin_PE01;
-#endif // MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F412ZG_PINS_H
+#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F405XX_PINS_H
diff --git a/ports/stm/peripherals/stm32f4/stm32f407xx/clocks.c b/ports/stm/peripherals/stm32f4/stm32f407xx/clocks.c
new file mode 100644
index 000000000..5f4fd2783
--- /dev/null
+++ b/ports/stm/peripherals/stm32f4/stm32f407xx/clocks.c
@@ -0,0 +1,62 @@
+
+/*
+ * This file is part of the Micro Python project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Lucian Copeland 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 "py/mpconfig.h"
+
+void stm32_peripherals_clocks_init(void) {
+ //System clock init
+ RCC_ClkInitTypeDef RCC_ClkInitStruct;
+ RCC_OscInitTypeDef RCC_OscInitStruct;
+
+ /* Enable Power Control clock */
+ __HAL_RCC_PWR_CLK_ENABLE();
+
+ /* The voltage scaling allows optimizing the power consumption when the device is
+ clocked below the maximum system frequency, to update the voltage scaling value
+ regarding system frequency refer to product datasheet. */
+ __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
+
+ /* Enable HSE Oscillator and activate PLL with HSE as source */
+ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
+ RCC_OscInitStruct.HSEState = RCC_HSE_ON;
+ RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
+ RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
+ RCC_OscInitStruct.PLL.PLLM = BOARD_OSC_DIV;
+ RCC_OscInitStruct.PLL.PLLN = 336;
+ RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
+ RCC_OscInitStruct.PLL.PLLQ = 7;
+ HAL_RCC_OscConfig(&RCC_OscInitStruct);
+
+ /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2
+ clocks dividers */
+ RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
+ RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
+ RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
+ RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
+ RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
+ HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5);
+}
diff --git a/ports/stm/peripherals/stm32f4/stm32f407xx/gpio.c b/ports/stm/peripherals/stm32f4/stm32f407xx/gpio.c
new file mode 100644
index 000000000..a5f4eae78
--- /dev/null
+++ b/ports/stm/peripherals/stm32f4/stm32f407xx/gpio.c
@@ -0,0 +1,59 @@
+/*
+ * This file is part of the Micro Python project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Lucian Copeland 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 "peripherals/gpio.h"
+#include "common-hal/microcontroller/Pin.h"
+
+void stm32_peripherals_gpio_init(void) {
+ //Enable all GPIO for now
+ __HAL_RCC_GPIOA_CLK_ENABLE();
+ __HAL_RCC_GPIOB_CLK_ENABLE();
+ __HAL_RCC_GPIOC_CLK_ENABLE();
+ __HAL_RCC_GPIOD_CLK_ENABLE();
+ __HAL_RCC_GPIOE_CLK_ENABLE();
+ __HAL_RCC_GPIOF_CLK_ENABLE();
+ __HAL_RCC_GPIOG_CLK_ENABLE();
+
+ //Never reset pins
+ never_reset_pin_number(2,13); //PC13 anti tamp
+ never_reset_pin_number(2,14); //PC14 OSC32_IN
+ never_reset_pin_number(2,15); //PC15 OSC32_OUT
+ never_reset_pin_number(0,13); //PA13 SWDIO
+ never_reset_pin_number(0,14); //PA14 SWCLK
+ // never_reset_pin_number(0,15); //PA15 JTDI
+ // never_reset_pin_number(1,3); //PB3 JTDO
+ // never_reset_pin_number(1,4); //PB4 JTRST
+
+ // Port H is not included in GPIO port array
+ // never_reset_pin_number(5,0); //PH0 JTDO
+ // never_reset_pin_number(5,1); //PH1 JTRST
+}
+
+void stm32f4_peripherals_status_led(uint8_t led, uint8_t state) {
+
+}
+
+
diff --git a/ports/stm/peripherals/stm32f4/stm32f407xx/periph.c b/ports/stm/peripherals/stm32f4/stm32f407xx/periph.c
new file mode 100644
index 000000000..e75f0b206
--- /dev/null
+++ b/ports/stm/peripherals/stm32f4/stm32f407xx/periph.c
@@ -0,0 +1,194 @@
+ /*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Lucian Copeland 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 "py/obj.h"
+#include "py/mphal.h"
+#include "peripherals/pins.h"
+#include "peripherals/periph.h"
+
+// I2C
+
+I2C_TypeDef * mcu_i2c_banks[3] = {I2C1, I2C2, I2C3};
+
+const mcu_periph_obj_t mcu_i2c_sda_list[4] = {
+ PERIPH(1, 4, &pin_PB07),
+ PERIPH(1, 4, &pin_PB09),
+ PERIPH(2, 4, &pin_PB11),
+ PERIPH(3, 4, &pin_PC09),
+};
+
+const mcu_periph_obj_t mcu_i2c_scl_list[4] = {
+ PERIPH(1, 4, &pin_PB06),
+ PERIPH(1, 4, &pin_PB08),
+ PERIPH(2, 4, &pin_PB10),
+ PERIPH(3, 4, &pin_PA08)
+};
+
+SPI_TypeDef * mcu_spi_banks[3] = {SPI1, SPI2, SPI3};
+
+const mcu_periph_obj_t mcu_spi_sck_list[7] = {
+ PERIPH(1, 5, &pin_PA05),
+ PERIPH(1, 5, &pin_PB03),
+ PERIPH(2, 5, &pin_PB10),
+ PERIPH(2, 5, &pin_PB13),
+ PERIPH(2, 5, &pin_PC07),
+ PERIPH(3, 6, &pin_PB03),
+ PERIPH(3, 6, &pin_PC10),
+};
+
+const mcu_periph_obj_t mcu_spi_mosi_list[6] = {
+ PERIPH(1, 5, &pin_PA07),
+ PERIPH(1, 5, &pin_PB05),
+ PERIPH(2, 5, &pin_PB15),
+ PERIPH(2, 5, &pin_PC03),
+ PERIPH(3, 6, &pin_PB05),
+ PERIPH(3, 6, &pin_PC12),
+};
+
+const mcu_periph_obj_t mcu_spi_miso_list[6] = {
+ PERIPH(1, 5, &pin_PA06),
+ PERIPH(1, 5, &pin_PB04),
+ PERIPH(2, 5, &pin_PB14),
+ PERIPH(2, 5, &pin_PC02),
+ PERIPH(3, 6, &pin_PB04),
+ PERIPH(3, 6, &pin_PC11),
+};
+
+const mcu_periph_obj_t mcu_spi_nss_list[6] = {
+ PERIPH(1, 5, &pin_PA04),
+ PERIPH(1, 5, &pin_PA15),
+ PERIPH(2, 5, &pin_PB09),
+ PERIPH(2, 5, &pin_PB12),
+ PERIPH(3, 6, &pin_PA04),
+ PERIPH(3, 6, &pin_PA15),
+};
+
+USART_TypeDef * mcu_uart_banks[MAX_UART] = {USART1, USART2, USART3, UART4, UART5, USART6};
+bool mcu_uart_has_usart[MAX_UART] = {true, true, true, false, false, true};
+
+const mcu_periph_obj_t mcu_uart_tx_list[12] = {
+ PERIPH(4, 8, &pin_PA00),
+ PERIPH(2, 7, &pin_PA02),
+ PERIPH(1, 7, &pin_PA09),
+ PERIPH(1, 7, &pin_PB06),
+ PERIPH(3, 7, &pin_PB10),
+ PERIPH(6, 8, &pin_PC06),
+ PERIPH(3, 7, &pin_PC10),
+ PERIPH(4, 8, &pin_PC10),
+ PERIPH(5, 8, &pin_PC12),
+ PERIPH(2, 7, &pin_PD05),
+ PERIPH(3, 7, &pin_PD08),
+ PERIPH(6, 8, &pin_PG14),
+};
+
+const mcu_periph_obj_t mcu_uart_rx_list[12] = {
+ PERIPH(4, 8, &pin_PA01),
+ PERIPH(2, 7, &pin_PA03),
+ PERIPH(1, 7, &pin_PA10),
+ PERIPH(1, 7, &pin_PB07),
+ PERIPH(3, 7, &pin_PB11),
+ PERIPH(6, 8, &pin_PC07),
+ PERIPH(3, 7, &pin_PC11),
+ PERIPH(4, 8, &pin_PC11),
+ PERIPH(5, 8, &pin_PD02),
+ PERIPH(2, 7, &pin_PD06),
+ PERIPH(3, 7, &pin_PD09),
+ PERIPH(6, 8, &pin_PG09),
+};
+
+//Timers
+//TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
+TIM_TypeDef * mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, TIM8, TIM9, TIM10,
+ TIM11, TIM12, TIM13, TIM14};
+
+const mcu_tim_pin_obj_t mcu_tim_pin_list[56] = {
+ TIM(2,1,1,&pin_PA00),
+ TIM(5,2,1,&pin_PA00),
+ TIM(2,1,2,&pin_PA01),
+ TIM(5,2,2,&pin_PA01),
+ TIM(2,1,3,&pin_PA02),
+ TIM(5,2,3,&pin_PA02),
+ TIM(2,1,4,&pin_PA03),
+ TIM(5,2,4,&pin_PA03),
+ TIM(9,3,1,&pin_PA02),
+ TIM(9,3,2,&pin_PA03),
+ TIM(3,2,1,&pin_PA06),
+ TIM(13,9,1,&pin_PA06),
+ TIM(3,2,2,&pin_PA07),
+ TIM(14,9,1,&pin_PA07),
+ TIM(1,1,1,&pin_PA08),
+ TIM(1,1,2,&pin_PA09),
+ TIM(1,1,3,&pin_PA10),
+ TIM(1,1,4,&pin_PA11),
+ TIM(2,1,1,&pin_PA15),
+ TIM(3,2,3,&pin_PB00),
+ TIM(3,2,4,&pin_PB01),
+ TIM(2,1,2,&pin_PB03),
+ TIM(3,2,1,&pin_PB04),
+ TIM(3,2,2,&pin_PB05),
+ TIM(4,2,1,&pin_PB06),
+ TIM(4,2,2,&pin_PB07),
+ TIM(4,2,3,&pin_PB08),
+ TIM(10,2,1,&pin_PB08),
+ TIM(4,2,4,&pin_PB09),
+ TIM(11,2,1,&pin_PB09),
+ TIM(2,1,3,&pin_PB10),
+ TIM(2,1,4,&pin_PB11),
+ TIM(12,9,1,&pin_PB14),
+ TIM(12,9,2,&pin_PB15),
+ TIM(3,2,1,&pin_PC06),
+ TIM(3,2,2,&pin_PC07),
+ TIM(3,2,3,&pin_PC08),
+ TIM(3,2,4,&pin_PC09),
+ TIM(8,3,1,&pin_PC06),
+ TIM(8,3,2,&pin_PC07),
+ TIM(8,3,3,&pin_PC08),
+ TIM(8,3,4,&pin_PC09),
+ TIM(4,2,1,&pin_PD12),
+ TIM(4,2,2,&pin_PD13),
+ TIM(4,2,3,&pin_PD14),
+ TIM(4,2,4,&pin_PD15),
+ TIM(9,3,1,&pin_PE05),
+ TIM(9,3,2,&pin_PE06),
+ TIM(1,1,1,&pin_PE09),
+ TIM(1,1,2,&pin_PE11),
+ TIM(1,1,3,&pin_PE13),
+ TIM(1,1,4,&pin_PE14),
+ TIM(10,3,1,&pin_PF06),
+ TIM(11,3,1,&pin_PF07),
+ TIM(13,9,1,&pin_PF08),
+ TIM(14,9,1,&pin_PF09),
+ // TIM(12,9,1,&pin_PH06), //TODO: include these when pin map is expanded
+ // TIM(12,9,2,&pin_PH09),
+ // TIM(5,2,1,&pin_PH10),
+ // TIM(5,2,2,&pin_PH11),
+ // TIM(5,2,3,&pin_PH12),
+ // TIM(5,2,4,&pin_PI00),
+ // TIM(8,3,4,&pin_PI02),
+ // TIM(8,3,1,&pin_PI05),
+ // TIM(8,3,2,&pin_PI06),
+ // TIM(8,3,3,&pin_PI07),
+};
diff --git a/ports/stm/peripherals/stm32f4/stm32f407xx/periph.h b/ports/stm/peripherals/stm32f4/stm32f407xx/periph.h
new file mode 100644
index 000000000..15cbfb16d
--- /dev/null
+++ b/ports/stm/peripherals/stm32f4/stm32f407xx/periph.h
@@ -0,0 +1,57 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Lucian Copeland 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.
+ */
+
+#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F407XX_PERIPH_H
+#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F407XX_PERIPH_H
+
+//I2C
+extern I2C_TypeDef * mcu_i2c_banks[3];
+
+extern const mcu_periph_obj_t mcu_i2c_sda_list[4];
+extern const mcu_periph_obj_t mcu_i2c_scl_list[4];
+
+//SPI
+extern SPI_TypeDef * mcu_spi_banks[3];
+
+extern const mcu_periph_obj_t mcu_spi_sck_list[7];
+extern const mcu_periph_obj_t mcu_spi_mosi_list[6];
+extern const mcu_periph_obj_t mcu_spi_miso_list[6];
+extern const mcu_periph_obj_t mcu_spi_nss_list[6];
+
+//UART
+extern USART_TypeDef * mcu_uart_banks[MAX_UART];
+extern bool mcu_uart_has_usart[MAX_UART];
+
+extern const mcu_periph_obj_t mcu_uart_tx_list[12];
+extern const mcu_periph_obj_t mcu_uart_rx_list[12];
+
+//Timers
+#define TIM_BANK_ARRAY_LEN 14
+#define TIM_PIN_ARRAY_LEN 56
+TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
+const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
+
+#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F407XX_PERIPH_H \ No newline at end of file
diff --git a/ports/stm/peripherals/stm32f4/stm32f407xx/pins.c b/ports/stm/peripherals/stm32f4/stm32f407xx/pins.c
new file mode 100644
index 000000000..0f669f1c6
--- /dev/null
+++ b/ports/stm/peripherals/stm32f4/stm32f407xx/pins.c
@@ -0,0 +1,161 @@
+ /*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Lucian Copeland 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 "py/obj.h"
+#include "py/mphal.h"
+#include "peripherals/pins.h"
+
+const mcu_pin_obj_t pin_PE02 = PIN(4, 2, NO_ADC);
+const mcu_pin_obj_t pin_PE03 = PIN(4, 3, NO_ADC);
+const mcu_pin_obj_t pin_PE04 = PIN(4, 4, NO_ADC);
+const mcu_pin_obj_t pin_PE05 = PIN(4, 5, NO_ADC);
+const mcu_pin_obj_t pin_PE06 = PIN(4, 6, NO_ADC);
+
+const mcu_pin_obj_t pin_PC13 = PIN(2, 13, NO_ADC); //anti-tamp
+const mcu_pin_obj_t pin_PC14 = PIN(2, 14, NO_ADC); //OSC32_IN
+const mcu_pin_obj_t pin_PC15 = PIN(2, 15, NO_ADC); //OSC32_OUT
+
+const mcu_pin_obj_t pin_PF00 = PIN(5, 0, NO_ADC); // 144 only
+const mcu_pin_obj_t pin_PF01 = PIN(5, 1, NO_ADC); // 144 only
+const mcu_pin_obj_t pin_PF02 = PIN(5, 2, NO_ADC); // 144 only
+const mcu_pin_obj_t pin_PF03 = PIN(5, 3, ADC_INPUT(ADC_3,9)); // 144 only
+const mcu_pin_obj_t pin_PF04 = PIN(5, 4, ADC_INPUT(ADC_3,14)); // 144 only
+const mcu_pin_obj_t pin_PF05 = PIN(5, 5, ADC_INPUT(ADC_3,15)); // 144 only
+const mcu_pin_obj_t pin_PF06 = PIN(5, 6, ADC_INPUT(ADC_3,4)); // 144 only
+const mcu_pin_obj_t pin_PF07 = PIN(5, 7, ADC_INPUT(ADC_3,5)); // 144 only
+const mcu_pin_obj_t pin_PF08 = PIN(5, 8, ADC_INPUT(ADC_3,6)); // 144 only
+const mcu_pin_obj_t pin_PF09 = PIN(5, 9, ADC_INPUT(ADC_3,7)); // 144 only
+const mcu_pin_obj_t pin_PF10 = PIN(5, 10, ADC_INPUT(ADC_3,8)); // 144 only
+
+const mcu_pin_obj_t pin_PC00 = PIN(2, 0, ADC_INPUT(ADC_123,10));
+const mcu_pin_obj_t pin_PC01 = PIN(2, 1, ADC_INPUT(ADC_123,11));
+const mcu_pin_obj_t pin_PC02 = PIN(2, 2, ADC_INPUT(ADC_123,12));
+const mcu_pin_obj_t pin_PC03 = PIN(2, 3, ADC_INPUT(ADC_123,13));
+
+const mcu_pin_obj_t pin_PA00 = PIN(0, 0, ADC_INPUT(ADC_123,0));
+const mcu_pin_obj_t pin_PA01 = PIN(0, 1, ADC_INPUT(ADC_123,1));
+const mcu_pin_obj_t pin_PA02 = PIN(0, 2, ADC_INPUT(ADC_123,2));
+const mcu_pin_obj_t pin_PA03 = PIN(0, 3, ADC_INPUT(ADC_123,3));
+const mcu_pin_obj_t pin_PA04 = PIN(0, 4, ADC_INPUT(ADC_12,4));
+const mcu_pin_obj_t pin_PA05 = PIN(0, 5, ADC_INPUT(ADC_12,5));
+const mcu_pin_obj_t pin_PA06 = PIN(0, 6, ADC_INPUT(ADC_12,6));
+const mcu_pin_obj_t pin_PA07 = PIN(0, 7, ADC_INPUT(ADC_12,7));
+
+const mcu_pin_obj_t pin_PC04 = PIN(2, 4, ADC_INPUT(ADC_12,14));
+const mcu_pin_obj_t pin_PC05 = PIN(2, 5, ADC_INPUT(ADC_12,15));
+
+const mcu_pin_obj_t pin_PB00 = PIN(1, 0, ADC_INPUT(ADC_12,8));
+const mcu_pin_obj_t pin_PB01 = PIN(1, 1, ADC_INPUT(ADC_12,9));
+const mcu_pin_obj_t pin_PB02 = PIN(1, 2, NO_ADC); //BOOT1
+
+const mcu_pin_obj_t pin_PF11 = PIN(5, 11, NO_ADC); // 144 only
+const mcu_pin_obj_t pin_PF12 = PIN(5, 12, NO_ADC); // 144 only
+const mcu_pin_obj_t pin_PF13 = PIN(5, 13, NO_ADC); // 144 only
+const mcu_pin_obj_t pin_PF14 = PIN(5, 14, NO_ADC); // 144 only
+const mcu_pin_obj_t pin_PF15 = PIN(5, 15, NO_ADC); // 144 only
+
+const mcu_pin_obj_t pin_PG00 = PIN(6, 0, NO_ADC); // 144 only
+const mcu_pin_obj_t pin_PG01 = PIN(6, 1, NO_ADC); // 144 only
+
+const mcu_pin_obj_t pin_PE07 = PIN(4, 7, NO_ADC);
+const mcu_pin_obj_t pin_PE08 = PIN(4, 8, NO_ADC);
+const mcu_pin_obj_t pin_PE09 = PIN(4, 9, NO_ADC);
+const mcu_pin_obj_t pin_PE10 = PIN(4, 10, NO_ADC);
+const mcu_pin_obj_t pin_PE11 = PIN(4, 11, NO_ADC);
+const mcu_pin_obj_t pin_PE12 = PIN(4, 12, NO_ADC);
+const mcu_pin_obj_t pin_PE13 = PIN(4, 13, NO_ADC);
+const mcu_pin_obj_t pin_PE14 = PIN(4, 14, NO_ADC);
+const mcu_pin_obj_t pin_PE15 = PIN(4, 15, NO_ADC);
+
+const mcu_pin_obj_t pin_PB10 = PIN(1, 10, NO_ADC);
+const mcu_pin_obj_t pin_PB11 = PIN(1, 11, NO_ADC);
+const mcu_pin_obj_t pin_PB12 = PIN(1, 12, NO_ADC);
+const mcu_pin_obj_t pin_PB13 = PIN(1, 13, NO_ADC);
+const mcu_pin_obj_t pin_PB14 = PIN(1, 14, NO_ADC);
+const mcu_pin_obj_t pin_PB15 = PIN(1, 15, NO_ADC);
+
+const mcu_pin_obj_t pin_PD08 = PIN(3, 8, NO_ADC);
+const mcu_pin_obj_t pin_PD09 = PIN(3, 9, NO_ADC);
+const mcu_pin_obj_t pin_PD10 = PIN(3, 10, NO_ADC);
+const mcu_pin_obj_t pin_PD11 = PIN(3, 11, NO_ADC);
+const mcu_pin_obj_t pin_PD12 = PIN(3, 12, NO_ADC);
+const mcu_pin_obj_t pin_PD13 = PIN(3, 13, NO_ADC);
+const mcu_pin_obj_t pin_PD14 = PIN(3, 14, NO_ADC);
+const mcu_pin_obj_t pin_PD15 = PIN(3, 15, NO_ADC);
+
+const mcu_pin_obj_t pin_PG02 = PIN(6, 2, NO_ADC); // 144 only
+const mcu_pin_obj_t pin_PG03 = PIN(6, 3, NO_ADC); // 144 only
+const mcu_pin_obj_t pin_PG04 = PIN(6, 4, NO_ADC); // 144 only
+const mcu_pin_obj_t pin_PG05 = PIN(6, 5, NO_ADC); // 144 only
+const mcu_pin_obj_t pin_PG06 = PIN(6, 6, NO_ADC); // 144 only
+const mcu_pin_obj_t pin_PG07 = PIN(6, 7, NO_ADC); // 144 only
+const mcu_pin_obj_t pin_PG08 = PIN(6, 8, NO_ADC); // 144 only
+
+const mcu_pin_obj_t pin_PC06 = PIN(2, 6, NO_ADC);
+const mcu_pin_obj_t pin_PC07 = PIN(2, 7, NO_ADC);
+const mcu_pin_obj_t pin_PC08 = PIN(2, 8, NO_ADC);
+const mcu_pin_obj_t pin_PC09 = PIN(2, 9, NO_ADC);
+
+const mcu_pin_obj_t pin_PA08 = PIN(0, 8, NO_ADC);
+const mcu_pin_obj_t pin_PA09 = PIN(0, 9, NO_ADC);
+const mcu_pin_obj_t pin_PA10 = PIN(0, 10, NO_ADC);
+const mcu_pin_obj_t pin_PA11 = PIN(0, 11, NO_ADC);
+const mcu_pin_obj_t pin_PA12 = PIN(0, 12, NO_ADC);
+const mcu_pin_obj_t pin_PA13 = PIN(0, 13, NO_ADC);
+const mcu_pin_obj_t pin_PA14 = PIN(0, 14, NO_ADC);
+const mcu_pin_obj_t pin_PA15 = PIN(0, 15, NO_ADC);
+
+const mcu_pin_obj_t pin_PC10 = PIN(2, 10, NO_ADC);
+const mcu_pin_obj_t pin_PC11 = PIN(2, 11, NO_ADC);
+const mcu_pin_obj_t pin_PC12 = PIN(2, 12, NO_ADC);
+
+const mcu_pin_obj_t pin_PD00 = PIN(3, 0, NO_ADC);
+const mcu_pin_obj_t pin_PD01 = PIN(3, 1, NO_ADC);
+const mcu_pin_obj_t pin_PD02 = PIN(3, 2, NO_ADC);
+const mcu_pin_obj_t pin_PD03 = PIN(3, 3, NO_ADC);
+const mcu_pin_obj_t pin_PD04 = PIN(3, 4, NO_ADC);
+const mcu_pin_obj_t pin_PD05 = PIN(3, 5, NO_ADC);
+const mcu_pin_obj_t pin_PD06 = PIN(3, 6, NO_ADC);
+const mcu_pin_obj_t pin_PD07 = PIN(3, 7, NO_ADC);
+
+const mcu_pin_obj_t pin_PG09 = PIN(6, 9, NO_ADC); // 144 only
+const mcu_pin_obj_t pin_PG10 = PIN(6, 10, NO_ADC); // 144 only
+const mcu_pin_obj_t pin_PG11 = PIN(6, 11, NO_ADC); // 144 only
+const mcu_pin_obj_t pin_PG12 = PIN(6, 12, NO_ADC); // 144 only
+const mcu_pin_obj_t pin_PG13 = PIN(6, 13, NO_ADC); // 144 only
+const mcu_pin_obj_t pin_PG14 = PIN(6, 14, NO_ADC); // 144 only
+const mcu_pin_obj_t pin_PG15 = PIN(6, 15, NO_ADC); // 144 only
+
+const mcu_pin_obj_t pin_PB03 = PIN(1, 3, NO_ADC);
+const mcu_pin_obj_t pin_PB04 = PIN(1, 4, NO_ADC);
+const mcu_pin_obj_t pin_PB05 = PIN(1, 5, NO_ADC);
+const mcu_pin_obj_t pin_PB06 = PIN(1, 6, NO_ADC);
+const mcu_pin_obj_t pin_PB07 = PIN(1, 7, NO_ADC);
+const mcu_pin_obj_t pin_PB08 = PIN(1, 8, NO_ADC);
+const mcu_pin_obj_t pin_PB09 = PIN(1, 9, NO_ADC);
+
+const mcu_pin_obj_t pin_PE00 = PIN(4, 0, NO_ADC);
+const mcu_pin_obj_t pin_PE01 = PIN(4, 1, NO_ADC);
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f412zx/pins.h b/ports/stm/peripherals/stm32f4/stm32f407xx/pins.h
index 180f5c316..109dcb922 100644
--- a/ports/stm32f4/peripherals/stm32f4/stm32f412zx/pins.h
+++ b/ports/stm/peripherals/stm32f4/stm32f407xx/pins.h
@@ -24,8 +24,8 @@
* THE SOFTWARE.
*/
-#ifndef MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F412ZG_PINS_H
-#define MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F412ZG_PINS_H
+#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F407XX_PINS_H
+#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F407XX_PINS_H
//Pins in datasheet order: DocID028087 Rev 7 page 50. LQFP100 only
//pg 50
@@ -155,4 +155,4 @@ extern const mcu_pin_obj_t pin_PB09;
extern const mcu_pin_obj_t pin_PE00;
extern const mcu_pin_obj_t pin_PE01;
-#endif // MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F412ZG_PINS_H
+#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F407XX_PINS_H
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f401xe/clocks.c b/ports/stm/peripherals/stm32f4/stm32f411xe/clocks.c
index 53af29b3b..d048d60e8 100644
--- a/ports/stm32f4/peripherals/stm32f4/stm32f401xe/clocks.c
+++ b/ports/stm/peripherals/stm32f4/stm32f411xe/clocks.c
@@ -24,9 +24,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#include "stm32f4xx_hal.h"
-void stm32f4_peripherals_clocks_init(void) {
+#include "py/mpconfig.h"
+
+void stm32_peripherals_clocks_init(void) {
//System clock init
RCC_ClkInitTypeDef RCC_ClkInitStruct;
RCC_OscInitTypeDef RCC_OscInitStruct;
@@ -44,7 +45,7 @@ void stm32f4_peripherals_clocks_init(void) {
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
- RCC_OscInitStruct.PLL.PLLM = 12;
+ RCC_OscInitStruct.PLL.PLLM = BOARD_OSC_DIV;
RCC_OscInitStruct.PLL.PLLN = 336;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4;
RCC_OscInitStruct.PLL.PLLQ = 7;
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f411xe/gpio.c b/ports/stm/peripherals/stm32f4/stm32f411xe/gpio.c
index 651aea269..201a90e34 100644
--- a/ports/stm32f4/peripherals/stm32f4/stm32f411xe/gpio.c
+++ b/ports/stm/peripherals/stm32f4/stm32f411xe/gpio.c
@@ -24,11 +24,11 @@
* THE SOFTWARE.
*/
-#include "stm32f4xx_hal.h"
-#include "stm32f4/gpio.h"
+#include "peripherals/gpio.h"
+#include "py/mpconfig.h"
#include "common-hal/microcontroller/Pin.h"
-void stm32f4_peripherals_gpio_init(void) {
+void stm32_peripherals_gpio_init(void) {
//* GPIO Ports Clock Enable */
__HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
@@ -40,8 +40,11 @@ void stm32f4_peripherals_gpio_init(void) {
//Never reset pins
never_reset_pin_number(2,14); //PC14 OSC32_IN
never_reset_pin_number(2,15); //PC15 OSC32_OUT
+
+ #if !(BOARD_OVERWRITE_SWD)
never_reset_pin_number(0,13); //PA13 SWDIO
never_reset_pin_number(0,14); //PA14 SWCLK
+ #endif
// Port H is not included in GPIO port array
// never_reset_pin_number(5,0); //PH0 JTDO
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f411xe/periph.c b/ports/stm/peripherals/stm32f4/stm32f411xe/periph.c
index b7d9edf4f..085663749 100644
--- a/ports/stm32f4/peripherals/stm32f4/stm32f411xe/periph.c
+++ b/ports/stm/peripherals/stm32f4/stm32f411xe/periph.c
@@ -26,120 +26,120 @@
#include "py/obj.h"
#include "py/mphal.h"
-#include "stm32f4/pins.h"
-#include "stm32f4/periph.h"
+#include "peripherals/pins.h"
+#include "peripherals/periph.h"
// I2C
I2C_TypeDef * mcu_i2c_banks[3] = {I2C1, I2C2, I2C3};
-const mcu_i2c_sda_obj_t mcu_i2c_sda_list[7] = {
- I2C_SDA(1, 4, &pin_PB07),
- I2C_SDA(1, 4, &pin_PB09),
- I2C_SDA(2, 9, &pin_PB09),
- I2C_SDA(2, 9, &pin_PB03),
- I2C_SDA(3, 4, &pin_PC09),
- I2C_SDA(3, 9, &pin_PB04),
- I2C_SDA(3, 9, &pin_PB08)
+const mcu_periph_obj_t mcu_i2c_sda_list[7] = {
+ PERIPH(1, 4, &pin_PB07),
+ PERIPH(1, 4, &pin_PB09),
+ PERIPH(2, 9, &pin_PB09),
+ PERIPH(2, 9, &pin_PB03),
+ PERIPH(3, 4, &pin_PC09),
+ PERIPH(3, 9, &pin_PB04),
+ PERIPH(3, 9, &pin_PB08)
};
-const mcu_i2c_scl_obj_t mcu_i2c_scl_list[4] = {
- I2C_SCL(1, 4, &pin_PB06),
- I2C_SCL(1, 4, &pin_PB08),
- I2C_SCL(2, 4, &pin_PB10),
- I2C_SCL(3, 4, &pin_PA08)
+const mcu_periph_obj_t mcu_i2c_scl_list[4] = {
+ PERIPH(1, 4, &pin_PB06),
+ PERIPH(1, 4, &pin_PB08),
+ PERIPH(2, 4, &pin_PB10),
+ PERIPH(3, 4, &pin_PA08)
};
// SPI
SPI_TypeDef * mcu_spi_banks[5] = {SPI1, SPI2, SPI3, SPI4, SPI5};
-const mcu_spi_sck_obj_t mcu_spi_sck_list[15] = {
- SPI(1, 5, &pin_PA05),
- SPI(1, 5, &pin_PB03),
- SPI(2, 5, &pin_PB10),
- SPI(2, 5, &pin_PB13),
- SPI(2, 5, &pin_PC07),
- SPI(2, 5, &pin_PD03),
- SPI(3, 6, &pin_PB03),
- SPI(3, 7, &pin_PB12),
- SPI(3, 6, &pin_PC10),
- SPI(4, 6, &pin_PB13),
- SPI(4, 5, &pin_PE02),
- SPI(4, 5, &pin_PE12),
- SPI(5, 6, &pin_PB00),
- SPI(5, 6, &pin_PE02),
- SPI(5, 6, &pin_PE12)
+const mcu_periph_obj_t mcu_spi_sck_list[15] = {
+ PERIPH(1, 5, &pin_PA05),
+ PERIPH(1, 5, &pin_PB03),
+ PERIPH(2, 5, &pin_PB10),
+ PERIPH(2, 5, &pin_PB13),
+ PERIPH(2, 5, &pin_PC07),
+ PERIPH(2, 5, &pin_PD03),
+ PERIPH(3, 6, &pin_PB03),
+ PERIPH(3, 7, &pin_PB12),
+ PERIPH(3, 6, &pin_PC10),
+ PERIPH(4, 6, &pin_PB13),
+ PERIPH(4, 5, &pin_PE02),
+ PERIPH(4, 5, &pin_PE12),
+ PERIPH(5, 6, &pin_PB00),
+ PERIPH(5, 6, &pin_PE02),
+ PERIPH(5, 6, &pin_PE12)
};
-const mcu_spi_mosi_obj_t mcu_spi_mosi_list[14] = {
- SPI(1, 5, &pin_PA07),
- SPI(1, 5, &pin_PB05),
- SPI(2, 5, &pin_PB15),
- SPI(2, 5, &pin_PC03),
- SPI(3, 6, &pin_PB05),
- SPI(3, 6, &pin_PC12),
- SPI(3, 5, &pin_PD06),
- SPI(4, 5, &pin_PA01),
- SPI(4, 5, &pin_PE06),
- SPI(4, 5, &pin_PE14),
- SPI(5, 6, &pin_PA10),
- SPI(5, 6, &pin_PB08),
- SPI(5, 6, &pin_PE06),
- SPI(5, 6, &pin_PE14)
+const mcu_periph_obj_t mcu_spi_mosi_list[14] = {
+ PERIPH(1, 5, &pin_PA07),
+ PERIPH(1, 5, &pin_PB05),
+ PERIPH(2, 5, &pin_PB15),
+ PERIPH(2, 5, &pin_PC03),
+ PERIPH(3, 6, &pin_PB05),
+ PERIPH(3, 6, &pin_PC12),
+ PERIPH(3, 5, &pin_PD06),
+ PERIPH(4, 5, &pin_PA01),
+ PERIPH(4, 5, &pin_PE06),
+ PERIPH(4, 5, &pin_PE14),
+ PERIPH(5, 6, &pin_PA10),
+ PERIPH(5, 6, &pin_PB08),
+ PERIPH(5, 6, &pin_PE06),
+ PERIPH(5, 6, &pin_PE14)
};
-const mcu_spi_miso_obj_t mcu_spi_miso_list[12] = {
- SPI(1, 5, &pin_PA06),
- SPI(1, 5, &pin_PB04),
- SPI(2, 5, &pin_PB14),
- SPI(2, 5, &pin_PC02),
- SPI(3, 6, &pin_PB04),
- SPI(3, 6, &pin_PC11),
- SPI(4, 6, &pin_PA11),
- SPI(4, 5, &pin_PE05),
- SPI(4, 5, &pin_PE13),
- SPI(5, 6, &pin_PA12),
- SPI(5, 6, &pin_PE05),
- SPI(5, 6, &pin_PE13)
+const mcu_periph_obj_t mcu_spi_miso_list[12] = {
+ PERIPH(1, 5, &pin_PA06),
+ PERIPH(1, 5, &pin_PB04),
+ PERIPH(2, 5, &pin_PB14),
+ PERIPH(2, 5, &pin_PC02),
+ PERIPH(3, 6, &pin_PB04),
+ PERIPH(3, 6, &pin_PC11),
+ PERIPH(4, 6, &pin_PA11),
+ PERIPH(4, 5, &pin_PE05),
+ PERIPH(4, 5, &pin_PE13),
+ PERIPH(5, 6, &pin_PA12),
+ PERIPH(5, 6, &pin_PE05),
+ PERIPH(5, 6, &pin_PE13)
};
-const mcu_spi_nss_obj_t mcu_spi_nss_list[12] = {
- SPI(1, 5, &pin_PA04),
- SPI(1, 5, &pin_PA15),
- SPI(2, 5, &pin_PB09),
- SPI(2, 5, &pin_PB12),
- SPI(3, 6, &pin_PA04),
- SPI(3, 6, &pin_PA15),
- SPI(4, 6, &pin_PB12),
- SPI(4, 5, &pin_PE04),
- SPI(4, 5, &pin_PE11),
- SPI(5, 6, &pin_PB01),
- SPI(5, 6, &pin_PE04),
- SPI(5, 6, &pin_PE11)
+const mcu_periph_obj_t mcu_spi_nss_list[12] = {
+ PERIPH(1, 5, &pin_PA04),
+ PERIPH(1, 5, &pin_PA15),
+ PERIPH(2, 5, &pin_PB09),
+ PERIPH(2, 5, &pin_PB12),
+ PERIPH(3, 6, &pin_PA04),
+ PERIPH(3, 6, &pin_PA15),
+ PERIPH(4, 6, &pin_PB12),
+ PERIPH(4, 5, &pin_PE04),
+ PERIPH(4, 5, &pin_PE11),
+ PERIPH(5, 6, &pin_PB01),
+ PERIPH(5, 6, &pin_PE04),
+ PERIPH(5, 6, &pin_PE11)
};
USART_TypeDef * mcu_uart_banks[MAX_UART] = {USART1, USART2, NULL, NULL, NULL, USART6};
bool mcu_uart_has_usart[MAX_UART] = {true, true, false, false, false, true};
-const mcu_uart_tx_obj_t mcu_uart_tx_list[7] = {
- UART(2, 7, &pin_PA02),
- UART(1, 7, &pin_PA09),
- UART(1, 7, &pin_PA15),
- UART(6, 8, &pin_PA11),
- UART(1, 7, &pin_PB06),
- UART(6, 8, &pin_PC06),
- UART(2, 7, &pin_PD05),
+const mcu_periph_obj_t mcu_uart_tx_list[7] = {
+ PERIPH(2, 7, &pin_PA02),
+ PERIPH(1, 7, &pin_PA09),
+ PERIPH(1, 7, &pin_PA15),
+ PERIPH(6, 8, &pin_PA11),
+ PERIPH(1, 7, &pin_PB06),
+ PERIPH(6, 8, &pin_PC06),
+ PERIPH(2, 7, &pin_PD05),
};
-const mcu_uart_rx_obj_t mcu_uart_rx_list[7] = {
- UART(2, 7, &pin_PA03),
- UART(1, 7, &pin_PA10),
- UART(6, 8, &pin_PA12),
- UART(1, 7, &pin_PB03),
- UART(1, 7, &pin_PB07),
- UART(6, 8, &pin_PC07),
- UART(2, 7, &pin_PD06),
+const mcu_periph_obj_t mcu_uart_rx_list[7] = {
+ PERIPH(2, 7, &pin_PA03),
+ PERIPH(1, 7, &pin_PA10),
+ PERIPH(6, 8, &pin_PA12),
+ PERIPH(1, 7, &pin_PB03),
+ PERIPH(1, 7, &pin_PB07),
+ PERIPH(6, 8, &pin_PC07),
+ PERIPH(2, 7, &pin_PD06),
};
//Timers
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f411xe/periph.h b/ports/stm/peripherals/stm32f4/stm32f411xe/periph.h
index d657d73b6..2c5e5dd56 100644
--- a/ports/stm32f4/peripherals/stm32f4/stm32f411xe/periph.h
+++ b/ports/stm/peripherals/stm32f4/stm32f411xe/periph.h
@@ -24,29 +24,29 @@
* THE SOFTWARE.
*/
-#ifndef MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F411VE_PERIPH_H
-#define MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F411VE_PERIPH_H
+#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F411XE_PERIPH_H
+#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F411XE_PERIPH_H
//I2C
extern I2C_TypeDef * mcu_i2c_banks[3];
-extern const mcu_i2c_sda_obj_t mcu_i2c_sda_list[7];
-extern const mcu_i2c_scl_obj_t mcu_i2c_scl_list[4];
+extern const mcu_periph_obj_t mcu_i2c_sda_list[7];
+extern const mcu_periph_obj_t mcu_i2c_scl_list[4];
//SPI
extern SPI_TypeDef * mcu_spi_banks[5];
-extern const mcu_spi_sck_obj_t mcu_spi_sck_list[15];
-extern const mcu_spi_mosi_obj_t mcu_spi_mosi_list[14];
-extern const mcu_spi_miso_obj_t mcu_spi_miso_list[12];
-extern const mcu_spi_nss_obj_t mcu_spi_nss_list[12];
+extern const mcu_periph_obj_t mcu_spi_sck_list[15];
+extern const mcu_periph_obj_t mcu_spi_mosi_list[14];
+extern const mcu_periph_obj_t mcu_spi_miso_list[12];
+extern const mcu_periph_obj_t mcu_spi_nss_list[12];
//UART
extern USART_TypeDef * mcu_uart_banks[MAX_UART];
extern bool mcu_uart_has_usart[MAX_UART];
-extern const mcu_uart_tx_obj_t mcu_uart_tx_list[7];
-extern const mcu_uart_rx_obj_t mcu_uart_rx_list[7];
+extern const mcu_periph_obj_t mcu_uart_tx_list[7];
+extern const mcu_periph_obj_t mcu_uart_rx_list[7];
//Timers
#define TIM_BANK_ARRAY_LEN 14
@@ -54,4 +54,4 @@ extern const mcu_uart_rx_obj_t mcu_uart_rx_list[7];
TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
-#endif // MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F411VE_PERIPH_H \ No newline at end of file
+#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F411XE_PERIPH_H \ No newline at end of file
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f411xe/pins.c b/ports/stm/peripherals/stm32f4/stm32f411xe/pins.c
index 7e88c3dcb..eea2a1a1b 100644
--- a/ports/stm32f4/peripherals/stm32f4/stm32f411xe/pins.c
+++ b/ports/stm/peripherals/stm32f4/stm32f411xe/pins.c
@@ -26,7 +26,7 @@
#include "py/obj.h"
#include "py/mphal.h"
-#include "stm32f4/pins.h"
+#include "peripherals/pins.h"
const mcu_pin_obj_t pin_PE02 = PIN(4, 2, NO_ADC);
const mcu_pin_obj_t pin_PE03 = PIN(4, 3, NO_ADC);
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f411xe/pins.h b/ports/stm/peripherals/stm32f4/stm32f411xe/pins.h
index 37d3a5cf1..b6c18b02e 100644
--- a/ports/stm32f4/peripherals/stm32f4/stm32f411xe/pins.h
+++ b/ports/stm/peripherals/stm32f4/stm32f411xe/pins.h
@@ -24,8 +24,8 @@
* THE SOFTWARE.
*/
-#ifndef MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F411VE_PINS_H
-#define MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F411VE_PINS_H
+#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F411XE_PINS_H
+#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F411XE_PINS_H
//Pins in datasheet order: DocID026289 Rev 7 page 38. LQFP100 only
//pg 38
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f412zx/clocks.c b/ports/stm/peripherals/stm32f4/stm32f412zx/clocks.c
index 107056550..ad45abed2 100644
--- a/ports/stm32f4/peripherals/stm32f4/stm32f412zx/clocks.c
+++ b/ports/stm/peripherals/stm32f4/stm32f412zx/clocks.c
@@ -24,11 +24,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#include "stm32f4xx_hal.h"
-void stm32f4_peripherals_clocks_init(void) {
+#include "py/mpconfig.h"
+
+void stm32_peripherals_clocks_init(void) {
//System clock init
- RCC_ClkInitTypeDef RCC_ClkInitStruct;
+ RCC_ClkInitTypeDef RCC_ClkInitStruct;
RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
@@ -46,7 +47,7 @@ void stm32f4_peripherals_clocks_init(void) {
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
- RCC_OscInitStruct.PLL.PLLM = 8;
+ RCC_OscInitStruct.PLL.PLLM = BOARD_OSC_DIV;
RCC_OscInitStruct.PLL.PLLN = 200;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 7;
diff --git a/ports/stm/peripherals/stm32f4/stm32f412zx/gpio.c b/ports/stm/peripherals/stm32f4/stm32f412zx/gpio.c
new file mode 100644
index 000000000..3ec1b5b79
--- /dev/null
+++ b/ports/stm/peripherals/stm32f4/stm32f412zx/gpio.c
@@ -0,0 +1,54 @@
+/*
+ * This file is part of the Micro Python project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Lucian Copeland 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 "peripherals/gpio.h"
+#include "common-hal/microcontroller/Pin.h"
+
+void stm32_peripherals_gpio_init(void) {
+
+ __HAL_RCC_GPIOE_CLK_ENABLE();
+ __HAL_RCC_GPIOC_CLK_ENABLE();
+ __HAL_RCC_GPIOF_CLK_ENABLE();
+ __HAL_RCC_GPIOH_CLK_ENABLE();
+ __HAL_RCC_GPIOA_CLK_ENABLE();
+ __HAL_RCC_GPIOB_CLK_ENABLE();
+ __HAL_RCC_GPIOG_CLK_ENABLE();
+ __HAL_RCC_GPIOD_CLK_ENABLE();
+
+ //Never reset pins
+ never_reset_pin_number(2,13); //PC13 anti tamp
+ never_reset_pin_number(2,14); //PC14 OSC32_IN
+ never_reset_pin_number(2,15); //PC15 OSC32_OUT
+ never_reset_pin_number(0,13); //PA13 SWDIO
+ never_reset_pin_number(0,14); //PA14 SWCLK
+ //never_reset_pin_number(0,15); //PA15 JTDI
+ //never_reset_pin_number(1,3); //PB3 JTDO
+ //never_reset_pin_number(1,4); //PB4 JTRST
+
+ // Port H is not included in GPIO port array
+ // never_reset_pin_number(5,0); //PH0 JTDO
+ // never_reset_pin_number(5,1); //PH1 JTRST
+}
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f412zx/periph.c b/ports/stm/peripherals/stm32f4/stm32f412zx/periph.c
index f5effa80e..e92c88ce5 100644
--- a/ports/stm32f4/peripherals/stm32f4/stm32f412zx/periph.c
+++ b/ports/stm/peripherals/stm32f4/stm32f412zx/periph.c
@@ -26,98 +26,98 @@
#include "py/obj.h"
#include "py/mphal.h"
-#include "stm32f4/pins.h"
-#include "stm32f4/periph.h"
+#include "peripherals/pins.h"
+#include "peripherals/periph.h"
// I2C
I2C_TypeDef * mcu_i2c_banks[3] = {I2C1, I2C2, I2C3};
-const mcu_i2c_sda_obj_t mcu_i2c_sda_list[8] = {
- I2C_SDA(1, 4, &pin_PB07),
- I2C_SDA(1, 4, &pin_PB09),
- I2C_SDA(2, 4, &pin_PB11), //not on LQFP100
- I2C_SDA(2, 9, &pin_PB09),
- I2C_SDA(2, 9, &pin_PB03),
- I2C_SDA(3, 4, &pin_PC09),
- I2C_SDA(3, 9, &pin_PB04),
- I2C_SDA(3, 9, &pin_PB08)
+const mcu_periph_obj_t mcu_i2c_sda_list[8] = {
+ PERIPH(1, 4, &pin_PB07),
+ PERIPH(1, 4, &pin_PB09),
+ PERIPH(2, 4, &pin_PB11), //not on LQFP100
+ PERIPH(2, 9, &pin_PB09),
+ PERIPH(2, 9, &pin_PB03),
+ PERIPH(3, 4, &pin_PC09),
+ PERIPH(3, 9, &pin_PB04),
+ PERIPH(3, 9, &pin_PB08)
};
-const mcu_i2c_scl_obj_t mcu_i2c_scl_list[4] = {
- I2C_SCL(1, 4, &pin_PB06),
- I2C_SCL(1, 4, &pin_PB08),
- I2C_SCL(2, 4, &pin_PB10),
- I2C_SCL(3, 4, &pin_PA08)
+const mcu_periph_obj_t mcu_i2c_scl_list[4] = {
+ PERIPH(1, 4, &pin_PB06),
+ PERIPH(1, 4, &pin_PB08),
+ PERIPH(2, 4, &pin_PB10),
+ PERIPH(3, 4, &pin_PA08)
};
// SPI
SPI_TypeDef * mcu_spi_banks[5] = {SPI1, SPI2, SPI3, SPI4, SPI5};
-const mcu_spi_sck_obj_t mcu_spi_sck_list[15] = {
- SPI(1, 5, &pin_PA05),
- SPI(1, 5, &pin_PB03),
- SPI(2, 5, &pin_PB10),
- SPI(2, 5, &pin_PB13),
- SPI(2, 5, &pin_PC07),
- SPI(2, 5, &pin_PD03),
- SPI(3, 6, &pin_PB03),
- SPI(3, 7, &pin_PB12),
- SPI(3, 6, &pin_PC10),
- SPI(4, 6, &pin_PB13),
- SPI(4, 5, &pin_PE02),
- SPI(4, 5, &pin_PE12),
- SPI(5, 6, &pin_PB00),
- SPI(5, 6, &pin_PE02),
- SPI(5, 6, &pin_PE12)
+const mcu_periph_obj_t mcu_spi_sck_list[15] = {
+ PERIPH(1, 5, &pin_PA05),
+ PERIPH(1, 5, &pin_PB03),
+ PERIPH(2, 5, &pin_PB10),
+ PERIPH(2, 5, &pin_PB13),
+ PERIPH(2, 5, &pin_PC07),
+ PERIPH(2, 5, &pin_PD03),
+ PERIPH(3, 6, &pin_PB03),
+ PERIPH(3, 7, &pin_PB12),
+ PERIPH(3, 6, &pin_PC10),
+ PERIPH(4, 6, &pin_PB13),
+ PERIPH(4, 5, &pin_PE02),
+ PERIPH(4, 5, &pin_PE12),
+ PERIPH(5, 6, &pin_PB00),
+ PERIPH(5, 6, &pin_PE02),
+ PERIPH(5, 6, &pin_PE12)
};
-const mcu_spi_mosi_obj_t mcu_spi_mosi_list[14] = {
- SPI(1, 5, &pin_PA07),
- SPI(1, 5, &pin_PB05),
- SPI(2, 5, &pin_PB15),
- SPI(2, 5, &pin_PC03),
- SPI(3, 6, &pin_PB05),
- SPI(3, 6, &pin_PC12),
- SPI(3, 5, &pin_PD06),
- SPI(4, 5, &pin_PA01),
- SPI(4, 5, &pin_PE06),
- SPI(4, 5, &pin_PE14),
- SPI(5, 6, &pin_PA10),
- SPI(5, 6, &pin_PB08),
- SPI(5, 6, &pin_PE06),
- SPI(5, 6, &pin_PE14)
+const mcu_periph_obj_t mcu_spi_mosi_list[14] = {
+ PERIPH(1, 5, &pin_PA07),
+ PERIPH(1, 5, &pin_PB05),
+ PERIPH(2, 5, &pin_PB15),
+ PERIPH(2, 5, &pin_PC03),
+ PERIPH(3, 6, &pin_PB05),
+ PERIPH(3, 6, &pin_PC12),
+ PERIPH(3, 5, &pin_PD06),
+ PERIPH(4, 5, &pin_PA01),
+ PERIPH(4, 5, &pin_PE06),
+ PERIPH(4, 5, &pin_PE14),
+ PERIPH(5, 6, &pin_PA10),
+ PERIPH(5, 6, &pin_PB08),
+ PERIPH(5, 6, &pin_PE06),
+ PERIPH(5, 6, &pin_PE14)
};
-const mcu_spi_miso_obj_t mcu_spi_miso_list[12] = {
- SPI(1, 5, &pin_PA06),
- SPI(1, 5, &pin_PB04),
- SPI(2, 5, &pin_PB14),
- SPI(2, 5, &pin_PC02),
- SPI(3, 6, &pin_PB04),
- SPI(3, 6, &pin_PC11),
- SPI(4, 6, &pin_PA11),
- SPI(4, 5, &pin_PE05),
- SPI(4, 5, &pin_PE13),
- SPI(5, 6, &pin_PA12),
- SPI(5, 6, &pin_PE05),
- SPI(5, 6, &pin_PE13)
+const mcu_periph_obj_t mcu_spi_miso_list[12] = {
+ PERIPH(1, 5, &pin_PA06),
+ PERIPH(1, 5, &pin_PB04),
+ PERIPH(2, 5, &pin_PB14),
+ PERIPH(2, 5, &pin_PC02),
+ PERIPH(3, 6, &pin_PB04),
+ PERIPH(3, 6, &pin_PC11),
+ PERIPH(4, 6, &pin_PA11),
+ PERIPH(4, 5, &pin_PE05),
+ PERIPH(4, 5, &pin_PE13),
+ PERIPH(5, 6, &pin_PA12),
+ PERIPH(5, 6, &pin_PE05),
+ PERIPH(5, 6, &pin_PE13)
};
-const mcu_spi_nss_obj_t mcu_spi_nss_list[12] = {
- SPI(1, 5, &pin_PA04),
- SPI(1, 5, &pin_PA15),
- SPI(2, 5, &pin_PB09),
- SPI(2, 5, &pin_PB12),
- SPI(3, 6, &pin_PA04),
- SPI(3, 6, &pin_PA15),
- SPI(4, 6, &pin_PB12),
- SPI(4, 5, &pin_PE04),
- SPI(4, 5, &pin_PE11),
- SPI(5, 6, &pin_PB01),
- SPI(5, 6, &pin_PE04),
- SPI(5, 6, &pin_PE11)
+const mcu_periph_obj_t mcu_spi_nss_list[12] = {
+ PERIPH(1, 5, &pin_PA04),
+ PERIPH(1, 5, &pin_PA15),
+ PERIPH(2, 5, &pin_PB09),
+ PERIPH(2, 5, &pin_PB12),
+ PERIPH(3, 6, &pin_PA04),
+ PERIPH(3, 6, &pin_PA15),
+ PERIPH(4, 6, &pin_PB12),
+ PERIPH(4, 5, &pin_PE04),
+ PERIPH(4, 5, &pin_PE11),
+ PERIPH(5, 6, &pin_PB01),
+ PERIPH(5, 6, &pin_PE04),
+ PERIPH(5, 6, &pin_PE11)
};
//UART
@@ -125,33 +125,33 @@ const mcu_spi_nss_obj_t mcu_spi_nss_list[12] = {
USART_TypeDef * mcu_uart_banks[MAX_UART] = {USART1, USART2, USART3, NULL, NULL, USART6};
bool mcu_uart_has_usart[MAX_UART] = {true, true, true, false, false, true};
-const mcu_uart_tx_obj_t mcu_uart_tx_list[11] = {
- UART(2, 7, &pin_PA02),
- UART(1, 7, &pin_PA09),
- UART(1, 7, &pin_PA15),
- UART(6, 8, &pin_PA11),
- UART(1, 7, &pin_PB06),
- UART(3, 7, &pin_PB10),
- UART(6, 8, &pin_PC06),
- UART(3, 7, &pin_PC10),
- UART(2, 7, &pin_PD05),
- UART(3, 7, &pin_PD08),
- UART(6, 8, &pin_PG14),
+const mcu_periph_obj_t mcu_uart_tx_list[11] = {
+ PERIPH(2, 7, &pin_PA02),
+ PERIPH(1, 7, &pin_PA09),
+ PERIPH(1, 7, &pin_PA15),
+ PERIPH(6, 8, &pin_PA11),
+ PERIPH(1, 7, &pin_PB06),
+ PERIPH(3, 7, &pin_PB10),
+ PERIPH(6, 8, &pin_PC06),
+ PERIPH(3, 7, &pin_PC10),
+ PERIPH(2, 7, &pin_PD05),
+ PERIPH(3, 7, &pin_PD08),
+ PERIPH(6, 8, &pin_PG14),
};
-const mcu_uart_rx_obj_t mcu_uart_rx_list[12] = {
- UART(2, 7, &pin_PA03),
- UART(1, 7, &pin_PA10),
- UART(6, 8, &pin_PA12),
- UART(1, 7, &pin_PB03),
- UART(1, 7, &pin_PB07),
- UART(3, 7, &pin_PB11),
- UART(3, 7, &pin_PC05),
- UART(6, 8, &pin_PC07),
- UART(3, 7, &pin_PC11),
- UART(2, 7, &pin_PD06),
- UART(3, 7, &pin_PD09),
- UART(6, 8, &pin_PG09),
+const mcu_periph_obj_t mcu_uart_rx_list[12] = {
+ PERIPH(2, 7, &pin_PA03),
+ PERIPH(1, 7, &pin_PA10),
+ PERIPH(6, 8, &pin_PA12),
+ PERIPH(1, 7, &pin_PB03),
+ PERIPH(1, 7, &pin_PB07),
+ PERIPH(3, 7, &pin_PB11),
+ PERIPH(3, 7, &pin_PC05),
+ PERIPH(6, 8, &pin_PC07),
+ PERIPH(3, 7, &pin_PC11),
+ PERIPH(2, 7, &pin_PD06),
+ PERIPH(3, 7, &pin_PD09),
+ PERIPH(6, 8, &pin_PG09),
};
//Timers
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f412zx/periph.h b/ports/stm/peripherals/stm32f4/stm32f412zx/periph.h
index e0141e6da..f668ace75 100644
--- a/ports/stm32f4/peripherals/stm32f4/stm32f412zx/periph.h
+++ b/ports/stm/peripherals/stm32f4/stm32f412zx/periph.h
@@ -24,30 +24,30 @@
* THE SOFTWARE.
*/
-#ifndef MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F411VE_PERIPH_H
-#define MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F411VE_PERIPH_H
+#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F412ZX_PERIPH_H
+#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F412ZX_PERIPH_H
//I2C
extern I2C_TypeDef * mcu_i2c_banks[3];
-extern const mcu_i2c_sda_obj_t mcu_i2c_sda_list[8];
-extern const mcu_i2c_scl_obj_t mcu_i2c_scl_list[4];
+extern const mcu_periph_obj_t mcu_i2c_sda_list[8];
+extern const mcu_periph_obj_t mcu_i2c_scl_list[4];
//SPI
extern SPI_TypeDef * mcu_spi_banks[5];
-extern const mcu_spi_sck_obj_t mcu_spi_sck_list[15];
-extern const mcu_spi_mosi_obj_t mcu_spi_mosi_list[14];
-extern const mcu_spi_miso_obj_t mcu_spi_miso_list[12];
-extern const mcu_spi_nss_obj_t mcu_spi_nss_list[12];
+extern const mcu_periph_obj_t mcu_spi_sck_list[15];
+extern const mcu_periph_obj_t mcu_spi_mosi_list[14];
+extern const mcu_periph_obj_t mcu_spi_miso_list[12];
+extern const mcu_periph_obj_t mcu_spi_nss_list[12];
//UART
extern USART_TypeDef * mcu_uart_banks[MAX_UART];
extern bool mcu_uart_has_usart[MAX_UART];
-extern const mcu_uart_tx_obj_t mcu_uart_tx_list[11];
-extern const mcu_uart_rx_obj_t mcu_uart_rx_list[12];
+extern const mcu_periph_obj_t mcu_uart_tx_list[11];
+extern const mcu_periph_obj_t mcu_uart_rx_list[12];
//Timers
#define TIM_BANK_ARRAY_LEN 14
@@ -55,4 +55,4 @@ extern const mcu_uart_rx_obj_t mcu_uart_rx_list[12];
TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN];
-#endif // MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F411VE_PERIPH_H \ No newline at end of file
+#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F412ZX_PERIPH_H \ No newline at end of file
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f412zx/pins.c b/ports/stm/peripherals/stm32f4/stm32f412zx/pins.c
index c56de5a29..ef3ce6d0e 100644
--- a/ports/stm32f4/peripherals/stm32f4/stm32f412zx/pins.c
+++ b/ports/stm/peripherals/stm32f4/stm32f412zx/pins.c
@@ -26,7 +26,7 @@
#include "py/obj.h"
#include "py/mphal.h"
-#include "stm32f4/pins.h"
+#include "peripherals/pins.h"
const mcu_pin_obj_t pin_PE02 = PIN(4, 2, NO_ADC);
const mcu_pin_obj_t pin_PE03 = PIN(4, 3, NO_ADC);
diff --git a/ports/stm/peripherals/stm32f4/stm32f412zx/pins.h b/ports/stm/peripherals/stm32f4/stm32f412zx/pins.h
new file mode 100644
index 000000000..5cf99345c
--- /dev/null
+++ b/ports/stm/peripherals/stm32f4/stm32f412zx/pins.h
@@ -0,0 +1,157 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Lucian Copeland 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.
+ */
+
+#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F412ZX_PINS_H
+#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F412ZX_PINS_H
+
+//pg 50
+extern const mcu_pin_obj_t pin_PE02;
+extern const mcu_pin_obj_t pin_PE03;
+extern const mcu_pin_obj_t pin_PE04;
+extern const mcu_pin_obj_t pin_PE05;
+extern const mcu_pin_obj_t pin_PE06;
+extern const mcu_pin_obj_t pin_PC13;
+extern const mcu_pin_obj_t pin_PC14;
+//pg 51
+extern const mcu_pin_obj_t pin_PC15;
+extern const mcu_pin_obj_t pin_PF00; // 144 only
+extern const mcu_pin_obj_t pin_PF01; // 144 only
+extern const mcu_pin_obj_t pin_PF02; // 144 only
+extern const mcu_pin_obj_t pin_PF03; // 144 only
+extern const mcu_pin_obj_t pin_PF04; // 144 only
+extern const mcu_pin_obj_t pin_PF05; // 144 only
+extern const mcu_pin_obj_t pin_PF06; // 144 only
+extern const mcu_pin_obj_t pin_PF07; // 144 only
+extern const mcu_pin_obj_t pin_PF08; // 144 only
+extern const mcu_pin_obj_t pin_PF09; // 144 only
+extern const mcu_pin_obj_t pin_PF10; // 144 only
+//pg 52
+extern const mcu_pin_obj_t pin_PC00;
+extern const mcu_pin_obj_t pin_PC01;
+extern const mcu_pin_obj_t pin_PC02;
+extern const mcu_pin_obj_t pin_PC03;
+extern const mcu_pin_obj_t pin_PA00;
+extern const mcu_pin_obj_t pin_PA01;
+extern const mcu_pin_obj_t pin_PA02;
+//pg 53
+extern const mcu_pin_obj_t pin_PA03;
+extern const mcu_pin_obj_t pin_PA04;
+extern const mcu_pin_obj_t pin_PA05;
+extern const mcu_pin_obj_t pin_PA06;
+extern const mcu_pin_obj_t pin_PA07;
+extern const mcu_pin_obj_t pin_PC04;
+//pg 54
+extern const mcu_pin_obj_t pin_PC05;
+extern const mcu_pin_obj_t pin_PB00;
+extern const mcu_pin_obj_t pin_PB01;
+extern const mcu_pin_obj_t pin_PB02;
+extern const mcu_pin_obj_t pin_PF11; // 144 only
+extern const mcu_pin_obj_t pin_PF12; // 144 only
+extern const mcu_pin_obj_t pin_PF13; // 144 only
+extern const mcu_pin_obj_t pin_PF14; // 144 only
+extern const mcu_pin_obj_t pin_PF15; // 144 only
+extern const mcu_pin_obj_t pin_PG00; // 144 only
+extern const mcu_pin_obj_t pin_PG01; // 144 only
+//pg 55
+extern const mcu_pin_obj_t pin_PE07;
+extern const mcu_pin_obj_t pin_PE08;
+extern const mcu_pin_obj_t pin_PE09;
+extern const mcu_pin_obj_t pin_PE10;
+extern const mcu_pin_obj_t pin_PE11;
+extern const mcu_pin_obj_t pin_PE12;
+extern const mcu_pin_obj_t pin_PE13;
+extern const mcu_pin_obj_t pin_PE14;
+//pg 56
+extern const mcu_pin_obj_t pin_PE15;
+extern const mcu_pin_obj_t pin_PB10;
+extern const mcu_pin_obj_t pin_PB11; // 144 only
+extern const mcu_pin_obj_t pin_PB12;
+extern const mcu_pin_obj_t pin_PB13;
+//pg 57
+extern const mcu_pin_obj_t pin_PB14;
+extern const mcu_pin_obj_t pin_PB15;
+extern const mcu_pin_obj_t pin_PD08;
+extern const mcu_pin_obj_t pin_PD09;
+extern const mcu_pin_obj_t pin_PD10;
+extern const mcu_pin_obj_t pin_PD11;
+extern const mcu_pin_obj_t pin_PD12;
+//pg 58
+extern const mcu_pin_obj_t pin_PD13;
+extern const mcu_pin_obj_t pin_PD14;
+extern const mcu_pin_obj_t pin_PD15;
+extern const mcu_pin_obj_t pin_PG02; // 144 only
+extern const mcu_pin_obj_t pin_PG03; // 144 only
+extern const mcu_pin_obj_t pin_PG04; // 144 only
+extern const mcu_pin_obj_t pin_PG05; // 144 only
+extern const mcu_pin_obj_t pin_PG06; // 144 only
+extern const mcu_pin_obj_t pin_PG07; // 144 only
+extern const mcu_pin_obj_t pin_PG08; // 144 only
+//pg 59
+extern const mcu_pin_obj_t pin_PC06;
+extern const mcu_pin_obj_t pin_PC07;
+extern const mcu_pin_obj_t pin_PC08;
+extern const mcu_pin_obj_t pin_PC09;
+extern const mcu_pin_obj_t pin_PA08;
+extern const mcu_pin_obj_t pin_PA09;
+extern const mcu_pin_obj_t pin_PA10;
+//pg 60
+extern const mcu_pin_obj_t pin_PA11;
+extern const mcu_pin_obj_t pin_PA12;
+extern const mcu_pin_obj_t pin_PA13;
+extern const mcu_pin_obj_t pin_PA14;
+extern const mcu_pin_obj_t pin_PA15;
+extern const mcu_pin_obj_t pin_PC10;
+extern const mcu_pin_obj_t pin_PC11;
+//pg 61
+extern const mcu_pin_obj_t pin_PC12;
+extern const mcu_pin_obj_t pin_PD00;
+extern const mcu_pin_obj_t pin_PD01;
+extern const mcu_pin_obj_t pin_PD02;
+extern const mcu_pin_obj_t pin_PD03;
+extern const mcu_pin_obj_t pin_PD04;
+extern const mcu_pin_obj_t pin_PD05;
+extern const mcu_pin_obj_t pin_PD06;
+extern const mcu_pin_obj_t pin_PD07;
+//pg 62
+extern const mcu_pin_obj_t pin_PG09; // 144 only
+extern const mcu_pin_obj_t pin_PG10; // 144 only
+extern const mcu_pin_obj_t pin_PG11; // 144 only
+extern const mcu_pin_obj_t pin_PG12; // 144 only
+extern const mcu_pin_obj_t pin_PG13; // 144 only
+extern const mcu_pin_obj_t pin_PG14; // 144 only
+extern const mcu_pin_obj_t pin_PG15; // 144 only
+extern const mcu_pin_obj_t pin_PB03;
+extern const mcu_pin_obj_t pin_PB04;
+//pg 63
+extern const mcu_pin_obj_t pin_PB05;
+extern const mcu_pin_obj_t pin_PB06;
+extern const mcu_pin_obj_t pin_PB07;
+extern const mcu_pin_obj_t pin_PB08;
+extern const mcu_pin_obj_t pin_PB09;
+extern const mcu_pin_obj_t pin_PE00;
+extern const mcu_pin_obj_t pin_PE01;
+
+#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F412ZX_PINS_H
diff --git a/ports/stm/peripherals/stm32f7/stm32f767xx/clocks.c b/ports/stm/peripherals/stm32f7/stm32f767xx/clocks.c
new file mode 100644
index 000000000..a0d58f4fc
--- /dev/null
+++ b/ports/stm/peripherals/stm32f7/stm32f767xx/clocks.c
@@ -0,0 +1,66 @@
+
+/*
+ * This file is part of the Micro Python project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Lucian Copeland 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 "py/mpconfig.h"
+
+void stm32_peripherals_clocks_init(void) {
+ RCC_ClkInitTypeDef RCC_ClkInitStruct;
+ RCC_OscInitTypeDef RCC_OscInitStruct;
+
+ /* Enable Power Control clock */
+ __HAL_RCC_PWR_CLK_ENABLE();
+
+ /* The voltage scaling allows optimizing the power consumption when the device is
+ clocked below the maximum system frequency, to update the voltage scaling value
+ regarding system frequency refer to product datasheet. */
+ __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
+
+ /* Enable HSE Oscillator and activate PLL with HSE as source */
+ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
+ RCC_OscInitStruct.HSEState = RCC_HSE_ON;
+ RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
+ RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
+ RCC_OscInitStruct.PLL.PLLM = BOARD_OSC_DIV;
+ RCC_OscInitStruct.PLL.PLLN = 432;
+ RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
+ RCC_OscInitStruct.PLL.PLLQ = 9;
+ RCC_OscInitStruct.PLL.PLLR = 7;
+ HAL_RCC_OscConfig(&RCC_OscInitStruct);
+
+ /* Activate the OverDrive to reach the 216 MHz Frequency */
+ HAL_PWREx_EnableOverDrive();
+
+ /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers */
+ RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
+ RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
+ RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
+ RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
+ RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
+
+ HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_7);
+
+}
diff --git a/ports/stm/peripherals/stm32f7/stm32f767xx/gpio.c b/ports/stm/peripherals/stm32f7/stm32f767xx/gpio.c
new file mode 100644
index 000000000..d51ff53c1
--- /dev/null
+++ b/ports/stm/peripherals/stm32f7/stm32f767xx/gpio.c
@@ -0,0 +1,48 @@
+/*
+ * This file is part of the Micro Python project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Lucian Copeland 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 "gpio.h"
+#include "common-hal/microcontroller/Pin.h"
+
+void stm32_peripherals_gpio_init(void) {
+ //Enable all GPIO for now
+ __HAL_RCC_GPIOE_CLK_ENABLE();
+ __HAL_RCC_GPIOC_CLK_ENABLE();
+ __HAL_RCC_GPIOF_CLK_ENABLE();
+ __HAL_RCC_GPIOH_CLK_ENABLE();
+ __HAL_RCC_GPIOA_CLK_ENABLE();
+ __HAL_RCC_GPIOB_CLK_ENABLE();
+ __HAL_RCC_GPIOG_CLK_ENABLE();
+ __HAL_RCC_GPIOD_CLK_ENABLE();
+
+ //Never reset pins
+ never_reset_pin_number(2,14); //PC14 OSC32_IN
+ never_reset_pin_number(2,15); //PC15 OSC32_OUT
+ never_reset_pin_number(0,13); //PA13 SWDIO
+ never_reset_pin_number(0,14); //PA14 SWCLK
+}
+
+
diff --git a/ports/stm/peripherals/stm32f7/stm32f767xx/periph.c b/ports/stm/peripherals/stm32f7/stm32f767xx/periph.c
new file mode 100644
index 000000000..07d226db3
--- /dev/null
+++ b/ports/stm/peripherals/stm32f7/stm32f767xx/periph.c
@@ -0,0 +1,248 @@
+ /*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Lucian Copeland 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 "py/obj.h"
+#include "py/mphal.h"
+#include "peripherals/pins.h"
+#include "peripherals/periph.h"
+
+// I2C
+
+I2C_TypeDef * mcu_i2c_banks[4] = {I2C1, I2C2, I2C3, I2C4};
+
+const mcu_periph_obj_t mcu_i2c_sda_list[12] = {
+ PERIPH(1, 4, &pin_PB07),
+ PERIPH(4, 11, &pin_PB07),
+ PERIPH(4, 1, &pin_PB09),
+ PERIPH(1, 4, &pin_PB09),
+ PERIPH(2, 4, &pin_PB11),
+ PERIPH(3, 4, &pin_PC09),
+ PERIPH(4, 4, &pin_PD13),
+ PERIPH(2, 4, &pin_PF00),
+ PERIPH(4, 4, &pin_PF15),
+ PERIPH(2, 4, &pin_PH05),
+ PERIPH(3, 4, &pin_PH08),
+ PERIPH(4, 4, &pin_PH12),
+};
+const mcu_periph_obj_t mcu_i2c_scl_list[12] = {
+ PERIPH(3, 4, &pin_PA08),
+ PERIPH(1, 4, &pin_PB06),
+ PERIPH(4, 11, &pin_PB06),
+ PERIPH(4, 1, &pin_PB08),
+ PERIPH(1, 4, &pin_PB08),
+ PERIPH(2, 4, &pin_PB10),
+ PERIPH(4, 4, &pin_PD12),
+ PERIPH(2, 4, &pin_PF01),
+ PERIPH(4, 4, &pin_PF14),
+ PERIPH(2, 4, &pin_PH04),
+ PERIPH(3, 4, &pin_PH07),
+ PERIPH(4, 4, &pin_PH11),
+};
+
+//SPI
+
+SPI_TypeDef * mcu_spi_banks[6] = {SPI1, SPI2, SPI3, SPI4, SPI5, SPI6};
+
+const mcu_periph_obj_t mcu_spi_sck_list[18] = {
+ PERIPH(1, 5, &pin_PA05),
+ PERIPH(6, 8, &pin_PA05),
+ PERIPH(2, 5, &pin_PA09),
+ PERIPH(2, 5, &pin_PA12),
+ PERIPH(1, 5, &pin_PB03),
+ PERIPH(3, 6, &pin_PB03),
+ PERIPH(6, 8, &pin_PB03),
+ PERIPH(2, 5, &pin_PB10),
+ PERIPH(2, 5, &pin_PB13),
+ PERIPH(3, 6, &pin_PC10),
+ PERIPH(2, 5, &pin_PD03),
+ PERIPH(4, 5, &pin_PE02),
+ PERIPH(4, 5, &pin_PE12),
+ PERIPH(5, 5, &pin_PF07),
+ PERIPH(1, 5, &pin_PG11),
+ PERIPH(6, 5, &pin_PG13),
+ PERIPH(5, 5, &pin_PH06),
+ PERIPH(2, 5, &pin_PI01),
+};
+const mcu_periph_obj_t mcu_spi_mosi_list[18] = {
+ PERIPH(1, 5, &pin_PA07),
+ PERIPH(6, 8, &pin_PA07),
+ PERIPH(3, 7, &pin_PB02),
+ PERIPH(1, 5, &pin_PB05),
+ PERIPH(3, 6, &pin_PB05),
+ PERIPH(6, 8, &pin_PB05),
+ PERIPH(2, 5, &pin_PB15),
+ PERIPH(2, 5, &pin_PC01),
+ PERIPH(2, 5, &pin_PC03),
+ PERIPH(3, 6, &pin_PC12),
+ PERIPH(3, 5, &pin_PD06),
+ PERIPH(1, 5, &pin_PD07),
+ PERIPH(4, 5, &pin_PE06),
+ PERIPH(4, 5, &pin_PE14),
+ PERIPH(5, 5, &pin_PF09),
+ PERIPH(5, 5, &pin_PF11),
+ PERIPH(6, 5, &pin_PG14),
+ PERIPH(2, 5, &pin_PI03),
+};
+const mcu_periph_obj_t mcu_spi_miso_list[15] = {
+ PERIPH(1, 5, &pin_PA06),
+ PERIPH(6, 8, &pin_PA06),
+ PERIPH(1, 5, &pin_PB04),
+ PERIPH(3, 6, &pin_PB04),
+ PERIPH(6, 8, &pin_PB04),
+ PERIPH(2, 5, &pin_PB14),
+ PERIPH(2, 5, &pin_PC02),
+ PERIPH(3, 6, &pin_PC11),
+ PERIPH(4, 5, &pin_PE05),
+ PERIPH(4, 5, &pin_PE13),
+ PERIPH(5, 5, &pin_PF08),
+ PERIPH(1, 5, &pin_PG09),
+ PERIPH(6, 5, &pin_PG12),
+ PERIPH(5, 5, &pin_PH07),
+ PERIPH(2, 5, &pin_PI02),
+};
+
+//UART
+
+USART_TypeDef * mcu_uart_banks[MAX_UART] = {USART1, USART2, USART3, UART4, UART5, USART6, UART7, UART8};
+bool mcu_uart_has_usart[MAX_UART] = {true, true, true, true, true, true, true, true};
+
+const mcu_periph_obj_t mcu_uart_tx_list[24] = {
+ PERIPH(4, 8, &pin_PA00),
+ PERIPH(2, 7, &pin_PA02),
+ PERIPH(1, 7, &pin_PA09),
+ PERIPH(4, 6, &pin_PA12),
+ PERIPH(7, 12, &pin_PA15),
+ PERIPH(7, 12, &pin_PB04),
+ PERIPH(5, 1, &pin_PB06),
+ PERIPH(1, 7, &pin_PB06),
+ PERIPH(5, 7, &pin_PB09),
+ PERIPH(3, 7, &pin_PB10),
+ PERIPH(5, 8, &pin_PB13),
+ PERIPH(1, 4, &pin_PB14),
+ PERIPH(6, 8, &pin_PC06),
+ PERIPH(3, 7, &pin_PC10),
+ PERIPH(4, 8, &pin_PC10),
+ PERIPH(5, 8, &pin_PC12),
+ PERIPH(4, 8, &pin_PD01),
+ PERIPH(2, 7, &pin_PD05),
+ PERIPH(3, 7, &pin_PD08),
+ PERIPH(8, 8, &pin_PE01),
+ PERIPH(7, 8, &pin_PE08),
+ PERIPH(7, 8, &pin_PF07),
+ PERIPH(6, 8, &pin_PG14),
+ PERIPH(4, 8, &pin_PH13),
+};
+const mcu_periph_obj_t mcu_uart_rx_list[25] = {
+ PERIPH(4, 8, &pin_PA01),
+ PERIPH(2, 7, &pin_PA03),
+ PERIPH(7, 12, &pin_PA08),
+ PERIPH(1, 7, &pin_PA10),
+ PERIPH(4, 6, &pin_PA11),
+ PERIPH(7, 12, &pin_PB03),
+ PERIPH(5, 1, &pin_PB05),
+ PERIPH(1, 7, &pin_PB07),
+ PERIPH(5, 7, &pin_PB08),
+ PERIPH(3, 7, &pin_PB11),
+ PERIPH(5, 8, &pin_PB12),
+ PERIPH(1, 4, &pin_PB15),
+ PERIPH(6, 8, &pin_PC07),
+ PERIPH(3, 7, &pin_PC11),
+ PERIPH(4, 8, &pin_PC11),
+ PERIPH(4, 8, &pin_PD00),
+ PERIPH(5, 8, &pin_PD02),
+ PERIPH(2, 7, &pin_PD06),
+ PERIPH(3, 7, &pin_PD09),
+ PERIPH(8, 8, &pin_PE00),
+ PERIPH(7, 8, &pin_PE07),
+ PERIPH(7, 8, &pin_PF06),
+ PERIPH(6, 8, &pin_PG09),
+ PERIPH(4, 8, &pin_PH14),
+ PERIPH(4, 8, &pin_PI09),
+};
+
+//Timers
+//TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
+//TODO: H7 has more timers than this, but are they tied to pins?
+TIM_TypeDef * mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, TIM8, NULL, NULL,
+ NULL, TIM12, TIM13, TIM14};
+
+const mcu_tim_pin_obj_t mcu_tim_pin_list[55] = {
+ TIM(2, 1, 1, &pin_PA00),
+ TIM(5, 2, 1, &pin_PA00),
+ TIM(2, 1, 2, &pin_PA01),
+ TIM(5, 2, 2, &pin_PA01),
+ TIM(2, 1, 3, &pin_PA02),
+ TIM(5, 2, 3, &pin_PA02),
+ TIM(9, 3, 1, &pin_PA02),
+ TIM(2, 1, 4, &pin_PA03),
+ TIM(5, 2, 4, &pin_PA03),
+ TIM(9, 3, 2, &pin_PA03),
+ TIM(2, 1, 1, &pin_PA05),
+ TIM(3, 2, 1, &pin_PA06),
+ TIM(3, 2, 2, &pin_PA07),
+ TIM(1, 1, 1, &pin_PA08),
+ TIM(1, 1, 2, &pin_PA09),
+ TIM(1, 1, 3, &pin_PA10),
+ TIM(1, 1, 4, &pin_PA11),
+ TIM(2, 1, 1, &pin_PA15),
+ TIM(3, 2, 3, &pin_PB00),
+ TIM(3, 2, 4, &pin_PB01),
+ TIM(2, 1, 2, &pin_PB03),
+ TIM(3, 2, 1, &pin_PB04),
+ TIM(3, 2, 2, &pin_PB05),
+ TIM(4, 2, 1, &pin_PB06),
+ TIM(4, 2, 2, &pin_PB07),
+ TIM(4, 2, 3, &pin_PB08),
+ TIM(4, 2, 4, &pin_PB09),
+ TIM(2, 1, 3, &pin_PB10),
+ TIM(2, 1, 4, &pin_PB11),
+ TIM(3, 2, 1, &pin_PC06),
+ TIM(8, 3, 1, &pin_PC06),
+ TIM(3, 2, 2, &pin_PC07),
+ TIM(8, 3, 2, &pin_PC07),
+ TIM(3, 2, 3, &pin_PC08),
+ TIM(8, 3, 3, &pin_PC08),
+ TIM(3, 2, 4, &pin_PC09),
+ TIM(8, 3, 4, &pin_PC09),
+ TIM(4, 2, 1, &pin_PD12),
+ TIM(4, 2, 2, &pin_PD13),
+ TIM(4, 2, 3, &pin_PD14),
+ TIM(4, 2, 4, &pin_PD15),
+ TIM(9, 3, 1, &pin_PE05),
+ TIM(9, 3, 2, &pin_PE06),
+ TIM(1, 1, 1, &pin_PE09),
+ TIM(1, 1, 2, &pin_PE11),
+ TIM(1, 1, 3, &pin_PE13),
+ TIM(1, 1, 4, &pin_PE14),
+ TIM(5, 2, 1, &pin_PH10),
+ TIM(5, 2, 2, &pin_PH11),
+ TIM(5, 2, 3, &pin_PH12),
+ TIM(5, 2, 4, &pin_PI00),
+ TIM(8, 3, 4, &pin_PI02),
+ TIM(8, 3, 1, &pin_PI05),
+ TIM(8, 3, 2, &pin_PI06),
+ TIM(8, 3, 3, &pin_PI07),
+};
diff --git a/ports/stm/peripherals/stm32f7/stm32f767xx/periph.h b/ports/stm/peripherals/stm32f7/stm32f767xx/periph.h
new file mode 100644
index 000000000..f1878ee2e
--- /dev/null
+++ b/ports/stm/peripherals/stm32f7/stm32f767xx/periph.h
@@ -0,0 +1,55 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Lucian Copeland 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.
+ */
+
+#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F767XX_PERIPH_H
+#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F767XX_PERIPH_H
+
+//I2C
+extern I2C_TypeDef * mcu_i2c_banks[4];
+
+const mcu_periph_obj_t mcu_i2c_sda_list[12];
+const mcu_periph_obj_t mcu_i2c_scl_list[12];
+
+//SPI
+extern SPI_TypeDef * mcu_spi_banks[6];
+
+const mcu_periph_obj_t mcu_spi_sck_list[18];
+const mcu_periph_obj_t mcu_spi_mosi_list[18];
+const mcu_periph_obj_t mcu_spi_miso_list[15];
+
+//UART
+extern USART_TypeDef * mcu_uart_banks[MAX_UART];
+extern bool mcu_uart_has_usart[MAX_UART];
+
+const mcu_periph_obj_t mcu_uart_tx_list[24];
+const mcu_periph_obj_t mcu_uart_rx_list[25];
+
+//Timers
+#define TIM_BANK_ARRAY_LEN 14
+#define TIM_PIN_ARRAY_LEN 55
+TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
+
+#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F767XX_PERIPH_H \ No newline at end of file
diff --git a/ports/stm/peripherals/stm32f7/stm32f767xx/pins.c b/ports/stm/peripherals/stm32f7/stm32f767xx/pins.c
new file mode 100644
index 000000000..870545f99
--- /dev/null
+++ b/ports/stm/peripherals/stm32f7/stm32f767xx/pins.c
@@ -0,0 +1,200 @@
+ /*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Lucian Copeland 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 "py/obj.h"
+#include "py/mphal.h"
+#include "peripherals/pins.h"
+
+// Todo: some pins do have ADCs, but the module isn't set up yet.
+
+const mcu_pin_obj_t pin_PA00 = PIN(0, 0, NO_ADC);
+const mcu_pin_obj_t pin_PA01 = PIN(0, 1, NO_ADC);
+const mcu_pin_obj_t pin_PA02 = PIN(0, 2, NO_ADC);
+const mcu_pin_obj_t pin_PA03 = PIN(0, 3, NO_ADC);
+const mcu_pin_obj_t pin_PA04 = PIN(0, 4, NO_ADC);
+const mcu_pin_obj_t pin_PA05 = PIN(0, 5, NO_ADC);
+const mcu_pin_obj_t pin_PA06 = PIN(0, 6, NO_ADC);
+const mcu_pin_obj_t pin_PA07 = PIN(0, 7, NO_ADC);
+const mcu_pin_obj_t pin_PA08 = PIN(0, 8, NO_ADC);
+const mcu_pin_obj_t pin_PA09 = PIN(0, 9, NO_ADC);
+const mcu_pin_obj_t pin_PA10 = PIN(0, 10, NO_ADC);
+const mcu_pin_obj_t pin_PA11 = PIN(0, 11, NO_ADC);
+const mcu_pin_obj_t pin_PA12 = PIN(0, 12, NO_ADC);
+const mcu_pin_obj_t pin_PA13 = PIN(0, 13, NO_ADC);
+const mcu_pin_obj_t pin_PA14 = PIN(0, 14, NO_ADC);
+const mcu_pin_obj_t pin_PA15 = PIN(0, 15, NO_ADC);
+const mcu_pin_obj_t pin_PB00 = PIN(1, 0, NO_ADC);
+const mcu_pin_obj_t pin_PB01 = PIN(1, 1, NO_ADC);
+const mcu_pin_obj_t pin_PB02 = PIN(1, 2, NO_ADC);
+const mcu_pin_obj_t pin_PB03 = PIN(1, 3, NO_ADC);
+const mcu_pin_obj_t pin_PB04 = PIN(1, 4, NO_ADC);
+const mcu_pin_obj_t pin_PB05 = PIN(1, 5, NO_ADC);
+const mcu_pin_obj_t pin_PB06 = PIN(1, 6, NO_ADC);
+const mcu_pin_obj_t pin_PB07 = PIN(1, 7, NO_ADC);
+const mcu_pin_obj_t pin_PB08 = PIN(1, 8, NO_ADC);
+const mcu_pin_obj_t pin_PB09 = PIN(1, 9, NO_ADC);
+const mcu_pin_obj_t pin_PB10 = PIN(1, 10, NO_ADC);
+const mcu_pin_obj_t pin_PB11 = PIN(1, 11, NO_ADC);
+const mcu_pin_obj_t pin_PB12 = PIN(1, 12, NO_ADC);
+const mcu_pin_obj_t pin_PB13 = PIN(1, 13, NO_ADC);
+const mcu_pin_obj_t pin_PB14 = PIN(1, 14, NO_ADC);
+const mcu_pin_obj_t pin_PB15 = PIN(1, 15, NO_ADC);
+const mcu_pin_obj_t pin_PC00 = PIN(2, 0, NO_ADC);
+const mcu_pin_obj_t pin_PC01 = PIN(2, 1, NO_ADC);
+const mcu_pin_obj_t pin_PC02 = PIN(2, 2, NO_ADC);
+const mcu_pin_obj_t pin_PC03 = PIN(2, 3, NO_ADC);
+const mcu_pin_obj_t pin_PC04 = PIN(2, 4, NO_ADC);
+const mcu_pin_obj_t pin_PC05 = PIN(2, 5, NO_ADC);
+const mcu_pin_obj_t pin_PC06 = PIN(2, 6, NO_ADC);
+const mcu_pin_obj_t pin_PC07 = PIN(2, 7, NO_ADC);
+const mcu_pin_obj_t pin_PC08 = PIN(2, 8, NO_ADC);
+const mcu_pin_obj_t pin_PC09 = PIN(2, 9, NO_ADC);
+const mcu_pin_obj_t pin_PC10 = PIN(2, 10, NO_ADC);
+const mcu_pin_obj_t pin_PC11 = PIN(2, 11, NO_ADC);
+const mcu_pin_obj_t pin_PC12 = PIN(2, 12, NO_ADC);
+const mcu_pin_obj_t pin_PC13 = PIN(2, 13, NO_ADC);
+const mcu_pin_obj_t pin_PC14 = PIN(2, 14, NO_ADC);
+const mcu_pin_obj_t pin_PC15 = PIN(2, 15, NO_ADC);
+const mcu_pin_obj_t pin_PD00 = PIN(3, 0, NO_ADC);
+const mcu_pin_obj_t pin_PD01 = PIN(3, 1, NO_ADC);
+const mcu_pin_obj_t pin_PD02 = PIN(3, 2, NO_ADC);
+const mcu_pin_obj_t pin_PD03 = PIN(3, 3, NO_ADC);
+const mcu_pin_obj_t pin_PD04 = PIN(3, 4, NO_ADC);
+const mcu_pin_obj_t pin_PD05 = PIN(3, 5, NO_ADC);
+const mcu_pin_obj_t pin_PD06 = PIN(3, 6, NO_ADC);
+const mcu_pin_obj_t pin_PD07 = PIN(3, 7, NO_ADC);
+const mcu_pin_obj_t pin_PD08 = PIN(3, 8, NO_ADC);
+const mcu_pin_obj_t pin_PD09 = PIN(3, 9, NO_ADC);
+const mcu_pin_obj_t pin_PD10 = PIN(3, 10, NO_ADC);
+const mcu_pin_obj_t pin_PD11 = PIN(3, 11, NO_ADC);
+const mcu_pin_obj_t pin_PD12 = PIN(3, 12, NO_ADC);
+const mcu_pin_obj_t pin_PD13 = PIN(3, 13, NO_ADC);
+const mcu_pin_obj_t pin_PD14 = PIN(3, 14, NO_ADC);
+const mcu_pin_obj_t pin_PD15 = PIN(3, 15, NO_ADC);
+const mcu_pin_obj_t pin_PE00 = PIN(4, 0, NO_ADC);
+const mcu_pin_obj_t pin_PE01 = PIN(4, 1, NO_ADC);
+const mcu_pin_obj_t pin_PE02 = PIN(4, 2, NO_ADC);
+const mcu_pin_obj_t pin_PE03 = PIN(4, 3, NO_ADC);
+const mcu_pin_obj_t pin_PE04 = PIN(4, 4, NO_ADC);
+const mcu_pin_obj_t pin_PE05 = PIN(4, 5, NO_ADC);
+const mcu_pin_obj_t pin_PE06 = PIN(4, 6, NO_ADC);
+const mcu_pin_obj_t pin_PE07 = PIN(4, 7, NO_ADC);
+const mcu_pin_obj_t pin_PE08 = PIN(4, 8, NO_ADC);
+const mcu_pin_obj_t pin_PE09 = PIN(4, 9, NO_ADC);
+const mcu_pin_obj_t pin_PE10 = PIN(4, 10, NO_ADC);
+const mcu_pin_obj_t pin_PE11 = PIN(4, 11, NO_ADC);
+const mcu_pin_obj_t pin_PE12 = PIN(4, 12, NO_ADC);
+const mcu_pin_obj_t pin_PE13 = PIN(4, 13, NO_ADC);
+const mcu_pin_obj_t pin_PE14 = PIN(4, 14, NO_ADC);
+const mcu_pin_obj_t pin_PE15 = PIN(4, 15, NO_ADC);
+const mcu_pin_obj_t pin_PF00 = PIN(5, 0, NO_ADC);
+const mcu_pin_obj_t pin_PF01 = PIN(5, 1, NO_ADC);
+const mcu_pin_obj_t pin_PF02 = PIN(5, 2, NO_ADC);
+const mcu_pin_obj_t pin_PF03 = PIN(5, 3, NO_ADC);
+const mcu_pin_obj_t pin_PF04 = PIN(5, 4, NO_ADC);
+const mcu_pin_obj_t pin_PF05 = PIN(5, 5, NO_ADC);
+const mcu_pin_obj_t pin_PF06 = PIN(5, 6, NO_ADC);
+const mcu_pin_obj_t pin_PF07 = PIN(5, 7, NO_ADC);
+const mcu_pin_obj_t pin_PF08 = PIN(5, 8, NO_ADC);
+const mcu_pin_obj_t pin_PF09 = PIN(5, 9, NO_ADC);
+const mcu_pin_obj_t pin_PF10 = PIN(5, 10, NO_ADC);
+const mcu_pin_obj_t pin_PF11 = PIN(5, 11, NO_ADC);
+const mcu_pin_obj_t pin_PF12 = PIN(5, 12, NO_ADC);
+const mcu_pin_obj_t pin_PF13 = PIN(5, 13, NO_ADC);
+const mcu_pin_obj_t pin_PF14 = PIN(5, 14, NO_ADC);
+const mcu_pin_obj_t pin_PF15 = PIN(5, 15, NO_ADC);
+const mcu_pin_obj_t pin_PG00 = PIN(6, 0, NO_ADC);
+const mcu_pin_obj_t pin_PG01 = PIN(6, 1, NO_ADC);
+const mcu_pin_obj_t pin_PG02 = PIN(6, 2, NO_ADC);
+const mcu_pin_obj_t pin_PG03 = PIN(6, 3, NO_ADC);
+const mcu_pin_obj_t pin_PG04 = PIN(6, 4, NO_ADC);
+const mcu_pin_obj_t pin_PG05 = PIN(6, 5, NO_ADC);
+const mcu_pin_obj_t pin_PG06 = PIN(6, 6, NO_ADC);
+const mcu_pin_obj_t pin_PG07 = PIN(6, 7, NO_ADC);
+const mcu_pin_obj_t pin_PG08 = PIN(6, 8, NO_ADC);
+const mcu_pin_obj_t pin_PG09 = PIN(6, 9, NO_ADC);
+const mcu_pin_obj_t pin_PG10 = PIN(6, 10, NO_ADC);
+const mcu_pin_obj_t pin_PG11 = PIN(6, 11, NO_ADC);
+const mcu_pin_obj_t pin_PG12 = PIN(6, 12, NO_ADC);
+const mcu_pin_obj_t pin_PG13 = PIN(6, 13, NO_ADC);
+const mcu_pin_obj_t pin_PG14 = PIN(6, 14, NO_ADC);
+const mcu_pin_obj_t pin_PG15 = PIN(6, 15, NO_ADC);
+const mcu_pin_obj_t pin_PH00 = PIN(7, 0, NO_ADC);
+const mcu_pin_obj_t pin_PH01 = PIN(7, 1, NO_ADC);
+const mcu_pin_obj_t pin_PH02 = PIN(7, 2, NO_ADC);
+const mcu_pin_obj_t pin_PH03 = PIN(7, 3, NO_ADC);
+const mcu_pin_obj_t pin_PH04 = PIN(7, 4, NO_ADC);
+const mcu_pin_obj_t pin_PH05 = PIN(7, 5, NO_ADC);
+const mcu_pin_obj_t pin_PH06 = PIN(7, 6, NO_ADC);
+const mcu_pin_obj_t pin_PH07 = PIN(7, 7, NO_ADC);
+const mcu_pin_obj_t pin_PH08 = PIN(7, 8, NO_ADC);
+const mcu_pin_obj_t pin_PH09 = PIN(7, 9, NO_ADC);
+const mcu_pin_obj_t pin_PH10 = PIN(7, 10, NO_ADC);
+const mcu_pin_obj_t pin_PH11 = PIN(7, 11, NO_ADC);
+const mcu_pin_obj_t pin_PH12 = PIN(7, 12, NO_ADC);
+const mcu_pin_obj_t pin_PH13 = PIN(7, 13, NO_ADC);
+const mcu_pin_obj_t pin_PH14 = PIN(7, 14, NO_ADC);
+const mcu_pin_obj_t pin_PH15 = PIN(7, 15, NO_ADC);
+const mcu_pin_obj_t pin_PI00 = PIN(8, 0, NO_ADC);
+const mcu_pin_obj_t pin_PI01 = PIN(8, 1, NO_ADC);
+const mcu_pin_obj_t pin_PI02 = PIN(8, 2, NO_ADC);
+const mcu_pin_obj_t pin_PI03 = PIN(8, 3, NO_ADC);
+const mcu_pin_obj_t pin_PI04 = PIN(8, 4, NO_ADC);
+const mcu_pin_obj_t pin_PI05 = PIN(8, 5, NO_ADC);
+const mcu_pin_obj_t pin_PI06 = PIN(8, 6, NO_ADC);
+const mcu_pin_obj_t pin_PI07 = PIN(8, 7, NO_ADC);
+const mcu_pin_obj_t pin_PI08 = PIN(8, 8, NO_ADC);
+const mcu_pin_obj_t pin_PI09 = PIN(8, 9, NO_ADC);
+const mcu_pin_obj_t pin_PI10 = PIN(8, 10, NO_ADC);
+const mcu_pin_obj_t pin_PI11 = PIN(8, 11, NO_ADC);
+const mcu_pin_obj_t pin_PI12 = PIN(8, 12, NO_ADC);
+const mcu_pin_obj_t pin_PI13 = PIN(8, 13, NO_ADC);
+const mcu_pin_obj_t pin_PI14 = PIN(8, 14, NO_ADC);
+const mcu_pin_obj_t pin_PI15 = PIN(8, 15, NO_ADC);
+const mcu_pin_obj_t pin_PJ00 = PIN(9, 0, NO_ADC);
+const mcu_pin_obj_t pin_PJ01 = PIN(9, 1, NO_ADC);
+const mcu_pin_obj_t pin_PJ02 = PIN(9, 2, NO_ADC);
+const mcu_pin_obj_t pin_PJ03 = PIN(9, 3, NO_ADC);
+const mcu_pin_obj_t pin_PJ04 = PIN(9, 4, NO_ADC);
+const mcu_pin_obj_t pin_PJ05 = PIN(9, 5, NO_ADC);
+const mcu_pin_obj_t pin_PJ06 = PIN(9, 6, NO_ADC);
+const mcu_pin_obj_t pin_PJ07 = PIN(9, 7, NO_ADC);
+const mcu_pin_obj_t pin_PJ08 = PIN(9, 8, NO_ADC);
+const mcu_pin_obj_t pin_PJ09 = PIN(9, 9, NO_ADC);
+const mcu_pin_obj_t pin_PJ10 = PIN(9, 10, NO_ADC);
+const mcu_pin_obj_t pin_PJ11 = PIN(9, 11, NO_ADC);
+const mcu_pin_obj_t pin_PJ12 = PIN(9, 12, NO_ADC);
+const mcu_pin_obj_t pin_PJ13 = PIN(9, 13, NO_ADC);
+const mcu_pin_obj_t pin_PJ14 = PIN(9, 14, NO_ADC);
+const mcu_pin_obj_t pin_PJ15 = PIN(9, 15, NO_ADC);
+const mcu_pin_obj_t pin_PK00 = PIN(10, 0, NO_ADC);
+const mcu_pin_obj_t pin_PK01 = PIN(10, 1, NO_ADC);
+const mcu_pin_obj_t pin_PK02 = PIN(10, 2, NO_ADC);
+const mcu_pin_obj_t pin_PK03 = PIN(10, 3, NO_ADC);
+const mcu_pin_obj_t pin_PK04 = PIN(10, 4, NO_ADC);
+const mcu_pin_obj_t pin_PK05 = PIN(10, 5, NO_ADC);
+const mcu_pin_obj_t pin_PK06 = PIN(10, 6, NO_ADC);
+const mcu_pin_obj_t pin_PK07 = PIN(10, 7, NO_ADC);
diff --git a/ports/stm/peripherals/stm32f7/stm32f767xx/pins.h b/ports/stm/peripherals/stm32f7/stm32f767xx/pins.h
new file mode 100644
index 000000000..e0f2bb056
--- /dev/null
+++ b/ports/stm/peripherals/stm32f7/stm32f767xx/pins.h
@@ -0,0 +1,199 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Lucian Copeland 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.
+ */
+
+#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F767XX_PINS_H
+#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F767XX_PINS_H
+
+extern const mcu_pin_obj_t pin_PA00;
+extern const mcu_pin_obj_t pin_PA01;
+extern const mcu_pin_obj_t pin_PA02;
+extern const mcu_pin_obj_t pin_PA03;
+extern const mcu_pin_obj_t pin_PA04;
+extern const mcu_pin_obj_t pin_PA05;
+extern const mcu_pin_obj_t pin_PA06;
+extern const mcu_pin_obj_t pin_PA07;
+extern const mcu_pin_obj_t pin_PA08;
+extern const mcu_pin_obj_t pin_PA09;
+extern const mcu_pin_obj_t pin_PA10;
+extern const mcu_pin_obj_t pin_PA11;
+extern const mcu_pin_obj_t pin_PA12;
+extern const mcu_pin_obj_t pin_PA13;
+extern const mcu_pin_obj_t pin_PA14;
+extern const mcu_pin_obj_t pin_PA15;
+extern const mcu_pin_obj_t pin_PB00;
+extern const mcu_pin_obj_t pin_PB01;
+extern const mcu_pin_obj_t pin_PB02;
+extern const mcu_pin_obj_t pin_PB03;
+extern const mcu_pin_obj_t pin_PB04;
+extern const mcu_pin_obj_t pin_PB05;
+extern const mcu_pin_obj_t pin_PB06;
+extern const mcu_pin_obj_t pin_PB07;
+extern const mcu_pin_obj_t pin_PB08;
+extern const mcu_pin_obj_t pin_PB09;
+extern const mcu_pin_obj_t pin_PB10;
+extern const mcu_pin_obj_t pin_PB11;
+extern const mcu_pin_obj_t pin_PB12;
+extern const mcu_pin_obj_t pin_PB13;
+extern const mcu_pin_obj_t pin_PB14;
+extern const mcu_pin_obj_t pin_PB15;
+extern const mcu_pin_obj_t pin_PC00;
+extern const mcu_pin_obj_t pin_PC01;
+extern const mcu_pin_obj_t pin_PC02;
+extern const mcu_pin_obj_t pin_PC03;
+extern const mcu_pin_obj_t pin_PC04;
+extern const mcu_pin_obj_t pin_PC05;
+extern const mcu_pin_obj_t pin_PC06;
+extern const mcu_pin_obj_t pin_PC07;
+extern const mcu_pin_obj_t pin_PC08;
+extern const mcu_pin_obj_t pin_PC09;
+extern const mcu_pin_obj_t pin_PC10;
+extern const mcu_pin_obj_t pin_PC11;
+extern const mcu_pin_obj_t pin_PC12;
+extern const mcu_pin_obj_t pin_PC13;
+extern const mcu_pin_obj_t pin_PC14;
+extern const mcu_pin_obj_t pin_PC15;
+extern const mcu_pin_obj_t pin_PD00;
+extern const mcu_pin_obj_t pin_PD01;
+extern const mcu_pin_obj_t pin_PD02;
+extern const mcu_pin_obj_t pin_PD03;
+extern const mcu_pin_obj_t pin_PD04;
+extern const mcu_pin_obj_t pin_PD05;
+extern const mcu_pin_obj_t pin_PD06;
+extern const mcu_pin_obj_t pin_PD07;
+extern const mcu_pin_obj_t pin_PD08;
+extern const mcu_pin_obj_t pin_PD09;
+extern const mcu_pin_obj_t pin_PD10;
+extern const mcu_pin_obj_t pin_PD11;
+extern const mcu_pin_obj_t pin_PD12;
+extern const mcu_pin_obj_t pin_PD13;
+extern const mcu_pin_obj_t pin_PD14;
+extern const mcu_pin_obj_t pin_PD15;
+extern const mcu_pin_obj_t pin_PE00;
+extern const mcu_pin_obj_t pin_PE01;
+extern const mcu_pin_obj_t pin_PE02;
+extern const mcu_pin_obj_t pin_PE03;
+extern const mcu_pin_obj_t pin_PE04;
+extern const mcu_pin_obj_t pin_PE05;
+extern const mcu_pin_obj_t pin_PE06;
+extern const mcu_pin_obj_t pin_PE07;
+extern const mcu_pin_obj_t pin_PE08;
+extern const mcu_pin_obj_t pin_PE09;
+extern const mcu_pin_obj_t pin_PE10;
+extern const mcu_pin_obj_t pin_PE11;
+extern const mcu_pin_obj_t pin_PE12;
+extern const mcu_pin_obj_t pin_PE13;
+extern const mcu_pin_obj_t pin_PE14;
+extern const mcu_pin_obj_t pin_PE15;
+extern const mcu_pin_obj_t pin_PF00;
+extern const mcu_pin_obj_t pin_PF01;
+extern const mcu_pin_obj_t pin_PF02;
+extern const mcu_pin_obj_t pin_PF03;
+extern const mcu_pin_obj_t pin_PF04;
+extern const mcu_pin_obj_t pin_PF05;
+extern const mcu_pin_obj_t pin_PF06;
+extern const mcu_pin_obj_t pin_PF07;
+extern const mcu_pin_obj_t pin_PF08;
+extern const mcu_pin_obj_t pin_PF09;
+extern const mcu_pin_obj_t pin_PF10;
+extern const mcu_pin_obj_t pin_PF11;
+extern const mcu_pin_obj_t pin_PF12;
+extern const mcu_pin_obj_t pin_PF13;
+extern const mcu_pin_obj_t pin_PF14;
+extern const mcu_pin_obj_t pin_PF15;
+extern const mcu_pin_obj_t pin_PG00;
+extern const mcu_pin_obj_t pin_PG01;
+extern const mcu_pin_obj_t pin_PG02;
+extern const mcu_pin_obj_t pin_PG03;
+extern const mcu_pin_obj_t pin_PG04;
+extern const mcu_pin_obj_t pin_PG05;
+extern const mcu_pin_obj_t pin_PG06;
+extern const mcu_pin_obj_t pin_PG07;
+extern const mcu_pin_obj_t pin_PG08;
+extern const mcu_pin_obj_t pin_PG09;
+extern const mcu_pin_obj_t pin_PG10;
+extern const mcu_pin_obj_t pin_PG11;
+extern const mcu_pin_obj_t pin_PG12;
+extern const mcu_pin_obj_t pin_PG13;
+extern const mcu_pin_obj_t pin_PG14;
+extern const mcu_pin_obj_t pin_PG15;
+extern const mcu_pin_obj_t pin_PH00;
+extern const mcu_pin_obj_t pin_PH01;
+extern const mcu_pin_obj_t pin_PH02;
+extern const mcu_pin_obj_t pin_PH03;
+extern const mcu_pin_obj_t pin_PH04;
+extern const mcu_pin_obj_t pin_PH05;
+extern const mcu_pin_obj_t pin_PH06;
+extern const mcu_pin_obj_t pin_PH07;
+extern const mcu_pin_obj_t pin_PH08;
+extern const mcu_pin_obj_t pin_PH09;
+extern const mcu_pin_obj_t pin_PH10;
+extern const mcu_pin_obj_t pin_PH11;
+extern const mcu_pin_obj_t pin_PH12;
+extern const mcu_pin_obj_t pin_PH13;
+extern const mcu_pin_obj_t pin_PH14;
+extern const mcu_pin_obj_t pin_PH15;
+extern const mcu_pin_obj_t pin_PI00;
+extern const mcu_pin_obj_t pin_PI01;
+extern const mcu_pin_obj_t pin_PI02;
+extern const mcu_pin_obj_t pin_PI03;
+extern const mcu_pin_obj_t pin_PI04;
+extern const mcu_pin_obj_t pin_PI05;
+extern const mcu_pin_obj_t pin_PI06;
+extern const mcu_pin_obj_t pin_PI07;
+extern const mcu_pin_obj_t pin_PI08;
+extern const mcu_pin_obj_t pin_PI09;
+extern const mcu_pin_obj_t pin_PI10;
+extern const mcu_pin_obj_t pin_PI11;
+extern const mcu_pin_obj_t pin_PI12;
+extern const mcu_pin_obj_t pin_PI13;
+extern const mcu_pin_obj_t pin_PI14;
+extern const mcu_pin_obj_t pin_PI15;
+extern const mcu_pin_obj_t pin_PJ00;
+extern const mcu_pin_obj_t pin_PJ01;
+extern const mcu_pin_obj_t pin_PJ02;
+extern const mcu_pin_obj_t pin_PJ03;
+extern const mcu_pin_obj_t pin_PJ04;
+extern const mcu_pin_obj_t pin_PJ05;
+extern const mcu_pin_obj_t pin_PJ06;
+extern const mcu_pin_obj_t pin_PJ07;
+extern const mcu_pin_obj_t pin_PJ08;
+extern const mcu_pin_obj_t pin_PJ09;
+extern const mcu_pin_obj_t pin_PJ10;
+extern const mcu_pin_obj_t pin_PJ11;
+extern const mcu_pin_obj_t pin_PJ12;
+extern const mcu_pin_obj_t pin_PJ13;
+extern const mcu_pin_obj_t pin_PJ14;
+extern const mcu_pin_obj_t pin_PJ15;
+extern const mcu_pin_obj_t pin_PK00;
+extern const mcu_pin_obj_t pin_PK01;
+extern const mcu_pin_obj_t pin_PK02;
+extern const mcu_pin_obj_t pin_PK03;
+extern const mcu_pin_obj_t pin_PK04;
+extern const mcu_pin_obj_t pin_PK05;
+extern const mcu_pin_obj_t pin_PK06;
+extern const mcu_pin_obj_t pin_PK07;
+
+#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F767XX_PINS_H
diff --git a/ports/stm/peripherals/stm32h7/stm32h743xx/clocks.c b/ports/stm/peripherals/stm32h7/stm32h743xx/clocks.c
new file mode 100644
index 000000000..d231f25d0
--- /dev/null
+++ b/ports/stm/peripherals/stm32h7/stm32h743xx/clocks.c
@@ -0,0 +1,83 @@
+
+/*
+ * This file is part of the Micro Python project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Lucian Copeland 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 "py/mpconfig.h"
+
+void stm32_peripherals_clocks_init(void) {
+ RCC_ClkInitTypeDef RCC_ClkInitStruct;
+ RCC_OscInitTypeDef RCC_OscInitStruct;
+
+ /* The PWR block is always enabled on the H7 series- there is no clock
+ enable. For now, use the default VOS3 scale mode (lowest) and limit clock
+ frequencies to avoid potential current draw problems from bus
+ power when using the max clock speeds throughout the chip. */
+
+ /* Enable HSE Oscillator and activate PLL1 with HSE as source */
+ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
+ RCC_OscInitStruct.HSEState = RCC_HSE_ON;
+ RCC_OscInitStruct.HSIState = RCC_HSI_OFF;
+ RCC_OscInitStruct.CSIState = RCC_CSI_OFF;
+ RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
+ RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
+ RCC_OscInitStruct.PLL.PLLM = BOARD_OSC_DIV;
+ RCC_OscInitStruct.PLL.PLLN = 336;
+ RCC_OscInitStruct.PLL.PLLP = 2;
+ RCC_OscInitStruct.PLL.PLLQ = 7;
+ RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_0;
+ RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOMEDIUM;
+ RCC_OscInitStruct.PLL.PLLFRACN = 0;
+ HAL_RCC_OscConfig(&RCC_OscInitStruct);
+
+ RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | \
+ RCC_CLOCKTYPE_D1PCLK1 | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2 | \
+ RCC_CLOCKTYPE_D3PCLK1);
+ RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
+ RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1;
+ RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV1;
+
+ /* Unlike on the STM32F4 family, it appears the maximum APB frequencies are
+ device-dependent- 120 MHz for this board according to Figure 2 of
+ the datasheet. Dividing by half will be safe for now. */
+ RCC_ClkInitStruct.APB3CLKDivider = RCC_APB3_DIV2;
+ RCC_ClkInitStruct.APB1CLKDivider = RCC_APB1_DIV2;
+ RCC_ClkInitStruct.APB2CLKDivider = RCC_APB2_DIV2;
+ RCC_ClkInitStruct.APB4CLKDivider = RCC_APB4_DIV2;
+
+ /* 4 wait states required for 168MHz and VOS3. */
+ HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4);
+
+ /* Like on F4, on H7, USB's actual peripheral clock and bus clock are
+ separate. However, the main system PLL (PLL1) doesn't have a direct
+ connection to the USB peripheral clock to generate 48 MHz, so we do this
+ dance. This will connect PLL1's Q output to the USB peripheral clock. */
+ RCC_PeriphCLKInitTypeDef RCC_PeriphCLKInitStruct;
+
+ RCC_PeriphCLKInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USB;
+ RCC_PeriphCLKInitStruct.UsbClockSelection = RCC_USBCLKSOURCE_PLL;
+ HAL_RCCEx_PeriphCLKConfig(&RCC_PeriphCLKInitStruct);
+
+}
diff --git a/ports/stm/peripherals/stm32h7/stm32h743xx/gpio.c b/ports/stm/peripherals/stm32h7/stm32h743xx/gpio.c
new file mode 100644
index 000000000..d51ff53c1
--- /dev/null
+++ b/ports/stm/peripherals/stm32h7/stm32h743xx/gpio.c
@@ -0,0 +1,48 @@
+/*
+ * This file is part of the Micro Python project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Lucian Copeland 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 "gpio.h"
+#include "common-hal/microcontroller/Pin.h"
+
+void stm32_peripherals_gpio_init(void) {
+ //Enable all GPIO for now
+ __HAL_RCC_GPIOE_CLK_ENABLE();
+ __HAL_RCC_GPIOC_CLK_ENABLE();
+ __HAL_RCC_GPIOF_CLK_ENABLE();
+ __HAL_RCC_GPIOH_CLK_ENABLE();
+ __HAL_RCC_GPIOA_CLK_ENABLE();
+ __HAL_RCC_GPIOB_CLK_ENABLE();
+ __HAL_RCC_GPIOG_CLK_ENABLE();
+ __HAL_RCC_GPIOD_CLK_ENABLE();
+
+ //Never reset pins
+ never_reset_pin_number(2,14); //PC14 OSC32_IN
+ never_reset_pin_number(2,15); //PC15 OSC32_OUT
+ never_reset_pin_number(0,13); //PA13 SWDIO
+ never_reset_pin_number(0,14); //PA14 SWCLK
+}
+
+
diff --git a/ports/stm/peripherals/stm32h7/stm32h743xx/periph.c b/ports/stm/peripherals/stm32h7/stm32h743xx/periph.c
new file mode 100644
index 000000000..892164600
--- /dev/null
+++ b/ports/stm/peripherals/stm32h7/stm32h743xx/periph.c
@@ -0,0 +1,260 @@
+ /*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Lucian Copeland 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 "py/obj.h"
+#include "py/mphal.h"
+#include "peripherals/pins.h"
+#include "peripherals/periph.h"
+
+// I2C
+
+I2C_TypeDef * mcu_i2c_banks[4] = {I2C1, I2C2, I2C3, I2C4};
+
+const mcu_periph_obj_t mcu_i2c_sda_list[12] = {
+ PERIPH(1, 4, &pin_PB07),
+ PERIPH(4, 6, &pin_PB07),
+ PERIPH(1, 4, &pin_PB09),
+ PERIPH(4, 6, &pin_PB09),
+ PERIPH(2, 4, &pin_PB11),
+ PERIPH(3, 4, &pin_PC09),
+ PERIPH(4, 4, &pin_PD13),
+ PERIPH(2, 4, &pin_PF00),
+ PERIPH(4, 4, &pin_PF15),
+ PERIPH(2, 4, &pin_PH05),
+ PERIPH(3, 4, &pin_PH08),
+ PERIPH(4, 4, &pin_PH12)
+};
+
+const mcu_periph_obj_t mcu_i2c_scl_list[12] = {
+ PERIPH(3, 4, &pin_PA08),
+ PERIPH(1, 4, &pin_PB06),
+ PERIPH(4, 6, &pin_PB06),
+ PERIPH(1, 4, &pin_PB08),
+ PERIPH(4, 6, &pin_PB08),
+ PERIPH(2, 4, &pin_PB10),
+ PERIPH(4, 4, &pin_PD12),
+ PERIPH(2, 4, &pin_PF01),
+ PERIPH(4, 4, &pin_PF14),
+ PERIPH(2, 4, &pin_PH04),
+ PERIPH(3, 4, &pin_PH07),
+ PERIPH(4, 4, &pin_PH11)
+};
+
+// SPI
+
+SPI_TypeDef * mcu_spi_banks[6] = {SPI1, SPI2, SPI3, SPI4, SPI5, SPI6};
+
+const mcu_periph_obj_t mcu_spi_sck_list[19] = {
+ PERIPH(1, 5, &pin_PA05),
+ PERIPH(6, 8, &pin_PA05),
+ PERIPH(2, 5, &pin_PA09),
+ PERIPH(2, 5, &pin_PA12),
+ PERIPH(1, 5, &pin_PB03),
+ PERIPH(3, 6, &pin_PB03),
+ PERIPH(6, 8, &pin_PB03),
+ PERIPH(2, 5, &pin_PB10),
+ PERIPH(2, 5, &pin_PB13),
+ PERIPH(3, 6, &pin_PC10),
+ PERIPH(2, 5, &pin_PD03),
+ PERIPH(4, 5, &pin_PE02),
+ PERIPH(4, 5, &pin_PE12),
+ PERIPH(5, 5, &pin_PF07),
+ PERIPH(1, 5, &pin_PG11),
+ PERIPH(6, 5, &pin_PG13),
+ PERIPH(5, 5, &pin_PH06),
+ PERIPH(2, 5, &pin_PI01),
+ PERIPH(5, 5, &pin_PK00),
+};
+
+const mcu_periph_obj_t mcu_spi_mosi_list[19] = {
+ PERIPH(1, 5, &pin_PA07),
+ PERIPH(6, 8, &pin_PA07),
+ PERIPH(3, 7, &pin_PB02),
+ PERIPH(1, 5, &pin_PB05),
+ PERIPH(3, 7, &pin_PB05),
+ PERIPH(6, 8, &pin_PB05),
+ PERIPH(2, 5, &pin_PB15),
+ PERIPH(2, 5, &pin_PC01),
+ PERIPH(2, 5, &pin_PC03),
+ PERIPH(3, 6, &pin_PC12),
+ PERIPH(3, 5, &pin_PD06),
+ PERIPH(1, 5, &pin_PD07),
+ PERIPH(4, 5, &pin_PE06),
+ PERIPH(4, 5, &pin_PE14),
+ PERIPH(5, 5, &pin_PF09),
+ PERIPH(5, 5, &pin_PF11),
+ PERIPH(6, 5, &pin_PG14),
+ PERIPH(2, 5, &pin_PI03),
+ PERIPH(5, 5, &pin_PJ10),
+};
+
+const mcu_periph_obj_t mcu_spi_miso_list[16] = {
+ PERIPH(1, 5, &pin_PA06),
+ PERIPH(6, 8, &pin_PA06),
+ PERIPH(1, 5, &pin_PB04),
+ PERIPH(3, 6, &pin_PB04),
+ PERIPH(6, 8, &pin_PB04),
+ PERIPH(2, 5, &pin_PB14),
+ PERIPH(2, 5, &pin_PC02),
+ PERIPH(3, 6, &pin_PC11),
+ PERIPH(4, 5, &pin_PE05),
+ PERIPH(4, 5, &pin_PE13),
+ PERIPH(5, 5, &pin_PF08),
+ PERIPH(1, 5, &pin_PG09),
+ PERIPH(6, 5, &pin_PG12),
+ PERIPH(5, 5, &pin_PH07),
+ PERIPH(2, 5, &pin_PI02),
+ PERIPH(5, 5, &pin_PJ11),
+};
+
+//UART
+
+USART_TypeDef * mcu_uart_banks[MAX_UART] = {USART1, USART2, USART3, UART4, UART5, USART6, UART7, UART8};
+bool mcu_uart_has_usart[MAX_UART] = {true, true, true, true, true, true, true, true};
+
+const mcu_periph_obj_t mcu_uart_tx_list[25] = {
+ PERIPH(4, 8, &pin_PA00),
+ PERIPH(2, 7, &pin_PA02),
+ PERIPH(1, 7, &pin_PA09),
+ PERIPH(4, 6, &pin_PA12),
+ PERIPH(7, 11, &pin_PA15),
+ PERIPH(7, 11, &pin_PB04),
+ PERIPH(1, 7, &pin_PB06),
+ PERIPH(5, 14, &pin_PB06),
+ PERIPH(4, 8, &pin_PB09),
+ PERIPH(3, 7, &pin_PB10),
+ PERIPH(5, 14, &pin_PB13),
+ PERIPH(1, 4, &pin_PB14),
+ PERIPH(6, 7, &pin_PC06),
+ PERIPH(3, 7, &pin_PC10),
+ PERIPH(4, 8, &pin_PC10),
+ PERIPH(5, 8, &pin_PC12),
+ PERIPH(4, 8, &pin_PD01),
+ PERIPH(2, 7, &pin_PD05),
+ PERIPH(3, 7, &pin_PD08),
+ PERIPH(8, 8, &pin_PE01),
+ PERIPH(7, 7, &pin_PE08),
+ PERIPH(7, 7, &pin_PF07),
+ PERIPH(6, 7, &pin_PG14),
+ PERIPH(4, 8, &pin_PH13),
+ PERIPH(8, 8, &pin_PJ08),
+};
+
+const mcu_periph_obj_t mcu_uart_rx_list[26] = {
+ PERIPH(4, 8, &pin_PA01),
+ PERIPH(2, 7, &pin_PA03),
+ PERIPH(7, 11, &pin_PA08),
+ PERIPH(1, 7, &pin_PA10),
+ PERIPH(4, 6, &pin_PA11),
+ PERIPH(7, 11, &pin_PB03),
+ PERIPH(5, 14, &pin_PB05),
+ PERIPH(1, 7, &pin_PB07),
+ PERIPH(4, 8, &pin_PB08),
+ PERIPH(3, 7, &pin_PB11),
+ PERIPH(5, 14, &pin_PB12),
+ PERIPH(1, 4, &pin_PB15),
+ PERIPH(6, 7, &pin_PC07),
+ PERIPH(3, 7, &pin_PC11),
+ PERIPH(4, 8, &pin_PC11),
+ PERIPH(4, 8, &pin_PD00),
+ PERIPH(5, 8, &pin_PD02),
+ PERIPH(2, 7, &pin_PD06),
+ PERIPH(3, 7, &pin_PD09),
+ PERIPH(8, 8, &pin_PE00),
+ PERIPH(7, 7, &pin_PE07),
+ PERIPH(7, 7, &pin_PF06),
+ PERIPH(6, 7, &pin_PG09),
+ PERIPH(4, 8, &pin_PH14),
+ PERIPH(4, 8, &pin_PI09),
+ PERIPH(8, 8, &pin_PJ09),
+};
+
+//Timers
+//TIM6 and TIM7 are basic timers that are only used by DAC, and don't have pins
+//TODO: H7 has more timers than this, but are they tied to pins?
+TIM_TypeDef * mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, TIM8, NULL, NULL,
+ NULL, TIM12, TIM13, TIM14};
+
+const mcu_tim_pin_obj_t mcu_tim_pin_list[58] = {
+ TIM(2, 1, 1, &pin_PA00),
+ TIM(5, 2, 1, &pin_PA00),
+ TIM(2, 1, 2, &pin_PA01),
+ TIM(5, 2, 2, &pin_PA01),
+ TIM(2, 1, 3, &pin_PA02),
+ TIM(5, 2, 3, &pin_PA02),
+ TIM(2, 1, 4, &pin_PA03),
+ TIM(5, 2, 4, &pin_PA03),
+ TIM(2, 1, 1, &pin_PA05),
+ TIM(3, 2, 1, &pin_PA06),
+ TIM(3, 2, 2, &pin_PA07),
+ TIM(1, 1, 1, &pin_PA08),
+ TIM(1, 1, 2, &pin_PA09),
+ TIM(1, 1, 3, &pin_PA10),
+ TIM(1, 1, 4, &pin_PA11),
+ TIM(2, 1, 1, &pin_PA15),
+ TIM(3, 2, 3, &pin_PB00),
+ TIM(3, 2, 4, &pin_PB01),
+ TIM(2, 1, 2, &pin_PB03),
+ TIM(3, 2, 1, &pin_PB04),
+ TIM(3, 2, 2, &pin_PB05),
+ TIM(4, 2, 1, &pin_PB06),
+ TIM(4, 2, 2, &pin_PB07),
+ TIM(4, 2, 3, &pin_PB08),
+ TIM(4, 2, 4, &pin_PB09),
+ TIM(2, 1, 3, &pin_PB10),
+ TIM(2, 1, 4, &pin_PB11),
+ TIM(3, 2, 1, &pin_PC06),
+ TIM(8, 3, 1, &pin_PC06),
+ TIM(3, 2, 2, &pin_PC07),
+ TIM(8, 3, 2, &pin_PC07),
+ TIM(3, 2, 3, &pin_PC08),
+ TIM(8, 3, 3, &pin_PC08),
+ TIM(3, 2, 4, &pin_PC09),
+ TIM(8, 3, 4, &pin_PC09),
+ TIM(4, 2, 1, &pin_PD12),
+ TIM(4, 2, 2, &pin_PD13),
+ TIM(4, 2, 3, &pin_PD14),
+ TIM(4, 2, 4, &pin_PD15),
+ TIM(1, 1, 1, &pin_PE09),
+ TIM(1, 1, 2, &pin_PE11),
+ TIM(1, 1, 3, &pin_PE13),
+ TIM(1, 1, 4, &pin_PE14),
+ TIM(5, 2, 1, &pin_PH10),
+ TIM(5, 2, 2, &pin_PH11),
+ TIM(5, 2, 3, &pin_PH12),
+ TIM(5, 2, 4, &pin_PI00),
+ TIM(8, 3, 4, &pin_PI02),
+ TIM(8, 3, 1, &pin_PI05),
+ TIM(8, 3, 2, &pin_PI06),
+ TIM(8, 3, 3, &pin_PI07),
+ TIM(8, 3, 2, &pin_PJ06),
+ TIM(8, 3, 1, &pin_PJ08),
+ TIM(1, 1, 3, &pin_PJ09),
+ TIM(8, 3, 2, &pin_PJ10),
+ TIM(1, 1, 2, &pin_PJ11),
+ TIM(8, 3, 3, &pin_PK00),
+ TIM(1, 1, 1, &pin_PK01),
+};
diff --git a/ports/stm/peripherals/stm32h7/stm32h743xx/periph.h b/ports/stm/peripherals/stm32h7/stm32h743xx/periph.h
new file mode 100644
index 000000000..4b852413b
--- /dev/null
+++ b/ports/stm/peripherals/stm32h7/stm32h743xx/periph.h
@@ -0,0 +1,55 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Lucian Copeland 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.
+ */
+
+#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32H743XX_PERIPH_H
+#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32H743XX_PERIPH_H
+
+//I2C
+extern I2C_TypeDef * mcu_i2c_banks[4];
+
+const mcu_periph_obj_t mcu_i2c_sda_list[12];
+const mcu_periph_obj_t mcu_i2c_scl_list[12];
+
+//SPI
+extern SPI_TypeDef * mcu_spi_banks[6];
+
+const mcu_periph_obj_t mcu_spi_sck_list[19];
+const mcu_periph_obj_t mcu_spi_mosi_list[19];
+const mcu_periph_obj_t mcu_spi_miso_list[16];
+
+//UART
+extern USART_TypeDef * mcu_uart_banks[MAX_UART];
+extern bool mcu_uart_has_usart[MAX_UART];
+
+const mcu_periph_obj_t mcu_uart_tx_list[25];
+const mcu_periph_obj_t mcu_uart_rx_list[26];
+
+//Timers
+#define TIM_BANK_ARRAY_LEN 14
+#define TIM_PIN_ARRAY_LEN 58
+TIM_TypeDef * mcu_tim_banks[TIM_BANK_ARRAY_LEN];
+
+#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32H743XX_PERIPH_H \ No newline at end of file
diff --git a/ports/stm/peripherals/stm32h7/stm32h743xx/pins.c b/ports/stm/peripherals/stm32h7/stm32h743xx/pins.c
new file mode 100644
index 000000000..491fe6938
--- /dev/null
+++ b/ports/stm/peripherals/stm32h7/stm32h743xx/pins.c
@@ -0,0 +1,210 @@
+ /*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Lucian Copeland 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 "py/obj.h"
+#include "py/mphal.h"
+#include "peripherals/pins.h"
+
+// Todo: some pins do have ADCs, but the module isn't set up yet.
+
+const mcu_pin_obj_t pin_PA00 = PIN(0, 0, NO_ADC);
+const mcu_pin_obj_t pin_PA01 = PIN(0, 1, NO_ADC);
+const mcu_pin_obj_t pin_PA02 = PIN(0, 2, NO_ADC);
+const mcu_pin_obj_t pin_PA03 = PIN(0, 3, NO_ADC);
+const mcu_pin_obj_t pin_PA04 = PIN(0, 4, NO_ADC);
+const mcu_pin_obj_t pin_PA05 = PIN(0, 5, NO_ADC);
+const mcu_pin_obj_t pin_PA06 = PIN(0, 6, NO_ADC);
+const mcu_pin_obj_t pin_PA07 = PIN(0, 7, NO_ADC);
+const mcu_pin_obj_t pin_PA08 = PIN(0, 8, NO_ADC);
+const mcu_pin_obj_t pin_PA09 = PIN(0, 9, NO_ADC);
+const mcu_pin_obj_t pin_PA10 = PIN(0, 10, NO_ADC);
+const mcu_pin_obj_t pin_PA11 = PIN(0, 11, NO_ADC);
+const mcu_pin_obj_t pin_PA12 = PIN(0, 12, NO_ADC);
+const mcu_pin_obj_t pin_PA13 = PIN(0, 13, NO_ADC);
+const mcu_pin_obj_t pin_PA14 = PIN(0, 14, NO_ADC);
+const mcu_pin_obj_t pin_PA15 = PIN(0, 15, NO_ADC);
+
+const mcu_pin_obj_t pin_PB00 = PIN(1, 0, NO_ADC);
+const mcu_pin_obj_t pin_PB01 = PIN(1, 1, NO_ADC);
+const mcu_pin_obj_t pin_PB02 = PIN(1, 2, NO_ADC);
+const mcu_pin_obj_t pin_PB03 = PIN(1, 3, NO_ADC);
+const mcu_pin_obj_t pin_PB04 = PIN(1, 4, NO_ADC);
+const mcu_pin_obj_t pin_PB05 = PIN(1, 5, NO_ADC);
+const mcu_pin_obj_t pin_PB06 = PIN(1, 6, NO_ADC);
+const mcu_pin_obj_t pin_PB07 = PIN(1, 7, NO_ADC);
+const mcu_pin_obj_t pin_PB08 = PIN(1, 8, NO_ADC);
+const mcu_pin_obj_t pin_PB09 = PIN(1, 9, NO_ADC);
+const mcu_pin_obj_t pin_PB10 = PIN(1, 10, NO_ADC);
+const mcu_pin_obj_t pin_PB11 = PIN(1, 11, NO_ADC);
+const mcu_pin_obj_t pin_PB12 = PIN(1, 12, NO_ADC);
+const mcu_pin_obj_t pin_PB13 = PIN(1, 13, NO_ADC);
+const mcu_pin_obj_t pin_PB14 = PIN(1, 14, NO_ADC);
+const mcu_pin_obj_t pin_PB15 = PIN(1, 15, NO_ADC);
+
+const mcu_pin_obj_t pin_PC00 = PIN(2, 0, NO_ADC);
+const mcu_pin_obj_t pin_PC01 = PIN(2, 1, NO_ADC);
+const mcu_pin_obj_t pin_PC02 = PIN(2, 2, NO_ADC);
+const mcu_pin_obj_t pin_PC03 = PIN(2, 3, NO_ADC);
+const mcu_pin_obj_t pin_PC04 = PIN(2, 4, NO_ADC);
+const mcu_pin_obj_t pin_PC05 = PIN(2, 5, NO_ADC);
+const mcu_pin_obj_t pin_PC06 = PIN(2, 6, NO_ADC);
+const mcu_pin_obj_t pin_PC07 = PIN(2, 7, NO_ADC);
+const mcu_pin_obj_t pin_PC08 = PIN(2, 8, NO_ADC);
+const mcu_pin_obj_t pin_PC09 = PIN(2, 9, NO_ADC);
+const mcu_pin_obj_t pin_PC10 = PIN(2, 10, NO_ADC);
+const mcu_pin_obj_t pin_PC11 = PIN(2, 11, NO_ADC);
+const mcu_pin_obj_t pin_PC12 = PIN(2, 12, NO_ADC);
+const mcu_pin_obj_t pin_PC13 = PIN(2, 13, NO_ADC);
+const mcu_pin_obj_t pin_PC14 = PIN(2, 14, NO_ADC);
+const mcu_pin_obj_t pin_PC15 = PIN(2, 15, NO_ADC);
+
+const mcu_pin_obj_t pin_PD00 = PIN(3, 0, NO_ADC);
+const mcu_pin_obj_t pin_PD01 = PIN(3, 1, NO_ADC);
+const mcu_pin_obj_t pin_PD02 = PIN(3, 2, NO_ADC);
+const mcu_pin_obj_t pin_PD03 = PIN(3, 3, NO_ADC);
+const mcu_pin_obj_t pin_PD04 = PIN(3, 4, NO_ADC);
+const mcu_pin_obj_t pin_PD05 = PIN(3, 5, NO_ADC);
+const mcu_pin_obj_t pin_PD06 = PIN(3, 6, NO_ADC);
+const mcu_pin_obj_t pin_PD07 = PIN(3, 7, NO_ADC);
+const mcu_pin_obj_t pin_PD08 = PIN(3, 8, NO_ADC);
+const mcu_pin_obj_t pin_PD09 = PIN(3, 9, NO_ADC);
+const mcu_pin_obj_t pin_PD10 = PIN(3, 10, NO_ADC);
+const mcu_pin_obj_t pin_PD11 = PIN(3, 11, NO_ADC);
+const mcu_pin_obj_t pin_PD12 = PIN(3, 12, NO_ADC);
+const mcu_pin_obj_t pin_PD13 = PIN(3, 13, NO_ADC);
+const mcu_pin_obj_t pin_PD14 = PIN(3, 14, NO_ADC);
+const mcu_pin_obj_t pin_PD15 = PIN(3, 15, NO_ADC);
+
+const mcu_pin_obj_t pin_PE00 = PIN(4, 0, NO_ADC);
+const mcu_pin_obj_t pin_PE01 = PIN(4, 1, NO_ADC);
+const mcu_pin_obj_t pin_PE02 = PIN(4, 2, NO_ADC);
+const mcu_pin_obj_t pin_PE03 = PIN(4, 3, NO_ADC);
+const mcu_pin_obj_t pin_PE04 = PIN(4, 4, NO_ADC);
+const mcu_pin_obj_t pin_PE05 = PIN(4, 5, NO_ADC);
+const mcu_pin_obj_t pin_PE06 = PIN(4, 6, NO_ADC);
+const mcu_pin_obj_t pin_PE07 = PIN(4, 7, NO_ADC);
+const mcu_pin_obj_t pin_PE08 = PIN(4, 8, NO_ADC);
+const mcu_pin_obj_t pin_PE09 = PIN(4, 9, NO_ADC);
+const mcu_pin_obj_t pin_PE10 = PIN(4, 10, NO_ADC);
+const mcu_pin_obj_t pin_PE11 = PIN(4, 11, NO_ADC);
+const mcu_pin_obj_t pin_PE12 = PIN(4, 12, NO_ADC);
+const mcu_pin_obj_t pin_PE13 = PIN(4, 13, NO_ADC);
+const mcu_pin_obj_t pin_PE14 = PIN(4, 14, NO_ADC);
+const mcu_pin_obj_t pin_PE15 = PIN(4, 15, NO_ADC);
+
+const mcu_pin_obj_t pin_PF00 = PIN(5, 0, NO_ADC);
+const mcu_pin_obj_t pin_PF01 = PIN(5, 1, NO_ADC);
+const mcu_pin_obj_t pin_PF02 = PIN(5, 2, NO_ADC);
+const mcu_pin_obj_t pin_PF03 = PIN(5, 3, NO_ADC);
+const mcu_pin_obj_t pin_PF04 = PIN(5, 4, NO_ADC);
+const mcu_pin_obj_t pin_PF05 = PIN(5, 5, NO_ADC);
+const mcu_pin_obj_t pin_PF06 = PIN(5, 6, NO_ADC);
+const mcu_pin_obj_t pin_PF07 = PIN(5, 7, NO_ADC);
+const mcu_pin_obj_t pin_PF08 = PIN(5, 8, NO_ADC);
+const mcu_pin_obj_t pin_PF09 = PIN(5, 9, NO_ADC);
+const mcu_pin_obj_t pin_PF10 = PIN(5, 10, NO_ADC);
+const mcu_pin_obj_t pin_PF11 = PIN(5, 11, NO_ADC);
+const mcu_pin_obj_t pin_PF12 = PIN(5, 12, NO_ADC);
+const mcu_pin_obj_t pin_PF13 = PIN(5, 13, NO_ADC);
+const mcu_pin_obj_t pin_PF14 = PIN(5, 14, NO_ADC);
+const mcu_pin_obj_t pin_PF15 = PIN(5, 15, NO_ADC);
+
+const mcu_pin_obj_t pin_PG00 = PIN(6, 0, NO_ADC);
+const mcu_pin_obj_t pin_PG01 = PIN(6, 1, NO_ADC);
+const mcu_pin_obj_t pin_PG02 = PIN(6, 2, NO_ADC);
+const mcu_pin_obj_t pin_PG03 = PIN(6, 3, NO_ADC);
+const mcu_pin_obj_t pin_PG04 = PIN(6, 4, NO_ADC);
+const mcu_pin_obj_t pin_PG05 = PIN(6, 5, NO_ADC);
+const mcu_pin_obj_t pin_PG06 = PIN(6, 6, NO_ADC);
+const mcu_pin_obj_t pin_PG07 = PIN(6, 7, NO_ADC);
+const mcu_pin_obj_t pin_PG08 = PIN(6, 8, NO_ADC);
+const mcu_pin_obj_t pin_PG09 = PIN(6, 9, NO_ADC);
+const mcu_pin_obj_t pin_PG10 = PIN(6, 10, NO_ADC);
+const mcu_pin_obj_t pin_PG11 = PIN(6, 11, NO_ADC);
+const mcu_pin_obj_t pin_PG12 = PIN(6, 12, NO_ADC);
+const mcu_pin_obj_t pin_PG13 = PIN(6, 13, NO_ADC);
+const mcu_pin_obj_t pin_PG14 = PIN(6, 14, NO_ADC);
+const mcu_pin_obj_t pin_PG15 = PIN(6, 15, NO_ADC);
+
+const mcu_pin_obj_t pin_PH00 = PIN(7, 0, NO_ADC);
+const mcu_pin_obj_t pin_PH01 = PIN(7, 1, NO_ADC);
+const mcu_pin_obj_t pin_PH02 = PIN(7, 2, NO_ADC);
+const mcu_pin_obj_t pin_PH03 = PIN(7, 3, NO_ADC);
+const mcu_pin_obj_t pin_PH04 = PIN(7, 4, NO_ADC);
+const mcu_pin_obj_t pin_PH05 = PIN(7, 5, NO_ADC);
+const mcu_pin_obj_t pin_PH06 = PIN(7, 6, NO_ADC);
+const mcu_pin_obj_t pin_PH07 = PIN(7, 7, NO_ADC);
+const mcu_pin_obj_t pin_PH08 = PIN(7, 8, NO_ADC);
+const mcu_pin_obj_t pin_PH09 = PIN(7, 9, NO_ADC);
+const mcu_pin_obj_t pin_PH10 = PIN(7, 10, NO_ADC);
+const mcu_pin_obj_t pin_PH11 = PIN(7, 11, NO_ADC);
+const mcu_pin_obj_t pin_PH12 = PIN(7, 12, NO_ADC);
+const mcu_pin_obj_t pin_PH13 = PIN(7, 13, NO_ADC);
+const mcu_pin_obj_t pin_PH14 = PIN(7, 14, NO_ADC);
+const mcu_pin_obj_t pin_PH15 = PIN(7, 15, NO_ADC);
+
+const mcu_pin_obj_t pin_PI00 = PIN(8, 0, NO_ADC);
+const mcu_pin_obj_t pin_PI01 = PIN(8, 1, NO_ADC);
+const mcu_pin_obj_t pin_PI02 = PIN(8, 2, NO_ADC);
+const mcu_pin_obj_t pin_PI03 = PIN(8, 3, NO_ADC);
+const mcu_pin_obj_t pin_PI04 = PIN(8, 4, NO_ADC);
+const mcu_pin_obj_t pin_PI05 = PIN(8, 5, NO_ADC);
+const mcu_pin_obj_t pin_PI06 = PIN(8, 6, NO_ADC);
+const mcu_pin_obj_t pin_PI07 = PIN(8, 7, NO_ADC);
+const mcu_pin_obj_t pin_PI08 = PIN(8, 8, NO_ADC);
+const mcu_pin_obj_t pin_PI09 = PIN(8, 9, NO_ADC);
+const mcu_pin_obj_t pin_PI10 = PIN(8, 10, NO_ADC);
+const mcu_pin_obj_t pin_PI11 = PIN(8, 11, NO_ADC);
+const mcu_pin_obj_t pin_PI12 = PIN(8, 12, NO_ADC);
+const mcu_pin_obj_t pin_PI13 = PIN(8, 13, NO_ADC);
+const mcu_pin_obj_t pin_PI14 = PIN(8, 14, NO_ADC);
+const mcu_pin_obj_t pin_PI15 = PIN(8, 15, NO_ADC);
+
+const mcu_pin_obj_t pin_PJ00 = PIN(9, 0, NO_ADC);
+const mcu_pin_obj_t pin_PJ01 = PIN(9, 1, NO_ADC);
+const mcu_pin_obj_t pin_PJ02 = PIN(9, 2, NO_ADC);
+const mcu_pin_obj_t pin_PJ03 = PIN(9, 3, NO_ADC);
+const mcu_pin_obj_t pin_PJ04 = PIN(9, 4, NO_ADC);
+const mcu_pin_obj_t pin_PJ05 = PIN(9, 5, NO_ADC);
+const mcu_pin_obj_t pin_PJ06 = PIN(9, 6, NO_ADC);
+const mcu_pin_obj_t pin_PJ07 = PIN(9, 7, NO_ADC);
+const mcu_pin_obj_t pin_PJ08 = PIN(9, 8, NO_ADC);
+const mcu_pin_obj_t pin_PJ09 = PIN(9, 9, NO_ADC);
+const mcu_pin_obj_t pin_PJ10 = PIN(9, 10, NO_ADC);
+const mcu_pin_obj_t pin_PJ11 = PIN(9, 11, NO_ADC);
+const mcu_pin_obj_t pin_PJ12 = PIN(9, 12, NO_ADC);
+const mcu_pin_obj_t pin_PJ13 = PIN(9, 13, NO_ADC);
+const mcu_pin_obj_t pin_PJ14 = PIN(9, 14, NO_ADC);
+const mcu_pin_obj_t pin_PJ15 = PIN(9, 15, NO_ADC);
+
+const mcu_pin_obj_t pin_PK00 = PIN(10, 0, NO_ADC);
+const mcu_pin_obj_t pin_PK01 = PIN(10, 1, NO_ADC);
+const mcu_pin_obj_t pin_PK02 = PIN(10, 2, NO_ADC);
+const mcu_pin_obj_t pin_PK03 = PIN(10, 3, NO_ADC);
+const mcu_pin_obj_t pin_PK04 = PIN(10, 4, NO_ADC);
+const mcu_pin_obj_t pin_PK05 = PIN(10, 5, NO_ADC);
+const mcu_pin_obj_t pin_PK06 = PIN(10, 6, NO_ADC);
+const mcu_pin_obj_t pin_PK07 = PIN(10, 7, NO_ADC);
diff --git a/ports/stm/peripherals/stm32h7/stm32h743xx/pins.h b/ports/stm/peripherals/stm32h7/stm32h743xx/pins.h
new file mode 100644
index 000000000..7c4650dca
--- /dev/null
+++ b/ports/stm/peripherals/stm32h7/stm32h743xx/pins.h
@@ -0,0 +1,199 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Lucian Copeland 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.
+ */
+
+#ifndef MICROPY_INCLUDED_STM32_PERIPHERALS_STM32H743XX_PINS_H
+#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32H743XX_PINS_H
+
+extern const mcu_pin_obj_t pin_PA00;
+extern const mcu_pin_obj_t pin_PA01;
+extern const mcu_pin_obj_t pin_PA02;
+extern const mcu_pin_obj_t pin_PA03;
+extern const mcu_pin_obj_t pin_PA04;
+extern const mcu_pin_obj_t pin_PA05;
+extern const mcu_pin_obj_t pin_PA06;
+extern const mcu_pin_obj_t pin_PA07;
+extern const mcu_pin_obj_t pin_PA08;
+extern const mcu_pin_obj_t pin_PA09;
+extern const mcu_pin_obj_t pin_PA10;
+extern const mcu_pin_obj_t pin_PA11;
+extern const mcu_pin_obj_t pin_PA12;
+extern const mcu_pin_obj_t pin_PA13;
+extern const mcu_pin_obj_t pin_PA14;
+extern const mcu_pin_obj_t pin_PA15;
+extern const mcu_pin_obj_t pin_PB00;
+extern const mcu_pin_obj_t pin_PB01;
+extern const mcu_pin_obj_t pin_PB02;
+extern const mcu_pin_obj_t pin_PB03;
+extern const mcu_pin_obj_t pin_PB04;
+extern const mcu_pin_obj_t pin_PB05;
+extern const mcu_pin_obj_t pin_PB06;
+extern const mcu_pin_obj_t pin_PB07;
+extern const mcu_pin_obj_t pin_PB08;
+extern const mcu_pin_obj_t pin_PB09;
+extern const mcu_pin_obj_t pin_PB10;
+extern const mcu_pin_obj_t pin_PB11;
+extern const mcu_pin_obj_t pin_PB12;
+extern const mcu_pin_obj_t pin_PB13;
+extern const mcu_pin_obj_t pin_PB14;
+extern const mcu_pin_obj_t pin_PB15;
+extern const mcu_pin_obj_t pin_PC00;
+extern const mcu_pin_obj_t pin_PC01;
+extern const mcu_pin_obj_t pin_PC02;
+extern const mcu_pin_obj_t pin_PC03;
+extern const mcu_pin_obj_t pin_PC04;
+extern const mcu_pin_obj_t pin_PC05;
+extern const mcu_pin_obj_t pin_PC06;
+extern const mcu_pin_obj_t pin_PC07;
+extern const mcu_pin_obj_t pin_PC08;
+extern const mcu_pin_obj_t pin_PC09;
+extern const mcu_pin_obj_t pin_PC10;
+extern const mcu_pin_obj_t pin_PC11;
+extern const mcu_pin_obj_t pin_PC12;
+extern const mcu_pin_obj_t pin_PC13;
+extern const mcu_pin_obj_t pin_PC14;
+extern const mcu_pin_obj_t pin_PC15;
+extern const mcu_pin_obj_t pin_PD00;
+extern const mcu_pin_obj_t pin_PD01;
+extern const mcu_pin_obj_t pin_PD02;
+extern const mcu_pin_obj_t pin_PD03;
+extern const mcu_pin_obj_t pin_PD04;
+extern const mcu_pin_obj_t pin_PD05;
+extern const mcu_pin_obj_t pin_PD06;
+extern const mcu_pin_obj_t pin_PD07;
+extern const mcu_pin_obj_t pin_PD08;
+extern const mcu_pin_obj_t pin_PD09;
+extern const mcu_pin_obj_t pin_PD10;
+extern const mcu_pin_obj_t pin_PD11;
+extern const mcu_pin_obj_t pin_PD12;
+extern const mcu_pin_obj_t pin_PD13;
+extern const mcu_pin_obj_t pin_PD14;
+extern const mcu_pin_obj_t pin_PD15;
+extern const mcu_pin_obj_t pin_PE00;
+extern const mcu_pin_obj_t pin_PE01;
+extern const mcu_pin_obj_t pin_PE02;
+extern const mcu_pin_obj_t pin_PE03;
+extern const mcu_pin_obj_t pin_PE04;
+extern const mcu_pin_obj_t pin_PE05;
+extern const mcu_pin_obj_t pin_PE06;
+extern const mcu_pin_obj_t pin_PE07;
+extern const mcu_pin_obj_t pin_PE08;
+extern const mcu_pin_obj_t pin_PE09;
+extern const mcu_pin_obj_t pin_PE10;
+extern const mcu_pin_obj_t pin_PE11;
+extern const mcu_pin_obj_t pin_PE12;
+extern const mcu_pin_obj_t pin_PE13;
+extern const mcu_pin_obj_t pin_PE14;
+extern const mcu_pin_obj_t pin_PE15;
+extern const mcu_pin_obj_t pin_PF00;
+extern const mcu_pin_obj_t pin_PF01;
+extern const mcu_pin_obj_t pin_PF02;
+extern const mcu_pin_obj_t pin_PF03;
+extern const mcu_pin_obj_t pin_PF04;
+extern const mcu_pin_obj_t pin_PF05;
+extern const mcu_pin_obj_t pin_PF06;
+extern const mcu_pin_obj_t pin_PF07;
+extern const mcu_pin_obj_t pin_PF08;
+extern const mcu_pin_obj_t pin_PF09;
+extern const mcu_pin_obj_t pin_PF10;
+extern const mcu_pin_obj_t pin_PF11;
+extern const mcu_pin_obj_t pin_PF12;
+extern const mcu_pin_obj_t pin_PF13;
+extern const mcu_pin_obj_t pin_PF14;
+extern const mcu_pin_obj_t pin_PF15;
+extern const mcu_pin_obj_t pin_PG00;
+extern const mcu_pin_obj_t pin_PG01;
+extern const mcu_pin_obj_t pin_PG02;
+extern const mcu_pin_obj_t pin_PG03;
+extern const mcu_pin_obj_t pin_PG04;
+extern const mcu_pin_obj_t pin_PG05;
+extern const mcu_pin_obj_t pin_PG06;
+extern const mcu_pin_obj_t pin_PG07;
+extern const mcu_pin_obj_t pin_PG08;
+extern const mcu_pin_obj_t pin_PG09;
+extern const mcu_pin_obj_t pin_PG10;
+extern const mcu_pin_obj_t pin_PG11;
+extern const mcu_pin_obj_t pin_PG12;
+extern const mcu_pin_obj_t pin_PG13;
+extern const mcu_pin_obj_t pin_PG14;
+extern const mcu_pin_obj_t pin_PG15;
+extern const mcu_pin_obj_t pin_PH00;
+extern const mcu_pin_obj_t pin_PH01;
+extern const mcu_pin_obj_t pin_PH02;
+extern const mcu_pin_obj_t pin_PH03;
+extern const mcu_pin_obj_t pin_PH04;
+extern const mcu_pin_obj_t pin_PH05;
+extern const mcu_pin_obj_t pin_PH06;
+extern const mcu_pin_obj_t pin_PH07;
+extern const mcu_pin_obj_t pin_PH08;
+extern const mcu_pin_obj_t pin_PH09;
+extern const mcu_pin_obj_t pin_PH10;
+extern const mcu_pin_obj_t pin_PH11;
+extern const mcu_pin_obj_t pin_PH12;
+extern const mcu_pin_obj_t pin_PH13;
+extern const mcu_pin_obj_t pin_PH14;
+extern const mcu_pin_obj_t pin_PH15;
+extern const mcu_pin_obj_t pin_PI00;
+extern const mcu_pin_obj_t pin_PI01;
+extern const mcu_pin_obj_t pin_PI02;
+extern const mcu_pin_obj_t pin_PI03;
+extern const mcu_pin_obj_t pin_PI04;
+extern const mcu_pin_obj_t pin_PI05;
+extern const mcu_pin_obj_t pin_PI06;
+extern const mcu_pin_obj_t pin_PI07;
+extern const mcu_pin_obj_t pin_PI08;
+extern const mcu_pin_obj_t pin_PI09;
+extern const mcu_pin_obj_t pin_PI10;
+extern const mcu_pin_obj_t pin_PI11;
+extern const mcu_pin_obj_t pin_PI12;
+extern const mcu_pin_obj_t pin_PI13;
+extern const mcu_pin_obj_t pin_PI14;
+extern const mcu_pin_obj_t pin_PI15;
+extern const mcu_pin_obj_t pin_PJ00;
+extern const mcu_pin_obj_t pin_PJ01;
+extern const mcu_pin_obj_t pin_PJ02;
+extern const mcu_pin_obj_t pin_PJ03;
+extern const mcu_pin_obj_t pin_PJ04;
+extern const mcu_pin_obj_t pin_PJ05;
+extern const mcu_pin_obj_t pin_PJ06;
+extern const mcu_pin_obj_t pin_PJ07;
+extern const mcu_pin_obj_t pin_PJ08;
+extern const mcu_pin_obj_t pin_PJ09;
+extern const mcu_pin_obj_t pin_PJ10;
+extern const mcu_pin_obj_t pin_PJ11;
+extern const mcu_pin_obj_t pin_PJ12;
+extern const mcu_pin_obj_t pin_PJ13;
+extern const mcu_pin_obj_t pin_PJ14;
+extern const mcu_pin_obj_t pin_PJ15;
+extern const mcu_pin_obj_t pin_PK00;
+extern const mcu_pin_obj_t pin_PK01;
+extern const mcu_pin_obj_t pin_PK02;
+extern const mcu_pin_obj_t pin_PK03;
+extern const mcu_pin_obj_t pin_PK04;
+extern const mcu_pin_obj_t pin_PK05;
+extern const mcu_pin_obj_t pin_PK06;
+extern const mcu_pin_obj_t pin_PK07;
+
+#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32H743XX_PINS_H
diff --git a/ports/stm/qstrdefsport.h b/ports/stm/qstrdefsport.h
new file mode 100644
index 000000000..3ba897069
--- /dev/null
+++ b/ports/stm/qstrdefsport.h
@@ -0,0 +1 @@
+// qstrs specific to this port
diff --git a/ports/stm/st_driver b/ports/stm/st_driver
new file mode 160000
+Subproject 3fc2e0f3db155b33177bb0705e0dd65cadb5841
diff --git a/ports/stm32f4/supervisor/cpu.s b/ports/stm/supervisor/cpu.s
index 9e6807a5e..9e6807a5e 100755
--- a/ports/stm32f4/supervisor/cpu.s
+++ b/ports/stm/supervisor/cpu.s
diff --git a/ports/stm/supervisor/internal_flash.c b/ports/stm/supervisor/internal_flash.c
new file mode 100644
index 000000000..8c04112c0
--- /dev/null
+++ b/ports/stm/supervisor/internal_flash.c
@@ -0,0 +1,321 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2013, 2014 Damien P. George
+ * Copyright (c) 2020 Lucian Copeland 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 "supervisor/internal_flash.h"
+
+#include <stdint.h>
+#include <string.h>
+
+#include "extmod/vfs.h"
+#include "extmod/vfs_fat.h"
+#include "py/mphal.h"
+#include "py/obj.h"
+#include "py/runtime.h"
+#include "lib/oofatfs/ff.h"
+#include "supervisor/shared/safe_mode.h"
+
+typedef struct {
+ uint32_t base_address;
+ uint32_t sector_size;
+ uint32_t sector_count;
+} flash_layout_t;
+
+/*------------------------------------------------------------------*/
+/* Internal Flash API
+ *------------------------------------------------------------------*/
+
+#if defined(STM32F4)
+
+ STATIC const flash_layout_t flash_layout[] = {
+ { 0x08000000, 0x04000, 4 },
+ { 0x08010000, 0x10000, 1 },
+ { 0x08020000, 0x20000, 3 },
+ #if defined(FLASH_SECTOR_8)
+ { 0x08080000, 0x20000, 4 },
+ #endif
+ #if defined(FLASH_SECTOR_12)
+ { 0x08100000, 0x04000, 4 },
+ { 0x08110000, 0x10000, 1 },
+ { 0x08120000, 0x20000, 7 },
+ #endif
+ };
+ STATIC uint8_t _flash_cache[0x4000] __attribute__((aligned(4)));
+
+#elif defined(STM32F7)
+
+ // FLASH_FLAG_PGSERR (Programming Sequence Error) was renamed to
+ // FLASH_FLAG_ERSERR (Erasing Sequence Error) in STM32F7
+ #define FLASH_FLAG_PGSERR FLASH_FLAG_ERSERR
+ #if defined(STM32F722xx) || defined(STM32F723xx) || defined(STM32F732xx) || defined(STM32F733xx)
+ static const flash_layout_t flash_layout[] = {
+ { 0x08000000, 0x04000, 4 },
+ { 0x08010000, 0x10000, 1 },
+ { 0x08020000, 0x20000, 3 },
+ };
+ STATIC uint8_t _flash_cache[0x4000] __attribute__((aligned(4)));
+ #else
+ static const flash_layout_t flash_layout[] = {
+ { 0x08000000, 0x08000, 4 },
+ { 0x08020000, 0x20000, 1 },
+ { 0x08040000, 0x40000, 3 },
+ };
+ STATIC uint8_t _flash_cache[0x8000] __attribute__((aligned(4)));
+ #endif
+#elif defined(STM32H7)
+
+ STATIC const flash_layout_t flash_layout[] = {
+ { 0x08000000, 0x20000, 16 },
+ };
+ STATIC uint8_t _flash_cache[0x20000] __attribute__((aligned(4)));
+
+#else
+ #error Unsupported processor
+#endif
+
+#define NO_CACHE 0xffffffff
+#define MAX_CACHE 0x4000
+
+
+STATIC uint32_t _cache_flash_addr = NO_CACHE;
+
+#if defined(STM32H7)
+// get the bank of a given flash address
+STATIC uint32_t get_bank(uint32_t addr) {
+ if (READ_BIT(FLASH->OPTCR, FLASH_OPTCR_SWAP_BANK) == 0) {
+ // no bank swap
+ if (addr < (FLASH_BASE + FLASH_BANK_SIZE)) {
+ return FLASH_BANK_1;
+ } else {
+ return FLASH_BANK_2;
+ }
+ } else {
+ // bank swap
+ if (addr < (FLASH_BASE + FLASH_BANK_SIZE)) {
+ return FLASH_BANK_2;
+ } else {
+ return FLASH_BANK_1;
+ }
+ }
+}
+#endif
+
+//Return the sector of a given flash address.
+uint32_t flash_get_sector_info(uint32_t addr, uint32_t *start_addr, uint32_t *size) {
+ if (addr >= flash_layout[0].base_address) {
+ uint32_t sector_index = 0;
+ for (uint8_t i = 0; i < MP_ARRAY_SIZE(flash_layout); ++i) {
+ for (uint8_t j = 0; j < flash_layout[i].sector_count; ++j) {
+ uint32_t sector_start_next = flash_layout[i].base_address
+ + (j + 1) * flash_layout[i].sector_size;
+ if (addr < sector_start_next) {
+ if (start_addr != NULL) {
+ *start_addr = flash_layout[i].base_address
+ + j * flash_layout[i].sector_size;
+ }
+ if (size != NULL) {
+ *size = flash_layout[i].sector_size;
+ }
+ return sector_index;
+ }
+ ++sector_index;
+ }
+ }
+ }
+ return 0;
+}
+
+void supervisor_flash_init(void) {
+}
+
+uint32_t supervisor_flash_get_block_size(void) {
+ return FILESYSTEM_BLOCK_SIZE;
+}
+
+uint32_t supervisor_flash_get_block_count(void) {
+ return INTERNAL_FLASH_FILESYSTEM_NUM_BLOCKS;
+}
+
+void supervisor_flash_flush(void) {
+ if (_cache_flash_addr == NO_CACHE) return;
+
+ #if defined(STM32H7)
+ __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_ALL_ERRORS_BANK1 | FLASH_FLAG_ALL_ERRORS_BANK2);
+ #else
+ __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR |
+ FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR);
+ #endif
+
+ // set up for erase
+ FLASH_EraseInitTypeDef EraseInitStruct;
+ EraseInitStruct.TypeErase = TYPEERASE_SECTORS;
+ EraseInitStruct.VoltageRange = VOLTAGE_RANGE_3; // voltage range needs to be 2.7V to 3.6V
+ // get the sector information
+ uint32_t sector_size;
+ uint32_t sector_start_addr;
+ #if defined(STM32H7)
+ EraseInitStruct.Banks = get_bank(_cache_flash_addr);
+ #endif
+ EraseInitStruct.Sector = flash_get_sector_info(_cache_flash_addr, &sector_start_addr, &sector_size);
+ EraseInitStruct.NbSectors = 1;
+ if (sector_size > sizeof(_flash_cache)) {
+ reset_into_safe_mode(FLASH_WRITE_FAIL);
+ }
+
+ // Skip if data is the same
+ if (memcmp(_flash_cache, (void *)_cache_flash_addr, sector_size) != 0) {
+ // unlock flash
+ HAL_FLASH_Unlock();
+
+ // erase the sector
+ uint32_t SectorError = 0;
+ if (HAL_FLASHEx_Erase(&EraseInitStruct, &SectorError) != HAL_OK) {
+ // error occurred during sector erase
+ HAL_FLASH_Lock(); // lock the flash
+ reset_into_safe_mode(FLASH_WRITE_FAIL);
+ }
+
+ uint32_t * cache_addr = (uint32_t*)_flash_cache;
+
+ #if defined(STM32H7)
+ for (uint32_t i = 0; i < (sector_size / 32); i++) {
+ // Note that the STM32H7 HAL interface differs by taking an address, not 64 bit data
+ if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_FLASHWORD, sector_start_addr,
+ (uint32_t)cache_addr) != HAL_OK) {
+ // error occurred during flash write
+ HAL_FLASH_Lock(); // lock the flash
+ reset_into_safe_mode(FLASH_WRITE_FAIL);
+ }
+ // RAM memory is by word (4 byte), but flash memory is by byte
+ cache_addr += 8;
+ sector_start_addr += 32;
+ }
+
+ #else // STM32F4
+ // program the flash word by word
+ for (uint32_t i = 0; i < sector_size / 4; i++) {
+ if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, sector_start_addr,
+ (uint64_t)*cache_addr) != HAL_OK) {
+ // error occurred during flash write
+ HAL_FLASH_Lock(); // lock the flash
+ reset_into_safe_mode(FLASH_WRITE_FAIL);
+ }
+ // RAM memory is by word (4 byte), but flash memory is by byte
+ cache_addr += 1;
+ sector_start_addr += 4;
+ }
+ #endif
+
+ // lock the flash
+ HAL_FLASH_Lock();
+ }
+}
+
+static uint32_t convert_block_to_flash_addr(uint32_t block) {
+ if (0 <= block && block < INTERNAL_FLASH_FILESYSTEM_NUM_BLOCKS) {
+ // a block in partition 1
+ return INTERNAL_FLASH_FILESYSTEM_START_ADDR + block * FILESYSTEM_BLOCK_SIZE;
+ }
+ // bad block
+ return -1;
+}
+
+mp_uint_t supervisor_flash_read_blocks(uint8_t *dest, uint32_t block, uint32_t num_blocks) {
+ int32_t src = convert_block_to_flash_addr(block);
+ if (src == -1) {
+ // bad block number
+ return false;
+ }
+
+ // Determine whether the read is contained within the sector
+ uint32_t sector_size;
+ uint32_t sector_start_addr;
+ flash_get_sector_info(src, &sector_start_addr, &sector_size);
+ // Count how many blocks are left in the sector
+ uint32_t count = (sector_size - (src - sector_start_addr))/FILESYSTEM_BLOCK_SIZE;
+ count = MIN(num_blocks, count);
+
+ if (count < num_blocks && _cache_flash_addr == sector_start_addr) {
+ // Read is contained in the cache, so just read cache
+ memcpy(dest, (_flash_cache + (src-sector_start_addr)), FILESYSTEM_BLOCK_SIZE*num_blocks);
+ } else {
+ // The read spans multiple sectors or is in another sector
+ // Must write out anything in cache before trying to read.
+ supervisor_flash_flush();
+ memcpy(dest, (uint8_t*) src, FILESYSTEM_BLOCK_SIZE*num_blocks);
+ }
+
+ return 0; // success
+}
+
+mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t block_num, uint32_t num_blocks) {
+ while (num_blocks) {
+ int32_t dest = convert_block_to_flash_addr(block_num);
+ if (dest == -1) {
+ // bad block number
+ return false;
+ }
+
+ // unlock flash
+ HAL_FLASH_Unlock();
+
+ uint32_t sector_size;
+ uint32_t sector_start_addr;
+ flash_get_sector_info(dest, &sector_start_addr, &sector_size);
+
+ // Fail for any sector outside what's supported by the cache
+ if (sector_size > sizeof(_flash_cache)) {
+ reset_into_safe_mode(FLASH_WRITE_FAIL);
+ }
+
+ // Find how many blocks are left in the sector
+ uint32_t count = (sector_size - (dest - sector_start_addr))/FILESYSTEM_BLOCK_SIZE;
+ count = MIN(num_blocks, count);
+
+ if (_cache_flash_addr != sector_start_addr) {
+ // Write out anything in cache before overwriting it.
+ supervisor_flash_flush();
+
+ _cache_flash_addr = sector_start_addr;
+
+ // Copy the current contents of the entire page into the cache.
+ memcpy(_flash_cache, (void *)sector_start_addr, sector_size);
+ }
+
+ // Overwrite part or all of the sector cache with the src data.
+ memcpy(_flash_cache + (dest-sector_start_addr), src, count * FILESYSTEM_BLOCK_SIZE);
+
+ // adjust for next run
+ block_num += count;
+ src += count * FILESYSTEM_BLOCK_SIZE;
+ num_blocks -= count;
+ }
+
+ return 0; // success
+}
+
+void supervisor_flash_release_cache(void) {
+}
+
diff --git a/ports/stm32f4/supervisor/internal_flash.h b/ports/stm/supervisor/internal_flash.h
index 8991fb8aa..53388d354 100644
--- a/ports/stm32f4/supervisor/internal_flash.h
+++ b/ports/stm/supervisor/internal_flash.h
@@ -4,7 +4,7 @@
* The MIT License (MIT)
*
* Copyright (c) 2013, 2014 Damien P. George
- * Copyright (c) 2019 Lucian Copeland for Adafruit Industries
+ * Copyright (c) 2020 Lucian Copeland 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,8 +24,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef MICROPY_INCLUDED_STM32F4_INTERNAL_FLASH_H
-#define MICROPY_INCLUDED_STM32F4_INTERNAL_FLASH_H
+#ifndef MICROPY_INCLUDED_STM32_INTERNAL_FLASH_H
+#define MICROPY_INCLUDED_STM32_INTERNAL_FLASH_H
#include <stdbool.h>
#include <stdint.h>
@@ -35,29 +35,55 @@
#ifdef STM32F401xE
#define STM32_FLASH_SIZE 0x80000 //512KiB
#define INTERNAL_FLASH_FILESYSTEM_SIZE 0xC000 //48KiB
+#define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x08004000
#endif
#ifdef STM32F411xE
#define STM32_FLASH_SIZE 0x80000 //512KiB
+#if CIRCUITPY_NVM
+#define INTERNAL_FLASH_FILESYSTEM_SIZE 0x8000 //32KiB
+#define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x08004000
+#else
#define INTERNAL_FLASH_FILESYSTEM_SIZE 0xC000 //48KiB
+#define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x08004000
+#endif
#endif
#ifdef STM32F412Zx
#define STM32_FLASH_SIZE 0x100000 //1MB
#define INTERNAL_FLASH_FILESYSTEM_SIZE 0xC000 //48KiB
+#define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x08004000
#endif
#ifdef STM32F405xx
#define STM32_FLASH_SIZE 0x100000 //1MB
#define INTERNAL_FLASH_FILESYSTEM_SIZE 0xC000 //48KiB
+#define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x08004000
#endif
-#define STM32_FLASH_OFFSET 0x8000000 //All STM32 chips map to this flash location
-
+#ifdef STM32F407xx
+#define STM32_FLASH_SIZE 0x100000 //1MB
+#define INTERNAL_FLASH_FILESYSTEM_SIZE 0xC000 //48KiB
#define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x08004000
+#endif
+
+#ifdef STM32F767xx
+#define STM32_FLASH_SIZE 0x200000 //2MB
+#define INTERNAL_FLASH_FILESYSTEM_SIZE 0x18000 //96KiB
+#define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x08008000
+#endif
+
+#ifdef STM32H743xx
+#define STM32_FLASH_SIZE 0x200000 //2MB
+#define INTERNAL_FLASH_FILESYSTEM_SIZE 0x20000 //128KiB
+#define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x08020000
+#endif
+
#define INTERNAL_FLASH_FILESYSTEM_NUM_BLOCKS (INTERNAL_FLASH_FILESYSTEM_SIZE / FILESYSTEM_BLOCK_SIZE)
+#define STM32_FLASH_OFFSET 0x8000000 //All STM32 chips map to this flash location
+
#define INTERNAL_FLASH_SYSTICK_MASK (0x1ff) // 512ms
#define INTERNAL_FLASH_IDLE_TICK(tick) (((tick) & INTERNAL_FLASH_SYSTICK_MASK) == 2)
-#endif // MICROPY_INCLUDED_STM32F4_INTERNAL_FLASH_H
+#endif // MICROPY_INCLUDED_STM32_INTERNAL_FLASH_H
diff --git a/ports/stm32f4/supervisor/internal_flash_root_pointers.h b/ports/stm/supervisor/internal_flash_root_pointers.h
index 7a8681bd9..7a8681bd9 100644
--- a/ports/stm32f4/supervisor/internal_flash_root_pointers.h
+++ b/ports/stm/supervisor/internal_flash_root_pointers.h
diff --git a/ports/stm/supervisor/port.c b/ports/stm/supervisor/port.c
new file mode 100644
index 000000000..21ff0b575
--- /dev/null
+++ b/ports/stm/supervisor/port.c
@@ -0,0 +1,256 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
+ * Copyright (c) 2019 Lucian Copeland 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 <stdint.h>
+#include "supervisor/port.h"
+#include "boards/board.h"
+#include "tick.h"
+
+#include "common-hal/microcontroller/Pin.h"
+
+#if CIRCUITPY_BUSIO
+#include "common-hal/busio/I2C.h"
+#include "common-hal/busio/SPI.h"
+#include "common-hal/busio/UART.h"
+#endif
+#if CIRCUITPY_PULSEIO
+#include "common-hal/pulseio/PWMOut.h"
+#include "common-hal/pulseio/PulseOut.h"
+#include "common-hal/pulseio/PulseIn.h"
+#endif
+
+#include "clocks.h"
+#include "gpio.h"
+
+//only enable the Reset Handler overwrite for the H7 for now
+#if defined(STM32H7)
+
+// Device memories must be accessed in order.
+#define DEVICE 2
+// Normal memory can have accesses reorder and prefetched.
+#define NORMAL 0
+// Prevents instruction access.
+#define NO_EXECUTION 1
+#define EXECUTION 0
+// Shareable if the memory system manages coherency.
+#define NOT_SHAREABLE 0
+#define SHAREABLE 1
+#define NOT_CACHEABLE 0
+#define CACHEABLE 1
+#define NOT_BUFFERABLE 0
+#define BUFFERABLE 1
+#define NO_SUBREGIONS 0
+
+extern uint32_t _ld_stack_top;
+
+extern uint32_t _ld_d1_ram_bss_start;
+extern uint32_t _ld_d1_ram_bss_size;
+extern uint32_t _ld_d1_ram_data_destination;
+extern uint32_t _ld_d1_ram_data_size;
+extern uint32_t _ld_d1_ram_data_flash_copy;
+extern uint32_t _ld_dtcm_bss_start;
+extern uint32_t _ld_dtcm_bss_size;
+extern uint32_t _ld_dtcm_data_destination;
+extern uint32_t _ld_dtcm_data_size;
+extern uint32_t _ld_dtcm_data_flash_copy;
+extern uint32_t _ld_itcm_destination;
+extern uint32_t _ld_itcm_size;
+extern uint32_t _ld_itcm_flash_copy;
+
+extern void main(void);
+extern void SystemInit(void);
+
+// This replaces the Reset_Handler in startup_*.S and SystemInit in system_*.c.
+__attribute__((used, naked)) void Reset_Handler(void) {
+ __disable_irq();
+ __set_MSP((uint32_t) &_ld_stack_top);
+
+ /* Disable MPU */
+ ARM_MPU_Disable();
+
+ // Copy all of the itcm code to run from ITCM. Do this while the MPU is disabled because we write
+ // protect it.
+ for (uint32_t i = 0; i < ((size_t) &_ld_itcm_size) / 4; i++) {
+ (&_ld_itcm_destination)[i] = (&_ld_itcm_flash_copy)[i];
+ }
+
+ // The first number in RBAR is the region number. When searching for a policy, the region with
+ // the highest number wins. If none match, then the default policy set at enable applies.
+
+ // Mark all the flash the same until instructed otherwise.
+ MPU->RBAR = ARM_MPU_RBAR(11, 0x08000000U);
+ MPU->RASR = ARM_MPU_RASR(EXECUTION, ARM_MPU_AP_FULL, NORMAL, NOT_SHAREABLE, CACHEABLE, BUFFERABLE, NO_SUBREGIONS, ARM_MPU_REGION_SIZE_2MB);
+
+ // This the ITCM. Set it to read-only because we've loaded everything already and it's easy to
+ // accidentally write the wrong value to 0x00000000 (aka NULL).
+ MPU->RBAR = ARM_MPU_RBAR(12, 0x00000000U);
+ MPU->RASR = ARM_MPU_RASR(EXECUTION, ARM_MPU_AP_RO, NORMAL, NOT_SHAREABLE, CACHEABLE, BUFFERABLE, NO_SUBREGIONS, ARM_MPU_REGION_SIZE_64KB);
+
+ // This the DTCM.
+ MPU->RBAR = ARM_MPU_RBAR(14, 0x20000000U);
+ MPU->RASR = ARM_MPU_RASR(EXECUTION, ARM_MPU_AP_FULL, NORMAL, NOT_SHAREABLE, CACHEABLE, BUFFERABLE, NO_SUBREGIONS, ARM_MPU_REGION_SIZE_128KB);
+
+ // This is AXI SRAM (D1).
+ MPU->RBAR = ARM_MPU_RBAR(15, 0x24000000U);
+ MPU->RASR = ARM_MPU_RASR(EXECUTION, ARM_MPU_AP_FULL, NORMAL, NOT_SHAREABLE, CACHEABLE, BUFFERABLE, NO_SUBREGIONS, ARM_MPU_REGION_SIZE_512KB);
+
+ /* Enable MPU */
+ ARM_MPU_Enable(MPU_CTRL_PRIVDEFENA_Msk);
+
+ // Copy all of the data to run from DTCM.
+ for (uint32_t i = 0; i < ((size_t) &_ld_dtcm_data_size) / 4; i++) {
+ (&_ld_dtcm_data_destination)[i] = (&_ld_dtcm_data_flash_copy)[i];
+ }
+
+ // Clear DTCM bss.
+ for (uint32_t i = 0; i < ((size_t) &_ld_dtcm_bss_size) / 4; i++) {
+ (&_ld_dtcm_bss_start)[i] = 0;
+ }
+
+ // Copy all of the data to run from D1 RAM.
+ for (uint32_t i = 0; i < ((size_t) &_ld_d1_ram_data_size) / 4; i++) {
+ (&_ld_d1_ram_data_destination)[i] = (&_ld_d1_ram_data_flash_copy)[i];
+ }
+
+ // Clear D1 RAM bss.
+ for (uint32_t i = 0; i < ((size_t) &_ld_d1_ram_bss_size) / 4; i++) {
+ (&_ld_d1_ram_bss_start)[i] = 0;
+ }
+
+ SystemInit();
+ __enable_irq();
+ main();
+}
+
+#endif //end H7 specific code
+
+safe_mode_t port_init(void) {
+ HAL_Init();
+ __HAL_RCC_SYSCFG_CLK_ENABLE();
+
+ #if defined(STM32F4)
+ __HAL_RCC_PWR_CLK_ENABLE();
+ #endif
+
+ stm32_peripherals_clocks_init();
+ stm32_peripherals_gpio_init();
+
+ tick_init();
+
+ return NO_SAFE_MODE;
+}
+
+void reset_port(void) {
+ reset_all_pins();
+#if CIRCUITPY_BUSIO
+ i2c_reset();
+ spi_reset();
+ uart_reset();
+#endif
+#if CIRCUITPY_PULSEIO
+ pwmout_reset();
+ pulseout_reset();
+ pulsein_reset();
+#endif
+}
+
+void reset_to_bootloader(void) {
+
+}
+
+void reset_cpu(void) {
+ NVIC_SystemReset();
+}
+
+extern uint32_t _ld_heap_start, _ld_heap_end, _ld_stack_top, _ld_stack_bottom;
+
+uint32_t *port_heap_get_bottom(void) {
+ return &_ld_heap_start;
+}
+
+uint32_t *port_heap_get_top(void) {
+ return &_ld_heap_end;
+}
+
+uint32_t *port_stack_get_limit(void) {
+ return &_ld_stack_bottom;
+}
+
+uint32_t *port_stack_get_top(void) {
+ return &_ld_stack_top;
+}
+
+extern uint32_t _ebss;
+
+// Place the word to save just after our BSS section that gets blanked.
+void port_set_saved_word(uint32_t value) {
+ _ebss = value;
+}
+
+uint32_t port_get_saved_word(void) {
+ return _ebss;
+}
+
+__attribute__((used)) void MemManage_Handler(void)
+{
+ reset_into_safe_mode(MEM_MANAGE);
+ while (true) {
+ asm("nop;");
+ }
+}
+
+__attribute__((used)) void BusFault_Handler(void)
+{
+ reset_into_safe_mode(MEM_MANAGE);
+ while (true) {
+ asm("nop;");
+ }
+}
+
+__attribute__((used)) void UsageFault_Handler(void)
+{
+ reset_into_safe_mode(MEM_MANAGE);
+ while (true) {
+ asm("nop;");
+ }
+}
+
+__attribute__((used)) void HardFault_Handler(void)
+{
+ reset_into_safe_mode(HARD_CRASH);
+ while (true) {
+ asm("nop;");
+ }
+}
+
+// Required by __libc_init_array in startup code if we are compiling using
+// -nostdlib/-nostartfiles.
+void _init(void)
+{
+
+}
+
diff --git a/ports/stm32f4/supervisor/qspi_flash.c b/ports/stm/supervisor/qspi_flash.c
index f3915273b..f3915273b 100644
--- a/ports/stm32f4/supervisor/qspi_flash.c
+++ b/ports/stm/supervisor/qspi_flash.c
diff --git a/ports/stm32f4/supervisor/serial.c b/ports/stm/supervisor/serial.c
index ce1366000..ce1366000 100644
--- a/ports/stm32f4/supervisor/serial.c
+++ b/ports/stm/supervisor/serial.c
diff --git a/ports/stm32f4/supervisor/usb.c b/ports/stm/supervisor/usb.c
index afafe26a9..b66107b7b 100644
--- a/ports/stm32f4/supervisor/usb.c
+++ b/ports/stm/supervisor/usb.c
@@ -30,7 +30,6 @@
#include "supervisor/usb.h"
#include "lib/utils/interrupt_char.h"
#include "lib/mp-readline/readline.h"
-#include "stm32f4xx_hal.h"
#include "py/mpconfig.h"
@@ -38,10 +37,15 @@
STATIC void init_usb_vbus_sense(void) {
-#ifdef BOARD_NO_VBUS_SENSE
+#if (BOARD_NO_VBUS_SENSE)
// Disable VBUS sensing
#ifdef USB_OTG_GCCFG_VBDEN
+ // Deactivate VBUS Sensing B
USB_OTG_FS->GCCFG &= ~USB_OTG_GCCFG_VBDEN;
+
+ // B-peripheral session valid override enable
+ USB_OTG_FS->GOTGCTL |= USB_OTG_GOTGCTL_BVALOEN;
+ USB_OTG_FS->GOTGCTL |= USB_OTG_GOTGCTL_BVALOVAL;
#else
USB_OTG_FS->GCCFG |= USB_OTG_GCCFG_NOVBUSSENS;
USB_OTG_FS->GCCFG &= ~USB_OTG_GCCFG_VBUSBSEN;
@@ -74,39 +78,54 @@ void init_usb_hardware(void) {
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
+ #if CPY_STM32H7
+ GPIO_InitStruct.Alternate = GPIO_AF10_OTG1_FS;
+ #elif CPY_STM32F4 || CPY_STM32F7
GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
+ #endif
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
never_reset_pin_number(0, 11);
never_reset_pin_number(0, 12);
/* Configure VBUS Pin */
+ #if !(BOARD_NO_VBUS_SENSE)
GPIO_InitStruct.Pin = GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
never_reset_pin_number(0, 9);
+ #endif
/* This for ID line debug */
GPIO_InitStruct.Pin = GPIO_PIN_10;
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
+ #if CPY_STM32H7
+ GPIO_InitStruct.Alternate = GPIO_AF10_OTG1_FS;
+ #elif CPY_STM32F4 || CPY_STM32F7
GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
+ #endif
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
never_reset_pin_number(0, 10);
-#ifdef STM32F412Zx
+ #ifdef STM32F412Zx
/* Configure POWER_SWITCH IO pin (F412 ONLY)*/
GPIO_InitStruct.Pin = GPIO_PIN_8;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
never_reset_pin_number(0, 8);
-#endif
-
+ #endif
+
+
+ #if CPY_STM32H7
+ HAL_PWREx_EnableUSBVoltageDetector();
+ __HAL_RCC_USB2_OTG_FS_CLK_ENABLE();
+ #else
/* Peripheral clock enable */
- __HAL_RCC_USB_OTG_FS_CLK_DISABLE();
__HAL_RCC_USB_OTG_FS_CLK_ENABLE();
+ #endif
init_usb_vbus_sense();
}
diff --git a/ports/stm32f4/tick.c b/ports/stm/tick.c
index f4adf183a..67adc84e3 100644
--- a/ports/stm32f4/tick.c
+++ b/ports/stm/tick.c
@@ -30,8 +30,6 @@
#include "supervisor/shared/tick.h"
#include "shared-bindings/microcontroller/Processor.h"
-#include "stm32f4xx.h"
-
void SysTick_Handler(void) {
// SysTick interrupt handler called when the SysTick timer reaches zero
// (every millisecond).
diff --git a/ports/stm32f4/tick.h b/ports/stm/tick.h
index 999acc7a3..17e96362d 100644
--- a/ports/stm32f4/tick.h
+++ b/ports/stm/tick.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef MICROPY_INCLUDED_STM32F4_TICK_H
-#define MICROPY_INCLUDED_STM32F4_TICK_H
+#ifndef MICROPY_INCLUDED_STM32_TICK_H
+#define MICROPY_INCLUDED_STM32_TICK_H
#include "py/mpconfig.h"
@@ -41,4 +41,4 @@ void current_tick(uint64_t* ms, uint32_t* us_until_ms);
// ticks_ms to increment.
void wait_until(uint64_t ms, uint32_t us_until_ms);
-#endif // MICROPY_INCLUDED_STM32F4_TICK_H
+#endif // MICROPY_INCLUDED_STM32_TICK_H
diff --git a/ports/stm/tools/examples/nucleo_h743.csv b/ports/stm/tools/examples/nucleo_h743.csv
new file mode 100644
index 000000000..2481415b3
--- /dev/null
+++ b/ports/stm/tools/examples/nucleo_h743.csv
@@ -0,0 +1,130 @@
+A0,PA3
+A1,PC0
+A2,PC3
+A3,PB1
+A4,PC2
+A5,PF10
+A6,PF4
+A7,PF5
+A8,PF6
+D0,PB7
+D1,PB6
+D2,PG14
+D3,PE13
+D4,PE14
+D5,PE11
+D6,PE9
+D7,PG12
+D8,PF3
+D9,PD15
+D10,PD14
+D11,PB5
+D12,PA6
+D13,PA7
+D14,PB9
+D15,PB8
+D16,PC6
+D17,PB15
+D18,PB13
+D19,PB12
+D20,PA15
+D21,PC7
+D22,PB5
+D23,PB3
+D24,PA4
+D25,PB4
+D26,PG6
+D27,PB2
+D28,PD13
+D29,PD12
+D30,PD11
+D31,PE2
+D32,PA0
+D33,PB0
+D34,PE0
+D35,PB11
+D36,PB10
+D37,PE15
+D38,PE6
+D39,PE12
+D40,PE10
+D41,PE7
+D42,PE8
+D43,PC8
+D44,PC9
+D45,PC10
+D46,PC11
+D47,PC12
+D48,PD2
+D49,PG2
+D50,PG3
+D51,PD7
+D52,PD6
+D53,PD5
+D54,PD4
+D55,PD3
+D56,PE2
+D57,PE4
+D58,PE5
+D59,PE6
+D60,PE3
+D61,PF8
+D62,PF7
+D63,PF9
+D64,PG1
+D65,PG0
+D66,PD1
+D67,PD0
+D68,PF0
+D69,PF1
+D70,PF2
+D71,PE9
+D72,PB2
+DAC1,PA4
+DAC2,PA5
+LED1,PB0
+LED2,PB7
+LED3,PB14
+SW,PC13
+I2C1_SDA,PB9
+I2C1_SCL,PB8
+I2C2_SDA,PF0
+I2C2_SCL,PF1
+I2C4_SCL,PF14
+I2C4_SDA,PF15
+SD_D0,PC8
+SD_D1,PC9
+SD_D2,PC10
+SD_D3,PC11
+SD_CMD,PD2
+SD_CK,PC12
+SD_SW,PG2
+OTG_FS_POWER,PG6
+OTG_FS_OVER_CURRENT,PG7
+USB_VBUS,PA9
+USB_ID,PA10
+USB_DM,PA11
+USB_DP,PA12
+UART2_TX,PD5
+UART2_RX,PD6
+UART2_RTS,PD4
+UART2_CTS,PD3
+UART3_TX,PD8
+UART3_RX,PD9
+UART5_TX,PB6
+UART5_RX,PB12
+UART6_TX,PC6
+UART6_RX,PC7
+UART7_TX,PF7
+UART7_RX,PF6
+UART8_TX,PE1
+UART8_RX,PE0
+ETH_MDC,PC1
+ETH_MDIO,PA2
+ETH_RMII_REF_CLK,PA1
+ETH_RMII_CRS_DV,PA7
+ETH_RMII_RXD0,PC4
+ETH_RMII_RXD1,PC5
+ETH_RMII_TX_EN,PG11
+ETH_RMII_TXD0,PG13
+ETH_RMII_TXD1,PB13 \ No newline at end of file
diff --git a/ports/stm/tools/examples/stm32f405.csv b/ports/stm/tools/examples/stm32f405.csv
new file mode 100644
index 000000000..2602db877
--- /dev/null
+++ b/ports/stm/tools/examples/stm32f405.csv
@@ -0,0 +1,142 @@
+Port,,AF0,AF1,AF2,AF3,AF4,AF5,AF6,AF7,AF8,AF9,AF10,AF11,AF12,AF13,AF14,AF15,
+,,SYS,TIM1/2,TIM3/4/5,TIM8/9/10/11,I2C1/2/3,SPI1/SPI2/I2S2/I2S2ext,SPI3/I2Sext/I2S3,USART1/2/3/I2S3ext,UART4/5/USART6,CAN1/CAN2/TIM12/13/14,OTG_FS/OTG_HS,ETH,FSMC/SDIO/OTG_FS,DCMI,,,ADC
+PortA,PA0,,TIM2_CH1/TIM2_ETR,TIM5_CH1,TIM8_ETR,,,,USART2_CTS,UART4_TX,,,ETH_MII_CRS,,,,EVENTOUT,ADC123_IN0
+PortA,PA1,,TIM2_CH2,TIM5_CH2,,,,,USART2_RTS,UART4_RX,,,ETH_MII_RX_CLK/ETH_RMII_REF_CLK,,,,EVENTOUT,ADC123_IN1
+PortA,PA2,,TIM2_CH3,TIM5_CH3,TIM9_CH1,,,,USART2_TX,,,,ETH_MDIO,,,,EVENTOUT,ADC123_IN2
+PortA,PA3,,TIM2_CH4,TIM5_CH4,TIM9_CH2,,,,USART2_RX,,,OTG_HS_ULPI_D0,ETH_MII_COL,,,,EVENTOUT,ADC123_IN3
+PortA,PA4,,,,,,SPI1_NSS,SPI3_NSS/I2S3_WS,USART2_CK,,,,,OTG_HS_SOF,DCMI_HSYNC,,EVENTOUT,ADC12_IN4
+PortA,PA5,,TIM2_CH1/TIM2_ETR,,TIM8_CH1N,,SPI1_SCK,,,,,OTG_HS_ULPI_CK,,,,,EVENTOUT,ADC12_IN5
+PortA,PA6,,TIM1_BKIN,TIM3_CH1,TIM8_BKIN,,SPI1_MISO,,,,TIM13_CH1,,,,DCMI_PIXCK,,EVENTOUT,ADC12_IN6
+PortA,PA7,,TIM1_CH1N,TIM3_CH2,TIM8_CH1N,,SPI1_MOSI,,,,TIM14_CH1,,ETH_MII_RX_DV/ETH_RMII_CRS_DV,,,,EVENTOUT,ADC12_IN7
+PortA,PA8,MCO1,TIM1_CH1,,,I2C3_SCL,,,USART1_CK,,,OTG_FS_SOF,,,,,EVENTOUT,
+PortA,PA9,,TIM1_CH2,,,I2C3_SMBA,,,USART1_TX,,,,,,DCMI_D0,,EVENTOUT,
+PortA,PA10,,TIM1_CH3,,,,,,USART1_RX,,,OTG_FS_ID,,,DCMI_D1,,EVENTOUT,
+PortA,PA11,,TIM1_CH4,,,,,,USART1_CTS,,CAN1_RX,OTG_FS_DM,,,,,EVENTOUT,
+PortA,PA12,,TIM1_ETR,,,,,,USART1_RTS,,CAN1_TX,OTG_FS_DP,,,,,EVENTOUT,
+PortA,PA13,JTMS/SWDIO,,,,,,,,,,,,,,,EVENTOUT,
+PortA,PA14,JTCK/SWCLK,,,,,,,,,,,,,,,EVENTOUT,
+PortA,PA15,JTDI,TIM2_CH1/TIM2_ETR,,,,SPI1_NSS,SPI3_NSS/I2S3_WS,,,,,,,,,EVENTOUT,
+PortB,PB0,,TIM1_CH2N,TIM3_CH3,TIM8_CH2N,,,,,,,OTG_HS_ULPI_D1,ETH_MII_RXD2,,,,EVENTOUT,ADC12_IN8
+PortB,PB1,,TIM1_CH3N,TIM3_CH4,TIM8_CH3N,,,,,,,OTG_HS_ULPI_D2,ETH_MII_RXD3,,,,EVENTOUT,ADC12_IN9
+PortB,PB2,,,,,,,,,,,,,,,,EVENTOUT,
+PortB,PB3,JTDO/TRACESWO,TIM2_CH2,,,,SPI1_SCK,SPI3_SCK/I2S3_CK,,,,,,,,,EVENTOUT,
+PortB,PB4,NJTRST,,TIM3_CH1,,,SPI1_MISO,SPI3_MISO,I2S3ext_SD,,,,,,,,EVENTOUT,
+PortB,PB5,,,TIM3_CH2,,I2C1_SMBA,SPI1_MOSI,SPI3_MOSI/I2S3_SD,,,CAN2_RX,OTG_HS_ULPI_D7,ETH_PPS_OUT,,DCMI_D10,,EVENTOUT,
+PortB,PB6,,,TIM4_CH1,,I2C1_SCL,,,USART1_TX,,CAN2_TX,,,,DCMI_D5,,EVENTOUT,
+PortB,PB7,,,TIM4_CH2,,I2C1_SDA,,,USART1_RX,,,,,FSMC_NL,DCMI_VSYNC,,EVENTOUT,
+PortB,PB8,,,TIM4_CH3,TIM10_CH1,I2C1_SCL,,,,,CAN1_RX,,ETH_MII_TXD3,SDIO_D4,DCMI_D6,,EVENTOUT,
+PortB,PB9,,,TIM4_CH4,TIM11_CH1,I2C1_SDA,SPI2_NSS/I2S2_WS,,,,CAN1_TX,,,SDIO_D5,DCMI_D7,,EVENTOUT,
+PortB,PB10,,TIM2_CH3,,,I2C2_SCL,SPI2_SCK/I2S2_CK,,USART3_TX,,,OTG_HS_ULPI_D3,ETH_MII_RX_ER,,,,EVENTOUT,
+PortB,PB11,,TIM2_CH4,,,I2C2_SDA,,,USART3_RX,,,OTG_HS_ULPI_D4,ETH_MII_TX_EN/ETH_RMII_TX_EN,,,,EVENTOUT,
+PortB,PB12,,TIM1_BKIN,,,I2C2_SMBA,SPI2_NSS/I2S2_WS,,USART3_CK,,CAN2_RX,OTG_HS_ULPI_D5,ETH_MII_TXD0/ETH_RMII_TXD0,OTG_HS_ID,,,EVENTOUT,
+PortB,PB13,,TIM1_CH1N,,,,SPI2_SCK/I2S2_CK,,USART3_CTS,,CAN2_TX,OTG_HS_ULPI_D6,ETH_MII_TXD1/ETH_RMII_TXD1,,,,EVENTOUT,
+PortB,PB14,,TIM1_CH2N,,TIM8_CH2N,,SPI2_MISO,I2S2ext_SD,USART3_RTS,,TIM12_CH1,,,OTG_HS_DM,,,EVENTOUT,
+PortB,PB15,RTC_REFIN,TIM1_CH3N,,TIM8_CH3N,,SPI2_MOSI/I2S2_SD,,,,TIM12_CH2,,,OTG_HS_DP,,,EVENTOUT,
+PortC,PC0,,,,,,,,,,,OTG_HS_ULPI_STP,,,,,EVENTOUT,ADC123_IN10
+PortC,PC1,,,,,,,,,,,,ETH_MDC,,,,EVENTOUT,ADC123_IN11
+PortC,PC2,,,,,,SPI2_MISO,I2S2ext_SD,,,,OTG_HS_ULPI_DIR,ETH_MII_TXD2,,,,EVENTOUT,ADC123_IN12
+PortC,PC3,,,,,,SPI2_MOSI/I2S2_SD,,,,,OTG_HS_ULPI_NXT,ETH_MII_TX_CLK,,,,EVENTOUT,ADC123_IN13
+PortC,PC4,,,,,,,,,,,,ETH_MII_RXD0/ETH_RMII_RXD0,,,,EVENTOUT,ADC123_IN14
+PortC,PC5,,,,,,,,,,,,ETH_MII_RXD1/ETH_RMII_RXD1,,,,EVENTOUT,ADC123_IN15
+PortC,PC6,,,TIM3_CH1,TIM8_CH1,,I2S2_MCK,,,USART6_TX,,,,SDIO_D6,DCMI_D0,,EVENTOUT,
+PortC,PC7,,,TIM3_CH2,TIM8_CH2,,,I2S3_MCK,,USART6_RX,,,,SDIO_D7,DCMI_D1,,EVENTOUT,
+PortC,PC8,,,TIM3_CH3,TIM8_CH3,,,,,USART6_CK,,,,SDIO_D0,DCMI_D2,,EVENTOUT,
+PortC,PC9,MCO2,,TIM3_CH4,TIM8_CH4,I2C3_SDA,I2S_CKIN,,,,,,,SDIO_D1,DCMI_D3,,EVENTOUT,
+PortC,PC10,,,,,,,SPI3_SCK/I2S3_CK,USART3_TX,UART4_TX,,,,SDIO_D2,DCMI_D8,,EVENTOUT,
+PortC,PC11,,,,,,I2S3ext_SD,SPI3_MISO,USART3_RX,UART4_RX,,,,SDIO_D3,DCMI_D4,,EVENTOUT,
+PortC,PC12,,,,,,,SPI3_MOSI/I2S3_SD,USART3_CK,UART5_TX,,,,SDIO_CK,DCMI_D9,,EVENTOUT,
+PortC,PC13,,,,,,,,,,,,,,,,EVENTOUT,
+PortC,PC14,,,,,,,,,,,,,,,,EVENTOUT,
+PortC,PC15,,,,,,,,,,,,,,,,EVENTOUT,
+PortD,PD0,,,,,,,,,,CAN1_RX,,,FSMC_D2,,,EVENTOUT,
+PortD,PD1,,,,,,,,,,CAN1_TX,,,FSMC_D3,,,EVENTOUT,
+PortD,PD2,,,TIM3_ETR,,,,,,UART5_RX,,,,SDIO_CMD,DCMI_D11,,EVENTOUT,
+PortD,PD3,,,,,,,,USART2_CTS,,,,,FSMC_CLK,,,EVENTOUT,
+PortD,PD4,,,,,,,,USART2_RTS,,,,,FSMC_NOE,,,EVENTOUT,
+PortD,PD5,,,,,,,,USART2_TX,,,,,FSMC_NWE,,,EVENTOUT,
+PortD,PD6,,,,,,,,USART2_RX,,,,,FSMC_NWAIT,,,EVENTOUT,
+PortD,PD7,,,,,,,,USART2_CK,,,,,FSMC_NE1/FSMC_NCE2,,,EVENTOUT,
+PortD,PD8,,,,,,,,USART3_TX,,,,,FSMC_D13,,,EVENTOUT,
+PortD,PD9,,,,,,,,USART3_RX,,,,,FSMC_D14,,,EVENTOUT,
+PortD,PD10,,,,,,,,USART3_CK,,,,,FSMC_D15,,,EVENTOUT,
+PortD,PD11,,,,,,,,USART3_CTS,,,,,FSMC_A16,,,EVENTOUT,
+PortD,PD12,,,TIM4_CH1,,,,,USART3_RTS,,,,,FSMC_A17,,,EVENTOUT,
+PortD,PD13,,,TIM4_CH2,,,,,,,,,,FSMC_A18,,,EVENTOUT,
+PortD,PD14,,,TIM4_CH3,,,,,,,,,,FSMC_D0,,,EVENTOUT,
+PortD,PD15,,,TIM4_CH4,,,,,,,,,,FSMC_D1,,,EVENTOUT,
+PortE,PE0,,,TIM4_ETR,,,,,,,,,,FSMC_NBL0,DCMI_D2,,EVENTOUT,
+PortE,PE1,,,,,,,,,,,,,FSMC_NBL1,DCMI_D3,,EVENTOUT,
+PortE,PE2,TRACECLK,,,,,,,,,,,ETH_MII_TXD3,FSMC_A23,,,EVENTOUT,
+PortE,PE3,TRACED0,,,,,,,,,,,,FSMC_A19,,,EVENTOUT,
+PortE,PE4,TRACED1,,,,,,,,,,,,FSMC_A20,DCMI_D4,,EVENTOUT,
+PortE,PE5,TRACED2,,,TIM9_CH1,,,,,,,,,FSMC_A21,DCMI_D6,,EVENTOUT,
+PortE,PE6,TRACED3,,,TIM9_CH2,,,,,,,,,FSMC_A22,DCMI_D7,,EVENTOUT,
+PortE,PE7,,TIM1_ETR,,,,,,,,,,,FSMC_D4,,,EVENTOUT,
+PortE,PE8,,TIM1_CH1N,,,,,,,,,,,FSMC_D5,,,EVENTOUT,
+PortE,PE9,,TIM1_CH1,,,,,,,,,,,FSMC_D6,,,EVENTOUT,
+PortE,PE10,,TIM1_CH2N,,,,,,,,,,,FSMC_D7,,,EVENTOUT,
+PortE,PE11,,TIM1_CH2,,,,,,,,,,,FSMC_D8,,,EVENTOUT,
+PortE,PE12,,TIM1_CH3N,,,,,,,,,,,FSMC_D9,,,EVENTOUT,
+PortE,PE13,,TIM1_CH3,,,,,,,,,,,FSMC_D10,,,EVENTOUT,
+PortE,PE14,,TIM1_CH4,,,,,,,,,,,FSMC_D11,,,EVENTOUT,
+PortE,PE15,,TIM1_BKIN,,,,,,,,,,,FSMC_D12,,,EVENTOUT,
+PortF,PF0,,,,,I2C2_SDA,,,,,,,,FSMC_A0,,,EVENTOUT,
+PortF,PF1,,,,,I2C2_SCL,,,,,,,,FSMC_A1,,,EVENTOUT,
+PortF,PF2,,,,,I2C2_SMBA,,,,,,,,FSMC_A2,,,EVENTOUT,
+PortF,PF3,,,,,,,,,,,,,FSMC_A3,,,EVENTOUT,ADC3_IN9
+PortF,PF4,,,,,,,,,,,,,FSMC_A4,,,EVENTOUT,ADC3_IN14
+PortF,PF5,,,,,,,,,,,,,FSMC_A5,,,EVENTOUT,ADC3_IN15
+PortF,PF6,,,,TIM10_CH1,,,,,,,,,FSMC_NIORD,,,EVENTOUT,ADC3_IN4
+PortF,PF7,,,,TIM11_CH1,,,,,,,,,FSMC_NREG,,,EVENTOUT,ADC3_IN5
+PortF,PF8,,,,,,,,,,TIM13_CH1,,,FSMC_NIOWR,,,EVENTOUT,ADC3_IN6
+PortF,PF9,,,,,,,,,,TIM14_CH1,,,FSMC_CD,,,EVENTOUT,ADC3_IN7
+PortF,PF10,,,,,,,,,,,,,FSMC_INTR,,,EVENTOUT,ADC3_IN8
+PortF,PF11,,,,,,,,,,,,,,DCMI_D12,,EVENTOUT,
+PortF,PF12,,,,,,,,,,,,,FSMC_A6,,,EVENTOUT,
+PortF,PF13,,,,,,,,,,,,,FSMC_A7,,,EVENTOUT,
+PortF,PF14,,,,,,,,,,,,,FSMC_A8,,,EVENTOUT,
+PortF,PF15,,,,,,,,,,,,,FSMC_A9,,,EVENTOUT,
+PortG,PG0,,,,,,,,,,,,,FSMC_A10,,,EVENTOUT,
+PortG,PG1,,,,,,,,,,,,,FSMC_A11,,,EVENTOUT,
+PortG,PG2,,,,,,,,,,,,,FSMC_A12,,,EVENTOUT,
+PortG,PG3,,,,,,,,,,,,,FSMC_A13,,,EVENTOUT,
+PortG,PG4,,,,,,,,,,,,,FSMC_A14,,,EVENTOUT,
+PortG,PG5,,,,,,,,,,,,,FSMC_A15,,,EVENTOUT,
+PortG,PG6,,,,,,,,,,,,,FSMC_INT2,,,EVENTOUT,
+PortG,PG7,,,,,,,,,USART6_CK,,,,FSMC_INT3,,,EVENTOUT,
+PortG,PG8,,,,,,,,,USART6_RTS,,,ETH_PPS_OUT,,,,EVENTOUT,
+PortG,PG9,,,,,,,,,USART6_RX,,,,FSMC_NE2/FSMC_NCE3,,,EVENTOUT,
+PortG,PG10,,,,,,,,,,,,,FSMC_NCE4_1/FSMC_NE3,,,EVENTOUT,
+PortG,PG11,,,,,,,,,,,,ETH_MII_TX_EN/ETH_RMII_TX_EN,FSMC_NCE4_2,,,EVENTOUT,
+PortG,PG12,,,,,,,,,USART6_RTS,,,,FSMC_NE4,,,EVENTOUT,
+PortG,PG13,,,,,,,,,USART6_CTS,,,ETH_MII_TXD0/ETH_RMII_TXD0,FSMC_A24,,,EVENTOUT,
+PortG,PG14,,,,,,,,,USART6_TX,,,ETH_MII_TXD1/ETH_RMII_TXD1,FSMC_A25,,,EVENTOUT,
+PortG,PG15,,,,,,,,,USART6_CTS,,,,,DCMI_D13,,EVENTOUT,
+PortH,PH0,,,,,,,,,,,,,,,,EVENTOUT,
+PortH,PH1,,,,,,,,,,,,,,,,EVENTOUT,
+PortH,PH2,,,,,,,,,,,,ETH_MII_CRS,,,,EVENTOUT,
+PortH,PH3,,,,,,,,,,,,ETH_MII_COL,,,,EVENTOUT,
+PortH,PH4,,,,,I2C2_SCL,,,,,,OTG_HS_ULPI_NXT,,,,,EVENTOUT,
+PortH,PH5,,,,,I2C2_SDA,,,,,,,,,,,EVENTOUT,
+PortH,PH6,,,,,I2C2_SMBA,,,,,TIM12_CH1,,ETH_MII_RXD2,,,,EVENTOUT,
+PortH,PH7,,,,,I2C3_SCL,,,,,,,ETH_MII_RXD3,,,,EVENTOUT,
+PortH,PH8,,,,,I2C3_SDA,,,,,,,,,DCMI_HSYNC,,EVENTOUT,
+PortH,PH9,,,,,I2C3_SMBA,,,,,TIM12_CH2,,,,DCMI_D0,,EVENTOUT,
+PortH,PH10,,,TIM5_CH1,,,,,,,,,,,DCMI_D1,,EVENTOUT,
+PortH,PH11,,,TIM5_CH2,,,,,,,,,,,DCMI_D2,,EVENTOUT,
+PortH,PH12,,,TIM5_CH3,,,,,,,,,,,DCMI_D3,,EVENTOUT,
+PortH,PH13,,,,TIM8_CH1N,,,,,,CAN1_TX,,,,,,EVENTOUT,
+PortH,PH14,,,,TIM8_CH2N,,,,,,,,,,DCMI_D4,,EVENTOUT,
+PortH,PH15,,,,TIM8_CH3N,,,,,,,,,,DCMI_D11,,EVENTOUT,
+PortI,PI0,,,TIM5_CH4,,,SPI2_NSS/I2S2_WS,,,,,,,,DCMI_D13,,EVENTOUT,
+PortI,PI1,,,,,,SPI2_SCK/I2S2_CK,,,,,,,,DCMI_D8,,EVENTOUT,
+PortI,PI2,,,,TIM8_CH4,,SPI2_MISO,I2S2ext_SD,,,,,,,DCMI_D9,,EVENTOUT,
+PortI,PI3,,,,TIM8_ETR,,SPI2_MOSI/I2S2_SD,,,,,,,,DCMI_D10,,EVENTOUT,
+PortI,PI4,,,,TIM8_BKIN,,,,,,,,,,DCMI_D5,,EVENTOUT,
+PortI,PI5,,,,TIM8_CH1,,,,,,,,,,DCMI_VSYNC,,EVENTOUT,
+PortI,PI6,,,,TIM8_CH2,,,,,,,,,,DCMI_D6,,EVENTOUT,
+PortI,PI7,,,,TIM8_CH3,,,,,,,,,,DCMI_D7,,EVENTOUT,
+PortI,PI8,,,,,,,,,,,,,,,,EVENTOUT,
+PortI,PI9,,,,,,,,,,CAN1_RX,,,,,,EVENTOUT,
+PortI,PI10,,,,,,,,,,,,ETH_MII_RX_ER,,,,EVENTOUT,
+PortI,PI11,,,,,,,,,,,OTG_HS_ULPI_DIR,,,,,EVENTOUT,
diff --git a/ports/stm/tools/parse_af_csv.py b/ports/stm/tools/parse_af_csv.py
new file mode 100644
index 000000000..b257a450c
--- /dev/null
+++ b/ports/stm/tools/parse_af_csv.py
@@ -0,0 +1,137 @@
+# This file is part of the MicroPython project, http://micropython.org/
+#
+# The MIT License (MIT)
+#
+# Copyright (c) 2020 Lucian Copeland 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.
+
+import csv
+import sys
+
+# Use: parse_af_csf.py Filename.csv -pins-only
+# Designed for use with .csv files from Micropython, or in identical format
+# created via Datasheet peripheral tables with a Sheets program.
+#
+# See examples/stm32f405.csv for example formatting.
+
+# Most peripherals (SPI, I2C) output 3 values:
+# peripheral index, alt function, pin string
+def evaluate_periph(inper, inlist, periph, subtype, altfn, pin):
+ # ex) SPI1_SCK,SPI3_SCK/I2S3_CK
+ # Clean anything after a '\' due to SPI/I2S mixing
+ if not inper.find('/') == -1:
+ inper = inper[:inper.find('/')]
+
+ if inper[:len(periph)] == periph and inper[-len(subtype):] == subtype:
+ inlist.append([inper[len(periph):len(periph)+1], altfn, pin])
+
+# Timers (TIM) are a special case with 4 values
+# timer index, alt function, channel, pin string
+def evaluate_tim(inper, inlist, altfn, pin):
+ # ex) TIM2_CH1/TIM2_ETR, TIM5_CH1
+ # Clean anything after a '\' to filter ETR
+ if not inper.find('/') == -1:
+ inper = inper[:inper.find('/')]
+
+ if inper[:3] == "TIM" and inper[5:7] == "CH" and inper[-1:] != 'N':
+ inlist.append([inper[3:4],altfn,inper[-1:],pin])
+
+# Open target file
+with open(sys.argv[1]) as csv_file:
+ csv_reader = csv.reader(csv_file, delimiter=',')
+ line_count = 0
+
+ if sys.argv[2] != "-pins-only":
+ # List of peripheral pin types to read
+ todo = [
+ ["I2C","SDA"],
+ ["I2C","SCL"],
+ ["SPI","SCK"],
+ ["SPI","MOSI"],
+ ["SPI","MISO"],
+ ["UART","TX"],
+ ["UART","RX"]]
+
+ # Make a list of empty lists to populate
+ outlist = []
+ for items in todo:
+ empty = []
+ outlist.append(empty)
+ # TIM
+ empty = []
+ outlist.append(empty)
+
+ # Each line is a list of strings
+ for row in csv_reader:
+ altfn = 0
+ pin = row[1]
+ if len(pin) < 4:
+ pin = pin[:2] + '0' + pin[2:]
+ for col in row:
+ array_index = 0
+ # Evaluate the string for every possible todo entry
+ for item in todo:
+ evaluate_periph(col, outlist[array_index], item[0], item[1], altfn - 2, pin)
+ # UART special case, run again for USART variant
+ if item[0] == "UART":
+ evaluate_periph(col, outlist[array_index], "USART", item[1], altfn - 2, pin)
+ array_index += 1
+ # TIM special case
+ evaluate_tim(col, outlist[-1], altfn - 2, pin)
+ altfn += 1
+ line_count += 1
+
+ # Print formatted output
+ for i in range(len(todo)):
+ ins = (todo[i][0]).lower() + '_' + (todo[i][1]).lower() + '_'
+ # const mcu_i2c_sda_obj_t mcu_i2c_sda_list[4] = {
+ print("const mcu_periph_obj_t mcu_" + ins + "list[" + str(len(outlist[i])) + "] = {")
+ for row in outlist[i]:
+ print(" PERIPH(" + row[0] + ", " + str(row[1]) + ", &pin_" + row[2] + "),")
+ print("};")
+
+ # Timer special case:
+ print("const mcu_tim_pin_obj_t mcu_tim_pin_list[" + str(len(outlist[-1])) + "] = {")
+ for row in outlist[-1]:
+ print(" TIM(" + row[0] + ", " + str(row[1]) + ", " + str(row[2]) + ", &pin_" + row[3] + "),")
+ print("};")
+
+ else:
+ # Format all viable pins listed
+ # ex) const mcu_pin_obj_t pin_PE02 = PIN(4, 2, NO_ADC);
+ # ex 2) extern const mcu_pin_obj_t pin_PE02;
+ # TODO: add ADC detection
+ outlist = []
+
+ for row in csv_reader:
+ altfn = 0
+ pin = row[1]
+ if len(pin) < 4:
+ pin = pin[:2] + '0' + pin[2:]
+ outlist.append([pin, str(ord(row[1][1:2]) - 65), row[1][2:4]])
+ line_count += 1
+
+ for line in outlist:
+ print("const mcu_pin_obj_t pin_" + line[0] + " = PIN(" + line[1] + ", " + line[2] + ", NO_ADC);")
+
+ for line in outlist:
+ print("extern const mcu_pin_obj_t pin_" + line[0] + ";")
+
+ print(f'Processed {line_count} lines.')
diff --git a/ports/stm/tools/parse_pins_csv.py b/ports/stm/tools/parse_pins_csv.py
new file mode 100644
index 000000000..b69b4791b
--- /dev/null
+++ b/ports/stm/tools/parse_pins_csv.py
@@ -0,0 +1,49 @@
+# This file is part of the MicroPython project, http://micropython.org/
+#
+# The MIT License (MIT)
+#
+# Copyright (c) 2020 Lucian Copeland 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.
+
+import csv
+import sys
+
+# Use: parse_pins_csv.py Filename.csv
+# Designed for use with .csv files from Micropython, or in identical format
+# created via Datasheet peripheral tables with a Sheets program.
+#
+# See examples/nucleo_h743.csv for example formatting.
+
+# Open target file
+with open(sys.argv[1]) as csv_file:
+ csv_reader = csv.reader(csv_file, delimiter=',')
+ line_count = 0
+
+ print("STATIC const mp_rom_map_elem_t board_module_globals_table[] = {")
+
+ for row in csv_reader:
+ label = row[0]
+ pin = row[1]
+ if len(pin) < 4:
+ pin = pin[:2] + '0' + pin[2:]
+ print("{ MP_ROM_QSTR(MP_QSTR_" + label + "), MP_ROM_PTR(&pin_" + pin + ") },")
+ line_count += 1
+
+ print(f'Processed {line_count} lines.')
diff --git a/ports/stm/tools/pins.csv b/ports/stm/tools/pins.csv
new file mode 100644
index 000000000..b424c2f78
--- /dev/null
+++ b/ports/stm/tools/pins.csv
@@ -0,0 +1,93 @@
+A0,PA3
+A1,PC0
+A2,PC3
+A3,PB1
+A4,PC2
+A5,PF10
+A6,PF4
+A7,PF5
+A8,PF6
+D0,PB7
+D1,PB6
+D2,PG14
+D3,PE13
+D4,PE14
+D5,PE11
+D6,PE9
+D7,PG12
+D8,PF3
+D9,PD15
+D10,PD14
+D11,PB5
+D12,PA6
+D13,PA5
+D14,PB9
+D15,PB8
+D16,PC6
+D17,PB15
+D18,PB13
+D19,PB12
+D20,PA15
+D21,PC7
+D22,PB5
+D23,PB3
+D24,PA4
+D25,PB4
+D26,PG6
+D27,PB2
+D28,PD13
+D29,PD12
+D30,PD11
+D31,PE2
+D32,PA0
+D33,PB0
+D34,PE0
+D35,PB11
+D36,PB10
+D37,PE15
+D38,PE6
+D39,PE12
+D40,PE10
+D41,PE7
+D42,PE8
+D43,PC8
+D44,PC9
+D45,PC10
+D46,PC11
+D47,PC12
+D48,PD2
+D49,PG2
+D50,PG3
+D51,PD7
+D52,PD6
+D53,PD5
+D54,PD4
+D55,PD3
+D56,PE2
+D57,PE4
+D58,PE5
+D59,PE6
+D60,PE3
+D61,PF8
+D62,PF7
+D63,PF9
+D64,PG1
+D65,PG0
+D66,PD1
+D67,PD0
+D68,PF0
+D69,PF1
+D70,PF2
+D71,PE0
+D72,PB2
+SDA,PB9
+SCL,PB8
+MOSI,PB5
+MISO,PA6
+SCK,PA5
+RX,PB7
+TX,PB6
+LED1,PB00
+LED2,PE01
+LED3,PB14
+SW,PC13
diff --git a/ports/stm/tools/stm32f767_af.csv b/ports/stm/tools/stm32f767_af.csv
new file mode 100644
index 000000000..86f10b6dc
--- /dev/null
+++ b/ports/stm/tools/stm32f767_af.csv
@@ -0,0 +1,168 @@
+PortA,PA0,,TIM2_CH1/TIM2_ETR,TIM5_CH1,TIM8_ETR,,,,USART2_CTS,UART4_TX,,SAI2_SD_B,ETH_MII_CRS,,,,EVENTOUT,ADC123_IN0
+PortA,PA1,,TIM2_CH2,TIM5_CH2,,,,,USART2_RTS,UART4_RX,QUADSPI_BK1_IO3,SAI2_MCK_B,ETH_MII_RX_CLK/ETH_RMII_REF_CLK,,,LCD_R2,EVENTOUT,ADC123_IN1
+PortA,PA2,,TIM2_CH3,TIM5_CH3,TIM9_CH1,,,,USART2_TX,SAI2_SCK_B,,,ETH_MDIO,MDIOS_MDIO,,LCD_R1,EVENTOUT,ADC123_IN2
+PortA,PA3,,TIM2_CH4,TIM5_CH4,TIM9_CH2,,,,USART2_RX,,LCD_B2,OTG_HS_ULPI_D0,ETH_MII_COL,,,LCD_B5,EVENTOUT,ADC123_IN3
+PortA,PA4,,,,,,SPI1_NSS/I2S1_WS,SPI3_NSS/I2S3_WS,USART2_CK,SPI6_NSS,,,,OTG_HS_SOF,DCMI_HSYNC,LCD_VSYNC,EVENTOUT,ADC12_IN4
+PortA,PA5,,TIM2_CH1/TIM2_ETR,,TIM8_CH1N,,SPI1_SCK/I2S1_CK,,,SPI6_SCK,,OTG_HS_ULPI_CK,,,,LCD_R4,EVENTOUT,ADC12_IN5
+PortA,PA6,,TIM1_BKIN,TIM3_CH1,TIM8_BKIN,,SPI1_MISO,,,SPI6_MISO,TIM13_CH1,,,MDIOS_MDC,DCMI_PIXCLK,LCD_G2,EVENTOUT,ADC12_IN6
+PortA,PA7,,TIM1_CH1N,TIM3_CH2,TIM8_CH1N,,SPI1_MOSI/I2S1_SD,,,SPI6_MOSI,TIM14_CH1,,ETH_MII_RX_DV/ETH_RMII_CRS_DV,FMC_SDNWE,,,EVENTOUT,ADC12_IN7
+PortA,PA8,MCO1,TIM1_CH1,,TIM8_BKIN2,I2C3_SCL,,,USART1_CK,,,OTG_FS_SOF,CAN3_RX,UART7_RX,LCD_B3,LCD_R6,EVENTOUT,
+PortA,PA9,,TIM1_CH2,,,I2C3_SMBA,SPI2_SCK/I2S2_CK,,USART1_TX,,,,,,DCMI_D0,LCD_R5,EVENTOUT,
+PortA,PA10,,TIM1_CH3,,,,,,USART1_RX,,LCD_B4,OTG_FS_ID,,MDIOS_MDIO,DCMI_D1,LCD_B1,EVENTOUT,
+PortA,PA11,,TIM1_CH4,,,,SPI2_NSS/I2S2_WS,UART4_RX,USART1_CTS,,CAN1_RX,OTG_FS_DM,,,,LCD_R4,EVENTOUT,
+PortA,PA12,,TIM1_ETR,,,,SPI2_SCK/I2S2_CK,UART4_TX,USART1_RTS,SAI2_FS_B,CAN1_TX,OTG_FS_DP,,,,LCD_R5,EVENTOUT,
+PortA,PA13,JTMS/SWDIO,,,,,,,,,,,,,,,EVENTOUT,
+PortA,PA14,JTCK/SWCLK,,,,,,,,,,,,,,,EVENTOUT,
+PortA,PA15,JTDI,TIM2_CH1/TIM2_ETR,,,HDMI_CEC,SPI1_NSS/I2S1_WS,SPI3_NSS/I2S3_WS,SPI6_NSS,UART4_RTS,,,CAN3_TX,UART7_TX,,,EVENTOUT,
+PortB,PB0,,TIM1_CH2N,TIM3_CH3,TIM8_CH2N,,,DFSDM1_CKOUT,,UART4_CTS,LCD_R3,OTG_HS_ULPI_D1,ETH_MII_RXD2,,,LCD_G1,EVENTOUT,ADC12_IN8
+PortB,PB1,,TIM1_CH3N,TIM3_CH4,TIM8_CH3N,,,DFSDM1_DATAIN1,,,LCD_R6,OTG_HS_ULPI_D2,ETH_MII_RXD3,,,LCD_G0,EVENTOUT,ADC12_IN9
+PortB,PB2,,,,,,,SAI1_SD_A,SPI3_MOSI/I2S3_SD,,QUADSPI_CLK,DFSDM1_CKIN1,,,,,EVENTOUT,
+PortB,PB3,JTDO/TRACESWO,TIM2_CH2,,,,SPI1_SCK/I2S1_CK,SPI3_SCK/I2S3_CK,,SPI6_SCK,,SDMMC2_D2,CAN3_RX,UART7_RX,,,EVENTOUT,
+PortB,PB4,NJTRST,,TIM3_CH1,,,SPI1_MISO,SPI3_MISO,SPI2_NSS/I2S2_WS,SPI6_MISO,,SDMMC2_D3,CAN3_TX,UART7_TX,,,EVENTOUT,
+PortB,PB5,,UART5_RX,TIM3_CH2,,I2C1_SMBA,SPI1_MOSI/I2S1_SD,SPI3_MOSI/I2S3_SD,,SPI6_MOSI,CAN2_RX,OTG_HS_ULPI_D7,ETH_PPS_OUT,FMC_SDCKE1,DCMI_D10,LCD_G7,EVENTOUT,
+PortB,PB6,,UART5_TX,TIM4_CH1,HDMI_CEC,I2C1_SCL,,DFSDM1_DATAIN5,USART1_TX,,CAN2_TX,QUADSPI_BK1_NCS,I2C4_SCL,FMC_SDNE1,DCMI_D5,,EVENTOUT,
+PortB,PB7,,,TIM4_CH2,,I2C1_SDA,,DFSDM1_CKIN5,USART1_RX,,,,I2C4_SDA,FMC_NL,DCMI_VSYNC,,EVENTOUT,
+PortB,PB8,,I2C4_SCL,TIM4_CH3,TIM10_CH1,I2C1_SCL,,DFSDM1_CKIN7,UART5_RX,,CAN1_RX,SDMMC2_D4,ETH_MII_TXD3,SDMMC1_D4,DCMI_D6,LCD_B6,EVENTOUT,
+PortB,PB9,,I2C4_SDA,TIM4_CH4,TIM11_CH1,I2C1_SDA,SPI2_NSS/I2S2_WS,DFSDM1_DATAIN7,UART5_TX,,CAN1_TX,SDMMC2_D5,I2C4_SMBA,SDMMC1_D5,DCMI_D7,LCD_B7,EVENTOUT,
+PortB,PB10,,TIM2_CH3,,,I2C2_SCL,SPI2_SCK/I2S2_CK,DFSDM1_DATAIN7,USART3_TX,,QUADSPI_BK1_NCS,OTG_HS_ULPI_D3,ETH_MII_RX_ER,,,LCD_G4,EVENTOUT,
+PortB,PB11,,TIM2_CH4,,,I2C2_SDA,,DFSDM1_CKIN7,USART3_RX,,,OTG_HS_ULPI_D4,ETH_MII_TX_EN/ETH_RMII_TX_EN,,DSI_TE,LCD_G5,EVENTOUT,
+PortB,PB12,,TIM1_BKIN,,,I2C2_SMBA,SPI2_NSS/I2S2_WS,DFSDM1_DATAIN1,USART3_CK,UART5_RX,CAN2_RX,OTG_HS_ULPI_D5,ETH_MII_TXD0/ETH_RMII_TXD0,OTG_HS_ID,,,EVENTOUT,
+PortB,PB13,,TIM1_CH1N,,,,SPI2_SCK/I2S2_CK,DFSDM1_CKIN1,USART3_CTS,UART5_TX,CAN2_TX,OTG_HS_ULPI_D6,ETH_MII_TXD1/ETH_RMII_TXD1,,,,EVENTOUT,
+PortB,PB14,,TIM1_CH2N,,TIM8_CH2N,USART1_TX,SPI2_MISO,DFSDM1_DATAIN2,USART3_RTS,UART4_RTS,TIM12_CH1,SDMMC2_D0,,OTG_HS_DM,,,EVENTOUT,
+PortB,PB15,RTC_REFIN,TIM1_CH3N,,TIM8_CH3N,USART1_RX,SPI2_MOSI/I2S2_SD,DFSDM1_CKIN2,,UART4_CTS,TIM12_CH2,SDMMC2_D1,,OTG_HS_DP,,,EVENTOUT,
+PortC,PC0,,,,DFSDM1_CKIN0,,,DFSDM1_DATAIN4,,SAI2_FS_B,,OTG_HS_ULPI_STP,,FMC_SDNWE,,LCD_R5,EVENTOUT,ADC123_IN10
+PortC,PC1,TRACED0,,,DFSDM1_DATAIN0,,SPI2_MOSI/I2S2_SD,SAI1_SD_A,,,,DFSDM1_CKIN4,ETH_MDC,MDIOS_MDC,,,EVENTOUT,ADC123_IN11
+PortC,PC2,,,,DFSDM1_CKIN1,,SPI2_MISO,DFSDM1_CKOUT,,,,OTG_HS_ULPI_DIR,ETH_MII_TXD2,FMC_SDNE0,,,EVENTOUT,ADC123_IN12
+PortC,PC3,,,,DFSDM1_DATAIN1,,SPI2_MOSI/I2S2_SD,,,,,OTG_HS_ULPI_NXT,ETH_MII_TX_CLK,FMC_SDCKE0,,,EVENTOUT,ADC123_IN13
+PortC,PC4,,,,DFSDM1_CKIN2,,I2S1_MCK,,,SPDIFRX_IN2,,,ETH_MII_RXD0/ETH_RMII_RXD0,FMC_SDNE0,,,EVENTOUT,ADC12_IN14
+PortC,PC5,,,,DFSDM1_DATAIN2,,,,,SPDIFRX_IN3,,,ETH_MII_RXD1/ETH_RMII_RXD1,FMC_SDCKE0,,,EVENTOUT,ADC12_IN15
+PortC,PC6,,,TIM3_CH1,TIM8_CH1,,I2S2_MCK,,DFSDM1_CKIN3,USART6_TX,FMC_NWAIT,SDMMC2_D6,,SDMMC1_D6,DCMI_D0,LCD_HSYNC,EVENTOUT,
+PortC,PC7,,,TIM3_CH2,TIM8_CH2,,,I2S3_MCK,DFSDM1_DATAIN3,USART6_RX,FMC_NE1,SDMMC2_D7,,SDMMC1_D7,DCMI_D1,LCD_G6,EVENTOUT,
+PortC,PC8,TRACED1,,TIM3_CH3,TIM8_CH3,,,,UART5_RTS,USART6_CK,FMC_NE2/FMC_NCE,,,SDMMC1_D0,DCMI_D2,,EVENTOUT,
+PortC,PC9,MCO2,,TIM3_CH4,TIM8_CH4,I2C3_SDA,I2S_CKIN,,UART5_CTS,,QUADSPI_BK1_IO0,LCD_G3,,SDMMC1_D1,DCMI_D3,LCD_B2,EVENTOUT,
+PortC,PC10,,,,DFSDM1_CKIN5,,,SPI3_SCK/I2S3_CK,USART3_TX,UART4_TX,QUADSPI_BK1_IO1,,,SDMMC1_D2,DCMI_D8,LCD_R2,EVENTOUT,
+PortC,PC11,,,,DFSDM1_DATAIN5,,,SPI3_MISO,USART3_RX,UART4_RX,QUADSPI_BK2_NCS,,,SDMMC1_D3,DCMI_D4,,EVENTOUT,
+PortC,PC12,TRACED3,,,,,,SPI3_MOSI/I2S3_SD,USART3_CK,UART5_TX,,,,SDMMC1_CK,DCMI_D9,,EVENTOUT,
+PortC,PC13,,,,,,,,,,,,,,,,EVENTOUT,
+PortC,PC14,,,,,,,,,,,,,,,,EVENTOUT,
+PortC,PC15,,,,,,,,,,,,,,,,EVENTOUT,
+PortD,PD0,,,,DFSDM1_CKIN6,,,DFSDM1_DATAIN7,,UART4_RX,CAN1_RX,,,FMC_D2,,,EVENTOUT,
+PortD,PD1,,,,DFSDM1_DATAIN6,,,DFSDM1_CKIN7,,UART4_TX,CAN1_TX,,,FMC_D3,,,EVENTOUT,
+PortD,PD2,TRACED2,,TIM3_ETR,,,,,,UART5_RX,,,,SDMMC1_CMD,DCMI_D11,,EVENTOUT,
+PortD,PD3,,,,DFSDM1_CKOUT,,SPI2_SCK/I2S2_CK,DFSDM1_DATAIN0,USART2_CTS,,,,,FMC_CLK,DCMI_D5,LCD_G7,EVENTOUT,
+PortD,PD4,,,,,,,DFSDM1_CKIN0,USART2_RTS,,,,,FMC_NOE,,,EVENTOUT,
+PortD,PD5,,,,,,,,USART2_TX,,,,,FMC_NWE,,,EVENTOUT,
+PortD,PD6,,,,DFSDM1_CKIN4,,SPI3_MOSI/I2S3_SD,SAI1_SD_A,USART2_RX,,,DFSDM1_DATAIN1,SDMMC2_CK,FMC_NWAIT,DCMI_D10,LCD_B2,EVENTOUT,
+PortD,PD7,,,,DFSDM1_DATAIN4,,SPI1_MOSI/I2S1_SD,DFSDM1_CKIN1,USART2_CK,SPDIFRX_IN0,,,SDMMC2_CMD,FMC_NE1,,,EVENTOUT,
+PortD,PD8,,,,DFSDM1_CKIN3,,,,USART3_TX,SPDIFRX_IN1,,,,FMC_D13,,,EVENTOUT,
+PortD,PD9,,,,DFSDM1_DATAIN3,,,,USART3_RX,,,,,FMC_D14,,,EVENTOUT,
+PortD,PD10,,,,DFSDM1_CKOUT,,,,USART3_CK,,,,,FMC_D15,,LCD_B3,EVENTOUT,
+PortD,PD11,,,,,I2C4_SMBA,,,USART3_CTS,,QUADSPI_BK1_IO0,SAI2_SD_A,,FMC_A16/FMC_CLE,,,EVENTOUT,
+PortD,PD12,,,TIM4_CH1,LPTIM1_IN1,I2C4_SCL,,,USART3_RTS,,QUADSPI_BK1_IO1,SAI2_FS_A,,FMC_A17/FMC_ALE,,,EVENTOUT,
+PortD,PD13,,,TIM4_CH2,LPTIM1_OUT,I2C4_SDA,,,,,QUADSPI_BK1_IO3,SAI2_SCK_A,,FMC_A18,,,EVENTOUT,
+PortD,PD14,,,TIM4_CH3,,,,,,UART8_CTS,,,,FMC_D0,,,EVENTOUT,
+PortD,PD15,,,TIM4_CH4,,,,,,UART8_RTS,,,,FMC_D1,,,EVENTOUT,
+PortE,PE0,,,TIM4_ETR,LPTIM1_ETR,,,,,UART8_RX,,SAI2_MCK_A,,FMC_NBL0,DCMI_D2,,EVENTOUT,
+PortE,PE1,,,,LPTIM1_IN2,,,,,UART8_TX,,,,FMC_NBL1,DCMI_D3,,EVENTOUT,
+PortE,PE2,TRACECLK,,,,,SPI4_SCK,SAI1_MCLK_A,,,QUADSPI_BK1_IO2,,ETH_MII_TXD3,FMC_A23,,,EVENTOUT,
+PortE,PE3,TRACED0,,,,,,SAI1_SD_B,,,,,,FMC_A19,,,EVENTOUT,
+PortE,PE4,TRACED1,,,,,SPI4_NSS,SAI1_FS_A,,,,DFSDM1_DATAIN3,,FMC_A20,DCMI_D4,LCD_B0,EVENTOUT,
+PortE,PE5,TRACED2,,,TIM9_CH1,,SPI4_MISO,SAI1_SCK_A,,,,DFSDM1_CKIN3,,FMC_A21,DCMI_D6,LCD_G0,EVENTOUT,
+PortE,PE6,TRACED3,TIM1_BKIN2,,TIM9_CH2,,SPI4_MOSI,SAI1_SD_A,,,,SAI2_MCK_B,,FMC_A22,DCMI_D7,LCD_G1,EVENTOUT,
+PortE,PE7,,TIM1_ETR,,,,,DFSDM1_DATAIN2,,UART7_RX,,QUADSPI_BK2_IO0,,FMC_D4,,,EVENTOUT,
+PortE,PE8,,TIM1_CH1N,,,,,DFSDM1_CKIN2,,UART7_TX,,QUADSPI_BK2_IO1,,FMC_D5,,,EVENTOUT,
+PortE,PE9,,TIM1_CH1,,,,,DFSDM1_CKOUT,,UART7_RTS,,QUADSPI_BK2_IO2,,FMC_D6,,,EVENTOUT,
+PortE,PE10,,TIM1_CH2N,,,,,DFSDM1_DATAIN4,,UART7_CTS,,QUADSPI_BK2_IO3,,FMC_D7,,,EVENTOUT,
+PortE,PE11,,TIM1_CH2,,,,SPI4_NSS,DFSDM1_CKIN4,,,,SAI2_SD_B,,FMC_D8,,LCD_G3,EVENTOUT,
+PortE,PE12,,TIM1_CH3N,,,,SPI4_SCK,DFSDM1_DATAIN5,,,,SAI2_SCK_B,,FMC_D9,,LCD_B4,EVENTOUT,
+PortE,PE13,,TIM1_CH3,,,,SPI4_MISO,DFSDM1_CKIN5,,,,SAI2_FS_B,,FMC_D10,,LCD_DE,EVENTOUT,
+PortE,PE14,,TIM1_CH4,,,,SPI4_MOSI,,,,,SAI2_MCK_B,,FMC_D11,,LCD_CLK,EVENTOUT,
+PortE,PE15,,TIM1_BKIN,,,,,,,,,,,FMC_D12,,LCD_R7,EVENTOUT,
+PortF,PF0,,,,,I2C2_SDA,,,,,,,,FMC_A0,,,EVENTOUT,
+PortF,PF1,,,,,I2C2_SCL,,,,,,,,FMC_A1,,,EVENTOUT,
+PortF,PF2,,,,,I2C2_SMBA,,,,,,,,FMC_A2,,,EVENTOUT,
+PortF,PF3,,,,,,,,,,,,,FMC_A3,,,EVENTOUT,ADC3_IN9
+PortF,PF4,,,,,,,,,,,,,FMC_A4,,,EVENTOUT,ADC3_IN14
+PortF,PF5,,,,,,,,,,,,,FMC_A5,,,EVENTOUT,ADC3_IN15
+PortF,PF6,,,,TIM10_CH1,,SPI5_NSS,SAI1_SD_B,,UART7_RX,QUADSPI_BK1_IO3,,,,,,EVENTOUT,ADC3_IN4
+PortF,PF7,,,,TIM11_CH1,,SPI5_SCK,SAI1_MCLK_B,,UART7_TX,QUADSPI_BK1_IO2,,,,,,EVENTOUT,ADC3_IN5
+PortF,PF8,,,,,,SPI5_MISO,SAI1_SCK_B,,UART7_RTS,TIM13_CH1,QUADSPI_BK1_IO0,,,,,EVENTOUT,ADC3_IN6
+PortF,PF9,,,,,,SPI5_MOSI,SAI1_FS_B,,UART7_CTS,TIM14_CH1,QUADSPI_BK1_IO1,,,,,EVENTOUT,ADC3_IN7
+PortF,PF10,,,,,,,,,,QUADSPI_CLK,,,,DCMI_D11,LCD_DE,EVENTOUT,ADC3_IN8
+PortF,PF11,,,,,,SPI5_MOSI,,,,,SAI2_SD_B,,FMC_SDNRAS,DCMI_D12,,EVENTOUT,
+PortF,PF12,,,,,,,,,,,,,FMC_A6,,,EVENTOUT,
+PortF,PF13,,,,,I2C4_SMBA,,DFSDM1_DATAIN6,,,,,,FMC_A7,,,EVENTOUT,
+PortF,PF14,,,,,I2C4_SCL,,DFSDM1_CKIN6,,,,,,FMC_A8,,,EVENTOUT,
+PortF,PF15,,,,,I2C4_SDA,,,,,,,,FMC_A9,,,EVENTOUT,
+PortG,PG0,,,,,,,,,,,,,FMC_A10,,,EVENTOUT,
+PortG,PG1,,,,,,,,,,,,,FMC_A11,,,EVENTOUT,
+PortG,PG2,,,,,,,,,,,,,FMC_A12,,,EVENTOUT,
+PortG,PG3,,,,,,,,,,,,,FMC_A13,,,EVENTOUT,
+PortG,PG4,,,,,,,,,,,,,FMC_A14/FMC_BA0,,,EVENTOUT,
+PortG,PG5,,,,,,,,,,,,,FMC_A15/FMC_BA1,,,EVENTOUT,
+PortG,PG6,,,,,,,,,,,,,FMC_NE3,DCMI_D12,LCD_R7,EVENTOUT,
+PortG,PG7,,,,,,,SAI1_MCLK_A,,USART6_CK,,,,FMC_INT,DCMI_D13,LCD_CLK,EVENTOUT,
+PortG,PG8,,,,,,SPI6_NSS,,SPDIFRX_IN2,USART6_RTS,,,ETH_PPS_OUT,FMC_SDCLK,,LCD_G7,EVENTOUT,
+PortG,PG9,,,,,,SPI1_MISO,,SPDIFRX_IN3,USART6_RX,QUADSPI_BK2_IO2,SAI2_FS_B,SDMMC2_D0,FMC_NE2/FMC_NCE,DCMI_VSYNC,,EVENTOUT,
+PortG,PG10,,,,,,SPI1_NSS/I2S1_WS,,,,LCD_G3,SAI2_SD_B,SDMMC2_D1,FMC_NE3,DCMI_D2,LCD_B2,EVENTOUT,
+PortG,PG11,,,,,,SPI1_SCK/I2S1_CK,,SPDIFRX_IN0,,,SDMMC2_D2,ETH_MII_TX_EN/ETH_RMII_TX_EN,,DCMI_D3,LCD_B3,EVENTOUT,
+PortG,PG12,,,,LPTIM1_IN1,,SPI6_MISO,,SPDIFRX_IN1,USART6_RTS,LCD_B4,,SDMMC2_D3,FMC_NE4,,LCD_B1,EVENTOUT,
+PortG,PG13,TRACED0,,,LPTIM1_OUT,,SPI6_SCK,,,USART6_CTS,,,ETH_MII_TXD0/ETH_RMII_TXD0,FMC_A24,,LCD_R0,EVENTOUT,
+PortG,PG14,TRACED1,,,LPTIM1_ETR,,SPI6_MOSI,,,USART6_TX,QUADSPI_BK2_IO3,,ETH_MII_TXD1/ETH_RMII_TXD1,FMC_A25,,LCD_B0,EVENTOUT,
+PortG,PG15,,,,,,,,,USART6_CTS,,,,FMC_SDNCAS,DCMI_D13,,EVENTOUT,
+PortH,PH0,,,,,,,,,,,,,,,,EVENTOUT,
+PortH,PH1,,,,,,,,,,,,,,,,EVENTOUT,
+PortH,PH2,,,,LPTIM1_IN2,,,,,,QUADSPI_BK2_IO0,SAI2_SCK_B,ETH_MII_CRS,FMC_SDCKE0,,LCD_R0,EVENTOUT,
+PortH,PH3,,,,,,,,,,QUADSPI_BK2_IO1,SAI2_MCK_B,ETH_MII_COL,FMC_SDNE0,,LCD_R1,EVENTOUT,
+PortH,PH4,,,,,I2C2_SCL,,,,,LCD_G5,OTG_HS_ULPI_NXT,,,,LCD_G4,EVENTOUT,
+PortH,PH5,,,,,I2C2_SDA,SPI5_NSS,,,,,,,FMC_SDNWE,,,EVENTOUT,
+PortH,PH6,,,,,I2C2_SMBA,SPI5_SCK,,,,TIM12_CH1,,ETH_MII_RXD2,FMC_SDNE1,DCMI_D8,,EVENTOUT,
+PortH,PH7,,,,,I2C3_SCL,SPI5_MISO,,,,,,ETH_MII_RXD3,FMC_SDCKE1,DCMI_D9,,EVENTOUT,
+PortH,PH8,,,,,I2C3_SDA,,,,,,,,FMC_D16,DCMI_HSYNC,LCD_R2,EVENTOUT,
+PortH,PH9,,,,,I2C3_SMBA,,,,,TIM12_CH2,,,FMC_D17,DCMI_D0,LCD_R3,EVENTOUT,
+PortH,PH10,,,TIM5_CH1,,I2C4_SMBA,,,,,,,,FMC_D18,DCMI_D1,LCD_R4,EVENTOUT,
+PortH,PH11,,,TIM5_CH2,,I2C4_SCL,,,,,,,,FMC_D19,DCMI_D2,LCD_R5,EVENTOUT,
+PortH,PH12,,,TIM5_CH3,,I2C4_SDA,,,,,,,,FMC_D20,DCMI_D3,LCD_R6,EVENTOUT,
+PortH,PH13,,,,TIM8_CH1N,,,,,UART4_TX,CAN1_TX,,,FMC_D21,,LCD_G2,EVENTOUT,
+PortH,PH14,,,,TIM8_CH2N,,,,,UART4_RX,CAN1_RX,,,FMC_D22,DCMI_D4,LCD_G3,EVENTOUT,
+PortH,PH15,,,,TIM8_CH3N,,,,,,,,,FMC_D23,DCMI_D11,LCD_G4,EVENTOUT,
+PortI,PI0,,,TIM5_CH4,,,SPI2_NSS/I2S2_WS,,,,,,,FMC_D24,DCMI_D13,LCD_G5,EVENTOUT,
+PortI,PI1,,,,TIM8_BKIN2,,SPI2_SCK/I2S2_CK,,,,,,,FMC_D25,DCMI_D8,LCD_G6,EVENTOUT,
+PortI,PI2,,,,TIM8_CH4,,SPI2_MISO,,,,,,,FMC_D26,DCMI_D9,LCD_G7,EVENTOUT,
+PortI,PI3,,,,TIM8_ETR,,SPI2_MOSI/I2S2_SD,,,,,,,FMC_D27,DCMI_D10,,EVENTOUT,
+PortI,PI4,,,,TIM8_BKIN,,,,,,,SAI2_MCK_A,,FMC_NBL2,DCMI_D5,LCD_B4,EVENTOUT,
+PortI,PI5,,,,TIM8_CH1,,,,,,,SAI2_SCK_A,,FMC_NBL3,DCMI_VSYNC,LCD_B5,EVENTOUT,
+PortI,PI6,,,,TIM8_CH2,,,,,,,SAI2_SD_A,,FMC_D28,DCMI_D6,LCD_B6,EVENTOUT,
+PortI,PI7,,,,TIM8_CH3,,,,,,,SAI2_FS_A,,FMC_D29,DCMI_D7,LCD_B7,EVENTOUT,
+PortI,PI8,,,,,,,,,,,,,,,,EVENTOUT,
+PortI,PI9,,,,,,,,,UART4_RX,CAN1_RX,,,FMC_D30,,LCD_VSYNC,EVENTOUT,
+PortI,PI10,,,,,,,,,,,,ETH_MII_RX_ER,FMC_D31,,LCD_HSYNC,EVENTOUT,
+PortI,PI11,,,,,,,,,,LCD_G6,OTG_HS_ULPI_DIR,,,,,EVENTOUT,
+PortI,PI12,,,,,,,,,,,,,,,LCD_HSYNC,EVENTOUT,
+PortI,PI13,,,,,,,,,,,,,,,LCD_VSYNC,EVENTOUT,
+PortI,PI14,,,,,,,,,,,,,,,LCD_CLK,EVENTOUT,
+PortI,PI15,,,,,,,,,,LCD_G2,,,,,LCD_R0,EVENTOUT,
+PortJ,PJ0,,,,,,,,,,LCD_R7,,,,,LCD_R1,EVENTOUT,
+PortJ,PJ1,,,,,,,,,,,,,,,LCD_R2,EVENTOUT,
+PortJ,PJ2,,,,,,,,,,,,,,DSI_TE,LCD_R3,EVENTOUT,
+PortJ,PJ3,,,,,,,,,,,,,,,LCD_R4,EVENTOUT,
+PortJ,PJ4,,,,,,,,,,,,,,,LCD_R5,EVENTOUT,
+PortJ,PJ5,,,,,,,,,,,,,,,LCD_R6,EVENTOUT,
+PortJ,PJ6,,,,,,,,,,,,,,,LCD_R7,EVENTOUT,
+PortJ,PJ7,,,,,,,,,,,,,,,LCD_G0,EVENTOUT,
+PortJ,PJ8,,,,,,,,,,,,,,,LCD_G1,EVENTOUT,
+PortJ,PJ9,,,,,,,,,,,,,,,LCD_G2,EVENTOUT,
+PortJ,PJ10,,,,,,,,,,,,,,,LCD_G3,EVENTOUT,
+PortJ,PJ11,,,,,,,,,,,,,,,LCD_G4,EVENTOUT,
+PortJ,PJ12,,,,,,,,,,LCD_G3,,,,,LCD_B0,EVENTOUT,
+PortJ,PJ13,,,,,,,,,,LCD_G4,,,,,LCD_B1,EVENTOUT,
+PortJ,PJ14,,,,,,,,,,,,,,,LCD_B2,EVENTOUT,
+PortJ,PJ15,,,,,,,,,,,,,,,LCD_B3,EVENTOUT,
+PortK,PK0,,,,,,,,,,,,,,,LCD_G5,EVENTOUT,
+PortK,PK1,,,,,,,,,,,,,,,LCD_G6,EVENTOUT,
+PortK,PK2,,,,,,,,,,,,,,,LCD_G7,EVENTOUT,
+PortK,PK3,,,,,,,,,,,,,,,LCD_B4,EVENTOUT,
+PortK,PK4,,,,,,,,,,,,,,,LCD_B5,EVENTOUT,
+PortK,PK5,,,,,,,,,,,,,,,LCD_B6,EVENTOUT,
+PortK,PK6,,,,,,,,,,,,,,,LCD_B7,EVENTOUT,
+PortK,PK7,,,,,,,,,,,,,,,LCD_DE,EVENTOUT,
diff --git a/ports/stm32f4/README.md b/ports/stm32f4/README.md
deleted file mode 100644
index a860c01ce..000000000
--- a/ports/stm32f4/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# CircuitPython Port To The ST Microelectronics STM32F4 Series
-
-This is a port of CircuitPython to the STM32F4 series of chips.
diff --git a/ports/stm32f4/boards/STM32F405_boot.ld b/ports/stm32f4/boards/STM32F405_boot.ld
deleted file mode 100644
index 64da3b652..000000000
--- a/ports/stm32f4/boards/STM32F405_boot.ld
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- GNU linker script for STM32F405 with bootloader
- Based on Micropython
-*/
-
-/* Specify the memory areas */
-MEMORY
-{
- FLASH (rx) : ORIGIN = 0x08010000, LENGTH = 1024K - 64K /* entire flash, sans bootloader region */
- FLASH_ISR (rx) : ORIGIN = 0x08010000, LENGTH = 64K /* sector 0 */
- FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 1024K - 64K - 64K /* sectors 5+ */
- CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
- RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
-}
-
-/* produce a link error if there is not this amount of RAM for these sections */
-_minimum_stack_size = 2K;
-_minimum_heap_size = 16K;
-
-/* Define the top end of the stack. The stack is full descending so begins just
- above last byte of RAM. Note that EABI requires the stack to be 8-byte
- aligned for a call. */
-_estack = ORIGIN(RAM) + LENGTH(RAM);
-
-/* RAM extents for the garbage collector */
-_ram_start = ORIGIN(RAM);
-_ram_end = ORIGIN(RAM) + LENGTH(RAM);
-
-ENTRY(Reset_Handler)
-
-/* define output sections */
-SECTIONS
-{
- /* The startup code goes first into FLASH */
- .isr_vector :
- {
- . = ALIGN(4);
- KEEP(*(.isr_vector)) /* Startup code */
-
- /* This first flash block is 16K annd the isr vectors only take up
- about 400 bytes. Micropython pads this with files, but this didn't
- work with the size of Circuitpython's ff object. */
-
- . = ALIGN(4);
- } >FLASH_ISR
-
- /* The program code and other data goes into FLASH */
- .text :
- {
- . = ALIGN(4);
- *(.text*) /* .text* sections (code) */
- *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
- /* *(.glue_7) */ /* glue arm to thumb code */
- /* *(.glue_7t) */ /* glue thumb to arm code */
-
- . = ALIGN(4);
- _etext = .; /* define a global symbol at end of code */
- } >FLASH_TEXT
-
- /* used by the startup to initialize data */
- _sidata = LOADADDR(.data);
-
- /* This is the initialized data section
- The program executes knowing that the data is in the RAM
- but the loader puts the initial values in the FLASH (inidata).
- It is one task of the startup to copy the initial values from FLASH to RAM. */
- .data :
- {
- . = ALIGN(4);
- _sdata = .; /* create a global symbol at data start; used by startup code in order to initialise the .data section in RAM */
- *(.data*) /* .data* sections */
-
- . = ALIGN(4);
- _edata = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */
- } >RAM AT> FLASH_TEXT
-
- /* Uninitialized data section */
- .bss :
- {
- . = ALIGN(4);
- _sbss = .; /* define a global symbol at bss start; used by startup code */
- *(.bss*)
- *(COMMON)
-
- . = ALIGN(4);
- _ebss = .; /* define a global symbol at bss end; used by startup code and GC */
- } >RAM
-
- /* this is to define the start of the heap, and make sure we have a minimum size */
- .heap :
- {
- . = ALIGN(4);
- . = . + _minimum_heap_size;
- . = ALIGN(4);
- } >RAM
-
- /* this just checks there is enough RAM for the stack */
- .stack :
- {
- . = ALIGN(4);
- . = . + _minimum_stack_size;
- . = ALIGN(4);
- } >RAM
-
- .ARM.attributes 0 : { *(.ARM.attributes) }
-}
-
diff --git a/ports/stm32f4/boards/STM32F405_fs.ld b/ports/stm32f4/boards/STM32F405_fs.ld
deleted file mode 100644
index 7f7c91784..000000000
--- a/ports/stm32f4/boards/STM32F405_fs.ld
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- GNU linker script for STM32F405 via Micropython
-*/
-
-/* Specify the memory areas */
-MEMORY
-{
- FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K /* entire flash */
- FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */
- FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 48K /* sectors 1,2,3 are 16K */
- FLASH_TEXT (rx) : ORIGIN = 0x08010000, LENGTH = 960K /* sector 4 is 64K, sectors 5,6,7 are 128K */
- CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
- RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
-}
-
-/* produce a link error if there is not this amount of RAM for these sections */
-_minimum_stack_size = 2K;
-_minimum_heap_size = 16K;
-
-/* Define tho top end of the stack. The stack is full descending so begins just
- above last byte of RAM. Note that EABI requires the stack to be 8-byte
- aligned for a call. */
-_estack = ORIGIN(RAM) + LENGTH(RAM);
-
-/* RAM extents for the garbage collector */
-_ram_start = ORIGIN(RAM);
-_ram_end = ORIGIN(RAM) + LENGTH(RAM);
-
-ENTRY(Reset_Handler)
-
-/* define output sections */
-SECTIONS
-{
- /* The startup code goes first into FLASH */
- .isr_vector :
- {
- . = ALIGN(4);
- KEEP(*(.isr_vector)) /* Startup code */
-
- /* This first flash block is 16K annd the isr vectors only take up
- about 400 bytes. Micropython pads this with files, but this didn't
- work with the size of Circuitpython's ff object. */
-
- . = ALIGN(4);
- } >FLASH_ISR
-
- /* The program code and other data goes into FLASH */
- .text :
- {
- . = ALIGN(4);
- *(.text*) /* .text* sections (code) */
- *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
- /* *(.glue_7) */ /* glue arm to thumb code */
- /* *(.glue_7t) */ /* glue thumb to arm code */
-
- . = ALIGN(4);
- _etext = .; /* define a global symbol at end of code */
- } >FLASH_TEXT
-
- /* used by the startup to initialize data */
- _sidata = LOADADDR(.data);
-
- /* This is the initialized data section
- The program executes knowing that the data is in the RAM
- but the loader puts the initial values in the FLASH (inidata).
- It is one task of the startup to copy the initial values from FLASH to RAM. */
- .data :
- {
- . = ALIGN(4);
- _sdata = .; /* create a global symbol at data start; used by startup code in order to initialise the .data section in RAM */
- *(.data*) /* .data* sections */
-
- . = ALIGN(4);
- _edata = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */
- } >RAM AT> FLASH_TEXT
-
- /* Uninitialized data section */
- .bss :
- {
- . = ALIGN(4);
- _sbss = .; /* define a global symbol at bss start; used by startup code */
- *(.bss*)
- *(COMMON)
-
- . = ALIGN(4);
- _ebss = .; /* define a global symbol at bss end; used by startup code and GC */
- } >RAM
-
- /* this is to define the start of the heap, and make sure we have a minimum size */
- .heap :
- {
- . = ALIGN(4);
- . = . + _minimum_heap_size;
- . = ALIGN(4);
- } >RAM
-
- /* this just checks there is enough RAM for the stack */
- .stack :
- {
- . = ALIGN(4);
- . = . + _minimum_stack_size;
- . = ALIGN(4);
- } >RAM
-
- .ARM.attributes 0 : { *(.ARM.attributes) }
-}
-
-
diff --git a/ports/stm32f4/boards/STM32F411VETx_FLASH.ld b/ports/stm32f4/boards/STM32F411VETx_FLASH.ld
deleted file mode 100644
index ac1ba3240..000000000
--- a/ports/stm32f4/boards/STM32F411VETx_FLASH.ld
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- GNU linker script for STM32F411 via Micropython
-*/
-
-/* Specify the memory areas */
-MEMORY
-{
- FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K /* entire flash */
- FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */
- FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 48K /* sectors 1,2,3 are 16K */
- FLASH_TEXT (rx) : ORIGIN = 0x08010000, LENGTH = 448K /* sector 4 is 64K, sectors 5,6,7 are 128K */
- RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
-}
-
-/* produce a link error if there is not this amount of RAM for these sections */
-_minimum_stack_size = 2K;
-_minimum_heap_size = 16K;
-
-/* Define tho top end of the stack. The stack is full descending so begins just
- above last byte of RAM. Note that EABI requires the stack to be 8-byte
- aligned for a call. */
-_estack = ORIGIN(RAM) + LENGTH(RAM);
-
-/* RAM extents for the garbage collector */
-_ram_start = ORIGIN(RAM);
-_ram_end = ORIGIN(RAM) + LENGTH(RAM);
-_heap_start = _ebss; /* heap starts just after statically allocated memory */
-_heap_end = 0x2001c000; /* tunable */
-
-ENTRY(Reset_Handler)
-
-/* define output sections */
-SECTIONS
-{
- /* The startup code goes first into FLASH */
- .isr_vector :
- {
- . = ALIGN(4);
- KEEP(*(.isr_vector)) /* Startup code */
-
- /* This first flash block is 16K annd the isr vectors only take up
- about 400 bytes. Micropython pads this with files, but this didn't
- work with the size of Circuitpython's ff object. */
-
- . = ALIGN(4);
- } >FLASH_ISR
-
- /* The program code and other data goes into FLASH */
- .text :
- {
- . = ALIGN(4);
- *(.text*) /* .text* sections (code) */
- *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
- /* *(.glue_7) */ /* glue arm to thumb code */
- /* *(.glue_7t) */ /* glue thumb to arm code */
-
- . = ALIGN(4);
- _etext = .; /* define a global symbol at end of code */
- } >FLASH_TEXT
-
- /* used by the startup to initialize data */
- _sidata = LOADADDR(.data);
-
- /* This is the initialized data section
- The program executes knowing that the data is in the RAM
- but the loader puts the initial values in the FLASH (inidata).
- It is one task of the startup to copy the initial values from FLASH to RAM. */
- .data :
- {
- . = ALIGN(4);
- _sdata = .; /* create a global symbol at data start; used by startup code in order to initialise the .data section in RAM */
- *(.data*) /* .data* sections */
-
- . = ALIGN(4);
- _edata = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */
- } >RAM AT> FLASH_TEXT
-
- /* Uninitialized data section */
- .bss :
- {
- . = ALIGN(4);
- _sbss = .; /* define a global symbol at bss start; used by startup code */
- *(.bss*)
- *(COMMON)
-
- . = ALIGN(4);
- _ebss = .; /* define a global symbol at bss end; used by startup code and GC */
- } >RAM
-
- /* this is to define the start of the heap, and make sure we have a minimum size */
- .heap :
- {
- . = ALIGN(4);
- . = . + _minimum_heap_size;
- . = ALIGN(4);
- } >RAM
-
- /* this just checks there is enough RAM for the stack */
- .stack :
- {
- . = ALIGN(4);
- . = . + _minimum_stack_size;
- . = ALIGN(4);
- } >RAM
-
- .ARM.attributes 0 : { *(.ARM.attributes) }
-}
-
-
diff --git a/ports/stm32f4/boards/STM32F412ZGTx_FLASH.ld b/ports/stm32f4/boards/STM32F412ZGTx_FLASH.ld
deleted file mode 100644
index e0586709e..000000000
--- a/ports/stm32f4/boards/STM32F412ZGTx_FLASH.ld
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- GNU linker script for STM32F412
-*/
-
-/* Specify the memory areas */
-MEMORY
-{
- FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K /* entire flash */
- FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */
- FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 48K /* sectors 1,2,3 are 16K */
- FLASH_TEXT (rx) : ORIGIN = 0x08010000, LENGTH = 960K /* sector 4 is 64K, sectors 5,6,7 are 128K */
- RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 256K
-}
-
-/* produce a link error if there is not this amount of RAM for these sections */
-_minimum_stack_size = 2K;
-_minimum_heap_size = 16K;
-
-/* Define tho top end of the stack. The stack is full descending so begins just
- above last byte of RAM. Note that EABI requires the stack to be 8-byte
- aligned for a call. */
-_estack = ORIGIN(RAM) + LENGTH(RAM);
-
-/* RAM extents for the garbage collector */
-_ram_start = ORIGIN(RAM);
-_ram_end = ORIGIN(RAM) + LENGTH(RAM);
-_heap_start = _ebss; /* heap starts just after statically allocated memory */
-_heap_end = 0x20020000; /* tunable */
-
-ENTRY(Reset_Handler)
-
-/* define output sections */
-SECTIONS
-{
- /* The startup code goes first into FLASH */
- .isr_vector :
- {
- . = ALIGN(4);
- KEEP(*(.isr_vector)) /* Startup code */
-
- /* This first flash block is 16K annd the isr vectors only take up
- about 400 bytes. Micropython pads this with files, but this didn't
- work with the size of Circuitpython's ff object. */
-
- . = ALIGN(4);
- } >FLASH_ISR
-
- /* The program code and other data goes into FLASH */
- .text :
- {
- . = ALIGN(4);
- *(.text*) /* .text* sections (code) */
- *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
-
- . = ALIGN(4);
- _etext = .; /* define a global symbol at end of code */
- } >FLASH_TEXT
-
- /* used by the startup to initialize data */
- _sidata = LOADADDR(.data);
-
- /* This is the initialized data section
- The program executes knowing that the data is in the RAM
- but the loader puts the initial values in the FLASH (inidata).
- It is one task of the startup to copy the initial values from FLASH to RAM. */
- .data :
- {
- . = ALIGN(4);
- _sdata = .; /* create a global symbol at data start; used by startup code in order to initialise the .data section in RAM */
- *(.data*) /* .data* sections */
-
- . = ALIGN(4);
- _edata = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */
- } >RAM AT> FLASH_TEXT
-
- /* Uninitialized data section */
- .bss :
- {
- . = ALIGN(4);
- _sbss = .; /* define a global symbol at bss start; used by startup code */
- *(.bss*)
- *(COMMON)
-
- . = ALIGN(4);
- _ebss = .; /* define a global symbol at bss end; used by startup code and GC */
- } >RAM
-
- /* this is to define the start of the heap, and make sure we have a minimum size */
- .heap :
- {
- . = ALIGN(4);
- . = . + _minimum_heap_size;
- . = ALIGN(4);
- } >RAM
-
- /* this just checks there is enough RAM for the stack */
- .stack :
- {
- . = ALIGN(4);
- . = . + _minimum_stack_size;
- . = ALIGN(4);
- } >RAM
-
- .ARM.attributes 0 : { *(.ARM.attributes) }
-}
diff --git a/ports/stm32f4/boards/startup_stm32f401xe.s b/ports/stm32f4/boards/startup_stm32f401xe.s
deleted file mode 100644
index 815ac1719..000000000
--- a/ports/stm32f4/boards/startup_stm32f401xe.s
+++ /dev/null
@@ -1,448 +0,0 @@
-/**
- ******************************************************************************
- * @file startup_stm32f401xe.s
- * @author MCD Application Team
- * @brief STM32F401xExx Devices vector table for GCC based toolchains.
- * This module performs:
- * - Set the initial SP
- * - Set the initial PC == Reset_Handler,
- * - Set the vector table entries with the exceptions ISR address
- * - Branches to main in the C library (which eventually
- * calls main()).
- * After Reset the Cortex-M4 processor is in Thread mode,
- * priority is Privileged, and the Stack is set to Main.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2017 STMicroelectronics</center></h2>
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of STMicroelectronics nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
-
- .syntax unified
- .cpu cortex-m4
- .fpu softvfp
- .thumb
-
-.global g_pfnVectors
-.global Default_Handler
-
-/* start address for the initialization values of the .data section.
-defined in linker script */
-.word _sidata
-/* start address for the .data section. defined in linker script */
-.word _sdata
-/* end address for the .data section. defined in linker script */
-.word _edata
-/* start address for the .bss section. defined in linker script */
-.word _sbss
-/* end address for the .bss section. defined in linker script */
-.word _ebss
-/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
-
-/**
- * @brief This is the code that gets called when the processor first
- * starts execution following a reset event. Only the absolutely
- * necessary set is performed, after which the application
- * supplied main() routine is called.
- * @param None
- * @retval : None
-*/
-
- .section .text.Reset_Handler
- .weak Reset_Handler
- .type Reset_Handler, %function
-Reset_Handler:
- ldr sp, =_estack /* set stack pointer */
-
-/* Copy the data segment initializers from flash to SRAM */
- movs r1, #0
- b LoopCopyDataInit
-
-CopyDataInit:
- ldr r3, =_sidata
- ldr r3, [r3, r1]
- str r3, [r0, r1]
- adds r1, r1, #4
-
-LoopCopyDataInit:
- ldr r0, =_sdata
- ldr r3, =_edata
- adds r2, r0, r1
- cmp r2, r3
- bcc CopyDataInit
- ldr r2, =_sbss
- b LoopFillZerobss
-/* Zero fill the bss segment. */
-FillZerobss:
- movs r3, #0
- str r3, [r2], #4
-
-LoopFillZerobss:
- ldr r3, = _ebss
- cmp r2, r3
- bcc FillZerobss
-
-/* Call the clock system intitialization function.*/
- bl SystemInit
-/* Call static constructors */
- /* bl __libc_init_array */
-/* Call the application's entry point.*/
- bl main
- bx lr
-.size Reset_Handler, .-Reset_Handler
-
-/**
- * @brief This is the code that gets called when the processor receives an
- * unexpected interrupt. This simply enters an infinite loop, preserving
- * the system state for examination by a debugger.
- * @param None
- * @retval None
-*/
- .section .text.Default_Handler,"ax",%progbits
-Default_Handler:
-Infinite_Loop:
- b Infinite_Loop
- .size Default_Handler, .-Default_Handler
-/******************************************************************************
-*
-* The minimal vector table for a Cortex M3. Note that the proper constructs
-* must be placed on this to ensure that it ends up at physical address
-* 0x0000.0000.
-*
-*******************************************************************************/
- .section .isr_vector,"a",%progbits
- .type g_pfnVectors, %object
- .size g_pfnVectors, .-g_pfnVectors
-
-g_pfnVectors:
- .word _estack
- .word Reset_Handler
- .word NMI_Handler
- .word HardFault_Handler
- .word MemManage_Handler
- .word BusFault_Handler
- .word UsageFault_Handler
- .word 0
- .word 0
- .word 0
- .word 0
- .word SVC_Handler
- .word DebugMon_Handler
- .word 0
- .word PendSV_Handler
- .word SysTick_Handler
-
- /* External Interrupts */
- .word WWDG_IRQHandler /* Window WatchDog */
- .word PVD_IRQHandler /* PVD through EXTI Line detection */
- .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */
- .word RTC_WKUP_IRQHandler /* RTC Wakeup through the EXTI line */
- .word FLASH_IRQHandler /* FLASH */
- .word RCC_IRQHandler /* RCC */
- .word EXTI0_IRQHandler /* EXTI Line0 */
- .word EXTI1_IRQHandler /* EXTI Line1 */
- .word EXTI2_IRQHandler /* EXTI Line2 */
- .word EXTI3_IRQHandler /* EXTI Line3 */
- .word EXTI4_IRQHandler /* EXTI Line4 */
- .word DMA1_Stream0_IRQHandler /* DMA1 Stream 0 */
- .word DMA1_Stream1_IRQHandler /* DMA1 Stream 1 */
- .word DMA1_Stream2_IRQHandler /* DMA1 Stream 2 */
- .word DMA1_Stream3_IRQHandler /* DMA1 Stream 3 */
- .word DMA1_Stream4_IRQHandler /* DMA1 Stream 4 */
- .word DMA1_Stream5_IRQHandler /* DMA1 Stream 5 */
- .word DMA1_Stream6_IRQHandler /* DMA1 Stream 6 */
- .word ADC_IRQHandler /* ADC1, ADC2 and ADC3s */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word EXTI9_5_IRQHandler /* External Line[9:5]s */
- .word TIM1_BRK_TIM9_IRQHandler /* TIM1 Break and TIM9 */
- .word TIM1_UP_TIM10_IRQHandler /* TIM1 Update and TIM10 */
- .word TIM1_TRG_COM_TIM11_IRQHandler /* TIM1 Trigger and Commutation and TIM11 */
- .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */
- .word TIM2_IRQHandler /* TIM2 */
- .word TIM3_IRQHandler /* TIM3 */
- .word TIM4_IRQHandler /* TIM4 */
- .word I2C1_EV_IRQHandler /* I2C1 Event */
- .word I2C1_ER_IRQHandler /* I2C1 Error */
- .word I2C2_EV_IRQHandler /* I2C2 Event */
- .word I2C2_ER_IRQHandler /* I2C2 Error */
- .word SPI1_IRQHandler /* SPI1 */
- .word SPI2_IRQHandler /* SPI2 */
- .word USART1_IRQHandler /* USART1 */
- .word USART2_IRQHandler /* USART2 */
- .word 0 /* Reserved */
- .word EXTI15_10_IRQHandler /* External Line[15:10]s */
- .word RTC_Alarm_IRQHandler /* RTC Alarm (A and B) through EXTI Line */
- .word OTG_FS_WKUP_IRQHandler /* USB OTG FS Wakeup through EXTI line */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word DMA1_Stream7_IRQHandler /* DMA1 Stream7 */
- .word 0 /* Reserved */
- .word SDIO_IRQHandler /* SDIO */
- .word TIM5_IRQHandler /* TIM5 */
- .word SPI3_IRQHandler /* SPI3 */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word DMA2_Stream0_IRQHandler /* DMA2 Stream 0 */
- .word DMA2_Stream1_IRQHandler /* DMA2 Stream 1 */
- .word DMA2_Stream2_IRQHandler /* DMA2 Stream 2 */
- .word DMA2_Stream3_IRQHandler /* DMA2 Stream 3 */
- .word DMA2_Stream4_IRQHandler /* DMA2 Stream 4 */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word OTG_FS_IRQHandler /* USB OTG FS */
- .word DMA2_Stream5_IRQHandler /* DMA2 Stream 5 */
- .word DMA2_Stream6_IRQHandler /* DMA2 Stream 6 */
- .word DMA2_Stream7_IRQHandler /* DMA2 Stream 7 */
- .word USART6_IRQHandler /* USART6 */
- .word I2C3_EV_IRQHandler /* I2C3 event */
- .word I2C3_ER_IRQHandler /* I2C3 error */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word FPU_IRQHandler /* FPU */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word SPI4_IRQHandler /* SPI4 */
-
-/*******************************************************************************
-*
-* Provide weak aliases for each Exception handler to the Default_Handler.
-* As they are weak aliases, any function with the same name will override
-* this definition.
-*
-*******************************************************************************/
- .weak NMI_Handler
- .thumb_set NMI_Handler,Default_Handler
-
- .weak HardFault_Handler
- .thumb_set HardFault_Handler,Default_Handler
-
- .weak MemManage_Handler
- .thumb_set MemManage_Handler,Default_Handler
-
- .weak BusFault_Handler
- .thumb_set BusFault_Handler,Default_Handler
-
- .weak UsageFault_Handler
- .thumb_set UsageFault_Handler,Default_Handler
-
- .weak SVC_Handler
- .thumb_set SVC_Handler,Default_Handler
-
- .weak DebugMon_Handler
- .thumb_set DebugMon_Handler,Default_Handler
-
- .weak PendSV_Handler
- .thumb_set PendSV_Handler,Default_Handler
-
- .weak SysTick_Handler
- .thumb_set SysTick_Handler,Default_Handler
-
- .weak WWDG_IRQHandler
- .thumb_set WWDG_IRQHandler,Default_Handler
-
- .weak PVD_IRQHandler
- .thumb_set PVD_IRQHandler,Default_Handler
-
- .weak TAMP_STAMP_IRQHandler
- .thumb_set TAMP_STAMP_IRQHandler,Default_Handler
-
- .weak RTC_WKUP_IRQHandler
- .thumb_set RTC_WKUP_IRQHandler,Default_Handler
-
- .weak FLASH_IRQHandler
- .thumb_set FLASH_IRQHandler,Default_Handler
-
- .weak RCC_IRQHandler
- .thumb_set RCC_IRQHandler,Default_Handler
-
- .weak EXTI0_IRQHandler
- .thumb_set EXTI0_IRQHandler,Default_Handler
-
- .weak EXTI1_IRQHandler
- .thumb_set EXTI1_IRQHandler,Default_Handler
-
- .weak EXTI2_IRQHandler
- .thumb_set EXTI2_IRQHandler,Default_Handler
-
- .weak EXTI3_IRQHandler
- .thumb_set EXTI3_IRQHandler,Default_Handler
-
- .weak EXTI4_IRQHandler
- .thumb_set EXTI4_IRQHandler,Default_Handler
-
- .weak DMA1_Stream0_IRQHandler
- .thumb_set DMA1_Stream0_IRQHandler,Default_Handler
-
- .weak DMA1_Stream1_IRQHandler
- .thumb_set DMA1_Stream1_IRQHandler,Default_Handler
-
- .weak DMA1_Stream2_IRQHandler
- .thumb_set DMA1_Stream2_IRQHandler,Default_Handler
-
- .weak DMA1_Stream3_IRQHandler
- .thumb_set DMA1_Stream3_IRQHandler,Default_Handler
-
- .weak DMA1_Stream4_IRQHandler
- .thumb_set DMA1_Stream4_IRQHandler,Default_Handler
-
- .weak DMA1_Stream5_IRQHandler
- .thumb_set DMA1_Stream5_IRQHandler,Default_Handler
-
- .weak DMA1_Stream6_IRQHandler
- .thumb_set DMA1_Stream6_IRQHandler,Default_Handler
-
- .weak ADC_IRQHandler
- .thumb_set ADC_IRQHandler,Default_Handler
-
- .weak EXTI9_5_IRQHandler
- .thumb_set EXTI9_5_IRQHandler,Default_Handler
-
- .weak TIM1_BRK_TIM9_IRQHandler
- .thumb_set TIM1_BRK_TIM9_IRQHandler,Default_Handler
-
- .weak TIM1_UP_TIM10_IRQHandler
- .thumb_set TIM1_UP_TIM10_IRQHandler,Default_Handler
-
- .weak TIM1_TRG_COM_TIM11_IRQHandler
- .thumb_set TIM1_TRG_COM_TIM11_IRQHandler,Default_Handler
-
- .weak TIM1_CC_IRQHandler
- .thumb_set TIM1_CC_IRQHandler,Default_Handler
-
- .weak TIM2_IRQHandler
- .thumb_set TIM2_IRQHandler,Default_Handler
-
- .weak TIM3_IRQHandler
- .thumb_set TIM3_IRQHandler,Default_Handler
-
- .weak TIM4_IRQHandler
- .thumb_set TIM4_IRQHandler,Default_Handler
-
- .weak I2C1_EV_IRQHandler
- .thumb_set I2C1_EV_IRQHandler,Default_Handler
-
- .weak I2C1_ER_IRQHandler
- .thumb_set I2C1_ER_IRQHandler,Default_Handler
-
- .weak I2C2_EV_IRQHandler
- .thumb_set I2C2_EV_IRQHandler,Default_Handler
-
- .weak I2C2_ER_IRQHandler
- .thumb_set I2C2_ER_IRQHandler,Default_Handler
-
- .weak SPI1_IRQHandler
- .thumb_set SPI1_IRQHandler,Default_Handler
-
- .weak SPI2_IRQHandler
- .thumb_set SPI2_IRQHandler,Default_Handler
-
- .weak USART1_IRQHandler
- .thumb_set USART1_IRQHandler,Default_Handler
-
- .weak USART2_IRQHandler
- .thumb_set USART2_IRQHandler,Default_Handler
-
- .weak EXTI15_10_IRQHandler
- .thumb_set EXTI15_10_IRQHandler,Default_Handler
-
- .weak RTC_Alarm_IRQHandler
- .thumb_set RTC_Alarm_IRQHandler,Default_Handler
-
- .weak OTG_FS_WKUP_IRQHandler
- .thumb_set OTG_FS_WKUP_IRQHandler,Default_Handler
-
- .weak DMA1_Stream7_IRQHandler
- .thumb_set DMA1_Stream7_IRQHandler,Default_Handler
-
- .weak SDIO_IRQHandler
- .thumb_set SDIO_IRQHandler,Default_Handler
-
- .weak TIM5_IRQHandler
- .thumb_set TIM5_IRQHandler,Default_Handler
-
- .weak SPI3_IRQHandler
- .thumb_set SPI3_IRQHandler,Default_Handler
-
- .weak DMA2_Stream0_IRQHandler
- .thumb_set DMA2_Stream0_IRQHandler,Default_Handler
-
- .weak DMA2_Stream1_IRQHandler
- .thumb_set DMA2_Stream1_IRQHandler,Default_Handler
-
- .weak DMA2_Stream2_IRQHandler
- .thumb_set DMA2_Stream2_IRQHandler,Default_Handler
-
- .weak DMA2_Stream3_IRQHandler
- .thumb_set DMA2_Stream3_IRQHandler,Default_Handler
-
- .weak DMA2_Stream4_IRQHandler
- .thumb_set DMA2_Stream4_IRQHandler,Default_Handler
-
- .weak OTG_FS_IRQHandler
- .thumb_set OTG_FS_IRQHandler,Default_Handler
-
- .weak DMA2_Stream5_IRQHandler
- .thumb_set DMA2_Stream5_IRQHandler,Default_Handler
-
- .weak DMA2_Stream6_IRQHandler
- .thumb_set DMA2_Stream6_IRQHandler,Default_Handler
-
- .weak DMA2_Stream7_IRQHandler
- .thumb_set DMA2_Stream7_IRQHandler,Default_Handler
-
- .weak USART6_IRQHandler
- .thumb_set USART6_IRQHandler,Default_Handler
-
- .weak I2C3_EV_IRQHandler
- .thumb_set I2C3_EV_IRQHandler,Default_Handler
-
- .weak I2C3_ER_IRQHandler
- .thumb_set I2C3_ER_IRQHandler,Default_Handler
-
- .weak FPU_IRQHandler
- .thumb_set FPU_IRQHandler,Default_Handler
-
- .weak SPI4_IRQHandler
- .thumb_set SPI4_IRQHandler,Default_Handler
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
diff --git a/ports/stm32f4/boards/startup_stm32f405xx.s b/ports/stm32f4/boards/startup_stm32f405xx.s
deleted file mode 100644
index 6b77655ca..000000000
--- a/ports/stm32f4/boards/startup_stm32f405xx.s
+++ /dev/null
@@ -1,516 +0,0 @@
-/**
- ******************************************************************************
- * @file startup_stm32f405xx.s
- * @author MCD Application Team
- * @brief STM32F405xx Devices vector table for GCC based toolchains.
- * This module performs:
- * - Set the initial SP
- * - Set the initial PC == Reset_Handler,
- * - Set the vector table entries with the exceptions ISR address
- * - Branches to main in the C library (which eventually
- * calls main()).
- * After Reset the Cortex-M4 processor is in Thread mode,
- * priority is Privileged, and the Stack is set to Main.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2017 STMicroelectronics</center></h2>
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of STMicroelectronics nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
-
- .syntax unified
- .cpu cortex-m4
- .fpu softvfp
- .thumb
-
-.global g_pfnVectors
-.global Default_Handler
-
-/* start address for the initialization values of the .data section.
-defined in linker script */
-.word _sidata
-/* start address for the .data section. defined in linker script */
-.word _sdata
-/* end address for the .data section. defined in linker script */
-.word _edata
-/* start address for the .bss section. defined in linker script */
-.word _sbss
-/* end address for the .bss section. defined in linker script */
-.word _ebss
-/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
-
-/**
- * @brief This is the code that gets called when the processor first
- * starts execution following a reset event. Only the absolutely
- * necessary set is performed, after which the application
- * supplied main() routine is called.
- * @param None
- * @retval : None
-*/
-
- .section .text.Reset_Handler
- .weak Reset_Handler
- .type Reset_Handler, %function
-Reset_Handler:
- ldr sp, =_estack /* set stack pointer */
-
-/* Copy the data segment initializers from flash to SRAM */
- movs r1, #0
- b LoopCopyDataInit
-
-CopyDataInit:
- ldr r3, =_sidata
- ldr r3, [r3, r1]
- str r3, [r0, r1]
- adds r1, r1, #4
-
-LoopCopyDataInit:
- ldr r0, =_sdata
- ldr r3, =_edata
- adds r2, r0, r1
- cmp r2, r3
- bcc CopyDataInit
- ldr r2, =_sbss
- b LoopFillZerobss
-/* Zero fill the bss segment. */
-FillZerobss:
- movs r3, #0
- str r3, [r2], #4
-
-LoopFillZerobss:
- ldr r3, = _ebss
- cmp r2, r3
- bcc FillZerobss
-
-/* Call the clock system intitialization function.*/
- bl SystemInit
-/* Call static constructors */
-/* bl __libc_init_array */
-/* Call the application's entry point.*/
- bl main
- bx lr
-.size Reset_Handler, .-Reset_Handler
-
-/**
- * @brief This is the code that gets called when the processor receives an
- * unexpected interrupt. This simply enters an infinite loop, preserving
- * the system state for examination by a debugger.
- * @param None
- * @retval None
-*/
- .section .text.Default_Handler,"ax",%progbits
-Default_Handler:
-Infinite_Loop:
- b Infinite_Loop
- .size Default_Handler, .-Default_Handler
-/******************************************************************************
-*
-* The minimal vector table for a Cortex M3. Note that the proper constructs
-* must be placed on this to ensure that it ends up at physical address
-* 0x0000.0000.
-*
-*******************************************************************************/
- .section .isr_vector,"a",%progbits
- .type g_pfnVectors, %object
- .size g_pfnVectors, .-g_pfnVectors
-
-
-
-g_pfnVectors:
- .word _estack
- .word Reset_Handler
-
- .word NMI_Handler
- .word HardFault_Handler
- .word MemManage_Handler
- .word BusFault_Handler
- .word UsageFault_Handler
- .word 0
- .word 0
- .word 0
- .word 0
- .word SVC_Handler
- .word DebugMon_Handler
- .word 0
- .word PendSV_Handler
- .word SysTick_Handler
-
- /* External Interrupts */
- .word WWDG_IRQHandler /* Window WatchDog */
- .word PVD_IRQHandler /* PVD through EXTI Line detection */
- .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */
- .word RTC_WKUP_IRQHandler /* RTC Wakeup through the EXTI line */
- .word FLASH_IRQHandler /* FLASH */
- .word RCC_IRQHandler /* RCC */
- .word EXTI0_IRQHandler /* EXTI Line0 */
- .word EXTI1_IRQHandler /* EXTI Line1 */
- .word EXTI2_IRQHandler /* EXTI Line2 */
- .word EXTI3_IRQHandler /* EXTI Line3 */
- .word EXTI4_IRQHandler /* EXTI Line4 */
- .word DMA1_Stream0_IRQHandler /* DMA1 Stream 0 */
- .word DMA1_Stream1_IRQHandler /* DMA1 Stream 1 */
- .word DMA1_Stream2_IRQHandler /* DMA1 Stream 2 */
- .word DMA1_Stream3_IRQHandler /* DMA1 Stream 3 */
- .word DMA1_Stream4_IRQHandler /* DMA1 Stream 4 */
- .word DMA1_Stream5_IRQHandler /* DMA1 Stream 5 */
- .word DMA1_Stream6_IRQHandler /* DMA1 Stream 6 */
- .word ADC_IRQHandler /* ADC1, ADC2 and ADC3s */
- .word CAN1_TX_IRQHandler /* CAN1 TX */
- .word CAN1_RX0_IRQHandler /* CAN1 RX0 */
- .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
- .word CAN1_SCE_IRQHandler /* CAN1 SCE */
- .word EXTI9_5_IRQHandler /* External Line[9:5]s */
- .word TIM1_BRK_TIM9_IRQHandler /* TIM1 Break and TIM9 */
- .word TIM1_UP_TIM10_IRQHandler /* TIM1 Update and TIM10 */
- .word TIM1_TRG_COM_TIM11_IRQHandler /* TIM1 Trigger and Commutation and TIM11 */
- .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */
- .word TIM2_IRQHandler /* TIM2 */
- .word TIM3_IRQHandler /* TIM3 */
- .word TIM4_IRQHandler /* TIM4 */
- .word I2C1_EV_IRQHandler /* I2C1 Event */
- .word I2C1_ER_IRQHandler /* I2C1 Error */
- .word I2C2_EV_IRQHandler /* I2C2 Event */
- .word I2C2_ER_IRQHandler /* I2C2 Error */
- .word SPI1_IRQHandler /* SPI1 */
- .word SPI2_IRQHandler /* SPI2 */
- .word USART1_IRQHandler /* USART1 */
- .word USART2_IRQHandler /* USART2 */
- .word USART3_IRQHandler /* USART3 */
- .word EXTI15_10_IRQHandler /* External Line[15:10]s */
- .word RTC_Alarm_IRQHandler /* RTC Alarm (A and B) through EXTI Line */
- .word OTG_FS_WKUP_IRQHandler /* USB OTG FS Wakeup through EXTI line */
- .word TIM8_BRK_TIM12_IRQHandler /* TIM8 Break and TIM12 */
- .word TIM8_UP_TIM13_IRQHandler /* TIM8 Update and TIM13 */
- .word TIM8_TRG_COM_TIM14_IRQHandler /* TIM8 Trigger and Commutation and TIM14 */
- .word TIM8_CC_IRQHandler /* TIM8 Capture Compare */
- .word DMA1_Stream7_IRQHandler /* DMA1 Stream7 */
- .word FSMC_IRQHandler /* FSMC */
- .word SDIO_IRQHandler /* SDIO */
- .word TIM5_IRQHandler /* TIM5 */
- .word SPI3_IRQHandler /* SPI3 */
- .word UART4_IRQHandler /* UART4 */
- .word UART5_IRQHandler /* UART5 */
- .word TIM6_DAC_IRQHandler /* TIM6 and DAC1&2 underrun errors */
- .word TIM7_IRQHandler /* TIM7 */
- .word DMA2_Stream0_IRQHandler /* DMA2 Stream 0 */
- .word DMA2_Stream1_IRQHandler /* DMA2 Stream 1 */
- .word DMA2_Stream2_IRQHandler /* DMA2 Stream 2 */
- .word DMA2_Stream3_IRQHandler /* DMA2 Stream 3 */
- .word DMA2_Stream4_IRQHandler /* DMA2 Stream 4 */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word CAN2_TX_IRQHandler /* CAN2 TX */
- .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
- .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
- .word CAN2_SCE_IRQHandler /* CAN2 SCE */
- .word OTG_FS_IRQHandler /* USB OTG FS */
- .word DMA2_Stream5_IRQHandler /* DMA2 Stream 5 */
- .word DMA2_Stream6_IRQHandler /* DMA2 Stream 6 */
- .word DMA2_Stream7_IRQHandler /* DMA2 Stream 7 */
- .word USART6_IRQHandler /* USART6 */
- .word I2C3_EV_IRQHandler /* I2C3 event */
- .word I2C3_ER_IRQHandler /* I2C3 error */
- .word OTG_HS_EP1_OUT_IRQHandler /* USB OTG HS End Point 1 Out */
- .word OTG_HS_EP1_IN_IRQHandler /* USB OTG HS End Point 1 In */
- .word OTG_HS_WKUP_IRQHandler /* USB OTG HS Wakeup through EXTI */
- .word OTG_HS_IRQHandler /* USB OTG HS */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word HASH_RNG_IRQHandler /* Hash and Rng */
- .word FPU_IRQHandler /* FPU */
-
-
-/*******************************************************************************
-*
-* Provide weak aliases for each Exception handler to the Default_Handler.
-* As they are weak aliases, any function with the same name will override
-* this definition.
-*
-*******************************************************************************/
- .weak NMI_Handler
- .thumb_set NMI_Handler,Default_Handler
-
- .weak HardFault_Handler
- .thumb_set HardFault_Handler,Default_Handler
-
- .weak MemManage_Handler
- .thumb_set MemManage_Handler,Default_Handler
-
- .weak BusFault_Handler
- .thumb_set BusFault_Handler,Default_Handler
-
- .weak UsageFault_Handler
- .thumb_set UsageFault_Handler,Default_Handler
-
- .weak SVC_Handler
- .thumb_set SVC_Handler,Default_Handler
-
- .weak DebugMon_Handler
- .thumb_set DebugMon_Handler,Default_Handler
-
- .weak PendSV_Handler
- .thumb_set PendSV_Handler,Default_Handler
-
- .weak SysTick_Handler
- .thumb_set SysTick_Handler,Default_Handler
-
- .weak WWDG_IRQHandler
- .thumb_set WWDG_IRQHandler,Default_Handler
-
- .weak PVD_IRQHandler
- .thumb_set PVD_IRQHandler,Default_Handler
-
- .weak TAMP_STAMP_IRQHandler
- .thumb_set TAMP_STAMP_IRQHandler,Default_Handler
-
- .weak RTC_WKUP_IRQHandler
- .thumb_set RTC_WKUP_IRQHandler,Default_Handler
-
- .weak FLASH_IRQHandler
- .thumb_set FLASH_IRQHandler,Default_Handler
-
- .weak RCC_IRQHandler
- .thumb_set RCC_IRQHandler,Default_Handler
-
- .weak EXTI0_IRQHandler
- .thumb_set EXTI0_IRQHandler,Default_Handler
-
- .weak EXTI1_IRQHandler
- .thumb_set EXTI1_IRQHandler,Default_Handler
-
- .weak EXTI2_IRQHandler
- .thumb_set EXTI2_IRQHandler,Default_Handler
-
- .weak EXTI3_IRQHandler
- .thumb_set EXTI3_IRQHandler,Default_Handler
-
- .weak EXTI4_IRQHandler
- .thumb_set EXTI4_IRQHandler,Default_Handler
-
- .weak DMA1_Stream0_IRQHandler
- .thumb_set DMA1_Stream0_IRQHandler,Default_Handler
-
- .weak DMA1_Stream1_IRQHandler
- .thumb_set DMA1_Stream1_IRQHandler,Default_Handler
-
- .weak DMA1_Stream2_IRQHandler
- .thumb_set DMA1_Stream2_IRQHandler,Default_Handler
-
- .weak DMA1_Stream3_IRQHandler
- .thumb_set DMA1_Stream3_IRQHandler,Default_Handler
-
- .weak DMA1_Stream4_IRQHandler
- .thumb_set DMA1_Stream4_IRQHandler,Default_Handler
-
- .weak DMA1_Stream5_IRQHandler
- .thumb_set DMA1_Stream5_IRQHandler,Default_Handler
-
- .weak DMA1_Stream6_IRQHandler
- .thumb_set DMA1_Stream6_IRQHandler,Default_Handler
-
- .weak ADC_IRQHandler
- .thumb_set ADC_IRQHandler,Default_Handler
-
- .weak CAN1_TX_IRQHandler
- .thumb_set CAN1_TX_IRQHandler,Default_Handler
-
- .weak CAN1_RX0_IRQHandler
- .thumb_set CAN1_RX0_IRQHandler,Default_Handler
-
- .weak CAN1_RX1_IRQHandler
- .thumb_set CAN1_RX1_IRQHandler,Default_Handler
-
- .weak CAN1_SCE_IRQHandler
- .thumb_set CAN1_SCE_IRQHandler,Default_Handler
-
- .weak EXTI9_5_IRQHandler
- .thumb_set EXTI9_5_IRQHandler,Default_Handler
-
- .weak TIM1_BRK_TIM9_IRQHandler
- .thumb_set TIM1_BRK_TIM9_IRQHandler,Default_Handler
-
- .weak TIM1_UP_TIM10_IRQHandler
- .thumb_set TIM1_UP_TIM10_IRQHandler,Default_Handler
-
- .weak TIM1_TRG_COM_TIM11_IRQHandler
- .thumb_set TIM1_TRG_COM_TIM11_IRQHandler,Default_Handler
-
- .weak TIM1_CC_IRQHandler
- .thumb_set TIM1_CC_IRQHandler,Default_Handler
-
- .weak TIM2_IRQHandler
- .thumb_set TIM2_IRQHandler,Default_Handler
-
- .weak TIM3_IRQHandler
- .thumb_set TIM3_IRQHandler,Default_Handler
-
- .weak TIM4_IRQHandler
- .thumb_set TIM4_IRQHandler,Default_Handler
-
- .weak I2C1_EV_IRQHandler
- .thumb_set I2C1_EV_IRQHandler,Default_Handler
-
- .weak I2C1_ER_IRQHandler
- .thumb_set I2C1_ER_IRQHandler,Default_Handler
-
- .weak I2C2_EV_IRQHandler
- .thumb_set I2C2_EV_IRQHandler,Default_Handler
-
- .weak I2C2_ER_IRQHandler
- .thumb_set I2C2_ER_IRQHandler,Default_Handler
-
- .weak SPI1_IRQHandler
- .thumb_set SPI1_IRQHandler,Default_Handler
-
- .weak SPI2_IRQHandler
- .thumb_set SPI2_IRQHandler,Default_Handler
-
- .weak USART1_IRQHandler
- .thumb_set USART1_IRQHandler,Default_Handler
-
- .weak USART2_IRQHandler
- .thumb_set USART2_IRQHandler,Default_Handler
-
- .weak USART3_IRQHandler
- .thumb_set USART3_IRQHandler,Default_Handler
-
- .weak EXTI15_10_IRQHandler
- .thumb_set EXTI15_10_IRQHandler,Default_Handler
-
- .weak RTC_Alarm_IRQHandler
- .thumb_set RTC_Alarm_IRQHandler,Default_Handler
-
- .weak OTG_FS_WKUP_IRQHandler
- .thumb_set OTG_FS_WKUP_IRQHandler,Default_Handler
-
- .weak TIM8_BRK_TIM12_IRQHandler
- .thumb_set TIM8_BRK_TIM12_IRQHandler,Default_Handler
-
- .weak TIM8_UP_TIM13_IRQHandler
- .thumb_set TIM8_UP_TIM13_IRQHandler,Default_Handler
-
- .weak TIM8_TRG_COM_TIM14_IRQHandler
- .thumb_set TIM8_TRG_COM_TIM14_IRQHandler,Default_Handler
-
- .weak TIM8_CC_IRQHandler
- .thumb_set TIM8_CC_IRQHandler,Default_Handler
-
- .weak DMA1_Stream7_IRQHandler
- .thumb_set DMA1_Stream7_IRQHandler,Default_Handler
-
- .weak FSMC_IRQHandler
- .thumb_set FSMC_IRQHandler,Default_Handler
-
- .weak SDIO_IRQHandler
- .thumb_set SDIO_IRQHandler,Default_Handler
-
- .weak TIM5_IRQHandler
- .thumb_set TIM5_IRQHandler,Default_Handler
-
- .weak SPI3_IRQHandler
- .thumb_set SPI3_IRQHandler,Default_Handler
-
- .weak UART4_IRQHandler
- .thumb_set UART4_IRQHandler,Default_Handler
-
- .weak UART5_IRQHandler
- .thumb_set UART5_IRQHandler,Default_Handler
-
- .weak TIM6_DAC_IRQHandler
- .thumb_set TIM6_DAC_IRQHandler,Default_Handler
-
- .weak TIM7_IRQHandler
- .thumb_set TIM7_IRQHandler,Default_Handler
-
- .weak DMA2_Stream0_IRQHandler
- .thumb_set DMA2_Stream0_IRQHandler,Default_Handler
-
- .weak DMA2_Stream1_IRQHandler
- .thumb_set DMA2_Stream1_IRQHandler,Default_Handler
-
- .weak DMA2_Stream2_IRQHandler
- .thumb_set DMA2_Stream2_IRQHandler,Default_Handler
-
- .weak DMA2_Stream3_IRQHandler
- .thumb_set DMA2_Stream3_IRQHandler,Default_Handler
-
- .weak DMA2_Stream4_IRQHandler
- .thumb_set DMA2_Stream4_IRQHandler,Default_Handler
-
- .weak CAN2_TX_IRQHandler
- .thumb_set CAN2_TX_IRQHandler,Default_Handler
-
- .weak CAN2_RX0_IRQHandler
- .thumb_set CAN2_RX0_IRQHandler,Default_Handler
-
- .weak CAN2_RX1_IRQHandler
- .thumb_set CAN2_RX1_IRQHandler,Default_Handler
-
- .weak CAN2_SCE_IRQHandler
- .thumb_set CAN2_SCE_IRQHandler,Default_Handler
-
- .weak OTG_FS_IRQHandler
- .thumb_set OTG_FS_IRQHandler,Default_Handler
-
- .weak DMA2_Stream5_IRQHandler
- .thumb_set DMA2_Stream5_IRQHandler,Default_Handler
-
- .weak DMA2_Stream6_IRQHandler
- .thumb_set DMA2_Stream6_IRQHandler,Default_Handler
-
- .weak DMA2_Stream7_IRQHandler
- .thumb_set DMA2_Stream7_IRQHandler,Default_Handler
-
- .weak USART6_IRQHandler
- .thumb_set USART6_IRQHandler,Default_Handler
-
- .weak I2C3_EV_IRQHandler
- .thumb_set I2C3_EV_IRQHandler,Default_Handler
-
- .weak I2C3_ER_IRQHandler
- .thumb_set I2C3_ER_IRQHandler,Default_Handler
-
- .weak OTG_HS_EP1_OUT_IRQHandler
- .thumb_set OTG_HS_EP1_OUT_IRQHandler,Default_Handler
-
- .weak OTG_HS_EP1_IN_IRQHandler
- .thumb_set OTG_HS_EP1_IN_IRQHandler,Default_Handler
-
- .weak OTG_HS_WKUP_IRQHandler
- .thumb_set OTG_HS_WKUP_IRQHandler,Default_Handler
-
- .weak OTG_HS_IRQHandler
- .thumb_set OTG_HS_IRQHandler,Default_Handler
-
- .weak HASH_RNG_IRQHandler
- .thumb_set HASH_RNG_IRQHandler,Default_Handler
-
- .weak FPU_IRQHandler
- .thumb_set FPU_IRQHandler,Default_Handler
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
-
diff --git a/ports/stm32f4/boards/startup_stm32f411xe.s b/ports/stm32f4/boards/startup_stm32f411xe.s
deleted file mode 100644
index 3aac640cb..000000000
--- a/ports/stm32f4/boards/startup_stm32f411xe.s
+++ /dev/null
@@ -1,452 +0,0 @@
-/**
- ******************************************************************************
- * @file startup_stm32f411xe.s
- * @author MCD Application Team
- * @brief STM32F411xExx Devices vector table for GCC based toolchains.
- * This module performs:
- * - Set the initial SP
- * - Set the initial PC == Reset_Handler,
- * - Set the vector table entries with the exceptions ISR address
- * - Branches to main in the C library (which eventually
- * calls main()).
- * After Reset the Cortex-M4 processor is in Thread mode,
- * priority is Privileged, and the Stack is set to Main.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2017 STMicroelectronics</center></h2>
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of STMicroelectronics nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
-
- .syntax unified
- .cpu cortex-m4
- .fpu softvfp
- .thumb
-
-.global g_pfnVectors
-.global Default_Handler
-
-/* start address for the initialization values of the .data section.
-defined in linker script */
-.word _sidata
-/* start address for the .data section. defined in linker script */
-.word _sdata
-/* end address for the .data section. defined in linker script */
-.word _edata
-/* start address for the .bss section. defined in linker script */
-.word _sbss
-/* end address for the .bss section. defined in linker script */
-.word _ebss
-/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
-
-/**
- * @brief This is the code that gets called when the processor first
- * starts execution following a reset event. Only the absolutely
- * necessary set is performed, after which the application
- * supplied main() routine is called.
- * @param None
- * @retval : None
-*/
-
- .section .text.Reset_Handler
- .weak Reset_Handler
- .type Reset_Handler, %function
-Reset_Handler:
- ldr sp, =_estack /* set stack pointer */
-
-/* Copy the data segment initializers from flash to SRAM */
- movs r1, #0
- b LoopCopyDataInit
-
-CopyDataInit:
- ldr r3, =_sidata
- ldr r3, [r3, r1]
- str r3, [r0, r1]
- adds r1, r1, #4
-
-LoopCopyDataInit:
- ldr r0, =_sdata
- ldr r3, =_edata
- adds r2, r0, r1
- cmp r2, r3
- bcc CopyDataInit
- ldr r2, =_sbss
- b LoopFillZerobss
-/* Zero fill the bss segment. */
-FillZerobss:
- movs r3, #0
- str r3, [r2], #4
-
-LoopFillZerobss:
- ldr r3, = _ebss
- cmp r2, r3
- bcc FillZerobss
-
-/* Call the clock system intitialization function.*/
- bl SystemInit
-/* Call static constructors */
-/* bl __libc_init_array */
-/* Call the application's entry point.*/
- bl main
- bx lr
-.size Reset_Handler, .-Reset_Handler
-
-/**
- * @brief This is the code that gets called when the processor receives an
- * unexpected interrupt. This simply enters an infinite loop, preserving
- * the system state for examination by a debugger.
- * @param None
- * @retval None
-*/
- .section .text.Default_Handler,"ax",%progbits
-Default_Handler:
-Infinite_Loop:
- b Infinite_Loop
- .size Default_Handler, .-Default_Handler
-/******************************************************************************
-*
-* The minimal vector table for a Cortex M3. Note that the proper constructs
-* must be placed on this to ensure that it ends up at physical address
-* 0x0000.0000.
-*
-*******************************************************************************/
- .section .isr_vector,"a",%progbits
- .type g_pfnVectors, %object
- .size g_pfnVectors, .-g_pfnVectors
-
-g_pfnVectors:
- .word _estack
- .word Reset_Handler
- .word NMI_Handler
- .word HardFault_Handler
- .word MemManage_Handler
- .word BusFault_Handler
- .word UsageFault_Handler
- .word 0
- .word 0
- .word 0
- .word 0
- .word SVC_Handler
- .word DebugMon_Handler
- .word 0
- .word PendSV_Handler
- .word SysTick_Handler
-
- /* External Interrupts */
- .word WWDG_IRQHandler /* Window WatchDog */
- .word PVD_IRQHandler /* PVD through EXTI Line detection */
- .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */
- .word RTC_WKUP_IRQHandler /* RTC Wakeup through the EXTI line */
- .word FLASH_IRQHandler /* FLASH */
- .word RCC_IRQHandler /* RCC */
- .word EXTI0_IRQHandler /* EXTI Line0 */
- .word EXTI1_IRQHandler /* EXTI Line1 */
- .word EXTI2_IRQHandler /* EXTI Line2 */
- .word EXTI3_IRQHandler /* EXTI Line3 */
- .word EXTI4_IRQHandler /* EXTI Line4 */
- .word DMA1_Stream0_IRQHandler /* DMA1 Stream 0 */
- .word DMA1_Stream1_IRQHandler /* DMA1 Stream 1 */
- .word DMA1_Stream2_IRQHandler /* DMA1 Stream 2 */
- .word DMA1_Stream3_IRQHandler /* DMA1 Stream 3 */
- .word DMA1_Stream4_IRQHandler /* DMA1 Stream 4 */
- .word DMA1_Stream5_IRQHandler /* DMA1 Stream 5 */
- .word DMA1_Stream6_IRQHandler /* DMA1 Stream 6 */
- .word ADC_IRQHandler /* ADC1, ADC2 and ADC3s */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word EXTI9_5_IRQHandler /* External Line[9:5]s */
- .word TIM1_BRK_TIM9_IRQHandler /* TIM1 Break and TIM9 */
- .word TIM1_UP_TIM10_IRQHandler /* TIM1 Update and TIM10 */
- .word TIM1_TRG_COM_TIM11_IRQHandler /* TIM1 Trigger and Commutation and TIM11 */
- .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */
- .word TIM2_IRQHandler /* TIM2 */
- .word TIM3_IRQHandler /* TIM3 */
- .word TIM4_IRQHandler /* TIM4 */
- .word I2C1_EV_IRQHandler /* I2C1 Event */
- .word I2C1_ER_IRQHandler /* I2C1 Error */
- .word I2C2_EV_IRQHandler /* I2C2 Event */
- .word I2C2_ER_IRQHandler /* I2C2 Error */
- .word SPI1_IRQHandler /* SPI1 */
- .word SPI2_IRQHandler /* SPI2 */
- .word USART1_IRQHandler /* USART1 */
- .word USART2_IRQHandler /* USART2 */
- .word 0 /* Reserved */
- .word EXTI15_10_IRQHandler /* External Line[15:10]s */
- .word RTC_Alarm_IRQHandler /* RTC Alarm (A and B) through EXTI Line */
- .word OTG_FS_WKUP_IRQHandler /* USB OTG FS Wakeup through EXTI line */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word DMA1_Stream7_IRQHandler /* DMA1 Stream7 */
- .word 0 /* Reserved */
- .word SDIO_IRQHandler /* SDIO */
- .word TIM5_IRQHandler /* TIM5 */
- .word SPI3_IRQHandler /* SPI3 */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word DMA2_Stream0_IRQHandler /* DMA2 Stream 0 */
- .word DMA2_Stream1_IRQHandler /* DMA2 Stream 1 */
- .word DMA2_Stream2_IRQHandler /* DMA2 Stream 2 */
- .word DMA2_Stream3_IRQHandler /* DMA2 Stream 3 */
- .word DMA2_Stream4_IRQHandler /* DMA2 Stream 4 */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word OTG_FS_IRQHandler /* USB OTG FS */
- .word DMA2_Stream5_IRQHandler /* DMA2 Stream 5 */
- .word DMA2_Stream6_IRQHandler /* DMA2 Stream 6 */
- .word DMA2_Stream7_IRQHandler /* DMA2 Stream 7 */
- .word USART6_IRQHandler /* USART6 */
- .word I2C3_EV_IRQHandler /* I2C3 event */
- .word I2C3_ER_IRQHandler /* I2C3 error */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word FPU_IRQHandler /* FPU */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word SPI4_IRQHandler /* SPI4 */
- .word SPI5_IRQHandler /* SPI5 */
-
-/*******************************************************************************
-*
-* Provide weak aliases for each Exception handler to the Default_Handler.
-* As they are weak aliases, any function with the same name will override
-* this definition.
-*
-*******************************************************************************/
- .weak NMI_Handler
- .thumb_set NMI_Handler,Default_Handler
-
- .weak HardFault_Handler
- .thumb_set HardFault_Handler,Default_Handler
-
- .weak MemManage_Handler
- .thumb_set MemManage_Handler,Default_Handler
-
- .weak BusFault_Handler
- .thumb_set BusFault_Handler,Default_Handler
-
- .weak UsageFault_Handler
- .thumb_set UsageFault_Handler,Default_Handler
-
- .weak SVC_Handler
- .thumb_set SVC_Handler,Default_Handler
-
- .weak DebugMon_Handler
- .thumb_set DebugMon_Handler,Default_Handler
-
- .weak PendSV_Handler
- .thumb_set PendSV_Handler,Default_Handler
-
- .weak SysTick_Handler
- .thumb_set SysTick_Handler,Default_Handler
-
- .weak WWDG_IRQHandler
- .thumb_set WWDG_IRQHandler,Default_Handler
-
- .weak PVD_IRQHandler
- .thumb_set PVD_IRQHandler,Default_Handler
-
- .weak TAMP_STAMP_IRQHandler
- .thumb_set TAMP_STAMP_IRQHandler,Default_Handler
-
- .weak RTC_WKUP_IRQHandler
- .thumb_set RTC_WKUP_IRQHandler,Default_Handler
-
- .weak FLASH_IRQHandler
- .thumb_set FLASH_IRQHandler,Default_Handler
-
- .weak RCC_IRQHandler
- .thumb_set RCC_IRQHandler,Default_Handler
-
- .weak EXTI0_IRQHandler
- .thumb_set EXTI0_IRQHandler,Default_Handler
-
- .weak EXTI1_IRQHandler
- .thumb_set EXTI1_IRQHandler,Default_Handler
-
- .weak EXTI2_IRQHandler
- .thumb_set EXTI2_IRQHandler,Default_Handler
-
- .weak EXTI3_IRQHandler
- .thumb_set EXTI3_IRQHandler,Default_Handler
-
- .weak EXTI4_IRQHandler
- .thumb_set EXTI4_IRQHandler,Default_Handler
-
- .weak DMA1_Stream0_IRQHandler
- .thumb_set DMA1_Stream0_IRQHandler,Default_Handler
-
- .weak DMA1_Stream1_IRQHandler
- .thumb_set DMA1_Stream1_IRQHandler,Default_Handler
-
- .weak DMA1_Stream2_IRQHandler
- .thumb_set DMA1_Stream2_IRQHandler,Default_Handler
-
- .weak DMA1_Stream3_IRQHandler
- .thumb_set DMA1_Stream3_IRQHandler,Default_Handler
-
- .weak DMA1_Stream4_IRQHandler
- .thumb_set DMA1_Stream4_IRQHandler,Default_Handler
-
- .weak DMA1_Stream5_IRQHandler
- .thumb_set DMA1_Stream5_IRQHandler,Default_Handler
-
- .weak DMA1_Stream6_IRQHandler
- .thumb_set DMA1_Stream6_IRQHandler,Default_Handler
-
- .weak ADC_IRQHandler
- .thumb_set ADC_IRQHandler,Default_Handler
-
- .weak EXTI9_5_IRQHandler
- .thumb_set EXTI9_5_IRQHandler,Default_Handler
-
- .weak TIM1_BRK_TIM9_IRQHandler
- .thumb_set TIM1_BRK_TIM9_IRQHandler,Default_Handler
-
- .weak TIM1_UP_TIM10_IRQHandler
- .thumb_set TIM1_UP_TIM10_IRQHandler,Default_Handler
-
- .weak TIM1_TRG_COM_TIM11_IRQHandler
- .thumb_set TIM1_TRG_COM_TIM11_IRQHandler,Default_Handler
-
- .weak TIM1_CC_IRQHandler
- .thumb_set TIM1_CC_IRQHandler,Default_Handler
-
- .weak TIM2_IRQHandler
- .thumb_set TIM2_IRQHandler,Default_Handler
-
- .weak TIM3_IRQHandler
- .thumb_set TIM3_IRQHandler,Default_Handler
-
- .weak TIM4_IRQHandler
- .thumb_set TIM4_IRQHandler,Default_Handler
-
- .weak I2C1_EV_IRQHandler
- .thumb_set I2C1_EV_IRQHandler,Default_Handler
-
- .weak I2C1_ER_IRQHandler
- .thumb_set I2C1_ER_IRQHandler,Default_Handler
-
- .weak I2C2_EV_IRQHandler
- .thumb_set I2C2_EV_IRQHandler,Default_Handler
-
- .weak I2C2_ER_IRQHandler
- .thumb_set I2C2_ER_IRQHandler,Default_Handler
-
- .weak SPI1_IRQHandler
- .thumb_set SPI1_IRQHandler,Default_Handler
-
- .weak SPI2_IRQHandler
- .thumb_set SPI2_IRQHandler,Default_Handler
-
- .weak USART1_IRQHandler
- .thumb_set USART1_IRQHandler,Default_Handler
-
- .weak USART2_IRQHandler
- .thumb_set USART2_IRQHandler,Default_Handler
-
- .weak EXTI15_10_IRQHandler
- .thumb_set EXTI15_10_IRQHandler,Default_Handler
-
- .weak RTC_Alarm_IRQHandler
- .thumb_set RTC_Alarm_IRQHandler,Default_Handler
-
- .weak OTG_FS_WKUP_IRQHandler
- .thumb_set OTG_FS_WKUP_IRQHandler,Default_Handler
-
- .weak DMA1_Stream7_IRQHandler
- .thumb_set DMA1_Stream7_IRQHandler,Default_Handler
-
- .weak SDIO_IRQHandler
- .thumb_set SDIO_IRQHandler,Default_Handler
-
- .weak TIM5_IRQHandler
- .thumb_set TIM5_IRQHandler,Default_Handler
-
- .weak SPI3_IRQHandler
- .thumb_set SPI3_IRQHandler,Default_Handler
-
- .weak DMA2_Stream0_IRQHandler
- .thumb_set DMA2_Stream0_IRQHandler,Default_Handler
-
- .weak DMA2_Stream1_IRQHandler
- .thumb_set DMA2_Stream1_IRQHandler,Default_Handler
-
- .weak DMA2_Stream2_IRQHandler
- .thumb_set DMA2_Stream2_IRQHandler,Default_Handler
-
- .weak DMA2_Stream3_IRQHandler
- .thumb_set DMA2_Stream3_IRQHandler,Default_Handler
-
- .weak DMA2_Stream4_IRQHandler
- .thumb_set DMA2_Stream4_IRQHandler,Default_Handler
-
- .weak OTG_FS_IRQHandler
- .thumb_set OTG_FS_IRQHandler,Default_Handler
-
- .weak DMA2_Stream5_IRQHandler
- .thumb_set DMA2_Stream5_IRQHandler,Default_Handler
-
- .weak DMA2_Stream6_IRQHandler
- .thumb_set DMA2_Stream6_IRQHandler,Default_Handler
-
- .weak DMA2_Stream7_IRQHandler
- .thumb_set DMA2_Stream7_IRQHandler,Default_Handler
-
- .weak USART6_IRQHandler
- .thumb_set USART6_IRQHandler,Default_Handler
-
- .weak I2C3_EV_IRQHandler
- .thumb_set I2C3_EV_IRQHandler,Default_Handler
-
- .weak I2C3_ER_IRQHandler
- .thumb_set I2C3_ER_IRQHandler,Default_Handler
-
- .weak FPU_IRQHandler
- .thumb_set FPU_IRQHandler,Default_Handler
-
- .weak SPI4_IRQHandler
- .thumb_set SPI4_IRQHandler,Default_Handler
-
- .weak SPI5_IRQHandler
- .thumb_set SPI5_IRQHandler,Default_Handler
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
diff --git a/ports/stm32f4/boards/startup_stm32f412zx.s b/ports/stm32f4/boards/startup_stm32f412zx.s
deleted file mode 100644
index 801220795..000000000
--- a/ports/stm32f4/boards/startup_stm32f412zx.s
+++ /dev/null
@@ -1,524 +0,0 @@
-/**
- ******************************************************************************
- * @file startup_stm32f412zx.s
- * @author MCD Application Team
- * @brief STM32F412Zx Devices vector table for GCC based toolchains.
- * This module performs:
- * - Set the initial SP
- * - Set the initial PC == Reset_Handler,
- * - Set the vector table entries with the exceptions ISR address
- * - Branches to main in the C library (which eventually
- * calls main()).
- * After Reset the Cortex-M4 processor is in Thread mode,
- * priority is Privileged, and the Stack is set to Main.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2017 STMicroelectronics</center></h2>
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of STMicroelectronics nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
-
- .syntax unified
- .cpu cortex-m4
- .fpu softvfp
- .thumb
-
-.global g_pfnVectors
-.global Default_Handler
-
-/* start address for the initialization values of the .data section.
-defined in linker script */
-.word _sidata
-/* start address for the .data section. defined in linker script */
-.word _sdata
-/* end address for the .data section. defined in linker script */
-.word _edata
-/* start address for the .bss section. defined in linker script */
-.word _sbss
-/* end address for the .bss section. defined in linker script */
-.word _ebss
-/* stack used for SystemInit_ExtMemCtl; always internal RAM used */
-
-/**
- * @brief This is the code that gets called when the processor first
- * starts execution following a reset event. Only the absolutely
- * necessary set is performed, after which the application
- * supplied main() routine is called.
- * @param None
- * @retval : None
-*/
-
- .section .text.Reset_Handler
- .weak Reset_Handler
- .type Reset_Handler, %function
-Reset_Handler:
- ldr sp, =_estack /* set stack pointer */
-
-/* Copy the data segment initializers from flash to SRAM */
- movs r1, #0
- b LoopCopyDataInit
-
-CopyDataInit:
- ldr r3, =_sidata
- ldr r3, [r3, r1]
- str r3, [r0, r1]
- adds r1, r1, #4
-
-LoopCopyDataInit:
- ldr r0, =_sdata
- ldr r3, =_edata
- adds r2, r0, r1
- cmp r2, r3
- bcc CopyDataInit
- ldr r2, =_sbss
- b LoopFillZerobss
-/* Zero fill the bss segment. */
-FillZerobss:
- movs r3, #0
- str r3, [r2], #4
-
-LoopFillZerobss:
- ldr r3, = _ebss
- cmp r2, r3
- bcc FillZerobss
-
-/* Call the clock system intitialization function.*/
- bl SystemInit
-/* Call static constructors */
-/* bl __libc_init_array */
-/* Call the application's entry point.*/
- bl main
- bx lr
-.size Reset_Handler, .-Reset_Handler
-
-/**
- * @brief This is the code that gets called when the processor receives an
- * unexpected interrupt. This simply enters an infinite loop, preserving
- * the system state for examination by a debugger.
- * @param None
- * @retval None
-*/
- .section .text.Default_Handler,"ax",%progbits
-Default_Handler:
-Infinite_Loop:
- b Infinite_Loop
- .size Default_Handler, .-Default_Handler
-/******************************************************************************
-*
-* The minimal vector table for a Cortex M3. Note that the proper constructs
-* must be placed on this to ensure that it ends up at physical address
-* 0x0000.0000.
-*
-*******************************************************************************/
- .section .isr_vector,"a",%progbits
- .type g_pfnVectors, %object
- .size g_pfnVectors, .-g_pfnVectors
-
-g_pfnVectors:
- .word _estack
- .word Reset_Handler
- .word NMI_Handler
- .word HardFault_Handler
- .word MemManage_Handler
- .word BusFault_Handler
- .word UsageFault_Handler
- .word 0
- .word 0
- .word 0
- .word 0
- .word SVC_Handler
- .word DebugMon_Handler
- .word 0
- .word PendSV_Handler
- .word SysTick_Handler
-
- /* External Interrupts */
- .word WWDG_IRQHandler /* Window WatchDog */
- .word PVD_IRQHandler /* PVD through EXTI Line detection */
- .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */
- .word RTC_WKUP_IRQHandler /* RTC Wakeup through the EXTI line */
- .word FLASH_IRQHandler /* FLASH */
- .word RCC_IRQHandler /* RCC */
- .word EXTI0_IRQHandler /* EXTI Line0 */
- .word EXTI1_IRQHandler /* EXTI Line1 */
- .word EXTI2_IRQHandler /* EXTI Line2 */
- .word EXTI3_IRQHandler /* EXTI Line3 */
- .word EXTI4_IRQHandler /* EXTI Line4 */
- .word DMA1_Stream0_IRQHandler /* DMA1 Stream 0 */
- .word DMA1_Stream1_IRQHandler /* DMA1 Stream 1 */
- .word DMA1_Stream2_IRQHandler /* DMA1 Stream 2 */
- .word DMA1_Stream3_IRQHandler /* DMA1 Stream 3 */
- .word DMA1_Stream4_IRQHandler /* DMA1 Stream 4 */
- .word DMA1_Stream5_IRQHandler /* DMA1 Stream 5 */
- .word DMA1_Stream6_IRQHandler /* DMA1 Stream 6 */
- .word ADC_IRQHandler /* ADC1, ADC2 and ADC3s */
- .word CAN1_TX_IRQHandler /* CAN1 TX */
- .word CAN1_RX0_IRQHandler /* CAN1 RX0 */
- .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
- .word CAN1_SCE_IRQHandler /* CAN1 SCE */
- .word EXTI9_5_IRQHandler /* External Line[9:5]s */
- .word TIM1_BRK_TIM9_IRQHandler /* TIM1 Break and TIM9 */
- .word TIM1_UP_TIM10_IRQHandler /* TIM1 Update and TIM10 */
- .word TIM1_TRG_COM_TIM11_IRQHandler /* TIM1 Trigger and Commutation and TIM11 */
- .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */
- .word TIM2_IRQHandler /* TIM2 */
- .word TIM3_IRQHandler /* TIM3 */
- .word TIM4_IRQHandler /* TIM4 */
- .word I2C1_EV_IRQHandler /* I2C1 Event */
- .word I2C1_ER_IRQHandler /* I2C1 Error */
- .word I2C2_EV_IRQHandler /* I2C2 Event */
- .word I2C2_ER_IRQHandler /* I2C2 Error */
- .word SPI1_IRQHandler /* SPI1 */
- .word SPI2_IRQHandler /* SPI2 */
- .word USART1_IRQHandler /* USART1 */
- .word USART2_IRQHandler /* USART2 */
- .word USART3_IRQHandler /* USART3 */
- .word EXTI15_10_IRQHandler /* External Line[15:10]s */
- .word RTC_Alarm_IRQHandler /* RTC Alarm (A and B) through EXTI Line */
- .word OTG_FS_WKUP_IRQHandler /* USB OTG FS Wakeup through EXTI line */
- .word TIM8_BRK_TIM12_IRQHandler /* TIM8 Break and TIM12 */
- .word TIM8_UP_TIM13_IRQHandler /* TIM8 Update and TIM13 */
- .word TIM8_TRG_COM_TIM14_IRQHandler /* TIM8 Trigger and Commutation and TIM14 */
- .word TIM8_CC_IRQHandler /* TIM8 Capture Compare */
- .word DMA1_Stream7_IRQHandler /* DMA1 Stream7 */
- .word 0 /* Reserved */
- .word SDIO_IRQHandler /* SDIO */
- .word TIM5_IRQHandler /* TIM5 */
- .word SPI3_IRQHandler /* SPI3 */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word TIM6_IRQHandler /* TIM6 */
- .word TIM7_IRQHandler /* TIM7 */
- .word DMA2_Stream0_IRQHandler /* DMA2 Stream 0 */
- .word DMA2_Stream1_IRQHandler /* DMA2 Stream 1 */
- .word DMA2_Stream2_IRQHandler /* DMA2 Stream 2 */
- .word DMA2_Stream3_IRQHandler /* DMA2 Stream 3 */
- .word DMA2_Stream4_IRQHandler /* DMA2 Stream 4 */
- .word DFSDM1_FLT0_IRQHandler /* DFSDM1 Filter0 */
- .word DFSDM1_FLT1_IRQHandler /* DFSDM1 Filter1 */
- .word CAN2_TX_IRQHandler /* CAN2 TX */
- .word CAN2_RX0_IRQHandler /* CAN2 RX0 */
- .word CAN2_RX1_IRQHandler /* CAN2 RX1 */
- .word CAN2_SCE_IRQHandler /* CAN2 SCE */
- .word OTG_FS_IRQHandler /* USB OTG FS */
- .word DMA2_Stream5_IRQHandler /* DMA2 Stream 5 */
- .word DMA2_Stream6_IRQHandler /* DMA2 Stream 6 */
- .word DMA2_Stream7_IRQHandler /* DMA2 Stream 7 */
- .word USART6_IRQHandler /* USART6 */
- .word I2C3_EV_IRQHandler /* I2C3 event */
- .word I2C3_ER_IRQHandler /* I2C3 error */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word RNG_IRQHandler /* RNG */
- .word FPU_IRQHandler /* FPU */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word SPI4_IRQHandler /* SPI4 */
- .word SPI5_IRQHandler /* SPI5 */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word QUADSPI_IRQHandler /* QuadSPI */
- .word 0 /* Reserved */
- .word 0 /* Reserved */
- .word FMPI2C1_EV_IRQHandler /* FMPI2C1 Event */
- .word FMPI2C1_ER_IRQHandler /* FMPI2C1 Error */
-
-/*******************************************************************************
-*
-* Provide weak aliases for each Exception handler to the Default_Handler.
-* As they are weak aliases, any function with the same name will override
-* this definition.
-*
-*******************************************************************************/
- .weak NMI_Handler
- .thumb_set NMI_Handler,Default_Handler
-
- .weak HardFault_Handler
- .thumb_set HardFault_Handler,Default_Handler
-
- .weak MemManage_Handler
- .thumb_set MemManage_Handler,Default_Handler
-
- .weak BusFault_Handler
- .thumb_set BusFault_Handler,Default_Handler
-
- .weak UsageFault_Handler
- .thumb_set UsageFault_Handler,Default_Handler
-
- .weak SVC_Handler
- .thumb_set SVC_Handler,Default_Handler
-
- .weak DebugMon_Handler
- .thumb_set DebugMon_Handler,Default_Handler
-
- .weak PendSV_Handler
- .thumb_set PendSV_Handler,Default_Handler
-
- .weak SysTick_Handler
- .thumb_set SysTick_Handler,Default_Handler
-
- .weak WWDG_IRQHandler
- .thumb_set WWDG_IRQHandler,Default_Handler
-
- .weak PVD_IRQHandler
- .thumb_set PVD_IRQHandler,Default_Handler
-
- .weak TAMP_STAMP_IRQHandler
- .thumb_set TAMP_STAMP_IRQHandler,Default_Handler
-
- .weak RTC_WKUP_IRQHandler
- .thumb_set RTC_WKUP_IRQHandler,Default_Handler
-
- .weak FLASH_IRQHandler
- .thumb_set FLASH_IRQHandler,Default_Handler
-
- .weak RCC_IRQHandler
- .thumb_set RCC_IRQHandler,Default_Handler
-
- .weak EXTI0_IRQHandler
- .thumb_set EXTI0_IRQHandler,Default_Handler
-
- .weak EXTI1_IRQHandler
- .thumb_set EXTI1_IRQHandler,Default_Handler
-
- .weak EXTI2_IRQHandler
- .thumb_set EXTI2_IRQHandler,Default_Handler
-
- .weak EXTI3_IRQHandler
- .thumb_set EXTI3_IRQHandler,Default_Handler
-
- .weak EXTI4_IRQHandler
- .thumb_set EXTI4_IRQHandler,Default_Handler
-
- .weak DMA1_Stream0_IRQHandler
- .thumb_set DMA1_Stream0_IRQHandler,Default_Handler
-
- .weak DMA1_Stream1_IRQHandler
- .thumb_set DMA1_Stream1_IRQHandler,Default_Handler
-
- .weak DMA1_Stream2_IRQHandler
- .thumb_set DMA1_Stream2_IRQHandler,Default_Handler
-
- .weak DMA1_Stream3_IRQHandler
- .thumb_set DMA1_Stream3_IRQHandler,Default_Handler
-
- .weak DMA1_Stream4_IRQHandler
- .thumb_set DMA1_Stream4_IRQHandler,Default_Handler
-
- .weak DMA1_Stream5_IRQHandler
- .thumb_set DMA1_Stream5_IRQHandler,Default_Handler
-
- .weak DMA1_Stream6_IRQHandler
- .thumb_set DMA1_Stream6_IRQHandler,Default_Handler
-
- .weak ADC_IRQHandler
- .thumb_set ADC_IRQHandler,Default_Handler
-
- .weak CAN1_TX_IRQHandler
- .thumb_set CAN1_TX_IRQHandler,Default_Handler
-
- .weak CAN1_RX0_IRQHandler
- .thumb_set CAN1_RX0_IRQHandler,Default_Handler
-
- .weak CAN1_RX1_IRQHandler
- .thumb_set CAN1_RX1_IRQHandler,Default_Handler
-
- .weak CAN1_SCE_IRQHandler
- .thumb_set CAN1_SCE_IRQHandler,Default_Handler
-
- .weak EXTI9_5_IRQHandler
- .thumb_set EXTI9_5_IRQHandler,Default_Handler
-
- .weak TIM1_BRK_TIM9_IRQHandler
- .thumb_set TIM1_BRK_TIM9_IRQHandler,Default_Handler
-
- .weak TIM1_UP_TIM10_IRQHandler
- .thumb_set TIM1_UP_TIM10_IRQHandler,Default_Handler
-
- .weak TIM1_TRG_COM_TIM11_IRQHandler
- .thumb_set TIM1_TRG_COM_TIM11_IRQHandler,Default_Handler
-
- .weak TIM1_CC_IRQHandler
- .thumb_set TIM1_CC_IRQHandler,Default_Handler
-
- .weak TIM2_IRQHandler
- .thumb_set TIM2_IRQHandler,Default_Handler
-
- .weak TIM3_IRQHandler
- .thumb_set TIM3_IRQHandler,Default_Handler
-
- .weak TIM4_IRQHandler
- .thumb_set TIM4_IRQHandler,Default_Handler
-
- .weak I2C1_EV_IRQHandler
- .thumb_set I2C1_EV_IRQHandler,Default_Handler
-
- .weak I2C1_ER_IRQHandler
- .thumb_set I2C1_ER_IRQHandler,Default_Handler
-
- .weak I2C2_EV_IRQHandler
- .thumb_set I2C2_EV_IRQHandler,Default_Handler
-
- .weak I2C2_ER_IRQHandler
- .thumb_set I2C2_ER_IRQHandler,Default_Handler
-
- .weak SPI1_IRQHandler
- .thumb_set SPI1_IRQHandler,Default_Handler
-
- .weak SPI2_IRQHandler
- .thumb_set SPI2_IRQHandler,Default_Handler
-
- .weak USART1_IRQHandler
- .thumb_set USART1_IRQHandler,Default_Handler
-
- .weak USART2_IRQHandler
- .thumb_set USART2_IRQHandler,Default_Handler
-
- .weak USART3_IRQHandler
- .thumb_set USART3_IRQHandler,Default_Handler
-
- .weak EXTI15_10_IRQHandler
- .thumb_set EXTI15_10_IRQHandler,Default_Handler
-
- .weak RTC_Alarm_IRQHandler
- .thumb_set RTC_Alarm_IRQHandler,Default_Handler
-
- .weak OTG_FS_WKUP_IRQHandler
- .thumb_set OTG_FS_WKUP_IRQHandler,Default_Handler
-
- .weak TIM8_BRK_TIM12_IRQHandler
- .thumb_set TIM8_BRK_TIM12_IRQHandler,Default_Handler
-
- .weak TIM8_UP_TIM13_IRQHandler
- .thumb_set TIM8_UP_TIM13_IRQHandler,Default_Handler
-
- .weak TIM8_TRG_COM_TIM14_IRQHandler
- .thumb_set TIM8_TRG_COM_TIM14_IRQHandler,Default_Handler
-
- .weak TIM8_CC_IRQHandler
- .thumb_set TIM8_CC_IRQHandler,Default_Handler
-
- .weak DMA1_Stream7_IRQHandler
- .thumb_set DMA1_Stream7_IRQHandler,Default_Handler
-
- .weak SDIO_IRQHandler
- .thumb_set SDIO_IRQHandler,Default_Handler
-
- .weak TIM5_IRQHandler
- .thumb_set TIM5_IRQHandler,Default_Handler
-
- .weak SPI3_IRQHandler
- .thumb_set SPI3_IRQHandler,Default_Handler
-
- .weak TIM6_IRQHandler
- .thumb_set TIM6_IRQHandler,Default_Handler
-
- .weak TIM7_IRQHandler
- .thumb_set TIM7_IRQHandler,Default_Handler
-
- .weak DMA2_Stream0_IRQHandler
- .thumb_set DMA2_Stream0_IRQHandler,Default_Handler
-
- .weak DMA2_Stream1_IRQHandler
- .thumb_set DMA2_Stream1_IRQHandler,Default_Handler
-
- .weak DMA2_Stream2_IRQHandler
- .thumb_set DMA2_Stream2_IRQHandler,Default_Handler
-
- .weak DMA2_Stream3_IRQHandler
- .thumb_set DMA2_Stream3_IRQHandler,Default_Handler
-
- .weak DMA2_Stream4_IRQHandler
- .thumb_set DMA2_Stream4_IRQHandler,Default_Handler
-
- .weak DFSDM1_FLT0_IRQHandler
- .thumb_set DFSDM1_FLT0_IRQHandler,Default_Handler
-
- .weak DFSDM1_FLT1_IRQHandler
- .thumb_set DFSDM1_FLT1_IRQHandler,Default_Handler
-
- .weak CAN2_TX_IRQHandler
- .thumb_set CAN2_TX_IRQHandler,Default_Handler
-
- .weak CAN2_RX0_IRQHandler
- .thumb_set CAN2_RX0_IRQHandler,Default_Handler
-
- .weak CAN2_RX1_IRQHandler
- .thumb_set CAN2_RX1_IRQHandler,Default_Handler
-
- .weak CAN2_SCE_IRQHandler
- .thumb_set CAN2_SCE_IRQHandler,Default_Handler
-
- .weak OTG_FS_IRQHandler
- .thumb_set OTG_FS_IRQHandler,Default_Handler
-
- .weak DMA2_Stream5_IRQHandler
- .thumb_set DMA2_Stream5_IRQHandler,Default_Handler
-
- .weak DMA2_Stream6_IRQHandler
- .thumb_set DMA2_Stream6_IRQHandler,Default_Handler
-
- .weak DMA2_Stream7_IRQHandler
- .thumb_set DMA2_Stream7_IRQHandler,Default_Handler
-
- .weak USART6_IRQHandler
- .thumb_set USART6_IRQHandler,Default_Handler
-
- .weak I2C3_EV_IRQHandler
- .thumb_set I2C3_EV_IRQHandler,Default_Handler
-
- .weak I2C3_ER_IRQHandler
- .thumb_set I2C3_ER_IRQHandler,Default_Handler
-
- .weak RNG_IRQHandler
- .thumb_set RNG_IRQHandler,Default_Handler
-
- .weak FPU_IRQHandler
- .thumb_set FPU_IRQHandler,Default_Handler
-
- .weak SPI4_IRQHandler
- .thumb_set SPI4_IRQHandler,Default_Handler
-
- .weak SPI5_IRQHandler
- .thumb_set SPI5_IRQHandler,Default_Handler
-
- .weak QUADSPI_IRQHandler
- .thumb_set QUADSPI_IRQHandler,Default_Handler
-
- .weak FMPI2C1_EV_IRQHandler
- .thumb_set FMPI2C1_EV_IRQHandler,Default_Handler
-
- .weak FMPI2C1_ER_IRQHandler
- .thumb_set FMPI2C1_ER_IRQHandler,Default_Handler
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/ports/stm32f4/common-hal/pulseio/PulseIn.c b/ports/stm32f4/common-hal/pulseio/PulseIn.c
deleted file mode 100644
index 068936bdd..000000000
--- a/ports/stm32f4/common-hal/pulseio/PulseIn.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2019 Lucian Copeland 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 "common-hal/pulseio/PulseIn.h"
-#include <stdint.h>
-#include <string.h>
-#include "py/mpconfig.h"
-#include "py/gc.h"
-#include "py/runtime.h"
-#include "shared-bindings/microcontroller/__init__.h"
-#include "shared-bindings/pulseio/PulseIn.h"
-#include "tick.h"
-
-void pulsein_reset(void) {
-}
-
-void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self, const mcu_pin_obj_t* pin,
- uint16_t maxlen, bool idle_state) {
- mp_raise_NotImplementedError(translate("PulseIn not yet supported"));
-}
-
-bool common_hal_pulseio_pulsein_deinited(pulseio_pulsein_obj_t* self) {
- return true;
-}
-
-void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t* self) {
-}
-
-void common_hal_pulseio_pulsein_pause(pulseio_pulsein_obj_t* self) {
-}
-
-void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t* self, uint16_t trigger_duration) {
-}
-
-void common_hal_pulseio_pulsein_clear(pulseio_pulsein_obj_t* self) {
-}
-
-uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t* self, int16_t index) {
- return 0;
-}
-
-uint16_t common_hal_pulseio_pulsein_popleft(pulseio_pulsein_obj_t* self) {
- return 0;
-}
-
-uint16_t common_hal_pulseio_pulsein_get_maxlen(pulseio_pulsein_obj_t* self) {
- return 0;
-}
-
-bool common_hal_pulseio_pulsein_get_paused(pulseio_pulsein_obj_t* self) {
- return 0;
-}
-
-uint16_t common_hal_pulseio_pulsein_get_len(pulseio_pulsein_obj_t* self) {
- return 0;
-}
diff --git a/ports/stm32f4/peripherals/stm32f4/periph.h b/ports/stm32f4/peripherals/stm32f4/periph.h
deleted file mode 100644
index ac98b8932..000000000
--- a/ports/stm32f4/peripherals/stm32f4/periph.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2019 Lucian Copeland 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.
- */
-
-#ifndef __MICROPY_INCLUDED_STM32F4_PERIPHERALS_PERIPH_H__
-#define __MICROPY_INCLUDED_STM32F4_PERIPHERALS_PERIPH_H__
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#include "stm32f4xx_hal.h"
-#include "stm32f4/pins.h"
-
-// I2C
-// TODO: these objects should be condensed into a single 'periph_pin' unless we
-// find a compelling reason to store more unique data in them.
-
-typedef struct {
- uint8_t i2c_index:4; // Index of the I2C unit (1 to 3)
- uint8_t altfn_index:4; //Index of the altfn for this pin (0 to 15)
- const mcu_pin_obj_t * pin;
-} mcu_i2c_sda_obj_t;
-
-typedef struct {
- uint8_t i2c_index:4;
- uint8_t altfn_index:4;
- const mcu_pin_obj_t * pin;
-} mcu_i2c_scl_obj_t;
-
-
-#define I2C_SDA(index, alt, sda_pin) \
-{ \
- .i2c_index = index, \
- .altfn_index = alt, \
- .pin = sda_pin, \
-}
-
-#define I2C_SCL(index, alt, scl_pin) \
-{ \
- .i2c_index = index, \
- .altfn_index = alt, \
- .pin = scl_pin, \
-}
-
-// SPI
-// TODO: these objects should be condensed into a single 'periph_pin' unless we
-// find a compelling reason to store more unique data in them.
-
-typedef struct {
- uint8_t spi_index:4; //Up to 6 SPI units
- uint8_t altfn_index:4; //Up to 15 alt channels
- const mcu_pin_obj_t * pin;
-} mcu_spi_sck_obj_t;
-
-typedef struct {
- uint8_t spi_index:4;
- uint8_t altfn_index:4;
- const mcu_pin_obj_t * pin;
-} mcu_spi_mosi_obj_t;
-
-typedef struct {
- uint8_t spi_index:4;
- uint8_t altfn_index:4;
- const mcu_pin_obj_t * pin;
-} mcu_spi_miso_obj_t;
-
-typedef struct {
- uint8_t spi_index:4;
- uint8_t altfn_index:4;
- const mcu_pin_obj_t * pin;
-} mcu_spi_nss_obj_t;
-
-#define SPI(index, alt, spi_pin) \
-{ \
- .spi_index = index, \
- .altfn_index = alt, \
- .pin = spi_pin, \
-}
-
-// UART
-// TODO: these objects should be condensed into a single 'periph_pin' unless we
-// find a compelling reason to store more unique data in them.
-
-typedef struct {
- uint8_t uart_index:4;
- uint8_t altfn_index:4;
- const mcu_pin_obj_t * pin;
-} mcu_uart_tx_obj_t;
-
-typedef struct {
- uint8_t uart_index:4;
- uint8_t altfn_index:4;
- const mcu_pin_obj_t * pin;
-} mcu_uart_rx_obj_t;
-
-#define UART(index, alt, uart_pin) \
-{ \
- .uart_index = index, \
- .altfn_index = alt, \
- .pin = uart_pin, \
-}
-
-//Timers
-typedef struct {
- uint8_t tim_index:4;
- uint8_t altfn_index:4;
- uint8_t channel_index:4;
- const mcu_pin_obj_t * pin;
-} mcu_tim_pin_obj_t;
-
-#define TIM(index, alt, channel, tim_pin) \
-{ \
- .tim_index = index, \
- .altfn_index = alt, \
- .channel_index = channel, \
- .pin = tim_pin, \
-}
-
-//Starter Lines
-
-#ifdef STM32F401xE
-#define HAS_DAC 0
-#define HAS_TRNG 0
-#include "stm32f401xe/periph.h"
-#endif
-
-#ifdef STM32F411xE
-#define HAS_DAC 0
-#define HAS_TRNG 0
-#include "stm32f411xe/periph.h"
-#endif
-
-#ifdef STM32F412Zx
-#define HAS_DAC 0
-#define HAS_TRNG 1
-#include "stm32f412zx/periph.h"
-#endif
-
-//Foundation Lines
-
-#ifdef STM32F405xx
-#define HAS_DAC 1
-#define HAS_TRNG 1
-#include "stm32f405xx/periph.h"
-#endif
-
-#endif // __MICROPY_INCLUDED_STM32F4_PERIPHERALS_PERIPH_H__
diff --git a/ports/stm32f4/peripherals/stm32f4/stm32f412zx/gpio.c b/ports/stm32f4/peripherals/stm32f4/stm32f412zx/gpio.c
deleted file mode 100644
index d17ab4e01..000000000
--- a/ports/stm32f4/peripherals/stm32f4/stm32f412zx/gpio.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * This file is part of the Micro Python project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2019 Lucian Copeland 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.
- */
-
-/* GPIO PIN REFERENCE
-#define LED3_Pin GPIO_PIN_2
-#define LED3_GPIO_Port GPIOE
-#define LED4_Pin GPIO_PIN_3
-#define LED4_GPIO_Port GPIOE
-#define DFSDM_DATIN3_Pin GPIO_PIN_4
-#define DFSDM_DATIN3_GPIO_Port GPIOE
-#define A0_Pin GPIO_PIN_0
-#define A0_GPIO_Port GPIOF
-#define LCD_BLCTRL_Pin GPIO_PIN_5
-#define LCD_BLCTRL_GPIO_Port GPIOF
-#define QSPI_BK1_IO3_Pin GPIO_PIN_6
-#define QSPI_BK1_IO3_GPIO_Port GPIOF
-#define QSPI_BK1_IO2_Pin GPIO_PIN_7
-#define QSPI_BK1_IO2_GPIO_Port GPIOF
-#define QSPI_BK1_IO0_Pin GPIO_PIN_8
-#define QSPI_BK1_IO0_GPIO_Port GPIOF
-#define QSPI_BK1_IO1_Pin GPIO_PIN_9
-#define QSPI_BK1_IO1_GPIO_Port GPIOF
-#define STLK_MCO_Pin GPIO_PIN_0
-#define STLK_MCO_GPIO_Port GPIOH
-#define DFSDM_CKOUT_Pin GPIO_PIN_2
-#define DFSDM_CKOUT_GPIO_Port GPIOC
-#define JOY_SEL_Pin GPIO_PIN_0
-#define JOY_SEL_GPIO_Port GPIOA
-#define STLINK_RX_Pin GPIO_PIN_2
-#define STLINK_RX_GPIO_Port GPIOA
-#define STLINK_TX_Pin GPIO_PIN_3
-#define STLINK_TX_GPIO_Port GPIOA
-#define CODEC_I2S3_WS_Pin GPIO_PIN_4
-#define CODEC_I2S3_WS_GPIO_Port GPIOA
-#define DFSDM_DATIN0_Pin GPIO_PIN_1
-#define DFSDM_DATIN0_GPIO_Port GPIOB
-#define QSPI_CLK_Pin GPIO_PIN_2
-#define QSPI_CLK_GPIO_Port GPIOB
-#define EXT_RESET_Pin GPIO_PIN_11
-#define EXT_RESET_GPIO_Port GPIOF
-#define CTP_RST_Pin GPIO_PIN_12
-#define CTP_RST_GPIO_Port GPIOF
-#define JOY_RIGHT_Pin GPIO_PIN_14
-#define JOY_RIGHT_GPIO_Port GPIOF
-#define JOY_LEFT_Pin GPIO_PIN_15
-#define JOY_LEFT_GPIO_Port GPIOF
-#define JOY_UP_Pin GPIO_PIN_0
-#define JOY_UP_GPIO_Port GPIOG
-#define JOY_DOWN_Pin GPIO_PIN_1
-#define JOY_DOWN_GPIO_Port GPIOG
-#define D4_Pin GPIO_PIN_7
-#define D4_GPIO_Port GPIOE
-#define D5_Pin GPIO_PIN_8
-#define D5_GPIO_Port GPIOE
-#define D6_Pin GPIO_PIN_9
-#define D6_GPIO_Port GPIOE
-#define D7_Pin GPIO_PIN_10
-#define D7_GPIO_Port GPIOE
-#define D8_Pin GPIO_PIN_11
-#define D8_GPIO_Port GPIOE
-#define D9_Pin GPIO_PIN_12
-#define D9_GPIO_Port GPIOE
-#define D10_Pin GPIO_PIN_13
-#define D10_GPIO_Port GPIOE
-#define D11_Pin GPIO_PIN_14
-#define D11_GPIO_Port GPIOE
-#define D12_Pin GPIO_PIN_15
-#define D12_GPIO_Port GPIOE
-#define I2C2_SCL_Pin GPIO_PIN_10
-#define I2C2_SCL_GPIO_Port GPIOB
-#define M2_CKIN_Pin GPIO_PIN_11
-#define M2_CKIN_GPIO_Port GPIOB
-#define CODEC_I2S3_SCK_Pin GPIO_PIN_12
-#define CODEC_I2S3_SCK_GPIO_Port GPIOB
-#define D13_Pin GPIO_PIN_8
-#define D13_GPIO_Port GPIOD
-#define D14_Pin GPIO_PIN_9
-#define D14_GPIO_Port GPIOD
-#define D15_Pin GPIO_PIN_10
-#define D15_GPIO_Port GPIOD
-#define LCD_RESET_Pin GPIO_PIN_11
-#define LCD_RESET_GPIO_Port GPIOD
-#define D0_Pin GPIO_PIN_14
-#define D0_GPIO_Port GPIOD
-#define D1_Pin GPIO_PIN_15
-#define D1_GPIO_Port GPIOD
-#define CODEC_INT_Pin GPIO_PIN_2
-#define CODEC_INT_GPIO_Port GPIOG
-#define LCD_TE_Pin GPIO_PIN_4
-#define LCD_TE_GPIO_Port GPIOG
-#define CTP_INT_Pin GPIO_PIN_5
-#define CTP_INT_GPIO_Port GPIOG
-#define QSPI_BK1_NCS_Pin GPIO_PIN_6
-#define QSPI_BK1_NCS_GPIO_Port GPIOG
-#define USB_OTGFS_OVRCR_Pin GPIO_PIN_7
-#define USB_OTGFS_OVRCR_GPIO_Port GPIOG
-#define USB_OTGFS_PPWR_EN_Pin GPIO_PIN_8
-#define USB_OTGFS_PPWR_EN_GPIO_Port GPIOG
-#define CODEC_I2S3_MCK_Pin GPIO_PIN_7
-#define CODEC_I2S3_MCK_GPIO_Port GPIOC
-#define uSD_D0_Pin GPIO_PIN_8
-#define uSD_D0_GPIO_Port GPIOC
-#define uSD_D1_Pin GPIO_PIN_9
-#define uSD_D1_GPIO_Port GPIOC
-#define M2_CKINA8_Pin GPIO_PIN_8
-#define M2_CKINA8_GPIO_Port GPIOA
-#define USB_OTGFS_VBUS_Pin GPIO_PIN_9
-#define USB_OTGFS_VBUS_GPIO_Port GPIOA
-#define USB_OTGFS_ID_Pin GPIO_PIN_10
-#define USB_OTGFS_ID_GPIO_Port GPIOA
-#define USB_OTGFS_DM_Pin GPIO_PIN_11
-#define USB_OTGFS_DM_GPIO_Port GPIOA
-#define USB_OTGFS_DP_Pin GPIO_PIN_12
-#define USB_OTGFS_DP_GPIO_Port GPIOA
-#define SWDIO_Pin GPIO_PIN_13
-#define SWDIO_GPIO_Port GPIOA
-#define SWCLK_Pin GPIO_PIN_14
-#define SWCLK_GPIO_Port GPIOA
-#define uSD_D2_Pin GPIO_PIN_10
-#define uSD_D2_GPIO_Port GPIOC
-#define uSD_D3_Pin GPIO_PIN_11
-#define uSD_D3_GPIO_Port GPIOC
-#define uSD_CLK_Pin GPIO_PIN_12
-#define uSD_CLK_GPIO_Port GPIOC
-#define D2_Pin GPIO_PIN_0
-#define D2_GPIO_Port GPIOD
-#define D3_Pin GPIO_PIN_1
-#define D3_GPIO_Port GPIOD
-#define uSD_CMD_Pin GPIO_PIN_2
-#define uSD_CMD_GPIO_Port GPIOD
-#define uSD_DETECT_Pin GPIO_PIN_3
-#define uSD_DETECT_GPIO_Port GPIOD
-#define FMC_NOE_Pin GPIO_PIN_4
-#define FMC_NOE_GPIO_Port GPIOD
-#define FMC_NWE_Pin GPIO_PIN_5
-#define FMC_NWE_GPIO_Port GPIOD
-#define FMC_NE1_Pin GPIO_PIN_7
-#define FMC_NE1_GPIO_Port GPIOD
-#define SWO_Pin GPIO_PIN_3
-#define SWO_GPIO_Port GPIOB
-#define CODEC_I2S3ext_SD_Pin GPIO_PIN_4
-#define CODEC_I2S3ext_SD_GPIO_Port GPIOB
-#define CODEC_I2S3_SD_Pin GPIO_PIN_5
-#define CODEC_I2S3_SD_GPIO_Port GPIOB
-#define I2C1_SCL_Pin GPIO_PIN_6
-#define I2C1_SCL_GPIO_Port GPIOB
-#define I2C1_SDA_Pin GPIO_PIN_7
-#define I2C1_SDA_GPIO_Port GPIOB
-#define I2C2_SDA_Pin GPIO_PIN_9
-#define I2C2_SDA_GPIO_Port GPIOB
-#define LED1_Pin GPIO_PIN_0
-#define LED1_GPIO_Port GPIOE
-#define LED2_Pin GPIO_PIN_1
-#define LED2_GPIO_Port GPIOE
-*/
-
-#include "stm32f4xx_hal.h"
-#include "stm32f4/gpio.h"
-#include "common-hal/microcontroller/Pin.h"
-
-void stm32f4_peripherals_gpio_init(void) {
- //Enable all GPIO for now
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- __HAL_RCC_GPIOE_CLK_ENABLE();
- __HAL_RCC_GPIOC_CLK_ENABLE();
- __HAL_RCC_GPIOF_CLK_ENABLE();
- __HAL_RCC_GPIOH_CLK_ENABLE();
- __HAL_RCC_GPIOA_CLK_ENABLE();
- __HAL_RCC_GPIOB_CLK_ENABLE();
- __HAL_RCC_GPIOG_CLK_ENABLE();
- __HAL_RCC_GPIOD_CLK_ENABLE();
-
- HAL_GPIO_WritePin(GPIOE, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, GPIO_PIN_RESET);
- //HAL_GPIO_WritePin(USB_OTGFS_PPWR_EN_GPIO_Port, USB_OTGFS_PPWR_EN_Pin, GPIO_PIN_SET);
-
- //Configure LED pins
- GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3;
- GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
- HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
-
- //Status LED chain
- stm32f4_peripherals_status_led(0,1);
- stm32f4_peripherals_status_led(1,0);
- stm32f4_peripherals_status_led(2,0);
- stm32f4_peripherals_status_led(3,0);
-
- //Never reset pins
- never_reset_pin_number(2,13); //PC13 anti tamp
- never_reset_pin_number(2,14); //PC14 OSC32_IN
- never_reset_pin_number(2,15); //PC15 OSC32_OUT
- never_reset_pin_number(0,13); //PA13 SWDIO
- never_reset_pin_number(0,14); //PA14 SWCLK
- //never_reset_pin_number(0,15); //PA15 JTDI
- //never_reset_pin_number(1,3); //PB3 JTDO
- //never_reset_pin_number(1,4); //PB4 JTRST
-
- // Port H is not included in GPIO port array
- // never_reset_pin_number(5,0); //PH0 JTDO
- // never_reset_pin_number(5,1); //PH1 JTRST
-}
-
-//LEDs are inverted on F411 DISCO
-void stm32f4_peripherals_status_led(uint8_t led, uint8_t state) {
- switch(led)
- {
- case 0: HAL_GPIO_WritePin(GPIOE, GPIO_PIN_0, (state ^ 1));
- break;
- case 1: HAL_GPIO_WritePin(GPIOE, GPIO_PIN_1, (state ^ 1));
- break;
- case 2: HAL_GPIO_WritePin(GPIOE, GPIO_PIN_2, (state ^ 1));
- break;
- case 3: HAL_GPIO_WritePin(GPIOE, GPIO_PIN_3, (state ^ 1));
- break;
- default: break;
- }
-}
-
-
diff --git a/ports/stm32f4/stm32f4 b/ports/stm32f4/stm32f4
deleted file mode 160000
-Subproject 89a356f0b44883d55c45a5d22940777a44a2b88
diff --git a/ports/stm32f4/supervisor/internal_flash.c b/ports/stm32f4/supervisor/internal_flash.c
deleted file mode 100644
index 046b26baf..000000000
--- a/ports/stm32f4/supervisor/internal_flash.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2013, 2014 Damien P. George
- * Copyright (c) 2019 Lucian Copeland 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 "supervisor/internal_flash.h"
-
-#include <stdint.h>
-#include <string.h>
-
-#include "extmod/vfs.h"
-#include "extmod/vfs_fat.h"
-#include "py/mphal.h"
-#include "py/obj.h"
-#include "py/runtime.h"
-#include "lib/oofatfs/ff.h"
-
-#include "stm32f4xx_hal.h"
-
-typedef struct {
- uint32_t base_address;
- uint32_t sector_size;
- uint32_t sector_count;
-} flash_layout_t;
-
-/*------------------------------------------------------------------*/
-/* Internal Flash API
- *------------------------------------------------------------------*/
-
-static const flash_layout_t flash_layout[] = {
- { 0x08000000, 0x04000, 4 },
- { 0x08010000, 0x10000, 1 },
- { 0x08020000, 0x20000, 3 },
- #if defined(FLASH_SECTOR_8)
- { 0x08080000, 0x20000, 4 },
- #endif
- #if defined(FLASH_SECTOR_12)
- { 0x08100000, 0x04000, 4 },
- { 0x08110000, 0x10000, 1 },
- { 0x08120000, 0x20000, 7 },
- #endif
-};
-
-static uint8_t sector_copy[0x4000] __attribute__((aligned(4)));
-
-//Return the sector of a given flash address.
-uint32_t flash_get_sector_info(uint32_t addr, uint32_t *start_addr, uint32_t *size) {
- if (addr >= flash_layout[0].base_address) {
- uint32_t sector_index = 0;
- for (uint8_t i = 0; i < MP_ARRAY_SIZE(flash_layout); ++i) {
- for (uint8_t j = 0; j < flash_layout[i].sector_count; ++j) {
- uint32_t sector_start_next = flash_layout[i].base_address
- + (j + 1) * flash_layout[i].sector_size;
- if (addr < sector_start_next) {
- if (start_addr != NULL) {
- *start_addr = flash_layout[i].base_address
- + j * flash_layout[i].sector_size;
- }
- if (size != NULL) {
- *size = flash_layout[i].sector_size;
- }
- return sector_index;
- }
- ++sector_index;
- }
- }
- }
- return 0;
-}
-
-void supervisor_flash_init(void) {
-}
-
-uint32_t supervisor_flash_get_block_size(void) {
- return FILESYSTEM_BLOCK_SIZE;
-}
-
-uint32_t supervisor_flash_get_block_count(void) {
- return INTERNAL_FLASH_FILESYSTEM_NUM_BLOCKS;
-}
-
-void supervisor_flash_flush(void) {
-}
-
-static int32_t convert_block_to_flash_addr(uint32_t block) {
- if (0 <= block && block < INTERNAL_FLASH_FILESYSTEM_NUM_BLOCKS) {
- // a block in partition 1
- return INTERNAL_FLASH_FILESYSTEM_START_ADDR + block * FILESYSTEM_BLOCK_SIZE;
- }
- // bad block
- return -1;
-}
-
-mp_uint_t supervisor_flash_read_blocks(uint8_t *dest, uint32_t block, uint32_t num_blocks) {
- int32_t src = convert_block_to_flash_addr(block);
- if (src == -1) {
- // bad block number
- return false;
- }
- memcpy(dest, (uint8_t*) src, FILESYSTEM_BLOCK_SIZE*num_blocks);
- return 0; // success
-}
-
-bool supervisor_flash_write_block(const uint8_t *src, uint32_t block) {
- int32_t dest = convert_block_to_flash_addr(block);
- if (dest == -1) {
- // bad block number
- mp_printf(&mp_plat_print, "BAD FLASH BLOCK ERROR");
- return false;
- }
-
- // unlock flash
- HAL_FLASH_Unlock();
-
- // set up for erase
- FLASH_EraseInitTypeDef EraseInitStruct;
- EraseInitStruct.TypeErase = TYPEERASE_SECTORS;
- EraseInitStruct.VoltageRange = VOLTAGE_RANGE_3; // voltage range needs to be 2.7V to 3.6V
- // get the sector information
- uint32_t sector_size;
- uint32_t sector_start_addr;
- EraseInitStruct.Sector = flash_get_sector_info(dest, &sector_start_addr, &sector_size);
- EraseInitStruct.NbSectors = 1;
- if (sector_size>0x4000) return false;
-
- // copy the sector
- memcpy(sector_copy,(void *)sector_start_addr,sector_size);
-
- // // overwrite sector data
- memcpy(sector_copy+(dest-sector_start_addr),src,FILESYSTEM_BLOCK_SIZE);
-
- // find end address, subtract for number of sectors
- // Shouldn't be required since blocks will always fit in a single sector, they should never overlap
- //EraseInitStruct.NbSectors = flash_get_sector_info(dest + FILESYSTEM_BLOCK_SIZE - 1, NULL, NULL) - EraseInitStruct.Sector + 1;
-
- // erase the sector
- uint32_t SectorError = 0;
- if (HAL_FLASHEx_Erase(&EraseInitStruct, &SectorError) != HAL_OK) {
- // error occurred during sector erase
- HAL_FLASH_Lock(); // lock the flash
- mp_printf(&mp_plat_print, "FLASH SECTOR ERASE ERROR");
- return false;
- }
-
- __HAL_FLASH_DATA_CACHE_DISABLE();
- __HAL_FLASH_INSTRUCTION_CACHE_DISABLE();
-
- __HAL_FLASH_DATA_CACHE_RESET();
- __HAL_FLASH_INSTRUCTION_CACHE_RESET();
-
- __HAL_FLASH_INSTRUCTION_CACHE_ENABLE();
- __HAL_FLASH_DATA_CACHE_ENABLE();
-
- // reprogram the sector
- for (uint32_t i = 0; i < sector_size; i++) {
- if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_BYTE, sector_start_addr, (uint64_t)sector_copy[i]) != HAL_OK) {
- // error occurred during flash write
- HAL_FLASH_Lock(); // lock the flash
- mp_printf(&mp_plat_print, "FLASH WRITE ERROR");
- return false;
- }
- sector_start_addr += 1;
- }
-
- // lock the flash
- HAL_FLASH_Lock();
-
- return true;
-}
-
-mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t block_num, uint32_t num_blocks) {
-
- for (size_t i = 0; i < num_blocks; i++) {
- if (!supervisor_flash_write_block(src + i * FILESYSTEM_BLOCK_SIZE, block_num + i)) {
- return 1; // error
- }
- }
- return 0; // success
-}
-
-void supervisor_flash_release_cache(void) {
-}
-
diff --git a/ports/unix/Makefile b/ports/unix/Makefile
index 7ffa0fd08..63c4980c3 100644
--- a/ports/unix/Makefile
+++ b/ports/unix/Makefile
@@ -277,6 +277,18 @@ coverage_test: coverage
coverage_clean:
$(MAKE) V=2 BUILD=build-coverage PROG=micropython_coverage clean
+# build an interpreter for fuzzing
+fuzz:
+ $(MAKE) \
+ CC=afl-clang-fast DEBUG=1 \
+ CFLAGS_EXTRA='$(CFLAGS_EXTRA) -ffunction-sections' \
+ LDFLAGS_EXTRA='$(LDFLAGS_EXTRA)' \
+ BUILD=build-fuzz PROG=micropython_fuzz
+
+fuzz_clean:
+ $(MAKE) V=2 BUILD=build-fuzz PROG=micropython_fuzz clean
+
+
# Value of configure's --host= option (required for cross-compilation).
# Deduce it from CROSS_COMPILE by default, but can be overridden.
ifneq ($(CROSS_COMPILE),)
diff --git a/ports/unix/mpconfigport.h b/ports/unix/mpconfigport.h
index e0f9d9995..3ac7ceaf2 100644
--- a/ports/unix/mpconfigport.h
+++ b/ports/unix/mpconfigport.h
@@ -323,3 +323,6 @@ void mp_unix_mark_exec(void);
// For debugging purposes, make printf() available to any source file.
#include <stdio.h>
#endif
+
+#define MICROPY_PY_BUILTINS_HELP (1)
+#define MICROPY_PY_BUILTINS_HELP_MODULES (1)
diff --git a/ports/unix/mpconfigport.mk b/ports/unix/mpconfigport.mk
index f0aa955c0..6bb1c9693 100644
--- a/ports/unix/mpconfigport.mk
+++ b/ports/unix/mpconfigport.mk
@@ -40,3 +40,5 @@ MICROPY_PY_JNI = 0
# Avoid using system libraries, use copies bundled with MicroPython
# as submodules (currently affects only libffi).
MICROPY_STANDALONE = 0
+
+CIRCUITPY_ULAB = 1
diff --git a/py/builtin.h b/py/builtin.h
index 84b99a8a4..6e0d5d9be 100644
--- a/py/builtin.h
+++ b/py/builtin.h
@@ -117,6 +117,13 @@ extern const mp_obj_module_t mp_module_websocket;
extern const mp_obj_module_t mp_module_webrepl;
extern const mp_obj_module_t mp_module_framebuf;
extern const mp_obj_module_t mp_module_btree;
+extern const mp_obj_module_t ulab_user_cmodule;
+extern mp_obj_module_t ulab_fft_module;
+extern mp_obj_module_t ulab_filter_module;
+extern mp_obj_module_t ulab_linalg_module;
+extern mp_obj_module_t ulab_numerical_module;
+extern mp_obj_module_t ulab_poly_module;
+
extern const char MICROPY_PY_BUILTINS_HELP_TEXT[];
diff --git a/py/builtinimport.c b/py/builtinimport.c
index 6ed0a7594..2be779c6c 100644
--- a/py/builtinimport.c
+++ b/py/builtinimport.c
@@ -400,21 +400,31 @@ mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) {
DEBUG_printf("Current path: %.*s\n", vstr_len(&path), vstr_str(&path));
if (stat == MP_IMPORT_STAT_NO_EXIST) {
- #if MICROPY_MODULE_WEAK_LINKS
- // check if there is a weak link to this module
- if (i == mod_len) {
- mp_map_elem_t *el = mp_map_lookup((mp_map_t*)&mp_builtin_module_weak_links_map, MP_OBJ_NEW_QSTR(mod_name), MP_MAP_LOOKUP);
+ // This is just the module name after the previous .
+ qstr current_module_name = qstr_from_strn(mod_str + last, i - last);
+ mp_map_elem_t *el = NULL;
+ if (outer_module_obj == MP_OBJ_NULL) {
+ el = mp_map_lookup((mp_map_t*)&mp_builtin_module_map,
+ MP_OBJ_NEW_QSTR(current_module_name),
+ MP_MAP_LOOKUP);
+ #if MICROPY_MODULE_WEAK_LINKS
+ // check if there is a weak link to this module
if (el == NULL) {
- goto no_exist;
+ el = mp_map_lookup((mp_map_t*)&mp_builtin_module_weak_links_map,
+ MP_OBJ_NEW_QSTR(current_module_name),
+ MP_MAP_LOOKUP);
}
- // found weak linked module
+ #endif
+ } else {
+ el = mp_map_lookup(&((mp_obj_module_t*) outer_module_obj)->globals->map,
+ MP_OBJ_NEW_QSTR(current_module_name),
+ MP_MAP_LOOKUP);
+ }
+
+ if (el != NULL && MP_OBJ_IS_TYPE(el->value, &mp_type_module)) {
module_obj = el->value;
mp_module_call_init(mod_name, module_obj);
} else {
- no_exist:
- #else
- {
- #endif
// couldn't find the file, so fail
if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
mp_raise_ImportError(translate("module not found"));
diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk
index 1f2d6c73e..b6b0cacaf 100644
--- a/py/circuitpy_defns.mk
+++ b/py/circuitpy_defns.mk
@@ -142,6 +142,9 @@ endif
ifeq ($(CIRCUITPY_DISPLAYIO),1)
SRC_PATTERNS += displayio/% terminalio/% fontio/%
endif
+ifeq ($(CIRCUITPY_FRAMEBUFFERIO),1)
+SRC_PATTERNS += framebufferio/%
+endif
ifeq ($(CIRCUITPY_FREQUENCYIO),1)
SRC_PATTERNS += frequencyio/%
endif
@@ -157,6 +160,9 @@ endif
ifeq ($(CIRCUITPY_MATH),1)
SRC_PATTERNS += math/%
endif
+ifeq ($(CIRCUITPY__EVE),1)
+SRC_PATTERNS += _eve/%
+endif
ifeq ($(CIRCUITPY_MICROCONTROLLER),1)
SRC_PATTERNS += microcontroller/%
endif
@@ -175,6 +181,9 @@ endif
ifeq ($(CIRCUITPY_PIXELBUF),1)
SRC_PATTERNS += _pixelbuf/%
endif
+ifeq ($(CIRCUITPY_PROTOMATTER),1)
+SRC_PATTERNS += _protomatter/%
+endif
ifeq ($(CIRCUITPY_PULSEIO),1)
SRC_PATTERNS += pulseio/%
endif
@@ -239,6 +248,8 @@ SRC_COMMON_HAL_ALL = \
_bleio/PacketBuffer.c \
_bleio/Service.c \
_bleio/UUID.c \
+ _protomatter/Protomatter.c \
+ _protomatter/__init__.c \
analogio/AnalogIn.c \
analogio/AnalogOut.c \
analogio/__init__.c \
@@ -298,6 +309,7 @@ $(filter $(SRC_PATTERNS), \
fontio/Glyph.c \
microcontroller/RunMode.c \
math/__init__.c \
+ _eve/__init__.c \
)
SRC_BINDINGS_ENUMS += \
@@ -311,6 +323,8 @@ SRC_SHARED_MODULE_ALL = \
_bleio/ScanResults.c \
_pixelbuf/PixelBuf.c \
_pixelbuf/__init__.c \
+ _protomatter/Protomatter.c \
+ _protomatter/__init__.c \
_stage/Layer.c \
_stage/Text.c \
_stage/__init__.c \
@@ -344,6 +358,8 @@ SRC_SHARED_MODULE_ALL = \
displayio/__init__.c \
fontio/BuiltinFont.c \
fontio/__init__.c \
+ framebufferio/FramebufferDisplay.c \
+ framebufferio/__init__.c \
gamepad/GamePad.c \
gamepad/__init__.c \
gamepadshift/GamePadShift.c \
@@ -359,7 +375,8 @@ SRC_SHARED_MODULE_ALL = \
uheap/__init__.c \
ustack/__init__.c \
_pew/__init__.c \
- _pew/PewPew.c
+ _pew/PewPew.c \
+ _eve/__init__.c
# All possible sources are listed here, and are filtered by SRC_PATTERNS.
SRC_SHARED_MODULE = $(filter $(SRC_PATTERNS), $(SRC_SHARED_MODULE_ALL))
@@ -396,6 +413,12 @@ SRC_MOD += $(addprefix lib/mp3/src/, \
)
$(BUILD)/lib/mp3/src/buffers.o: CFLAGS += -include "py/misc.h" -D'MPDEC_ALLOCATOR(x)=m_malloc(x,0)' -D'MPDEC_FREE(x)=m_free(x)'
endif
+ifeq ($(CIRCUITPY_PROTOMATTER),1)
+SRC_MOD += $(addprefix lib/protomatter/, \
+ core.c \
+)
+$(BUILD)/lib/protomatter/core.o: CFLAGS += -include "shared-module/_protomatter/allocator.h" -DCIRCUITPY -Wno-missing-braces
+endif
# All possible sources are listed here, and are filtered by SRC_PATTERNS.
SRC_SHARED_MODULE_INTERNAL = \
@@ -426,6 +449,19 @@ $(addprefix lib/,\
libm/atanf.c \
libm/atan2f.c \
)
+ifeq ($(CIRCUITPY_ULAB),1)
+SRC_LIBM += \
+$(addprefix lib/,\
+ libm/acoshf.c \
+ libm/asinhf.c \
+ libm/atanhf.c \
+ libm/erf_lgamma.c \
+ libm/log1pf.c \
+ libm/sf_erf.c \
+ libm/wf_lgamma.c \
+ libm/wf_tgamma.c \
+ )
+endif
endif
ifdef LD_TEMPLATE_FILE
diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h
index 5b705a088..06289258d 100644
--- a/py/circuitpy_mpconfig.h
+++ b/py/circuitpy_mpconfig.h
@@ -72,6 +72,7 @@
#define MICROPY_HELPER_REPL (1)
#define MICROPY_KBD_EXCEPTION (1)
#define MICROPY_MEM_STATS (0)
+#define MICROPY_MODULE_BUILTIN_INIT (1)
#define MICROPY_NONSTANDARD_TYPECODES (0)
#define MICROPY_OPT_COMPUTED_GOTO (1)
#define MICROPY_PERSISTENT_CODE_LOAD (1)
@@ -186,6 +187,9 @@ typedef long mp_off_t;
#if !defined(MICROPY_CPYTHON_COMPAT)
#define MICROPY_CPYTHON_COMPAT (CIRCUITPY_FULL_BUILD)
#endif
+#if !defined(MICROPY_COMP_FSTRING_LITERAL)
+#define MICROPY_COMP_FSTRING_LITERAL (MICROPY_CPYTHON_COMPAT)
+#endif
#define MICROPY_MODULE_WEAK_LINKS (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_ALL_SPECIAL_METHODS (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_BUILTINS_COMPLEX (CIRCUITPY_FULL_BUILD)
@@ -341,6 +345,13 @@ extern const struct _mp_obj_module_t terminalio_module;
#define CIRCUITPY_DISPLAY_LIMIT (0)
#endif
+#if CIRCUITPY_FRAMEBUFFERIO
+extern const struct _mp_obj_module_t framebufferio_module;
+#define FRAMEBUFFERIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_framebufferio), (mp_obj_t)&framebufferio_module },
+#else
+#define FRAMEBUFFERIO_MODULE
+#endif
+
#if CIRCUITPY_FREQUENCYIO
extern const struct _mp_obj_module_t frequencyio_module;
#define FREQUENCYIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_frequencyio), (mp_obj_t)&frequencyio_module },
@@ -384,6 +395,13 @@ extern const struct _mp_obj_module_t math_module;
#define MATH_MODULE
#endif
+#if CIRCUITPY__EVE
+extern const struct _mp_obj_module_t _eve_module;
+#define _EVE_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR__eve), (mp_obj_t)&_eve_module },
+#else
+#define _EVE_MODULE
+#endif
+
#if CIRCUITPY_MICROCONTROLLER
extern const struct _mp_obj_module_t microcontroller_module;
#define MICROCONTROLLER_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_microcontroller), (mp_obj_t)&microcontroller_module },
@@ -443,6 +461,13 @@ extern const struct _mp_obj_module_t pixelbuf_module;
#define PIXELBUF_MODULE
#endif
+#if CIRCUITPY_PROTOMATTER
+extern const struct _mp_obj_module_t protomatter_module;
+#define PROTOMATTER_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR__protomatter),(mp_obj_t)&protomatter_module },
+#else
+#define PROTOMATTER_MODULE
+#endif
+
#if CIRCUITPY_PULSEIO
extern const struct _mp_obj_module_t pulseio_module;
#define PULSEIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_pulseio), (mp_obj_t)&pulseio_module },
@@ -570,6 +595,12 @@ extern const struct _mp_obj_module_t ustack_module;
#define JSON_MODULE
#endif
+#if defined(CIRCUITPY_ULAB) && CIRCUITPY_ULAB
+#define ULAB_MODULE \
+ { MP_ROM_QSTR(MP_QSTR_ulab), MP_ROM_PTR(&ulab_user_cmodule) },
+#else
+#define ULAB_MODULE
+#endif
#if MICROPY_PY_URE
#define RE_MODULE { MP_ROM_QSTR(MP_QSTR_re), MP_ROM_PTR(&mp_module_ure) },
#else
@@ -611,12 +642,14 @@ extern const struct _mp_obj_module_t ustack_module;
FONTIO_MODULE \
TERMINALIO_MODULE \
ERRNO_MODULE \
+ FRAMEBUFFERIO_MODULE \
FREQUENCYIO_MODULE \
GAMEPAD_MODULE \
GAMEPADSHIFT_MODULE \
I2CSLAVE_MODULE \
JSON_MODULE \
MATH_MODULE \
+ _EVE_MODULE \
MICROCONTROLLER_MODULE \
NEOPIXEL_WRITE_MODULE \
NETWORK_MODULE \
@@ -625,6 +658,7 @@ extern const struct _mp_obj_module_t ustack_module;
PEW_MODULE \
PIXELBUF_MODULE \
PS2IO_MODULE \
+ PROTOMATTER_MODULE \
PULSEIO_MODULE \
RANDOM_MODULE \
RE_MODULE \
diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk
index 93175e136..ba94f9784 100644
--- a/py/circuitpy_mpconfig.mk
+++ b/py/circuitpy_mpconfig.mk
@@ -149,6 +149,11 @@ CIRCUITPY_DISPLAYIO = $(CIRCUITPY_FULL_BUILD)
endif
CFLAGS += -DCIRCUITPY_DISPLAYIO=$(CIRCUITPY_DISPLAYIO)
+ifndef CIRCUITPY_FRAMEBUFFERIO
+CIRCUITPY_FRAMEBUFFERIO = 0
+endif
+CFLAGS += -DCIRCUITPY_FRAMEBUFFERIO=$(CIRCUITPY_FRAMEBUFFERIO)
+
ifndef CIRCUITPY_FREQUENCYIO
CIRCUITPY_FREQUENCYIO = $(CIRCUITPY_FULL_BUILD)
endif
@@ -174,6 +179,11 @@ CIRCUITPY_MATH = $(CIRCUITPY_ALWAYS_BUILD)
endif
CFLAGS += -DCIRCUITPY_MATH=$(CIRCUITPY_MATH)
+ifndef CIRCUITPY__EVE
+CIRCUITPY__EVE = 0
+endif
+CFLAGS += -DCIRCUITPY__EVE=$(CIRCUITPY__EVE)
+
ifndef CIRCUITPY_MICROCONTROLLER
CIRCUITPY_MICROCONTROLLER = $(CIRCUITPY_DEFAULT_BUILD)
endif
@@ -205,6 +215,12 @@ CIRCUITPY_PIXELBUF = $(CIRCUITPY_FULL_BUILD)
endif
CFLAGS += -DCIRCUITPY_PIXELBUF=$(CIRCUITPY_PIXELBUF)
+# Only for SAMD boards for the moment
+ifndef CIRCUITPY_PROTOMATTER
+CIRCUITPY_PROTOMATTER = 0
+endif
+CFLAGS += -DCIRCUITPY_PROTOMATTER=$(CIRCUITPY_PROTOMATTER)
+
ifndef CIRCUITPY_PULSEIO
CIRCUITPY_PULSEIO = $(CIRCUITPY_DEFAULT_BUILD)
endif
@@ -323,12 +339,22 @@ CIRCUITPY_SERIAL_BLE = 0
endif
CFLAGS += -DCIRCUITPY_SERIAL_BLE=$(CIRCUITPY_SERIAL_BLE)
+ifndef CIRCUITPY_BLE_FILE_SERVICE
+CIRCUITPY_BLE_FILE_SERVICE = 0
+endif
+CFLAGS += -DCIRCUITPY_BLE_FILE_SERVICE=$(CIRCUITPY_BLE_FILE_SERVICE)
+
# REPL over UART
ifndef CIRCUITPY_SERIAL_UART
CIRCUITPY_SERIAL_UART = 0
endif
CFLAGS += -DCIRCUITPY_SERIAL_UART=$(CIRCUITPY_SERIAL_UART)
+# ulab numerics library
+ifndef CIRCUITPY_ULAB
+CIRCUITPY_ULAB = $(CIRCUITPY_FULL_BUILD)
+endif
+
# Enabled micropython.native decorator (experimental)
ifndef CIRCUITPY_ENABLE_MPY_NATIVE
CIRCUITPY_ENABLE_MPY_NATIVE = 0
diff --git a/py/compile.c b/py/compile.c
index 77715d3fe..d5fae0299 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -1711,6 +1711,16 @@ STATIC void compile_yield_from(compiler_t *comp) {
}
#if MICROPY_PY_ASYNC_AWAIT
+STATIC bool compile_require_async_context(compiler_t *comp, mp_parse_node_struct_t *pns) {
+ int scope_flags = comp->scope_cur->scope_flags;
+ if(scope_flags & MP_SCOPE_FLAG_GENERATOR) {
+ return true;
+ }
+ compile_syntax_error(comp, (mp_parse_node_t)pns,
+ translate("'async for' or 'async with' outside async function"));
+ return false;
+}
+
STATIC void compile_await_object_method(compiler_t *comp, qstr method) {
EMIT_ARG(load_method, method, false);
EMIT_ARG(call_method, 0, 0, 0);
@@ -1720,6 +1730,10 @@ STATIC void compile_await_object_method(compiler_t *comp, qstr method) {
STATIC void compile_async_for_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
// comp->break_label |= MP_EMIT_BREAK_FROM_FOR;
+ if(!compile_require_async_context(comp, pns)) {
+ return;
+ }
+
qstr context = MP_PARSE_NODE_LEAF_ARG(pns->nodes[1]);
uint while_else_label = comp_next_label(comp);
uint try_exception_label = comp_next_label(comp);
@@ -1857,6 +1871,9 @@ STATIC void compile_async_with_stmt_helper(compiler_t *comp, int n, mp_parse_nod
}
STATIC void compile_async_with_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+ if(!compile_require_async_context(comp, pns)) {
+ return;
+ }
// get the nodes for the pre-bit of the with (the a as b, c as d, ... bit)
mp_parse_node_t *nodes;
int n = mp_parse_node_extract_list(&pns->nodes[0], PN_with_stmt_list, &nodes);
diff --git a/py/gc.c b/py/gc.c
index fef67f61b..271bc9462 100755
--- a/py/gc.c
+++ b/py/gc.c
@@ -150,9 +150,13 @@ void gc_init(void *start, void *end) {
#endif
// Set first free ATB index to the start of the heap.
- MP_STATE_MEM(gc_first_free_atb_index) = 0;
+ for (size_t i = 0; i < MICROPY_ATB_INDICES; i++) {
+ MP_STATE_MEM(gc_first_free_atb_index)[i] = 0;
+ }
+
// Set last free ATB index to the end of the heap.
MP_STATE_MEM(gc_last_free_atb_index) = MP_STATE_MEM(gc_alloc_table_byte_len) - 1;
+
// Set the lowest long lived ptr to the end of the heap to start. This will be lowered as long
// lived objects are allocated.
MP_STATE_MEM(gc_lowest_long_lived_ptr) = (void*) PTR_FROM_BLOCK(MP_STATE_MEM(gc_alloc_table_byte_len * BLOCKS_PER_ATB));
@@ -387,7 +391,9 @@ void gc_collect_root(void **ptrs, size_t len) {
void gc_collect_end(void) {
gc_deal_with_stack_overflow();
gc_sweep();
- MP_STATE_MEM(gc_first_free_atb_index) = 0;
+ for (size_t i = 0; i < MICROPY_ATB_INDICES; i++) {
+ MP_STATE_MEM(gc_first_free_atb_index)[i] = 0;
+ }
MP_STATE_MEM(gc_last_free_atb_index) = MP_STATE_MEM(gc_alloc_table_byte_len) - 1;
MP_STATE_MEM(gc_lock_depth)--;
GC_EXIT();
@@ -513,14 +519,16 @@ void *gc_alloc(size_t n_bytes, bool has_finaliser, bool long_lived) {
size_t crossover_block = BLOCK_FROM_PTR(MP_STATE_MEM(gc_lowest_long_lived_ptr));
while (keep_looking) {
int8_t direction = 1;
- size_t start = MP_STATE_MEM(gc_first_free_atb_index);
+ size_t bucket = MIN(n_blocks, MICROPY_ATB_INDICES) - 1;
+ size_t first_free = MP_STATE_MEM(gc_first_free_atb_index)[bucket];
+ size_t start = first_free;
if (long_lived) {
direction = -1;
start = MP_STATE_MEM(gc_last_free_atb_index);
}
n_free = 0;
// look for a run of n_blocks available blocks
- for (size_t i = start; keep_looking && MP_STATE_MEM(gc_first_free_atb_index) <= i && i <= MP_STATE_MEM(gc_last_free_atb_index); i += direction) {
+ for (size_t i = start; keep_looking && first_free <= i && i <= MP_STATE_MEM(gc_last_free_atb_index); i += direction) {
byte a = MP_STATE_MEM(gc_alloc_table_start)[i];
// Four ATB states are packed into a single byte.
int j = 0;
@@ -565,22 +573,24 @@ void *gc_alloc(size_t n_bytes, bool has_finaliser, bool long_lived) {
// Found free space ending at found_block inclusive.
// Also, set last free ATB index to block after last block we found, for start of
- // next scan. To reduce fragmentation, we only do this if we were looking
- // for a single free block, which guarantees that there are no free blocks
- // before this one. Also, whenever we free or shrink a block we must check
- // if this index needs adjusting (see gc_realloc and gc_free).
+ // next scan. Also, whenever we free or shrink a block we must check if this index needs
+ // adjusting (see gc_realloc and gc_free).
if (!long_lived) {
end_block = found_block;
start_block = found_block - n_free + 1;
- if (n_blocks == 1) {
- MP_STATE_MEM(gc_first_free_atb_index) = (found_block + 1) / BLOCKS_PER_ATB;
+ if (n_blocks < MICROPY_ATB_INDICES) {
+ size_t next_free_atb = (found_block + n_blocks) / BLOCKS_PER_ATB;
+ // Update all atb indices for larger blocks too.
+ for (size_t i = n_blocks - 1; i < MICROPY_ATB_INDICES; i++) {
+ MP_STATE_MEM(gc_first_free_atb_index)[i] = next_free_atb;
+ }
}
} else {
start_block = found_block;
end_block = found_block + n_free - 1;
- if (n_blocks == 1) {
- MP_STATE_MEM(gc_last_free_atb_index) = (found_block - 1) / BLOCKS_PER_ATB;
- }
+ // Always update the bounds of the long lived area because we assume it is contiguous. (It
+ // can still be reset by a sweep.)
+ MP_STATE_MEM(gc_last_free_atb_index) = (found_block - 1) / BLOCKS_PER_ATB;
}
#ifdef LOG_HEAP_ACTIVITY
@@ -676,30 +686,37 @@ void gc_free(void *ptr) {
}
// get the GC block number corresponding to this pointer
assert(VERIFY_PTR(ptr));
- size_t block = BLOCK_FROM_PTR(ptr);
- assert(ATB_GET_KIND(block) == AT_HEAD);
+ size_t start_block = BLOCK_FROM_PTR(ptr);
+ assert(ATB_GET_KIND(start_block) == AT_HEAD);
#if MICROPY_ENABLE_FINALISER
- FTB_CLEAR(block);
+ FTB_CLEAR(start_block);
#endif
- // set the last_free pointer to this block if it's earlier in the heap
- if (block / BLOCKS_PER_ATB < MP_STATE_MEM(gc_first_free_atb_index)) {
- MP_STATE_MEM(gc_first_free_atb_index) = block / BLOCKS_PER_ATB;
- }
- if (block / BLOCKS_PER_ATB > MP_STATE_MEM(gc_last_free_atb_index)) {
- MP_STATE_MEM(gc_last_free_atb_index) = block / BLOCKS_PER_ATB;
- }
-
// free head and all of its tail blocks
- #ifdef LOG_HEAP_ACTIVITY
- gc_log_change(block, 0);
- #endif
+ #ifdef LOG_HEAP_ACTIVITY
+ gc_log_change(start_block, 0);
+ #endif
+ size_t block = start_block;
do {
ATB_ANY_TO_FREE(block);
block += 1;
} while (ATB_GET_KIND(block) == AT_TAIL);
+ // Update the first free pointer for our size only. Not much calls gc_free directly so there
+ // is decent chance we'll want to allocate this size again. By only updating the specific
+ // size we don't risk something smaller fitting in.
+ size_t n_blocks = block - start_block;
+ size_t bucket = MIN(n_blocks, MICROPY_ATB_INDICES) - 1;
+ size_t new_free_atb = start_block / BLOCKS_PER_ATB;
+ if (new_free_atb < MP_STATE_MEM(gc_first_free_atb_index)[bucket]) {
+ MP_STATE_MEM(gc_first_free_atb_index)[bucket] = new_free_atb;
+ }
+ // set the last_free pointer to this block if it's earlier in the heap
+ if (new_free_atb > MP_STATE_MEM(gc_last_free_atb_index)) {
+ MP_STATE_MEM(gc_last_free_atb_index) = new_free_atb;
+ }
+
GC_EXIT();
#if EXTENSIVE_HEAP_PROFILING
@@ -870,11 +887,13 @@ void *gc_realloc(void *ptr_in, size_t n_bytes, bool allow_move) {
}
// set the last_free pointer to end of this block if it's earlier in the heap
- if ((block + new_blocks) / BLOCKS_PER_ATB < MP_STATE_MEM(gc_first_free_atb_index)) {
- MP_STATE_MEM(gc_first_free_atb_index) = (block + new_blocks) / BLOCKS_PER_ATB;
+ size_t new_free_atb = (block + new_blocks) / BLOCKS_PER_ATB;
+ size_t bucket = MIN(n_blocks - new_blocks, MICROPY_ATB_INDICES) - 1;
+ if (new_free_atb < MP_STATE_MEM(gc_first_free_atb_index)[bucket]) {
+ MP_STATE_MEM(gc_first_free_atb_index)[bucket] = new_free_atb;
}
- if ((block + new_blocks) / BLOCKS_PER_ATB > MP_STATE_MEM(gc_last_free_atb_index)) {
- MP_STATE_MEM(gc_last_free_atb_index) = (block + new_blocks) / BLOCKS_PER_ATB;
+ if (new_free_atb > MP_STATE_MEM(gc_last_free_atb_index)) {
+ MP_STATE_MEM(gc_last_free_atb_index) = new_free_atb;
}
GC_EXIT();
diff --git a/py/gc_long_lived.c b/py/gc_long_lived.c
index 01c22a7af..0e94390e9 100755
--- a/py/gc_long_lived.c
+++ b/py/gc_long_lived.c
@@ -89,7 +89,7 @@ mp_obj_dict_t *make_dict_long_lived(mp_obj_dict_t *dict, uint8_t max_depth) {
#ifndef MICROPY_ENABLE_GC
return dict;
#endif
- if (dict == NULL || max_depth == 0 || dict == &MP_STATE_VM(dict_main)) {
+ if (dict == NULL || max_depth == 0 || dict == &MP_STATE_VM(dict_main) || dict->map.is_fixed) {
return dict;
}
// Don't recurse unnecessarily. Return immediately if we've already seen this dict.
diff --git a/py/lexer.c b/py/lexer.c
index 755fa625b..00cd59bca 100644
--- a/py/lexer.c
+++ b/py/lexer.c
@@ -64,6 +64,12 @@ STATIC bool is_char_or3(mp_lexer_t *lex, byte c1, byte c2, byte c3) {
return lex->chr0 == c1 || lex->chr0 == c2 || lex->chr0 == c3;
}
+#if MICROPY_COMP_FSTRING_LITERAL
+STATIC bool is_char_or4(mp_lexer_t *lex, byte c1, byte c2, byte c3, byte c4) {
+ return lex->chr0 == c1 || lex->chr0 == c2 || lex->chr0 == c3 || lex->chr0 == c4;
+}
+#endif
+
STATIC bool is_char_following(mp_lexer_t *lex, byte c) {
return lex->chr1 == c;
}
@@ -107,7 +113,13 @@ STATIC bool is_following_odigit(mp_lexer_t *lex) {
STATIC bool is_string_or_bytes(mp_lexer_t *lex) {
return is_char_or(lex, '\'', '\"')
+#if MICROPY_COMP_FSTRING_LITERAL
+ || (is_char_or4(lex, 'r', 'u', 'b', 'f') && is_char_following_or(lex, '\'', '\"'))
+ || ((is_char_and(lex, 'r', 'f') || is_char_and(lex, 'f', 'r'))
+ && is_char_following_following_or(lex, '\'', '\"'))
+#else
|| (is_char_or3(lex, 'r', 'u', 'b') && is_char_following_or(lex, '\'', '\"'))
+#endif
|| ((is_char_and(lex, 'r', 'b') || is_char_and(lex, 'b', 'r'))
&& is_char_following_following_or(lex, '\'', '\"'));
}
@@ -121,6 +133,31 @@ STATIC bool is_tail_of_identifier(mp_lexer_t *lex) {
return is_head_of_identifier(lex) || is_digit(lex);
}
+#if MICROPY_COMP_FSTRING_LITERAL
+STATIC void swap_char_banks(mp_lexer_t *lex) {
+ if (lex->vstr_postfix_processing) {
+ lex->chr3 = lex->chr0;
+ lex->chr4 = lex->chr1;
+ lex->chr5 = lex->chr2;
+ lex->chr0 = lex->vstr_postfix.buf[0];
+ lex->chr1 = lex->vstr_postfix.buf[1];
+ lex->chr2 = lex->vstr_postfix.buf[2];
+
+ lex->vstr_postfix_idx = 3;
+ } else {
+ // blindly reset to the "backup" bank when done postfix processing
+ // this restores control to the mp_reader
+ lex->chr0 = lex->chr3;
+ lex->chr1 = lex->chr4;
+ lex->chr2 = lex->chr5;
+ // willfully ignoring setting chr3-5 here - WARNING consider those garbage data now
+
+ vstr_reset(&lex->vstr_postfix);
+ lex->vstr_postfix_idx = 0;
+ }
+}
+#endif
+
STATIC void next_char(mp_lexer_t *lex) {
if (lex->chr0 == '\n') {
// a new line
@@ -136,7 +173,19 @@ STATIC void next_char(mp_lexer_t *lex) {
lex->chr0 = lex->chr1;
lex->chr1 = lex->chr2;
- lex->chr2 = lex->reader.readbyte(lex->reader.data);
+
+#if MICROPY_COMP_FSTRING_LITERAL
+ if (lex->vstr_postfix_processing) {
+ if (lex->vstr_postfix_idx == lex->vstr_postfix.len) {
+ lex->chr2 = '\0';
+ } else {
+ lex->chr2 = lex->vstr_postfix.buf[lex->vstr_postfix_idx++];
+ }
+ } else
+#endif
+ {
+ lex->chr2 = lex->reader.readbyte(lex->reader.data);
+ }
if (lex->chr1 == '\r') {
// CR is a new line, converted to LF
@@ -151,6 +200,13 @@ STATIC void next_char(mp_lexer_t *lex) {
if (lex->chr2 == MP_LEXER_EOF && lex->chr1 != MP_LEXER_EOF && lex->chr1 != '\n') {
lex->chr2 = '\n';
}
+
+#if MICROPY_COMP_FSTRING_LITERAL
+ if (lex->vstr_postfix_processing && lex->chr0 == '\0') {
+ lex->vstr_postfix_processing = false;
+ swap_char_banks(lex);
+ }
+#endif
}
STATIC void indent_push(mp_lexer_t *lex, size_t indent) {
@@ -270,7 +326,7 @@ STATIC bool get_hex(mp_lexer_t *lex, size_t num_digits, mp_uint_t *result) {
return true;
}
-STATIC void parse_string_literal(mp_lexer_t *lex, bool is_raw) {
+STATIC void parse_string_literal(mp_lexer_t *lex, bool is_raw, bool is_fstring) {
// get first quoting character
char quote_char = '\'';
if (is_char(lex, '\"')) {
@@ -291,15 +347,71 @@ STATIC void parse_string_literal(mp_lexer_t *lex, bool is_raw) {
}
size_t n_closing = 0;
+#if MICROPY_COMP_FSTRING_LITERAL
+ bool in_expression = false;
+ bool expression_eat = true;
+#endif
+
while (!is_end(lex) && (num_quotes > 1 || !is_char(lex, '\n')) && n_closing < num_quotes) {
if (is_char(lex, quote_char)) {
n_closing += 1;
vstr_add_char(&lex->vstr, CUR_CHAR(lex));
} else {
n_closing = 0;
+#if MICROPY_COMP_FSTRING_LITERAL
+ if (is_fstring && is_char(lex, '{')) {
+ vstr_add_char(&lex->vstr, CUR_CHAR(lex));
+ in_expression = !in_expression;
+ expression_eat = in_expression;
+
+ if (lex->vstr_postfix.len == 0) {
+ vstr_add_str(&lex->vstr_postfix, ".format(");
+ }
+
+ next_char(lex);
+ continue;
+ }
+
+ if (is_fstring && is_char(lex, '}')) {
+ vstr_add_char(&lex->vstr, CUR_CHAR(lex));
+
+ if (in_expression) {
+ in_expression = false;
+ vstr_add_char(&lex->vstr_postfix, ',');
+ }
+
+ next_char(lex);
+ continue;
+ }
+
+ if (in_expression) {
+ // throw errors for illegal chars inside f-string expressions
+ if (is_char(lex, '#')) {
+ lex->tok_kind = MP_TOKEN_FSTRING_COMMENT;
+ return;
+ } else if (is_char(lex, '\\')) {
+ lex->tok_kind = MP_TOKEN_FSTRING_BACKSLASH;
+ return;
+ } else if (is_char(lex, ':')) {
+ expression_eat = false;
+ }
+
+ unichar c = CUR_CHAR(lex);
+ if (expression_eat) {
+ vstr_add_char(&lex->vstr_postfix, c);
+ } else {
+ vstr_add_char(&lex->vstr, c);
+ }
+
+ next_char(lex);
+ continue;
+ }
+#endif
+
if (is_char(lex, '\\')) {
next_char(lex);
unichar c = CUR_CHAR(lex);
+
if (is_raw) {
// raw strings allow escaping of quotes, but the backslash is also emitted
vstr_add_char(&lex->vstr, '\\');
@@ -430,6 +542,15 @@ STATIC bool skip_whitespace(mp_lexer_t *lex, bool stop_at_newline) {
}
void mp_lexer_to_next(mp_lexer_t *lex) {
+#if MICROPY_COMP_FSTRING_LITERAL
+ if (lex->vstr_postfix.len && !lex->vstr_postfix_processing) {
+ // end format call injection
+ vstr_add_char(&lex->vstr_postfix, ')');
+ lex->vstr_postfix_processing = true;
+ swap_char_banks(lex);
+ }
+#endif
+
// start new token text
vstr_reset(&lex->vstr);
@@ -481,10 +602,19 @@ void mp_lexer_to_next(mp_lexer_t *lex) {
// MP_TOKEN_END is used to indicate that this is the first string token
lex->tok_kind = MP_TOKEN_END;
+#if MICROPY_COMP_FSTRING_LITERAL
+ bool saw_normal = false, saw_fstring = false;
+#endif
+
// Loop to accumulate string/bytes literals
do {
// parse type codes
bool is_raw = false;
+#if MICROPY_COMP_FSTRING_LITERAL
+ bool is_fstring = false;
+#else
+ const bool is_fstring = false;
+#endif
mp_token_kind_t kind = MP_TOKEN_STRING;
int n_char = 0;
if (is_char(lex, 'u')) {
@@ -503,7 +633,33 @@ void mp_lexer_to_next(mp_lexer_t *lex) {
kind = MP_TOKEN_BYTES;
n_char = 2;
}
+#if MICROPY_COMP_FSTRING_LITERAL
+ if (is_char_following(lex, 'f')) {
+ lex->tok_kind = MP_TOKEN_FSTRING_RAW;
+ break;
+ }
+ } else if (is_char(lex, 'f')) {
+ if (is_char_following(lex, 'r')) {
+ lex->tok_kind = MP_TOKEN_FSTRING_RAW;
+ break;
+ }
+ n_char = 1;
+ is_fstring = true;
+#endif
+ }
+
+#if MICROPY_COMP_FSTRING_LITERAL
+ if (is_fstring) {
+ saw_fstring = true;
+ } else {
+ saw_normal = true;
+ }
+
+ if (saw_fstring && saw_normal) {
+ // Can't concatenate f-string with normal string
+ break;
}
+#endif
// Set or check token kind
if (lex->tok_kind == MP_TOKEN_END) {
@@ -522,13 +678,12 @@ void mp_lexer_to_next(mp_lexer_t *lex) {
}
// Parse the literal
- parse_string_literal(lex, is_raw);
+ parse_string_literal(lex, is_raw, is_fstring);
// Skip whitespace so we can check if there's another string following
skip_whitespace(lex, true);
} while (is_string_or_bytes(lex));
-
} else if (is_head_of_identifier(lex)) {
lex->tok_kind = MP_TOKEN_NAME;
@@ -682,6 +837,9 @@ mp_lexer_t *mp_lexer_new(qstr src_name, mp_reader_t reader) {
lex->num_indent_level = 1;
lex->indent_level = m_new(uint16_t, lex->alloc_indent_level);
vstr_init(&lex->vstr, 32);
+#if MICROPY_COMP_FSTRING_LITERAL
+ vstr_init(&lex->vstr_postfix, 0);
+#endif
// store sentinel for first indentation level
lex->indent_level[0] = 0;
diff --git a/py/lexer.h b/py/lexer.h
index a29709107..a3eaa2a7e 100644
--- a/py/lexer.h
+++ b/py/lexer.h
@@ -44,6 +44,14 @@ typedef enum _mp_token_kind_t {
MP_TOKEN_INVALID,
MP_TOKEN_DEDENT_MISMATCH,
MP_TOKEN_LONELY_STRING_OPEN,
+#if MICROPY_COMP_FSTRING_LITERAL
+ MP_TOKEN_FSTRING_BACKSLASH,
+ MP_TOKEN_FSTRING_COMMENT,
+ MP_TOKEN_FSTRING_UNCLOSED,
+ MP_TOKEN_FSTRING_UNOPENED,
+ MP_TOKEN_FSTRING_EMPTY_EXP,
+ MP_TOKEN_FSTRING_RAW,
+#endif
MP_TOKEN_NEWLINE,
MP_TOKEN_INDENT,
@@ -150,6 +158,9 @@ typedef struct _mp_lexer_t {
mp_reader_t reader; // stream source
unichar chr0, chr1, chr2; // current cached characters from source
+#if MICROPY_COMP_FSTRING_LITERAL
+ unichar chr3, chr4, chr5; // current cached characters from alt source
+#endif
size_t line; // current source line
size_t column; // current source column
@@ -165,6 +176,11 @@ typedef struct _mp_lexer_t {
size_t tok_column; // token source column
mp_token_kind_t tok_kind; // token kind
vstr_t vstr; // token data
+#if MICROPY_COMP_FSTRING_LITERAL
+ vstr_t vstr_postfix; // postfix to apply to string
+ bool vstr_postfix_processing;
+ uint16_t vstr_postfix_idx;
+#endif
} mp_lexer_t;
mp_lexer_t *mp_lexer_new(qstr src_name, mp_reader_t reader);
diff --git a/py/mkrules.mk b/py/mkrules.mk
index 292d25746..13a73b90e 100644
--- a/py/mkrules.mk
+++ b/py/mkrules.mk
@@ -145,7 +145,7 @@ $(PROG): $(OBJ)
# Do not pass COPT here - it's *C* compiler optimizations. For example,
# we may want to compile using Thumb, but link with non-Thumb libc.
$(Q)$(CC) -o $@ $^ $(LIB) $(LDFLAGS)
-ifndef DEBUG
+ifdef STRIP_CIRCUITPYTHON
$(Q)$(STRIP) $(STRIPFLAGS_EXTRA) $(PROG)
endif
$(Q)$(SIZE) $$(find $(BUILD) -path "$(BUILD)/build/frozen*.o") $(PROG)
diff --git a/py/mpconfig.h b/py/mpconfig.h
index a0d211bfa..513f04f6e 100755
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -244,6 +244,14 @@
#define alloca(x) m_malloc(x)
#endif
+// Number of atb indices to cache. Allocations of fewer blocks will be faster
+// because the search will be accelerated by the index cache. This only applies
+// to short lived allocations because we assume the long lived allocations are
+// contiguous.
+#ifndef MICROPY_ATB_INDICES
+#define MICROPY_ATB_INDICES (8)
+#endif
+
/*****************************************************************************/
/* MicroPython emitters */
@@ -369,6 +377,11 @@
#define MICROPY_COMP_RETURN_IF_EXPR (0)
#endif
+// Whether to include parsing of f-string literals
+#ifndef MICROPY_COMP_FSTRING_LITERAL
+#define MICROPY_COMP_FSTRING_LITERAL (1)
+#endif
+
/*****************************************************************************/
/* Internal debugging stuff */
@@ -1165,6 +1178,10 @@ typedef double mp_float_t;
#define MICROPY_PY_UJSON (0)
#endif
+#ifndef CIRCUITPY_ULAB
+#define CIRCUITPY_ULAB (0)
+#endif
+
#ifndef MICROPY_PY_URE
#define MICROPY_PY_URE (0)
#endif
diff --git a/py/mpstate.h b/py/mpstate.h
index a3d7e5dcc..a5815776a 100644
--- a/py/mpstate.h
+++ b/py/mpstate.h
@@ -92,7 +92,7 @@ typedef struct _mp_state_mem_t {
size_t gc_alloc_threshold;
#endif
- size_t gc_first_free_atb_index;
+ size_t gc_first_free_atb_index[MICROPY_ATB_INDICES];
size_t gc_last_free_atb_index;
#if MICROPY_PY_GC_COLLECT_RETVAL
diff --git a/py/obj.h b/py/obj.h
index cf4216d02..fa315d12f 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -858,6 +858,7 @@ typedef struct {
mp_uint_t stop;
mp_int_t step;
} mp_bound_slice_t;
+void mp_obj_slice_indices(mp_obj_t self_in, mp_int_t length, mp_bound_slice_t *result);
// Compute the new length of a sequence and ensure an exception is thrown on overflow.
size_t mp_seq_multiply_len(size_t item_sz, size_t len);
diff --git a/py/objint.c b/py/objint.c
index 9e11871f1..b78c9f25b 100644
--- a/py/objint.c
+++ b/py/objint.c
@@ -490,15 +490,24 @@ STATIC mp_obj_t int_from_bytes(size_t n_args, const mp_obj_t *args) {
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(int_from_bytes_fun_obj, 3, 4, int_from_bytes);
STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(int_from_bytes_obj, MP_ROM_PTR(&int_from_bytes_fun_obj));
-STATIC mp_obj_t int_to_bytes(size_t n_args, const mp_obj_t *args) {
- // TODO: Support signed param (assumes signed=False)
- (void)n_args;
-
- mp_int_t len = mp_obj_get_int(args[1]);
+STATIC mp_obj_t int_to_bytes(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+ enum { ARG_length, ARG_byteorder, ARG_signed };
+ static const mp_arg_t allowed_args[] = {
+ { MP_QSTR_length, MP_ARG_REQUIRED | MP_ARG_INT },
+ { MP_QSTR_byteorder, MP_ARG_REQUIRED | MP_ARG_OBJ },
+ { MP_QSTR_signed, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
+ };
+ mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
+ mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
+
+ mp_int_t len = args[ARG_length].u_int;
if (len < 0) {
mp_raise_ValueError(NULL);
}
- bool big_endian = args[2] != MP_OBJ_NEW_QSTR(MP_QSTR_little);
+
+ mp_obj_t self = pos_args[0];
+ bool big_endian = args[ARG_byteorder].u_obj != MP_OBJ_NEW_QSTR(MP_QSTR_little);
+ bool signed_ = args[ARG_signed].u_bool;
vstr_t vstr;
vstr_init_len(&vstr, len);
@@ -506,22 +515,26 @@ STATIC mp_obj_t int_to_bytes(size_t n_args, const mp_obj_t *args) {
memset(data, 0, len);
#if MICROPY_LONGINT_IMPL != MICROPY_LONGINT_IMPL_NONE
- if (!MP_OBJ_IS_SMALL_INT(args[0])) {
- mp_obj_int_buffer_overflow_check(args[0], len, false);
- mp_obj_int_to_bytes_impl(args[0], big_endian, len, data);
+ if (!MP_OBJ_IS_SMALL_INT(self)) {
+ mp_obj_int_buffer_overflow_check(self, len, signed_);
+ mp_obj_int_to_bytes_impl(self, big_endian, len, data);
} else
#endif
{
- mp_int_t val = MP_OBJ_SMALL_INT_VALUE(args[0]);
+ mp_int_t val = MP_OBJ_SMALL_INT_VALUE(self);
// Small int checking is separate, to be fast.
- mp_small_int_buffer_overflow_check(val, len, false);
+ mp_small_int_buffer_overflow_check(val, len, signed_);
size_t l = MIN((size_t)len, sizeof(val));
+ if (val < 0) {
+ // Sign extend negative numbers.
+ memset(data, -1, len);
+ }
mp_binary_set_int(l, big_endian, data + (big_endian ? (len - l) : 0), val);
}
return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(int_to_bytes_obj, 3, 4, int_to_bytes);
+STATIC MP_DEFINE_CONST_FUN_OBJ_KW(int_to_bytes_obj, 3, int_to_bytes);
STATIC const mp_rom_map_elem_t int_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_from_bytes), MP_ROM_PTR(&int_from_bytes_obj) },
diff --git a/py/objmodule.c b/py/objmodule.c
index 627ba79e8..b6a8a084e 100644
--- a/py/objmodule.c
+++ b/py/objmodule.c
@@ -69,6 +69,13 @@ STATIC void module_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
// delete/store attribute
mp_obj_dict_t *dict = self->globals;
if (dict->map.is_fixed) {
+ mp_map_elem_t *elem = mp_map_lookup(&dict->map, MP_OBJ_NEW_QSTR(attr), MP_MAP_LOOKUP);
+ // Return success if the given value is already in the dictionary. This is the case for
+ // native packages with native submodules.
+ if (elem != NULL && elem->value == dest[1]) {
+ dest[0] = MP_OBJ_NULL; // indicate success
+ return;
+ } else
#if MICROPY_CAN_OVERRIDE_BUILTINS
if (dict == &mp_module_builtins_globals) {
if (MP_STATE_VM(mp_module_builtins_override_dict) == NULL) {
@@ -206,6 +213,14 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = {
{ MP_ROM_QSTR(MP_QSTR_ujson), MP_ROM_PTR(&mp_module_ujson) },
#endif
#endif
+#if CIRCUITPY_ULAB
+#if CIRCUITPY
+// CircuitPython: Defined in MICROPY_PORT_BUILTIN_MODULES, so not defined here.
+// TODO: move to shared-bindings/
+#else
+ { MP_ROM_QSTR(MP_QSTR_ulab), MP_ROM_PTR(&ulab_user_cmodule) },
+#endif
+#endif
#if MICROPY_PY_URE
#if CIRCUITPY
// CircuitPython: Defined in MICROPY_PORT_BUILTIN_MODULES, so not defined here.
diff --git a/py/objslice.c b/py/objslice.c
index 5a15be55a..cbbee326e 100644
--- a/py/objslice.c
+++ b/py/objslice.c
@@ -152,6 +152,71 @@ mp_obj_t mp_obj_new_slice(mp_obj_t ostart, mp_obj_t ostop, mp_obj_t ostep) {
return MP_OBJ_FROM_PTR(o);
}
+// Return the real index and step values for a slice when applied to a sequence of
+// the given length, resolving missing components, negative values and values off
+// the end of the sequence.
+void mp_obj_slice_indices(mp_obj_t self_in, mp_int_t length, mp_bound_slice_t *result) {
+ mp_obj_slice_t *self = MP_OBJ_TO_PTR(self_in);
+ mp_int_t start, stop, step;
+
+ if (self->step == mp_const_none) {
+ step = 1;
+ } else {
+ step = mp_obj_get_int(self->step);
+ if (step == 0) {
+ mp_raise_ValueError(translate("slice step cannot be zero"));
+ }
+ }
+
+ if (step > 0) {
+ // Positive step
+ if (self->start == mp_const_none) {
+ start = 0;
+ } else {
+ start = mp_obj_get_int(self->start);
+ if (start < 0) {
+ start += length;
+ }
+ start = MIN(length, MAX(start, 0));
+ }
+
+ if (self->stop == mp_const_none) {
+ stop = length;
+ } else {
+ stop = mp_obj_get_int(self->stop);
+ if (stop < 0) {
+ stop += length;
+ }
+ stop = MIN(length, MAX(stop, 0));
+ }
+ } else {
+ // Negative step
+ if (self->start == mp_const_none) {
+ start = length - 1;
+ } else {
+ start = mp_obj_get_int(self->start);
+ if (start < 0) {
+ start += length;
+ }
+ start = MIN(length - 1, MAX(start, -1));
+ }
+
+ if (self->stop == mp_const_none) {
+ stop = -1;
+ } else {
+ stop = mp_obj_get_int(self->stop);
+ if (stop < 0) {
+ stop += length;
+ }
+ stop = MIN(length - 1, MAX(stop, -1));
+ }
+ }
+
+ result->start = start;
+ result->stop = stop;
+ result->step = step;
+}
+
#if MICROPY_PY_BUILTINS_SLICE_ATTRS
STATIC mp_obj_t slice_make_new(const mp_obj_type_t *type,
size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
diff --git a/py/parse.c b/py/parse.c
index 911b891e0..b8cfda2cb 100644
--- a/py/parse.c
+++ b/py/parse.c
@@ -477,6 +477,9 @@ STATIC void push_result_token(parser_t *parser, uint8_t rule_id) {
mp_parse_node_t pn;
mp_lexer_t *lex = parser->lexer;
if (lex->tok_kind == MP_TOKEN_NAME) {
+ if(lex->vstr.len >= (1 << (8 * MICROPY_QSTR_BYTES_IN_LEN))) {
+ mp_raise_msg(&mp_type_SyntaxError, translate("Name too long"));
+ }
qstr id = qstr_from_strn(lex->vstr.buf, lex->vstr.len);
#if MICROPY_COMP_CONST
// if name is a standalone identifier, look it up in the table of dynamic constants
@@ -921,6 +924,7 @@ mp_parse_tree_t mp_parse(mp_lexer_t *lex, mp_parse_input_kind_t input_kind) {
backtrack = false;
}
for (; i < n; ++i) {
+ //printf("--> inside for @L924\n");
uint16_t kind = rule_arg[i] & RULE_ARG_KIND_MASK;
if (kind == RULE_ARG_TOK) {
if (lex->tok_kind == (rule_arg[i] & RULE_ARG_ARG_MASK)) {
@@ -1165,15 +1169,57 @@ mp_parse_tree_t mp_parse(mp_lexer_t *lex, mp_parse_input_kind_t input_kind) {
) {
syntax_error:;
mp_obj_t exc;
- if (lex->tok_kind == MP_TOKEN_INDENT) {
- exc = mp_obj_new_exception_msg(&mp_type_IndentationError,
- translate("unexpected indent"));
- } else if (lex->tok_kind == MP_TOKEN_DEDENT_MISMATCH) {
- exc = mp_obj_new_exception_msg(&mp_type_IndentationError,
- translate("unindent does not match any outer indentation level"));
- } else {
- exc = mp_obj_new_exception_msg(&mp_type_SyntaxError,
- translate("invalid syntax"));
+ switch(lex->tok_kind) {
+ case MP_TOKEN_INDENT:
+ exc = mp_obj_new_exception_msg(&mp_type_IndentationError,
+ translate("unexpected indent"));
+ break;
+ case MP_TOKEN_DEDENT_MISMATCH:
+ exc = mp_obj_new_exception_msg(&mp_type_IndentationError,
+ translate("unindent does not match any outer indentation level"));
+ break;
+#if MICROPY_COMP_FSTRING_LITERAL
+#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED
+ case MP_TOKEN_FSTRING_BACKSLASH:
+ exc = mp_obj_new_exception_msg(&mp_type_SyntaxError,
+ translate("f-string expression part cannot include a backslash"));
+ break;
+ case MP_TOKEN_FSTRING_COMMENT:
+ exc = mp_obj_new_exception_msg(&mp_type_SyntaxError,
+ translate("f-string expression part cannot include a '#'"));
+ break;
+ case MP_TOKEN_FSTRING_UNCLOSED:
+ exc = mp_obj_new_exception_msg(&mp_type_SyntaxError,
+ translate("f-string: expecting '}'"));
+ break;
+ case MP_TOKEN_FSTRING_UNOPENED:
+ exc = mp_obj_new_exception_msg(&mp_type_SyntaxError,
+ translate("f-string: single '}' is not allowed"));
+ break;
+ case MP_TOKEN_FSTRING_EMPTY_EXP:
+ exc = mp_obj_new_exception_msg(&mp_type_SyntaxError,
+ translate("f-string: empty expression not allowed"));
+ break;
+ case MP_TOKEN_FSTRING_RAW:
+ exc = mp_obj_new_exception_msg(&mp_type_NotImplementedError,
+ translate("raw f-strings are not implemented"));
+ break;
+#else
+ case MP_TOKEN_FSTRING_BACKSLASH:
+ case MP_TOKEN_FSTRING_COMMENT:
+ case MP_TOKEN_FSTRING_UNCLOSED:
+ case MP_TOKEN_FSTRING_UNOPENED:
+ case MP_TOKEN_FSTRING_EMPTY_EXP:
+ case MP_TOKEN_FSTRING_RAW:
+ exc = mp_obj_new_exception_msg(&mp_type_SyntaxError,
+ translate("malformed f-string"));
+ break;
+#endif
+#endif
+ default:
+ exc = mp_obj_new_exception_msg(&mp_type_SyntaxError,
+ translate("invalid syntax"));
+ break;
}
// add traceback to give info about file name and location
// we don't have a 'block' name, so just pass the NULL qstr to indicate this
diff --git a/py/py.mk b/py/py.mk
index a73b47f37..bca6ac14c 100644
--- a/py/py.mk
+++ b/py/py.mk
@@ -105,6 +105,23 @@ $(BUILD)/$(BTREE_DIR)/%.o: CFLAGS += -Wno-old-style-definition -Wno-sign-compare
$(BUILD)/extmod/modbtree.o: CFLAGS += $(BTREE_DEFS)
endif
+ifeq ($(CIRCUITPY_ULAB),1)
+SRC_MOD += $(addprefix extmod/ulab/code/, \
+create.c \
+extras.c \
+fft.c \
+filter.c \
+linalg.c \
+ndarray.c \
+numerical.c \
+poly.c \
+ulab.c \
+vectorise.c \
+ )
+CFLAGS_MOD += -DCIRCUITPY_ULAB=1 -DMODULE_ULAB_ENABLED=1
+$(BUILD)/extmod/ulab/code/%.o: CFLAGS += -Wno-float-equal -Wno-sign-compare -DCIRCUITPY
+endif
+
# External modules written in C.
ifneq ($(USER_C_MODULES),)
# pre-define USERMOD variables as expanded so that variables are immediate
diff --git a/py/runtime.c b/py/runtime.c
index c1c311ae4..59dcbc7a1 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -1172,7 +1172,7 @@ void mp_store_attr(mp_obj_t base, qstr attr, mp_obj_t value) {
mp_raise_AttributeError(translate("no such attribute"));
} else {
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_AttributeError,
- translate("'%s' object has no attribute '%q'"),
+ translate("'%s' object cannot assign attribute '%q'"),
mp_obj_get_type_str(base), attr));
}
}
diff --git a/shared-bindings/_bleio/Adapter.c b/shared-bindings/_bleio/Adapter.c
index 500055cf3..921667f0f 100644
--- a/shared-bindings/_bleio/Adapter.c
+++ b/shared-bindings/_bleio/Adapter.c
@@ -117,7 +117,7 @@ const mp_obj_property_t bleio_adapter_address_obj = {
//| .. attribute:: name
//|
-//| name of the BLE adapter used once connected. Not used in advertisements.
+//| name of the BLE adapter used once connected.
//| The name is "CIRCUITPY" + the last four hex digits of ``adapter.address``,
//| to make it easy to distinguish multiple CircuitPython boards.
//|
diff --git a/shared-bindings/_bleio/PacketBuffer.c b/shared-bindings/_bleio/PacketBuffer.c
index 3ed295f01..9e3666044 100644
--- a/shared-bindings/_bleio/PacketBuffer.c
+++ b/shared-bindings/_bleio/PacketBuffer.c
@@ -109,7 +109,12 @@ STATIC mp_obj_t bleio_packet_buffer_readinto(mp_obj_t self_in, mp_obj_t buffer_o
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(buffer_obj, &bufinfo, MP_BUFFER_WRITE);
- return MP_OBJ_NEW_SMALL_INT(common_hal_bleio_packet_buffer_readinto(self, bufinfo.buf, bufinfo.len));
+ int size = common_hal_bleio_packet_buffer_readinto(self, bufinfo.buf, bufinfo.len);
+ if (size < 0) {
+ mp_raise_ValueError_varg(translate("Buffer too short by %d bytes"), size * -1);
+ }
+
+ return MP_OBJ_NEW_SMALL_INT(size);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bleio_packet_buffer_readinto_obj, bleio_packet_buffer_readinto);
diff --git a/shared-bindings/_bleio/__init__.c b/shared-bindings/_bleio/__init__.c
index 5d26862a6..dd401398c 100644
--- a/shared-bindings/_bleio/__init__.c
+++ b/shared-bindings/_bleio/__init__.c
@@ -132,6 +132,14 @@ NORETURN void mp_raise_bleio_SecurityError(const compressed_string_t* fmt, ...)
nlr_raise(exception);
}
+// Called when _bleio is imported.
+STATIC mp_obj_t bleio___init__(void) {
+ common_hal_bleio_adapter_set_enabled(&common_hal_bleio_adapter_obj, true);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_0(bleio___init___obj, bleio___init__);
+
+
STATIC const mp_rom_map_elem_t bleio_module_globals_table[] = {
// Name must be the first entry so that the exception printing below is correct.
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__bleio) },
@@ -156,6 +164,10 @@ STATIC const mp_rom_map_elem_t bleio_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_ConnectionError), MP_ROM_PTR(&mp_type_bleio_ConnectionError) },
{ MP_ROM_QSTR(MP_QSTR_RoleError), MP_ROM_PTR(&mp_type_bleio_RoleError) },
{ MP_ROM_QSTR(MP_QSTR_SecurityError), MP_ROM_PTR(&mp_type_bleio_SecurityError) },
+
+ // Initialization
+ { MP_ROM_QSTR(MP_QSTR___init__), MP_ROM_PTR(&bleio___init___obj) },
+
};
STATIC MP_DEFINE_CONST_DICT(bleio_module_globals, bleio_module_globals_table);
diff --git a/shared-bindings/_eve/__init__.c b/shared-bindings/_eve/__init__.c
new file mode 100644
index 000000000..9bc790f5d
--- /dev/null
+++ b/shared-bindings/_eve/__init__.c
@@ -0,0 +1,1105 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 James Bowman for Excamera Labs
+ *
+ * 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 <stdio.h>
+#include <assert.h>
+#include <string.h>
+
+#include "py/runtime.h"
+#include "py/binary.h"
+
+#include "shared-module/_eve/__init__.h"
+#include "shared-bindings/_eve/__init__.h"
+
+//| :mod:`_eve` --- low-level BridgeTek EVE bindings
+//| ================================================
+//|
+//| .. module:: _eve
+//| :synopsis: low-level BridgeTek EVE bindings
+//| :platform: SAMD21/SAMD51
+//|
+//| The `_eve` module provides a class _EVE which
+//| contains methods for constructing EVE command
+//| buffers and appending basic graphics commands.
+//|
+
+typedef struct _mp_obj__EVE_t {
+ mp_obj_base_t base;
+ common_hal__eve_t _eve;
+} mp_obj__EVE_t;
+
+STATIC const mp_obj_type_t _EVE_type;
+
+#define EVEHAL(s) \
+ (&((mp_obj__EVE_t*)mp_instance_cast_to_native_base((s), &_EVE_type))->_eve)
+
+STATIC mp_obj_t _register(mp_obj_t self, mp_obj_t o) {
+ common_hal__eve_t *eve = EVEHAL(self);
+ mp_load_method(o, MP_QSTR_write, eve->dest);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(register_obj, _register);
+
+//| .. method:: flush()
+//|
+//| Send any queued drawing commands directly to the hardware.
+//|
+//| :param int width: The width of the grid in tiles, or 1 for sprites.
+//|
+STATIC mp_obj_t _flush(mp_obj_t self) {
+ common_hal__eve_flush(EVEHAL(self));
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_1(flush_obj, _flush);
+
+//| .. method:: cc(b)
+//|
+//| Append bytes to the command FIFO.
+//|
+//| :param bytes b: The bytes to add
+//|
+STATIC mp_obj_t _cc(mp_obj_t self, mp_obj_t b) {
+ mp_buffer_info_t buffer_info;
+ mp_get_buffer_raise(b, &buffer_info, MP_BUFFER_READ);
+ common_hal__eve_add(EVEHAL(self), buffer_info.len, buffer_info.buf);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(cc_obj, _cc);
+
+//{
+
+//| .. method:: AlphaFunc(func, ref)
+//|
+//| Set the alpha test function
+//|
+//| :param int func: specifies the test function, one of ``NEVER``, ``LESS``, ``LEQUAL``, ``GREATER``, ``GEQUAL``, ``EQUAL``, ``NOTEQUAL``, or ``ALWAYS``. Range 0-7. The initial value is ALWAYS(7)
+//| :param int ref: specifies the reference value for the alpha test. Range 0-255. The initial value is 0
+//|
+//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _alphafunc(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
+ uint32_t func = mp_obj_get_int_truncated(a0);
+ uint32_t ref = mp_obj_get_int_truncated(a1);
+ common_hal__eve_AlphaFunc(EVEHAL(self), func, ref);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_3(alphafunc_obj, _alphafunc);
+
+//| .. method:: Begin(prim)
+//|
+//| Begin drawing a graphics primitive
+//|
+//| :param int prim: graphics primitive.
+//|
+//| Valid primitives are ``BITMAPS``, ``POINTS``, ``LINES``, ``LINE_STRIP``, ``EDGE_STRIP_R``, ``EDGE_STRIP_L``, ``EDGE_STRIP_A``, ``EDGE_STRIP_B`` and ``RECTS``.
+//|
+
+STATIC mp_obj_t _begin(mp_obj_t self, mp_obj_t a0) {
+ uint32_t prim = mp_obj_get_int_truncated(a0);
+ common_hal__eve_Begin(EVEHAL(self), prim);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(begin_obj, _begin);
+
+//| .. method:: BitmapExtFormat(format)
+//|
+//| Set the bitmap format
+//|
+//| :param int format: bitmap pixel format.
+//|
+
+STATIC mp_obj_t _bitmapextformat(mp_obj_t self, mp_obj_t a0) {
+ uint32_t fmt = mp_obj_get_int_truncated(a0);
+ common_hal__eve_BitmapExtFormat(EVEHAL(self), fmt);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmapextformat_obj, _bitmapextformat);
+
+//| .. method:: BitmapHandle(handle)
+//|
+//| Set the bitmap handle
+//|
+//| :param int handle: bitmap handle. Range 0-31. The initial value is 0
+//|
+//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _bitmaphandle(mp_obj_t self, mp_obj_t a0) {
+ uint32_t handle = mp_obj_get_int_truncated(a0);
+ common_hal__eve_BitmapHandle(EVEHAL(self), handle);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaphandle_obj, _bitmaphandle);
+
+//| .. method:: BitmapLayoutH(linestride, height)
+//|
+//| Set the source bitmap memory format and layout for the current handle. high bits for large bitmaps
+//|
+//| :param int linestride: high part of bitmap line stride, in bytes. Range 0-7
+//| :param int height: high part of bitmap height, in lines. Range 0-3
+//|
+
+STATIC mp_obj_t _bitmaplayouth(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
+ uint32_t linestride = mp_obj_get_int_truncated(a0);
+ uint32_t height = mp_obj_get_int_truncated(a1);
+ common_hal__eve_BitmapLayoutH(EVEHAL(self), linestride, height);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaplayouth_obj, _bitmaplayouth);
+
+//| .. method:: BitmapLayout(format, linestride, height)
+//|
+//| Set the source bitmap memory format and layout for the current handle
+//|
+//| :param int format: bitmap pixel format, or GLFORMAT to use BITMAP_EXT_FORMAT instead. Range 0-31
+//| :param int linestride: bitmap line stride, in bytes. Range 0-1023
+//| :param int height: bitmap height, in lines. Range 0-511
+//|
+
+STATIC mp_obj_t _bitmaplayout(size_t n_args, const mp_obj_t *args) {
+ uint32_t format = mp_obj_get_int_truncated(args[1]);
+ uint32_t linestride = mp_obj_get_int_truncated(args[2]);
+ uint32_t height = mp_obj_get_int_truncated(args[3]);
+ common_hal__eve_BitmapLayout(EVEHAL(args[0]), format, linestride, height);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmaplayout_obj, 4, 4, _bitmaplayout);
+
+//| .. method:: BitmapSizeH(width, height)
+//|
+//| Set the screen drawing of bitmaps for the current handle. high bits for large bitmaps
+//|
+//| :param int width: high part of drawn bitmap width, in pixels. Range 0-3
+//| :param int height: high part of drawn bitmap height, in pixels. Range 0-3
+//|
+
+STATIC mp_obj_t _bitmapsizeh(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
+ uint32_t width = mp_obj_get_int_truncated(a0);
+ uint32_t height = mp_obj_get_int_truncated(a1);
+ common_hal__eve_BitmapSizeH(EVEHAL(self), width, height);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmapsizeh_obj, _bitmapsizeh);
+
+//| .. method:: BitmapSize(filter, wrapx, wrapy, width, height)
+//|
+//| Set the screen drawing of bitmaps for the current handle
+//|
+//| :param int filter: bitmap filtering mode, one of ``NEAREST`` or ``BILINEAR``. Range 0-1
+//| :param int wrapx: bitmap :math:`x` wrap mode, one of ``REPEAT`` or ``BORDER``. Range 0-1
+//| :param int wrapy: bitmap :math:`y` wrap mode, one of ``REPEAT`` or ``BORDER``. Range 0-1
+//| :param int width: drawn bitmap width, in pixels. Range 0-511
+//| :param int height: drawn bitmap height, in pixels. Range 0-511
+//|
+
+STATIC mp_obj_t _bitmapsize(size_t n_args, const mp_obj_t *args) {
+ uint32_t filter = mp_obj_get_int_truncated(args[1]);
+ uint32_t wrapx = mp_obj_get_int_truncated(args[2]);
+ uint32_t wrapy = mp_obj_get_int_truncated(args[3]);
+ uint32_t width = mp_obj_get_int_truncated(args[4]);
+ uint32_t height = mp_obj_get_int_truncated(args[5]);
+ common_hal__eve_BitmapSize(EVEHAL(args[0]), filter, wrapx, wrapy, width, height);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmapsize_obj, 6, 6, _bitmapsize);
+
+//| .. method:: BitmapSource(addr)
+//|
+//| Set the source address for bitmap graphics
+//|
+//| :param int addr: Bitmap start address, pixel-aligned. May be in SRAM or flash. Range 0-16777215
+//|
+
+STATIC mp_obj_t _bitmapsource(mp_obj_t self, mp_obj_t a0) {
+ uint32_t addr = mp_obj_get_int_truncated(a0);
+ common_hal__eve_BitmapSource(EVEHAL(self), addr);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmapsource_obj, _bitmapsource);
+
+//| .. method:: BitmapSwizzle(r, g, b, a)
+//|
+//| Set the source for the r,g,b and a channels of a bitmap
+//|
+//| :param int r: red component source channel. Range 0-7
+//| :param int g: green component source channel. Range 0-7
+//| :param int b: blue component source channel. Range 0-7
+//| :param int a: alpha component source channel. Range 0-7
+//|
+
+STATIC mp_obj_t _bitmapswizzle(size_t n_args, const mp_obj_t *args) {
+ uint32_t r = mp_obj_get_int_truncated(args[1]);
+ uint32_t g = mp_obj_get_int_truncated(args[2]);
+ uint32_t b = mp_obj_get_int_truncated(args[3]);
+ uint32_t a = mp_obj_get_int_truncated(args[4]);
+ common_hal__eve_BitmapSwizzle(EVEHAL(args[0]), r, g, b, a);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmapswizzle_obj, 5, 5, _bitmapswizzle);
+
+//| .. method:: BitmapTransformA(p, v)
+//|
+//| Set the :math:`a` component of the bitmap transform matrix
+//|
+//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
+//| :param int v: The :math:`a` component of the bitmap transform matrix, in signed 8.8 or 1.15 bit fixed-point form. Range 0-131071. The initial value is 256
+//|
+//| The initial value is **p** = 0, **v** = 256. This represents the value 1.0.
+//|
+//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _bitmaptransforma(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
+ uint32_t p = mp_obj_get_int_truncated(a0);
+ uint32_t v = mp_obj_get_int_truncated(a1);
+ common_hal__eve_BitmapTransformA(EVEHAL(self), p, v);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforma_obj, _bitmaptransforma);
+
+//| .. method:: BitmapTransformB(p, v)
+//|
+//| Set the :math:`b` component of the bitmap transform matrix
+//|
+//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
+//| :param int v: The :math:`b` component of the bitmap transform matrix, in signed 8.8 or 1.15 bit fixed-point form. Range 0-131071. The initial value is 0
+//|
+//| The initial value is **p** = 0, **v** = 0. This represents the value 0.0.
+//|
+//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _bitmaptransformb(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
+ uint32_t p = mp_obj_get_int_truncated(a0);
+ uint32_t v = mp_obj_get_int_truncated(a1);
+ common_hal__eve_BitmapTransformB(EVEHAL(self), p, v);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformb_obj, _bitmaptransformb);
+
+//| .. method:: BitmapTransformC(v)
+//|
+//| Set the :math:`c` component of the bitmap transform matrix
+//|
+//| :param int v: The :math:`c` component of the bitmap transform matrix, in signed 15.8 bit fixed-point form. Range 0-16777215. The initial value is 0
+//|
+//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _bitmaptransformc(mp_obj_t self, mp_obj_t a0) {
+ uint32_t v = mp_obj_get_int_truncated(a0);
+ common_hal__eve_BitmapTransformC(EVEHAL(self), v);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformc_obj, _bitmaptransformc);
+
+//| .. method:: BitmapTransformD(p, v)
+//|
+//| Set the :math:`d` component of the bitmap transform matrix
+//|
+//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
+//| :param int v: The :math:`d` component of the bitmap transform matrix, in signed 8.8 or 1.15 bit fixed-point form. Range 0-131071. The initial value is 0
+//|
+//| The initial value is **p** = 0, **v** = 0. This represents the value 0.0.
+//|
+//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _bitmaptransformd(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
+ uint32_t p = mp_obj_get_int_truncated(a0);
+ uint32_t v = mp_obj_get_int_truncated(a1);
+ common_hal__eve_BitmapTransformD(EVEHAL(self), p, v);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformd_obj, _bitmaptransformd);
+
+//| .. method:: BitmapTransformE(p, v)
+//|
+//| Set the :math:`e` component of the bitmap transform matrix
+//|
+//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
+//| :param int v: The :math:`e` component of the bitmap transform matrix, in signed 8.8 or 1.15 bit fixed-point form. Range 0-131071. The initial value is 256
+//|
+//| The initial value is **p** = 0, **v** = 256. This represents the value 1.0.
+//|
+//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _bitmaptransforme(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
+ uint32_t p = mp_obj_get_int_truncated(a0);
+ uint32_t v = mp_obj_get_int_truncated(a1);
+ common_hal__eve_BitmapTransformE(EVEHAL(self), p, v);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforme_obj, _bitmaptransforme);
+
+//| .. method:: BitmapTransformF(v)
+//|
+//| Set the :math:`f` component of the bitmap transform matrix
+//|
+//| :param int v: The :math:`f` component of the bitmap transform matrix, in signed 15.8 bit fixed-point form. Range 0-16777215. The initial value is 0
+//|
+//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _bitmaptransformf(mp_obj_t self, mp_obj_t a0) {
+ uint32_t v = mp_obj_get_int_truncated(a0);
+ common_hal__eve_BitmapTransformF(EVEHAL(self), v);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformf_obj, _bitmaptransformf);
+
+//| .. method:: BlendFunc(src, dst)
+//|
+//| Set pixel arithmetic
+//|
+//| :param int src: specifies how the source blending factor is computed. One of ``ZERO``, ``ONE``, ``SRC_ALPHA``, ``DST_ALPHA``, ``ONE_MINUS_SRC_ALPHA`` or ``ONE_MINUS_DST_ALPHA``. Range 0-7. The initial value is SRC_ALPHA(2)
+//| :param int dst: specifies how the destination blending factor is computed, one of the same constants as **src**. Range 0-7. The initial value is ONE_MINUS_SRC_ALPHA(4)
+//|
+//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _blendfunc(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
+ uint32_t src = mp_obj_get_int_truncated(a0);
+ uint32_t dst = mp_obj_get_int_truncated(a1);
+ common_hal__eve_BlendFunc(EVEHAL(self), src, dst);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_3(blendfunc_obj, _blendfunc);
+
+//| .. method:: Call(dest)
+//|
+//| Execute a sequence of commands at another location in the display list
+//|
+//| :param int dest: display list address. Range 0-65535
+//|
+
+STATIC mp_obj_t _call(mp_obj_t self, mp_obj_t a0) {
+ uint32_t dest = mp_obj_get_int_truncated(a0);
+ common_hal__eve_Call(EVEHAL(self), dest);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(call_obj, _call);
+
+//| .. method:: Cell(cell)
+//|
+//| Set the bitmap cell number for the vertex2f command
+//|
+//| :param int cell: bitmap cell number. Range 0-127. The initial value is 0
+//|
+//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _cell(mp_obj_t self, mp_obj_t a0) {
+ uint32_t cell = mp_obj_get_int_truncated(a0);
+ common_hal__eve_Cell(EVEHAL(self), cell);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(cell_obj, _cell);
+
+//| .. method:: ClearColorA(alpha)
+//|
+//| Set clear value for the alpha channel
+//|
+//| :param int alpha: alpha value used when the color buffer is cleared. Range 0-255. The initial value is 0
+//|
+//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _clearcolora(mp_obj_t self, mp_obj_t a0) {
+ uint32_t alpha = mp_obj_get_int_truncated(a0);
+ common_hal__eve_ClearColorA(EVEHAL(self), alpha);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(clearcolora_obj, _clearcolora);
+
+//| .. method:: ClearColorRGB(red, green, blue)
+//|
+//| Set clear values for red, green and blue channels
+//|
+//| :param int red: red value used when the color buffer is cleared. Range 0-255. The initial value is 0
+//| :param int green: green value used when the color buffer is cleared. Range 0-255. The initial value is 0
+//| :param int blue: blue value used when the color buffer is cleared. Range 0-255. The initial value is 0
+//|
+//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _clearcolorrgb(size_t n_args, const mp_obj_t *args) {
+ uint32_t red = mp_obj_get_int_truncated(args[1]);
+ uint32_t green = mp_obj_get_int_truncated(args[2]);
+ uint32_t blue = mp_obj_get_int_truncated(args[3]);
+ common_hal__eve_ClearColorRGB(EVEHAL(args[0]), red, green, blue);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(clearcolorrgb_obj, 4, 4, _clearcolorrgb);
+
+//| .. method:: Clear(c, s, t)
+//|
+//| Clear buffers to preset values
+//|
+//| :param int c: clear color buffer. Range 0-1
+//| :param int s: clear stencil buffer. Range 0-1
+//| :param int t: clear tag buffer. Range 0-1
+//|
+
+STATIC mp_obj_t _clear(size_t n_args, const mp_obj_t *args) {
+ uint32_t c = (n_args > 1) ? mp_obj_get_int_truncated(args[1]) : 1;
+ uint32_t s = (n_args > 2) ? mp_obj_get_int_truncated(args[2]) : 1;
+ uint32_t t = (n_args > 3) ? mp_obj_get_int_truncated(args[3]) : 1;
+ common_hal__eve_Clear(EVEHAL(args[0]), c, s, t);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(clear_obj, 1, 4, _clear);
+
+//| .. method:: ClearStencil(s)
+//|
+//| Set clear value for the stencil buffer
+//|
+//| :param int s: value used when the stencil buffer is cleared. Range 0-255. The initial value is 0
+//|
+//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _clearstencil(mp_obj_t self, mp_obj_t a0) {
+ uint32_t s = mp_obj_get_int_truncated(a0);
+ common_hal__eve_ClearStencil(EVEHAL(self), s);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(clearstencil_obj, _clearstencil);
+
+//| .. method:: ClearTag(s)
+//|
+//| Set clear value for the tag buffer
+//|
+//| :param int s: value used when the tag buffer is cleared. Range 0-255. The initial value is 0
+//|
+//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _cleartag(mp_obj_t self, mp_obj_t a0) {
+ uint32_t s = mp_obj_get_int_truncated(a0);
+ common_hal__eve_ClearTag(EVEHAL(self), s);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(cleartag_obj, _cleartag);
+
+//| .. method:: ColorA(alpha)
+//|
+//| Set the current color alpha
+//|
+//| :param int alpha: alpha for the current color. Range 0-255. The initial value is 255
+//|
+//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _colora(mp_obj_t self, mp_obj_t a0) {
+ uint32_t alpha = mp_obj_get_int_truncated(a0);
+ common_hal__eve_ColorA(EVEHAL(self), alpha);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(colora_obj, _colora);
+
+//| .. method:: ColorMask(r, g, b, a)
+//|
+//| Enable and disable writing of frame buffer color components
+//|
+//| :param int r: allow updates to the frame buffer red component. Range 0-1. The initial value is 1
+//| :param int g: allow updates to the frame buffer green component. Range 0-1. The initial value is 1
+//| :param int b: allow updates to the frame buffer blue component. Range 0-1. The initial value is 1
+//| :param int a: allow updates to the frame buffer alpha component. Range 0-1. The initial value is 1
+//|
+//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _colormask(size_t n_args, const mp_obj_t *args) {
+ uint32_t r = mp_obj_get_int_truncated(args[1]);
+ uint32_t g = mp_obj_get_int_truncated(args[2]);
+ uint32_t b = mp_obj_get_int_truncated(args[3]);
+ uint32_t a = mp_obj_get_int_truncated(args[4]);
+ common_hal__eve_ColorMask(EVEHAL(args[0]), r, g, b, a);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(colormask_obj, 5, 5, _colormask);
+
+//| .. method:: ColorRGB(red, green, blue)
+//|
+//| Set the drawing color
+//|
+//| :param int red: red value for the current color. Range 0-255. The initial value is 255
+//| :param int green: green for the current color. Range 0-255. The initial value is 255
+//| :param int blue: blue for the current color. Range 0-255. The initial value is 255
+//|
+//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _colorrgb(size_t n_args, const mp_obj_t *args) {
+ uint32_t red = mp_obj_get_int_truncated(args[1]);
+ uint32_t green = mp_obj_get_int_truncated(args[2]);
+ uint32_t blue = mp_obj_get_int_truncated(args[3]);
+ common_hal__eve_ColorRGB(EVEHAL(args[0]), red, green, blue);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(colorrgb_obj, 4, 4, _colorrgb);
+
+//| .. method:: Display()
+//|
+//| End the display list
+//|
+
+STATIC mp_obj_t _display(mp_obj_t self) {
+
+ common_hal__eve_Display(EVEHAL(self));
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_1(display_obj, _display);
+
+//| .. method:: End()
+//|
+//| End drawing a graphics primitive
+//|
+//| :meth:`Vertex2ii` and :meth:`Vertex2f` calls are ignored until the next :meth:`Begin`.
+//|
+
+STATIC mp_obj_t _end(mp_obj_t self) {
+
+ common_hal__eve_End(EVEHAL(self));
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_1(end_obj, _end);
+
+//| .. method:: Jump(dest)
+//|
+//| Execute commands at another location in the display list
+//|
+//| :param int dest: display list address. Range 0-65535
+//|
+
+STATIC mp_obj_t _jump(mp_obj_t self, mp_obj_t a0) {
+ uint32_t dest = mp_obj_get_int_truncated(a0);
+ common_hal__eve_Jump(EVEHAL(self), dest);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(jump_obj, _jump);
+
+//| .. method:: LineWidth(width)
+//|
+//| Set the width of rasterized lines
+//|
+//| :param int width: line width in :math:`1/16` pixel. Range 0-4095. The initial value is 16
+//|
+//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _linewidth(mp_obj_t self, mp_obj_t a0) {
+ uint32_t width = mp_obj_get_int_truncated(a0);
+ common_hal__eve_LineWidth(EVEHAL(self), width);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(linewidth_obj, _linewidth);
+
+//| .. method:: Macro(m)
+//|
+//| Execute a single command from a macro register
+//|
+//| :param int m: macro register to read. Range 0-1
+//|
+
+STATIC mp_obj_t _macro(mp_obj_t self, mp_obj_t a0) {
+ uint32_t m = mp_obj_get_int_truncated(a0);
+ common_hal__eve_Macro(EVEHAL(self), m);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(macro_obj, _macro);
+
+//| .. method:: Nop()
+//|
+//| No operation
+//|
+
+STATIC mp_obj_t _nop(mp_obj_t self) {
+
+ common_hal__eve_Nop(EVEHAL(self));
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_1(nop_obj, _nop);
+
+//| .. method:: PaletteSource(addr)
+//|
+//| Set the base address of the palette
+//|
+//| :param int addr: Address in graphics SRAM, 2-byte aligned. Range 0-4194303. The initial value is 0
+//|
+//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _palettesource(mp_obj_t self, mp_obj_t a0) {
+ uint32_t addr = mp_obj_get_int_truncated(a0);
+ common_hal__eve_PaletteSource(EVEHAL(self), addr);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(palettesource_obj, _palettesource);
+
+//| .. method:: PointSize(size)
+//|
+//| Set the radius of rasterized points
+//|
+//| :param int size: point radius in :math:`1/16` pixel. Range 0-8191. The initial value is 16
+//|
+//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _pointsize(mp_obj_t self, mp_obj_t a0) {
+ uint32_t size = mp_obj_get_int_truncated(a0);
+ common_hal__eve_PointSize(EVEHAL(self), size);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(pointsize_obj, _pointsize);
+
+//| .. method:: RestoreContext()
+//|
+//| Restore the current graphics context from the context stack
+//|
+
+STATIC mp_obj_t _restorecontext(mp_obj_t self) {
+
+ common_hal__eve_RestoreContext(EVEHAL(self));
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_1(restorecontext_obj, _restorecontext);
+
+//| .. method:: Return()
+//|
+//| Return from a previous call command
+//|
+
+STATIC mp_obj_t _return(mp_obj_t self) {
+
+ common_hal__eve_Return(EVEHAL(self));
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_1(return_obj, _return);
+
+//| .. method:: SaveContext()
+//|
+//| Push the current graphics context on the context stack
+//|
+
+STATIC mp_obj_t _savecontext(mp_obj_t self) {
+
+ common_hal__eve_SaveContext(EVEHAL(self));
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_1(savecontext_obj, _savecontext);
+
+//| .. method:: ScissorSize(width, height)
+//|
+//| Set the size of the scissor clip rectangle
+//|
+//| :param int width: The width of the scissor clip rectangle, in pixels. Range 0-4095. The initial value is hsize
+//| :param int height: The height of the scissor clip rectangle, in pixels. Range 0-4095. The initial value is 2048
+//|
+//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _scissorsize(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
+ uint32_t width = mp_obj_get_int_truncated(a0);
+ uint32_t height = mp_obj_get_int_truncated(a1);
+ common_hal__eve_ScissorSize(EVEHAL(self), width, height);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_3(scissorsize_obj, _scissorsize);
+
+//| .. method:: ScissorXY(x, y)
+//|
+//| Set the top left corner of the scissor clip rectangle
+//|
+//| :param int x: The :math:`x` coordinate of the scissor clip rectangle, in pixels. Range 0-2047. The initial value is 0
+//| :param int y: The :math:`y` coordinate of the scissor clip rectangle, in pixels. Range 0-2047. The initial value is 0
+//|
+//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _scissorxy(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
+ uint32_t x = mp_obj_get_int_truncated(a0);
+ uint32_t y = mp_obj_get_int_truncated(a1);
+ common_hal__eve_ScissorXY(EVEHAL(self), x, y);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_3(scissorxy_obj, _scissorxy);
+
+//| .. method:: StencilFunc(func, ref, mask)
+//|
+//| Set function and reference value for stencil testing
+//|
+//| :param int func: specifies the test function, one of ``NEVER``, ``LESS``, ``LEQUAL``, ``GREATER``, ``GEQUAL``, ``EQUAL``, ``NOTEQUAL``, or ``ALWAYS``. Range 0-7. The initial value is ALWAYS(7)
+//| :param int ref: specifies the reference value for the stencil test. Range 0-255. The initial value is 0
+//| :param int mask: specifies a mask that is ANDed with the reference value and the stored stencil value. Range 0-255. The initial value is 255
+//|
+//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _stencilfunc(size_t n_args, const mp_obj_t *args) {
+ uint32_t func = mp_obj_get_int_truncated(args[1]);
+ uint32_t ref = mp_obj_get_int_truncated(args[2]);
+ uint32_t mask = mp_obj_get_int_truncated(args[3]);
+ common_hal__eve_StencilFunc(EVEHAL(args[0]), func, ref, mask);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(stencilfunc_obj, 4, 4, _stencilfunc);
+
+//| .. method:: StencilMask(mask)
+//|
+//| Control the writing of individual bits in the stencil planes
+//|
+//| :param int mask: the mask used to enable writing stencil bits. Range 0-255. The initial value is 255
+//|
+//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _stencilmask(mp_obj_t self, mp_obj_t a0) {
+ uint32_t mask = mp_obj_get_int_truncated(a0);
+ common_hal__eve_StencilMask(EVEHAL(self), mask);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(stencilmask_obj, _stencilmask);
+
+//| .. method:: StencilOp(sfail, spass)
+//|
+//| Set stencil test actions
+//|
+//| :param int sfail: specifies the action to take when the stencil test fails, one of ``KEEP``, ``ZERO``, ``REPLACE``, ``INCR``, ``INCR_WRAP``, ``DECR``, ``DECR_WRAP``, and ``INVERT``. Range 0-7. The initial value is KEEP(1)
+//| :param int spass: specifies the action to take when the stencil test passes, one of the same constants as **sfail**. Range 0-7. The initial value is KEEP(1)
+//|
+//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _stencilop(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
+ uint32_t sfail = mp_obj_get_int_truncated(a0);
+ uint32_t spass = mp_obj_get_int_truncated(a1);
+ common_hal__eve_StencilOp(EVEHAL(self), sfail, spass);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_3(stencilop_obj, _stencilop);
+
+//| .. method:: TagMask(mask)
+//|
+//| Control the writing of the tag buffer
+//|
+//| :param int mask: allow updates to the tag buffer. Range 0-1. The initial value is 1
+//|
+//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _tagmask(mp_obj_t self, mp_obj_t a0) {
+ uint32_t mask = mp_obj_get_int_truncated(a0);
+ common_hal__eve_TagMask(EVEHAL(self), mask);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(tagmask_obj, _tagmask);
+
+//| .. method:: Tag(s)
+//|
+//| Set the current tag value
+//|
+//| :param int s: tag value. Range 0-255. The initial value is 255
+//|
+//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _tag(mp_obj_t self, mp_obj_t a0) {
+ uint32_t s = mp_obj_get_int_truncated(a0);
+ common_hal__eve_Tag(EVEHAL(self), s);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(tag_obj, _tag);
+
+//| .. method:: VertexTranslateX(x)
+//|
+//| Set the vertex transformation's x translation component
+//|
+//| :param int x: signed x-coordinate in :math:`1/16` pixel. Range 0-131071. The initial value is 0
+//|
+//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _vertextranslatex(mp_obj_t self, mp_obj_t a0) {
+ uint32_t x = mp_obj_get_int_truncated(a0);
+ common_hal__eve_VertexTranslateX(EVEHAL(self), x);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatex_obj, _vertextranslatex);
+
+//| .. method:: VertexTranslateY(y)
+//|
+//| Set the vertex transformation's y translation component
+//|
+//| :param int y: signed y-coordinate in :math:`1/16` pixel. Range 0-131071. The initial value is 0
+//|
+//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+
+STATIC mp_obj_t _vertextranslatey(mp_obj_t self, mp_obj_t a0) {
+ uint32_t y = mp_obj_get_int_truncated(a0);
+ common_hal__eve_VertexTranslateY(EVEHAL(self), y);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatey_obj, _vertextranslatey);
+
+//| .. method:: VertexFormat(frac)
+//|
+//| Set the precision of vertex2f coordinates
+//|
+//| :param int frac: Number of fractional bits in X,Y coordinates, 0-4. Range 0-7. The initial value is 4
+//|
+//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
+//|
+
+STATIC mp_obj_t _vertexformat(mp_obj_t self, mp_obj_t a0) {
+ uint32_t frac = mp_obj_get_int_truncated(a0);
+ common_hal__eve_VertexFormat(EVEHAL(self), frac);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertexformat_obj, _vertexformat);
+
+//| .. method:: Vertex2ii(x, y, handle, cell)
+//|
+//| :param int x: x-coordinate in pixels. Range 0-511
+//| :param int y: y-coordinate in pixels. Range 0-511
+//| :param int handle: bitmap handle. Range 0-31
+//| :param int cell: cell number. Range 0-127
+//|
+//| This method is an alternative to :meth:`Vertex2f`.
+//|
+
+STATIC mp_obj_t _vertex2ii(size_t n_args, const mp_obj_t *args) {
+ uint32_t x = mp_obj_get_int_truncated(args[1]);
+ uint32_t y = mp_obj_get_int_truncated(args[2]);
+ uint32_t handle = (n_args > 3) ? mp_obj_get_int_truncated(args[3]) : 0;
+ uint32_t cell = (n_args > 4) ? mp_obj_get_int_truncated(args[4]) : 0;
+ common_hal__eve_Vertex2ii(EVEHAL(args[0]), x, y, handle, cell);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(vertex2ii_obj, 3, 5, _vertex2ii);
+
+#define ROM_DECLS \
+ { MP_ROM_QSTR(MP_QSTR_AlphaFunc), MP_ROM_PTR(&alphafunc_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_Begin), MP_ROM_PTR(&begin_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_BitmapExtFormat), MP_ROM_PTR(&bitmapextformat_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_BitmapHandle), MP_ROM_PTR(&bitmaphandle_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_BitmapLayoutH), MP_ROM_PTR(&bitmaplayouth_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_BitmapLayout), MP_ROM_PTR(&bitmaplayout_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_BitmapSizeH), MP_ROM_PTR(&bitmapsizeh_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_BitmapSize), MP_ROM_PTR(&bitmapsize_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_BitmapSource), MP_ROM_PTR(&bitmapsource_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_BitmapSwizzle), MP_ROM_PTR(&bitmapswizzle_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_BitmapTransformA), MP_ROM_PTR(&bitmaptransforma_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_BitmapTransformB), MP_ROM_PTR(&bitmaptransformb_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_BitmapTransformC), MP_ROM_PTR(&bitmaptransformc_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_BitmapTransformD), MP_ROM_PTR(&bitmaptransformd_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_BitmapTransformE), MP_ROM_PTR(&bitmaptransforme_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_BitmapTransformF), MP_ROM_PTR(&bitmaptransformf_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_BlendFunc), MP_ROM_PTR(&blendfunc_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_Call), MP_ROM_PTR(&call_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_Cell), MP_ROM_PTR(&cell_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_ClearColorA), MP_ROM_PTR(&clearcolora_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_ClearColorRGB), MP_ROM_PTR(&clearcolorrgb_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_Clear), MP_ROM_PTR(&clear_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_ClearStencil), MP_ROM_PTR(&clearstencil_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_ClearTag), MP_ROM_PTR(&cleartag_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_ColorA), MP_ROM_PTR(&colora_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_ColorMask), MP_ROM_PTR(&colormask_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_ColorRGB), MP_ROM_PTR(&colorrgb_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_Display), MP_ROM_PTR(&display_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_End), MP_ROM_PTR(&end_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_Jump), MP_ROM_PTR(&jump_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_LineWidth), MP_ROM_PTR(&linewidth_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_Macro), MP_ROM_PTR(&macro_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_Nop), MP_ROM_PTR(&nop_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_PaletteSource), MP_ROM_PTR(&palettesource_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_PointSize), MP_ROM_PTR(&pointsize_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_RestoreContext), MP_ROM_PTR(&restorecontext_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_Return), MP_ROM_PTR(&return_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_SaveContext), MP_ROM_PTR(&savecontext_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_ScissorSize), MP_ROM_PTR(&scissorsize_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_ScissorXY), MP_ROM_PTR(&scissorxy_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_StencilFunc), MP_ROM_PTR(&stencilfunc_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_StencilMask), MP_ROM_PTR(&stencilmask_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_StencilOp), MP_ROM_PTR(&stencilop_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_TagMask), MP_ROM_PTR(&tagmask_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_Tag), MP_ROM_PTR(&tag_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_VertexTranslateX), MP_ROM_PTR(&vertextranslatex_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_VertexTranslateY), MP_ROM_PTR(&vertextranslatey_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_VertexFormat), MP_ROM_PTR(&vertexformat_obj) }, \
+ { MP_ROM_QSTR(MP_QSTR_Vertex2ii), MP_ROM_PTR(&vertex2ii_obj) }
+
+//}
+
+// Hand-written functions {
+
+//| .. method:: Vertex2f(b)
+//|
+//| Draw a point.
+//|
+//| :param float x: pixel x-coordinate
+//| :param float y: pixel y-coordinate
+//|
+STATIC mp_obj_t _vertex2f(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
+ mp_float_t x = mp_obj_get_float(a0);
+ mp_float_t y = mp_obj_get_float(a1);
+ common_hal__eve_Vertex2f(EVEHAL(self), x, y);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_3(vertex2f_obj, _vertex2f);
+
+// Append an object x to the FIFO
+#define ADD_X(self, x) \
+ common_hal__eve_add(EVEHAL(self), sizeof(x), &(x));
+
+//| .. method:: cmd0(n)
+//|
+//| Append the command word n to the FIFO
+//|
+//| :param int n: The command code
+//|
+//| This method is used by the ``eve`` module to efficiently add
+//| commands to the FIFO.
+//|
+
+STATIC mp_obj_t _cmd0(mp_obj_t self, mp_obj_t n) {
+ uint32_t code = 0xffffff00 | mp_obj_get_int_truncated(n);
+ ADD_X(self, code);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(cmd0_obj, _cmd0);
+
+//| .. method:: cmd(n, fmt, args)
+//|
+//| Append a command packet to the FIFO.
+//|
+//| :param int n: The command code
+//| :param str fmt: The command format `struct` layout
+//| :param tuple args: The command's arguments
+//|
+//| Supported format codes: h, H, i, I.
+//|
+//| This method is used by the ``eve`` module to efficiently add
+//| commands to the FIFO.
+//|
+STATIC mp_obj_t _cmd(size_t n_args, const mp_obj_t *args) {
+ mp_obj_t self = args[0];
+ mp_obj_t num = args[1];
+ mp_buffer_info_t fmt;
+ mp_get_buffer_raise(args[2], &fmt, MP_BUFFER_READ);
+ size_t len;
+ mp_obj_t *items;
+ mp_obj_tuple_get(args[3], &len, &items);
+
+ // Count how many 32-bit words required
+ size_t n = 0;
+ for (size_t i = 0; i < fmt.len; n++) {
+ switch (((char*)fmt.buf)[i]) {
+ case 'I':
+ case 'i':
+ i += 1;
+ break;
+ case 'H':
+ case 'h':
+ i += 2;
+ break;
+ default:
+ break;
+ }
+ }
+
+ uint32_t buf[16];
+ uint32_t *p = buf;
+ *p++ = 0xffffff00 | mp_obj_get_int_truncated(num);
+ mp_obj_t *a = items;
+ uint32_t lo;
+
+ for (size_t i = 0; i < fmt.len; ) {
+ switch (((char*)fmt.buf)[i]) {
+ case 'I':
+ case 'i':
+ *p++ = mp_obj_get_int_truncated(*a++);
+ i += 1;
+ break;
+ case 'H':
+ case 'h':
+ lo = mp_obj_get_int_truncated(*a++) & 0xffff;
+ *p++ = lo | (mp_obj_get_int_truncated(*a++) << 16);
+ i += 2;
+ break;
+ default:
+ break;
+ }
+ }
+
+ common_hal__eve_add(EVEHAL(self), sizeof(uint32_t) * (1 + n), buf);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(cmd_obj, 4, 4, _cmd);
+
+STATIC const mp_rom_map_elem_t _EVE_locals_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_register), MP_ROM_PTR(&register_obj) },
+ { MP_ROM_QSTR(MP_QSTR_cc), MP_ROM_PTR(&cc_obj) },
+ { MP_ROM_QSTR(MP_QSTR_flush), MP_ROM_PTR(&flush_obj) },
+ { MP_ROM_QSTR(MP_QSTR_Vertex2f), MP_ROM_PTR(&vertex2f_obj) },
+ { MP_ROM_QSTR(MP_QSTR_cmd), MP_ROM_PTR(&cmd_obj) },
+ { MP_ROM_QSTR(MP_QSTR_cmd0), MP_ROM_PTR(&cmd0_obj) },
+ ROM_DECLS
+};
+STATIC MP_DEFINE_CONST_DICT(_EVE_locals_dict, _EVE_locals_dict_table);
+
+STATIC mp_obj_t _EVE_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+ // mp_arg_check_num(n_args, kw_args, 1, 1, false);
+ mp_obj__EVE_t *o = m_new_obj(mp_obj__EVE_t);
+ o->base.type = &_EVE_type;
+ o->_eve.n = 0;
+ o->_eve.vscale = 16;
+ return MP_OBJ_FROM_PTR(o);
+}
+
+STATIC const mp_obj_type_t _EVE_type = {
+ { &mp_type_type },
+ .name = MP_QSTR__EVE,
+ .make_new = _EVE_make_new,
+ .locals_dict = (void*)&_EVE_locals_dict,
+};
+
+STATIC const mp_rom_map_elem_t mp_module__eve_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__eve) },
+ { MP_ROM_QSTR(MP_QSTR__EVE), MP_OBJ_FROM_PTR(&_EVE_type) },
+};
+
+STATIC MP_DEFINE_CONST_DICT(mp_module__eve_globals, mp_module__eve_globals_table);
+
+const mp_obj_module_t _eve_module = {
+ .base = { &mp_type_module },
+ .globals = (mp_obj_dict_t*)&mp_module__eve_globals,
+};
diff --git a/shared-bindings/_eve/__init__.h b/shared-bindings/_eve/__init__.h
new file mode 100644
index 000000000..759a629bb
--- /dev/null
+++ b/shared-bindings/_eve/__init__.h
@@ -0,0 +1,84 @@
+/*
+ * This file is part of the Micro Python project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 James Bowman for Excamera Labs
+ *
+ * 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_SHARED_BINDINGS__EVE___INIT___H
+#define MICROPY_INCLUDED_SHARED_BINDINGS__EVE___INIT___H
+
+void common_hal__eve_flush(common_hal__eve_t *eve);
+void common_hal__eve_add(common_hal__eve_t *eve, size_t len, void *buf);
+void common_hal__eve_Vertex2f(common_hal__eve_t *eve, mp_float_t x, mp_float_t y);
+
+void common_hal__eve_AlphaFunc(common_hal__eve_t *eve, uint32_t func, uint32_t ref);
+void common_hal__eve_Begin(common_hal__eve_t *eve, uint32_t prim);
+void common_hal__eve_BitmapExtFormat(common_hal__eve_t *eve, uint32_t fmt);
+void common_hal__eve_BitmapHandle(common_hal__eve_t *eve, uint32_t handle);
+void common_hal__eve_BitmapLayoutH(common_hal__eve_t *eve, uint32_t linestride, uint32_t height);
+void common_hal__eve_BitmapLayout(common_hal__eve_t *eve, uint32_t format, uint32_t linestride, uint32_t height);
+void common_hal__eve_BitmapSizeH(common_hal__eve_t *eve, uint32_t width, uint32_t height);
+void common_hal__eve_BitmapSize(common_hal__eve_t *eve, uint32_t filter, uint32_t wrapx, uint32_t wrapy, uint32_t width, uint32_t height);
+void common_hal__eve_BitmapSource(common_hal__eve_t *eve, uint32_t addr);
+void common_hal__eve_BitmapSwizzle(common_hal__eve_t *eve, uint32_t r, uint32_t g, uint32_t b, uint32_t a);
+void common_hal__eve_BitmapTransformA(common_hal__eve_t *eve, uint32_t p, uint32_t v);
+void common_hal__eve_BitmapTransformB(common_hal__eve_t *eve, uint32_t p, uint32_t v);
+void common_hal__eve_BitmapTransformC(common_hal__eve_t *eve, uint32_t v);
+void common_hal__eve_BitmapTransformD(common_hal__eve_t *eve, uint32_t p, uint32_t v);
+void common_hal__eve_BitmapTransformE(common_hal__eve_t *eve, uint32_t p, uint32_t v);
+void common_hal__eve_BitmapTransformF(common_hal__eve_t *eve, uint32_t v);
+void common_hal__eve_BlendFunc(common_hal__eve_t *eve, uint32_t src, uint32_t dst);
+void common_hal__eve_Call(common_hal__eve_t *eve, uint32_t dest);
+void common_hal__eve_Cell(common_hal__eve_t *eve, uint32_t cell);
+void common_hal__eve_ClearColorA(common_hal__eve_t *eve, uint32_t alpha);
+void common_hal__eve_ClearColorRGB(common_hal__eve_t *eve, uint32_t red, uint32_t green, uint32_t blue);
+void common_hal__eve_Clear(common_hal__eve_t *eve, uint32_t c, uint32_t s, uint32_t t);
+void common_hal__eve_ClearStencil(common_hal__eve_t *eve, uint32_t s);
+void common_hal__eve_ClearTag(common_hal__eve_t *eve, uint32_t s);
+void common_hal__eve_ColorA(common_hal__eve_t *eve, uint32_t alpha);
+void common_hal__eve_ColorMask(common_hal__eve_t *eve, uint32_t r, uint32_t g, uint32_t b, uint32_t a);
+void common_hal__eve_ColorRGB(common_hal__eve_t *eve, uint32_t red, uint32_t green, uint32_t blue);
+void common_hal__eve_Display(common_hal__eve_t *eve);
+void common_hal__eve_End(common_hal__eve_t *eve);
+void common_hal__eve_Jump(common_hal__eve_t *eve, uint32_t dest);
+void common_hal__eve_LineWidth(common_hal__eve_t *eve, uint32_t width);
+void common_hal__eve_Macro(common_hal__eve_t *eve, uint32_t m);
+void common_hal__eve_Nop(common_hal__eve_t *eve);
+void common_hal__eve_PaletteSource(common_hal__eve_t *eve, uint32_t addr);
+void common_hal__eve_PointSize(common_hal__eve_t *eve, uint32_t size);
+void common_hal__eve_RestoreContext(common_hal__eve_t *eve);
+void common_hal__eve_Return(common_hal__eve_t *eve);
+void common_hal__eve_SaveContext(common_hal__eve_t *eve);
+void common_hal__eve_ScissorSize(common_hal__eve_t *eve, uint32_t width, uint32_t height);
+void common_hal__eve_ScissorXY(common_hal__eve_t *eve, uint32_t x, uint32_t y);
+void common_hal__eve_StencilFunc(common_hal__eve_t *eve, uint32_t func, uint32_t ref, uint32_t mask);
+void common_hal__eve_StencilMask(common_hal__eve_t *eve, uint32_t mask);
+void common_hal__eve_StencilOp(common_hal__eve_t *eve, uint32_t sfail, uint32_t spass);
+void common_hal__eve_TagMask(common_hal__eve_t *eve, uint32_t mask);
+void common_hal__eve_Tag(common_hal__eve_t *eve, uint32_t s);
+void common_hal__eve_VertexTranslateX(common_hal__eve_t *eve, uint32_t x);
+void common_hal__eve_VertexTranslateY(common_hal__eve_t *eve, uint32_t y);
+void common_hal__eve_VertexFormat(common_hal__eve_t *eve, uint32_t frac);
+void common_hal__eve_Vertex2ii(common_hal__eve_t *eve, uint32_t x, uint32_t y, uint32_t handle, uint32_t cell);
+
+#endif // MICROPY_INCLUDED_SHARED_BINDINGS__EVE___INIT___H
diff --git a/shared-bindings/_protomatter/Protomatter.c b/shared-bindings/_protomatter/Protomatter.c
new file mode 100644
index 000000000..bb4339079
--- /dev/null
+++ b/shared-bindings/_protomatter/Protomatter.c
@@ -0,0 +1,376 @@
+/*
+ * This file is part of the Micro Python project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Jeff Epler 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 "py/obj.h"
+#include "py/objproperty.h"
+#include "py/runtime.h"
+#include "py/objarray.h"
+
+#include "common-hal/_protomatter/Protomatter.h"
+#include "shared-bindings/_protomatter/Protomatter.h"
+#include "shared-bindings/microcontroller/Pin.h"
+#include "shared-bindings/microcontroller/__init__.h"
+#include "shared-bindings/util.h"
+#include "shared-module/displayio/__init__.h"
+#include "shared-module/framebufferio/__init__.h"
+#include "shared-module/framebufferio/FramebufferDisplay.h"
+
+//| .. currentmodule:: _protomatter
+//|
+//| :class:`protomatter` -- Driver for HUB75-style RGB LED matrices
+//| ================================================================
+//|
+
+extern Protomatter_core *_PM_protoPtr;
+
+STATIC uint8_t validate_pin(mp_obj_t obj) {
+ mcu_pin_obj_t *result = validate_obj_is_free_pin(obj);
+ return common_hal_mcu_pin_number(result);
+}
+
+STATIC void validate_pins(qstr what, uint8_t* pin_nos, mp_int_t max_pins, mp_obj_t seq, uint8_t *count_out) {
+ mp_int_t len = MP_OBJ_SMALL_INT_VALUE(mp_obj_len(seq));
+ if (len > max_pins) {
+ mp_raise_ValueError_varg(translate("At most %d %q may be specified (not %d)"), max_pins, what, len);
+ }
+ *count_out = len;
+ for (mp_int_t i=0; i<len; i++) {
+ pin_nos[i] = validate_pin(mp_obj_subscr(seq, MP_OBJ_NEW_SMALL_INT(i), MP_OBJ_SENTINEL));
+ }
+}
+
+STATIC void claim_and_never_reset_pin(mp_obj_t pin) {
+ common_hal_mcu_pin_claim(pin);
+ common_hal_never_reset_pin(pin);
+}
+
+STATIC void claim_and_never_reset_pins(mp_obj_t seq) {
+ mp_int_t len = MP_OBJ_SMALL_INT_VALUE(mp_obj_len(seq));
+ for (mp_int_t i=0; i<len; i++) {
+ claim_and_never_reset_pin(mp_obj_subscr(seq, MP_OBJ_NEW_SMALL_INT(i), MP_OBJ_SENTINEL));
+ }
+}
+
+STATIC void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_t rgb_pin_count, bool allow_inefficient) {
+ uint32_t port = clock_pin / 32;
+ uint32_t bit_mask = 1 << (clock_pin % 32);
+
+ for (uint8_t i = 0; i < rgb_pin_count; i++) {
+ uint32_t pin_port = rgb_pins[i] / 32;
+
+ if (pin_port != port) {
+ mp_raise_ValueError_varg(
+ translate("rgb_pins[%d] is not on the same port as clock"), i);
+ }
+
+ uint32_t pin_mask = 1 << (rgb_pins[i] % 32);
+ if (pin_mask & bit_mask) {
+ mp_raise_ValueError_varg(
+ translate("rgb_pins[%d] duplicates another pin assignment"), i);
+ }
+
+ bit_mask |= pin_mask;
+ }
+
+ if (allow_inefficient) {
+ return;
+ }
+
+ uint8_t byte_mask = 0;
+ if (bit_mask & 0x000000FF) byte_mask |= 0b0001;
+ if (bit_mask & 0x0000FF00) byte_mask |= 0b0010;
+ if (bit_mask & 0x00FF0000) byte_mask |= 0b0100;
+ if (bit_mask & 0xFF000000) byte_mask |= 0b1000;
+
+ uint8_t bytes_per_element = 0xff;
+ uint8_t ideal_bytes_per_element = (rgb_pin_count + 7) / 8;
+
+ switch(byte_mask) {
+ case 0b0001:
+ case 0b0010:
+ case 0b0100:
+ case 0b1000:
+ bytes_per_element = 1;
+ break;
+
+ case 0b0011:
+ case 0b1100:
+ bytes_per_element = 2;
+ break;
+
+ default:
+ bytes_per_element = 4;
+ break;
+ }
+
+ if (bytes_per_element != ideal_bytes_per_element) {
+ mp_raise_ValueError_varg(
+ translate("Pinout uses %d bytes per element, which consumes more than the ideal %d bytes. If this cannot be avoided, pass allow_inefficient=True to the constructor"),
+ bytes_per_element, ideal_bytes_per_element);
+ }
+}
+
+//| :class:`~_protomatter.Protomatter` displays an in-memory framebuffer to an LED matrix.
+//|
+//| .. class:: Protomatter(width, bit_depth, rgb_pins, addr_pins, clock_pin, latch_pin, output_enable_pin, *, doublebuffer=True, framebuffer=None)
+//|
+//| Create a Protomatter object with the given attributes. The height of
+//| the display is determined by the number of rgb and address pins:
+//| len(rgb_pins) // 3 * 2 ** len(address_pins). With 6 RGB pins and 4
+//| address lines, the display will be 32 pixels tall.
+//|
+//| Up to 30 RGB pins and 8 address pins are supported.
+//|
+//| The RGB pins must be within a single "port" and performance and memory
+//| usage are best when they are all within "close by" bits of the port.
+//| The clock pin must also be on the same port as the RGB pins. See the
+//| documentation of the underlying protomatter C library for more
+//| information. Generally, Adafruit's interface boards are designed so
+//| that these requirements are met when matched with the intended
+//| microcontroller board. For instance, the Feather M4 Express works
+//| together with the RGB Matrix Feather.
+//|
+//| The framebuffer is in "RGB565" format.
+//|
+//| "RGB565" means that it is organized as a series of 16-bit numbers
+//| where the highest 5 bits are interpreted as red, the next 6 as
+//| green, and the final 5 as blue. The object can be any buffer, but
+//| `array.array` and `ulab.array` objects are most often useful.
+//| To update the content, modify the framebuffer and call refresh.
+//|
+//| If a framebuffer is not passed in, one is allocated and initialized
+//| to all black. In any case, the framebuffer can be retrieved
+//| by passing the protomatter object to memoryview().
+//|
+//| If doublebuffer is False, some memory is saved, but the display may
+//| flicker during updates.
+//|
+//| If a framebuffer is not passed in, one is allocated internally. To
+//| retrieve it, pass the protomatter object to memoryview().
+//|
+//| A Protomatter framebuffer is often used in conjunction with a
+//| `framebufferio.FramebufferDisplay`.
+//|
+
+STATIC mp_obj_t protomatter_protomatter_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+ enum { ARG_width, ARG_bit_depth, ARG_rgb_list, ARG_addr_list,
+ ARG_clock_pin, ARG_latch_pin, ARG_output_enable_pin, ARG_doublebuffer, ARG_framebuffer, ARG_height };
+ static const mp_arg_t allowed_args[] = {
+ { MP_QSTR_width, MP_ARG_INT | MP_ARG_REQUIRED | MP_ARG_KW_ONLY },
+ { MP_QSTR_bit_depth, MP_ARG_INT | MP_ARG_REQUIRED | MP_ARG_KW_ONLY },
+ { MP_QSTR_rgb_pins, MP_ARG_OBJ | MP_ARG_REQUIRED | MP_ARG_KW_ONLY },
+ { MP_QSTR_addr_pins, MP_ARG_OBJ | MP_ARG_REQUIRED | MP_ARG_KW_ONLY },
+ { MP_QSTR_clock_pin, MP_ARG_OBJ | MP_ARG_REQUIRED | MP_ARG_KW_ONLY },
+ { MP_QSTR_latch_pin, MP_ARG_OBJ | MP_ARG_REQUIRED | MP_ARG_KW_ONLY },
+ { MP_QSTR_output_enable_pin, MP_ARG_OBJ | MP_ARG_REQUIRED | MP_ARG_KW_ONLY },
+ { MP_QSTR_doublebuffer, MP_ARG_BOOL | MP_ARG_KW_ONLY, { .u_bool = true } },
+ { MP_QSTR_framebuffer, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = mp_const_none } },
+ { MP_QSTR_height, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 0 } },
+ };
+ mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
+ mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
+
+ // Because interrupt handlers point directly at protomatter objects,
+ // it is NOT okay to move them to the long-lived pool later. Allocate
+ // them there to begin with, since generally they'll be long-lived anyway.
+ protomatter_protomatter_obj_t *self = &allocate_display_bus_or_raise()->protomatter;
+ self->base.type = &protomatter_Protomatter_type;
+
+ uint8_t rgb_count, addr_count;
+ uint8_t rgb_pins[MP_ARRAY_SIZE(self->rgb_pins)];
+ uint8_t addr_pins[MP_ARRAY_SIZE(self->addr_pins)];
+ uint8_t clock_pin = validate_pin(args[ARG_clock_pin].u_obj);
+ uint8_t latch_pin = validate_pin(args[ARG_latch_pin].u_obj);
+ uint8_t output_enable_pin = validate_pin(args[ARG_output_enable_pin].u_obj);
+
+ validate_pins(MP_QSTR_rgb_pins, rgb_pins, MP_ARRAY_SIZE(self->rgb_pins), args[ARG_rgb_list].u_obj, &rgb_count);
+ validate_pins(MP_QSTR_addr_pins, addr_pins, MP_ARRAY_SIZE(self->addr_pins), args[ARG_addr_list].u_obj, &addr_count);
+
+ if (rgb_count % 6) {
+ mp_raise_ValueError_varg(translate("Must use a multiple of 6 rgb pins, not %d"), rgb_count);
+ }
+
+ // TODO(@jepler) Use fewer than all rows of pixels if height < computed_height
+ if (args[ARG_height].u_int != 0) {
+ int computed_height = (rgb_count / 3) << (addr_count);
+ if (computed_height != args[ARG_height].u_int) {
+ mp_raise_ValueError_varg(
+ translate("%d address pins and %d rgb pins indicate a height of %d, not %d"), addr_count, rgb_count, computed_height, args[ARG_height].u_int);
+ }
+ }
+
+ preflight_pins_or_throw(clock_pin, rgb_pins, rgb_count, true);
+
+ mp_obj_t framebuffer = args[ARG_framebuffer].u_obj;
+ if (framebuffer == mp_const_none) {
+ int width = args[ARG_width].u_int;
+ int bufsize = 2 * width * rgb_count / 3 * (1 << addr_count);
+ framebuffer = mp_obj_new_bytearray_of_zeros(bufsize);
+ }
+
+ common_hal_protomatter_protomatter_construct(self,
+ args[ARG_width].u_int,
+ args[ARG_bit_depth].u_int,
+ rgb_count, rgb_pins,
+ addr_count, addr_pins,
+ clock_pin, latch_pin, output_enable_pin,
+ args[ARG_doublebuffer].u_bool,
+ framebuffer, NULL);
+
+ claim_and_never_reset_pins(args[ARG_rgb_list].u_obj);
+ claim_and_never_reset_pins(args[ARG_addr_list].u_obj);
+ claim_and_never_reset_pin(args[ARG_clock_pin].u_obj);
+ claim_and_never_reset_pin(args[ARG_output_enable_pin].u_obj);
+ claim_and_never_reset_pin(args[ARG_latch_pin].u_obj);
+
+ return MP_OBJ_FROM_PTR(self);
+}
+
+//| .. method:: deinit
+//|
+//| Free the resources (pins, timers, etc.) associated with this
+//| protomatter instance. After deinitialization, no further operations
+//| may be performed.
+//|
+STATIC mp_obj_t protomatter_protomatter_deinit(mp_obj_t self_in) {
+ protomatter_protomatter_obj_t *self = (protomatter_protomatter_obj_t*)self_in;
+ common_hal_protomatter_protomatter_deinit(self);
+ return mp_const_none;
+}
+
+STATIC MP_DEFINE_CONST_FUN_OBJ_1(protomatter_protomatter_deinit_obj, protomatter_protomatter_deinit);
+
+static void check_for_deinit(protomatter_protomatter_obj_t *self) {
+ if (!self->core.rgbPins) {
+ raise_deinited_error();
+ }
+}
+
+//| .. attribute:: brightness
+//|
+//| In the current implementation, 0.0 turns the display off entirely
+//| and any other value up to 1.0 turns the display on fully.
+//|
+STATIC mp_obj_t protomatter_protomatter_get_brightness(mp_obj_t self_in) {
+ protomatter_protomatter_obj_t *self = (protomatter_protomatter_obj_t*)self_in;
+ check_for_deinit(self);
+ return mp_obj_new_float(common_hal_protomatter_protomatter_get_paused(self)? 0.0f : 1.0f);
+}
+MP_DEFINE_CONST_FUN_OBJ_1(protomatter_protomatter_get_brightness_obj, protomatter_protomatter_get_brightness);
+
+STATIC mp_obj_t protomatter_protomatter_set_brightness(mp_obj_t self_in, mp_obj_t value_in) {
+ protomatter_protomatter_obj_t *self = (protomatter_protomatter_obj_t*)self_in;
+ check_for_deinit(self);
+ mp_float_t brightness = mp_obj_get_float(value_in);
+ if (brightness < 0.0f || brightness > 1.0f) {
+ mp_raise_ValueError(translate("Brightness must be 0-1.0"));
+ }
+ common_hal_protomatter_protomatter_set_paused(self_in, brightness <= 0);
+
+ return mp_const_none;
+}
+MP_DEFINE_CONST_FUN_OBJ_2(protomatter_protomatter_set_brightness_obj, protomatter_protomatter_set_brightness);
+
+const mp_obj_property_t protomatter_protomatter_brightness_obj = {
+ .base.type = &mp_type_property,
+ .proxy = {(mp_obj_t)&protomatter_protomatter_get_brightness_obj,
+ (mp_obj_t)&protomatter_protomatter_set_brightness_obj,
+ (mp_obj_t)&mp_const_none_obj},
+};
+
+//| .. method:: refresh()
+//|
+//| Transmits the color data in the buffer to the pixels so that
+//| they are shown.
+//|
+STATIC mp_obj_t protomatter_protomatter_refresh(mp_obj_t self_in) {
+ protomatter_protomatter_obj_t *self = (protomatter_protomatter_obj_t*)self_in;
+ check_for_deinit(self);
+ common_hal_protomatter_protomatter_refresh(self);
+ return mp_const_none;
+}
+MP_DEFINE_CONST_FUN_OBJ_1(protomatter_protomatter_refresh_obj, protomatter_protomatter_refresh);
+
+STATIC const mp_rom_map_elem_t protomatter_protomatter_locals_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&protomatter_protomatter_deinit_obj) },
+ { MP_ROM_QSTR(MP_QSTR_brightness), MP_ROM_PTR(&protomatter_protomatter_brightness_obj) },
+ { MP_ROM_QSTR(MP_QSTR_refresh), MP_ROM_PTR(&protomatter_protomatter_refresh_obj) },
+};
+STATIC MP_DEFINE_CONST_DICT(protomatter_protomatter_locals_dict, protomatter_protomatter_locals_dict_table);
+
+STATIC void protomatter_protomatter_get_bufinfo(mp_obj_t self_in, mp_buffer_info_t *bufinfo) {
+ protomatter_protomatter_obj_t *self = (protomatter_protomatter_obj_t*)self_in;
+ check_for_deinit(self);
+
+ *bufinfo = self->bufinfo;
+}
+
+// These version exists so that the prototype matches the protocol,
+// avoiding a type cast that can hide errors
+STATIC void protomatter_protomatter_swapbuffers(mp_obj_t self_in) {
+ common_hal_protomatter_protomatter_refresh(self_in);
+}
+
+STATIC void protomatter_protomatter_deinit_proto(mp_obj_t self_in) {
+ common_hal_protomatter_protomatter_deinit(self_in);
+}
+
+STATIC float protomatter_protomatter_get_brightness_proto(mp_obj_t self_in) {
+ return common_hal_protomatter_protomatter_get_paused(self_in) ? 0.0f : 1.0f;
+}
+
+STATIC bool protomatter_protomatter_set_brightness_proto(mp_obj_t self_in, mp_float_t value) {
+ common_hal_protomatter_protomatter_set_paused(self_in, value <= 0);
+ return true;
+}
+
+STATIC const framebuffer_p_t protomatter_protomatter_proto = {
+ MP_PROTO_IMPLEMENT(MP_QSTR_protocol_framebuffer)
+ .get_bufinfo = protomatter_protomatter_get_bufinfo,
+ .set_brightness = protomatter_protomatter_set_brightness_proto,
+ .get_brightness = protomatter_protomatter_get_brightness_proto,
+ .swapbuffers = protomatter_protomatter_swapbuffers,
+ .deinit = protomatter_protomatter_deinit_proto,
+};
+
+STATIC mp_int_t protomatter_protomatter_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) {
+ protomatter_protomatter_obj_t *self = (protomatter_protomatter_obj_t*)self_in;
+ // a readonly framebuffer would be unusual but not impossible
+ if ((flags & MP_BUFFER_WRITE) && !(self->bufinfo.typecode & MP_OBJ_ARRAY_TYPECODE_FLAG_RW)) {
+ return 1;
+ }
+ *bufinfo = self->bufinfo;
+ return 0;
+}
+
+const mp_obj_type_t protomatter_Protomatter_type = {
+ { &mp_type_type },
+ .name = MP_QSTR_Protomatter,
+ .buffer_p = { .get_buffer = protomatter_protomatter_get_buffer, },
+ .make_new = protomatter_protomatter_make_new,
+ .protocol = &protomatter_protomatter_proto,
+ .locals_dict = (mp_obj_dict_t*)&protomatter_protomatter_locals_dict,
+};
diff --git a/shared-bindings/_protomatter/Protomatter.h b/shared-bindings/_protomatter/Protomatter.h
new file mode 100644
index 000000000..9499da22c
--- /dev/null
+++ b/shared-bindings/_protomatter/Protomatter.h
@@ -0,0 +1,59 @@
+/*
+ * This file is part of the Micro Python project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Jeff Epler 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.
+ */
+
+#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_PROTOMATTER_PROTOMATTER_H
+#define MICROPY_INCLUDED_SHARED_BINDINGS_PROTOMATTER_PROTOMATTER_H
+
+#include "shared-module/_protomatter/Protomatter.h"
+#include "lib/protomatter/core.h"
+
+extern const mp_obj_type_t protomatter_Protomatter_type;
+typedef struct {
+ mp_obj_base_t base;
+ mp_obj_t framebuffer;
+ mp_buffer_info_t bufinfo;
+ Protomatter_core core;
+ void *timer;
+ uint16_t bufsize, width;
+ uint8_t rgb_pins[30];
+ uint8_t addr_pins[10];
+ uint8_t clock_pin, latch_pin, oe_pin;
+ uint8_t rgb_count, addr_count;
+ uint8_t bit_depth;
+ bool core_is_initialized;
+ bool paused;
+ bool doublebuffer;
+} protomatter_protomatter_obj_t;
+
+void common_hal_protomatter_protomatter_construct(protomatter_protomatter_obj_t* self, int width, int bit_depth, uint8_t rgb_count, uint8_t* rgb_pins, uint8_t addr_count, uint8_t* addr_pins, uint8_t clock_pin, uint8_t latch_pin, uint8_t oe_pin, bool doublebuffer, mp_obj_t framebuffer, void* timer);
+void common_hal_protomatter_protomatter_deinit(protomatter_protomatter_obj_t*);
+void protomatter_protomatter_collect_ptrs(protomatter_protomatter_obj_t*);
+void common_hal_protomatter_protomatter_reconstruct(protomatter_protomatter_obj_t* self, mp_obj_t framebuffer);
+void common_hal_protomatter_protomatter_set_paused(protomatter_protomatter_obj_t* self, bool paused);
+bool common_hal_protomatter_protomatter_get_paused(protomatter_protomatter_obj_t* self);
+void common_hal_protomatter_protomatter_refresh(protomatter_protomatter_obj_t* self);
+
+#endif
diff --git a/shared-bindings/_protomatter/__init__.c b/shared-bindings/_protomatter/__init__.c
new file mode 100644
index 000000000..2281b15f1
--- /dev/null
+++ b/shared-bindings/_protomatter/__init__.c
@@ -0,0 +1,55 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Jeff Epler 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 <stdint.h>
+
+#include "py/obj.h"
+#include "py/runtime.h"
+
+#include "shared-bindings/_protomatter/Protomatter.h"
+
+//| :mod:`_protomatter` --- Low-level routines for bitbanged LED matrices
+//| =====================================================================
+//|
+//| .. module:: _protomatter
+//| :synopsis: Low-level routines for bitbanged LED matrices
+//|
+//| .. toctree::
+//| :maxdepth: 3
+//|
+//| Protomatter
+
+STATIC const mp_rom_map_elem_t protomatter_module_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__protomatter) },
+ { MP_ROM_QSTR(MP_QSTR_Protomatter), MP_ROM_PTR(&protomatter_Protomatter_type) },
+};
+
+STATIC MP_DEFINE_CONST_DICT(protomatter_module_globals, protomatter_module_globals_table);
+
+const mp_obj_module_t protomatter_module = {
+ .base = { &mp_type_module },
+ .globals = (mp_obj_dict_t*)&protomatter_module_globals,
+};
diff --git a/shared-bindings/analogio/AnalogIn.c b/shared-bindings/analogio/AnalogIn.c
index 9a9b525d8..b4eeb2af1 100644
--- a/shared-bindings/analogio/AnalogIn.c
+++ b/shared-bindings/analogio/AnalogIn.c
@@ -63,16 +63,13 @@ STATIC mp_obj_t analogio_analogin_make_new(const mp_obj_type_t *type,
mp_arg_check_num(n_args, kw_args, 1, 1, false);
// 1st argument is the pin
- mp_obj_t pin_obj = args[0];
- assert_pin(pin_obj, false);
+ const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[0]);
analogio_analogin_obj_t *self = m_new_obj(analogio_analogin_obj_t);
self->base.type = &analogio_analogin_type;
- const mcu_pin_obj_t *pin = MP_OBJ_TO_PTR(pin_obj);
- assert_pin_free(pin);
common_hal_analogio_analogin_construct(self, pin);
- return (mp_obj_t) self;
+ return MP_OBJ_FROM_PTR(self);
}
//| .. method:: deinit()
@@ -141,7 +138,7 @@ STATIC mp_obj_t analogio_analogin_obj_get_reference_voltage(mp_obj_t self_in) {
float reference_voltage = common_hal_analogio_analogin_get_reference_voltage(self);
if (reference_voltage <= 0.0f) {
- return mp_const_none;
+ return mp_const_none;
} else {
return mp_obj_new_float(reference_voltage);
}
diff --git a/shared-bindings/analogio/AnalogOut.c b/shared-bindings/analogio/AnalogOut.c
index 0816da465..89cf147b2 100644
--- a/shared-bindings/analogio/AnalogOut.c
+++ b/shared-bindings/analogio/AnalogOut.c
@@ -62,15 +62,13 @@ STATIC mp_obj_t analogio_analogout_make_new(const mp_obj_type_t *type, mp_uint_t
// check arguments
mp_arg_check_num(n_args, kw_args, 1, 1, false);
- assert_pin(args[0], false);
- const mcu_pin_obj_t *pin = MP_OBJ_TO_PTR(args[0]);
+ const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[0]);
analogio_analogout_obj_t *self = m_new_obj(analogio_analogout_obj_t);
self->base.type = &analogio_analogout_type;
- assert_pin_free(pin);
common_hal_analogio_analogout_construct(self, pin);
- return self;
+ return MP_OBJ_FROM_PTR(self);
}
//| .. method:: deinit()
diff --git a/shared-bindings/audiobusio/I2SOut.c b/shared-bindings/audiobusio/I2SOut.c
index 8f7382fde..cd662acb5 100644
--- a/shared-bindings/audiobusio/I2SOut.c
+++ b/shared-bindings/audiobusio/I2SOut.c
@@ -105,17 +105,9 @@ STATIC mp_obj_t audiobusio_i2sout_make_new(const mp_obj_type_t *type, size_t n_a
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
- mp_obj_t bit_clock_obj = args[ARG_bit_clock].u_obj;
- assert_pin(bit_clock_obj, false);
- const mcu_pin_obj_t *bit_clock = MP_OBJ_TO_PTR(bit_clock_obj);
-
- mp_obj_t word_select_obj = args[ARG_word_select].u_obj;
- assert_pin(word_select_obj, false);
- const mcu_pin_obj_t *word_select = MP_OBJ_TO_PTR(word_select_obj);
-
- mp_obj_t data_obj = args[ARG_data].u_obj;
- assert_pin(data_obj, false);
- const mcu_pin_obj_t *data = MP_OBJ_TO_PTR(data_obj);
+ const mcu_pin_obj_t *bit_clock = validate_obj_is_free_pin(args[ARG_bit_clock].u_obj);
+ const mcu_pin_obj_t *word_select = validate_obj_is_free_pin(args[ARG_word_select].u_obj);
+ const mcu_pin_obj_t *data = validate_obj_is_free_pin(args[ARG_data].u_obj);
audiobusio_i2sout_obj_t *self = m_new_obj_with_finaliser(audiobusio_i2sout_obj_t);
self->base.type = &audiobusio_i2sout_type;
diff --git a/shared-bindings/audiobusio/PDMIn.c b/shared-bindings/audiobusio/PDMIn.c
index 0c92c2478..fce6cf7a2 100644
--- a/shared-bindings/audiobusio/PDMIn.c
+++ b/shared-bindings/audiobusio/PDMIn.c
@@ -104,15 +104,8 @@ STATIC mp_obj_t audiobusio_pdmin_make_new(const mp_obj_type_t *type, size_t n_ar
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
- mp_obj_t clock_pin_obj = args[ARG_clock_pin].u_obj;
- assert_pin(clock_pin_obj, false);
- const mcu_pin_obj_t *clock_pin = MP_OBJ_TO_PTR(clock_pin_obj);
- assert_pin_free(clock_pin);
-
- mp_obj_t data_pin_obj = args[ARG_data_pin].u_obj;
- assert_pin(data_pin_obj, false);
- const mcu_pin_obj_t *data_pin = MP_OBJ_TO_PTR(data_pin_obj);
- assert_pin_free(data_pin);
+ const mcu_pin_obj_t *clock_pin = validate_obj_is_free_pin(args[ARG_clock_pin].u_obj);
+ const mcu_pin_obj_t *data_pin = validate_obj_is_free_pin(args[ARG_data_pin].u_obj);
// create PDMIn object from the given pin
audiobusio_pdmin_obj_t *self = m_new_obj(audiobusio_pdmin_obj_t);
diff --git a/shared-bindings/audiocore/RawSample.c b/shared-bindings/audiocore/RawSample.c
index 87d410ea1..96af58a4f 100644
--- a/shared-bindings/audiocore/RawSample.c
+++ b/shared-bindings/audiocore/RawSample.c
@@ -49,7 +49,7 @@
//| first sample will be for channel 1, the second sample will be for channel two, the third for
//| channel 1 and so on.
//|
-//| :param array buffer: An `array.array` with samples
+//| :param array.array buffer: An `array.array` with samples
//| :param int channel_count: The number of channels in the buffer
//| :param int sample_rate: The desired playback sample rate
//|
diff --git a/shared-bindings/audioio/AudioOut.c b/shared-bindings/audioio/AudioOut.c
index eb4ef1fc6..ea1efcdff 100644
--- a/shared-bindings/audioio/AudioOut.c
+++ b/shared-bindings/audioio/AudioOut.c
@@ -104,16 +104,8 @@ STATIC mp_obj_t audioio_audioout_make_new(const mp_obj_type_t *type, size_t n_ar
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
- mp_obj_t left_channel_obj = args[ARG_left_channel].u_obj;
- assert_pin(left_channel_obj, false);
- const mcu_pin_obj_t *left_channel_pin = MP_OBJ_TO_PTR(left_channel_obj);
-
- mp_obj_t right_channel_obj = args[ARG_right_channel].u_obj;
- const mcu_pin_obj_t *right_channel_pin = NULL;
- if (right_channel_obj != mp_const_none) {
- assert_pin(right_channel_obj, false);
- right_channel_pin = MP_OBJ_TO_PTR(right_channel_obj);
- }
+ const mcu_pin_obj_t *left_channel_pin = validate_obj_is_free_pin(args[ARG_left_channel].u_obj);
+ const mcu_pin_obj_t *right_channel_pin = validate_obj_is_free_pin_or_none(args[ARG_right_channel].u_obj);
// create AudioOut object from the given pin
audioio_audioout_obj_t *self = m_new_obj(audioio_audioout_obj_t);
diff --git a/shared-bindings/audiopwmio/PWMAudioOut.c b/shared-bindings/audiopwmio/PWMAudioOut.c
index 60bf08500..9fa2b1578 100644
--- a/shared-bindings/audiopwmio/PWMAudioOut.c
+++ b/shared-bindings/audiopwmio/PWMAudioOut.c
@@ -107,16 +107,8 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_make_new(const mp_obj_type_t *type, size_
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
- mp_obj_t left_channel_obj = args[ARG_left_channel].u_obj;
- assert_pin(left_channel_obj, false);
- const mcu_pin_obj_t *left_channel_pin = MP_OBJ_TO_PTR(left_channel_obj);
-
- mp_obj_t right_channel_obj = args[ARG_right_channel].u_obj;
- const mcu_pin_obj_t *right_channel_pin = NULL;
- if (right_channel_obj != mp_const_none) {
- assert_pin(right_channel_obj, false);
- right_channel_pin = MP_OBJ_TO_PTR(right_channel_obj);
- }
+ const mcu_pin_obj_t *left_channel_pin = validate_obj_is_free_pin(args[ARG_left_channel].u_obj);
+ const mcu_pin_obj_t *right_channel_pin = validate_obj_is_free_pin_or_none(args[ARG_right_channel].u_obj);
// create AudioOut object from the given pin
audiopwmio_pwmaudioout_obj_t *self = m_new_obj(audiopwmio_pwmaudioout_obj_t);
diff --git a/shared-bindings/bitbangio/I2C.c b/shared-bindings/bitbangio/I2C.c
index 01a128393..3c4f13777 100644
--- a/shared-bindings/bitbangio/I2C.c
+++ b/shared-bindings/bitbangio/I2C.c
@@ -63,10 +63,9 @@ STATIC mp_obj_t bitbangio_i2c_make_new(const mp_obj_type_t *type, size_t n_args,
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
- assert_pin(args[ARG_scl].u_obj, false);
- assert_pin(args[ARG_sda].u_obj, false);
- const mcu_pin_obj_t* scl = MP_OBJ_TO_PTR(args[ARG_scl].u_obj);
- const mcu_pin_obj_t* sda = MP_OBJ_TO_PTR(args[ARG_sda].u_obj);
+
+ const mcu_pin_obj_t* scl = validate_obj_is_free_pin(args[ARG_scl].u_obj);
+ const mcu_pin_obj_t* sda = validate_obj_is_free_pin(args[ARG_sda].u_obj);
bitbangio_i2c_obj_t *self = m_new_obj(bitbangio_i2c_obj_t);
self->base.type = &bitbangio_i2c_type;
diff --git a/shared-bindings/bitbangio/OneWire.c b/shared-bindings/bitbangio/OneWire.c
index 73bedcd8d..95bbd0679 100644
--- a/shared-bindings/bitbangio/OneWire.c
+++ b/shared-bindings/bitbangio/OneWire.c
@@ -69,9 +69,8 @@ STATIC mp_obj_t bitbangio_onewire_make_new(const mp_obj_type_t *type, size_t n_a
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
- assert_pin(args[ARG_pin].u_obj, false);
- const mcu_pin_obj_t* pin = MP_OBJ_TO_PTR(args[ARG_pin].u_obj);
- assert_pin_free(pin);
+
+ const mcu_pin_obj_t* pin = validate_obj_is_free_pin(args[ARG_pin].u_obj);
bitbangio_onewire_obj_t *self = m_new_obj(bitbangio_onewire_obj_t);
self->base.type = &bitbangio_onewire_type;
diff --git a/shared-bindings/bitbangio/SPI.c b/shared-bindings/bitbangio/SPI.c
index 9a51bde66..b1a94c184 100644
--- a/shared-bindings/bitbangio/SPI.c
+++ b/shared-bindings/bitbangio/SPI.c
@@ -71,12 +71,10 @@ STATIC mp_obj_t bitbangio_spi_make_new(const mp_obj_type_t *type, size_t n_args,
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
- assert_pin(args[ARG_clock].u_obj, false);
- assert_pin(args[ARG_MOSI].u_obj, true);
- assert_pin(args[ARG_MISO].u_obj, true);
- const mcu_pin_obj_t* clock = MP_OBJ_TO_PTR(args[ARG_clock].u_obj);
- const mcu_pin_obj_t* mosi = MP_OBJ_TO_PTR(args[ARG_MOSI].u_obj);
- const mcu_pin_obj_t* miso = MP_OBJ_TO_PTR(args[ARG_MISO].u_obj);
+
+ const mcu_pin_obj_t* clock = validate_obj_is_free_pin(args[ARG_clock].u_obj);
+ const mcu_pin_obj_t* mosi = validate_obj_is_free_pin_or_none(args[ARG_MOSI].u_obj);
+ const mcu_pin_obj_t* miso = validate_obj_is_free_pin_or_none(args[ARG_MISO].u_obj);
bitbangio_spi_obj_t *self = m_new_obj(bitbangio_spi_obj_t);
self->base.type = &bitbangio_spi_type;
diff --git a/shared-bindings/busio/I2C.c b/shared-bindings/busio/I2C.c
index 50a95beb2..c89215acd 100644
--- a/shared-bindings/busio/I2C.c
+++ b/shared-bindings/busio/I2C.c
@@ -76,12 +76,10 @@ STATIC mp_obj_t busio_i2c_make_new(const mp_obj_type_t *type, size_t n_args, con
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
- assert_pin(args[ARG_scl].u_obj, false);
- assert_pin(args[ARG_sda].u_obj, false);
- const mcu_pin_obj_t* scl = MP_OBJ_TO_PTR(args[ARG_scl].u_obj);
- assert_pin_free(scl);
- const mcu_pin_obj_t* sda = MP_OBJ_TO_PTR(args[ARG_sda].u_obj);
- assert_pin_free(sda);
+
+ const mcu_pin_obj_t* scl = validate_obj_is_free_pin(args[ARG_scl].u_obj);
+ const mcu_pin_obj_t* sda = validate_obj_is_free_pin(args[ARG_sda].u_obj);
+
common_hal_busio_i2c_construct(self, scl, sda, args[ARG_frequency].u_int, args[ARG_timeout].u_int);
return (mp_obj_t)self;
}
diff --git a/shared-bindings/busio/OneWire.c b/shared-bindings/busio/OneWire.c
index aca2a3ef2..022d6afcf 100644
--- a/shared-bindings/busio/OneWire.c
+++ b/shared-bindings/busio/OneWire.c
@@ -69,9 +69,7 @@ STATIC mp_obj_t busio_onewire_make_new(const mp_obj_type_t *type, size_t n_args,
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
- assert_pin(args[ARG_pin].u_obj, false);
- const mcu_pin_obj_t* pin = MP_OBJ_TO_PTR(args[ARG_pin].u_obj);
- assert_pin_free(pin);
+ const mcu_pin_obj_t* pin = validate_obj_is_free_pin(args[ARG_pin].u_obj);
busio_onewire_obj_t *self = m_new_obj(busio_onewire_obj_t);
self->base.type = &busio_onewire_type;
diff --git a/shared-bindings/busio/SPI.c b/shared-bindings/busio/SPI.c
index d1791bef3..043c1089d 100644
--- a/shared-bindings/busio/SPI.c
+++ b/shared-bindings/busio/SPI.c
@@ -57,6 +57,13 @@
//|
//| Construct an SPI object on the given pins.
//|
+//| ..note:: The SPI peripherals allocated in order of desirability, if possible,
+//| such as highest speed and not shared use first. For instance, on the nRF52840,
+//| there is a single 32MHz SPI peripheral, and multiple 8MHz peripherals,
+//| some of which may also be used for I2C. The 32MHz SPI peripheral is returned
+//| first, then the exclusive 8MHz SPI peripheral, and finally the shared 8MHz
+//| peripherals.
+//|
//| .. seealso:: Using this class directly requires careful lock management.
//| Instead, use :class:`~adafruit_bus_device.spi_device.SPIDevice` to
//| manage locks.
@@ -82,17 +89,13 @@ STATIC mp_obj_t busio_spi_make_new(const mp_obj_type_t *type, size_t n_args, con
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
- assert_pin(args[ARG_clock].u_obj, false);
- assert_pin(args[ARG_MOSI].u_obj, true);
- assert_pin(args[ARG_MISO].u_obj, true);
- const mcu_pin_obj_t* clock = MP_OBJ_TO_PTR(args[ARG_clock].u_obj);
- assert_pin_free(clock);
- const mcu_pin_obj_t* mosi = MP_OBJ_TO_PTR(args[ARG_MOSI].u_obj);
- assert_pin_free(mosi);
- const mcu_pin_obj_t* miso = MP_OBJ_TO_PTR(args[ARG_MISO].u_obj);
- assert_pin_free(miso);
+
+ const mcu_pin_obj_t* clock = validate_obj_is_free_pin(args[ARG_clock].u_obj);
+ const mcu_pin_obj_t* mosi = validate_obj_is_free_pin_or_none(args[ARG_MOSI].u_obj);
+ const mcu_pin_obj_t* miso = validate_obj_is_free_pin_or_none(args[ARG_MISO].u_obj);
+
common_hal_busio_spi_construct(self, clock, mosi, miso);
- return (mp_obj_t)self;
+ return MP_OBJ_FROM_PTR(self);
}
//| .. method:: deinit()
diff --git a/shared-bindings/busio/UART.c b/shared-bindings/busio/UART.c
index 1fc81e78e..f231924d5 100644
--- a/shared-bindings/busio/UART.c
+++ b/shared-bindings/busio/UART.c
@@ -53,6 +53,10 @@
//|
//| :param ~microcontroller.Pin tx: the pin to transmit with, or ``None`` if this ``UART`` is receive-only.
//| :param ~microcontroller.Pin rx: the pin to receive on, or ``None`` if this ``UART`` is transmit-only.
+//| :param ~microcontroller.Pin rts: the pin for rts, or ``None`` if rts not in use.
+//| :param ~microcontroller.Pin cts: the pin for cts, or ``None`` if cts not in use.
+//| :param ~microcontroller.Pin rs485_dir: the pin for rs485 direction setting, or ``None`` if rs485 not in use.
+//| :param bool rs485_invert: set to invert the sense of the rs485_dir pin.
//| :param int baudrate: the transmit and receive speed.
//| :param int bits: the number of bits per byte, 7, 8 or 9.
//| :param Parity parity: the parity used for error checking.
@@ -82,7 +86,8 @@ STATIC mp_obj_t busio_uart_make_new(const mp_obj_type_t *type, size_t n_args, co
// https://github.com/adafruit/circuitpython/issues/1056)
busio_uart_obj_t *self = m_new_ll_obj(busio_uart_obj_t);
self->base.type = &busio_uart_type;
- enum { ARG_tx, ARG_rx, ARG_baudrate, ARG_bits, ARG_parity, ARG_stop, ARG_timeout, ARG_receiver_buffer_size};
+ enum { ARG_tx, ARG_rx, ARG_baudrate, ARG_bits, ARG_parity, ARG_stop, ARG_timeout, ARG_receiver_buffer_size,
+ ARG_rts, ARG_cts, ARG_rs485_dir,ARG_rs485_invert};
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_tx, MP_ARG_REQUIRED | MP_ARG_OBJ },
{ MP_QSTR_rx, MP_ARG_REQUIRED | MP_ARG_OBJ },
@@ -92,17 +97,20 @@ STATIC mp_obj_t busio_uart_make_new(const mp_obj_type_t *type, size_t n_args, co
{ MP_QSTR_stop, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} },
{ MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NEW_SMALL_INT(1)} },
{ MP_QSTR_receiver_buffer_size, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 64} },
+ { MP_QSTR_rts, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
+ { MP_QSTR_cts, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
+ { MP_QSTR_rs485_dir, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none } },
+ { MP_QSTR_rs485_invert, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false } },
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
- assert_pin(args[ARG_rx].u_obj, true);
- const mcu_pin_obj_t* rx = MP_OBJ_TO_PTR(args[ARG_rx].u_obj);
- assert_pin_free(rx);
+ const mcu_pin_obj_t* rx = validate_obj_is_free_pin_or_none(args[ARG_rx].u_obj);
+ const mcu_pin_obj_t* tx = validate_obj_is_free_pin_or_none(args[ARG_tx].u_obj);
- assert_pin(args[ARG_tx].u_obj, true);
- const mcu_pin_obj_t* tx = MP_OBJ_TO_PTR(args[ARG_tx].u_obj);
- assert_pin_free(tx);
+ if ( (tx == NULL) && (rx == NULL) ) {
+ mp_raise_ValueError(translate("tx and rx cannot both be None"));
+ }
uint8_t bits = args[ARG_bits].u_int;
if (bits < 7 || bits > 9) {
@@ -124,7 +132,13 @@ STATIC mp_obj_t busio_uart_make_new(const mp_obj_type_t *type, size_t n_args, co
mp_float_t timeout = mp_obj_get_float(args[ARG_timeout].u_obj);
validate_timeout(timeout);
- common_hal_busio_uart_construct(self, tx, rx,
+ const mcu_pin_obj_t* rts = validate_obj_is_free_pin_or_none(args[ARG_rts].u_obj);
+ const mcu_pin_obj_t* cts = validate_obj_is_free_pin_or_none(args[ARG_cts].u_obj);
+ const mcu_pin_obj_t* rs485_dir = validate_obj_is_free_pin_or_none(args[ARG_rs485_dir].u_obj);
+
+ const bool rs485_invert = args[ARG_rs485_invert].u_bool;
+
+ common_hal_busio_uart_construct(self, tx, rx, rts, cts, rs485_dir, rs485_invert,
args[ARG_baudrate].u_int, bits, parity, stop, timeout,
args[ARG_receiver_buffer_size].u_int);
return (mp_obj_t)self;
diff --git a/shared-bindings/busio/UART.h b/shared-bindings/busio/UART.h
index cfd2c800c..fe71e8668 100644
--- a/shared-bindings/busio/UART.h
+++ b/shared-bindings/busio/UART.h
@@ -40,9 +40,11 @@ typedef enum {
// Construct an underlying UART object.
extern void common_hal_busio_uart_construct(busio_uart_obj_t *self,
- const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx, uint32_t baudrate,
- uint8_t bits, uart_parity_t parity, uint8_t stop, mp_float_t timeout,
- uint16_t receiver_buffer_size);
+ const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx,
+ const mcu_pin_obj_t * rts, const mcu_pin_obj_t * cts,
+ const mcu_pin_obj_t * rs485_dir, bool rs485_invert,
+ uint32_t baudrate, uint8_t bits, uart_parity_t parity, uint8_t stop,
+ mp_float_t timeout, uint16_t receiver_buffer_size);
extern void common_hal_busio_uart_deinit(busio_uart_obj_t *self);
extern bool common_hal_busio_uart_deinited(busio_uart_obj_t *self);
diff --git a/shared-bindings/digitalio/DigitalInOut.c b/shared-bindings/digitalio/DigitalInOut.c
index 16472c12c..39da00cf7 100644
--- a/shared-bindings/digitalio/DigitalInOut.c
+++ b/shared-bindings/digitalio/DigitalInOut.c
@@ -68,12 +68,10 @@ STATIC mp_obj_t digitalio_digitalinout_make_new(const mp_obj_type_t *type,
digitalio_digitalinout_obj_t *self = m_new_obj(digitalio_digitalinout_obj_t);
self->base.type = &digitalio_digitalinout_type;
- assert_pin(args[0], false);
- mcu_pin_obj_t *pin = MP_OBJ_TO_PTR(args[0]);
- assert_pin_free(pin);
+ mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[0]);
common_hal_digitalio_digitalinout_construct(self, pin);
- return (mp_obj_t)self;
+ return MP_OBJ_FROM_PTR(self);
}
//| .. method:: deinit()
diff --git a/shared-bindings/displayio/Bitmap.c b/shared-bindings/displayio/Bitmap.c
index 91c17f2d1..391f3e595 100644
--- a/shared-bindings/displayio/Bitmap.c
+++ b/shared-bindings/displayio/Bitmap.c
@@ -178,9 +178,28 @@ STATIC mp_obj_t bitmap_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t val
return mp_const_none;
}
+//| .. method:: fill(value)
+//|
+//| Fills the bitmap with the supplied palette index value.
+//|
+STATIC mp_obj_t displayio_bitmap_obj_fill(mp_obj_t self_in, mp_obj_t value_obj) {
+ displayio_bitmap_t *self = MP_OBJ_TO_PTR(self_in);
+
+ mp_int_t value = mp_obj_get_int(value_obj);
+ if (value >= 1 << common_hal_displayio_bitmap_get_bits_per_value(self)) {
+ mp_raise_ValueError(translate("pixel value requires too many bits"));
+ }
+ common_hal_displayio_bitmap_fill(self, value);
+
+ return mp_const_none;
+}
+MP_DEFINE_CONST_FUN_OBJ_2(displayio_bitmap_fill_obj, displayio_bitmap_obj_fill);
+
STATIC const mp_rom_map_elem_t displayio_bitmap_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&displayio_bitmap_height_obj) },
{ MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&displayio_bitmap_width_obj) },
+ { MP_ROM_QSTR(MP_QSTR_fill), MP_ROM_PTR(&displayio_bitmap_fill_obj) },
+
};
STATIC MP_DEFINE_CONST_DICT(displayio_bitmap_locals_dict, displayio_bitmap_locals_dict_table);
diff --git a/shared-bindings/displayio/Bitmap.h b/shared-bindings/displayio/Bitmap.h
index 90694951f..46c337329 100644
--- a/shared-bindings/displayio/Bitmap.h
+++ b/shared-bindings/displayio/Bitmap.h
@@ -41,5 +41,6 @@ uint16_t common_hal_displayio_bitmap_get_width(displayio_bitmap_t *self);
uint32_t common_hal_displayio_bitmap_get_bits_per_value(displayio_bitmap_t *self);
void common_hal_displayio_bitmap_set_pixel(displayio_bitmap_t *bitmap, int16_t x, int16_t y, uint32_t value);
uint32_t common_hal_displayio_bitmap_get_pixel(displayio_bitmap_t *bitmap, int16_t x, int16_t y);
+void common_hal_displayio_bitmap_fill(displayio_bitmap_t *bitmap, uint32_t value);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_BITMAP_H
diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c
index 5759e8ad2..a22b2add2 100644
--- a/shared-bindings/displayio/Display.c
+++ b/shared-bindings/displayio/Display.c
@@ -92,6 +92,7 @@
//| :param bool pixels_in_byte_share_row: True when pixels are less than a byte and a byte includes pixels from the same row of the display. When False, pixels share a column.
//| :param int bytes_per_cell: Number of bytes per addressable memory location when color_depth < 8. When greater than one, bytes share a row or column according to pixels_in_byte_share_row.
//| :param bool reverse_pixels_in_byte: Reverses the pixel order within each byte when color_depth < 8. Does not apply across multiple bytes even if there is more than one byte per cell (bytes_per_cell.)
+//| :param bool reverse_bytes_in_word: Reverses the order of bytes within a word when color_depth == 16
//| :param int set_column_command: Command used to set the start and end columns to update
//| :param int set_row_command: Command used so set the start and end rows to update
//| :param int write_ram_command: Command used to write pixels values into the update region. Ignored if data_as_commands is set.
@@ -104,9 +105,10 @@
//| :param bool data_as_commands: Treat all init and boundary data as SPI commands. Certain displays require this.
//| :param bool auto_refresh: Automatically refresh the screen
//| :param int native_frames_per_second: Number of display refreshes per second that occur with the given init_sequence.
+//| :param bool backlight_on_high: If True, pulling the backlight pin high turns the backlight on.
//|
STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
- enum { ARG_display_bus, ARG_init_sequence, ARG_width, ARG_height, ARG_colstart, ARG_rowstart, ARG_rotation, ARG_color_depth, ARG_grayscale, ARG_pixels_in_byte_share_row, ARG_bytes_per_cell, ARG_reverse_pixels_in_byte, ARG_set_column_command, ARG_set_row_command, ARG_write_ram_command, ARG_set_vertical_scroll, ARG_backlight_pin, ARG_brightness_command, ARG_brightness, ARG_auto_brightness, ARG_single_byte_bounds, ARG_data_as_commands, ARG_auto_refresh, ARG_native_frames_per_second };
+ enum { ARG_display_bus, ARG_init_sequence, ARG_width, ARG_height, ARG_colstart, ARG_rowstart, ARG_rotation, ARG_color_depth, ARG_grayscale, ARG_pixels_in_byte_share_row, ARG_bytes_per_cell, ARG_reverse_pixels_in_byte, ARG_reverse_bytes_in_word, ARG_set_column_command, ARG_set_row_command, ARG_write_ram_command, ARG_set_vertical_scroll, ARG_backlight_pin, ARG_brightness_command, ARG_brightness, ARG_auto_brightness, ARG_single_byte_bounds, ARG_data_as_commands, ARG_auto_refresh, ARG_native_frames_per_second, ARG_backlight_on_high };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_display_bus, MP_ARG_REQUIRED | MP_ARG_OBJ },
{ MP_QSTR_init_sequence, MP_ARG_REQUIRED | MP_ARG_OBJ },
@@ -120,6 +122,7 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a
{ MP_QSTR_pixels_in_byte_share_row, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} },
{ MP_QSTR_bytes_per_cell, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 1} },
{ MP_QSTR_reverse_pixels_in_byte, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} },
+ { MP_QSTR_reverse_bytes_in_word, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} },
{ MP_QSTR_set_column_command, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0x2a} },
{ MP_QSTR_set_row_command, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0x2b} },
{ MP_QSTR_write_ram_command, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0x2c} },
@@ -132,6 +135,7 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a
{ MP_QSTR_data_as_commands, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} },
{ MP_QSTR_auto_refresh, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} },
{ MP_QSTR_native_frames_per_second, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 60} },
+ { MP_QSTR_backlight_on_high, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} },
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
@@ -141,13 +145,7 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(args[ARG_init_sequence].u_obj, &bufinfo, MP_BUFFER_READ);
- mp_obj_t backlight_pin_obj = args[ARG_backlight_pin].u_obj;
- assert_pin(backlight_pin_obj, true);
- const mcu_pin_obj_t* backlight_pin = NULL;
- if (backlight_pin_obj != NULL && backlight_pin_obj != mp_const_none) {
- backlight_pin = MP_OBJ_TO_PTR(backlight_pin_obj);
- assert_pin_free(backlight_pin);
- }
+ const mcu_pin_obj_t* backlight_pin = validate_obj_is_free_pin_or_none(args[ARG_backlight_pin].u_obj);
mp_float_t brightness = mp_obj_get_float(args[ARG_brightness].u_obj);
@@ -156,23 +154,17 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a
mp_raise_ValueError(translate("Display rotation must be in 90 degree increments"));
}
- displayio_display_obj_t *self = NULL;
- for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) {
- if (displays[i].display.base.type == NULL ||
- displays[i].display.base.type == &mp_type_NoneType) {
- self = &displays[i].display;
- break;
- }
- }
- if (self == NULL) {
- mp_raise_RuntimeError(translate("Too many displays"));
- }
+ primary_display_t *disp = allocate_display_or_raise();
+ displayio_display_obj_t *self = &disp->display;;
self->base.type = &displayio_display_type;
common_hal_displayio_display_construct(
self,
display_bus, args[ARG_width].u_int, args[ARG_height].u_int, args[ARG_colstart].u_int, args[ARG_rowstart].u_int, rotation,
args[ARG_color_depth].u_int, args[ARG_grayscale].u_bool,
- args[ARG_pixels_in_byte_share_row].u_bool, args[ARG_bytes_per_cell].u_bool, args[ARG_reverse_pixels_in_byte].u_bool,
+ args[ARG_pixels_in_byte_share_row].u_bool,
+ args[ARG_bytes_per_cell].u_bool,
+ args[ARG_reverse_pixels_in_byte].u_bool,
+ args[ARG_reverse_bytes_in_word].u_bool,
args[ARG_set_column_command].u_int, args[ARG_set_row_command].u_int,
args[ARG_write_ram_command].u_int,
args[ARG_set_vertical_scroll].u_int,
@@ -184,7 +176,8 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a
args[ARG_single_byte_bounds].u_bool,
args[ARG_data_as_commands].u_bool,
args[ARG_auto_refresh].u_bool,
- args[ARG_native_frames_per_second].u_int
+ args[ARG_native_frames_per_second].u_int,
+ args[ARG_backlight_on_high].u_bool
);
return self;
diff --git a/shared-bindings/displayio/Display.h b/shared-bindings/displayio/Display.h
index b82a68ebe..e69c5b6b5 100644
--- a/shared-bindings/displayio/Display.h
+++ b/shared-bindings/displayio/Display.h
@@ -41,11 +41,11 @@ extern const mp_obj_type_t displayio_display_type;
void common_hal_displayio_display_construct(displayio_display_obj_t* self,
mp_obj_t bus, uint16_t width, uint16_t height,
int16_t colstart, int16_t rowstart, uint16_t rotation, uint16_t color_depth, bool grayscale,
- bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte,
+ bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte, bool reverse_bytes_in_word,
uint8_t set_column_command, uint8_t set_row_command, uint8_t write_ram_command, uint8_t set_vertical_scroll,
uint8_t* init_sequence, uint16_t init_sequence_len, const mcu_pin_obj_t* backlight_pin, uint16_t brightness_command,
mp_float_t brightness, bool auto_brightness,
- bool single_byte_bounds, bool data_as_commands, bool auto_refresh, uint16_t native_frames_per_second);
+ bool single_byte_bounds, bool data_as_commands, bool auto_refresh, uint16_t native_frames_per_second, bool backlight_on_high);
bool common_hal_displayio_display_show(displayio_display_obj_t* self,
displayio_group_t* root_group);
diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c
index 81e06f82f..1459c1680 100644
--- a/shared-bindings/displayio/EPaperDisplay.c
+++ b/shared-bindings/displayio/EPaperDisplay.c
@@ -129,30 +129,15 @@ STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size
mp_get_buffer_raise(args[ARG_stop_sequence].u_obj, &stop_bufinfo, MP_BUFFER_READ);
- mp_obj_t busy_pin_obj = args[ARG_busy_pin].u_obj;
- assert_pin(busy_pin_obj, true);
- const mcu_pin_obj_t* busy_pin = NULL;
- if (busy_pin_obj != NULL && busy_pin_obj != mp_const_none) {
- busy_pin = MP_OBJ_TO_PTR(busy_pin_obj);
- assert_pin_free(busy_pin);
- }
+ const mcu_pin_obj_t* busy_pin = validate_obj_is_free_pin_or_none(args[ARG_busy_pin].u_obj);
mp_int_t rotation = args[ARG_rotation].u_int;
if (rotation % 90 != 0) {
mp_raise_ValueError(translate("Display rotation must be in 90 degree increments"));
}
- displayio_epaperdisplay_obj_t *self = NULL;
- for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) {
- if (displays[i].display.base.type == NULL ||
- displays[i].display.base.type == &mp_type_NoneType) {
- self = &displays[i].epaper_display;
- break;
- }
- }
- if (self == NULL) {
- mp_raise_RuntimeError(translate("Too many displays"));
- }
+ primary_display_t *disp = allocate_display_or_raise();
+ displayio_epaperdisplay_obj_t *self = &disp->epaper_display;;
mp_float_t refresh_time = mp_obj_get_float(args[ARG_refresh_time].u_obj);
mp_float_t seconds_per_frame = mp_obj_get_float(args[ARG_seconds_per_frame].u_obj);
diff --git a/shared-bindings/displayio/FourWire.c b/shared-bindings/displayio/FourWire.c
index 51203d460..1cd51b2e2 100644
--- a/shared-bindings/displayio/FourWire.c
+++ b/shared-bindings/displayio/FourWire.c
@@ -46,7 +46,7 @@
//| Manage updating a display over SPI four wire protocol in the background while Python code runs.
//| It doesn't handle display initialization.
//|
-//| .. class:: FourWire(spi_bus, *, command, chip_select, reset=None, baudrate=24000000)
+//| .. class:: FourWire(spi_bus, *, command, chip_select, reset=None, baudrate=24000000, polarity=0, phase=0)
//|
//| Create a FourWire object associated with the given pins.
//|
@@ -60,46 +60,42 @@
//| :param microcontroller.Pin chip_select: Chip select pin
//| :param microcontroller.Pin reset: Reset pin. When None only software reset can be used
//| :param int baudrate: Maximum baudrate in Hz for the display on the bus
+//| :param int polarity: the base state of the clock line (0 or 1)
+//| :param int phase: the edge of the clock that data is captured. First (0)
+//| or second (1). Rising or falling depends on clock polarity.
//|
STATIC mp_obj_t displayio_fourwire_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
- enum { ARG_spi_bus, ARG_command, ARG_chip_select, ARG_reset, ARG_baudrate };
+ enum { ARG_spi_bus, ARG_command, ARG_chip_select, ARG_reset, ARG_baudrate, ARG_polarity, ARG_phase };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_spi_bus, MP_ARG_REQUIRED | MP_ARG_OBJ },
{ MP_QSTR_command, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED },
{ MP_QSTR_chip_select, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED },
{ MP_QSTR_reset, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} },
{ MP_QSTR_baudrate, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 24000000} },
+ { MP_QSTR_polarity, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
+ { MP_QSTR_phase, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
- mp_obj_t command = args[ARG_command].u_obj;
- mp_obj_t chip_select = args[ARG_chip_select].u_obj;
- assert_pin_free(command);
- assert_pin_free(chip_select);
- mp_obj_t reset = args[ARG_reset].u_obj;
- if (reset != mp_const_none) {
- assert_pin_free(reset);
- } else {
- reset = NULL;
- }
+ mcu_pin_obj_t *command = validate_obj_is_free_pin(args[ARG_command].u_obj);
+ mcu_pin_obj_t *chip_select = validate_obj_is_free_pin(args[ARG_chip_select].u_obj);
+ mcu_pin_obj_t *reset = validate_obj_is_free_pin_or_none(args[ARG_reset].u_obj);
- displayio_fourwire_obj_t* self = NULL;
mp_obj_t spi = args[ARG_spi_bus].u_obj;
- for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) {
- if (displays[i].fourwire_bus.base.type == NULL ||
- displays[i].fourwire_bus.base.type == &mp_type_NoneType) {
- self = &displays[i].fourwire_bus;
- self->base.type = &displayio_fourwire_type;
- break;
- }
+ displayio_fourwire_obj_t* self = &allocate_display_bus_or_raise()->fourwire_bus;
+
+ uint8_t polarity = args[ARG_polarity].u_int;
+ if (polarity != 0 && polarity != 1) {
+ mp_raise_ValueError(translate("Invalid polarity"));
}
- if (self == NULL) {
- mp_raise_RuntimeError(translate("Too many display busses"));
+ uint8_t phase = args[ARG_phase].u_int;
+ if (phase != 0 && phase != 1) {
+ mp_raise_ValueError(translate("Invalid phase"));
}
common_hal_displayio_fourwire_construct(self,
- MP_OBJ_TO_PTR(spi), command, chip_select, reset, args[ARG_baudrate].u_int);
+ MP_OBJ_TO_PTR(spi), command, chip_select, reset, args[ARG_baudrate].u_int, polarity, phase);
return self;
}
diff --git a/shared-bindings/displayio/FourWire.h b/shared-bindings/displayio/FourWire.h
index d0935f063..ac186d2c3 100644
--- a/shared-bindings/displayio/FourWire.h
+++ b/shared-bindings/displayio/FourWire.h
@@ -38,7 +38,8 @@ extern const mp_obj_type_t displayio_fourwire_type;
void common_hal_displayio_fourwire_construct(displayio_fourwire_obj_t* self,
busio_spi_obj_t* spi, const mcu_pin_obj_t* command,
- const mcu_pin_obj_t* chip_select, const mcu_pin_obj_t* reset, uint32_t baudrate);
+ const mcu_pin_obj_t* chip_select, const mcu_pin_obj_t* reset, uint32_t baudrate,
+ uint8_t polarity, uint8_t phase);
void common_hal_displayio_fourwire_deinit(displayio_fourwire_obj_t* self);
diff --git a/shared-bindings/displayio/I2CDisplay.c b/shared-bindings/displayio/I2CDisplay.c
index 9b863f656..dd3333f6d 100644
--- a/shared-bindings/displayio/I2CDisplay.c
+++ b/shared-bindings/displayio/I2CDisplay.c
@@ -69,26 +69,10 @@ STATIC mp_obj_t displayio_i2cdisplay_make_new(const mp_obj_type_t *type, size_t
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
- mp_obj_t reset = args[ARG_reset].u_obj;
- if (reset != mp_const_none) {
- assert_pin_free(reset);
- } else {
- reset = NULL;
- }
+ mcu_pin_obj_t *reset = validate_obj_is_free_pin_or_none(args[ARG_reset].u_obj);
- displayio_i2cdisplay_obj_t* self = NULL;
mp_obj_t i2c = args[ARG_i2c_bus].u_obj;
- for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) {
- if (displays[i].i2cdisplay_bus.base.type == NULL ||
- displays[i].i2cdisplay_bus.base.type == &mp_type_NoneType) {
- self = &displays[i].i2cdisplay_bus;
- self->base.type = &displayio_i2cdisplay_type;
- break;
- }
- }
- if (self == NULL) {
- mp_raise_RuntimeError(translate("Too many display busses"));
- }
+ displayio_i2cdisplay_obj_t* self = &allocate_display_bus_or_raise()->i2cdisplay_bus;
common_hal_displayio_i2cdisplay_construct(self,
MP_OBJ_TO_PTR(i2c), args[ARG_device_address].u_int, reset);
diff --git a/shared-bindings/displayio/OnDiskBitmap.c b/shared-bindings/displayio/OnDiskBitmap.c
index f7e2bf693..57179947e 100644
--- a/shared-bindings/displayio/OnDiskBitmap.c
+++ b/shared-bindings/displayio/OnDiskBitmap.c
@@ -62,7 +62,7 @@
//| face = displayio.TileGrid(odb, pixel_shader=displayio.ColorConverter())
//| splash.append(face)
//| # Wait for the image to load.
-//| board.DISPLAY.wait_for_frame()
+//| board.DISPLAY.refresh(target_frames_per_second=60)
//|
//| # Fade up the backlight
//| for i in range(100):
diff --git a/shared-bindings/displayio/ParallelBus.c b/shared-bindings/displayio/ParallelBus.c
index f7195b9cc..4d9ffb0a1 100644
--- a/shared-bindings/displayio/ParallelBus.c
+++ b/shared-bindings/displayio/ParallelBus.c
@@ -71,36 +71,19 @@ STATIC mp_obj_t displayio_parallelbus_make_new(const mp_obj_type_t *type, size_t
{ MP_QSTR_chip_select, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED },
{ MP_QSTR_write, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED },
{ MP_QSTR_read, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED },
- { MP_QSTR_reset, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} },
+ { MP_QSTR_reset, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED },
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
- mp_obj_t data0 = args[ARG_data0].u_obj;
- mp_obj_t command = args[ARG_command].u_obj;
- mp_obj_t chip_select = args[ARG_chip_select].u_obj;
- mp_obj_t write = args[ARG_write].u_obj;
- mp_obj_t read = args[ARG_read].u_obj;
- mp_obj_t reset = args[ARG_reset].u_obj;
- assert_pin_free(data0);
- assert_pin_free(command);
- assert_pin_free(chip_select);
- assert_pin_free(write);
- assert_pin_free(read);
- assert_pin_free(reset);
+ mcu_pin_obj_t *data0 = validate_obj_is_free_pin(args[ARG_data0].u_obj);
+ mcu_pin_obj_t *command = validate_obj_is_free_pin(args[ARG_command].u_obj);
+ mcu_pin_obj_t *chip_select = validate_obj_is_free_pin(args[ARG_chip_select].u_obj);
+ mcu_pin_obj_t *write = validate_obj_is_free_pin(args[ARG_write].u_obj);
+ mcu_pin_obj_t *read = validate_obj_is_free_pin(args[ARG_read].u_obj);
+ mcu_pin_obj_t *reset = validate_obj_is_free_pin(args[ARG_reset].u_obj);
- displayio_parallelbus_obj_t* self = NULL;
- for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) {
- if (displays[i].parallel_bus.base.type== NULL ||
- displays[i].parallel_bus.base.type == &mp_type_NoneType) {
- self = &displays[i].parallel_bus;
- self->base.type = &displayio_parallelbus_type;
- break;
- }
- }
- if (self == NULL) {
- mp_raise_RuntimeError(translate("Too many display busses"));
- }
+ displayio_parallelbus_obj_t* self = &allocate_display_bus_or_raise()->parallel_bus;
common_hal_displayio_parallelbus_construct(self, data0, command, chip_select, write, read, reset);
return self;
diff --git a/shared-bindings/framebufferio/FramebufferDisplay.c b/shared-bindings/framebufferio/FramebufferDisplay.c
new file mode 100644
index 000000000..aa8fc1a63
--- /dev/null
+++ b/shared-bindings/framebufferio/FramebufferDisplay.c
@@ -0,0 +1,428 @@
+/*
+ * This file is part of the Micro Python project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2018 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 "shared-bindings/framebufferio/FramebufferDisplay.h"
+
+#include <stdint.h>
+
+#include "lib/utils/context_manager_helpers.h"
+#include "py/binary.h"
+#include "py/objproperty.h"
+#include "py/objtype.h"
+#include "py/runtime.h"
+#include "shared-bindings/displayio/Group.h"
+#include "shared-bindings/microcontroller/Pin.h"
+#include "shared-bindings/util.h"
+#include "shared-module/displayio/__init__.h"
+#include "supervisor/shared/translate.h"
+
+//| .. currentmodule:: framebufferio
+//|
+//| :class:`FramebufferDisplay` -- Manage updating a display with framebuffer in RAM
+//| ================================================================================
+//|
+//| This initializes a display and connects it into CircuitPython. Unlike other
+//| objects in CircuitPython, Display objects live until `displayio.release_displays()`
+//| is called. This is done so that CircuitPython can use the display itself.
+//|
+//| .. class:: FramebufferDisplay(framebuffer, *, width, height, colstart=0, rowstart=0, rotation=0, color_depth=16, grayscale=False, pixels_in_byte_share_row=True, bytes_per_cell=1, reverse_pixels_in_byte=False, backlight_pin=None, brightness=1.0, auto_brightness=False, auto_refresh=True, native_frames_per_second=60)
+//|
+//| Create a Display object with the given framebuffer (a buffer, array, ulab.array, etc)
+//|
+//| :param framebuffer: The framebuffer that the display is connected to
+//| :type framebuffer: any core object implementing the framebuffer protocol
+//| :param int width: Width in pixels
+//| :param int height: Height in pixels
+//| :param int rotation: The rotation of the display in degrees clockwise. Must be in 90 degree increments (0, 90, 180, 270)
+//| :param int color_depth: The number of bits of color per pixel transmitted. (Some displays
+//| support 18 bit but 16 is easier to transmit. The last bit is extrapolated.)
+//| :param int bytes_per_cell: Number of bytes per addressable memory location when color_depth < 8. When greater than one, bytes share a row or column according to pixels_in_byte_share_row.
+//| :param microcontroller.Pin backlight_pin: Pin connected to the display's backlight
+//| :param bool brightness: Initial display brightness. This value is ignored if auto_brightness is True.
+//| :param bool auto_brightness: If True, brightness is controlled via an ambient light sensor or other mechanism.
+//| :param bool auto_refresh: Automatically refresh the screen
+//| :param int native_frames_per_second: Number of display refreshes per second
+//|
+STATIC mp_obj_t framebufferio_framebufferdisplay_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+ enum { ARG_framebuffer, ARG_width, ARG_height, ARG_rotation, ARG_color_depth, ARG_bytes_per_cell, ARG_auto_refresh, ARG_native_frames_per_second, NUM_ARGS };
+ static const mp_arg_t allowed_args[] = {
+ { MP_QSTR_framebuffer, MP_ARG_REQUIRED | MP_ARG_OBJ },
+ { MP_QSTR_width, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, },
+ { MP_QSTR_height, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, },
+ { MP_QSTR_rotation, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} },
+ { MP_QSTR_color_depth, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 16} },
+ { MP_QSTR_bytes_per_cell, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 1} },
+ { MP_QSTR_auto_refresh, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} },
+ { MP_QSTR_native_frames_per_second, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 60} },
+ };
+ MP_STATIC_ASSERT( MP_ARRAY_SIZE(allowed_args) == NUM_ARGS );
+ mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
+ mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
+
+ mp_obj_t framebuffer = args[ARG_framebuffer].u_obj;
+
+ mp_int_t rotation = args[ARG_rotation].u_int;
+ if (rotation % 90 != 0) {
+ mp_raise_ValueError(translate("Display rotation must be in 90 degree increments"));
+ }
+
+ primary_display_t *disp = allocate_display_or_raise();
+ framebufferio_framebufferdisplay_obj_t *self = &disp->framebuffer_display;
+ self->base.type = &framebufferio_framebufferdisplay_type;
+ common_hal_framebufferio_framebufferdisplay_construct(
+ self,
+ framebuffer,
+ args[ARG_width].u_int, args[ARG_height].u_int,
+ rotation,
+ args[ARG_color_depth].u_int,
+ args[ARG_bytes_per_cell].u_int,
+ args[ARG_auto_refresh].u_bool,
+ args[ARG_native_frames_per_second].u_int
+ );
+
+ return self;
+}
+
+// Helper to ensure we have the native super class instead of a subclass.
+static framebufferio_framebufferdisplay_obj_t* native_display(mp_obj_t display_obj) {
+ mp_obj_t native_display = mp_instance_cast_to_native_base(display_obj, &framebufferio_framebufferdisplay_type);
+ mp_obj_assert_native_inited(native_display);
+ return MP_OBJ_TO_PTR(native_display);
+}
+
+//| .. method:: show(group)
+//|
+//| Switches to displaying the given group of layers. When group is None, the default
+//| CircuitPython terminal will be shown.
+//|
+//| :param Group group: The group to show.
+//|
+STATIC mp_obj_t framebufferio_framebufferdisplay_obj_show(mp_obj_t self_in, mp_obj_t group_in) {
+ framebufferio_framebufferdisplay_obj_t *self = native_display(self_in);
+ displayio_group_t* group = NULL;
+ if (group_in != mp_const_none) {
+ group = MP_OBJ_TO_PTR(native_group(group_in));
+ }
+
+ bool ok = common_hal_framebufferio_framebufferdisplay_show(self, group);
+ if (!ok) {
+ mp_raise_ValueError(translate("Group already used"));
+ }
+ return mp_const_none;
+}
+MP_DEFINE_CONST_FUN_OBJ_2(framebufferio_framebufferdisplay_show_obj, framebufferio_framebufferdisplay_obj_show);
+
+//| .. method:: refresh(*, target_frames_per_second=60, minimum_frames_per_second=1)
+//|
+//| When auto refresh is off, waits for the target frame rate and then refreshes the display,
+//| returning True. If the call has taken too long since the last refresh call for the given
+//| target frame rate, then the refresh returns False immediately without updating the screen to
+//| hopefully help getting caught up.
+//|
+//| If the time since the last successful refresh is below the minimum frame rate, then an
+//| exception will be raised. Set minimum_frames_per_second to 0 to disable.
+//|
+//| When auto refresh is on, updates the display immediately. (The display will also update
+//| without calls to this.)
+//|
+//| :param int target_frames_per_second: How many times a second `refresh` should be called and the screen updated.
+//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second.
+//|
+STATIC mp_obj_t framebufferio_framebufferdisplay_obj_refresh(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+ enum { ARG_target_frames_per_second, ARG_minimum_frames_per_second };
+ static const mp_arg_t allowed_args[] = {
+ { MP_QSTR_target_frames_per_second, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 60} },
+ { MP_QSTR_minimum_frames_per_second, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} },
+ };
+ mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
+ mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
+
+ framebufferio_framebufferdisplay_obj_t *self = native_display(pos_args[0]);
+ uint32_t maximum_ms_per_real_frame = 0xffffffff;
+ mp_int_t minimum_frames_per_second = args[ARG_minimum_frames_per_second].u_int;
+ if (minimum_frames_per_second > 0) {
+ maximum_ms_per_real_frame = 1000 / minimum_frames_per_second;
+ }
+ return mp_obj_new_bool(common_hal_framebufferio_framebufferdisplay_refresh(self, 1000 / args[ARG_target_frames_per_second].u_int, maximum_ms_per_real_frame));
+}
+MP_DEFINE_CONST_FUN_OBJ_KW(framebufferio_framebufferdisplay_refresh_obj, 1, framebufferio_framebufferdisplay_obj_refresh);
+
+//| .. attribute:: auto_refresh
+//|
+//| True when the display is refreshed automatically.
+//|
+STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_auto_refresh(mp_obj_t self_in) {
+ framebufferio_framebufferdisplay_obj_t *self = native_display(self_in);
+ return mp_obj_new_bool(common_hal_framebufferio_framebufferdisplay_get_auto_refresh(self));
+}
+MP_DEFINE_CONST_FUN_OBJ_1(framebufferio_framebufferdisplay_get_auto_refresh_obj, framebufferio_framebufferdisplay_obj_get_auto_refresh);
+
+STATIC mp_obj_t framebufferio_framebufferdisplay_obj_set_auto_refresh(mp_obj_t self_in, mp_obj_t auto_refresh) {
+ framebufferio_framebufferdisplay_obj_t *self = native_display(self_in);
+
+ common_hal_framebufferio_framebufferdisplay_set_auto_refresh(self, mp_obj_is_true(auto_refresh));
+
+ return mp_const_none;
+}
+MP_DEFINE_CONST_FUN_OBJ_2(framebufferio_framebufferdisplay_set_auto_refresh_obj, framebufferio_framebufferdisplay_obj_set_auto_refresh);
+
+const mp_obj_property_t framebufferio_framebufferdisplay_auto_refresh_obj = {
+ .base.type = &mp_type_property,
+ .proxy = {(mp_obj_t)&framebufferio_framebufferdisplay_get_auto_refresh_obj,
+ (mp_obj_t)&framebufferio_framebufferdisplay_set_auto_refresh_obj,
+ (mp_obj_t)&mp_const_none_obj},
+};
+
+//| .. attribute:: brightness
+//|
+//| The brightness of the display as a float. 0.0 is off and 1.0 is full brightness. When
+//| `auto_brightness` is True, the value of `brightness` will change automatically.
+//| If `brightness` is set, `auto_brightness` will be disabled and will be set to False.
+//|
+STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_brightness(mp_obj_t self_in) {
+ framebufferio_framebufferdisplay_obj_t *self = native_display(self_in);
+ mp_float_t brightness = common_hal_framebufferio_framebufferdisplay_get_brightness(self);
+ if (brightness < 0) {
+ mp_raise_RuntimeError(translate("Brightness not adjustable"));
+ }
+ return mp_obj_new_float(brightness);
+}
+MP_DEFINE_CONST_FUN_OBJ_1(framebufferio_framebufferdisplay_get_brightness_obj, framebufferio_framebufferdisplay_obj_get_brightness);
+
+STATIC mp_obj_t framebufferio_framebufferdisplay_obj_set_brightness(mp_obj_t self_in, mp_obj_t brightness_obj) {
+ framebufferio_framebufferdisplay_obj_t *self = native_display(self_in);
+ common_hal_framebufferio_framebufferdisplay_set_auto_brightness(self, false);
+ mp_float_t brightness = mp_obj_get_float(brightness_obj);
+ if (brightness < 0.0f || brightness > 1.0f) {
+ mp_raise_ValueError(translate("Brightness must be 0-1.0"));
+ }
+ bool ok = common_hal_framebufferio_framebufferdisplay_set_brightness(self, brightness);
+ if (!ok) {
+ mp_raise_RuntimeError(translate("Brightness not adjustable"));
+ }
+ return mp_const_none;
+}
+MP_DEFINE_CONST_FUN_OBJ_2(framebufferio_framebufferdisplay_set_brightness_obj, framebufferio_framebufferdisplay_obj_set_brightness);
+
+const mp_obj_property_t framebufferio_framebufferdisplay_brightness_obj = {
+ .base.type = &mp_type_property,
+ .proxy = {(mp_obj_t)&framebufferio_framebufferdisplay_get_brightness_obj,
+ (mp_obj_t)&framebufferio_framebufferdisplay_set_brightness_obj,
+ (mp_obj_t)&mp_const_none_obj},
+};
+
+//| .. attribute:: auto_brightness
+//|
+//| True when the display brightness is adjusted automatically, based on an ambient
+//| light sensor or other method. Note that some displays may have this set to True by default,
+//| but not actually implement automatic brightness adjustment. `auto_brightness` is set to False
+//| if `brightness` is set manually.
+//|
+STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_auto_brightness(mp_obj_t self_in) {
+ framebufferio_framebufferdisplay_obj_t *self = native_display(self_in);
+ return mp_obj_new_bool(common_hal_framebufferio_framebufferdisplay_get_auto_brightness(self));
+}
+MP_DEFINE_CONST_FUN_OBJ_1(framebufferio_framebufferdisplay_get_auto_brightness_obj, framebufferio_framebufferdisplay_obj_get_auto_brightness);
+
+STATIC mp_obj_t framebufferio_framebufferdisplay_obj_set_auto_brightness(mp_obj_t self_in, mp_obj_t auto_brightness) {
+ framebufferio_framebufferdisplay_obj_t *self = native_display(self_in);
+
+ bool ok = common_hal_framebufferio_framebufferdisplay_set_auto_brightness(self, mp_obj_is_true(auto_brightness));
+ if (!ok) {
+ mp_raise_RuntimeError(translate("Brightness not adjustable"));
+ }
+
+ return mp_const_none;
+}
+MP_DEFINE_CONST_FUN_OBJ_2(framebufferio_framebufferdisplay_set_auto_brightness_obj, framebufferio_framebufferdisplay_obj_set_auto_brightness);
+
+const mp_obj_property_t framebufferio_framebufferdisplay_auto_brightness_obj = {
+ .base.type = &mp_type_property,
+ .proxy = {(mp_obj_t)&framebufferio_framebufferdisplay_get_auto_brightness_obj,
+ (mp_obj_t)&framebufferio_framebufferdisplay_set_auto_brightness_obj,
+ (mp_obj_t)&mp_const_none_obj},
+};
+
+//| .. attribute:: width
+//|
+//| Gets the width of the framebuffer
+//|
+STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_width(mp_obj_t self_in) {
+ framebufferio_framebufferdisplay_obj_t *self = native_display(self_in);
+ return MP_OBJ_NEW_SMALL_INT(common_hal_framebufferio_framebufferdisplay_get_width(self));
+}
+MP_DEFINE_CONST_FUN_OBJ_1(framebufferio_framebufferdisplay_get_width_obj, framebufferio_framebufferdisplay_obj_get_width);
+
+const mp_obj_property_t framebufferio_framebufferdisplay_width_obj = {
+ .base.type = &mp_type_property,
+ .proxy = {(mp_obj_t)&framebufferio_framebufferdisplay_get_width_obj,
+ (mp_obj_t)&mp_const_none_obj,
+ (mp_obj_t)&mp_const_none_obj},
+};
+
+//| .. attribute:: height
+//|
+//| Gets the height of the framebuffer
+//|
+STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_height(mp_obj_t self_in) {
+ framebufferio_framebufferdisplay_obj_t *self = native_display(self_in);
+ return MP_OBJ_NEW_SMALL_INT(common_hal_framebufferio_framebufferdisplay_get_height(self));
+}
+MP_DEFINE_CONST_FUN_OBJ_1(framebufferio_framebufferdisplay_get_height_obj, framebufferio_framebufferdisplay_obj_get_height);
+
+const mp_obj_property_t framebufferio_framebufferdisplay_height_obj = {
+ .base.type = &mp_type_property,
+ .proxy = {(mp_obj_t)&framebufferio_framebufferdisplay_get_height_obj,
+ (mp_obj_t)&mp_const_none_obj,
+ (mp_obj_t)&mp_const_none_obj},
+};
+
+//| .. attribute:: rotation
+//|
+//| The rotation of the display as an int in degrees.
+//|
+STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_rotation(mp_obj_t self_in) {
+ framebufferio_framebufferdisplay_obj_t *self = native_display(self_in);
+ return MP_OBJ_NEW_SMALL_INT(common_hal_framebufferio_framebufferdisplay_get_rotation(self));
+}
+MP_DEFINE_CONST_FUN_OBJ_1(framebufferio_framebufferdisplay_get_rotation_obj, framebufferio_framebufferdisplay_obj_get_rotation);
+STATIC mp_obj_t framebufferio_framebufferdisplay_obj_set_rotation(mp_obj_t self_in, mp_obj_t value) {
+ framebufferio_framebufferdisplay_obj_t *self = native_display(self_in);
+ common_hal_framebufferio_framebufferdisplay_set_rotation(self, mp_obj_get_int(value));
+ return mp_const_none;
+}
+MP_DEFINE_CONST_FUN_OBJ_2(framebufferio_framebufferdisplay_set_rotation_obj, framebufferio_framebufferdisplay_obj_set_rotation);
+
+
+const mp_obj_property_t framebufferio_framebufferdisplay_rotation_obj = {
+ .base.type = &mp_type_property,
+ .proxy = {(mp_obj_t)&framebufferio_framebufferdisplay_get_rotation_obj,
+ (mp_obj_t)&framebufferio_framebufferdisplay_set_rotation_obj,
+ (mp_obj_t)&mp_const_none_obj},
+};
+
+//| .. attribute:: framebuffer
+//|
+//| The framebuffer being used by the display
+//|
+//|
+STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_framebuffer(mp_obj_t self_in) {
+ framebufferio_framebufferdisplay_obj_t *self = native_display(self_in);
+ return common_hal_framebufferio_framebufferdisplay_get_framebuffer(self);
+}
+MP_DEFINE_CONST_FUN_OBJ_1(framebufferio_framebufferdisplay_get_framebuffer_obj, framebufferio_framebufferdisplay_obj_get_framebuffer);
+
+const mp_obj_property_t framebufferio_framebufferframebuffer_obj = {
+ .base.type = &mp_type_property,
+ .proxy = {(mp_obj_t)&framebufferio_framebufferdisplay_get_framebuffer_obj,
+ (mp_obj_t)&mp_const_none_obj,
+ (mp_obj_t)&mp_const_none_obj},
+};
+
+
+//| .. method:: fill_row(y, buffer)
+//|
+//| Extract the pixels from a single row
+//|
+//| :param int y: The top edge of the area
+//| :param bytearray buffer: The buffer in which to place the pixel data
+STATIC mp_obj_t framebufferio_framebufferdisplay_obj_fill_row(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+ enum { ARG_y, ARG_buffer };
+ static const mp_arg_t allowed_args[] = {
+ { MP_QSTR_y, MP_ARG_INT | MP_ARG_REQUIRED, {.u_int = -1} },
+ { MP_QSTR_buffer, MP_ARG_OBJ | MP_ARG_REQUIRED, {} },
+ };
+ mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
+ mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
+ framebufferio_framebufferdisplay_obj_t *self = native_display(pos_args[0]);
+ mp_int_t y = args[ARG_y].u_int;
+ mp_obj_t *result = args[ARG_buffer].u_obj;
+
+ mp_buffer_info_t bufinfo;
+ mp_get_buffer_raise(result, &bufinfo, MP_BUFFER_WRITE);
+
+ if (bufinfo.typecode != BYTEARRAY_TYPECODE) {
+ mp_raise_ValueError(translate("Buffer is not a bytearray."));
+ }
+ if (self->core.colorspace.depth != 16) {
+ mp_raise_ValueError(translate("Display must have a 16 bit colorspace."));
+ }
+
+ displayio_area_t area = {
+ .x1 = 0,
+ .y1 = y,
+ .x2 = self->core.width,
+ .y2 = y + 1
+ };
+ uint8_t pixels_per_word = (sizeof(uint32_t) * 8) / self->core.colorspace.depth;
+ uint16_t buffer_size = self->core.width / pixels_per_word;
+ uint16_t pixels_per_buffer = displayio_area_size(&area);
+ if (pixels_per_buffer % pixels_per_word) {
+ buffer_size += 1;
+ }
+
+ uint32_t *result_buffer = bufinfo.buf;
+ size_t result_buffer_size = bufinfo.len;
+
+ if (result_buffer_size >= (buffer_size * 4)) {
+ volatile uint32_t mask_length = (pixels_per_buffer / 32) + 1;
+ uint32_t mask[mask_length];
+
+ for (uint16_t k = 0; k < mask_length; k++) {
+ mask[k] = 0x00000000;
+ }
+
+ displayio_display_core_fill_area(&self->core, &area, mask, result_buffer);
+ return result;
+ } else {
+ mp_raise_ValueError(translate("Buffer is too small"));
+ }
+}
+MP_DEFINE_CONST_FUN_OBJ_KW(framebufferio_framebufferdisplay_fill_row_obj, 1, framebufferio_framebufferdisplay_obj_fill_row);
+
+STATIC const mp_rom_map_elem_t framebufferio_framebufferdisplay_locals_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&framebufferio_framebufferdisplay_show_obj) },
+ { MP_ROM_QSTR(MP_QSTR_refresh), MP_ROM_PTR(&framebufferio_framebufferdisplay_refresh_obj) },
+ { MP_ROM_QSTR(MP_QSTR_fill_row), MP_ROM_PTR(&framebufferio_framebufferdisplay_fill_row_obj) },
+
+ { MP_ROM_QSTR(MP_QSTR_auto_refresh), MP_ROM_PTR(&framebufferio_framebufferdisplay_auto_refresh_obj) },
+
+ { MP_ROM_QSTR(MP_QSTR_brightness), MP_ROM_PTR(&framebufferio_framebufferdisplay_brightness_obj) },
+ { MP_ROM_QSTR(MP_QSTR_auto_brightness), MP_ROM_PTR(&framebufferio_framebufferdisplay_auto_brightness_obj) },
+
+ { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&framebufferio_framebufferdisplay_width_obj) },
+ { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&framebufferio_framebufferdisplay_height_obj) },
+ { MP_ROM_QSTR(MP_QSTR_rotation), MP_ROM_PTR(&framebufferio_framebufferdisplay_rotation_obj) },
+ { MP_ROM_QSTR(MP_QSTR_framebuffer), MP_ROM_PTR(&framebufferio_framebufferframebuffer_obj) },
+};
+STATIC MP_DEFINE_CONST_DICT(framebufferio_framebufferdisplay_locals_dict, framebufferio_framebufferdisplay_locals_dict_table);
+
+const mp_obj_type_t framebufferio_framebufferdisplay_type = {
+ { &mp_type_type },
+ .name = MP_QSTR_FramebufferDisplay,
+ .make_new = framebufferio_framebufferdisplay_make_new,
+ .locals_dict = (mp_obj_dict_t*)&framebufferio_framebufferdisplay_locals_dict,
+};
diff --git a/shared-bindings/framebufferio/FramebufferDisplay.h b/shared-bindings/framebufferio/FramebufferDisplay.h
new file mode 100644
index 000000000..b472088d2
--- /dev/null
+++ b/shared-bindings/framebufferio/FramebufferDisplay.h
@@ -0,0 +1,69 @@
+/*
+ * This file is part of the Micro Python project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017, 2018 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.
+ */
+
+#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_FRAMEBUFFERDISPLAY_H
+#define MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_FRAMEBUFFERDISPLAY_H
+
+#include "common-hal/microcontroller/Pin.h"
+
+#include "shared-module/framebufferio/FramebufferDisplay.h"
+#include "shared-module/displayio/Group.h"
+
+extern const mp_obj_type_t framebufferio_framebufferdisplay_type;
+
+#define DELAY 0x80
+
+#define NO_BRIGHTNESS_COMMAND 0x100
+
+void common_hal_framebufferio_framebufferdisplay_construct(framebufferio_framebufferdisplay_obj_t* self,
+ mp_obj_t framebuffer, uint16_t width, uint16_t height,
+ uint16_t rotation, uint16_t color_depth,
+ uint8_t bytes_per_cell,
+ bool auto_refresh, uint16_t native_frames_per_second);
+
+bool common_hal_framebufferio_framebufferdisplay_show(framebufferio_framebufferdisplay_obj_t* self,
+ displayio_group_t* root_group);
+
+bool common_hal_framebufferio_framebufferdisplay_refresh(framebufferio_framebufferdisplay_obj_t* self, uint32_t target_ms_per_frame, uint32_t maximum_ms_per_real_frame);
+
+bool common_hal_framebufferio_framebufferdisplay_get_auto_refresh(framebufferio_framebufferdisplay_obj_t* self);
+void common_hal_framebufferio_framebufferdisplay_set_auto_refresh(framebufferio_framebufferdisplay_obj_t* self, bool auto_refresh);
+
+uint16_t common_hal_framebufferio_framebufferdisplay_get_width(framebufferio_framebufferdisplay_obj_t* self);
+uint16_t common_hal_framebufferio_framebufferdisplay_get_height(framebufferio_framebufferdisplay_obj_t* self);
+uint16_t common_hal_framebufferio_framebufferdisplay_get_rotation(framebufferio_framebufferdisplay_obj_t* self);
+void common_hal_framebufferio_framebufferdisplay_set_rotation(framebufferio_framebufferdisplay_obj_t* self, int rotation);
+
+bool common_hal_framebufferio_framebufferdisplay_get_auto_brightness(framebufferio_framebufferdisplay_obj_t* self);
+bool common_hal_framebufferio_framebufferdisplay_set_auto_brightness(framebufferio_framebufferdisplay_obj_t* self, bool auto_brightness);
+
+mp_float_t common_hal_framebufferio_framebufferdisplay_get_brightness(framebufferio_framebufferdisplay_obj_t* self);
+bool common_hal_framebufferio_framebufferdisplay_set_brightness(framebufferio_framebufferdisplay_obj_t* self, mp_float_t brightness);
+
+mp_obj_t common_hal_framebufferio_framebufferdisplay_framebuffer(framebufferio_framebufferdisplay_obj_t* self);
+
+
+#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_FRAMEBUFFERDISPLAY_H
diff --git a/shared-bindings/framebufferio/__init__.c b/shared-bindings/framebufferio/__init__.c
new file mode 100644
index 000000000..0f0823a25
--- /dev/null
+++ b/shared-bindings/framebufferio/__init__.c
@@ -0,0 +1,63 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Jeff Epler 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 "py/obj.h"
+#include "shared-bindings/framebufferio/__init__.h"
+#include "shared-bindings/framebufferio/FramebufferDisplay.h"
+
+//| :mod:`framebufferio` --- Native framebuffer display driving
+//| =========================================================================
+//|
+//| .. module:: framebufferio
+//| :synopsis: Native helpers for driving displays
+//| :platform: SAMD51, nRF52
+//|
+//| The `framebufferio` module contains classes to manage display output
+//| including synchronizing with refresh rates and partial updating.
+//| It is used in conjunction with classes from `displayio` to actually
+//| place items on the display; and classes like `Protomatter` to actually
+//| drive the display.
+//|
+//| Libraries
+//|
+//| .. toctree::
+//| :maxdepth: 3
+//|
+//| FramebufferDisplay
+//|
+
+#if CIRCUITPY_FRAMEBUFFERIO
+static const mp_rom_map_elem_t framebufferio_module_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_framebufferio) },
+ { MP_ROM_QSTR(MP_QSTR_FramebufferDisplay), MP_ROM_PTR(&framebufferio_framebufferdisplay_type) },
+};
+STATIC MP_DEFINE_CONST_DICT(framebufferio_module_globals, framebufferio_module_globals_table);
+const mp_obj_module_t framebufferio_module = {
+ .base = { &mp_type_module },
+ .globals = (mp_obj_dict_t*)&framebufferio_module_globals,
+};
+#endif
+
diff --git a/shared-bindings/framebufferio/__init__.h b/shared-bindings/framebufferio/__init__.h
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/shared-bindings/framebufferio/__init__.h
diff --git a/shared-bindings/frequencyio/FrequencyIn.c b/shared-bindings/frequencyio/FrequencyIn.c
index e2b924c07..6743f8706 100644
--- a/shared-bindings/frequencyio/FrequencyIn.c
+++ b/shared-bindings/frequencyio/FrequencyIn.c
@@ -87,9 +87,7 @@ STATIC mp_obj_t frequencyio_frequencyin_make_new(const mp_obj_type_t *type, size
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
- assert_pin(args[ARG_pin].u_obj, false);
- mcu_pin_obj_t* pin = MP_OBJ_TO_PTR(args[ARG_pin].u_obj);
- assert_pin_free(pin);
+ mcu_pin_obj_t* pin = validate_obj_is_free_pin(args[ARG_pin].u_obj);
const uint16_t capture_period = args[ARG_capture_period].u_int;
diff --git a/shared-bindings/i2cslave/I2CSlave.c b/shared-bindings/i2cslave/I2CSlave.c
index c98ea52e0..e28eb3f25 100644
--- a/shared-bindings/i2cslave/I2CSlave.c
+++ b/shared-bindings/i2cslave/I2CSlave.c
@@ -77,12 +77,8 @@ STATIC mp_obj_t i2cslave_i2c_slave_make_new(const mp_obj_type_t *type, size_t n_
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
- assert_pin(args[ARG_scl].u_obj, false);
- assert_pin(args[ARG_sda].u_obj, false);
- const mcu_pin_obj_t* scl = MP_OBJ_TO_PTR(args[ARG_scl].u_obj);
- assert_pin_free(scl);
- const mcu_pin_obj_t* sda = MP_OBJ_TO_PTR(args[ARG_sda].u_obj);
- assert_pin_free(sda);
+ const mcu_pin_obj_t* scl = validate_obj_is_free_pin(args[ARG_scl].u_obj);
+ const mcu_pin_obj_t* sda = validate_obj_is_free_pin(args[ARG_sda].u_obj);
mp_obj_iter_buf_t iter_buf;
mp_obj_t iterable = mp_getiter(args[ARG_addresses].u_obj, &iter_buf);
diff --git a/shared-bindings/microcontroller/Pin.c b/shared-bindings/microcontroller/Pin.c
index 3635f0afb..67aecaf66 100644
--- a/shared-bindings/microcontroller/Pin.c
+++ b/shared-bindings/microcontroller/Pin.c
@@ -84,10 +84,35 @@ const mp_obj_type_t mcu_pin_type = {
.print = mcu_pin_print
};
-void assert_pin(mp_obj_t obj, bool none_ok) {
- if ((obj != mp_const_none || !none_ok) && !MP_OBJ_IS_TYPE(obj, &mcu_pin_type)) {
+mcu_pin_obj_t *validate_obj_is_pin(mp_obj_t obj) {
+ if (!MP_OBJ_IS_TYPE(obj, &mcu_pin_type)) {
mp_raise_TypeError_varg(translate("Expected a %q"), mcu_pin_type.name);
}
+ return MP_OBJ_TO_PTR(obj);
+}
+
+// Validate that the obj is a pin or None. Return an mcu_pin_obj_t* or NULL, correspondingly.
+mcu_pin_obj_t *validate_obj_is_pin_or_none(mp_obj_t obj) {
+ if (obj == mp_const_none) {
+ return NULL;
+ }
+ return validate_obj_is_pin(obj);
+}
+
+mcu_pin_obj_t *validate_obj_is_free_pin(mp_obj_t obj) {
+ mcu_pin_obj_t *pin = validate_obj_is_pin(obj);
+ assert_pin_free(pin);
+ return pin;
+}
+
+// Validate that the obj is a free pin or None. Return an mcu_pin_obj_t* or NULL, correspondingly.
+mcu_pin_obj_t *validate_obj_is_free_pin_or_none(mp_obj_t obj) {
+ if (obj == mp_const_none) {
+ return NULL;
+ }
+ mcu_pin_obj_t *pin = validate_obj_is_pin(obj);
+ assert_pin_free(pin);
+ return pin;
}
void assert_pin_free(const mcu_pin_obj_t* pin) {
diff --git a/shared-bindings/microcontroller/Pin.h b/shared-bindings/microcontroller/Pin.h
index 2d15dd5c5..bb5256b55 100644
--- a/shared-bindings/microcontroller/Pin.h
+++ b/shared-bindings/microcontroller/Pin.h
@@ -33,11 +33,21 @@
// Type object used in Python. Should be shared between ports.
extern const mp_obj_type_t mcu_pin_type;
-void assert_pin(mp_obj_t obj, bool none_ok);
+mcu_pin_obj_t *validate_obj_is_pin(mp_obj_t obj);
+mcu_pin_obj_t *validate_obj_is_pin_or_none(mp_obj_t obj);
+mcu_pin_obj_t *validate_obj_is_free_pin(mp_obj_t obj);
+mcu_pin_obj_t *validate_obj_is_free_pin_or_none(mp_obj_t obj);
+
void assert_pin_free(const mcu_pin_obj_t* pin);
bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t* pin);
void common_hal_never_reset_pin(const mcu_pin_obj_t* pin);
void common_hal_reset_pin(const mcu_pin_obj_t* pin);
+uint8_t common_hal_mcu_pin_number(const mcu_pin_obj_t* pin);
+void common_hal_mcu_pin_claim(const mcu_pin_obj_t* pin);
+void common_hal_mcu_pin_claim_number(uint8_t pin_no);
+void common_hal_mcu_pin_reset_number(uint8_t pin_no);
+
+#define COMMON_HAL_MCU_NO_PIN ((uint8_t)0xff)
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_MICROCONTROLLER_PIN_H
diff --git a/shared-bindings/os/__init__.c b/shared-bindings/os/__init__.c
index c2b63bbce..f3b745aef 100644
--- a/shared-bindings/os/__init__.c
+++ b/shared-bindings/os/__init__.c
@@ -143,6 +143,11 @@ MP_DEFINE_CONST_FUN_OBJ_1(os_rmdir_obj, os_rmdir);
//|
//| Get the status of a file or directory.
//|
+//| .. note:: On builds without long integers, the number of seconds
+//| for contemporary dates will not fit in a small integer.
+//| So the time fields return 946684800,
+//| which is the number of seconds corresponding to 1999-12-31.
+//|
mp_obj_t os_stat(mp_obj_t path_in) {
const char *path = mp_obj_str_get_str(path_in);
return common_hal_os_stat(path);
diff --git a/shared-bindings/ps2io/Ps2.c b/shared-bindings/ps2io/Ps2.c
index fb5c24b85..89ed0a76c 100644
--- a/shared-bindings/ps2io/Ps2.c
+++ b/shared-bindings/ps2io/Ps2.c
@@ -77,12 +77,9 @@ STATIC mp_obj_t ps2io_ps2_make_new(const mp_obj_type_t *type, size_t n_args, con
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
- assert_pin(args[ARG_clkpin].u_obj, false);
- assert_pin(args[ARG_datapin].u_obj, false);
- const mcu_pin_obj_t* clkpin = MP_OBJ_TO_PTR(args[ARG_clkpin].u_obj);
- assert_pin_free(clkpin);
- const mcu_pin_obj_t* datapin = MP_OBJ_TO_PTR(args[ARG_datapin].u_obj);
- assert_pin_free(datapin);
+
+ const mcu_pin_obj_t* clkpin = validate_obj_is_free_pin(args[ARG_clkpin].u_obj);
+ const mcu_pin_obj_t* datapin = validate_obj_is_free_pin(args[ARG_datapin].u_obj);
ps2io_ps2_obj_t *self = m_new_obj(ps2io_ps2_obj_t);
self->base.type = &ps2io_ps2_type;
diff --git a/shared-bindings/pulseio/PWMOut.c b/shared-bindings/pulseio/PWMOut.c
index 53b88c61a..2491a5c3f 100644
--- a/shared-bindings/pulseio/PWMOut.c
+++ b/shared-bindings/pulseio/PWMOut.c
@@ -96,10 +96,7 @@ STATIC mp_obj_t pulseio_pwmout_make_new(const mp_obj_type_t *type, size_t n_args
mp_arg_val_t parsed_args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, parsed_args);
- mp_obj_t pin_obj = parsed_args[ARG_pin].u_obj;
- assert_pin(pin_obj, false);
- const mcu_pin_obj_t *pin = MP_OBJ_TO_PTR(pin_obj);
- assert_pin_free(pin);
+ const mcu_pin_obj_t *pin = validate_obj_is_free_pin(parsed_args[ARG_pin].u_obj);
uint16_t duty_cycle = parsed_args[ARG_duty_cycle].u_int;
uint32_t frequency = parsed_args[ARG_frequency].u_int;
diff --git a/shared-bindings/pulseio/PulseIn.c b/shared-bindings/pulseio/PulseIn.c
index 8b69109f0..6c01a4c17 100644
--- a/shared-bindings/pulseio/PulseIn.c
+++ b/shared-bindings/pulseio/PulseIn.c
@@ -90,9 +90,7 @@ STATIC mp_obj_t pulseio_pulsein_make_new(const mp_obj_type_t *type, size_t n_arg
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
- assert_pin(args[ARG_pin].u_obj, false);
- const mcu_pin_obj_t* pin = MP_OBJ_TO_PTR(args[ARG_pin].u_obj);
- assert_pin_free(pin);
+ const mcu_pin_obj_t* pin = validate_obj_is_free_pin(args[ARG_pin].u_obj);
pulseio_pulsein_obj_t *self = m_new_obj(pulseio_pulsein_obj_t);
self->base.type = &pulseio_pulsein_type;
diff --git a/shared-bindings/rotaryio/IncrementalEncoder.c b/shared-bindings/rotaryio/IncrementalEncoder.c
index f2f157847..058241d24 100644
--- a/shared-bindings/rotaryio/IncrementalEncoder.c
+++ b/shared-bindings/rotaryio/IncrementalEncoder.c
@@ -73,13 +73,8 @@ STATIC mp_obj_t rotaryio_incrementalencoder_make_new(const mp_obj_type_t *type,
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
- assert_pin(args[ARG_pin_a].u_obj, false);
- const mcu_pin_obj_t* pin_a = MP_OBJ_TO_PTR(args[ARG_pin_a].u_obj);
- assert_pin_free(pin_a);
-
- assert_pin(args[ARG_pin_b].u_obj, false);
- const mcu_pin_obj_t* pin_b = MP_OBJ_TO_PTR(args[ARG_pin_b].u_obj);
- assert_pin_free(pin_b);
+ const mcu_pin_obj_t* pin_a = validate_obj_is_free_pin(args[ARG_pin_a].u_obj);
+ const mcu_pin_obj_t* pin_b = validate_obj_is_free_pin(args[ARG_pin_b].u_obj);
rotaryio_incrementalencoder_obj_t *self = m_new_obj(rotaryio_incrementalencoder_obj_t);
self->base.type = &rotaryio_incrementalencoder_type;
diff --git a/shared-bindings/time/__init__.c b/shared-bindings/time/__init__.c
index b3e4604b5..8d7f2f3fd 100644
--- a/shared-bindings/time/__init__.c
+++ b/shared-bindings/time/__init__.c
@@ -70,14 +70,16 @@ MP_DEFINE_CONST_FUN_OBJ_0(time_monotonic_obj, time_monotonic);
//|
STATIC mp_obj_t time_sleep(mp_obj_t seconds_o) {
#if MICROPY_PY_BUILTINS_FLOAT
- float seconds = mp_obj_get_float(seconds_o);
+ mp_float_t seconds = mp_obj_get_float(seconds_o);
+ mp_float_t msecs = 1000.0f * seconds + 0.5f;
#else
- int seconds = mp_obj_get_int(seconds_o);
+ mp_int_t seconds = mp_obj_get_int(seconds_o);
+ mp_int_t msecs = 1000 * seconds;
#endif
if (seconds < 0) {
mp_raise_ValueError(translate("sleep length must be non-negative"));
}
- common_hal_time_delay_ms(1000 * seconds);
+ common_hal_time_delay_ms(msecs);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_1(time_sleep_obj, time_sleep);
@@ -216,7 +218,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(time_time_obj, time_time);
//| :rtype: int
//|
STATIC mp_obj_t time_monotonic_ns(void) {
- uint64_t time64 = common_hal_time_monotonic() * 1000000llu;
+ uint64_t time64 = common_hal_time_monotonic_ns();
return mp_obj_new_int_from_ll((long long) time64);
}
MP_DEFINE_CONST_FUN_OBJ_0(time_monotonic_ns_obj, time_monotonic_ns);
diff --git a/shared-bindings/time/__init__.h b/shared-bindings/time/__init__.h
index c5a0b47fc..ec96aea24 100644
--- a/shared-bindings/time/__init__.h
+++ b/shared-bindings/time/__init__.h
@@ -36,6 +36,7 @@ extern mp_obj_t struct_time_from_tm(timeutils_struct_time_t *tm);
extern void struct_time_to_tm(mp_obj_t t, timeutils_struct_time_t *tm);
extern uint64_t common_hal_time_monotonic(void);
+extern uint64_t common_hal_time_monotonic_ns(void);
extern void common_hal_time_delay_ms(uint32_t);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_TIME___INIT___H
diff --git a/shared-bindings/touchio/TouchIn.c b/shared-bindings/touchio/TouchIn.c
index 33d369c74..db53ec1bc 100644
--- a/shared-bindings/touchio/TouchIn.c
+++ b/shared-bindings/touchio/TouchIn.c
@@ -66,10 +66,7 @@ STATIC mp_obj_t touchio_touchin_make_new(const mp_obj_type_t *type,
mp_arg_check_num(n_args, kw_args, 1, 1, false);
// 1st argument is the pin
- mp_obj_t pin_obj = args[0];
- assert_pin(pin_obj, false);
- const mcu_pin_obj_t *pin = MP_OBJ_TO_PTR(pin_obj);
- assert_pin_free(pin);
+ const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[0]);
touchio_touchin_obj_t *self = m_new_obj(touchio_touchin_obj_t);
self->base.type = &touchio_touchin_type;
diff --git a/shared-bindings/ulab/__init__.rst b/shared-bindings/ulab/__init__.rst
new file mode 100644
index 000000000..c9f2617ff
--- /dev/null
+++ b/shared-bindings/ulab/__init__.rst
@@ -0,0 +1,491 @@
+
+:mod:`ulab` --- Manipulate numeric data similar to numpy
+========================================================
+
+.. module:: ulab
+ :synopsis: Manipulate numeric data similar to numpy
+
+`ulab` is a numpy-like module for micropython, meant to simplify and
+speed up common mathematical operations on arrays. The primary goal was to
+implement a small subset of numpy that might be useful in the context of a
+microcontroller. This means low-level data processing of linear (array) and
+two-dimensional (matrix) data.
+
+`ulab` is adapted from micropython-ulab, and the original project's
+documentation can be found at
+https://micropython-ulab.readthedocs.io/en/latest/
+
+`ulab` is modeled after numpy, and aims to be a compatible subset where
+possible. Numpy's documentation can be found at
+https://docs.scipy.org/doc/numpy/index.html
+
+.. contents::
+
+.. attribute:: __version__
+
+The closest corresponding version of micropython-ulab
+
+ulab.array -- 1- and 2- dimensional array
+-----------------------------------------
+
+.. class:: ulab.array(values, \*, dtype=float)
+
+ :param sequence values: Sequence giving the initial content of the array.
+ :param dtype: The type of array values, ``int8``, ``uint8``, ``int16``, ``uint16``, or ``float``
+
+ The `values` sequence can either be another ~ulab.array, sequence of numbers
+ (in which case a 1-dimensional array is created), or a sequence where each
+ subsequence has the same length (in which case a 2-dimensional array is
+ created).
+
+ Passing a ~ulab.array and a different dtype can be used to convert an array
+ from one dtype to another.
+
+ In many cases, it is more convenient to create an array from a function
+ like `zeros` or `linspace`.
+
+ `ulab.array` implements the buffer protocol, so it can be used in many
+ places an `array.array` can be used.
+
+ .. attribute:: shape
+
+ The size of the array, a tuple of length 1 or 2
+
+ .. attribute:: size
+
+ The number of elements in the array
+
+ .. attribute:: itemsize
+
+ The number of elements in the array
+
+ .. method:: flatten(\*, order='C')
+
+ :param order: Whether to flatten by rows ('C') or columns ('F')
+
+ Returns a new `ulab.array` object which is always 1 dimensional.
+ If order is 'C' (the default", then the data is ordered in rows;
+ If it is 'F', then the data is ordered in columns. "C" and "F" refer
+ to the typical storage organization of the C and Fortran languages.
+
+ .. method:: sort(\*, axis=1)
+
+ :param axis: Whether to sort elements within rows (0), columns (1), or elements (None)
+
+ .. method:: transpose()
+
+ Swap the rows and columns of a 2-dimensional array
+
+ .. method:: __add__()
+
+ Adds corresponding elements of the two arrays, or adds a number to all
+ elements of the array. If both arguments are arrays, their sizes must match.
+
+ .. method:: __sub__()
+
+ Subtracts corresponding elements of the two arrays, or adds a number to all
+ elements of the array. If both arguments are arrays, their sizes must match.
+
+ .. method:: __mul__()
+
+ Multiplies corresponding elements of the two arrays, or multiplies
+ all elements of the array by a number. If both arguments are arrays,
+ their sizes must match.
+
+ .. method:: __div__()
+
+ Multiplies corresponding elements of the two arrays, or divides
+ all elements of the array by a number. If both arguments are arrays,
+ their sizes must match.
+
+ .. method:: __pow__()
+
+ Computes the power (x**y) of corresponding elements of the the two arrays,
+ or one number and one array. If both arguments are arrays, their sizes
+ must match.
+
+ .. method:: __getitem__()
+
+ Retrieve an element of the array.
+
+ .. method:: __setitem__()
+
+ Set an element of the array.
+
+Array type codes
+----------------
+.. attribute:: int8
+
+ Type code for signed integers in the range -128 .. 127 inclusive, like the 'b' typecode of `array.array`
+
+.. attribute:: int16
+
+ Type code for signed integers in the range -32768 .. 32767 inclusive, like the 'h' typecode of `array.array`
+
+.. attribute:: float
+
+ Type code for floating point values, like the 'f' typecode of `array.array`
+
+.. attribute:: uint8
+
+ Type code for unsigned integers in the range 0 .. 255 inclusive, like the 'H' typecode of `array.array`
+
+.. attribute:: uint16
+
+ Type code for unsigned integers in the range 0 .. 65535 inclusive, like the 'h' typecode of `array.array`
+
+
+Basic Array defining functions
+------------------------------
+
+.. method:: ones(shape, \*, dtype=float)
+
+ .. param: shape
+ Shape of the array, either an integer (for a 1-D array) or a tuple of 2 integers (for a 2-D array)
+
+ .. param: dtype
+ Type of values in the array
+
+ Return a new array of the given shape with all elements set to 1.
+
+.. method:: zeros
+
+ .. param: shape
+ Shape of the array, either an integer (for a 1-D array) or a tuple of 2 integers (for a 2-D array)
+
+ .. param: dtype
+ Type of values in the array
+
+ Return a new array of the given shape with all elements set to 0.
+
+
+.. method:: eye(size, \*, dtype=float)
+
+ Return a new square array of size, with the diagonal elements set to 1
+ and the other elements set to 0.
+
+.. method:: linspace(start, stop, \*, dtype=float, num=50, endpoint=True)
+
+ .. param: start
+
+ First value in the array
+
+ .. param: stop
+
+ Final value in the array
+
+ .. param int: num
+
+ Count of values in the array
+
+ .. param: dtype
+
+ Type of values in the array
+
+ .. param bool: endpoint
+
+ Whether the ``stop`` value is included. Note that even when
+ endpoint=True, the exact ``stop`` value may not be included due to the
+ inaccuracy of floating point arithmetic.
+
+ Return a new 1-D array with ``num`` elements ranging from ``start`` to ``stop`` linearly.
+
+
+
+:mod:`ulab.vector` --- Element-by-element functions
+===================================================
+
+.. module:: ulab.vector
+
+These functions can operate on numbers, 1-D arrays, or 2-D arrays by
+applying the function to every element in the array. This is typically
+much more efficient than expressing the same operation as a Python loop.
+
+.. method:: acos
+
+ Computes the inverse cosine function
+
+.. method:: acosh
+
+ Computes the inverse hyperbolic cosine function
+
+.. method:: asin
+
+ Computes the inverse sine function
+
+.. method:: asinh
+
+ Computes the inverse hyperbolic sine function
+
+.. method:: around(a, \*, decimals)
+
+ Returns a new float array in which each element is rounded to
+ ``decimals`` places.
+
+.. method:: atan
+
+ Computes the inverse tangent function; the return values are in the
+ range [-pi/2,pi/2].
+
+.. method:: atan2(y,x)
+
+ Computes the inverse tangent function of y/x; the return values are in
+ the range [-pi, pi].
+
+.. method:: atanh
+
+ Computes the inverse hyperbolic tangent function
+
+.. method:: ceil
+
+ Rounds numbers up to the next whole number
+
+.. method:: cos
+
+ Computes the cosine function
+
+.. method:: erf
+
+ Computes the error function, which has applications in statistics
+
+.. method:: erfc
+
+ Computes the complementary error function, which has applications in statistics
+
+.. method:: exp
+
+ Computes the exponent function.
+
+.. method:: expm1
+
+ Computes $e^x-1$. In certain applications, using this function preserves numeric accuracy better than the `exp` function.
+
+.. method:: floor
+
+ Rounds numbers up to the next whole number
+
+.. method:: gamma
+
+ Computes the gamma function
+
+.. method:: lgamma
+
+ Computes the natural log of the gamma function
+
+.. method:: log
+
+ Computes the natural log
+
+.. method:: log10
+
+ Computes the log base 10
+
+.. method:: log2
+
+ Computes the log base 2
+
+.. method:: sin
+
+ Computes the sine
+
+.. method:: sinh
+
+ Computes the hyperbolic sine
+
+.. method:: sqrt
+
+ Computes the square root
+
+.. method:: tan
+
+ Computes the tangent
+
+.. method:: tanh
+
+ Computes the hyperbolic tangent
+
+:mod:`ulab.linalg` - Linear algebra functions
+=============================================
+
+.. module:: ulab.linalg
+
+.. method:: cholesky(A)
+
+ :param ~ulab.array A: a positive definite, symmetric square matrix
+ :return ~ulab.array L: a square root matrix in the lower triangular form
+ :raises ValueError: If the input does not fulfill the necessary conditions
+
+ The returned matrix satisfies the equation m=LL*
+
+.. method:: det
+
+ :param: m, a square matrix
+ :return float: The determinant of the matrix
+
+ Computes the eigenvalues and eigenvectors of a square matrix
+
+.. method:: dot(m1, m2)
+
+ :param ~ulab.array m1: a matrix
+ :param ~ulab.array m2: a matrix
+
+ Computes the matrix product of two matrices
+
+ **WARNING:** Unlike ``numpy``, this function cannot be used to compute the dot product of two vectors
+
+.. method:: eig(m)
+
+ :param m: a square matrix
+ :return tuple (eigenvectors, eigenvalues):
+
+ Computes the eigenvalues and eigenvectors of a square matrix
+
+.. method:: inv(m)
+
+ :param ~ulab.array m: a square matrix
+ :return: The inverse of the matrix, if it exists
+ :raises ValueError: if the matrix is not invertible
+
+ Computes the inverse of a square matrix
+
+.. method:: size(array)
+
+ Return the total number of elements in the array, as an integer.
+
+.. method:: trace(m)
+
+ :param m: a square matrix
+
+ Compute the trace of the matrix, the sum of its diagonal elements.
+
+:mod:`ulab.filter` --- Filtering functions
+==========================================
+
+.. module:: ulab.filter
+
+.. method:: convolve(r, c=None)
+
+ :param ulab.array a:
+ :param ulab.array v:
+
+ Returns the discrete, linear convolution of two one-dimensional sequences.
+ The result is always an array of float. Only the ``full`` mode is supported,
+ and the ``mode`` named parameter of numpy is not accepted. Note that all other
+ modes can be had by slicing a ``full`` result.
+
+ Convolution filters can implement high pass, low pass, band pass, etc.,
+ filtering operations. Convolution filters are typically constructed ahead
+ of time. This can be done using desktop python with scipy, or on web pages
+ such as https://fiiir.com/
+
+ Convolution is most time-efficient when both inputs are of float type.
+
+:mod:`ulab.fft` --- Frequency-domain functions
+==============================================
+
+.. module:: ulab.fft
+
+.. method:: fft(r, c=None)
+
+ :param ulab.array r: A 1-dimension array of values whose size is a power of 2
+ :param ulab.array c: An optional 1-dimension array of values whose size is a power of 2, giving the complex part of the value
+ :return tuple (r, c): The real and complex parts of the FFT
+
+ Perform a Fast Fourier Transform from the time domain into the frequency domain
+
+ See also ~ulab.extras.spectrum, which computes the magnitude of the fft,
+ rather than separately returning its real and imaginary parts.
+
+.. method:: ifft(r, c=None)
+
+ :param ulab.array r: A 1-dimension array of values whose size is a power of 2
+ :param ulab.array c: An optional 1-dimension array of values whose size is a power of 2, giving the complex part of the value
+ :return tuple (r, c): The real and complex parts of the inverse FFT
+
+ Perform an Inverse Fast Fourier Transform from the frequeny domain into the time domain
+
+:mod:`ulab.numerical` --- Numerical and Statistical functions
+=============================================================
+
+.. module:: ulab.numerical
+
+Most of these functions take an "axis" argument, which indicates whether to
+operate over the flattened array (None), rows (0), or columns (1).
+
+.. method:: argmax(array, \*, axis=None)
+
+ Return the index of the maximum element of the 1D array
+
+.. method:: argmin(array, \*, axis=None)
+
+ Return the index of the minimum element of the 1D array
+
+.. method:: argsort(array, \*, axis=None)
+
+ Returns an array which gives indices into the input array from least to greatest.
+
+.. method:: diff(array, \*, axis=1)
+
+ Return the numerical derivative of successive elements of the array, as
+ an array. axis=None is not supported.
+
+.. method:: flip(array, \*, axis=None)
+
+ Returns a new array that reverses the order of the elements along the
+ given axis, or along all axes if axis is None.
+
+.. method:: max(array, \*, axis=None)
+
+ Return the maximum element of the 1D array
+
+.. method:: mean(array, \*, axis=None)
+
+ Return the mean element of the 1D array, as a number if axis is None, otherwise as an array.
+
+.. method:: min(array, \*, axis=None)
+
+ Return the minimum element of the 1D array
+
+.. method:: roll(array, distance, \*, axis=None)
+
+ Shift the content of a vector by the positions given as the second
+ argument. If the ``axis`` keyword is supplied, the shift is applied to
+ the given axis. The array is modified in place.
+
+.. method:: std(array, \*, axis=None)
+
+ Return the standard deviation of the array, as a number if axis is None, otherwise as an array.
+
+.. method:: sum(array, \*, axis=None)
+
+ Return the sum of the array, as a number if axis is None, otherwise as an array.
+
+.. method:: sort(array, \*, axis=0)
+
+ Sort the array along the given axis, or along all axes if axis is None.
+ The array is modified in place.
+
+:mod:`ulab.poly` --- Polynomial functions
+=========================================
+
+.. module:: ulab.poly
+
+.. method:: polyfit([x, ] y, degree)
+
+ Return a polynomial of given degree that approximates the function
+ f(x)=y. If x is not supplied, it is the range(len(y)).
+
+.. method:: polyval(p, x)
+
+ Evaluate the polynomial p at the points x. x must be an array.
+
+:mod:`ulab.extras` --- Additional functions not in numpy
+========================================================
+
+.. method:: spectrum(r):
+
+ :param ulab.array r: A 1-dimension array of values whose size is a power of 2
+
+ Computes the spectrum of the input signal. This is the absolute value of the (complex-valued) fft of the signal.
+
+ This function is similar to scipy's ``scipy.signal.spectrogram``.
diff --git a/shared-bindings/wiznet/wiznet5k.c b/shared-bindings/wiznet/wiznet5k.c
index ac89cc691..786978bfe 100644
--- a/shared-bindings/wiznet/wiznet5k.c
+++ b/shared-bindings/wiznet/wiznet5k.c
@@ -78,10 +78,10 @@ STATIC mp_obj_t wiznet5k_make_new(const mp_obj_type_t *type, size_t n_args, cons
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
// TODO check type of ARG_spi?
- assert_pin(args[ARG_cs].u_obj, false);
- assert_pin(args[ARG_rst].u_obj, true); // may be NULL
+ const mcu_pin_obj_t *cs = validate_obj_is_free_pin(args[ARG_cs].u_obj);
+ const mcu_pin_obj_t *rst = validate_obj_is_free_pin_or_none(args[ARG_rst].u_obj);
- mp_obj_t ret = wiznet5k_create(args[ARG_spi].u_obj, args[ARG_cs].u_obj, args[ARG_rst].u_obj);
+ mp_obj_t ret = wiznet5k_create(args[ARG_spi].u_obj, cs, rst);
if (args[ARG_dhcp].u_bool) wiznet5k_start_dhcp();
return ret;
}
diff --git a/shared-module/_eve/__init__.c b/shared-module/_eve/__init__.c
new file mode 100644
index 000000000..2c93eb69f
--- /dev/null
+++ b/shared-module/_eve/__init__.c
@@ -0,0 +1,317 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 James Bowman for Excamera Labs
+ *
+ * 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 <stddef.h>
+#include <stdint.h>
+#include "py/runtime.h"
+#include "shared-module/_eve/__init__.h"
+
+STATIC void write(common_hal__eve_t *eve, size_t len, void *buf) {
+ eve->dest[2] = mp_obj_new_bytearray_by_ref(len, buf);
+ mp_call_method_n_kw(1, 0, eve->dest);
+}
+
+void common_hal__eve_flush(common_hal__eve_t *eve) {
+ if (eve->n != 0) {
+ write(eve, eve->n, eve->buf);
+ eve->n = 0;
+ }
+}
+
+static void *append(common_hal__eve_t *eve, size_t m) {
+ if ((eve->n + m) > sizeof(eve->buf))
+ common_hal__eve_flush(eve);
+ uint8_t *r = eve->buf + eve->n;
+ eve->n += m;
+ return (void*)r;
+}
+
+void common_hal__eve_add(common_hal__eve_t *eve, size_t len, void *buf) {
+ if (len <= sizeof(eve->buf)) {
+ uint8_t *p = (uint8_t*)append(eve, len);
+ // memcpy(p, buffer_info.buf, buffer_info.len);
+ uint8_t *s = buf; for (size_t i = 0; i < len; i++) *p++ = *s++;
+ } else {
+ common_hal__eve_flush(eve);
+ write(eve, len, buf);
+ }
+}
+
+#define C4(eve, u) (*(uint32_t*)append((eve), sizeof(uint32_t)) = (u))
+
+void common_hal__eve_Vertex2f(common_hal__eve_t *eve, mp_float_t x, mp_float_t y) {
+ int16_t ix = (int)(eve->vscale * x);
+ int16_t iy = (int)(eve->vscale * y);
+ C4(eve, (1 << 30) | ((ix & 32767) << 15) | (iy & 32767));
+}
+
+void common_hal__eve_VertexFormat(common_hal__eve_t *eve, uint32_t frac)
+{
+ C4(eve, ((27 << 24) | ((frac & 7))));
+ eve->vscale = 1 << eve->vscale;
+}
+
+
+
+void common_hal__eve_AlphaFunc(common_hal__eve_t *eve, uint32_t func, uint32_t ref) {
+ C4(eve, ((9 << 24) | ((func & 7) << 8) | ((ref & 255))));
+}
+
+
+void common_hal__eve_Begin(common_hal__eve_t *eve, uint32_t prim) {
+ C4(eve, ((31 << 24) | ((prim & 15))));
+}
+
+
+void common_hal__eve_BitmapExtFormat(common_hal__eve_t *eve, uint32_t fmt) {
+ C4(eve, ((46 << 24) | (fmt & 65535)));
+}
+
+
+void common_hal__eve_BitmapHandle(common_hal__eve_t *eve, uint32_t handle) {
+ C4(eve, ((5 << 24) | ((handle & 31))));
+}
+
+
+void common_hal__eve_BitmapLayoutH(common_hal__eve_t *eve, uint32_t linestride, uint32_t height) {
+ C4(eve, ((40 << 24) | (((linestride) & 3) << 2) | (((height) & 3))));
+}
+
+
+void common_hal__eve_BitmapLayout(common_hal__eve_t *eve, uint32_t format, uint32_t linestride, uint32_t height) {
+ C4(eve, ((7 << 24) | ((format & 31) << 19) | ((linestride & 1023) << 9) | ((height & 511))));
+}
+
+
+void common_hal__eve_BitmapSizeH(common_hal__eve_t *eve, uint32_t width, uint32_t height) {
+ C4(eve, ((41 << 24) | (((width) & 3) << 2) | (((height) & 3))));
+}
+
+
+void common_hal__eve_BitmapSize(common_hal__eve_t *eve, uint32_t filter, uint32_t wrapx, uint32_t wrapy, uint32_t width, uint32_t height) {
+ C4(eve, ((8 << 24) | ((filter & 1) << 20) | ((wrapx & 1) << 19) | ((wrapy & 1) << 18) | ((width & 511) << 9) | ((height & 511))));
+}
+
+
+void common_hal__eve_BitmapSource(common_hal__eve_t *eve, uint32_t addr) {
+ C4(eve, ((1 << 24) | ((addr & 0xffffff))));
+}
+
+
+void common_hal__eve_BitmapSwizzle(common_hal__eve_t *eve, uint32_t r, uint32_t g, uint32_t b, uint32_t a) {
+ C4(eve, ((47 << 24) | ((r & 7) << 9) | ((g & 7) << 6) | ((b & 7) << 3) | ((a & 7))));
+}
+
+
+void common_hal__eve_BitmapTransformA(common_hal__eve_t *eve, uint32_t p, uint32_t v) {
+ C4(eve, ((21 << 24) | ((p & 1) << 17) | ((v & 131071))));
+}
+
+
+void common_hal__eve_BitmapTransformB(common_hal__eve_t *eve, uint32_t p, uint32_t v) {
+ C4(eve, ((22 << 24) | ((p & 1) << 17) | ((v & 131071))));
+}
+
+
+void common_hal__eve_BitmapTransformC(common_hal__eve_t *eve, uint32_t v) {
+ C4(eve, ((23 << 24) | ((v & 16777215))));
+}
+
+
+void common_hal__eve_BitmapTransformD(common_hal__eve_t *eve, uint32_t p, uint32_t v) {
+ C4(eve, ((24 << 24) | ((p & 1) << 17) | ((v & 131071))));
+}
+
+
+void common_hal__eve_BitmapTransformE(common_hal__eve_t *eve, uint32_t p, uint32_t v) {
+ C4(eve, ((25 << 24) | ((p & 1) << 17) | ((v & 131071))));
+}
+
+
+void common_hal__eve_BitmapTransformF(common_hal__eve_t *eve, uint32_t v) {
+ C4(eve, ((26 << 24) | ((v & 16777215))));
+}
+
+
+void common_hal__eve_BlendFunc(common_hal__eve_t *eve, uint32_t src, uint32_t dst) {
+ C4(eve, ((11 << 24) | ((src & 7) << 3) | ((dst & 7))));
+}
+
+
+void common_hal__eve_Call(common_hal__eve_t *eve, uint32_t dest) {
+ C4(eve, ((29 << 24) | ((dest & 65535))));
+}
+
+
+void common_hal__eve_Cell(common_hal__eve_t *eve, uint32_t cell) {
+ C4(eve, ((6 << 24) | ((cell & 127))));
+}
+
+
+void common_hal__eve_ClearColorA(common_hal__eve_t *eve, uint32_t alpha) {
+ C4(eve, ((15 << 24) | ((alpha & 255))));
+}
+
+
+void common_hal__eve_ClearColorRGB(common_hal__eve_t *eve, uint32_t red, uint32_t green, uint32_t blue) {
+ C4(eve, ((2 << 24) | ((red & 255) << 16) | ((green & 255) << 8) | ((blue & 255))));
+}
+
+
+void common_hal__eve_Clear(common_hal__eve_t *eve, uint32_t c, uint32_t s, uint32_t t) {
+ C4(eve, ((38 << 24) | ((c & 1) << 2) | ((s & 1) << 1) | ((t & 1))));
+}
+
+
+void common_hal__eve_ClearStencil(common_hal__eve_t *eve, uint32_t s) {
+ C4(eve, ((17 << 24) | ((s & 255))));
+}
+
+
+void common_hal__eve_ClearTag(common_hal__eve_t *eve, uint32_t s) {
+ C4(eve, ((18 << 24) | ((s & 255))));
+}
+
+
+void common_hal__eve_ColorA(common_hal__eve_t *eve, uint32_t alpha) {
+ C4(eve, ((16 << 24) | ((alpha & 255))));
+}
+
+
+void common_hal__eve_ColorMask(common_hal__eve_t *eve, uint32_t r, uint32_t g, uint32_t b, uint32_t a) {
+ C4(eve, ((32 << 24) | ((r & 1) << 3) | ((g & 1) << 2) | ((b & 1) << 1) | ((a & 1))));
+}
+
+
+void common_hal__eve_ColorRGB(common_hal__eve_t *eve, uint32_t red, uint32_t green, uint32_t blue) {
+ C4(eve, ((4 << 24) | ((red & 255) << 16) | ((green & 255) << 8) | ((blue & 255))));
+}
+
+
+void common_hal__eve_Display(common_hal__eve_t *eve) {
+ C4(eve, ((0 << 24)));
+}
+
+
+void common_hal__eve_End(common_hal__eve_t *eve) {
+ C4(eve, ((33 << 24)));
+}
+
+
+void common_hal__eve_Jump(common_hal__eve_t *eve, uint32_t dest) {
+ C4(eve, ((30 << 24) | ((dest & 65535))));
+}
+
+
+void common_hal__eve_LineWidth(common_hal__eve_t *eve, uint32_t width) {
+ C4(eve, ((14 << 24) | ((width & 4095))));
+}
+
+
+void common_hal__eve_Macro(common_hal__eve_t *eve, uint32_t m) {
+ C4(eve, ((37 << 24) | ((m & 1))));
+}
+
+
+void common_hal__eve_Nop(common_hal__eve_t *eve) {
+ C4(eve, ((45 << 24)));
+}
+
+
+void common_hal__eve_PaletteSource(common_hal__eve_t *eve, uint32_t addr) {
+ C4(eve, ((42 << 24) | (((addr) & 4194303))));
+}
+
+
+void common_hal__eve_PointSize(common_hal__eve_t *eve, uint32_t size) {
+ C4(eve, ((13 << 24) | ((size & 8191))));
+}
+
+
+void common_hal__eve_RestoreContext(common_hal__eve_t *eve) {
+ C4(eve, ((35 << 24)));
+}
+
+
+void common_hal__eve_Return(common_hal__eve_t *eve) {
+ C4(eve, ((36 << 24)));
+}
+
+
+void common_hal__eve_SaveContext(common_hal__eve_t *eve) {
+ C4(eve, ((34 << 24)));
+}
+
+
+void common_hal__eve_ScissorSize(common_hal__eve_t *eve, uint32_t width, uint32_t height) {
+ C4(eve, ((28 << 24) | ((width & 4095) << 12) | ((height & 4095))));
+}
+
+
+void common_hal__eve_ScissorXY(common_hal__eve_t *eve, uint32_t x, uint32_t y) {
+ C4(eve, ((27 << 24) | ((x & 2047) << 11) | ((y & 2047))));
+}
+
+
+void common_hal__eve_StencilFunc(common_hal__eve_t *eve, uint32_t func, uint32_t ref, uint32_t mask) {
+ C4(eve, ((10 << 24) | ((func & 7) << 16) | ((ref & 255) << 8) | ((mask & 255))));
+}
+
+
+void common_hal__eve_StencilMask(common_hal__eve_t *eve, uint32_t mask) {
+ C4(eve, ((19 << 24) | ((mask & 255))));
+}
+
+
+void common_hal__eve_StencilOp(common_hal__eve_t *eve, uint32_t sfail, uint32_t spass) {
+ C4(eve, ((12 << 24) | ((sfail & 7) << 3) | ((spass & 7))));
+}
+
+
+void common_hal__eve_TagMask(common_hal__eve_t *eve, uint32_t mask) {
+ C4(eve, ((20 << 24) | ((mask & 1))));
+}
+
+
+void common_hal__eve_Tag(common_hal__eve_t *eve, uint32_t s) {
+ C4(eve, ((3 << 24) | ((s & 255))));
+}
+
+
+void common_hal__eve_VertexTranslateX(common_hal__eve_t *eve, uint32_t x) {
+ C4(eve, ((43 << 24) | (((x) & 131071))));
+}
+
+
+void common_hal__eve_VertexTranslateY(common_hal__eve_t *eve, uint32_t y) {
+ C4(eve, ((44 << 24) | (((y) & 131071))));
+}
+
+
+void common_hal__eve_Vertex2ii(common_hal__eve_t *eve, uint32_t x, uint32_t y, uint32_t handle, uint32_t cell) {
+ C4(eve, ((2 << 30) | (((x) & 511) << 21) | (((y) & 511) << 12) | (((handle) & 31) << 7) | (((cell) & 127) << 0)));
+}
+
diff --git a/shared-module/_eve/__init__.h b/shared-module/_eve/__init__.h
new file mode 100644
index 000000000..5217d860a
--- /dev/null
+++ b/shared-module/_eve/__init__.h
@@ -0,0 +1,37 @@
+/*
+ * This file is part of the Micro Python project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 James Bowman for Excamera Labs
+ *
+ * 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_SHARED_MODULE__EVE___INIT___H
+#define MICROPY_INCLUDED_SHARED_MODULE__EVE___INIT___H
+
+typedef struct _common_hal__eve_t {
+ mp_obj_t dest[3]; // Own 'write' method, plus argument
+ int vscale; // fixed-point scaling used for Vertex2f
+ size_t n; // Current size of command buffer
+ uint8_t buf[512]; // Command buffer
+} common_hal__eve_t;
+
+#endif // MICROPY_INCLUDED_SHARED_MODULE__EVE___INIT___H
diff --git a/shared-module/_pixelbuf/PixelBuf.c b/shared-module/_pixelbuf/PixelBuf.c
index bad8539ea..31350b875 100644
--- a/shared-module/_pixelbuf/PixelBuf.c
+++ b/shared-module/_pixelbuf/PixelBuf.c
@@ -243,6 +243,7 @@ mp_obj_t common_hal__pixelbuf_pixelbuf_get_pixel(mp_obj_t self_in, size_t index)
if (self->pre_brightness_buffer != NULL) {
pixel_buffer = self->pre_brightness_buffer;
}
+ pixel_buffer += self->byteorder.bpp * index;
pixelbuf_rgbw_t *rgbw_order = &self->byteorder.byteorder;
elems[0] = MP_OBJ_NEW_SMALL_INT(pixel_buffer[rgbw_order->r]);
diff --git a/shared-module/_protomatter/Protomatter.c b/shared-module/_protomatter/Protomatter.c
new file mode 100644
index 000000000..77ca63476
--- /dev/null
+++ b/shared-module/_protomatter/Protomatter.c
@@ -0,0 +1,200 @@
+/*
+ * This file is part of the Micro Python project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Jeff Epler 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 <string.h>
+
+#include "py/gc.h"
+#include "py/obj.h"
+#include "py/objarray.h"
+#include "py/objproperty.h"
+#include "py/runtime.h"
+
+#include "common-hal/_protomatter/Protomatter.h"
+#include "shared-module/_protomatter/allocator.h"
+#include "shared-bindings/_protomatter/Protomatter.h"
+#include "shared-bindings/microcontroller/Pin.h"
+#include "shared-bindings/microcontroller/__init__.h"
+#include "shared-bindings/util.h"
+#include "shared-module/framebufferio/FramebufferDisplay.h"
+
+extern Protomatter_core *_PM_protoPtr;
+
+void common_hal_protomatter_protomatter_construct(protomatter_protomatter_obj_t *self, int width, int bit_depth, uint8_t rgb_count, uint8_t *rgb_pins, uint8_t addr_count, uint8_t *addr_pins, uint8_t clock_pin, uint8_t latch_pin, uint8_t oe_pin, bool doublebuffer, mp_obj_t framebuffer, void *timer) {
+ self->width = width;
+ self->bit_depth = bit_depth;
+ self->rgb_count = rgb_count;
+ memcpy(self->rgb_pins, rgb_pins, rgb_count);
+ self->addr_count = addr_count;
+ memcpy(self->addr_pins, addr_pins, addr_count);
+ self->clock_pin = clock_pin;
+ self->oe_pin = oe_pin;
+ self->latch_pin = latch_pin;
+ self->doublebuffer = doublebuffer;
+
+ self->timer = timer ? timer : common_hal_protomatter_timer_allocate();
+ if (self->timer == NULL) {
+ mp_raise_ValueError(translate("No timer available"));
+ }
+
+ self->width = width;
+ self->bufsize = 2 * width * rgb_count / 3 * (1 << addr_count);
+
+ common_hal_protomatter_protomatter_reconstruct(self, framebuffer);
+}
+
+void common_hal_protomatter_protomatter_reconstruct(protomatter_protomatter_obj_t* self, mp_obj_t framebuffer) {
+ if (framebuffer) {
+ self->framebuffer = framebuffer;
+ framebuffer = mp_obj_new_bytearray_of_zeros(self->bufsize);
+ mp_get_buffer_raise(self->framebuffer, &self->bufinfo, MP_BUFFER_READ);
+ if (mp_get_buffer(self->framebuffer, &self->bufinfo, MP_BUFFER_RW)) {
+ self->bufinfo.typecode = 'H' | MP_OBJ_ARRAY_TYPECODE_FLAG_RW;
+ } else {
+ self->bufinfo.typecode = 'H';
+ }
+ // verify that the matrix is big enough
+ mp_get_index(mp_obj_get_type(self->framebuffer), self->bufinfo.len, MP_OBJ_NEW_SMALL_INT(self->bufsize-1), false);
+ } else {
+ _PM_FREE(self->bufinfo.buf);
+ _PM_FREE(self->core.rgbPins);
+ _PM_FREE(self->core.addr);
+ _PM_FREE(self->core.screenData);
+
+ self->framebuffer = NULL;
+ self->bufinfo.buf = _PM_allocator_impl(self->bufsize);
+ self->bufinfo.len = self->bufsize;
+ self->bufinfo.typecode = 'H' | MP_OBJ_ARRAY_TYPECODE_FLAG_RW;
+ }
+
+ ProtomatterStatus stat = _PM_init(&self->core,
+ self->width, self->bit_depth,
+ self->rgb_count/6, self->rgb_pins,
+ self->addr_count, self->addr_pins,
+ self->clock_pin, self->latch_pin, self->oe_pin,
+ self->doublebuffer, self->timer);
+
+ if (stat == PROTOMATTER_OK) {
+ _PM_protoPtr = &self->core;
+ common_hal_mcu_disable_interrupts();
+ common_hal_protomatter_timer_enable(self->timer);
+ stat = _PM_begin(&self->core);
+ _PM_convert_565(&self->core, self->bufinfo.buf, self->width);
+ common_hal_mcu_enable_interrupts();
+ _PM_swapbuffer_maybe(&self->core);
+ }
+
+ if (stat != PROTOMATTER_OK) {
+ // XXX this deinit() actually makes crashy-crashy
+ // can trigger it by sending inappropriate pins
+ common_hal_protomatter_protomatter_deinit(self);
+ switch (stat) {
+ case PROTOMATTER_ERR_PINS:
+ mp_raise_ValueError(translate("Invalid pin"));
+ break;
+ case PROTOMATTER_ERR_ARG:
+ mp_raise_ValueError(translate("Invalid argument"));
+ break;
+ case PROTOMATTER_ERR_MALLOC: /// should have already been signaled as NLR
+ default:
+ mp_raise_msg_varg(&mp_type_RuntimeError,
+ translate("Protomatter internal error #%d"), (int)stat);
+ break;
+ }
+ }
+
+ self->paused = 0;
+
+}
+
+STATIC void free_pin(uint8_t *pin) {
+ if (*pin != COMMON_HAL_MCU_NO_PIN) {
+ common_hal_mcu_pin_reset_number(*pin);
+ }
+ *pin = COMMON_HAL_MCU_NO_PIN;
+}
+
+STATIC void free_pin_seq(uint8_t *seq, int count) {
+ for (int i=0; i<count; i++) {
+ free_pin(&seq[i]);
+ }
+}
+
+void common_hal_protomatter_protomatter_deinit(protomatter_protomatter_obj_t* self) {
+ if (self->timer) {
+ common_hal_protomatter_timer_free(self->timer);
+ self->timer = 0;
+ }
+
+ if (_PM_protoPtr == &self->core) {
+ _PM_protoPtr = NULL;
+ }
+
+ free_pin_seq(self->rgb_pins, self->rgb_count);
+ free_pin_seq(self->addr_pins, self->addr_count);
+ free_pin(&self->clock_pin);
+ free_pin(&self->latch_pin);
+ free_pin(&self->oe_pin);
+
+ if (self->core.rgbPins) {
+ _PM_free(&self->core);
+ }
+ memset(&self->core, 0, sizeof(self->core));
+
+ // If it was supervisor-allocated, it is supervisor-freed and the pointer
+ // is zeroed, otherwise the pointer is just zeroed
+ _PM_FREE(self->bufinfo.buf);
+ self->base.type = NULL;
+
+ // If a framebuffer was passed in to the constructor, NULL the reference
+ // here so that it will become GC'able
+ self->framebuffer = NULL;
+}
+
+void protomatter_protomatter_collect_ptrs(protomatter_protomatter_obj_t* self) {
+ gc_collect_ptr(self->framebuffer);
+ gc_collect_ptr(self->core.rgbPins);
+ gc_collect_ptr(self->core.addr);
+ gc_collect_ptr(self->core.screenData);
+}
+
+void common_hal_protomatter_protomatter_set_paused(protomatter_protomatter_obj_t* self, bool paused) {
+ if (paused && !self->paused) {
+ _PM_stop(&self->core);
+ } else if (!paused && self->paused) {
+ _PM_resume(&self->core);
+ }
+ self->paused = paused;
+}
+
+bool common_hal_protomatter_protomatter_get_paused(protomatter_protomatter_obj_t* self) {
+ return self->paused;
+}
+
+void common_hal_protomatter_protomatter_refresh(protomatter_protomatter_obj_t* self) {
+ _PM_convert_565(&self->core, self->bufinfo.buf, self->width);
+ _PM_swapbuffer_maybe(&self->core);
+}
+
diff --git a/shared-module/_protomatter/Protomatter.h b/shared-module/_protomatter/Protomatter.h
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/shared-module/_protomatter/Protomatter.h
diff --git a/shared-module/_protomatter/__init__.c b/shared-module/_protomatter/__init__.c
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/shared-module/_protomatter/__init__.c
diff --git a/shared-module/_protomatter/__init__.h b/shared-module/_protomatter/__init__.h
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/shared-module/_protomatter/__init__.h
diff --git a/shared-module/_protomatter/allocator.h b/shared-module/_protomatter/allocator.h
new file mode 100644
index 000000000..b7f517ce5
--- /dev/null
+++ b/shared-module/_protomatter/allocator.h
@@ -0,0 +1,29 @@
+#ifndef MICROPY_INCLUDED_SHARED_MODULE_PROTOMATTER_ALLOCATOR_H
+#define MICROPY_INCLUDED_SHARED_MODULE_PROTOMATTER_ALLOCATOR_H
+
+#include <stdbool.h>
+#include "py/gc.h"
+#include "py/misc.h"
+#include "supervisor/memory.h"
+
+#define _PM_ALLOCATOR _PM_allocator_impl
+#define _PM_FREE(x) (_PM_free_impl((x)), (x)=NULL, (void)0)
+
+static inline void *_PM_allocator_impl(size_t sz) {
+ if (gc_alloc_possible()) {
+ return m_malloc(sz + sizeof(void*), true);
+ } else {
+ supervisor_allocation *allocation = allocate_memory(align32_size(sz), false);
+ return allocation ? allocation->ptr : NULL;
+ }
+}
+
+static inline void _PM_free_impl(void *ptr_in) {
+ supervisor_allocation *allocation = allocation_from_ptr(ptr_in);
+
+ if (allocation) {
+ free_memory(allocation);
+ }
+}
+
+#endif
diff --git a/shared-module/bitbangio/SPI.c b/shared-module/bitbangio/SPI.c
index d02adf34f..e0ff1184f 100644
--- a/shared-module/bitbangio/SPI.c
+++ b/shared-module/bitbangio/SPI.c
@@ -45,7 +45,7 @@ void shared_module_bitbangio_spi_construct(bitbangio_spi_obj_t *self,
}
common_hal_digitalio_digitalinout_switch_to_output(&self->clock, self->polarity == 1, DRIVE_MODE_PUSH_PULL);
- if (mosi != mp_const_none) {
+ if (mosi != NULL) {
result = common_hal_digitalio_digitalinout_construct(&self->mosi, mosi);
if (result != DIGITALINOUT_OK) {
common_hal_digitalio_digitalinout_deinit(&self->clock);
@@ -55,12 +55,12 @@ void shared_module_bitbangio_spi_construct(bitbangio_spi_obj_t *self,
common_hal_digitalio_digitalinout_switch_to_output(&self->mosi, false, DRIVE_MODE_PUSH_PULL);
}
- if (miso != mp_const_none) {
+ if (miso != NULL) {
// Starts out as input by default, no need to change.
result = common_hal_digitalio_digitalinout_construct(&self->miso, miso);
if (result != DIGITALINOUT_OK) {
common_hal_digitalio_digitalinout_deinit(&self->clock);
- if (mosi != mp_const_none) {
+ if (mosi != NULL) {
common_hal_digitalio_digitalinout_deinit(&self->mosi);
}
mp_raise_ValueError(translate("MISO pin init failed."));
diff --git a/shared-module/board/__init__.c b/shared-module/board/__init__.c
index 914bc4313..789318a05 100644
--- a/shared-module/board/__init__.c
+++ b/shared-module/board/__init__.c
@@ -100,8 +100,30 @@ mp_obj_t common_hal_board_create_uart(void) {
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);
+#ifdef DEFAULT_UART_BUS_RTS
+ const mcu_pin_obj_t* rts = MP_OBJ_TO_PTR(DEFAULT_UART_BUS_RTS);
+#else
+ const mcu_pin_obj_t* rts = NULL;
+#endif
+#ifdef DEFAULT_UART_BUS_CTS
+ const mcu_pin_obj_t* cts = MP_OBJ_TO_PTR(DEFAULT_UART_BUS_CTS);
+#else
+ const mcu_pin_obj_t* cts = NULL;
+#endif
+#ifdef DEFAULT_UART_IS_RS485
+ const mcu_pin_obj_t* rs485_dir = MP_OBJ_TO_PTR(DEFAULT_UART_BUS_RS485DIR);
+#ifdef DEFAULT_UART_RS485_INVERT
+ const bool rs485_invert = true;
+#else
+ const bool rs485_invert = false;
+#endif
+#else
+ const mcu_pin_obj_t* rs485_dir = NULL;
+ const bool rs485_invert = false;
+#endif
- common_hal_busio_uart_construct(self, tx, rx, 9600, 8, PARITY_NONE, 1, 1.0f, 64);
+ common_hal_busio_uart_construct(self, tx, rx, rts, cts, rs485_dir, rs485_invert,
+ 9600, 8, PARITY_NONE, 1, 1.0f, 64);
MP_STATE_VM(shared_uart_bus) = MP_OBJ_FROM_PTR(self);
return MP_STATE_VM(shared_uart_bus);
}
diff --git a/shared-module/displayio/Bitmap.c b/shared-module/displayio/Bitmap.c
index 59971d25c..8bcda6086 100644
--- a/shared-module/displayio/Bitmap.c
+++ b/shared-module/displayio/Bitmap.c
@@ -162,3 +162,24 @@ void displayio_bitmap_finish_refresh(displayio_bitmap_t *self) {
self->dirty_area.x1 = 0;
self->dirty_area.x2 = 0;
}
+
+void common_hal_displayio_bitmap_fill(displayio_bitmap_t *self, uint32_t value) {
+ if (self->read_only) {
+ mp_raise_RuntimeError(translate("Read-only object"));
+ }
+ // Update the dirty area.
+ self->dirty_area.x1 = 0;
+ self->dirty_area.x2 = self->width;
+ self->dirty_area.y1 = 0;
+ self->dirty_area.y2 = self->height;
+
+ // build the packed word
+ uint32_t word = 0;
+ for (uint8_t i=0; i<32 / self->bits_per_value; i++) {
+ word |= (value & self->bitmask) << (32 - ((i+1)*self->bits_per_value));
+ }
+ // copy it in
+ for (uint32_t i=0; i<self->stride * self->height; i++) {
+ self->data[i] = word;
+ }
+}
diff --git a/shared-module/displayio/ColorConverter.c b/shared-module/displayio/ColorConverter.c
index a5d7f0b05..2c9fb6d78 100644
--- a/shared-module/displayio/ColorConverter.c
+++ b/shared-module/displayio/ColorConverter.c
@@ -47,9 +47,7 @@ uint16_t displayio_colorconverter_compute_rgb565(uint32_t color_rgb888) {
uint32_t r5 = (color_rgb888 >> 19);
uint32_t g6 = (color_rgb888 >> 10) & 0x3f;
uint32_t b5 = (color_rgb888 >> 3) & 0x1f;
- uint32_t packed = r5 << 11 | g6 << 5 | b5;
- // swap bytes
- return __builtin_bswap16(packed);
+ return r5 << 11 | g6 << 5 | b5;
}
uint8_t displayio_colorconverter_compute_luma(uint32_t color_rgb888) {
@@ -156,7 +154,12 @@ void displayio_colorconverter_convert(displayio_colorconverter_t *self, const _d
}
if (colorspace->depth == 16) {
- output_color->pixel = displayio_colorconverter_compute_rgb565(pixel);
+ uint16_t packed = displayio_colorconverter_compute_rgb565(pixel);
+ if (colorspace->reverse_bytes_in_word) {
+ // swap bytes
+ packed = __builtin_bswap16(packed);
+ }
+ output_color->pixel = packed;
output_color->opaque = true;
return;
} else if (colorspace->tricolor) {
diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c
index 299c8ad35..aaddbb471 100644
--- a/shared-module/displayio/Display.c
+++ b/shared-module/displayio/Display.c
@@ -46,11 +46,11 @@
void common_hal_displayio_display_construct(displayio_display_obj_t* self,
mp_obj_t bus, uint16_t width, uint16_t height, int16_t colstart, int16_t rowstart,
uint16_t rotation, uint16_t color_depth, bool grayscale, bool pixels_in_byte_share_row,
- uint8_t bytes_per_cell, bool reverse_pixels_in_byte, uint8_t set_column_command,
+ uint8_t bytes_per_cell, bool reverse_pixels_in_byte, bool reverse_bytes_in_word, uint8_t set_column_command,
uint8_t set_row_command, uint8_t write_ram_command, uint8_t set_vertical_scroll,
uint8_t* init_sequence, uint16_t init_sequence_len, const mcu_pin_obj_t* backlight_pin,
uint16_t brightness_command, mp_float_t brightness, bool auto_brightness,
- bool single_byte_bounds, bool data_as_commands, bool auto_refresh, uint16_t native_frames_per_second) {
+ bool single_byte_bounds, bool data_as_commands, bool auto_refresh, uint16_t native_frames_per_second, bool backlight_on_high) {
// Turn off auto-refresh as we init.
self->auto_refresh = false;
uint16_t ram_width = 0x100;
@@ -60,7 +60,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
ram_height = 0xff;
}
displayio_display_core_construct(&self->core, bus, width, height, ram_width, ram_height, colstart, rowstart, rotation,
- color_depth, grayscale, pixels_in_byte_share_row, bytes_per_cell, reverse_pixels_in_byte);
+ color_depth, grayscale, pixels_in_byte_share_row, bytes_per_cell, reverse_pixels_in_byte, reverse_bytes_in_word);
self->set_column_command = set_column_command;
self->set_row_command = set_row_command;
@@ -69,6 +69,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
self->auto_brightness = auto_brightness;
self->first_manual_refresh = !auto_refresh;
self->data_as_commands = data_as_commands;
+ self->backlight_on_high = backlight_on_high;
self->native_frames_per_second = native_frames_per_second;
self->native_ms_per_frame = 1000 / native_frames_per_second;
@@ -159,6 +160,9 @@ mp_float_t common_hal_displayio_display_get_brightness(displayio_display_obj_t*
bool common_hal_displayio_display_set_brightness(displayio_display_obj_t* self, mp_float_t brightness) {
self->updating_backlight = true;
+ if (!self->backlight_on_high){
+ brightness = 1.0-brightness;
+ }
bool ok = false;
if (self->backlight_pwm.base.type == &pulseio_pwmout_type) {
common_hal_pulseio_pwmout_set_duty_cycle(&self->backlight_pwm, (uint16_t) (0xffff * brightness));
diff --git a/shared-module/displayio/Display.h b/shared-module/displayio/Display.h
index e5fe0a708..8adaf597f 100644
--- a/shared-module/displayio/Display.h
+++ b/shared-module/displayio/Display.h
@@ -55,6 +55,7 @@ typedef struct {
bool data_as_commands;
bool auto_brightness;
bool updating_backlight;
+ bool backlight_on_high;
} displayio_display_obj_t;
void displayio_display_background(displayio_display_obj_t* self);
diff --git a/shared-module/displayio/EPaperDisplay.c b/shared-module/displayio/EPaperDisplay.c
index 91d4bb7f9..5b4a8f916 100644
--- a/shared-module/displayio/EPaperDisplay.c
+++ b/shared-module/displayio/EPaperDisplay.c
@@ -58,7 +58,7 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t*
self->core.colorspace.tricolor_luma = displayio_colorconverter_compute_luma(highlight_color);
}
- displayio_display_core_construct(&self->core, bus, width, height, ram_width, ram_height, colstart, rowstart, rotation, 1, true, true, 1, true);
+ displayio_display_core_construct(&self->core, bus, width, height, ram_width, ram_height, colstart, rowstart, rotation, 1, true, true, 1, true, true);
self->set_column_window_command = set_column_window_command;
self->set_row_window_command = set_row_window_command;
diff --git a/shared-module/displayio/FourWire.c b/shared-module/displayio/FourWire.c
index 256c29642..fe7234aa7 100644
--- a/shared-module/displayio/FourWire.c
+++ b/shared-module/displayio/FourWire.c
@@ -40,7 +40,8 @@
void common_hal_displayio_fourwire_construct(displayio_fourwire_obj_t* self,
busio_spi_obj_t* spi, const mcu_pin_obj_t* command,
- const mcu_pin_obj_t* chip_select, const mcu_pin_obj_t* reset, uint32_t baudrate) {
+ const mcu_pin_obj_t* chip_select, const mcu_pin_obj_t* reset, uint32_t baudrate,
+ uint8_t polarity, uint8_t phase) {
self->bus = spi;
common_hal_busio_spi_never_reset(self->bus);
@@ -49,8 +50,8 @@ void common_hal_displayio_fourwire_construct(displayio_fourwire_obj_t* self,
gc_never_free(self->bus);
self->frequency = baudrate;
- self->polarity = 0;
- self->phase = 0;
+ self->polarity = polarity;
+ self->phase = phase;
common_hal_digitalio_digitalinout_construct(&self->command, command);
common_hal_digitalio_digitalinout_switch_to_output(&self->command, true, DRIVE_MODE_PUSH_PULL);
diff --git a/shared-module/displayio/Palette.c b/shared-module/displayio/Palette.c
index 3bce86f48..1ef03aab4 100644
--- a/shared-module/displayio/Palette.c
+++ b/shared-module/displayio/Palette.c
@@ -83,7 +83,12 @@ bool displayio_palette_get_color(displayio_palette_t *self, const _displayio_col
} else if (colorspace->grayscale) {
*color = self->colors[palette_index].luma >> (8 - colorspace->depth);
} else {
- *color = self->colors[palette_index].rgb565;
+ uint16_t packed = self->colors[palette_index].rgb565;
+ if (colorspace->reverse_bytes_in_word) {
+ // swap bytes
+ packed = __builtin_bswap16(packed);
+ }
+ *color = packed;
}
return true;
diff --git a/shared-module/displayio/Palette.h b/shared-module/displayio/Palette.h
index 758fd43fc..da72f250f 100644
--- a/shared-module/displayio/Palette.h
+++ b/shared-module/displayio/Palette.h
@@ -41,6 +41,7 @@ typedef struct {
bool tricolor;
bool pixels_in_byte_share_row;
bool reverse_pixels_in_byte;
+ bool reverse_bytes_in_word;
bool dither;
} _displayio_colorspace_t;
diff --git a/shared-module/displayio/__init__.c b/shared-module/displayio/__init__.c
index efa61265e..cf1bc45d9 100644
--- a/shared-module/displayio/__init__.c
+++ b/shared-module/displayio/__init__.c
@@ -21,6 +21,20 @@
primary_display_t displays[CIRCUITPY_DISPLAY_LIMIT];
+#if CIRCUITPY_PROTOMATTER
+STATIC bool any_display_uses_this_protomatter(protomatter_protomatter_obj_t* pm) {
+ for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) {
+ if (displays[i].framebuffer_display.base.type == &framebufferio_framebufferdisplay_type) {
+ framebufferio_framebufferdisplay_obj_t* display = &displays[i].framebuffer_display;
+ if (display->framebuffer == pm) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+#endif
+
// Check for recursive calls to displayio_background.
bool displayio_background_in_progress = false;
@@ -47,6 +61,10 @@ void displayio_background(void) {
}
if (displays[i].display.base.type == &displayio_display_type) {
displayio_display_background(&displays[i].display);
+#if CIRCUITPY_FRAMEBUFFERIO
+ } else if (displays[i].framebuffer_display.base.type == &framebufferio_framebufferdisplay_type) {
+ framebufferio_framebufferdisplay_background(&displays[i].framebuffer_display);
+#endif
} else if (displays[i].epaper_display.base.type == &displayio_epaperdisplay_type) {
displayio_epaperdisplay_background(&displays[i].epaper_display);
}
@@ -67,6 +85,10 @@ void common_hal_displayio_release_displays(void) {
release_display(&displays[i].display);
} else if (display_type == &displayio_epaperdisplay_type) {
release_epaperdisplay(&displays[i].epaper_display);
+#if CIRCUITPY_FRAMEBUFFERIO
+ } else if (display_type == &framebufferio_framebufferdisplay_type) {
+ release_framebufferdisplay(&displays[i].framebuffer_display);
+#endif
}
displays[i].display.base.type = &mp_type_NoneType;
}
@@ -80,6 +102,10 @@ void common_hal_displayio_release_displays(void) {
common_hal_displayio_i2cdisplay_deinit(&displays[i].i2cdisplay_bus);
} else if (bus_type == &displayio_parallelbus_type) {
common_hal_displayio_parallelbus_deinit(&displays[i].parallel_bus);
+#if CIRCUITPY_FRAMEBUFFERIO
+ } else if (bus_type == &protomatter_Protomatter_type) {
+ common_hal_protomatter_protomatter_deinit(&displays[i].protomatter);
+#endif
}
displays[i].fourwire_bus.base.type = &mp_type_NoneType;
}
@@ -141,6 +167,13 @@ void reset_displays(void) {
}
}
}
+#if CIRCUITPY_PROTOMATTER
+ } else if (displays[i].protomatter.base.type == &protomatter_Protomatter_type) {
+ protomatter_protomatter_obj_t * pm = &displays[i].protomatter;
+ if(!any_display_uses_this_protomatter(pm)) {
+ common_hal_protomatter_protomatter_deinit(pm);
+ }
+#endif
} else {
// Not an active display bus.
continue;
@@ -155,12 +188,24 @@ void reset_displays(void) {
} else if (displays[i].epaper_display.base.type == &displayio_epaperdisplay_type) {
displayio_epaperdisplay_obj_t* display = &displays[i].epaper_display;
common_hal_displayio_epaperdisplay_show(display, NULL);
+#if CIRCUITPY_FRAMEBUFFERIO
+ } else if (displays[i].framebuffer_display.base.type == &framebufferio_framebufferdisplay_type) {
+ framebufferio_framebufferdisplay_obj_t* display = &displays[i].framebuffer_display;
+ display->auto_refresh = true;
+ common_hal_framebufferio_framebufferdisplay_show(display, NULL);
+#endif
}
}
}
void displayio_gc_collect(void) {
for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) {
+#if CIRCUITPY_PROTOMATTER
+ if (displays[i].protomatter.base.type == &protomatter_Protomatter_type) {
+ protomatter_protomatter_collect_ptrs(&displays[i].protomatter);
+ }
+#endif
+
if (displays[i].display.base.type == NULL) {
continue;
}
@@ -169,6 +214,10 @@ void displayio_gc_collect(void) {
// but this is more precise, and is the only field that needs marking.
if (displays[i].display.base.type == &displayio_display_type) {
displayio_display_collect_ptrs(&displays[i].display);
+#if CIRCUITPY_FRAMEBUFFERIO
+ } else if (displays[i].framebuffer_display.base.type == &framebufferio_framebufferdisplay_type) {
+ framebufferio_framebufferdisplay_collect_ptrs(&displays[i].framebuffer_display);
+#endif
} else if (displays[i].epaper_display.base.type == &displayio_epaperdisplay_type) {
displayio_epaperdisplay_collect_ptrs(&displays[i].epaper_display);
}
@@ -308,3 +357,38 @@ void displayio_area_transform_within(bool mirror_x, bool mirror_y, bool transpos
transformed->x1 = whole->x1 + (y1 - whole->y1);
}
}
+
+primary_display_t *allocate_display(void) {
+ for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) {
+ mp_const_obj_t display_type = displays[i].display.base.type;
+ if (display_type == NULL || display_type == &mp_type_NoneType) {
+ return &displays[i];
+ }
+ }
+ return NULL;
+}
+
+primary_display_t *allocate_display_or_raise(void) {
+ primary_display_t *result = allocate_display();
+ if (result) {
+ return result;
+ }
+ mp_raise_RuntimeError(translate("Too many displays"));
+}
+primary_display_t *allocate_display_bus(void) {
+ for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) {
+ mp_const_obj_t display_type = displays[i].display.base.type;
+ if (display_type == NULL || display_type == &mp_type_NoneType) {
+ return &displays[i];
+ }
+ }
+ return NULL;
+}
+
+primary_display_t *allocate_display_bus_or_raise(void) {
+ primary_display_t *result = allocate_display_bus();
+ if (result) {
+ return result;
+ }
+ mp_raise_RuntimeError(translate("Too many display busses"));
+}
diff --git a/shared-module/displayio/__init__.h b/shared-module/displayio/__init__.h
index e78bc61ce..278a5e78f 100644
--- a/shared-module/displayio/__init__.h
+++ b/shared-module/displayio/__init__.h
@@ -29,20 +29,30 @@
#include "shared-bindings/displayio/Display.h"
#include "shared-bindings/displayio/EPaperDisplay.h"
+#if CIRCUITPY_FRAMEBUFFERIO
+#include "shared-bindings/framebufferio/FramebufferDisplay.h"
+#endif
#include "shared-bindings/displayio/FourWire.h"
#include "shared-bindings/displayio/Group.h"
#include "shared-bindings/displayio/I2CDisplay.h"
#include "shared-bindings/displayio/ParallelBus.h"
+#include "shared-bindings/_protomatter/Protomatter.h"
typedef struct {
union {
displayio_fourwire_obj_t fourwire_bus;
displayio_i2cdisplay_obj_t i2cdisplay_bus;
displayio_parallelbus_obj_t parallel_bus;
+#if CIRCUITPY_PROTOMATTER
+ protomatter_protomatter_obj_t protomatter;
+#endif
};
union {
displayio_display_obj_t display;
displayio_epaperdisplay_obj_t epaper_display;
+#if CIRCUITPY_FRAMEBUFFERIO
+ framebufferio_framebufferdisplay_obj_t framebuffer_display;
+#endif
};
} primary_display_t;
@@ -54,4 +64,9 @@ void displayio_background(void);
void reset_displays(void);
void displayio_gc_collect(void);
+primary_display_t *allocate_display(void);
+primary_display_t *allocate_display_or_raise(void);
+primary_display_t *allocate_display_bus(void);
+primary_display_t *allocate_display_bus_or_raise(void);
+
#endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO___INIT___H
diff --git a/shared-module/displayio/display_core.c b/shared-module/displayio/display_core.c
index 120b70f76..4cc7564d0 100644
--- a/shared-module/displayio/display_core.c
+++ b/shared-module/displayio/display_core.c
@@ -44,38 +44,42 @@
void displayio_display_core_construct(displayio_display_core_t* self,
mp_obj_t bus, uint16_t width, uint16_t height, uint16_t ram_width, uint16_t ram_height, int16_t colstart, int16_t rowstart, uint16_t rotation,
- uint16_t color_depth, bool grayscale, bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte) {
+ uint16_t color_depth, bool grayscale, bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte, bool reverse_bytes_in_word) {
self->colorspace.depth = color_depth;
self->colorspace.grayscale = grayscale;
self->colorspace.pixels_in_byte_share_row = pixels_in_byte_share_row;
self->colorspace.bytes_per_cell = bytes_per_cell;
self->colorspace.reverse_pixels_in_byte = reverse_pixels_in_byte;
+ self->colorspace.reverse_bytes_in_word = reverse_bytes_in_word;
self->colorspace.dither = false;
self->current_group = NULL;
self->colstart = colstart;
self->rowstart = rowstart;
self->last_refresh = 0;
- if (MP_OBJ_IS_TYPE(bus, &displayio_parallelbus_type)) {
- self->bus_reset = common_hal_displayio_parallelbus_reset;
- self->bus_free = common_hal_displayio_parallelbus_bus_free;
- self->begin_transaction = common_hal_displayio_parallelbus_begin_transaction;
- self->send = common_hal_displayio_parallelbus_send;
- self->end_transaction = common_hal_displayio_parallelbus_end_transaction;
- } else if (MP_OBJ_IS_TYPE(bus, &displayio_fourwire_type)) {
- self->bus_reset = common_hal_displayio_fourwire_reset;
- self->bus_free = common_hal_displayio_fourwire_bus_free;
- self->begin_transaction = common_hal_displayio_fourwire_begin_transaction;
- self->send = common_hal_displayio_fourwire_send;
- self->end_transaction = common_hal_displayio_fourwire_end_transaction;
- } else if (MP_OBJ_IS_TYPE(bus, &displayio_i2cdisplay_type)) {
- self->bus_reset = common_hal_displayio_i2cdisplay_reset;
- self->bus_free = common_hal_displayio_i2cdisplay_bus_free;
- self->begin_transaction = common_hal_displayio_i2cdisplay_begin_transaction;
- self->send = common_hal_displayio_i2cdisplay_send;
- self->end_transaction = common_hal_displayio_i2cdisplay_end_transaction;
- } else {
- mp_raise_ValueError(translate("Unsupported display bus type"));
+ // (framebufferdisplay already validated its 'bus' is a buffer-protocol object)
+ if (bus) {
+ if (MP_OBJ_IS_TYPE(bus, &displayio_parallelbus_type)) {
+ self->bus_reset = common_hal_displayio_parallelbus_reset;
+ self->bus_free = common_hal_displayio_parallelbus_bus_free;
+ self->begin_transaction = common_hal_displayio_parallelbus_begin_transaction;
+ self->send = common_hal_displayio_parallelbus_send;
+ self->end_transaction = common_hal_displayio_parallelbus_end_transaction;
+ } else if (MP_OBJ_IS_TYPE(bus, &displayio_fourwire_type)) {
+ self->bus_reset = common_hal_displayio_fourwire_reset;
+ self->bus_free = common_hal_displayio_fourwire_bus_free;
+ self->begin_transaction = common_hal_displayio_fourwire_begin_transaction;
+ self->send = common_hal_displayio_fourwire_send;
+ self->end_transaction = common_hal_displayio_fourwire_end_transaction;
+ } else if (MP_OBJ_IS_TYPE(bus, &displayio_i2cdisplay_type)) {
+ self->bus_reset = common_hal_displayio_i2cdisplay_reset;
+ self->bus_free = common_hal_displayio_i2cdisplay_bus_free;
+ self->begin_transaction = common_hal_displayio_i2cdisplay_begin_transaction;
+ self->send = common_hal_displayio_i2cdisplay_send;
+ self->end_transaction = common_hal_displayio_i2cdisplay_end_transaction;
+ } else {
+ mp_raise_ValueError(translate("Unsupported display bus type"));
+ }
}
self->bus = bus;
diff --git a/shared-module/displayio/display_core.h b/shared-module/displayio/display_core.h
index 1c3d0f09c..e4fd62d4a 100644
--- a/shared-module/displayio/display_core.h
+++ b/shared-module/displayio/display_core.h
@@ -58,7 +58,7 @@ typedef struct {
void displayio_display_core_construct(displayio_display_core_t* self,
mp_obj_t bus, uint16_t width, uint16_t height, uint16_t ram_width, uint16_t ram_height, int16_t colstart, int16_t rowstart, uint16_t rotation,
- uint16_t color_depth, bool grayscale, bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte);
+ uint16_t color_depth, bool grayscale, bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte, bool reverse_bytes_in_word);
bool displayio_display_core_show(displayio_display_core_t* self, displayio_group_t* root_group);
diff --git a/shared-module/framebufferio/FramebufferDisplay.c b/shared-module/framebufferio/FramebufferDisplay.c
new file mode 100644
index 000000000..bd0764e8e
--- /dev/null
+++ b/shared-module/framebufferio/FramebufferDisplay.c
@@ -0,0 +1,300 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2018 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 "shared-bindings/framebufferio/FramebufferDisplay.h"
+
+#include "py/gc.h"
+#include "py/runtime.h"
+#include "shared-bindings/microcontroller/Pin.h"
+#include "shared-bindings/time/__init__.h"
+#include "shared-module/displayio/__init__.h"
+#include "shared-module/displayio/display_core.h"
+#include "supervisor/shared/display.h"
+#include "supervisor/shared/tick.h"
+#include "supervisor/usb.h"
+
+#include <stdint.h>
+#include <string.h>
+
+#include "tick.h"
+
+void common_hal_framebufferio_framebufferdisplay_construct(framebufferio_framebufferdisplay_obj_t* self,
+ mp_obj_t framebuffer, uint16_t width, uint16_t height,
+ uint16_t rotation, uint16_t color_depth,
+ uint8_t bytes_per_cell,
+ bool auto_refresh, uint16_t native_frames_per_second) {
+ // Turn off auto-refresh as we init.
+ self->auto_refresh = false;
+ self->framebuffer = framebuffer;
+ self->framebuffer_protocol = mp_proto_get_or_throw(MP_QSTR_protocol_framebuffer, framebuffer);
+
+ uint16_t ram_width = 0x100;
+ uint16_t ram_height = 0x100;
+
+ displayio_display_core_construct(&self->core, NULL, width, height, ram_width, ram_height, 0, 0, rotation,
+ color_depth, false, false, bytes_per_cell, false, false);
+
+ self->first_manual_refresh = !auto_refresh;
+
+ self->native_frames_per_second = native_frames_per_second;
+ self->native_ms_per_frame = 1000 / native_frames_per_second;
+
+ supervisor_start_terminal(width, height);
+
+ // Set the group after initialization otherwise we may send pixels while we delay in
+ // initialization.
+ common_hal_framebufferio_framebufferdisplay_show(self, &circuitpython_splash);
+ self->auto_refresh = auto_refresh;
+}
+
+bool common_hal_framebufferio_framebufferdisplay_show(framebufferio_framebufferdisplay_obj_t* self, displayio_group_t* root_group) {
+ return displayio_display_core_show(&self->core, root_group);
+}
+
+uint16_t common_hal_framebufferio_framebufferdisplay_get_width(framebufferio_framebufferdisplay_obj_t* self){
+ return displayio_display_core_get_width(&self->core);
+}
+
+uint16_t common_hal_framebufferio_framebufferdisplay_get_height(framebufferio_framebufferdisplay_obj_t* self){
+ return displayio_display_core_get_height(&self->core);
+}
+
+bool common_hal_framebufferio_framebufferdisplay_get_auto_brightness(framebufferio_framebufferdisplay_obj_t* self) {
+ if (self->framebuffer_protocol->get_auto_brightness) {
+ return self->framebuffer_protocol->get_auto_brightness(self->framebuffer);
+ }
+ return true;
+}
+
+bool common_hal_framebufferio_framebufferdisplay_set_auto_brightness(framebufferio_framebufferdisplay_obj_t* self, bool auto_brightness) {
+ if (self->framebuffer_protocol->set_auto_brightness) {
+ return self->framebuffer_protocol->set_auto_brightness(self->framebuffer, auto_brightness);
+ }
+ return false;
+}
+
+mp_float_t common_hal_framebufferio_framebufferdisplay_get_brightness(framebufferio_framebufferdisplay_obj_t* self) {
+ if (self->framebuffer_protocol->set_brightness) {
+ return self->framebuffer_protocol->get_brightness(self->framebuffer);
+ }
+ return -1;
+}
+
+bool common_hal_framebufferio_framebufferdisplay_set_brightness(framebufferio_framebufferdisplay_obj_t* self, mp_float_t brightness) {
+ bool ok = false;
+ if (self->framebuffer_protocol->set_brightness) {
+ self->framebuffer_protocol->set_brightness(self->framebuffer, brightness);
+ ok = true;
+ }
+ return ok;
+}
+
+mp_obj_t common_hal_framebufferio_framebufferdisplay_get_framebuffer(framebufferio_framebufferdisplay_obj_t* self) {
+ return self->framebuffer;
+}
+
+STATIC const displayio_area_t* _get_refresh_areas(framebufferio_framebufferdisplay_obj_t *self) {
+ if (self->core.full_refresh) {
+ self->core.area.next = NULL;
+ return &self->core.area;
+ } else if (self->core.current_group != NULL) {
+ return displayio_group_get_refresh_areas(self->core.current_group, NULL);
+ }
+ return NULL;
+}
+
+STATIC bool _refresh_area(framebufferio_framebufferdisplay_obj_t* self, const displayio_area_t* area) {
+ uint16_t buffer_size = 128; // In uint32_ts
+
+ displayio_area_t clipped;
+ // Clip the area to the display by overlapping the areas. If there is no overlap then we're done.
+ if (!displayio_display_core_clip_area(&self->core, area, &clipped)) {
+ return true;
+ }
+ uint16_t subrectangles = 1;
+ uint16_t rows_per_buffer = displayio_area_height(&clipped);
+ uint8_t pixels_per_word = (sizeof(uint32_t) * 8) / self->core.colorspace.depth;
+ uint16_t pixels_per_buffer = displayio_area_size(&clipped);
+ if (displayio_area_size(&clipped) > buffer_size * pixels_per_word) {
+ rows_per_buffer = buffer_size * pixels_per_word / displayio_area_width(&clipped);
+ if (rows_per_buffer == 0) {
+ rows_per_buffer = 1;
+ }
+ // If pixels are packed by column then ensure rows_per_buffer is on a byte boundary.
+ if (self->core.colorspace.depth < 8 && !self->core.colorspace.pixels_in_byte_share_row) {
+ uint8_t pixels_per_byte = 8 / self->core.colorspace.depth;
+ if (rows_per_buffer % pixels_per_byte != 0) {
+ rows_per_buffer -= rows_per_buffer % pixels_per_byte;
+ }
+ }
+ subrectangles = displayio_area_height(&clipped) / rows_per_buffer;
+ if (displayio_area_height(&clipped) % rows_per_buffer != 0) {
+ subrectangles++;
+ }
+ pixels_per_buffer = rows_per_buffer * displayio_area_width(&clipped);
+ buffer_size = pixels_per_buffer / pixels_per_word;
+ if (pixels_per_buffer % pixels_per_word) {
+ buffer_size += 1;
+ }
+ }
+
+ // Allocated and shared as a uint32_t array so the compiler knows the
+ // alignment everywhere.
+ uint32_t buffer[buffer_size];
+ uint32_t mask_length = (pixels_per_buffer / 32) + 1;
+ uint32_t mask[mask_length];
+ uint16_t remaining_rows = displayio_area_height(&clipped);
+
+ for (uint16_t j = 0; j < subrectangles; j++) {
+ displayio_area_t subrectangle = {
+ .x1 = clipped.x1,
+ .y1 = clipped.y1 + rows_per_buffer * j,
+ .x2 = clipped.x2,
+ .y2 = clipped.y1 + rows_per_buffer * (j + 1)
+ };
+ if (remaining_rows < rows_per_buffer) {
+ subrectangle.y2 = subrectangle.y1 + remaining_rows;
+ }
+ remaining_rows -= rows_per_buffer;
+
+ memset(mask, 0, mask_length * sizeof(mask[0]));
+ memset(buffer, 0, buffer_size * sizeof(buffer[0]));
+
+ displayio_display_core_fill_area(&self->core, &subrectangle, mask, buffer);
+
+ // COULDDO: this arithmetic only supports multiple-of-8 bpp
+ uint8_t *dest = self->bufinfo.buf + (subrectangle.y1 * self->core.width + subrectangle.x1) * (self->core.colorspace.depth / 8);
+ uint8_t *src = (uint8_t*)buffer;
+ size_t rowsize = (subrectangle.x2 - subrectangle.x1) * (self->core.colorspace.depth / 8);
+ size_t rowstride = self->core.width * (self->core.colorspace.depth/8);
+ for (uint16_t i = subrectangle.y1; i < subrectangle.y2; i++) {
+ memcpy(dest, src, rowsize);
+ dest += rowstride;
+ src += rowsize;
+ }
+
+ // TODO(tannewt): Make refresh displays faster so we don't starve other
+ // background tasks.
+ usb_background();
+ }
+ return true;
+}
+
+STATIC void _refresh_display(framebufferio_framebufferdisplay_obj_t* self) {
+ displayio_display_core_start_refresh(&self->core);
+ self->framebuffer_protocol->get_bufinfo(self->framebuffer, &self->bufinfo);
+ const displayio_area_t* current_area = _get_refresh_areas(self);
+ while (current_area != NULL) {
+ _refresh_area(self, current_area);
+ current_area = current_area->next;
+ }
+ displayio_display_core_finish_refresh(&self->core);
+ self->framebuffer_protocol->swapbuffers(self->framebuffer);
+}
+
+void common_hal_framebufferio_framebufferdisplay_set_rotation(framebufferio_framebufferdisplay_obj_t* self, int rotation){
+ bool transposed = (self->core.rotation == 90 || self->core.rotation == 270);
+ bool will_transposed = (rotation == 90 || rotation == 270);
+ if(transposed != will_transposed) {
+ int tmp = self->core.width;
+ self->core.width = self->core.height;
+ self->core.height = tmp;
+ }
+ displayio_display_core_set_rotation(&self->core, rotation);
+ supervisor_stop_terminal();
+ supervisor_start_terminal(self->core.width, self->core.height);
+ if (self->core.current_group != NULL) {
+ displayio_group_update_transform(self->core.current_group, &self->core.transform);
+ }
+}
+
+uint16_t common_hal_framebufferio_framebufferdisplay_get_rotation(framebufferio_framebufferdisplay_obj_t* self){
+ return self->core.rotation;
+}
+
+
+bool common_hal_framebufferio_framebufferdisplay_refresh(framebufferio_framebufferdisplay_obj_t* self, uint32_t target_ms_per_frame, uint32_t maximum_ms_per_real_frame) {
+ if (!self->auto_refresh && !self->first_manual_refresh) {
+ uint64_t current_time = supervisor_ticks_ms64();
+ uint32_t current_ms_since_real_refresh = current_time - self->core.last_refresh;
+ // Test to see if the real frame time is below our minimum.
+ if (current_ms_since_real_refresh > maximum_ms_per_real_frame) {
+ mp_raise_RuntimeError(translate("Below minimum frame rate"));
+ }
+ uint32_t current_ms_since_last_call = current_time - self->last_refresh_call;
+ self->last_refresh_call = current_time;
+ // Skip the actual refresh to help catch up.
+ if (current_ms_since_last_call > target_ms_per_frame) {
+ return false;
+ }
+ uint32_t remaining_time = target_ms_per_frame - (current_ms_since_real_refresh % target_ms_per_frame);
+ // We're ahead of the game so wait until we align with the frame rate.
+ while (supervisor_ticks_ms64() - self->last_refresh_call < remaining_time) {
+ RUN_BACKGROUND_TASKS;
+ }
+ }
+ self->first_manual_refresh = false;
+ _refresh_display(self);
+ return true;
+}
+
+bool common_hal_framebufferio_framebufferdisplay_get_auto_refresh(framebufferio_framebufferdisplay_obj_t* self) {
+ return self->auto_refresh;
+}
+
+void common_hal_framebufferio_framebufferdisplay_set_auto_refresh(framebufferio_framebufferdisplay_obj_t* self,
+ bool auto_refresh) {
+ self->first_manual_refresh = !auto_refresh;
+ self->auto_refresh = auto_refresh;
+}
+
+STATIC void _update_backlight(framebufferio_framebufferdisplay_obj_t* self) {
+ // TODO(tannewt): Fade the backlight based on it's existing value and a target value. The target
+ // should account for ambient light when possible.
+}
+
+void framebufferio_framebufferdisplay_background(framebufferio_framebufferdisplay_obj_t* self) {
+ _update_backlight(self);
+
+ if (self->auto_refresh && (supervisor_ticks_ms64() - self->core.last_refresh) > self->native_ms_per_frame) {
+ _refresh_display(self);
+ }
+}
+
+void release_framebufferdisplay(framebufferio_framebufferdisplay_obj_t* self) {
+ release_display_core(&self->core);
+ self->framebuffer_protocol->deinit(self->framebuffer);
+}
+
+void reset_framebufferdisplay(framebufferio_framebufferdisplay_obj_t* self) {
+ self->auto_refresh = true;
+ common_hal_framebufferio_framebufferdisplay_show(self, NULL);
+}
+
+void framebufferio_framebufferdisplay_collect_ptrs(framebufferio_framebufferdisplay_obj_t* self) {
+ gc_collect_ptr(self->framebuffer);
+ displayio_display_core_collect_ptrs(&self->core);
+}
diff --git a/shared-module/framebufferio/FramebufferDisplay.h b/shared-module/framebufferio/FramebufferDisplay.h
new file mode 100644
index 000000000..a7b91a522
--- /dev/null
+++ b/shared-module/framebufferio/FramebufferDisplay.h
@@ -0,0 +1,81 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * 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
+ * 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_SHARED_MODULE_DISPLAYIO_FRAMEBUFFERDISPLAY_H
+#define MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_FRAMEBUFFERDISPLAY_H
+
+#include "py/obj.h"
+#include "py/proto.h"
+
+#include "shared-bindings/digitalio/DigitalInOut.h"
+#include "shared-bindings/displayio/Group.h"
+#include "shared-bindings/pulseio/PWMOut.h"
+
+#include "shared-module/displayio/area.h"
+#include "shared-module/displayio/display_core.h"
+
+typedef struct {
+ mp_obj_base_t base;
+ displayio_display_core_t core;
+ mp_obj_t framebuffer;
+ const struct _framebuffer_p_t *framebuffer_protocol;
+ mp_buffer_info_t bufinfo;
+ uint64_t last_backlight_refresh;
+ uint64_t last_refresh_call;
+ uint16_t native_frames_per_second;
+ uint16_t native_ms_per_frame;
+ bool auto_refresh;
+ bool first_manual_refresh;
+} framebufferio_framebufferdisplay_obj_t;
+
+void framebufferio_framebufferdisplay_background(framebufferio_framebufferdisplay_obj_t* self);
+void release_framebufferdisplay(framebufferio_framebufferdisplay_obj_t* self);
+void reset_framebufferdisplay(framebufferio_framebufferdisplay_obj_t* self);
+
+void framebufferio_framebufferdisplay_collect_ptrs(framebufferio_framebufferdisplay_obj_t* self);
+
+mp_obj_t common_hal_framebufferio_framebufferdisplay_get_framebuffer(framebufferio_framebufferdisplay_obj_t* self);
+
+typedef void (*framebuffer_get_bufinfo_fun)(mp_obj_t, mp_buffer_info_t *bufinfo);
+typedef void (*framebuffer_swapbuffers_fun)(mp_obj_t);
+typedef void (*framebuffer_deinit_fun)(mp_obj_t);
+typedef bool (*framebuffer_set_brightness_fun)(mp_obj_t, mp_float_t);
+typedef mp_float_t (*framebuffer_get_brightness_fun)(mp_obj_t);
+typedef bool (*framebuffer_set_auto_brightness_fun)(mp_obj_t, bool);
+typedef bool (*framebuffer_get_auto_brightness_fun)(mp_obj_t);
+
+typedef struct _framebuffer_p_t {
+ MP_PROTOCOL_HEAD // MP_QSTR_protocol_framebuffer
+ framebuffer_get_bufinfo_fun get_bufinfo;
+ framebuffer_swapbuffers_fun swapbuffers;
+ framebuffer_deinit_fun deinit;
+ framebuffer_get_brightness_fun get_brightness;
+ framebuffer_set_brightness_fun set_brightness;
+ framebuffer_get_auto_brightness_fun get_auto_brightness;
+ framebuffer_set_auto_brightness_fun set_auto_brightness;
+} framebuffer_p_t;
+
+#endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_FRAMEBUFFERDISPLAY_H
diff --git a/shared-module/framebufferio/__init__.c b/shared-module/framebufferio/__init__.c
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/shared-module/framebufferio/__init__.c
diff --git a/shared-module/framebufferio/__init__.h b/shared-module/framebufferio/__init__.h
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/shared-module/framebufferio/__init__.h
diff --git a/shared-module/storage/__init__.c b/shared-module/storage/__init__.c
index 215e1356a..c3d4b50c8 100644
--- a/shared-module/storage/__init__.c
+++ b/shared-module/storage/__init__.c
@@ -149,9 +149,7 @@ void common_hal_storage_remount(const char *mount_path, bool readonly, bool disa
}
#ifdef USB_AVAILABLE
- // TODO(dhalbert): is this is a good enough check? It checks for
- // CDC enabled. There is no "MSC enabled" check.
- if (usb_enabled()) {
+ if (!usb_msc_ejected()) {
mp_raise_RuntimeError(translate("Cannot remount '/' when USB is active."));
}
#endif
diff --git a/shared-module/wiznet/wiznet5k.c b/shared-module/wiznet/wiznet5k.c
index 3c5c5f0c8..a603a5593 100644
--- a/shared-module/wiznet/wiznet5k.c
+++ b/shared-module/wiznet/wiznet5k.c
@@ -379,12 +379,12 @@ void wiznet5k_socket_deinit(mod_network_socket_obj_t *socket) {
}
/// Create and return a WIZNET5K object.
-mp_obj_t wiznet5k_create(mp_obj_t spi_in, mp_obj_t cs_in, mp_obj_t rst_in) {
+mp_obj_t wiznet5k_create(busio_spi_obj_t *spi_in, const mcu_pin_obj_t *cs_in, const mcu_pin_obj_t *rst_in) {
// init the wiznet5k object
wiznet5k_obj.base.type = (mp_obj_type_t*)&mod_network_nic_type_wiznet5k;
wiznet5k_obj.cris_state = 0;
- wiznet5k_obj.spi = MP_OBJ_TO_PTR(spi_in);
+ wiznet5k_obj.spi = spi_in;
wiznet5k_obj.socket_used = 0;
wiznet5k_obj.dhcp_socket = -1;
diff --git a/shared-module/wiznet/wiznet5k.h b/shared-module/wiznet/wiznet5k.h
index 0154831c7..19823ae55 100644
--- a/shared-module/wiznet/wiznet5k.h
+++ b/shared-module/wiznet/wiznet5k.h
@@ -59,7 +59,7 @@ int wiznet5k_socket_ioctl(mod_network_socket_obj_t *socket, mp_uint_t request, m
void wiznet5k_socket_timer_tick(mod_network_socket_obj_t *socket);
void wiznet5k_socket_deinit(mod_network_socket_obj_t *socket);
mp_obj_t wiznet5k_socket_disconnect(mp_obj_t self_in);
-mp_obj_t wiznet5k_create(mp_obj_t spi_in, mp_obj_t cs_in, mp_obj_t rst_in);
+mp_obj_t wiznet5k_create(busio_spi_obj_t *spi_in, const mcu_pin_obj_t *cs_in, const mcu_pin_obj_t *rst_in);
int wiznet5k_start_dhcp(void);
int wiznet5k_stop_dhcp(void);
diff --git a/supervisor/linker.h b/supervisor/linker.h
index b58414433..74b2dd5a6 100755
--- a/supervisor/linker.h
+++ b/supervisor/linker.h
@@ -29,7 +29,7 @@
#ifndef MICROPY_INCLUDED_SUPERVISOR_LINKER_H
#define MICROPY_INCLUDED_SUPERVISOR_LINKER_H
-#if defined(IMXRT10XX)
+#if defined(IMXRT10XX) || defined(FOMU) || defined(STM32H7)
#define PLACE_IN_DTCM_DATA(name) name __attribute__((section(".dtcm_data." #name )))
#define PLACE_IN_DTCM_BSS(name) name __attribute__((section(".dtcm_bss." #name )))
#define PLACE_IN_ITCM(name) __attribute__((section(".itcm." #name ))) name
diff --git a/supervisor/memory.h b/supervisor/memory.h
index f557744ae..f4359ca46 100755
--- a/supervisor/memory.h
+++ b/supervisor/memory.h
@@ -43,6 +43,7 @@ typedef struct {
void memory_init(void);
void free_memory(supervisor_allocation* allocation);
+supervisor_allocation* allocation_from_ptr(void *ptr);
supervisor_allocation* allocate_remaining_memory(void);
// Allocate a piece of a given length in bytes. If high_address is true then it should be allocated
diff --git a/supervisor/shared/bluetooth.c b/supervisor/shared/bluetooth.c
index 18caa2eb4..b463160cf 100644
--- a/supervisor/shared/bluetooth.c
+++ b/supervisor/shared/bluetooth.c
@@ -64,6 +64,9 @@ mp_obj_list_t characteristic_list;
mp_obj_t characteristic_list_items[4];
void supervisor_bluetooth_start_advertising(void) {
+ #if !CIRCUITPY_BLE_FILE_SERVICE
+ return;
+ #endif
bool is_connected = common_hal_bleio_adapter_get_connected(&common_hal_bleio_adapter_obj);
if (is_connected) {
return;
@@ -79,6 +82,10 @@ void supervisor_bluetooth_start_advertising(void) {
}
void supervisor_start_bluetooth(void) {
+ #if !CIRCUITPY_BLE_FILE_SERVICE
+ return;
+ #endif
+
common_hal_bleio_adapter_set_enabled(&common_hal_bleio_adapter_obj, true);
supervisor_ble_service_uuid.base.type = &bleio_uuid_type;
@@ -203,6 +210,9 @@ uint32_t current_command[1024 / sizeof(uint32_t)];
volatile size_t current_offset;
void supervisor_bluetooth_background(void) {
+ #if !CIRCUITPY_BLE_FILE_SERVICE
+ return;
+ #endif
if (!run_ble_background) {
return;
}
@@ -296,6 +306,9 @@ void supervisor_bluetooth_background(void) {
// This happens in an interrupt so we need to be quick.
bool supervisor_bluetooth_hook(ble_evt_t *ble_evt) {
+ #if !CIRCUITPY_BLE_FILE_SERVICE
+ return false;
+ #endif
// Catch writes to filename or contents. Length is read-only.
bool done = false;
diff --git a/supervisor/shared/display.c b/supervisor/shared/display.c
index 855432d64..95926bc9c 100644
--- a/supervisor/shared/display.c
+++ b/supervisor/shared/display.c
@@ -34,6 +34,10 @@
#include "shared-bindings/displayio/TileGrid.h"
#include "supervisor/memory.h"
+#if CIRCUITPY_PROTOMATTER
+#include "shared-module/displayio/__init__.h"
+#endif
+
extern size_t blinka_bitmap_data[];
extern displayio_bitmap_t blinka_bitmap;
extern displayio_group_t circuitpython_splash;
@@ -112,6 +116,14 @@ void supervisor_display_move_memory(void) {
grid->inline_tiles = false;
}
MP_STATE_VM(terminal_tilegrid_tiles) = NULL;
+ #if CIRCUITPY_PROTOMATTER
+ for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) {
+ if (displays[i].protomatter.base.type == &protomatter_Protomatter_type) {
+ protomatter_protomatter_obj_t * pm = &displays[i].protomatter;
+ common_hal_protomatter_protomatter_reconstruct(pm, NULL);
+ }
+ }
+ #endif
#endif
}
@@ -157,28 +169,28 @@ _displayio_color_t blinka_colors[7] = {
},
{
.rgb888 = 0x8428bc,
- .rgb565 = 0x7889,
+ .rgb565 = 0x8978,
.luma = 0xff, // We cheat the luma here. It is actually 0x60
.hue = 184,
.chroma = 148
},
{
.rgb888 = 0xff89bc,
- .rgb565 = 0xB8FC,
+ .rgb565 = 0xFCB8,
.luma = 0xb5,
.hue = 222,
.chroma = 118
},
{
.rgb888 = 0x7beffe,
- .rgb565 = 0x9F86,
+ .rgb565 = 0x869F,
.luma = 0xe0,
.hue = 124,
.chroma = 131
},
{
.rgb888 = 0x51395f,
- .rgb565 = 0x0D5A,
+ .rgb565 = 0x5A0D,
.luma = 0x47,
.hue = 185,
.chroma = 38
@@ -191,7 +203,7 @@ _displayio_color_t blinka_colors[7] = {
},
{
.rgb888 = 0x0736a0,
- .rgb565 = 0xf501,
+ .rgb565 = 0x01f5,
.luma = 0x44,
.hue = 147,
.chroma = 153
diff --git a/supervisor/shared/external_flash/devices.h b/supervisor/shared/external_flash/devices.h
index 08d0a78fd..fd9224f56 100644
--- a/supervisor/shared/external_flash/devices.h
+++ b/supervisor/shared/external_flash/devices.h
@@ -105,6 +105,25 @@ typedef struct {
.single_status_byte = false, \
}
+// Settings for the Adesto Tech AT25SF041 1MiB SPI flash. It's on the SparkFun
+// SAMD51 Thing Plus board
+// Datasheet: https://www.adestotech.com/wp-content/uploads/DS-AT25SF041_044.pdf
+#define AT25SF041A {\
+ .total_size = (1 << 19), /* 512 KiB */ \
+ .start_up_time_us = 10000, \
+ .manufacturer_id = 0x1f, \
+ .memory_type = 0x84, \
+ .capacity = 0x01, \
+ .max_clock_speed_mhz = 85, \
+ .quad_enable_bit_mask = 0x00, \
+ .has_sector_protection = false, \
+ .supports_fast_read = true, \
+ .supports_qspi = false, \
+ .supports_qspi_writes = false, \
+ .write_status_register_split = false, \
+ .single_status_byte = false, \
+}
+
// Settings for the Gigadevice GD25Q16C 2MiB SPI flash.
// Datasheet: http://www.gigadevice.com/datasheet/gd25q16c/
#define GD25Q16C {\
@@ -371,6 +390,23 @@ typedef struct {
.single_status_byte = false, \
}
+// Settings for the Winbond W25Q80DV 1MiB SPI flash.. Note that W25Q80DL has a different memory type (0x60)
+// Datasheet: https://www.winbond.com/resource-files/w25q80dv%20dl_revh_10022015.pdf
+#define W25Q80DV {\
+ .total_size = (1 << 20), /* 1 MiB */ \
+ .start_up_time_us = 5000, \
+ .manufacturer_id = 0xef, \
+ .memory_type = 0x40, \
+ .capacity = 0x14, \
+ .max_clock_speed_mhz = 104, \
+ .quad_enable_bit_mask = 0x02, \
+ .has_sector_protection = false, \
+ .supports_fast_read = true, \
+ .supports_qspi = true, \
+ .supports_qspi_writes = false, \
+ .write_status_register_split = false, \
+ .single_status_byte = false, \
+}
// Settings for the Winbond W25Q128JV-SQ 16MiB SPI flash. Note that JV-IM has a different .memory_type (0x70)
// Datasheet: https://www.winbond.com/resource-files/w25q128jv%20revf%2003272018%20plus.pdf
@@ -445,6 +481,24 @@ typedef struct {
.single_status_byte = true, \
}
+// Settings for the Macronix MX25L51245G 64MiB SPI flash.
+// Datasheet: https://www.macronix.com/Lists/Datasheet/Attachments/7437/MX25L51245G,%203V,%20512Mb,%20v1.6.pdf
+#define MX25L51245G {\
+ .total_size = (1 << 26), /* 64 MiB */ \
+ .start_up_time_us = 5000, \
+ .manufacturer_id = 0xc2, \
+ .memory_type = 0x20, \
+ .capacity = 0x1a, \
+ .max_clock_speed_mhz = 133, \
+ .quad_enable_bit_mask = 0x40, \
+ .has_sector_protection = false, \
+ .supports_fast_read = true, \
+ .supports_qspi = true, \
+ .supports_qspi_writes = true, \
+ .write_status_register_split = false, \
+ .single_status_byte = true, \
+}
+
// Settings for the Winbond W25Q128JV-PM 16MiB SPI flash. Note that JV-IM has a different .memory_type (0x70)
// Datasheet: https://www.winbond.com/resource-files/w25q128jv%20revf%2003272018%20plus.pdf
#define W25Q128JV_PM {\
diff --git a/supervisor/shared/filesystem.c b/supervisor/shared/filesystem.c
index 3b799619f..f6b94e38b 100644
--- a/supervisor/shared/filesystem.c
+++ b/supervisor/shared/filesystem.c
@@ -104,7 +104,11 @@ void filesystem_init(bool create_allowed, bool force_create) {
}
// set label
+#ifdef CIRCUITPY_DRIVE_LABEL
+ f_setlabel(&vfs_fat->fatfs, CIRCUITPY_DRIVE_LABEL);
+#else
f_setlabel(&vfs_fat->fatfs, "CIRCUITPY");
+#endif
// inhibit file indexing on MacOS
f_mkdir(&vfs_fat->fatfs, "/.fseventsd");
diff --git a/supervisor/shared/memory.c b/supervisor/shared/memory.c
index 14c3b4979..d52334eb4 100755
--- a/supervisor/shared/memory.c
+++ b/supervisor/shared/memory.c
@@ -31,7 +31,7 @@
#include "supervisor/shared/display.h"
-#define CIRCUITPY_SUPERVISOR_ALLOC_COUNT 8
+#define CIRCUITPY_SUPERVISOR_ALLOC_COUNT (12)
static supervisor_allocation allocations[CIRCUITPY_SUPERVISOR_ALLOC_COUNT];
// We use uint32_t* to ensure word (4 byte) alignment.
@@ -82,6 +82,15 @@ void free_memory(supervisor_allocation* allocation) {
allocation->ptr = NULL;
}
+supervisor_allocation* allocation_from_ptr(void *ptr) {
+ for (size_t index = 0; index < CIRCUITPY_SUPERVISOR_ALLOC_COUNT; index++) {
+ if (allocations[index].ptr == ptr) {
+ return &allocations[index];
+ }
+ }
+ return NULL;
+}
+
supervisor_allocation* allocate_remaining_memory(void) {
if (low_address == high_address) {
return NULL;
diff --git a/supervisor/shared/rgb_led_status.c b/supervisor/shared/rgb_led_status.c
index f751a7ffd..f3c210647 100644
--- a/supervisor/shared/rgb_led_status.c
+++ b/supervisor/shared/rgb_led_status.c
@@ -115,7 +115,7 @@ void rgb_led_status_init() {
shared_module_bitbangio_spi_construct(&status_apa102,
MICROPY_HW_APA102_SCK,
MICROPY_HW_APA102_MOSI,
- mp_const_none);
+ NULL);
#else
if (!common_hal_busio_spi_deinited(&status_apa102)) {
// This may call us recursively if common_hal_reset_pin() is called,
@@ -125,7 +125,7 @@ void rgb_led_status_init() {
common_hal_busio_spi_construct(&status_apa102,
MICROPY_HW_APA102_SCK,
MICROPY_HW_APA102_MOSI,
- mp_const_none);
+ NULL);
common_hal_busio_spi_never_reset(&status_apa102);
#endif
// Pretend we aren't using the pins. bitbangio.SPI will
diff --git a/supervisor/shared/usb/usb_msc_flash.c b/supervisor/shared/usb/usb_msc_flash.c
index 0376cfc1d..7532b6aea 100644
--- a/supervisor/shared/usb/usb_msc_flash.c
+++ b/supervisor/shared/usb/usb_msc_flash.c
@@ -39,7 +39,7 @@
#define MSC_FLASH_BLOCK_SIZE 512
-static bool ejected[1];
+static bool ejected[1] = {true};
void usb_msc_mount(void) {
// Reset the ejection tracking every time we're plugged into USB. This allows for us to battery
@@ -53,6 +53,14 @@ void usb_msc_umount(void) {
}
+bool usb_msc_ejected(void) {
+ bool all_ejected = true;
+ for (uint8_t i = 0; i < sizeof(ejected); i++) {
+ all_ejected &= ejected[i];
+ }
+ return all_ejected;
+}
+
// The root FS is always at the end of the list.
static fs_user_mount_t* get_vfs(int lun) {
// TODO(tannewt): Return the mount which matches the lun where 0 is the end
@@ -200,6 +208,8 @@ bool tud_msc_test_unit_ready_cb(uint8_t lun) {
return false;
}
if (ejected[lun]) {
+ // Set 0x3a for media not present.
+ tud_msc_set_sense(lun, SCSI_SENSE_NOT_READY, 0x3A, 0x00);
return false;
}
@@ -235,10 +245,8 @@ bool tud_msc_start_stop_cb(uint8_t lun, uint8_t power_condition, bool start, boo
if (disk_ioctl(current_mount, CTRL_SYNC, NULL) != RES_OK) {
return false;
}
- } else {
- // Start the unit, but only if not ejected.
- return !ejected[lun];
}
+ // Always start the unit, even if ejected. Whether media is present is a separate check.
}
return true;
diff --git a/supervisor/usb.h b/supervisor/usb.h
index 0cc361619..29280c725 100644
--- a/supervisor/usb.h
+++ b/supervisor/usb.h
@@ -44,5 +44,6 @@ void usb_init(void);
// Propagate plug/unplug events to the MSC logic.
void usb_msc_mount(void);
void usb_msc_umount(void);
+bool usb_msc_ejected(void);
#endif // MICROPY_INCLUDED_SUPERVISOR_USB_H
diff --git a/tests/basics/dict1.py b/tests/basics/dict1.py
index 20fa9def3..0cec51173 100644
--- a/tests/basics/dict1.py
+++ b/tests/basics/dict1.py
@@ -27,7 +27,7 @@ print({1:1} == {2:1})
try:
{}[0]
except KeyError as er:
- print('KeyError', er, repr(er), er.args)
+ print('KeyError', er, er.args)
# unsupported unary op
try:
diff --git a/tests/basics/exception1.py b/tests/basics/exception1.py
index 739dd3275..d83764cb9 100644
--- a/tests/basics/exception1.py
+++ b/tests/basics/exception1.py
@@ -1,7 +1,6 @@
print(repr(IndexError()))
print(str(IndexError()))
-print(repr(IndexError("foo")))
print(str(IndexError("foo")))
a = IndexError(1, "test", [100, 200])
diff --git a/tests/basics/gen_yield_from.py.exp b/tests/basics/gen_yield_from.py.exp
new file mode 100644
index 000000000..507f2b9ca
--- /dev/null
+++ b/tests/basics/gen_yield_from.py.exp
@@ -0,0 +1,14 @@
+here1
+3
+here2
+[1, 2]
+here1
+None
+here2
+[1, 2]
+here1
+123
+here2
+[1, 2]
+444
+[0, 1, 2]
diff --git a/tests/basics/gen_yield_from_close.py.exp b/tests/basics/gen_yield_from_close.py.exp
new file mode 100644
index 000000000..a44d1353d
--- /dev/null
+++ b/tests/basics/gen_yield_from_close.py.exp
@@ -0,0 +1,20 @@
+-1
+1
+StopIteration
+-1
+1
+2
+leaf caught GeneratorExit and swallowed it
+delegating caught GeneratorExit
+StopIteration
+-1
+1
+2
+leaf caught GeneratorExit and raised StopIteration instead
+delegating caught GeneratorExit
+StopIteration
+123
+RuntimeError
+0
+1
+close
diff --git a/tests/basics/gen_yield_from_throw.py.exp b/tests/basics/gen_yield_from_throw.py.exp
new file mode 100644
index 000000000..6ce97ad86
--- /dev/null
+++ b/tests/basics/gen_yield_from_throw.py.exp
@@ -0,0 +1,6 @@
+1
+got ValueError from upstream!
+str1
+got TypeError from downstream!
+123
+got StopIteration from downstream!
diff --git a/tests/basics/generator_close.py.exp b/tests/basics/generator_close.py.exp
new file mode 100644
index 000000000..fcd583935
--- /dev/null
+++ b/tests/basics/generator_close.py.exp
@@ -0,0 +1,10 @@
+None
+StopIteration
+1
+None
+StopIteration
+[1, 2]
+None
+StopIteration
+None
+ValueError
diff --git a/tests/basics/generator_return.py b/tests/basics/generator_return.py
index a3ac88575..5814ce837 100644
--- a/tests/basics/generator_return.py
+++ b/tests/basics/generator_return.py
@@ -7,4 +7,4 @@ print(next(g))
try:
print(next(g))
except StopIteration as e:
- print(repr(e))
+ print(type(e), e.args)
diff --git a/tests/basics/int_big_error.py b/tests/basics/int_big_error.py
index e036525d1..79809aef1 100644
--- a/tests/basics/int_big_error.py
+++ b/tests/basics/int_big_error.py
@@ -17,9 +17,9 @@ try:
except TypeError:
print("TypeError")
-# overflow because rhs of >> is being converted to machine int
+# overflow because arg of bytearray is being converted to machine int
try:
- 1 >> i
+ bytearray(i)
except OverflowError:
print('OverflowError')
diff --git a/tests/basics/int_bytes.py b/tests/basics/int_bytes.py
index aaf440081..d42afac1f 100644
--- a/tests/basics/int_bytes.py
+++ b/tests/basics/int_bytes.py
@@ -1,8 +1,11 @@
print((10).to_bytes(1, "little"))
+print((-10).to_bytes(1, "little", signed=True))
# Test fitting in length that's not a power of two.
print((0x10000).to_bytes(3, 'little'))
print((111111).to_bytes(4, "little"))
+print((-111111).to_bytes(4, "little", signed=True))
print((100).to_bytes(10, "little"))
+print((-100).to_bytes(10, "little", signed=True))
# check that extra zero bytes don't change the internal int value
print(int.from_bytes(bytes(20), "little") == 0)
@@ -10,7 +13,9 @@ print(int.from_bytes(b"\x01" + bytes(20), "little") == 1)
# big-endian conversion
print((10).to_bytes(1, "big"))
+print((-10).to_bytes(1, "big", signed=True))
print((100).to_bytes(10, "big"))
+print((-100).to_bytes(10, "big", signed=True))
print(int.from_bytes(b"\0\0\0\0\0\0\0\0\0\x01", "big"))
print(int.from_bytes(b"\x01\0", "big"))
@@ -26,8 +31,13 @@ try:
except OverflowError:
print("OverflowError")
-# negative numbers should raise an error
+# negative numbers should raise an error if signed=False
try:
(-256).to_bytes(2, "little")
except OverflowError:
print("OverflowError")
+
+try:
+ (-256).to_bytes(2, "little", signed=False)
+except OverflowError:
+ print("OverflowError")
diff --git a/tests/basics/int_bytes_intbig.py b/tests/basics/int_bytes_intbig.py
index b19c8ae53..a9f069902 100644
--- a/tests/basics/int_bytes_intbig.py
+++ b/tests/basics/int_bytes_intbig.py
@@ -2,7 +2,9 @@ import skip_if
skip_if.no_bigint()
print((2**64).to_bytes(9, "little"))
+print((-2**64).to_bytes(9, "little", signed=True))
print((2**64).to_bytes(9, "big"))
+print((-2**64).to_bytes(9, "big", signed=True))
b = bytes(range(20))
@@ -22,8 +24,12 @@ try:
except OverflowError:
print("OverflowError")
-# negative numbers should raise an error
+# negative numbers should raise an error if signed=False
try:
(-2**64).to_bytes(9, "little")
except OverflowError:
print("OverflowError")
+try:
+ (-2**64).to_bytes(9, "little", signed=False)
+except OverflowError:
+ print("OverflowError")
diff --git a/tests/basics/int_longint_bytes.py b/tests/basics/int_longint_bytes.py
index 42e445f53..90cbff2f8 100644
--- a/tests/basics/int_longint_bytes.py
+++ b/tests/basics/int_longint_bytes.py
@@ -3,6 +3,7 @@ import skip_if
skip_if.no_bigint()
print((2**64).to_bytes(9, "little"))
+print((-2**64).to_bytes(9, "little", signed=True))
print(int.from_bytes(b"\x00\x01\0\0\0\0\0\0", "little"))
print(int.from_bytes(b"\x01\0\0\0\0\0\0\0", "little"))
print(int.from_bytes(b"\x00\x01\0\0\0\0\0\0", "little"))
diff --git a/tests/basics/parser.py.exp b/tests/basics/parser.py.exp
new file mode 100644
index 000000000..4d9886a09
--- /dev/null
+++ b/tests/basics/parser.py.exp
@@ -0,0 +1,3 @@
+SyntaxError
+SyntaxError
+SyntaxError
diff --git a/tests/basics/python34.py b/tests/basics/python34.py
index 36531f11c..4030db143 100644
--- a/tests/basics/python34.py
+++ b/tests/basics/python34.py
@@ -1,4 +1,4 @@
-# tests that differ when running under Python 3.4 vs 3.5/3.6
+# tests that differ when running under Python 3.4 vs 3.5/3.6/3.7
try:
exec
@@ -36,3 +36,7 @@ test_syntax("del ()") # can't delete empty tuple (in 3.6 we can)
import sys
print(sys.version[:3])
print(sys.version_info[0], sys.version_info[1])
+
+# from basics/exception1.py
+# in 3.7 no comma is printed if there is only 1 arg (in 3.4-3.6 one is printed)
+print(repr(IndexError("foo")))
diff --git a/tests/basics/python34.py.exp b/tests/basics/python34.py.exp
index 590fc364f..848017130 100644
--- a/tests/basics/python34.py.exp
+++ b/tests/basics/python34.py.exp
@@ -11,3 +11,4 @@ SyntaxError
SyntaxError
3.4
3 4
+IndexError('foo',)
diff --git a/tests/basics/set_pop.py b/tests/basics/set_pop.py
index 5e1196c9f..e951ca593 100644
--- a/tests/basics/set_pop.py
+++ b/tests/basics/set_pop.py
@@ -15,4 +15,4 @@ while s:
print(s.pop()) # last pop() should trigger the optimisation
for i in range(N):
s.add(i) # check that we can add the numbers back to the set
-print(list(s))
+print(sorted(s))
diff --git a/tests/basics/string_pep498_fstring.py b/tests/basics/string_pep498_fstring.py
new file mode 100644
index 000000000..c645a730c
--- /dev/null
+++ b/tests/basics/string_pep498_fstring.py
@@ -0,0 +1,113 @@
+# Tests against https://www.python.org/dev/peps/pep-0498/
+
+assert f'no interpolation' == 'no interpolation'
+assert f"no interpolation" == 'no interpolation'
+
+# Quoth the PEP:
+# Backslashes may not appear anywhere within expressions. Comments, using the
+# '#' character, are not allowed inside an expression
+#
+# CPython (3.7.4 on Linux) raises a SyntaxError here:
+# >>> f'{#}'
+# File "<stdin>", line 1
+# SyntaxError: f-string expression part cannot include '#'
+# >>> f'{\}'
+# File "<stdin>", line 1
+# SyntaxError: f-string expression part cannot include a backslash
+# >>> f'{\\}'
+# File "<stdin>", line 1
+# SyntaxError: f-string expression part cannot include a backslash
+# >>> f'{\#}'
+# File "<stdin>", line 1
+# SyntaxError: f-string expression part cannot include a backslash
+
+# Backslashes and comments allowed outside expression
+assert f"\\" == "\\"
+assert f'#' == '#'
+
+## But not inside
+try:
+ eval("f'{\}'")
+except SyntaxError:
+ pass
+else:
+ raise AssertionError('f-string with backslash in expression did not raise SyntaxError')
+
+try:
+ eval("f'{#}'")
+except SyntaxError:
+ pass
+else:
+ raise AssertionError('f-string with \'#\' in expression did not raise SyntaxError')
+
+# Quoth the PEP:
+# While scanning the string for expressions, any doubled braces '{{' or '}}'
+# inside literal portions of an f-string are replaced by the corresponding
+# single brace. Doubled literal opening braces do not signify the start of an
+# expression. A single closing curly brace '}' in the literal portion of a
+# string is an error: literal closing curly braces must be doubled '}}' in
+# order to represent a single closing brace.
+#
+# CPython (3.7.4 on Linux) raises a SyntaxError for the last case:
+# >>> f'{{}'
+# File "<stdin>", line 1
+# SyntaxError: f-string: single '}' is not allowed
+
+assert f'{{}}' == '{}'
+
+try:
+ eval("f'{{}'")
+except ValueError:
+ pass
+else:
+ raise RuntimeError('Expected ValueError for invalid f-string literal bracing')
+
+x = 1
+assert f'{x}' == '1'
+
+# Quoth the PEP:
+# The expressions that are extracted from the string are evaluated in the
+# context where the f-string appeared. This means the expression has full
+# access to local and global variables. Any valid Python expression can be
+# used, including function and method calls. Because the f-strings are
+# evaluated where the string appears in the source code, there is no additional
+# expressiveness available with f-strings. There are also no additional
+# security concerns: you could have also just written the same expression, not
+# inside of an f-string:
+
+def foo():
+ return 20
+
+assert f'result={foo()}' == 'result=20'
+assert f'result={foo()}' == 'result={}'.format(foo())
+assert f'result={foo()}' == 'result={result}'.format(result=foo())
+
+
+# Quoth the PEP:
+# Adjacent f-strings and regular strings are concatenated. Regular strings are
+# concatenated at compile time, and f-strings are concatenated at run time. For
+# example, the expression:
+#
+# >>> x = 10
+# >>> y = 'hi'
+# >>> 'a' 'b' f'{x}' '{c}' f'str<{y:^4}>' 'd' 'e'
+#
+# yields the value: 'ab10{c}str< hi >de'
+#
+# Because strings are concatenated at lexer time rather than parser time in
+# MicroPython for mostly RAM efficiency reasons (see
+# https://github.com/micropython/micropython/commit/534b7c368dc2af7720f3aaed0c936ef46d773957),
+# and because f-strings here are implemented as a syntax translation
+# (f'{something}' => '{}'.format(something)), this particular functionality is unimplemented,
+# and in the above example, the '{c}' portion will trigger a KeyError on String.format()
+
+x = 10
+y = 'hi'
+assert (f'h' f'i') == 'hi'
+#assert (f'h' 'i') == 'hi'
+#assert ('h' f'i') == 'hi'
+assert f'{x:^4}' == ' 10 '
+#assert ('a' 'b' f'{x}' f'str<{y:^4}>' 'd' 'e') == 'ab10str< hi >de'
+
+# Other tests
+assert f'{{{4*10}}}' == '{40}'
diff --git a/tests/basics/string_pep498_fstring.py.exp b/tests/basics/string_pep498_fstring.py.exp
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/basics/string_pep498_fstring.py.exp
diff --git a/tests/basics/subclass_native3.py b/tests/basics/subclass_native3.py
index bd99ab0d6..6745b77bb 100644
--- a/tests/basics/subclass_native3.py
+++ b/tests/basics/subclass_native3.py
@@ -7,12 +7,12 @@ print(repr(e))
print(e.args)
try:
- raise MyExc("Some error")
+ raise MyExc("Some error", 1)
except MyExc as e:
print("Caught exception:", repr(e))
try:
- raise MyExc("Some error2")
+ raise MyExc("Some error2", 2)
except Exception as e:
print("Caught exception:", repr(e))
diff --git a/tests/basics/try_as_var.py b/tests/basics/try_as_var.py
index 0a92f1cae..4f02f9c10 100644
--- a/tests/basics/try_as_var.py
+++ b/tests/basics/try_as_var.py
@@ -1,7 +1,7 @@
try:
raise ValueError(534)
except ValueError as e:
- print(repr(e))
+ print(type(e), e.args)
# Var bound in except block is automatically deleted
try:
diff --git a/tests/cmdline/cmd_parsetree.py.exp b/tests/cmdline/cmd_parsetree.py.exp
index 12a1bfbe9..c06ce4e31 100644
--- a/tests/cmdline/cmd_parsetree.py.exp
+++ b/tests/cmdline/cmd_parsetree.py.exp
@@ -1,6 +1,6 @@
----------------
[ 4] rule(1) (n=9)
- tok(4)
+ tok(10)
[ 4] rule(22) (n=4)
id(i)
[ 4] rule(44) (n=1)
@@ -9,7 +9,7 @@
NULL
[ 6] rule(5) (n=2)
id(a)
- tok(14)
+ tok(20)
[ 7] rule(5) (n=2)
id(b)
str(str)
diff --git a/tests/import/import_override.py.exp b/tests/import/import_override.py.exp
new file mode 100644
index 000000000..365248da6
--- /dev/null
+++ b/tests/import/import_override.py.exp
@@ -0,0 +1,2 @@
+import import1b None 0
+456
diff --git a/tests/misc/sys_exc_info.py b/tests/misc/sys_exc_info.py
index 4bb2c61e8..bf9438e46 100644
--- a/tests/misc/sys_exc_info.py
+++ b/tests/misc/sys_exc_info.py
@@ -9,7 +9,7 @@ def f():
print(sys.exc_info()[0:2])
try:
- 1/0
+ raise ValueError('value', 123)
except:
print(sys.exc_info()[0:2])
f()
diff --git a/tests/run-tests b/tests/run-tests
index 94e1591e8..6e980f03c 100755
--- a/tests/run-tests
+++ b/tests/run-tests
@@ -385,6 +385,7 @@ def run_tests(pyb, tests, args, base_path=".", num_threads=1):
skip_tests.add('stress/gc_trace.py') # requires yield
skip_tests.add('stress/recursive_gen.py') # requires yield
skip_tests.add('extmod/vfs_userfs.py') # because native doesn't properly handle globals across different modules
+ skip_tests.add('../extmod/ulab/tests/argminmax.py') # requires yield
def run_one_test(test_file):
test_file = test_file.replace('\\', '/')
@@ -579,7 +580,7 @@ the last matching regex is used:
# run PC tests
test_dirs = (
'basics', 'micropython', 'float', 'import', 'io', 'misc',
- 'stress', 'unicode', 'extmod', 'unix', 'cmdline',
+ 'stress', 'unicode', 'extmod', '../extmod/ulab/tests', 'unix', 'cmdline',
)
else:
# run tests from these directories
diff --git a/tools/build_board_info.py b/tools/build_board_info.py
index 1f074dddf..543224fae 100644
--- a/tools/build_board_info.py
+++ b/tools/build_board_info.py
@@ -12,7 +12,7 @@ from sh.contrib import git
sys.path.append("adabot")
import adabot.github_requests as github
-SUPPORTED_PORTS = ["nrf", "atmel-samd", "stm32f4", "cxd56", "mimxrt10xx"]
+SUPPORTED_PORTS = ["nrf", "atmel-samd", "stm", "cxd56", "mimxrt10xx", "litex"]
BIN = ('bin',)
UF2 = ('uf2',)
@@ -20,21 +20,30 @@ BIN_UF2 = ('bin', 'uf2')
HEX = ('hex',)
HEX_UF2 = ('hex', 'uf2')
SPK = ('spk',)
+DFU = ('dfu',)
+BIN_DFU = ('bin', 'dfu')
+
+# Example:
+# https://downloads.circuitpython.org/bin/trinket_m0/en_US/adafruit-circuitpython-trinket_m0-en_US-5.0.0-rc.0.uf2
+DOWNLOAD_BASE_URL = "https://downloads.circuitpython.org/bin"
# Default extensions
extension_by_port = {
"nrf": UF2,
"atmel-samd": UF2,
- "stm32f4": BIN,
+ "stm": BIN,
"cxd56": SPK,
"mimxrt10xx": HEX_UF2,
+ "litex": DFU,
}
# Per board overrides
extension_by_board = {
# samd
- "arduino_mkr1300": BIN,
- "arduino_zero": BIN,
+ "arduino_mkr1300": BIN_UF2,
+ "arduino_mkrzero": BIN_UF2,
+ "arduino_nano_33_iot": BIN_UF2,
+ "arduino_zero": BIN_UF2,
"feather_m0_adalogger": BIN_UF2,
"feather_m0_basic": BIN_UF2,
"feather_m0_rfm69": BIN_UF2,
@@ -275,7 +284,14 @@ def generate_download_info():
files = []
new_version["files"][language] = files
for extension in board_info["extensions"]:
- files.append("https://github.com/adafruit/circuitpython/releases/download/{tag}/adafruit-circuitpython-{alias}-{language}-{tag}.{extension}".format(tag=new_tag, alias=alias, language=language, extension=extension))
+ files.append(
+ "{base_url}/{alias}/{language}/adafruit-circuitpython-{alias}-{language}-{tag}.{extension}"
+ .format(
+ base_url=DOWNLOAD_BASE_URL,
+ tag=new_tag,
+ alias=alias,
+ language=language,
+ extension=extension))
current_info[alias]["downloads"] = alias_info["download_count"]
current_info[alias]["versions"].append(new_version)
diff --git a/tools/convert_release_notes.py b/tools/convert_release_notes.py
index 87b7e444b..649184102 100644
--- a/tools/convert_release_notes.py
+++ b/tools/convert_release_notes.py
@@ -52,6 +52,9 @@ class AdafruitBBCodeRenderer:
def double_emphasis(self, text):
return "[b]{}[/b]".format(text)
+ def emphasis(self, text):
+ return "[b]{}[/b]".format(text)
+
bbcode = mistune.Markdown(renderer=AdafruitBBCodeRenderer())
print()
diff --git a/tools/dfu.py b/tools/dfu.py
index 54b602438..dd6019235 100755..100644
--- a/tools/dfu.py
+++ b/tools/dfu.py
@@ -1,6 +1,7 @@
#!/usr/bin/python
# Written by Antonio Galea - 2010/11/18
+# Updated for DFU 1.1 by Sean Cross - 2020/03/31
# Distributed under Gnu LGPL 3.0
# see http://www.gnu.org/licenses/lgpl-3.0.txt
@@ -23,30 +24,7 @@ def parse(file,dump_images=False):
print ('File: "%s"' % file)
data = open(file,'rb').read()
crc = compute_crc(data[:-4])
- prefix, data = consume('<5sBIB',data,'signature version size targets')
- print ('%(signature)s v%(version)d, image size: %(size)d, targets: %(targets)d' % prefix)
- for t in range(prefix['targets']):
- tprefix, data = consume('<6sBI255s2I',data,'signature altsetting named name size elements')
- tprefix['num'] = t
- if tprefix['named']:
- tprefix['name'] = cstring(tprefix['name'])
- else:
- tprefix['name'] = ''
- print ('%(signature)s %(num)d, alt setting: %(altsetting)s, name: "%(name)s", size: %(size)d, elements: %(elements)d' % tprefix)
- tsize = tprefix['size']
- target, data = data[:tsize], data[tsize:]
- for e in range(tprefix['elements']):
- eprefix, target = consume('<2I',target,'address size')
- eprefix['num'] = e
- print (' %(num)d, address: 0x%(address)08x, size: %(size)d' % eprefix)
- esize = eprefix['size']
- image, target = target[:esize], target[esize:]
- if dump_images:
- out = '%s.target%d.image%d.bin' % (file,t,e)
- open(out,'wb').write(image)
- print (' DUMPED IMAGE TO "%s"' % out)
- if len(target):
- print ("target %d: PARSE ERROR" % t)
+ data = data[len(data)-16:]
suffix = named(struct.unpack('<4H3sBI',data[:16]),'device product vendor dfu ufd len crc')
print ('usb: %(vendor)04x:%(product)04x, device: 0x%(device)04x, dfu: 0x%(dfu)04x, %(ufd)s, %(len)d, 0x%(crc)08x' % suffix)
if crc != suffix['crc']:
@@ -55,53 +33,49 @@ def parse(file,dump_images=False):
if data:
print ("PARSE ERROR")
-def build(file,targets,device=DEFAULT_DEVICE):
- data = b''
- for t,target in enumerate(targets):
- tdata = b''
- for image in target:
- tdata += struct.pack('<2I',image['address'],len(image['data']))+image['data']
- tdata = struct.pack('<6sBI255s2I',b'Target',0,1, b'ST...',len(tdata),len(target)) + tdata
- data += tdata
- data = struct.pack('<5sBIB',b'DfuSe',1,len(data)+11,len(targets)) + data
+def build(file,data,device=DEFAULT_DEVICE):
+ # Parse the VID and PID from the `device` argument
v,d=map(lambda x: int(x,0) & 0xFFFF, device.split(':',1))
- data += struct.pack('<4H3sB',0,d,v,0x011a,b'UFD',16)
+
+ # Generate the DFU suffix, consisting of these fields:
+ # Field name | Length | Description
+ # ================+=========+================================
+ # bcdDevice | 2 | The release number of this firmware (0xffff - don't care)
+ # idProduct | 2 | PID of this device
+ # idVendor | 2 | VID of this device
+ # bcdDFU | 2 | Version of this DFU spec (0x01 0x00)
+ # ucDfuSignature | 3 | The characters 'DFU', printed in reverse order
+ # bLength | 1 | The length of this suffix (16 bytes)
+ # dwCRC | 4 | A CRC32 of the data, including this suffix
+ data += struct.pack('<4H3sB',0xffff,d,v,0x0100,b'UFD',16)
crc = compute_crc(data)
+ # Append the CRC32 of the entire block
data += struct.pack('<I',crc)
open(file,'wb').write(data)
if __name__=="__main__":
usage = """
%prog [-d|--dump] infile.dfu
-%prog {-b|--build} address:file.bin [-b address:file.bin ...] [{-D|--device}=vendor:device] outfile.dfu"""
+%prog {-b|--build} file.bin [{-D|--device}=vendor:device] outfile.dfu"""
parser = OptionParser(usage=usage)
- parser.add_option("-b", "--build", action="append", dest="binfiles",
- help="build a DFU file from given BINFILES", metavar="BINFILES")
+ parser.add_option("-b", "--build", action="store", dest="binfile",
+ help="build a DFU file from given BINFILE", metavar="BINFILE")
parser.add_option("-D", "--device", action="store", dest="device",
help="build for DEVICE, defaults to %s" % DEFAULT_DEVICE, metavar="DEVICE")
parser.add_option("-d", "--dump", action="store_true", dest="dump_images",
default=False, help="dump contained images to current directory")
(options, args) = parser.parse_args()
- if options.binfiles and len(args)==1:
- target = []
- for arg in options.binfiles:
- try:
- address,binfile = arg.split(':',1)
- except ValueError:
- print ("Address:file couple '%s' invalid." % arg)
- sys.exit(1)
- try:
- address = int(address,0) & 0xFFFFFFFF
- except ValueError:
- print ("Address %s invalid." % address)
- sys.exit(1)
- if not os.path.isfile(binfile):
- print ("Unreadable file '%s'." % binfile)
- sys.exit(1)
- target.append({ 'address': address, 'data': open(binfile,'rb').read() })
+ if options.binfile and len(args)==1:
+ binfile = options.binfile
+ if not os.path.isfile(binfile):
+ print ("Unreadable file '%s'." % binfile)
+ sys.exit(1)
+ target = open(binfile,'rb').read()
outfile = args[0]
device = DEFAULT_DEVICE
+ # If a device is specified, parse the pair into a VID:PID pair
+ # in order to validate them.
if options.device:
device=options.device
try:
@@ -109,7 +83,7 @@ if __name__=="__main__":
except:
print ("Invalid device '%s'." % device)
sys.exit(1)
- build(outfile,[target],device)
+ build(outfile,target,device)
elif len(args)==1:
infile = args[0]
if not os.path.isfile(infile):
diff --git a/tools/gc_activity.md b/tools/gc_activity.md
index d1a4c2803..686d9b6b7 100644
--- a/tools/gc_activity.md
+++ b/tools/gc_activity.md
@@ -13,7 +13,7 @@ correct port. GDB is usually :3333 and JLink is :2331.
Now, run gdb from your port directory:
```
-arm-none-eabi-gdb -x ../tools/output_gc_until_repl.txt build-metro_m0_express/firmware.elf
+arm-none-eabi-gdb -x ../../tools/output_gc_until_repl.txt build-metro_m0_express/firmware.elf
```
This will take a little time while it breaks, backtraces and continues for every
diff --git a/tools/gc_activity_between_collects.py b/tools/gc_activity_between_collects.py
new file mode 100644
index 000000000..c02c479f9
--- /dev/null
+++ b/tools/gc_activity_between_collects.py
@@ -0,0 +1,141 @@
+import sys
+import json
+
+# Map start block to current allocation info.
+current_heap = {}
+allocation_history = []
+root = {}
+
+def change_root(trace, size):
+ level = root
+ for frame in reversed(trace):
+ file_location = frame[1]
+ if file_location not in level:
+ level[file_location] = {"blocks": 0,
+ "file": file_location,
+ "function": frame[2],
+ "subcalls": {}}
+ level[file_location]["blocks"] += size
+ level = level[file_location]["subcalls"]
+
+total_actions = 0
+non_single_block_streak = 0
+max_nsbs = 0
+last_action = None
+last_total_actions = 0
+count = 0
+actions = {}
+last_ticks_ms = 0
+ticks_ms = 0
+block_sizes = {}
+allocation_sources = {}
+with open(sys.argv[1], "r") as f:
+ for line in f:
+ if not line.strip():
+ break
+ for line in f:
+ action = None
+ if line.startswith("Breakpoint 2"):
+ break
+ next(f) # throw away breakpoint code line
+ # print(next(f)) # first frame
+ block = 0
+ size = 0
+ trace = []
+ for line in f:
+ # print(line.strip())
+ if line[0] == "#":
+ frame = line.strip().split()
+ if frame[1].startswith("0x"):
+ trace.append((frame[1], frame[-1], frame[3]))
+ else:
+ trace.append(("0x0", frame[-1], frame[1]))
+ elif line[0] == "$":
+ #print(line.strip().split()[-1])
+ block = int(line.strip().split()[-1][2:], 16)
+ next_line = next(f)
+ size = int(next_line.strip().split()[-1][2:], 16)
+ # next_line = next(f)
+ # ticks_ms = int(next_line.strip().split()[-1][2:], 16)
+ if not line.strip():
+ break
+
+ action = "unknown"
+ if block not in current_heap:
+ current_heap[block] = {"start_block": block, "size": size, "start_trace": trace, "start_time": total_actions}
+ action = "alloc"
+ if size == 1:
+ max_nsbs = max(max_nsbs, non_single_block_streak)
+ non_single_block_streak = 0
+ else:
+ non_single_block_streak += 1
+ #change_root(trace, size)
+ if size not in block_sizes:
+ block_sizes[size] = 0
+ source = trace[-1][-1]
+ if source not in allocation_sources:
+ print(trace)
+ allocation_sources[source] = 0
+ allocation_sources[source] += 1
+ block_sizes[size] += 1
+ else:
+ alloc = current_heap[block]
+ alloc["end_trace"] = trace
+ alloc["end_time"] = total_actions
+ change_root(alloc["start_trace"], -1 * alloc["size"])
+ if size > 0:
+ action = "realloc"
+ current_heap[block] = {"start_block": block, "size": size, "start_trace": trace, "start_time": total_actions}
+ #change_root(trace, size)
+ else:
+ action = "free"
+ if trace[0][2] == "gc_sweep":
+ action = "sweep"
+ non_single_block_streak = 0
+ if (trace[3][2] == "py_gc_collect" or (trace[3][2] == "gc_deinit" and count > 1)) and last_action != "sweep":
+ print(ticks_ms - last_ticks_ms, total_actions - last_total_actions, "gc.collect", max_nsbs)
+ print(actions)
+ print(block_sizes)
+ print(allocation_sources)
+ actions = {}
+ block_sizes = {}
+ allocation_sources = {}
+ if count % 2 == 0:
+ print()
+ count += 1
+ last_total_actions = total_actions
+ last_ticks_ms = ticks_ms
+ max_nsbs = 0
+ del current_heap[block]
+ alloc["end_cause"] = action
+ allocation_history.append(alloc)
+ if action not in actions:
+ actions[action] = 0
+ actions[action] += 1
+ last_action = action
+ #print(total_actions, non_single_block_streak, action, block, size)
+ total_actions += 1
+print(actions)
+print(max_nsbs)
+print()
+
+for alloc in current_heap.values():
+ alloc["end_trace"] = ""
+ alloc["end_time"] = total_actions
+ allocation_history.append(alloc)
+
+def print_frame(frame, indent=0):
+ for key in sorted(frame):
+ if not frame[key]["blocks"] or key.startswith("../py/malloc.c") or key.startswith("../py/gc.c"):
+ continue
+ print(" " * (indent - 1), key, frame[key]["function"], frame[key]["blocks"], "blocks")
+ print_frame(frame[key]["subcalls"], indent + 2)
+
+# print_frame(root)
+# total_blocks = 0
+# for key in sorted(root):
+# total_blocks += root[key]["blocks"]
+# print(total_blocks, "total blocks")
+
+# with open("allocation_history.json", "w") as f:
+# json.dump(allocation_history, f)
diff --git a/tools/hid_report_descriptors.py b/tools/hid_report_descriptors.py
index 92c962d59..07ed26744 100644
--- a/tools/hid_report_descriptors.py
+++ b/tools/hid_report_descriptors.py
@@ -68,9 +68,9 @@ def keyboard_hid_descriptor(report_id):
0x81, 0x02, # Input (Data, Variable, Absolute)
0x81, 0x01, # Input (Constant)
0x19, 0x00, # Usage Minimum (0)
- 0x29, 101, # Usage Maximum (101)
+ 0x29, 0xDD, # Usage Maximum (221)
0x15, 0x00, # Logical Minimum (0)
- 0x25, 101, # Logical Maximum (101)
+ 0x25, 0xDD, # Logical Maximum (221)
0x75, 0x08, # Report Size (8)
0x95, 0x06, # Report Count (6)
0x81, 0x00, # Input (Data, Array)
diff --git a/tools/output_gc_until_repl.txt b/tools/output_gc_until_repl.txt
index 81711deeb..1c124de80 100644
--- a/tools/output_gc_until_repl.txt
+++ b/tools/output_gc_until_repl.txt
@@ -10,16 +10,23 @@ set logging on
set remote hardware-breakpoint-limit 4
# gc log
-break gc.c:103
+break gc.c:106
commands
-backtrace
p/x start_block
p/x length
-append binary memory ram.bin &_srelocate &_estack
+p/x ticks_ms
+# backtrace output redirect is currently broken in gdb so we use up instead.
+# https://sourceware.org/bugzilla/show_bug.cgi?id=23439
+# backtrace
+up
+up
+up
+up
+# append binary memory ram.bin &_srelocate &_estack
continue
end
-break main.c:179
+break main.c:251
continue
diff --git a/tools/upload_release_files.py b/tools/upload_release_files.py
deleted file mode 100755
index 4f193a8be..000000000
--- a/tools/upload_release_files.py
+++ /dev/null
@@ -1,35 +0,0 @@
-#! /usr/bin/env python3
-
-import os
-import os.path
-import sys
-import uritemplate
-
-sys.path.append("adabot")
-import adabot.github_requests as github
-
-exit_status = 0
-
-for dirpath, dirnames, filenames in os.walk("../bin"):
- if not filenames:
- continue
- for filename in filenames:
- full_filename = os.path.join(dirpath, filename)
- label = filename.replace("adafruit-circuitpython-", "")
- url_vars = {}
- url_vars["name"] = filename
- url_vars["label"] = label
- url = uritemplate.expand(os.environ["UPLOAD_URL"], url_vars)
- headers = {"content-type": "application/octet-stream"}
- print(url)
- with open(full_filename, "rb") as f:
- response = github.post(url, data=f, headers=headers)
- if not response.ok:
- if response.status_code == 422 and response.json().get("errors", [{"code":""}])[0]["code"] == "already_exists":
- print("File already uploaded. Skipping.")
- continue
- print("Upload of {} failed with {}.".format(filename, response.status_code))
- print(response.text)
- sys.exit(response.status_code)
-
-sys.exit(exit_status)