Commit Graph

7153 Commits

Author SHA1 Message Date
Damien George fd01b6c779 stm32/adc: Allow mboot to use basic ADC functions.
Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 00:42:59 +10:00
Damien George ef2896bdea stm32/mboot: Allow a board to add source files to the build.
A board can now use BUILDING_MBOOT at the Makefile-level to do things
conditional on building mboot, for example add source files to SRC_C.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 00:42:59 +10:00
Damien George 885b246ca9 stm32/boardctrl: Show first reset-mode state on LEDs when selecting.
Commit 1e297c8898 introduced a bug where the
very first reset-mode state on the LEDs was not shown, because prior to
that commit the first reset-mode state was the same as the initial LED
state (green on, others off) and update_reset_mode() was called after
setting this initial LED state.

This is fixed in this commit by changing the update_reset_mode() loop so
that it displays the current reset mode before doing the delay.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 00:32:12 +10:00
Damien George a72b8443ca stm32/boardctrl: Add constants for reset mode values.
And use the same boardctrl.h header for both the application and mboot so
these constants are consistent.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 00:31:35 +10:00
microDev 1b972c51c3
add authmode class 2021-04-29 18:42:36 +05:30
Damien George 647fa63f9c stm32/softtimer: Support static soft timer instances.
This adds support for making static (ie not on the Python GC heap) soft
timers.  This can be useful for a board to define a custom background
handler, or eventually for BLE/network processing to use instead of systick
slots; it will be more efficient using soft timer for this.

The main issue with using the existing code for static soft timers is that
it would combine heap allocated and statically allocated soft_timer_entry_t
instances in the same pairing-heap data structure.  This would prevent the
GC from tracing some of the heap allocated entries (because the GC won't
follow pointers outside the heap).

This commit makes it so that soft timer entries are explicitly marked,
instead of relying on implicit marking by having the root of the pairing
heap in the root pointer section.  Also, on soft reset only the heap-
allocated soft timers are deleted from the pairing heap, leaving the
statically allocated ones.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-29 16:54:35 +10:00
Damien George 89b64478c7 stm32/softtimer: Add support for having a C-based callback.
Signed-off-by: Damien George <damien@micropython.org>
2021-04-29 16:54:35 +10:00
Dan Halbert f06d54524d merge from adafruit 2021-04-28 23:48:26 -04:00
Seth Kerr 555ade7ff3 final change to ja flags i think 2021-04-28 20:42:13 -06:00
Steve App 21fee92be6 esp32: Restore FROZEN_MANIFEST support with new CMake build system.
This commit re-enables the command-line make option "FROZEN_MANIFEST".  The
boards/*/mpconfigboard.cmake will now use the command-line FROZEN_MANIFEST
value if supplied.

Usage: make FROZEN_MANIFEST=~/foo/my-manifest.py
2021-04-29 12:34:00 +10:00
Seth Kerr 8090af07dd fix ja build issue 2021-04-28 19:14:45 -06:00
Lucian Copeland 9fe8d61656 Fix broken MP macros from 1.11 merge 2021-04-28 18:26:52 -04:00
Lucian Copeland 5c4500dbfa Fix MP type macros 2021-04-28 15:35:15 -04:00
Lucian Copeland 9feef41c82 Merge remote-tracking branch 'upstream/main' into stm-alarm 2021-04-28 15:10:55 -04:00
Tsutomu IKEGAMI 0d25b95f0d Add definitions of PB2[4-9] pins to microcontroller.pin for atmel-samd. 2021-04-29 02:19:34 +09:00
root cfac07c1cc Wrap pulsein when maxlen is exceeded 2021-04-28 11:20:13 -05:00
Dan Halbert d4d96bb25f
Merge pull request #4236 from jun2sak/nrf52-sleep
sleep and wakeup for nrf52
2021-04-28 12:11:31 -04:00
Tsutomu IKEGAMI 22c4abd28f Add DAC* and RTL_* pin assignments to Wio Terminal board. 2021-04-28 18:57:21 +09:00
Dan Halbert 8500e846c6 partially working 2021-04-27 23:53:23 -04:00
Seth Kerr e85091193b adding CP Sapling Rev B 2021-04-27 16:30:44 -06:00
Dan Halbert f98a54628b wip: compiles 2021-04-27 14:37:36 -04:00
Scott Shawcroft 17fcd499b2
Merge pull request #4649 from tannewt/merge_1.11_2
Merge MicroPython v1.11 into CircuitPython
2021-04-27 11:02:02 -07:00
Scott Shawcroft f99deeda68
Merge pull request #4668 from DavePutz/issue_4659
Increased possible pulsein length to ~65 ms.
2021-04-27 11:01:51 -07:00
Scott Shawcroft 9e183bbbba
Merge pull request #4674 from kattni/dotstar-pins
Adding clearer on-board DotStar pin names.
2021-04-27 10:56:47 -07:00
Kattni Rembor 4e1d2fa056 Adding clearer on-board DotStar pin names. 2021-04-27 12:52:24 -04:00
Melissa LeBlanc-Williams d7faac11b8 Release display on FunHouse for DeepSleep 2021-04-27 09:09:23 -07:00
iabdalkader a708848b0c stm32/uart: Fix H7 UART clock source configuration.
Previously to this commit, Usart16ClockSelection was overwritten and
Usart234578ClockSelection was not set.
2021-04-28 00:46:48 +10:00
plan-do-break-fix 4dc802400f stm32,teensy: Correct typos in project README files. 2021-04-28 00:29:18 +10:00
Daniel Maslowski f452b9c265 pic16bit/Makefile: Make the XC compiler version user-configurable. 2021-04-28 00:18:04 +10:00
Damien George 43a8c8178e bare-arm: Switch to use MICROPY_ERROR_REPORTING_NONE to reduce size.
Reduces size of this port by about 3300 bytes, and demonstrates how to use
this feature.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-27 23:52:40 +10:00
Damien George 65b90cd0f9 teensy: Provide own implementation of gc_collect, to not use stm32.
Signed-off-by: Damien George <damien@micropython.org>
2021-04-27 12:08:00 +10:00
root 91739de71a Increased max pulse to 65535 us 2021-04-26 18:52:15 -05:00
Scott Shawcroft 76033d5115
Merge MicroPython v1.11 into CircuitPython 2021-04-26 15:47:41 -07:00
Lucian Copeland 43840363c2 Fix submodule 2021-04-26 17:59:21 -04:00
Kattni 65c1ddb570
Merge pull request #4667 from ajs256/trinkey_pixel_fixes
Trinkey pixel fixes
2021-04-26 17:19:14 -04:00
anecdata a1e2afadce AP ip_info, gateway, & subnet 2021-04-26 00:22:51 -05:00
Dan Halbert c26e49c2e6 wip: starting to try to compile 2021-04-25 23:17:41 -04:00
root 5bd1da21a2 Increased possible pulsein length to 32 ms. 2021-04-25 21:38:57 -05:00
Jeff Epler 92919c25c2
Merge pull request #4666 from DavePutz/issue_4660
Reset buffer index in PulseIn clear
2021-04-25 20:33:58 -05:00
ajs256 de3c5ff976
oh crud, i forgot a semicolon 2021-04-25 16:42:58 -07:00
anecdata f20a53177b add authmode to start_ap() 2021-04-25 18:20:18 -05:00
anecdata 747d72f5a5 redundant with system log 2021-04-25 18:18:45 -05:00
ajs256 4bafbca0c3 Trinkeys: Clear neopixels on board reset 2021-04-25 12:58:52 -07:00
root d1861a6b9c Reset buffer index in PulseIn clear 2021-04-25 14:24:21 -05:00
Limor "Ladyada" Fried f7f6a42f3d
Merge pull request #4663 from zapwizard/patch-1
Update pins.c
2021-04-25 15:09:13 -04:00
zapwizard 889da596ff
Update pins.c
Both D0 and D1 were assigned to pin_GPIO7, fixed D0 to pin_GPIO6, which also matches the comment.
2021-04-25 13:10:52 -05:00
gamblor21 30f31639d3 Added statemachine deinit 2021-04-25 11:58:22 -05:00
jun2sak 872fff7fbb simplify system_on_idle_until_alarm() 2021-04-25 23:59:21 +09:00
anecdata c510c4d501 allow start/stop sta/ap (changing modes) when `wifi.radio.enabled = False` 2021-04-25 09:29:15 -05:00
Dan Halbert 9d1fcc3b14 merge from main 2021-04-25 10:27:52 -04:00
jun2sak 7accb8b173 modify copyright notice. 2021-04-25 19:57:21 +09:00
jun2sak a17fcb6d1a add copyright notice. remove obsolete comments. 2021-04-25 19:19:11 +09:00
anecdata dc3c47d396 ap channel param 2021-04-25 00:22:08 -05:00
anecdata 354b442867 fixes 2021-04-24 19:36:11 -05:00
anecdata 2e52c0ae62 set all wifi modes; add sta start & sta/ap stop 2021-04-24 16:41:41 -05:00
Mark ed374a89fb
Merge pull request #4655 from DavePutz/issue_4602
Issue 4602 - Correct timing of PulseOut on SAMD21
2021-04-24 10:45:10 -05:00
Dan Halbert 2ba2574ebf
Merge pull request #4619 from tyomitch/microbit
[build] Allow USB to be set to 0
2021-04-24 10:31:29 -04:00
Dan Halbert 80f05c76a8
Merge pull request #4654 from dhalbert/6.2.x-merge-1
Port #4645 to main
2021-04-24 10:29:52 -04:00
anecdata 4d267ef644 add get_ipv4_address_ap 2021-04-23 21:44:34 -05:00
Scott Shawcroft 80e8b4ac14
Merge pull request #4635 from jepler/pcc
WIP: Implement 'ParallelImageCapture' for samd51
2021-04-23 13:31:53 -07:00
Dan Halbert 454e78f41f merge #4645 from 6.2.x to main 2021-04-23 13:33:58 -04:00
Artyom Skrobov 4e3c1d4a4c [build] Allow USB to be set to 0
Unify USB-related makefile var and C def as CIRCUITPY_USB.

Always define it as 0 or 1, same as all other settings.

USB_AVAILABLE was conditionally defined in supervisor.mk,
but never actually used to #ifdef USB-related code.

Loosely related to #4546
2021-04-23 11:13:34 -04:00
Jeff Epler 34c4cc1bd9 samd: Rename dma_{allocate,free} channel
These are now used in the (video) parallel capture device as well.
2021-04-23 09:46:33 -05:00
Jeff Epler f838ff9528 raspberrypi: Remove debug prints 2021-04-23 09:44:01 -05:00
stijn bb2007b05c windows/mpconfigport.h: Enable features also present in unix port. 2021-04-23 23:15:10 +10:00
Damien George df4e9bdf5c esp32/CMakeLists.txt: Require CMake version 3.12.
Because "find_package(Python3 ...)" requires at least this version of
CMake.  And other features like GREATER_EQUAL and COMMAND_EXPAND_LISTS need
at least CMake 3.7 and 3.8 respectively.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-23 23:03:03 +10:00
Dan Halbert 346740e152
Merge pull request #4609 from Neradoc/add_nrf_countio
NRF: implement countio
2021-04-23 08:37:00 -04:00
anecdata 3d60ed1322 loc & common_hal start_ap(), + AP MAC getter 2021-04-22 22:55:32 -05:00
anecdata 7e95dc1261 ap additions to radio object 2021-04-22 22:23:33 -05:00
anecdata bfc5eb1660 event_handler, init, and reset 2021-04-22 22:21:50 -05:00
David Michieli 5669a60954 stm32/mboot: Allow unpacking dfu without secret key.
- unpack-dfu command no longer requies a secret key to be present
- pack-dfu command raises an exception if no secret key is found
2021-04-23 11:04:37 +10:00
Dan Halbert 8f73270f2b
Merge pull request #4646 from tannewt/merge_mp1.10
Merge in MicroPython v1.10
2021-04-22 13:16:27 -04:00
Jeff Epler 10fee3e673 raspberrypi: Increase PIO clock speed in ParallelImageCapture
.. this allows DIV_4 and DIV_2 resolutions to work without being
jumbled.
2021-04-22 12:14:44 -05:00
Jeff Epler 2def016fd0 raspberrypi: Use 32-bit elements in FIFO
.. these do come in the right
2021-04-22 12:14:03 -05:00
Jeff Epler 7fb751808f raspberrypi: Implement ParallelImageCapture using PIO
.. based on code from Phil B.
2021-04-22 12:02:51 -05:00
Dan Halbert f1b5249d3c Fix esp32s2 uart.write() return value 2021-04-22 09:47:54 -04:00
Dan Halbert 64e0958916 wip: descriptor building 2021-04-21 23:25:36 -04:00
Scott Shawcroft 09f7b43c64
Merge MicroPython 1.10 into CircuitPython 2021-04-21 15:59:17 -07:00
Dan Halbert b3ffb3ab1f Return bytes written from RP2040 UART.write() 2021-04-21 18:38:35 -04:00
Lucian Copeland 8ce89860e6 Pass pre-commit formatting 2021-04-21 17:34:13 -04:00
Damien George 00d6a79b3d stm32/machine_timer: Improve usability of Timer constructor and init.
Improvements are:
- Default period is 1000ms with callback disabled.
- if period is not specified then it's not updated (previously, if period
  was not specified then it was set to -1 and running the timer callback as
  fast as possible, making the REPL unresponsive).
- Use uint64_t to compute delta_ms, and raise a ValueError if the period is
  too large.
- If callback is not specified then it's not updated.
- Specifying None for the callback will disable the timer.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-21 14:22:09 +10:00
root 0e2431048d Fix PWMOut on SAMD21 2021-04-20 15:21:05 -05:00
Jeff Epler 46c9b1bc37 atmel-sam: Use DMA for ParallelImageCapture
This allows ctrl-c to interrupt the capture, and ensures we handle
interrupts & background tasks.
2021-04-20 13:52:44 -05:00
Jeff Epler d50feebd2c atmel-sam: Factor out find_sync_event_channel_raise 2021-04-20 13:33:11 -05:00
Jeff Epler 4dcbdac97e Complete the 'horizontal_reference' rename 2021-04-20 11:33:32 -05:00
Dan Halbert 01979acd48
Merge pull request #4604 from tannewt/buffer_size
Assume max characteristic size when the client
2021-04-20 12:02:06 -04:00
Jeff Epler 5c5736ee1e atmel-sam: Allow PWM to go up to cpu_frequency/2
24MHz is the nominal external clock to use with OV7670.  (My testing
was actually at 16MHz)
2021-04-20 10:22:21 -05:00
Jeff Epler 99799cded6 imagecapture: implement to review suggestions 2021-04-20 10:21:32 -05:00
Damien George 6e0f9b9262 stm32/boards/pllvalues.py: Support wider range of PLL values for F413.
Signed-off-by: Damien George <damien@micropython.org>
2021-04-20 23:33:33 +10:00
Scott Shawcroft b057fb8a4b
codeformat 2021-04-19 22:22:44 -07:00
Limor "Ladyada" Fried 83c768b25d
Merge pull request #4627 from aramcon-badge/aramcon2-badge
Add board definition files for ARAMCON2 Badge
2021-04-19 15:17:47 -04:00
Limor "Ladyada" Fried 17e419f129
Merge pull request #4633 from ZodiusInfuser/main
Tweaked Pimoroni board names
2021-04-19 15:16:37 -04:00
Benny Meisels f0b04d403d Add board definition files for ARAMCON2 Badge 2021-04-19 20:41:01 +03:00
Eddie Espinal 0e8b99dc65 Removes the USB_DEVICES entry as it's causing the build to fail. 2021-04-19 10:24:44 -04:00
Eddie Espinal fce6226ca5 Add board definition for the ATMegaZero ESP32-S2 2021-04-19 08:47:29 -04:00
ZodiusInfuser efdbc6be08 Tweaked board name 2021-04-19 10:38:07 +01:00
Limor "Ladyada" Fried b6fa90d0b5
Merge pull request #4625 from stonehippo/sparkfun_micromod_atp_rp2040
Added Sparkfun MicroMod RP2040
2021-04-18 21:14:47 -04:00
Limor "Ladyada" Fried be21589722
Merge pull request #4631 from adafruit/anecdata-patch-1
Update mpconfigboard.h DEFAULT_I2C_BUS_SDA & _SCL pins to match pins.c and schematic
2021-04-18 10:18:19 -04:00
anecdata 2198b1a4df
Update mpconfigboard.h 2021-04-17 20:15:04 -05:00
George White 5bd2e97865
Fix pin definitions
I missed a few pin definitions. Fixed those.
2021-04-17 18:43:49 -04:00
George White 493127f4bc pre-commit trailing space fixes 2021-04-17 17:43:13 -04:00
George White e0bb7385a1
Added Sparkfun MicroMod RP2040
Added board definition for the Sparkfun MicroMod RP2040.

Mostly followed the format for pins from the MicroMod nRF52840 board
definition, as MicroMod tries to standardize pins across
microcontrollers.
2021-04-17 10:56:04 -04:00
Dan Halbert b2160bdddd
Add VBUS_SENSE (GP24) to board
Prompted by https://forums.adafruit.com/viewtopic.php?f=60&t=178237.
Also add some whitespace to make pin aliases stand out, and add GP23 as an alias for `SMPS_MODE`.
2021-04-17 08:51:20 -04:00
Jeff Epler fc4538f845 WIP: Implement 'ParallelImageCapture' for samd51 2021-04-16 17:18:59 -05:00
ZodiusInfuser efa9cfa5ec Tweaked board name 2021-04-16 18:02:10 +01:00
Tim Radvan f842a40df4 rp2/rp2_pio: Add fifo_join support for PIO.
The PIO state machines on the RP2040 have 4 word deep TX and RX FIFOs.  If
you only need one direction, you can "merge" them into either a single 8
word deep TX or RX FIFO.

We simply add constants to the PIO object, and set the appropriate bits in
`shiftctrl`.

Resolves #6854.

Signed-off-by: Tim Radvan <tim@tjvr.org>
2021-04-17 00:45:38 +10:00
Scott Shawcroft 43c16c89c4
Account for max_packet_size in outgoing length 2021-04-15 16:34:06 -07:00
Dan Halbert f55d684057
Merge pull request #4612 from ZodiusInfuser/main
Added definitions for Pimoroni RP2040-based boards
2021-04-15 19:20:24 -04:00
Lucian Copeland e0024c70de Merge remote-tracking branch 'upstream/main' into stm-alarm 2021-04-15 16:32:30 -04:00
Lucian Copeland 7eeea869ac Fix light sleep global alarms, API revisions 2021-04-15 15:02:42 -04:00
ZodiusInfuser 1c700a82c9 Removed trailing whitespaces 2021-04-15 12:01:47 +01:00
ZodiusInfuser f69bf8beb9 Removed whitespaces 2021-04-15 11:57:27 +01:00
ZodiusInfuser d67ccb625c Added correct USB PIDs 2021-04-15 11:41:46 +01:00
Damien George e5d2ddde25 esp32/machine_pin: Use rtc_gpio_deinit instead of gpio_reset_pin.
Commit 8a917ad252 added the gpio_reset_pin()
call to make sure that pins that were used as ADC inputs could subsequently
be used as digital IO.  But calling gpio_reset_pin() will enable the
pull-up on the pin and so pull it high for a brief period.  Instead use
rtc_gpio_deinit() which will just reconfigure the pin as a digital IO and
do nothing else.

Fixes issue #7079 (see also #5771).

Signed-off-by: Damien George <damien@micropython.org>
2021-04-15 13:06:05 +10:00
Damien George d97b8daf1a esp32/boards: Add GENERIC_S2 board definition.
Signed-off-by: Damien George <damien@micropython.org>
2021-04-15 10:31:06 +10:00
Damien George c81d048bb3 esp32: Add support for USB with CDC ACM.
The REPL will be available on the USB serial port.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-15 10:31:06 +10:00
Damien George 66a86a0615 esp32: Add initial support for ESP32S2 SoCs.
Builds against IDF v4.3-beta2.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-15 10:31:06 +10:00
Scott Shawcroft aa28d4f315
Allow setting max_packet_size for PacketBuffer
This is handy for remote characteristics because it allows for
the PacketBuffer binding code to have the correct max size. This
PR also adds checks so we don't write outside the outgoing buffer.
2021-04-14 17:09:48 -07:00
Neradoc 223027fe9e
shrink simmel 2021-04-15 01:43:02 +02:00
ZodiusInfuser e4456bd756 Added definitions for PicoLipo boards 2021-04-14 23:09:10 +01:00
Scott Shawcroft 3978b50b8d
Merge pull request #4489 from gamblor21/audiomixer_rp2040
Add non M4 audiomixer support
2021-04-14 12:19:17 -07:00
Damien George 7f366a2190 esp32/modsocket: Correctly handle poll/read of unconnected TCP socket.
For an unconnected TCP socket, poll should return WR|HUP and read should
raise ENOTCONN.  This is implemented by this commit and now the following
tests pass on esp32: extmod/usocket_tcp_basic.py,
net_hosted/connect_poll.py.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-14 15:35:31 +10:00
Damien George d0e014aa41 mimxrt: Enable CPYTHON_COMPAT, PY_ASYNC_AWAIT, PY_ATTRTUPLE options.
This change allows running the tests in tests/basics/ without any failures
(but some tests are still skipped).

Signed-off-by: Damien George <damien@micropython.org>
2021-04-14 12:55:53 +10:00
8bitgeek fc6ea28d00 stm32/sdram: Make MICROPY_HW_FMC_BA1,MICROPY_HW_FMC_A11 optional pins.
This supports SDRAM having only 2 internal banks (using BA0 only), and only
11 (A0-A10) bits of address, such as IS42S16100H (512K x 16bit x 2bank).
2021-04-14 11:06:32 +10:00
Marian Buschsieweke 9c9bfe1968 unix/main: Make static variable that's potentially clobbered by longjmp.
This fixes `error: variable 'subpkg_tried' might be clobbered by 'longjmp'
or 'vfork' [-Werror=clobbered]` when compiling on ppc64le and aarch64 (and
possibly other architectures/toolchains).
2021-04-14 10:45:26 +10:00
Neradoc 0d743224f2 add countio to nrf port 2021-04-14 01:37:19 +02:00
Scott Shawcroft b273f59c4e
Assume max characteristic size when the client 2021-04-13 15:37:47 -07:00
Scott Shawcroft b1f4a9a9fd
Merge pull request #4447 from tyomitch/patch-3
[synthio] add a simple MidiTrack implementation
2021-04-13 15:09:23 -07:00
Kattni 9a3f04a1b8
Merge pull request #4599 from dhalbert/neopixel-trinkey-storage
Turn storage back on for NeoPixel Trinkey
2021-04-13 12:42:46 -04:00
Limor "Ladyada" Fried 1163af5d48
Merge pull request #4591 from jepler/same51-modules
same51: enable specific modules based on chip family
2021-04-13 11:47:08 -04:00
Dan Halbert cc36402a64 turn storage back on 2021-04-13 11:06:59 -04:00
Damien George 2ac09c2694 stm32/uart: Use LL_USART_GetBaudRate to compute baudrate.
This function includes the UART prescaler in the calculation (if it has
one, eg on H7 and WB MCUs).

Signed-off-by: Damien George <damien@micropython.org>
2021-04-13 23:59:01 +10:00
Damien George 25c029ce9f stm32/boards: Split UARTx_RTS_DE into UARTx_RTS/UARTx_DE in pin defs.
So these alternate functions can be parsed by the build scripts and used in
application code.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-13 23:58:20 +10:00
Artyom Skrobov 92d7f31046 [synthio] disable in stm32f411ce_blackpill_with_flash
region `FLASH_FIRMWARE' overflowed by 228 bytes
2021-04-13 03:01:55 -04:00
Artyom Skrobov c6ee471b52 Merge branch 'main' of https://github.com/adafruit/circuitpython into patch-3 2021-04-13 00:32:19 -04:00
lady ada d136078768 try re-enabling storage 2021-04-12 22:17:20 -04:00
jun2sak 6e9429d779 soft reboot for pretending deep sleep. 2021-04-12 20:53:14 +09:00
Damien George 2668337f36 stm32/rfcore: Intercept addr-resolution HCI cmd to work around BLE bug.
The STM32WB has a problem when address resolution is enabled: under certain
conditions the MCU can get into a state where it draws an additional 10mA
or so and eventually ends up with a broken BLE RX path in the silicon.  A
simple way to reproduce this is to enable address resolution (which is the
default for NimBLE) and start the device advertising.  If there is enough
BLE activity in the vicinity then the device will at some point enter the
bad state and, if left long enough, will have permanent BLE RX damage.

STMicroelectronics are aware of this issue.  The only known workaround at
this stage is to not enable address resolution, which is implemented by
this commit.

Work done in collaboration with Jim Mussared aka @jimmo.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-12 21:51:11 +10:00
Damien George dd62c52a36 stm32/rfcore: Fix race condition with C2 accessing free buffer list.
Prior to this commit, if C2 was busy (eg lots of BLE activity) then it may
not have had time to respond to the notification on the IPCC_CH_MM channel
by the time additional memory was available to put on that buffer.  In such
a case C1 would modify the free buffer list while C2 was potentially
accessing it, and this would eventually lead to lost memory buffers (or a
corrupt linked list).  If all buffers become lost then ACL packets
(asynchronous events) can no longer be delivered from C2 to C1.

This commit fixes this issue by waiting for C2 to indicate that it has
finished using the free buffer list.

Work done in collaboration with Jim Mussared aka @jimmo.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-12 21:43:04 +10:00
jahr 7ca686684e rp2: Add support for building different board configurations.
This change allows to build firmware for different rp2-based boards,
following how it is done in other ports like stm32 and esp32.  So far only
the original Pico and Adafruit Feather RP2040 are added.  Board names
should match (sans case) those in pico-sdk/src/boards/include/boards/.

Usage: Pico firmware can be build either using make as previously (it is
the default board) or by `make BOARD=PICO`.  Feather is built by `make
BOARD=ADAFRUIT_FEATHER_RP2040`.  Only the board name and flash drive size
is set, pin definition is taken from the appropriate pico-sdk board
definition.  Firmware is saved in the directory build-BOARD_NAME.
2021-04-12 21:40:32 +10:00
robert-hh 1be74b94b6 rp2/machine_uart: Add buffered transfer of data with rxbuf/txbuf kwargs.
Instantiation and init now support the rxbuf and txbuf keywords for setting
the buffer size.  The default size is 256 bytes.  The minimum and maximum
sizes are 32 and 32766 respectively.

uart.write() still includes checks for timeout, even if it is very unlikely
to happen due to a) lack of flow control support and b) the minimal timeout
values being longer than the time it needs to send a byte.
2021-04-12 21:31:08 +10:00
lady ada 8053d4a7a3 remove neopixels 2021-04-11 22:33:03 -04:00
Jeff Epler 4f36504aeb same51: enable specific modules based on chip family
closes #4590
2021-04-11 20:07:59 -05:00
lady ada 42abb982fe rename proxsense to proxlight 2021-04-11 18:39:14 -04:00
lady ada 9dc6d691b8 add prox trinkey and rename others to adafruit_ 2021-04-11 17:45:37 -04:00
robert-hh 22554cf8e2 rp2/rp2_pio: Add StateMachine restart,rx_fifo,tx_fifo helper functions.
StateMachine.restart: Restarts the state machine
StateMachine.rx_fifo: Return the number of RX FIFO items, 0 if empty
StateMachine.tx_fifo: Return the number of TX FIFO items, 0 if empty

restart() seems to be the most useful one, as it resets the state machine
to the initial state without the need to re-initialise/re-create.  It also
makes PIO code easier, because then stalling as an error state can be
unlocked.

rx_fifo() is also useful, for MP code to check for data and timeout if no
data arrived.  Complex logic is easier handled in Python code than in PIO
code.

tx_fifo() can be useful to check states where data is not processed, and is
mostly for symmetry.
2021-04-11 22:41:54 +10:00
lady ada 56be8306cd try adding a submodule? 2021-04-10 23:22:13 -04:00
lady ada 137745e911 neokey trinkey friend 2021-04-10 23:04:48 -04:00
Lucian Copeland 15764b4c24 Merge remote-tracking branch 'upstream/main' into nrf52-sleep 2021-04-09 13:48:45 -04:00
Scott Shawcroft ebfe36c9aa
Merge pull request #4576 from felixerdy/main
Add senseBox MCU
2021-04-09 10:27:37 -07:00
Dan Halbert 11b9a5e605
Merge pull request #4577 from dglaude/patch-1
Respect product name: space between QT and Py
2021-04-09 13:10:19 -04:00
Dan Halbert 1b60c9d033
Merge pull request #4580 from jepler/incrementalencoder-refactor
IncrementalEncoder: factor out the quadrature state machine
2021-04-09 13:10:02 -04:00
Dan Halbert 61e33a5619 fix nrf ISR; make direction consistent across ports; save code size 2021-04-09 11:07:47 -04:00
robert-hh 6f06dcaee5 rp2/moduos: Implement uos.urandom().
The implementation samples rosc.randombits at a frequency lower than the
oscillator frequency.  This gives better random values.  In addition, for
an 8-bit value 8 samples are taken and fed through a 8-bit CRC,
distributing the sampling over the byte.  The resulting sampling rate is
about 120k/sec.

The RNG does not include testing of error conditions, like the ROSC being
in sync with the sampling or completely failing.  Making the interim value
static causes it to perform a little bit better in short sync or drop-out
situations.

The output of uos.urandom() performs well with the NIST800-22 test suite.
In my trial it passed all tests of the sts 2.1.2 test suite.  I also ran a
test of the random data with the Common Criteria test suite AIS 31, and it
passed all tests too.
2021-04-09 18:24:38 +10:00
Damien George 2c9af1c1d7 rp2/rp2_pio: Validate state machine frequency in constructor.
Fixes issue #7025.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-09 18:06:10 +10:00
felixerdy ca6dda4d2b reorder alias 2021-04-09 08:35:13 +02:00
aziubin 7546d3cf73 stm32/boards/NUCLEO_L476RG: Add 5 remaining UARTs.
STM32L476RG MCU of NUCLEO_L476RG board has 6 UART/USART units in total
(USART1, USART2, USART3, UART4, UART5 and LPUART1), but only UART2,
connected to REPL, was defined and available in Python code.
Defined are all 5 remaining UART/USART units including LPUART1.

Signed-off-by: Alexander Ziubin aziubin@googlemail.com
2021-04-09 15:00:55 +10:00
Kevin Lutzer 4fb3139273 switch orders the flash memory is listed 2021-04-08 21:56:25 -06:00
Kevin Lutzer c672b33770 add W25Q64JVxQ as a supported flash for stm32f411 black pill 2021-04-08 21:53:38 -06:00
Damien George ab9d47e023 esp32: Enable btree module.
This was disabled with the move to CMake, and this commit reinstates it.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-09 13:33:26 +10:00
Damien George 212fe7f33e extmod/extmod.cmake: Add support to build btree module with CMake.
Signed-off-by: Damien George <damien@micropython.org>
2021-04-09 13:33:26 +10:00
Damien George 5dcc9b3b16 py/py.cmake: Introduce MICROPY_INC_CORE as a list with core includes.
Signed-off-by: Damien George <damien@micropython.org>
2021-04-09 13:08:35 +10:00
Damien George 0fabda31de py/py.cmake: Move qstr helper code to micropy_gather_target_properties.
Signed-off-by: Damien George <damien@micropython.org>
2021-04-09 13:08:35 +10:00
Damien George 7b41d7f187 stm32/boardctrl: Give boards control over execution of boot.py,main.py.
This commit simplifies the customisation of the main MicroPython execution
loop (4 macros are reduced to 2), and allows a board to have full control
over the execution (or not) of boot.py and main.py.

For boards that use the default start-up code, there is no functional
change in this commit.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-09 12:44:19 +10:00
Dan Halbert fdc5bb41f4
D3 pin should be GPIO26 2021-04-08 19:11:27 -04:00
Dan Halbert 72055ff02b
Merge pull request #4578 from tannewt/packetbuffer_lengths
Improve PacketBuffer lengths and remove packet_size
2021-04-08 18:55:24 -04:00
Jeff Epler d69ca4a8ae nrf: switch to shared softencoder implementation 2021-04-08 16:36:10 -05:00
Jeff Epler 3aec1032f7 atmel-samd: switch to shared softencoder implementation 2021-04-08 16:32:36 -05:00
Jeff Epler 3ce0b512f8 rasberrypi: IncrementalEncoder: factor out state machine 2021-04-08 16:25:47 -05:00
Scott Shawcroft e3b3f97fa6
Improve PacketBuffer packet lengths for remote service 2021-04-08 13:25:11 -07:00
David Glaude 5d6bef569d
Respect product name: space between QT and Py
https://www.adafruit.com/product/4900 say "Adafruit QT Py RP2040"

This is also matching other "QT Py" product.
2021-04-08 21:50:16 +02:00
felixerdy e5cffa94e8 add aliases for TX and RX 2021-04-08 21:19:27 +02:00
Damien George 4d9e657f0e stm32/mpconfigport.h: Add support for a board to specify root pointers.
A board can now define MICROPY_BOARD_ROOT_POINTERS to specify any custom
root pointers.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-08 17:00:26 +10:00
Scott Shawcroft 0539b88a6b
Merge pull request #4561 from bd34n/bdmicro_vina_d51_update
boards/bdmicro_vina_d51: A few updates for flexibility and expansion.
2021-04-07 10:33:58 -07:00
Brian Dean 8544249fc0 boards/bdmicro_vina_d51: Replace old rev with new rev and rename.
This update to the PR retains the earlier board rev (with a rename) so
that backward binary compatibility is not lost for the earlier board
revision. The primary name 'vina-d51' is retained for the latest
revision to make it easy for customers to select the proper UF2
download - because the name matches the commercial name.

Details:

Replace bdmicro_vina_d51 with bdmicro_vina_d51_pcb7 (revision 7 of
PCB) with boardfiles unmodified. Add _pcb7 to the workflow build.

Replace bdmicro_vina_d51 boardfile content with latest PCB updates
(revision 10 ov PCB). Add minimal comments in the board files to make
it clear which PCB revision is implemented. Update the USB PID to
reflect an updated board revision.
2021-04-07 09:11:30 -04:00
Damien George cb396827f5 stm32/boards/pllvalues.py: Relax PLLQ constraints on STM32F413 MCUs.
Signed-off-by: Damien George <damien@micropython.org>
2021-04-07 12:47:21 +10:00
Damien George f4340b7e62 stm32/powerctrl: Support using PLLI2C on STM32F413 as USB clock source.
So SYSCLK can run at more varied frequencies, eg 100MHz.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-07 12:47:21 +10:00
Damien George 00963a4e69 stm32/powerctrl: Allow a board to configure AHB and APB clock dividers.
Signed-off-by: Damien George <damien@micropython.org>
2021-04-07 12:47:09 +10:00
stijn a66286f3a0 unix: Improve command line argument processing.
Per CPython everything which comes after the command, module or file
argument is not an option for the interpreter itself.  Hence the processing
of options should stop when encountering those, and the remainder be passed
as sys.argv.  Note the latter was already the case for a module or file but
not for a command.

This fixes issues like 'micropython myfile.py -h' showing the help and
exiting instead of passing '-h' as sys.argv[1], likewise for
'-X <something>' being treated as a special option no matter where it
occurs on the command line.
2021-04-07 12:41:25 +10:00
Limor "Ladyada" Fried e6aaf9924f
Merge pull request #4570 from jepler/mimxrt-busdevice
mimxrt10xx: enable adafruit_bus_device in core
2021-04-06 20:15:23 -04:00
Tim Radvan 4f53f462ca rp2: Import uarray instead of array in rp2 module.
Some forum users noticed that `sm.exec()` took longer the more was present
on the flash filesystem connected to the RP2040.  They traced this back to
the `array` import inside `asm_pio()`, which is causing MicroPython to scan
the filesystem.

uarray is a built-in module, so importing it shouldn't require scanning the
filesystem.

We avoid moving the import to the top-level in order to keep the namespace
clean; we don't want to accidentally expose `rp2.array`.
2021-04-07 10:06:18 +10:00
Dan Halbert 82479b6a2c
Merge pull request #4503 from hierophect/sleep-api-update
Sleep API changes and fix for main.c silent issue
2021-04-06 16:53:25 -04:00
Scott Shawcroft 6097afdaa5
Merge pull request #4559 from jepler/rp2-rotary-encoder-fixes
raspberrypi: Several rotary encoder fixes
2021-04-06 10:00:26 -07:00
Jeff Epler 1a2ce27b73 raspberrypi: Drop support for auto-reversing swapped encoder 2021-04-06 09:22:59 -05:00
Jeff Epler 1a163dd70d mimxrt10xx: enable adafruit_bus_device in core 2021-04-06 09:19:41 -05:00
Damien George 25ae169e6e stm32: Include .ARM section in firmware for C++ exception handling.
Support for C++ was added in 97960dc7de but
that commit didn't include the C++ exception handling table in the binary
firmware image.  This commit fixes that.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-06 12:11:15 +10:00
Damien George 2d8aecd2ad rp2/CMakeLists.txt: Enable USB enumeration fix.
This is a workaround for errata RP2040-E5, and is needed to make USB more
reliable on certain USB ports.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-06 11:40:02 +10:00
Scott Shawcroft 71eabe814c
Update StateMachine.c 2021-04-05 16:17:08 -07:00
Lucian Copeland bf58afdb2a
Merge pull request #4399 from tyomitch/patch-2
[stm] implementation of audiopwmio
2021-04-05 18:35:39 -04:00
Brian Dean 3e558a89ac boards/bdmicro_vina_d51: A few updates for flexibility and expansion.
ESP-01 header renamed to AUX, and expanded to 12 pins from 8
pins. Pins 1-8 still accommodate the ESP-01, with expansion to full
SERCOM 4-pad support to allow for SPI and I2C on that expansion port
with additional GPIO control.

Update pins.c with additional signals provided AUX_1-8, along with
UART, SPI, I2C name usage as aliases to appropriate AUX_1-8
signals. Additionally, add several alternate names specific to several
expansion modules - the ESP-01, and the ATW-01 using the WINC_1500
(SPI) w/interrupt and control needed for the WINC - with assignments
to module pin positions.

Re-work SERCOM assignments to accommodate the above from other parts
of the board, which required moving a SERCOM or two around in order to
accommodate the 4-pad sercom pin mapping on the AUX port.

Built and tested using latest from 'main':

Adafruit CircuitPython 6.2.0-rc.0-70-ga1562430f-dirty on 2021-04-05;
BDMICRO VINA-D51 with samd51n20
2021-04-05 10:44:52 -04:00
Jeff Epler fc86475de5 IncrementalEncoder: support swapped pins
Closes: #4422
2021-04-04 13:49:50 -05:00
Jeff Epler 93d6ceedd9 IncrementalEncoder: Disconnect interrupt handler during deinit.
Closes: #4557
2021-04-04 13:49:41 -05:00
Jeff Epler bcd90dd927 IncrementalEncoder: There are no out pins.
Closes #4556
2021-04-04 13:49:21 -05:00
Dan Halbert ae80378c4e
Merge pull request #4545 from ElectronicCats/huntercat_nfc
HunterCat NFC
2021-04-04 14:21:49 -04:00
sabas1080 8b6ffba392 Update comment 2021-04-04 11:10:32 -05:00
Jeff Epler 27d8832868
Merge pull request #4512 from m-byte/main
Add Artisense RD00 board files
2021-04-03 18:40:59 -05:00
Artyom Skrobov 4ee781227f [meowbit] change board.BUZZ type to PWMAudioOut,
as advised in #4257
2021-04-03 13:35:19 -04:00
Matthias Breithaupt 43ba81ffa1 Add Artisense RD00 board files 2021-04-03 17:20:59 +02:00
Lucian Copeland 8a2143f161 Clean up comments and debugging pins 2021-04-02 17:40:40 -04:00
Lucian Copeland 9240146b22 Make light sleep store true alarm object to global map 2021-04-02 16:58:42 -04:00
sabas1080 53f3282e9c change flash device 2021-04-02 14:42:38 -06:00
sabas1080 f8da94b8ba removed o¡modules not availables 2021-04-02 14:40:27 -06:00
sabas1080 c1987b7311 init port hunter cat nfc! 2021-04-02 13:19:59 -06:00
Lucian Copeland 66a1583183 Implement fake and true deep sleep alarm differentiation 2021-04-02 15:13:10 -04:00
Jonny Bergdahl 1afd204828 Changed error message to display the generic term 'system firmware' instead of the Nordic specific term 'soft device' 2021-04-02 20:34:37 +02:00
Lucian Copeland 17585e1e07 Clean up API 2021-04-02 14:08:48 -04:00
Lucian Copeland 91e530d36c Resolve wake alarm crash 2021-04-02 13:42:22 -04:00
Jeff Epler 3451c25a75
Merge pull request #4530 from jepler/mimxrt1011-pwmio
mimxrt1011: pwmio: Enable basic PWMOut functionality
2021-04-02 09:29:41 -05:00
Dan Halbert da16e4dce1
Merge pull request #4534 from UnexpectedCircuitPython/main
Changed some pins for TinyS2
2021-04-01 21:05:46 -04:00
Lucian Copeland 4f52554eb3 Fix to RTC reset 2021-04-01 20:53:25 -04:00
Scott Shawcroft 58835e5a5b
Two small PacketBuffer fixes
1. Allow for ctrl-c during a write.
2. Handle disconnects when acting as a client.
2021-04-01 14:16:35 -07:00
Seon Rozenblum a9b4e04643 Changed some pins for TinyS2 2021-04-02 08:08:02 +11:00
Jeff Epler 3f3cb79b7d Add pinmux info for 1021 and 1062 family MCUs 2021-04-01 15:59:57 -05:00
Jeff Epler 89fc0298ce mimxrt1011: pwmout: Add prescaler, fix duty_cycle=65535 2021-04-01 13:04:06 -05:00
Jeff Epler 489163b74e mimxrt1011: pwmio: Enable basic PWMOut functionality
After this change, the following program works for me on the MIMXRT1010-EVK:
```python
import pwmio
import board

p = pwmio.PWMOut(board.D13, frequency=1_000_000, variable_frequency=True)
p.duty_cycle = 32868

while True:
    pass
```

Querying and varying the duty_cycle and frequency work as well.

The lowest frequency obtainable is about 2kHz; there is an additional
divider which would allow lower PWM frequencies (I think 1kHz is important
for servos?)

Something odd happens with very low duty cycles, such as
```python
>>> p.frequency = 2000
>>> p.duty_cycle = 2
```
instead of a symmetrical waveform, it's asymmetrical.  With `duty_cycle=4`,
the effect disappears.  The reason for this is probably hidden in the
datasheet, but could affect servos or other things that count pulse
widths.
2021-04-01 10:06:59 -05:00
Tsutomu IKEGAMI be50732515 Fix SD_DET pin assignment of seeduino_wio_terminal. 2021-04-01 17:09:56 +09:00
Damien George d87f42b0e5 examples/usercmodules: Simplify user C module enabling.
It's a bit of a pitfall with user C modules that including them in the
build does not automatically enable them.  This commit changes the docs and
examples for user C modules to encourage writers of user C modules to
enable them unconditionally.  This makes things simpler and covers most use
cases.

See discussion in issue #6960, and also #7086.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-01 16:27:38 +11:00
Michael O'Cleirigh ec79e44502 esp32: Fix multiple definition errors with mp_hal_stdout_tx functions.
It was noticed that the esp32 port didn't build ulab correctly.  The
problem was a multiple defintion of the 'mp_hal_stdout_tx_str' and
'mp_hal_stdout_tx_strn_cooked' functions.

They were defined in stdout_helpers.c but also in the
ports/esp32/mphalport.c.

Fixed by removing stdout_helpers.c from the build.

Signed-off-by: Michael O'Cleirigh <michael.ocleirigh@rivulet.ca>
2021-04-01 15:44:25 +11:00
Michael O'Cleirigh 0ccd9e08aa esp32: Restore USER_C_MODULE support with new CMake build system.
Support for User C and C++ modules was lost due to upgrading the esp32 to
the latest CMake based IDF from the GNUMakefile build process.

Restore the support for the esp32 port by integrating with the approach
recently added for the rp2 port.

Signed-off-by: Michael O'Cleirigh <michael.ocleirigh@rivulet.ca>
2021-04-01 15:43:15 +11:00
Dan Halbert d0ba75e6dc
Merge pull request #4522 from tannewt/ble_fixup
Fix central pairing and crash on clear
2021-03-31 21:24:19 -04:00
Scott Shawcroft 0752bbd5fd
Fix central pairing and crash on clear
The list_clear would crash if we tried to clear a NULL list. (It
can happen if we haven't tried to discover any services.)
2021-03-31 16:04:04 -07:00
Dan Halbert 0e915dc3fb
Merge pull request #4518 from jepler/fix-bogus-assertion
mimxrt10xx: Fix bogus assertion.
2021-03-31 15:53:42 -04:00
Jeff Epler cce8b2be07 raspberypi: Allow mpconfigboard to override additional items
This allows more options to be overridden to 0 in an mpconfigboard.mk.

Improved:
 * FRAMEBUFFERIO, FULL_BUILD, BITOPS, PWMIO, RGBMATRIX, OTARYIO, PULSEIO, WATCHDOG

Still problematic (pull requests welcome):
 * RP2PIO & NEOPIXEL_WRITE, possibly only if a status neopixel is defined
 * BITBANGIO, possibly only if BUSIO is enabled
 * RTC

Incidentally, with RP2PIO & NEOPIXEL_WRITE, BITBANGIO, and RTC re-enabled I get
```
323956 bytes used, 720524 bytes free in flash firmware space out of 1044480 bytes (1020.0kB).
12072 bytes used, 250072 bytes free in ram for stack and heap out of 262144 bytes (256.0kB).
```

Closes #4515
2021-03-31 09:40:48 -05:00
Jeff Epler cb29ad0846 mimxrt10xx: Fix bogus assertion.
.. as noted by @d-c-d
2021-03-31 09:21:08 -05:00
Liam Fraser ca3d51f122 rp2: Don't advertise remote wakeup for USB serial.
This USB feature is currently not supported.  With this flag enabled (and
the feature not implemented) the USB serial will stop working if there is a
delay of more than about 2 seconds between messages, which can occur with
USB autosuspend enabled.

Fixes issue #6866.
2021-03-31 13:50:21 +11:00
Jeff Epler 71eee45a37 mimxrt1011: UART: Add additional error checking
.. and make the 'invalid pin' messages standard.

Closes #4502
2021-03-30 10:17:48 -05:00
Phil Howard 0cf12dd59c rp2: Add support for USER_C_MODULES to CMake build system.
The parts that are generic are added to py/ so they can be used by other
ports that use CMake.

py/usermod.cmake:

* Creates a usermod target to hang user C/CXX modules from.
* Gathers sources from user C/CXX modules and libs for QSTR scan.

ports/rp2/CMakeLists.txt:

* Includes py/usermod.cmake.
* Links the resulting usermod library to the MicroPython target.

py/mkrules.cmake:

Add cxxflags to qstr.i.last custom command for CXX modules:

* MICROPY_CPP_FLAGS so CXX modules will find includes.
* -DNO_QSTR to fix fatal error missing "genhdr/qstrdefs.generated.h".

Usage:

The rp2 port can be linked against user C modules by running:

make USER_C_MODULES=/path/to/module/micropython.cmake

CMake will print a list of included modules.

Co-authored-by: Graham Sanderson <graham.sanderson@raspberrypi.org>
Co-authored-by: Michael O'Cleirigh <michael.ocleirigh@rivulet.ca>
Signed-off-by: Phil Howard <phil@pimoroni.com>
2021-03-31 00:26:01 +11:00
Phil Howard ccc388f157 rp2/mpthreadport.h: Cast core_state to _mp_state_thread_t.
Required for user C++ code to build successfully against ports/rp2.

Signed-off-by: Phil Howard <phil@pimoroni.com>
2021-03-31 00:25:51 +11:00
Scott Shawcroft 580456719c
Merge pull request #4508 from dhalbert/rp2040-calc-sda-hold-time
Calculate RP2040 SDA hold time
2021-03-29 15:09:30 -07:00
Dan Halbert 840373f5c2
Merge pull request #4495 from tyomitch/patch-1
[ure] to save space, disable debug dumps by default
2021-03-29 16:08:56 -04:00
Dan Halbert 8e0834d74c Calculate RP2040 SDA hold time 2021-03-29 14:40:13 -04:00
Lucian Copeland 33418ce826 Merge remote-tracking branch 'upstream/main' into stm-alarm 2021-03-29 13:39:14 -04:00
Lucian Copeland d35a307ffa Merge branch 'sleep-api-update' into stm-alarm 2021-03-29 12:27:25 -04:00
Lucian Copeland 00178ca5e0 Sleep API changes, redundancy fix 2021-03-27 14:14:57 -04:00
Jeff Epler 010232574e
Merge pull request #4468 from jepler/metro-m7-dup-pins
remove duplicate RX/TX pin lines
2021-03-27 12:49:33 -05:00
Lucian Copeland 529fb52309 Style changes and wakeup detection 2021-03-27 13:16:12 -04:00
Limor "Ladyada" Fried 9ac8ea587a
Merge pull request #4499 from dhalbert/rp2040-lengthen-sda-tx-hold-time
Length RP2040 I2C SDA hold time
2021-03-26 20:21:52 -04:00
Dan Halbert 03340a3fcd Incorporate https://github.com/adafruit/pico-sdk/pull/2 2021-03-26 18:55:45 -04:00
Artyom Skrobov 8056af8648 [synthio] add a simple MidiTrack implementation 2021-03-26 16:38:10 -04:00
Artyom Skrobov d7dc3801ab [ure] to save space, disable debug dumps by default
Has to stay enabled in unix port for the sake of tests/extmod/ure_debug.py
2021-03-26 13:24:20 -04:00
Artyom Skrobov b40d072648 [stm] implementation of audiopwmio
Based on nrf PWMAudioOut by @jepler and stm PulseOut by @hierophect

Tested on a Meowbit
2021-03-26 13:18:01 -04:00
Jeff Epler 2bc61b4580 Parenthesize double-division for clarity 2021-03-26 11:01:22 -05:00
Jeff Epler 231cb1ffd9 mimxrt10xx: Use the proper "betweenTransferDelay" (et al) values
Set the betweenTransferDelay to the SCK low-time, to avoid long pauses
between bytes (transfers) while preventing the last SCK cycle in a byte
from being a runt pulse.

Compared to an earlier revision of this change, which just set the delays
all to zero, this doesn't break using an AirLift, which was sensitive
to the runt pulses (the simple loopback-wire test didn't detect the problem)
2021-03-26 10:54:13 -05:00
Jeff Epler 1d48054aea mimxrt10xx: Factor out "transfer_common"
.. and set the "MasterPcsContinuous" flag, which removes some of the
gap between bytes of a single SPI transaction
2021-03-26 10:04:35 -05:00
Jeff Epler ffb70a8737 Freeze ESP32SPI into mimxrt1011_evk
.. so that it is more conveniently like the metro m7 for my testing
2021-03-26 10:01:53 -05:00
Jeff Epler 9e110f120a mimxrt10xx: busio: cap SPI baudrate at 30MHz per datasheet 2021-03-26 10:01:53 -05:00
Dan Halbert 155b61f027
Merge pull request #4378 from Gadgetoid/patch-remove-rp2040-i2c-bitbang
RP2040: Remove short-write bitbang from I2C
2021-03-25 21:01:02 -04:00
gamblor21 0b212e2243 Add non M4 audiomixer support 2021-03-25 17:30:40 -05:00
Scott Shawcroft da4dceea15
Fix 16MB Winbond names 2021-03-25 11:37:08 -07:00
Scott Shawcroft aec0ef3cbf
Switch devices.h to nvm.toml data 2021-03-25 09:57:18 -07:00
Scott Shawcroft e9ceb9263e
Merge pull request #4474 from jepler/fix-spi-frequency
mimxrt: SPI: Set the TCR value returned by MasterBaudSetRate
2021-03-25 08:59:21 -07:00
Scott Shawcroft f79d60b205
Use GCC @file to shorten linker command length
This hopefully fixes linking on Windows with cmd.exe
2021-03-24 15:03:33 -07:00
Jeff Epler b440883fe5 mimxrt: SPI: Set the TCR value returned by MasterBaudSetRate
without this, the baud rate could be wrong; in my testing, it was
low by a factor of 2 when requesating baudrate=1_000_000 (1MHz).

When passing the baudrate in to LPSPI_MasterInit, the setting is made
automatically, but LPSPI_MAster_SetBaudRate just returns it via the
out-parameter tcrPrescaleValue.
2021-03-24 13:33:21 -05:00
Jeff Epler 5314fddca0 remove duplicate RX/TX pin lines 2021-03-23 16:04:23 -05:00
Dan Halbert c81007afb0
Merge pull request #4446 from tannewt/rp2040_flash
Switch RP2040 flash settings to nvm.toml
2021-03-23 15:18:29 -04:00
felixerdy cde659651b add brown out detect level 2021-03-23 19:17:45 +01:00
Lucian Copeland 278d53c512
Merge pull request #4465 from anecdata/udp_server
swap recvfrom_into() port byte-order
2021-03-23 13:48:39 -04:00
Scott Shawcroft 36edc4bb89
Improve Winbond naming and correct board settings 2021-03-23 09:06:48 -07:00
anecdata c106b432c5 swap recvfrom_into() port byte-order 2021-03-22 20:03:26 -05:00
Scott Shawcroft 7867632a81
Merge remote-tracking branch 'adafruit/main' into rp2040_flash 2021-03-22 15:29:43 -07:00
Scott Shawcroft f200e6a21e
Fix doc build and address feedback 2021-03-22 15:24:27 -07:00
lady ada 36ae69ab6f qtpy is more of a button than a switch! add itsybitsy rev C files 2021-03-21 18:44:32 -04:00
lady ada ebd6011633 add USBBOOT switch, move RX pin, re-enable UART (tested) 2021-03-21 14:58:18 -04:00
Lucian Copeland d8a2d69e10 Working deep sleep via RTC reset, with debug pins 2021-03-21 13:15:44 -04:00
Limor "Ladyada" Fried 4b42932188
Merge pull request #4449 from ladyada/main
adventure together with rotary trinkey
2021-03-20 13:37:31 -04:00
lady ada 8884682cac adventure together with rotary trinkey 2021-03-20 12:03:51 -04:00
Scott Shawcroft 4aea7f8f52
Add requirements-dev.txt for python deps 2021-03-19 15:22:23 -07:00
Jeff Epler 22906ac95e
Merge pull request #4442 from jepler/m7-reboot-bootloader
mimxrt1011: Fix reset-to-bootloader
2021-03-19 15:37:06 -05:00
Jeff Epler 3fcb6b278f
Merge pull request #4443 from jepler/evk-pins-dnp
imxrt1010_evk: Delete pins that are not connected
2021-03-19 15:36:36 -05:00
Limor "Ladyada" Fried c0ec904c7a
Merge pull request #4441 from jepler/metro_m7_4mb
metro m7: another place to fix flash capacity
2021-03-19 12:42:35 -04:00
Jeff Epler ee59c75f62 imxrt1010_evk: Delete pins that are not connected
There are DNP resistors on the MIMXRT1010-EVK board (see SCH-45852)
that lead to these pins on the arduino-style header not being connected
through. In theory someone could populate them, but as it the presence
of these names in the pins module caused problems when they didn't work
as expected.

Closes #3012
2021-03-19 11:29:32 -05:00
Jeff Epler 06743d91ed mimxrt1011: Fix reset-to-bootloader
The definition of DBL_TAP_REG must match tinyuf2
2021-03-19 10:11:45 -05:00
Dan Halbert d7a2ae9df7 fix stm compiler error 2021-03-19 11:04:46 -04:00
Jeff Epler 01a1cdf13a update flash chip comment 2021-03-19 09:50:26 -05:00
Dan Halbert 1512ca520b Fix PWMOut non-error handling and never reset 2021-03-19 09:57:21 -04:00
Jeff Epler 6abea8a4aa another place to fix flash capacity 2021-03-19 08:41:28 -05:00
Dan Halbert 8293e1eedc fix display rotation and position 2021-03-19 00:09:48 -04:00
Dan Halbert 47437cb415 make translate; fix display pins 2021-03-18 23:42:24 -04:00
Dan Halbert ea82ca1d02 correct PID 2021-03-18 23:24:20 -04:00
Damien George 4fc2866f45 bare-arm: Clean up the code, make it run on an F405, and add a README.
This commit simplifies and cleans up the bare-arm port, and adds just
enough system and library code to make it execute on an STM32F405 MCU.

The mpconfigport.h configuration is simplified to just specify those
configuration values that are different from the defaults.  And the
addition of -fdata-sections and -ffunction-sections means the final
firmware is smaller than it previously was, by about 4200 bytes.

A README is also added.

Signed-off-by: Damien George <damien@micropython.org>
2021-03-19 14:20:26 +11:00
Dan Halbert 21c55f8e75 update funhouse pins for latest rev b 2021-03-18 23:14:59 -04:00
Dan Halbert b2d913412f merge from upstream 2021-03-18 23:14:43 -04:00
Scott Shawcroft 5d2b60cbf6
Redo RP2040 flash settings
This switches stage2 to C and uses Jinja to change the C code based
on flash settings from https://github.com/adafruit/nvm.toml. It
produces the fastest settings for the given set of external flashes.
Flash size is no longer hard coded so switching flashes with similar
capabilities but different sizes should *just work*.

This PR also places "ITCM" code in RAM to save the XIP cache for
code execution. Further optimization is possible. A blink code.py
still requires a number of flash fetches every blink.

Fixes #4041
2021-03-18 16:55:42 -07:00
Jeff Epler 2589515342
Merge pull request #4435 from jepler/metro-m7
Fixes for Metro M7
2021-03-18 17:56:12 -05:00
Jeff Epler 0b22a9397a mimxrt: Quiet some warnings down in the sdk
Closes #2487
2021-03-18 16:54:11 -05:00
Jeff Epler 0ba0fae495 mimxrt: Enable USB Midi
Closes #2473
2021-03-18 16:54:11 -05:00
Jeff Epler 74243fd71a metro_m7: Update board name, flash chip size 2021-03-18 16:54:11 -05:00
Scott Shawcroft 11e510a06a
Merge pull request #4419 from spe2/main
Add board definition for Sparkfun Pro Micro RP2040
2021-03-17 18:17:24 -07:00
Jeff Epler 719e8710f2
Merge pull request #4411 from mintakka/thingplus-rp2040
added board configuration for Sparkfun ThingPlus RP2040
2021-03-17 16:23:55 -05:00
Phil Howard b8d4f9655f RP2040: Only bitbang 0-byte writes
The I2C.c for RP2040 included a special case for writes <=2 bytes to match the MicroPython implementation,
however RP2040 does support 1 and 2 byte reads, with only 0 bytes being the exception.

Signed-off-by: Philip Howard <phil@pimoroni.com>
2021-03-17 16:25:54 +00:00
Jeff Epler bfc8c89536
Merge pull request #4403 from jepler/bitmap-read-2
bitmaptools: Add readinto, arrayblit
2021-03-17 07:57:31 -05:00
mintakka 337727ba0c renamed board folder to match board name in boards.yml 2021-03-16 21:10:10 -04:00
Jeff Epler 94fa8e8a60 disable bitmaptools on small board 2021-03-16 19:04:21 -05:00
Jeff Epler 75ba26ee7c
Merge pull request #4421 from kattni/led-pin
Adding LED for D13/L pin name.
2021-03-16 18:58:14 -05:00
Damien George 6e5aea08a9 stm32/Makefile: Allow QSTR_DEFS,QSTR_GLOBAL_DEPENDENCIES to be extended.
So a board can provide custom qstr definitions if needed.

Signed-off-by: Damien George <damien@micropython.org>
2021-03-17 10:25:16 +11:00
Mark 1be5ca7881
Merge pull request #4130 from gamblor21/rp_dp_parallel
Add RP2040 displayio.ParallelBus Support
2021-03-16 13:49:55 -05:00
spe2 dcd9a8ab91
Update ports/raspberrypi/boards/sparkfun_pro_micro_rp2040/mpconfigboard.mk
Co-authored-by: Scott Shawcroft <scott@tannewt.org>
2021-03-16 10:54:20 -07:00
spe2 5bc132a209
Update ports/raspberrypi/boards/sparkfun_pro_micro_rp2040/mpconfigboard.h
Co-authored-by: Scott Shawcroft <scott@tannewt.org>
2021-03-16 10:54:15 -07:00
mintakka b5333f2bdf
Update ports/raspberrypi/boards/sparkfun_thingplus_rp2040/mpconfigboard.h
Co-authored-by: Scott Shawcroft <scott@tannewt.org>
2021-03-16 13:47:33 -04:00
mintakka 3d15877639
Update ports/raspberrypi/boards/sparkfun_thingplus_rp2040/mpconfigboard.mk
Co-authored-by: Scott Shawcroft <scott@tannewt.org>
2021-03-16 13:47:21 -04:00
Jeff Epler 58679dc038 Merge remote-tracking branch 'origin/main' into bitmap-read-2 2021-03-16 12:21:50 -05:00
Kattni Rembor 2b910b7292 Adding LED for D13/L pin name. 2021-03-16 12:14:40 -04:00
Jeff Epler bc690d4070
Merge pull request #4415 from jepler/pre-commit-no-run-if-empty
pre-commit: code formatter fixes
2021-03-16 09:54:12 -05:00
gamblor21 0890b54cd9 More formatting 2021-03-16 08:29:04 -05:00
gamblor21 fb437d8280 Formatting fixes 2021-03-16 08:22:02 -05:00
gamblor21 3b01a65743 Fixed formatting 2021-03-16 08:14:49 -05:00
spe2 9de40f56f3
Add board config files 2021-03-15 22:08:19 -06:00
spe2 c9427780b3
Create pins.c 2021-03-15 22:07:24 -06:00
mintakka 49baa94446 added sparkfun_thingplus_rp2040 to .github/workflows/boards.yml and renamed board folder to include chip 2021-03-15 23:00:24 -04:00
stijn d53a6d58b0 stm32/Makefile: Fix C++ linker flags when toolchain has spaces in path.
The GNU Make dir command uses spaces as item separator so it does not
work for e.g building the STM32 port on Cygwin with a default Arm
installation in "c:/program files (x86)/GNU Arm Embedded Toolchain".
Fix by using POSIX dirname on a quoted path instead.
2021-03-16 12:54:16 +11:00
mintakka 288415f867
Update ports/raspberrypi/boards/sparkfun_thingplus/mpconfigboard.h
Co-authored-by: Scott Shawcroft <scott@tannewt.org>
2021-03-15 21:07:31 -04:00
mintakka 30a74b3d92
Update ports/raspberrypi/boards/sparkfun_thingplus/mpconfigboard.mk
Co-authored-by: Scott Shawcroft <scott@tannewt.org>
2021-03-15 21:07:24 -04:00
Mark e326d7ca80
Merge branch 'main' into rp_dp_parallel 2021-03-15 20:00:13 -05:00
Scott Shawcroft f7a988b9b3
Merge pull request #4405 from DavePutz/issue_4237
Issue 4237 - Changed initial setting in program_struct
2021-03-15 17:51:36 -07:00
Scott Shawcroft 9cb8ce67ed
Merge pull request #4412 from kamtom480/spi_and_i2c
spresense: minor changes for i2c, spi and uart
2021-03-15 17:35:06 -07:00
Jeff Epler d3bf1fe15d modifications by pre-commit 2021-03-15 18:11:00 -05:00
Kamil Tomaszewski ed3f636be5 spresense: empty rx uart fifo after initialization 2021-03-15 16:14:16 +01:00
Kamil Tomaszewski 22ed0abf6c spresens: configure pin mode for i2c and spi 2021-03-15 16:14:16 +01:00
mintakka 0567d06936 added board configuration for Sparkfun ThingPlus RP2040 2021-03-15 10:27:21 -04:00
microDev a52eb88031
run code formatting script 2021-03-15 19:27:36 +05:30
felixerdy 6c32a1f67f update pins of senseBox MCU 2021-03-15 10:27:50 +01:00
Jeff Epler b33d77bfe8 disable bitmaptools on over-full board 2021-03-14 20:08:09 -05:00
root 9a83501982 Fixed initial settings for program_struct to allow more than 1 program per pio 2021-03-14 15:05:56 -05:00
Damien George a9140ab09b rp2: Use core-provided cmake fragments instead of custom ones.
Signed-off-by: Damien George <damien@micropython.org>
2021-03-14 15:53:18 +11:00
Damien George eccd73a403 extmod/extmod.cmake: Add modonewire.c to MICROPY_SOURCE_EXTMOD list.
Signed-off-by: Damien George <damien@micropython.org>
2021-03-14 15:51:28 +11:00
Dan Halbert 8e425a9354
Merge pull request #4393 from tannewt/raise_default_flash_speed
Speed up a bit more
2021-03-13 12:50:29 -05:00
Damien George dcaf702578 rp2/modmachine: Enable machine.Signal class.
Fixes issue #6863.

Signed-off-by: Damien George <damien@micropython.org>
2021-03-14 00:19:04 +11:00
Damien George 8010b15968 rp2: Enabled more core Python features.
This brings the port's configuration closer to the stm32 and esp32 ports.

Signed-off-by: Damien George <damien@micropython.org>
2021-03-14 00:17:22 +11:00
Kevin Köck af45d511f1 rp2: Enable uerrno module.
Fixes #6991.
2021-03-13 23:34:50 +11:00
Scott Shawcroft 1b106de4e0
Merge pull request #4262 from DavePutz/issue_4111
Issue 4111 - Implement pulseio(pulsein) for RP2040
2021-03-12 16:48:57 -08:00
Scott Shawcroft 45487f14a0
Speed up a bit more 2021-03-12 16:00:16 -08:00
DavePutz 96ce43e6d6
Added the correct files 2021-03-12 16:18:33 -06:00
DavePutz 6628f49852
Use StateMachine.c interrupt setup and simplify SM program 2021-03-12 16:06:57 -06:00
Jeff Epler a5c6759325
Merge pull request #4392 from tannewt/lower_default_flash_speed
Lower default flash speed.
2021-03-12 13:58:44 -06:00
Scott Shawcroft aec03a409f
Lower default flash speed.
/ 6 leads to ~40mhz. 2M and 4M have a max 0x03 read speed of 60mhz.
If the divisor is / 4 then the speed is just over 60mhz.

Fixes #4377
2021-03-12 11:06:39 -08:00
felixerdy 2009aecac3 Merge branch 'main' of github.com:felixerdy/circuitpython 2021-03-12 17:59:44 +01:00
felixerdy de93df6444 add senseBox MCU 2021-03-12 17:57:55 +01:00
Dan Halbert 0ce5b2f594 put back pullup setting 2021-03-12 08:20:09 -05:00
Damien George 6129b8e401 tests: Rename run-tests to run-tests.py for consistency.
Signed-off-by: Damien George <damien@micropython.org>
2021-03-12 19:56:09 +11:00
gamblor21 307d2a99fe Fix after rebase 2021-03-11 20:06:50 -06:00
gamblor21 5689307798 Changed frequency to match PIO having 2 instructions 2021-03-11 19:32:44 -06:00
gamblor21 b02b1e9979 Set frequency default 60Mhz 2021-03-11 19:32:44 -06:00
gamblor21 1658fe04f9 Set the statemachine to never reset so REPL works 2021-03-11 19:32:44 -06:00
gamblor21 c384ebe5c0 Updated to initalize pindirs 2021-03-11 19:32:44 -06:00
gamblor21 7321411962 Added frequency to parallel display 2021-03-11 19:32:43 -06:00
gamblor21 56a219911f Add frequency support to parallel bus 2021-03-11 19:32:43 -06:00
gamblor21 b080d6207b Removing debug info and clean up 2021-03-11 19:32:43 -06:00
gamblor21 c6aaab6f64 Initial commit 2021-03-11 19:32:43 -06:00
Dan Halbert c71b6cb699 move to esp-idf PR merge 2021-03-11 20:05:31 -05:00
Damien George b24fcd7aec esp32/machine_hw_spi: Use default pins when making SPI if none given.
The default pins can be optionally configured by a board.

Fixes issue #6974.

Signed-off-by: Damien George <damien@micropython.org>
2021-03-12 10:56:25 +11:00
Lucian Copeland 6b2c9985ff Extract RTC, implement fake RTC deepsleep 2021-03-11 17:50:05 -05:00
Dan Halbert f75a009ed4 fix unnecessary statement order change 2021-03-11 15:16:32 -05:00
Dan Halbert b5d2cc6f46 Merge remote-tracking branch 'adafruit/main' into esp32s2-i2c-bug 2021-03-11 15:09:18 -05:00
Jeff Epler 24f4d981bd
Merge pull request #4380 from jepler/rp2040-audiomp3
raspberrypi: Enable mp3 playback
2021-03-11 12:53:46 -06:00
Scott Shawcroft 0e451a1681
Merge pull request #4383 from hierophect/stm32-uart-dereserve
STM32: Fix UART deinit
2021-03-11 10:48:01 -08:00
Scott Shawcroft 40886d198d
Merge pull request #4385 from hierophect/stm32-f407-can
STM32: add all F405 modules to F407
2021-03-11 10:45:08 -08:00
Dan Halbert de88fa37fb Merge remote-tracking branch 'adafruit/main' into esp32s2-i2c-bug 2021-03-11 12:27:29 -05:00
Dan Halbert 061d5910cb use fixed esp-idf 2021-03-11 12:09:01 -05:00
Kamil Tomaszewski 18668f6e28 spresense: fix spi to work with only one data pin 2021-03-11 18:06:49 +01:00
Kamil Tomaszewski 76d0870fba spresense: return error as positive value for i2c 2021-03-11 18:04:01 +01:00
Lucian Copeland 0b73c7a212 Update F407 to match F405 2021-03-11 11:27:17 -05:00
Lucian Copeland 1ebbd14d0f Fix UART deinit 2021-03-11 11:02:13 -05:00
Jeff Epler 15e97f12a1
Merge pull request #4379 from jepler/rp2040-rtc
raspberrypi: RTC: Ensure a time is set
2021-03-11 09:00:31 -06:00
Andrew Scheller b6489425c6 rp2/rp2_flash: Prevent MICROPY_HW_FLASH_STORAGE_BASE being set negative. 2021-03-12 00:57:29 +11:00
Dan Halbert 08c5dbb003 use return values in STM PWMOut constructor, not exceptions 2021-03-11 08:52:47 -05:00
robert-hh c675452566 rp2/modmachine: Re-init UART for REPL on frequency change.
When UART is used for REPL and the MCU frequency is changed, the UART
has to be re-initialised.  Besides that the UART may have to be recreated
after a frequency change, but with USB REPL this is not a problem.

Thanks to @HermannSW for spotting and providing the change.
2021-03-12 00:49:30 +11:00
robert-hh 11cf742524 rp2/modmachine: Allow changing CPU clock frequency.
Using the standard machine.freq().

The safe ranges tested were 10 and 12-270MHz, at which USB REPL still
worked.  Requested settings can be checked with the script:
pico-sdk/src/rp2_common/hardware_clocks/scripts/vcocalc.py.  At frequencies
like 300MHz the script still signaled OK, but USB did not work any more.
2021-03-12 00:48:46 +11:00
robert-hh 0461640983 rp2/rp2_pio: Fix sm.get(buf) to not wait after getting last item.
sm.get(buf) was waiting for one item more than the length of the supplied
buffer.  Even if this item was not stored, sm_get would block trying to get
an item from the RX fifo.

As part of the fix, the edge case for a zero length buffer was moved up to
the section where the function arguments are handled.  In case of a zero
length buffer, sm.get() now returns immediately that buffer.
2021-03-12 00:39:26 +11:00
robert-hh a075e0b7d8 rp2/rp2_pio: Allow more than 8 consecutive pins for PIO out/set/sideset.
The bitmasks supplied for initialization of out/set/sideset were only 8 bit
instead of 32.  This resulted in an error, that not more than 8 consecutive
pins would get initialized.

Fixes issue #6933.
2021-03-12 00:26:32 +11:00
robert-hh da85cb014a rp2/machine_uart: Add support for inverted TX and RX lines.
Usage as in the other ports:

    keyword "invert"
    constants: INV_TX and INV_RX

Sample: uart = UART(1, invert=UART.INV_TX | UART.INV_RX)
2021-03-11 18:27:53 +11:00
robert-hh 8ade163fff rp2/machine_uart: Add timeout/timeout_char to read and write. 2021-03-11 18:19:15 +11:00
StereoRocker 8610bababe rp2: Enable VfsFat class for FAT filesystem support.
Allows interfacing with SD cards, for example.
2021-03-11 17:56:21 +11:00
svetelna 23ce25a7c3 mimxrt/boards: Add MIMXRT1050_EVK board, based on MIMXRT1060_EVK. 2021-03-11 16:42:38 +11:00
Mike Causer 8785acac22 esp32/Makefile: Specify port and baud on erase_flash command. 2021-03-11 15:49:10 +11:00
Jeff Epler 16bfe3b41c raspberrypi: RTC: Ensure a time is set
Until a time is set, the RTC is not running, and rtc_get_datetime()
returns false without assigning to the out-parameter.

In CircuitPython, this would manifest as arbitrary values being returned,
since uninitialized storage on the stack was being converted into a timestamp.
2021-03-10 20:20:40 -06:00
Scott Shawcroft f0965b1ef7
Merge pull request #4350 from nitz/board-add-sparkfun-micromod-nrf52840
Add new nRF port for SF MicroMod nRF52840.
2021-03-10 18:13:11 -08:00
Jeff Epler c95def0b32 raspberrypi: Enable mp3 playback
The rp2040 is _very_ marginal for mp3 playback, and currently sometimes triggers a bug that gives garbled audio output.  However, it does work for some limited situations.
2021-03-10 18:44:10 -06:00
Damien George c33c749f64 stm32/boardctrl: Add MICROPY_BOARD_STARTUP hook.
Signed-off-by: Damien George <damien@micropython.org>
2021-03-11 09:04:36 +11:00
Reinhard Feger 79c186f5c9 stm32/spi: Fix baudrate calculation for H7 series.
Fixes issue #6342.
2021-03-11 01:06:52 +11:00
Peter Hinch 0facd891e7 stm32/powerctrl: Save and restore EWUP state when configuring standby.
This allows the user to enable wake-up sources using the EWUP bits, on F7
MCUs.

Disabling the wake-up sources while clearing the wake-up flags follows the
reference manual and ST examples.
2021-03-11 00:56:01 +11:00
Braiden Kindt 85ea4ac0e5 stm32/main: Fix passing state.reset_mode to init_flash_fs.
state.reset_mode is updated by `MICROPY_BOARD_BEFORE_SOFT_RESET_LOOP` but
not passed to `init_flash_fs`, and so factory reset is not executed on
boards that do not have a bootloader.  This bug was introduced by
4c3976bbca

Fixes #6903.
2021-03-10 23:50:40 +11:00
Herwin Grobben 35c602d3b8 stm32/make-stmconst.py: Allow "[]" chars when parsing source comments.
For STM32WB MCUs, EXTI offset addresses were not parsed due to the
appearance of "[31:0]" in a comment in the .h file.
2021-03-10 23:44:02 +11:00
hathach 58fb011070 clean up 2021-03-10 19:03:27 +07:00
hathach d1c6bb0927 rp2040 add double reset to uf2, also update pico-sdk to 1.1.0 2021-03-10 18:58:23 +07:00
DavePutz a3c3e8a0fa
fix trailing whitespace 2021-03-09 22:41:08 -06:00
nitz d5365cb066
SDIO/QSPI pin names. ¯\_(ツ)_/¯ 2021-03-09 18:36:29 -05:00
nitz 5beb529f61
Update pins, remove unused defs from board config. 2021-03-09 17:43:13 -05:00
nitz fe0655e121
Update pins, remove unused defs from board config. 2021-03-09 17:39:50 -05:00
DavePutz 0c58cc4772
Moved pin wait to an initial exec 2021-03-09 16:37:29 -06:00
nitz 1ae858126a
Fix the mpconfigboard.mk that was screwy? 2021-03-09 17:29:10 -05:00
Scott Shawcroft d650849581
Merge pull request #4348 from FBSeletronica/franzininhoWIFI_wrover
Franzininho wifi ESP32-S2 Wrover
2021-03-09 13:07:19 -08:00
Scott Shawcroft 2c3002b327
Merge pull request #4370 from jposada202020/i2cperipheral_ctrlc
I2CPeripheral samd51 corrections in the CTRLC bit
2021-03-09 12:58:59 -08:00
Chris Dailey a61db7f12e
Updated SparkFun MicroMod USB PID
As per the PID provide by TheHoff, [here](https://forum.sparkfun.com/viewtopic.php?p=223812#p223812)
2021-03-09 12:54:52 -05:00
DavePutz f0e3274a33
Update to agree with modified StateMachine.h 2021-03-09 11:13:09 -06:00
FBSeletronica c6eb3f98be Fixing build.yml 2021-03-09 13:55:20 -03:00
jposada202020 be90fa80e8 Initial Changes 2021-03-09 10:48:33 -05:00
DavePutz 6f4510d7aa
Merge branch 'main' into issue_4111 2021-03-08 23:28:21 -06:00
root 576da73a17 Added check for maxlen 2021-03-08 23:23:51 -06:00
root 95b7a59156 Merge branch 'issue_4111' of https://github.com/DavePutz/circuitpython into issue_4111 2021-03-08 23:22:05 -06:00
root 3db0fec267 Added check for maxlen 2021-03-08 23:20:57 -06:00
DavePutz 88650bc4d0
Removed leftover debug code 2021-03-08 22:48:57 -06:00
Andrew Leech 59a129f22f stm32/storage: Prevent attempts to read/write invalid block addresses.
A corrupt filesystem may lead to a request for a block which is out of
range of the block device limits.  Return an error instead of passing the
request down to the lower layer.
2021-03-09 15:32:50 +11:00
Dan Halbert 7029783985 funhouse board 2021-03-08 21:24:28 -05:00
Scott Shawcroft 775f1b9e0d
Merge pull request #4329 from jepler/rp2-rotaryio
raspberrypi: Implement rotaryio, improve StateMachine
2021-03-08 17:49:45 -08:00
Scott Shawcroft 4fc6c7d8c9
Merge pull request #4347 from FBSeletronica/franzininhoWIFI
Adding Circuitpython port for Franzininho WIFI board with the ESP32-S2 wroom module
2021-03-08 15:37:42 -08:00
jun2sak c8f36e604c reset myself, not go REPL, after wakeup from deep sleep. 2021-03-09 00:42:22 +09:00
FBSeletronica 27703f3156 fix quote error 2021-03-08 10:32:37 -03:00
FBSeletronica fe29780afb updating USB_VID and USB_PID for Espressif modules 2021-03-08 08:51:48 -03:00
FBSeletronica 2771e7fe75 Updating USB vendor ID and producfor Espressif modules 2021-03-08 08:47:33 -03:00
Jeff Epler cdb0fda72a Merge remote-tracking branch 'origin/main' into count-flash-devices 2021-03-07 20:26:04 -06:00
Dan Halbert 26eb429cc6 restore install/delete for i2c driver 2021-03-07 18:23:14 -05:00
Jeff Epler f1ada8e880 Automatically count EXTERNAL_FLASH_DEVICES 2021-03-07 11:48:39 -06:00
jerryneedell a23129bc49 add GD25Q16C flash to BlackPill 2021-03-07 17:23:39 +00:00
Jeff Epler a4133c4545
Merge pull request #4344 from jepler/vm-size-optimizations
Vm size optimizations: Get back 1500 bytes for 3.2% VM speed decrease
2021-03-07 10:09:51 -06:00
jun2sak 51c7a49853 Merge branch 'main' into nrf52-sleep 2021-03-07 20:50:53 +09:00
jun2sak 5bd1107fec Clean up. 2021-03-07 20:38:04 +09:00
jun2sak 2eed9a1735 old System OFF sleep code for future reference. 2021-03-07 20:21:33 +09:00
jun2sak 7430b92d27 address hw pin-reset while sleep. 2021-03-07 20:20:29 +09:00
jun2sak 2795c002ad disable QSPI while system ON idle loop. 2021-03-07 19:14:04 +09:00
jun2sak cd5c0e99f7 Clean up. 2021-03-07 19:09:01 +09:00
nitz 3b76299f39
Add new nRF port for SF MicroMod nRF52840. 2021-03-07 01:06:50 -05:00
FBSeletronica 17aa9ae3f6 Update vendor ID for Espressif ESP32S2 Modules 2021-03-06 18:43:34 -03:00
FBSeletronica 4a50f1dd6f Update Vendor ID for Espressif 2021-03-06 18:36:53 -03:00
FBSeletronica 48e727f7d6 adding port for Franzininho WIFI board ESP32S2 w/Wrover 2021-03-06 17:47:27 -03:00
FBSeletronica 6cf9c5158c adding port for Franzininho WIFI board 2021-03-06 17:15:54 -03:00
jun2sak 3fab9f8b1b new wait-until-alarm design, don't use System OFF. 2021-03-07 01:09:54 +09:00
Jeff Epler 4f040af481 vm: Make the speed-size trade-off compile time settable
.. and enable for all samd21 boards
2021-03-05 18:29:27 -06:00
Jeff Epler 67fb3054b4
Merge pull request #4342 from jamesbowman/main
Enable EVE low-level for Teensy 4.0 and 4.1
2021-03-05 17:25:00 -06:00
Jeff Epler d2056a46ee
Merge pull request #4335 from tyomitch/main
[nrf] No need to store `buffer_length` as part of `audiopwmio_pwmaudioout_obj_t`
2021-03-05 15:54:10 -06:00
Jeff Epler bed96a98d2
Merge pull request #4337 from tyomitch/patch-1
[stm] `curr_pulseout` can be `STATIC`
2021-03-05 15:53:31 -06:00
James Bowman bff585ffd2 Enable EVE low-level for Teensy 4.0 and 4.1 2021-03-05 11:32:58 -08:00
Jeff Epler cd1f19020f raspberrypi: move landmine Makefile comments 2021-03-05 12:59:55 -06:00
Jeff Epler 2ae1e7de61 WIPrp2040: Implement IncrementalEncoder
Any two consecutive pins can be used for an IncrementalEncoder

Testing performed: Put a synthesized (few hundred counts per second) quadrature signal into GP2/3 and read the encoder out.  Performed filesystem operations at the same time to stress test it.

The reasons for not using common_hal_rp2pio_statemachine_readinto are commented on.
2021-03-05 10:31:29 -06:00
Dan Halbert 4cf6579e22 remove general changes; not consistent across builds 2021-03-05 10:10:50 -05:00
Artyom Skrobov e0b96c0f43 [nrf] No need to store `buffer_length` as part of `audiopwmio_pwmaudioout_obj_t` 2021-03-05 06:01:58 -05:00
Artyom Skrobov 4720dc179a
[stm] `curr_pulseout` can be `STATIC`
Not used outside of PulseOut.c
2021-03-05 12:52:13 +02:00
Dan Halbert c97721455a Shrink the smallest builds with compile options 2021-03-04 23:07:06 -05:00
DavePutz a4dda3a5ba
Merge branch 'main' into issue_4111 2021-03-04 14:38:00 -06:00
DavePutz c5c297d2c0
Update PulseOut.c 2021-03-04 13:53:19 -06:00
DavePutz b7f03f9487
Update PulseOut.h 2021-03-04 13:52:40 -06:00
DavePutz 2d941b070f
Changed interrupt to per-word basis; cleaned up other small items 2021-03-04 13:51:46 -06:00
Jeff Epler bc14ed31f6 StateMachine.h: Add header for declaration of mcu_pin_obj_t typedef 2021-03-04 12:28:46 -06:00
Jeff Epler c023ec03ff PDMIn: Add missing deinit call 2021-03-04 12:28:06 -06:00
Jeff Epler bd01d31542 rp2pio: Add pins_are_sequential
This can be used where the standard API calls for a list of pins, to check that they satisfy the requirements of the rp2pio state machine, e.g.,
```python
    def __init__(self, pin_a, pin_b):
        if not rp2pio.pins_are_sequential([pin_a, pin_b]):
            raise ValueError("Pins must be sequential")
```
2021-03-04 11:26:33 -06:00
Jeff Epler ff62b0d2c0 StateMachine: Add pull up/down for inputs 2021-03-04 11:26:29 -06:00
Jeff Epler 68ac14b309 StateMachine: Add in_available property
I named the property `in_available` because it is similar to pyserial.
However, it indicates the number of words in the fifo, not the number
of bytes.
2021-03-04 11:14:09 -06:00
Dan Halbert 2ae8a44b2a
Merge pull request #4325 from microDev1/fix-wdt
ESP32S2: Fix watchdog deinit
2021-03-04 11:04:01 -05:00
hathach 6f99026a64 rp2040 use normal usb_irq_handler() 2021-03-04 21:29:04 +07:00
microDev 13453d35c6
fix watchdog deinit 2021-03-04 13:23:34 +05:30
Dan Halbert 71c43ca2dd
Merge pull request #4319 from jepler/feather-default-uart
feather rp2040: enable default board.UART
2021-03-03 16:46:00 -05:00
Jeff Epler b0fca4fcda feather rp2040: enable default board.UART 2021-03-03 13:13:06 -06:00
Dan Halbert cd48c5ee83
Merge pull request #4315 from dhalbert/rp2040-i2c-short-writes
RP2040: Implement short I2C writes (2 bytes or less) using bitbangio
2021-03-03 12:42:47 -05:00
DavePutz 88353f2f5b
Update mpconfigport.mk 2021-03-03 11:00:58 -06:00
DavePutz ced707ed32
Update call to rp2pio_statemachine_construct 2021-03-03 10:55:08 -06:00
Scott Shawcroft 514b73bcf8
Merge pull request #4254 from gamblor21/rp2040_countio
Rp2040 countio
2021-03-03 08:47:24 -08:00
Scott Shawcroft 1d8933dd05
Merge pull request #4265 from DavePutz/pio_soft_reset
Clear out PIOs and State Machines on RP2040 soft reset
2021-03-03 08:43:57 -08:00
Dan Halbert fb7a0f7efc add 1sec timeouts for I2C read and write 2021-03-03 09:43:57 -05:00
gamblor21 98075c5255 Fixed merge 2021-03-02 22:32:59 -06:00
Dan Halbert e3ab394cd6 works on nearly all sensors 2021-03-02 23:27:37 -05:00
Dan Halbert 4167778bbc
Merge pull request #4312 from jepler/feather-rp2040-led
feather rp2040: add board.LED
2021-03-02 23:19:14 -05:00
DavePutz 9b96bae668
Update mpconfigport.mk 2021-03-02 21:36:00 -06:00
DavePutz 30d491e136
Update mpconfigport.mk 2021-03-02 21:30:49 -06:00
DavePutz 58fb7b9b32
Update mpconfigport.mk to get builds working 2021-03-02 21:27:46 -06:00
DavePutz 6046d37f31
Update PulseIn.c 2021-03-02 21:23:45 -06:00
Mark 37ee18349f
Merge branch 'main' into rp2040_countio 2021-03-02 19:47:53 -06:00
gamblor21 4246cc3f6d Counter and PWMOut slice conflict check 2021-03-02 19:32:06 -06:00
Jeff Epler b27afad9cb move LED to the right spot in the file 2021-03-02 19:02:38 -06:00
Jeff Epler efc2667b5f
Merge pull request #4186 from jepler/update-protomatter-rp2
Enable protomatter on RP2040 builds
2021-03-02 19:01:37 -06:00
Dan Halbert 15615effc2
Merge pull request #4276 from bergdahl/patch-1
Update StateMachine.c
2021-03-02 17:11:45 -05:00
Dan Halbert 0a58d451ad
Merge pull request #4306 from Neradoc/fix-reset-to-safe
press reset to safe mode on ports where reset reason is not implemented
2021-03-02 15:44:52 -05:00
Dan Halbert f31b472309 Merge remote-tracking branch 'adafruit/main' into rp2040-i2c-short-writes 2021-03-02 15:17:12 -05:00
Dan Halbert 9939c59caa wip 2021-03-02 15:16:55 -05:00
Jeff Epler 8bfd308d37 feather rp2040: add board.LED 2021-03-02 13:16:09 -06:00
Scott Shawcroft e4f0e47d9f
Merge pull request #4233 from pewpew-game/displayio-group-list
displayio: make Group use a python list internally
2021-03-02 09:59:58 -08:00
Scott Shawcroft ce70b95990
Merge pull request #4177 from microDev1/nvm-rp
RP2040: Support for NVM
2021-03-02 09:57:36 -08:00
Dan Halbert 248acd07c8 shrink builds 2021-03-02 12:25:42 -05:00
Dan Halbert f41fb6fafc
Apply suggestions from code review
copyediting
2021-03-02 12:01:50 -05:00
Dan Halbert 9f6ebf3012
Merge pull request #4310 from kamtom480/spresense_analogin
spresense: return valid reference voltage
2021-03-02 11:55:42 -05:00
Scott Shawcroft 2651e15a52
Merge pull request #4309 from jepler/rp2040-interrupt-pio
rp2pio: allow keyboard interrupt while waiting for tx fifo to empty (& stall)
2021-03-02 08:55:27 -08:00
Scott Shawcroft 722a7150ca
Merge pull request #4308 from jepler/rp2040-build-boot2
raspberrypi: allow directly specifying the original boot .S file
2021-03-02 08:54:30 -08:00
Lucian Copeland f1792c8474 Extract EXTI, create base sleep framework 2021-03-02 11:41:53 -05:00
Jeff Epler f560b5f3a3 raspberry: switch pico back to the boot2 for W25Q16
Presumably, switching it to generic hurt performance a bit.

I verified that the build-raspberry_pi_pico/boot2_padded_checksummed.S
built file has the same checksum as the old
bs2_default_padded_checksummed.S
2021-03-02 08:08:41 -06:00
Kamil Tomaszewski 7c921b808b spresense: Define LONGINT_IMPL as MPZ 2021-03-02 14:25:22 +01:00
Kamil Tomaszewski f9d21637a3 spresense: return valid reference voltage 2021-03-02 14:25:22 +01:00
Radomir Dopieralski cb2cf81136 ugame10 - disable pulseio to make more room for the French 2021-03-02 11:11:55 +01:00
microDev b029031286
minor structural modification 2021-03-02 14:36:28 +05:30
Dan Halbert 54d11a8e2d
Merge pull request #4299 from jamesbowman/main
Add EVE support for Feather M4 Express
2021-03-01 22:56:50 -05:00
Jeff Epler 5a00862b1d raspberrypi: allow directly specifying the original boot .S file
.. all the necessary steps to transform it into a padded, checksummed
file are now done by the build system.

Since it is assigned by "?=", it _should_ be the case that individual
builds can override it.

I did not "test" this per se, but it gives the same content and checksum
(except for the identifying comment with a path) as #4302.
2021-03-01 21:08:19 -06:00
Jeff Epler 4b63a8c9b4 rp2pio: allow keyboard interrupt while waiting for tx fifo to empty (& stall) 2021-03-01 21:07:04 -06:00
Scott Shawcroft d0eab5c561
Merge pull request #4256 from kmatch98/bt_cleanup
Add `bitmaptools` module
2021-03-01 18:24:12 -08:00
Damien George 680ce45323 stm32/rfcore: Allow BLE settings to be changed by a board.
Two of the defaults have also changed in this commit:

- MICROPY_HW_RFCORE_BLE_LSE_SOURCE changed from 1 to 0, which configures
  the LsSource to be LSE (needed due to errata 2.2.1).

- MICROPY_HW_RFCORE_BLE_VITERBI_MODE changed from 0 to 1, which enables
  Viterbi mode, following all the ST examples.

Signed-off-by: Damien George <damien@micropython.org>
2021-03-02 12:14:54 +11:00
James Bowman 0dabd1ace2 Add EVE support for Feather M4 Express 2021-03-01 14:42:48 -08:00
Scott Shawcroft 1b3bca14cb
Merge pull request #4294 from kamtom480/spresense_analogin
spresense: return the correct value for Analog In
2021-03-01 13:21:15 -08:00
Scott Shawcroft 21a8752166
Merge pull request #4297 from adafruit/tannewt-patch-1
Update flash sizes for Adafruit RP2040 boards
2021-03-01 13:19:50 -08:00
Jeff Epler 238484ec26 Merge remote-tracking branch 'origin/main' into update-protomatter-rp2 2021-03-01 15:18:32 -06:00
Scott Shawcroft 532e7db293
Merge pull request #4267 from dhalbert/rp2040-digitalinout-fixes
RP2040: change DigitalInOut direction only when necessary; strong drive strength
2021-03-01 13:14:13 -08:00
Scott Shawcroft af9dfccab1
Update QT Py flash size 2021-03-01 10:34:25 -08:00
Scott Shawcroft dac047db61
Update Feather RP2040 to 8MB 2021-03-01 10:33:04 -08:00
Kamil Tomaszewski d68fdf3a3d spresense: return the correct value for Analog In 2021-03-01 15:45:10 +01:00
jun2sak 7cecd99658 remove unused debug printf's. 2021-02-28 16:04:29 +09:00
jun2sak 3e47e00291 address the pretending-to-deep-sleep issue. 2021-02-28 15:57:37 +09:00
jun2sak 498debc826 remove unused debug printf's. 2021-02-28 15:37:25 +09:00
jun2sak 9b34726c0d GPIO and GPIOTE reg dump for debug. 2021-02-28 15:36:14 +09:00
gamblor21 d7bc8a46a5 Added counters per slice 2021-02-27 15:17:27 -06:00
root 29c89a2487 Removed more includes 2021-02-26 22:35:38 -06:00
root f3515502b7 Removed unecessary includes 2021-02-26 22:33:50 -06:00
root 6374408c06 Changed reset_rp2pio_statemachine to clean up any PIO interrupts. 2021-02-26 22:28:50 -06:00
Jonny Bergdahl f7eac46c78
Update StateMachine.c
Changed woring to use max instead
2021-02-27 00:07:30 +01:00
Scott Shawcroft 776301c932
Typo fix: direcion -> direction 2021-02-26 15:03:56 -08:00
Scott Shawcroft 888a0c5f08
Merge pull request #4224 from microDev1/busio-uart-rp
RP2040: Support for UART
2021-02-26 14:57:23 -08:00
Dan Halbert d9234ffa82 need to gpio_set_dir() at some point 2021-02-26 15:27:35 -05:00
root 7942932176 Requested changes 2021-02-26 14:14:55 -06:00
Scott Shawcroft 7562b0cbb8
Turn off GC opt on catwan_usbstick 2021-02-26 12:00:01 -08:00
Scott Shawcroft 2e6e91dc5c
Merge pull request #4253 from tannewt/rp2040_fix_pwm_reuse
Fix second shared PWM
2021-02-26 11:53:54 -08:00
Scott Shawcroft 7c8d7d77dd
Merge remote-tracking branch 'adafruit/main' into busio-uart-rp 2021-02-26 09:04:42 -08:00
Limor "Ladyada" Fried caedc3bba6
Merge pull request #4270 from tannewt/rp2040_feather_pinout
Update RP2040 Feather pinout for production rev
2021-02-26 11:11:44 -05:00
Jeff Epler 1d1ff5f308 Merge remote-tracking branch 'origin/main' into update-protomatter-rp2 2021-02-26 09:56:35 -06:00
Scott Shawcroft 3f08cb47b8
Merge remote-tracking branch 'adafruit/main' into busio-uart-rp 2021-02-25 16:59:15 -08:00
Scott Shawcroft 52bc935fa7
A few minor fixes for corner cases
* Always clear the peripheral interrupt so we don't hang when full
* Store the ringbuf in the object so it gets collected when we're alive
* Make UART objects have a finaliser so they are deinit when their
  memory is freed
* Copy bytes into the ringbuf from the FIFO after we read to ensure
  the interrupt is enabled ASAP
* Copy bytes into the ringbuf from the FIFO before measuring our
  rx available because the interrupt is based on a threshold (not
  > 0). For example, a single byte won't trigger an interrupt.
2021-02-25 16:50:57 -08:00
Scott Shawcroft f0432b9d6f
Remove neopixel power 2021-02-25 16:37:34 -08:00
jun2sak 0f8c96f424 remove trailing whitespaces. 2021-02-26 09:11:35 +09:00
jun2sak 7fd4648cd5 rase error if Alarm time >= 512 sec. 2021-02-26 09:06:11 +09:00
Kevin Matocha ec4cd68edc More mpconfigboard.mk corrections for small builds 2021-02-25 17:48:50 -06:00
Dan Halbert d0f1cfb039 address review; use gpio_set() carefully 2021-02-25 18:41:22 -05:00
jun2sak 277a67d876 call touchalarm funcs as well as pin/timealarm. 2021-02-26 08:11:50 +09:00
Scott Shawcroft 2b163ccd6a
Fix incorrect deinit mask 2021-02-25 14:57:46 -08:00
Scott Shawcroft 1b00d94b23
Fix second shared PWM
Fixes #4210
2021-02-25 14:49:09 -08:00
Scott Shawcroft 80f7972f72
Update RP2040 Feather pinout for production rev 2021-02-25 14:46:08 -08:00
Jeff Epler 22276710e6 rp2pio: Fix writing where the stride was 2 or 4
The wrong stride value was being checked.
2021-02-25 15:50:49 -06:00
Kevin Matocha a7a4f93ff8 Updated build configs to turn off BITMAPTOOLS for smaller builds 2021-02-25 15:44:32 -06:00
Dan Halbert 94d7bfb1c9
Merge pull request #4264 from UnexpectedCircuitPython/main
Expanded pin names for TinyS2 + FeatherS2 pin additions for DAC1 & DAC2
2021-02-25 15:13:18 -05:00
Dan Halbert 199a8ce8b0 change DigitalInOut direction only when necessary; strong drive strength 2021-02-25 14:10:19 -05:00
root f8eb5bc275 Cleanup PIOs and State Machines on soft reset 2021-02-25 12:38:43 -06:00
microDev 8170e26a86
more uart improvements
- address suggested changes
- refine uart instance availibility checks
- improve pin validation and rx buffer handling
2021-02-25 23:46:00 +05:30
jun2sak 2aa5aec0d5 cleanup. 2021-02-26 01:45:12 +09:00
jun2sak c713d31d0d move externs to .h 2021-02-26 01:20:55 +09:00
Dan Halbert bbe0602738
Merge pull request #4245 from kamtom480/spresense_usb_speed
spresense: Pass the correct USB bus speed after restart
2021-02-25 11:02:33 -05:00
jun2sak c86ca2a4ff move externs to .h 2021-02-26 00:51:52 +09:00
jun2sak 9328d09a7a re-enable parameters check. 2021-02-26 00:50:44 +09:00
Kamil Tomaszewski fb32e0a7fd qtpy_m0_haxpress: Change config to make it fit. 2021-02-25 09:44:33 +01:00
Seon Rozenblum 69b10d7925 Added DAC1 & DAC2 pin names for FeatherS2
Expanded pin names for TinyS2 and added some new ones for functionality I forgot to add pin names for
Cleaned up mpconfigboard
2021-02-25 17:32:34 +11:00
root 86e60f5f35 Clean up formatting 2021-02-24 17:26:35 -06:00
jun2sak 61a69daae1 raise NotImplementedError when construct TouchAlarm. 2021-02-25 08:19:03 +09:00
root 17ff5dcc99 Return NotImplementedError for PulseOut 2021-02-24 17:04:05 -06:00
root 8e15f36baa pulseio (pulsein) for RP2040 2021-02-24 16:58:29 -06:00
microDev 5d7fdafcde
implement suggested changes
- add internal buffering
- rtc initialization fix
2021-02-25 00:48:36 +05:30
jun2sak f66896ce32 use nRF SDK function to set up memory retention. 2021-02-25 02:34:43 +09:00
Kamil Tomaszewski e369473794 spresense: change RX and TX buffer size for CDC 2021-02-24 18:19:18 +01:00
jun2sak 9661d67cd3 replace MY_DEBUG_UART -> NRF_DEBUG_PRINT. 2021-02-25 01:49:57 +09:00
jun2sak 72b5f1a9a6 clean up my personal settings. 2021-02-25 01:38:23 +09:00
Mark b935dcafdc
Merge branch 'main' into rp2040_countio 2021-02-23 19:46:41 -06:00
gamblor21 379f454ce6 Adding countio to rp2040 2021-02-23 19:38:05 -06:00
Scott Shawcroft abbbb91fa8
Add state machine divisor check
This causes an exception when setting a state machine too slow or
too fast.

Fixes #4222
2021-02-23 16:30:46 -08:00
Scott Shawcroft 360475e266
Implement audiobusio and enhance PIO for it
This adds I2SOut and PDMIn support via PIO.

StateMachines can now:
 * read and read while writing
 * transfer in 1, 2 or 4 byte increments
 * init pins based on expected defaults automatically
 * be stopped and restarted
 * rxfifo can be cleared and rxstalls detected (good for tracking when
   the reading code isn't keeping up)

Fixes #4162
2021-02-23 15:50:00 -08:00
Scott Shawcroft e41137c745
Merge pull request #4244 from UnexpectedCircuitPython/main
Added Unexpected Maker TinyS2 board definition
2021-02-23 10:40:06 -08:00
Scott Shawcroft 001d7299b2
Merge pull request #4228 from ZodiusInfuser/rp2040-boards
Added definitions for Pimoroni RP2040-based boards
2021-02-23 10:00:19 -08:00
jun2sak 0f188befb6 set RAM retention just before deep sleep 2021-02-24 00:12:25 +09:00
ZodiusInfuser 1a0bf4c33f
Added flash size for PicoSystem 2021-02-23 11:04:20 +00:00
ZodiusInfuser a9951c9b6c
Added flash size for Keybow2040 2021-02-23 11:01:40 +00:00
ZodiusInfuser ca9b7debe0
Added flash size for Tiny2040 2021-02-23 10:43:35 +00:00
Seon Rozenblum 78b2daa2a7 Added Unexpected Maker TinyS2 board definition 2021-02-23 17:55:17 +11:00
Dan Halbert a30d4ad25d set SUPEROPT_VM = 0 on most non-Express SAMD21 boards 2021-02-22 23:03:11 -05:00
jun2sak ec64fa6a29 move dump_xxx functions to debug_uart.c. 2021-02-23 12:16:37 +09:00
jun2sak 372c98626a move all the debug codes from port.c to debug_uart.c. 2021-02-23 11:56:40 +09:00
Scott Shawcroft 3fdf29e773
More parens 2021-02-22 18:35:09 -08:00
Scott Shawcroft 863981a5b8
Parens 2021-02-22 18:31:45 -08:00
jun2sak 9df0f439f3 alarm/pin/__init__.c is no longer used. 2021-02-23 10:31:49 +09:00
Scott Shawcroft 0aafeac209
Board specific flash sizes for RP2040
Stop-gap solution for #4041. Comment is there to provide info
needed in the future. (We currently run the generic "safe" settings.)
2021-02-22 17:19:18 -08:00
Damien George 53f5bb05a9 rp2,stm32: Enable MICROPY_PY_UBINASCII_CRC32 to get ubinascii.crc32().
These ports already have uzlib enabled so this additional ubinascii.crc32
function only costs about 90 bytes of flash.

Signed-off-by: Damien George <damien@micropython.org>
2021-02-23 10:13:25 +11:00
Dan Halbert 8470f0fdb7 SAMD21: one endpoint pair for MSC now instead of two 2021-02-21 12:37:59 -05:00
jun2sak 5c858a1925 add weak board_deinit(). 2021-02-21 16:27:21 +09:00
Damien George 75db0b9079 esp32: Define MICROPY_QSTRDEFS_PORT to include special qstrs.
Fixes issue #6942.

Signed-off-by: Damien George <damien@micropython.org>
2021-02-21 15:56:54 +11:00
Damien George 03a64f2077 stm32/boards/NUCLEO_WB55: Enable LPUART1 on PA2/PA3.
Signed-off-by: Damien George <damien@micropython.org>
2021-02-21 15:49:33 +11:00
Chris Mason 9d674cf7ab stm32/uart: Add support for LPUART1 on L0, L4, H7 and WB MCUs.
Add LPUART1 as a standard UART.  No low power features are supported, yet.
LPUART1 is enabled as the next available UART after the standard U(S)ARTs:

    STM32WB:      LPUART1 = UART(2)
    STM32L0:      LPUART1 = UART(6)
    STM32L4:      LPUART1 = UART(6)
    STM32H7:      LPUART1 = UART(9)

On all ports: LPUART1 = machine.UART('LP1')

LPUART1 is enabled by defining MICROPY_HW_LPUART1_TX and
MICROPY_HW_LPUART1_RX in mpconfigboard.h.

Signed-off-by: Chris Mason <c.mason@inchipdesign.com.au>
2021-02-21 15:49:32 +11:00
jun2sak 1da8b9900a Merge branch 'main' into nrf52-sleep 2021-02-21 13:35:06 +09:00
jun2sak 36c59250dd some cleanups. 2021-02-21 09:57:14 +09:00
jun2sak d659c2ce34 move port-specific debug functions from supervisor/shared/serial.c to ports/nrf/supervisor/port.c 2021-02-21 09:55:10 +09:00
jun2sak 793198909e set SleepMemory size to 256 bytes. 2021-02-21 08:19:39 +09:00
jun2sak 41d9d4e0ab call sd API only when sd enabled. 2021-02-21 08:17:57 +09:00
Dan Halbert cf3217e6d4
Merge pull request #4232 from TG-Techie/fix_tg_watch
fix TG-Watch ble issue
2021-02-20 18:10:52 -05:00
Jonah Yolles-Murphy a9a2145238 fix TG-Watch ble issue 2021-02-20 15:46:33 -05:00
ZodiusInfuser 52f2fd6d53
Removed trailing white space 2021-02-20 17:25:26 +00:00
ZodiusInfuser 417173b752
Removed trailing white space 2021-02-20 17:24:26 +00:00
ZodiusInfuser 9a4b8c5ed9
Removed trailing white space 2021-02-20 17:23:23 +00:00
ZodiusInfuser dea498a51f
Added new line 2021-02-20 17:20:28 +00:00
ZodiusInfuser 9fbeb0baea
Added new line 2021-02-20 17:20:06 +00:00
ZodiusInfuser 03577ec81c
Added new line 2021-02-20 17:19:45 +00:00
ZodiusInfuser dac81ea545
Added new line 2021-02-20 17:19:31 +00:00
ZodiusInfuser 0a00f91979
Added new line 2021-02-20 17:15:42 +00:00
ZodiusInfuser f1df07002f
Added new line 2021-02-20 17:15:20 +00:00
jun2sak 26f8f532f1 safe mode fix. 2021-02-21 00:47:07 +09:00
ZodiusInfuser 27bc5492f5
Added other files for PicoSystem 2021-02-20 13:37:08 +00:00
ZodiusInfuser e9c7af1dee
Added board.c for PicoSystem 2021-02-20 13:36:46 +00:00
ZodiusInfuser fb7cce6503
Added other files for Keybow2040 2021-02-20 13:35:27 +00:00
ZodiusInfuser 7ac20bfb8b
Added board.c for Keybow2040 2021-02-20 13:35:06 +00:00
ZodiusInfuser 66dd74cd12
Added other files for Tiny2040 2021-02-20 13:33:54 +00:00
ZodiusInfuser ad8916499d
Added board.c for Tiny2040 2021-02-20 13:32:54 +00:00
Dan Halbert 985e020936 shrink simmel build 2021-02-19 18:41:27 -05:00
Dan Halbert 67406488d1 merge from upstream; re-alphabetize 2021-02-19 14:22:50 -05:00
ZodiusInfuser ee5a48fece
Delete pimoroni_tiny2040 2021-02-19 18:30:29 +00:00
ZodiusInfuser db102ab1ad
Create pimoroni_tiny2040 2021-02-19 18:29:57 +00:00
microDev b12ccefbe6
uart implementation for rp2040 2021-02-19 18:36:00 +05:30
Thorsten von Eicken d28dbcd6c7 esp32: Make machine.soft_reset() work in main.py and reset_cause().
This commit fixes two issues on the esp32:
- it enables machine.soft_reset() to be called in main.py;
- it enables machine.reset_cause() to correctly identify a soft reset.

The former is useful in that it enables soft resets in applications that
are started at boot time.  The support is patterned after the stm32 port.
2021-02-19 15:15:11 +11:00
Thorsten von Eicken c10d431819 esp32: Add basic support for Non-Volatile-Storage in esp32 module.
This commit implements basic NVS support for the esp32.  It follows the
pattern of the esp32.Partition class and exposes an NVS object per NVS
namespace.  The initial support provided is only for signed 32-bit integers
and binary blobs.  It's easy (albeit a bit tedious) to add support for
more types.

See discussions in: #4436, #4707, #6780
2021-02-19 15:05:19 +11:00
Jeff Epler 1cd4e4552e
Merge pull request #4219 from jepler/bit_transpose
Add Bit transpose function to support piopixl8
2021-02-18 20:29:05 -06:00
Damien George 143372ab5e esp32: Add support to build with ESP-IDF v4.3 pre-release.
The esp32 port now builds against IDF v4.3-beta1, as well as v4.4-dev.

Signed-off-by: Damien George <damien@micropython.org>
2021-02-19 10:58:52 +11:00
Damien George 466ad35a72 esp32/boards: Enable size optimisation for builds.
This enables -Os for compilation, but still keeps full assertion messages.
With IDF v4.2, -Os changes the GENERIC firmware size from 1512176 down to
1384640, and the GENERIC_SPIRAM firmware is now 1452320 which fits in the
allocated partition.

Signed-off-by: Damien George <damien@micropython.org>
2021-02-19 10:42:16 +11:00
Jeff Epler 7fd4567893 bitops: rename from _bit_transpose, describe the algorithm 2021-02-18 15:41:23 -06:00
Lucian Copeland 0ecb24c3e5
Merge pull request #4169 from hierophect/stm32-i2cstart
STM32: Fix I2C repeated start by converting to IT mode
2021-02-18 15:19:00 -05:00
Dan Halbert e344c6d684 fix some builds 2021-02-18 14:24:58 -05:00
Dan Halbert 53a002a096 Initial fix, but bitbangio timing may be off 2021-02-18 13:14:51 -05:00
Jeff Epler 9cf7d73c6c core: add bit_transpose function
.. this version can only handle exactly 8 bits "across".  The restriction
may be relaxed in a future revision.
2021-02-18 11:32:47 -06:00
Dan Halbert 5c37b73c6d fix typo to fix nrf builds 2021-02-18 11:09:32 -05:00
microDev 696d212dc7
fix nvm rewrite 2021-02-18 18:42:00 +05:30
Damien George d4b45898f5 stm32/mboot: After sig verify, only write firmware-head if latter valid.
So that mboot can be used to program encrypted/signed firmware to regions
of flash that are not the main application, eg that are the filesystem.

Signed-off-by: Damien George <damien@micropython.org>
2021-02-18 13:59:03 +11:00
Jeff Epler ab5eb86118 raspberrypi: implement os.urandom
Since the datasheet cast some doubt on the strength of the "rosc_hw->randombit",
I use the SHA256 hash function to create a high quality random seed
from random values of uncertain entropy, as well as to generate a sequence
of random values from that seed using SHA256 as a cryptographically-secure
random number generator.

In practice, it produces over 100kB/s of random data which does not
have any gross problems according to _PractRand_.
2021-02-17 17:49:25 -06:00
jun2sak cf2427c561 light sleep reason fix. 2021-02-17 21:51:28 +09:00
jun2sak e6350ff834 Initial commit. 2021-02-17 20:53:18 +09:00
Damien George 301fe805ca stm32/mpbtstackport: Allow chipset and secondary baudrate to be set.
Signed-off-by: Damien George <damien@micropython.org>
2021-02-17 15:47:17 +11:00
Damien George 89cb2c6b80 stm32/mpbthciport: Use mp_printf instead of printf for error message.
Signed-off-by: Damien George <damien@micropython.org>
2021-02-17 15:47:17 +11:00
Andrew Leech 629fdc366a stm32/mpbthciport: Fix initial baudrate to use provided value.
Fixes bug introduced in the recent bffb71f523
2021-02-17 14:50:38 +11:00
Damien George 5c92ff53fe stm32/boards: Disable onewire module on boards with small flash.
Signed-off-by: Damien George <damien@micropython.org>
2021-02-17 14:42:46 +11:00
Damien George 9b78f3e6c6 stm32: Make pyb, uos, utime, machine and onewire modules configurable.
The default for these is to enable them, but they can now be disabled
individually by a board configuration.

Signed-off-by: Damien George <damien@micropython.org>
2021-02-17 14:42:46 +11:00
Damien George caeec80a9c stm32/usb: Allow a board to configure USBD_VID and all PIDs.
If a board defines USBD_VID then that will be used instead of the default.
And then the board must also define all USBD_PID_xxx values that it needs.

Signed-off-by: Damien George <damien@micropython.org>
2021-02-17 14:40:43 +11:00
Scott Shawcroft 261b077209
Merge pull request #4192 from dhalbert/pico-pwmout-top-fix-4189
RP2040: fix off-by-one PWM top issue
2021-02-16 17:38:09 -08:00
Thorsten von Eicken 2c1299b007 extmod/modussl: Fix ussl read/recv/send/write errors when non-blocking.
Also fix related problems with socket on esp32, improve docs for
wrap_socket, and add more tests.
2021-02-17 11:50:54 +11:00
David Michieli 2eed9780ba stm32/mboot: Add unpack-dfu command to mboot_pack_dfu.py tool.
This command unpacks a previously packed DFU file, writing out a DFU which
should be the same as the original (before packing).
2021-02-17 11:36:44 +11:00
PTH 5cb91afb9b zephyr/modusocket: Fix parameter in calls to net_context_get_XXX().
The following simple usocket example throws an error EINVAL on connect

    import usocket
    s = usocket.socket()
    s.connect(usocket.getaddrinfo('www.micropython.org', 80)[0][-1])

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    OSError: [Errno 22] EINVAL

Fixing the context parameter in calls of net_context_get_family() and
net_context_get_type(), the connect works fine.

Tested on a nucleo_h743zi board.
2021-02-17 10:42:43 +11:00
PTH 6c4a5d185d zephyr/boards: Add support for the nucleo_h743zi board. 2021-02-17 10:38:00 +11:00
Dan Halbert c26de0136a works! no timeouts 2021-02-16 17:39:36 -05:00
Maureen Helm f573e73bae zephyr: Build MicroPython as a cmake target.
Refactors the zephyr build infrastructure to build MicroPython as a
cmake target, using the recently introduced core cmake rules.

This change makes it possible to build the zephyr port like most other
zephyr applications using west or cmake directly. It simplifies building
with extra cmake arguments, such as specifying an alternate conf file or
adding an Arduino shield. It also enables building the zephyr port
anywhere in the host file system, which will allow regressing across
multiple boards with the zephyr twister script.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2021-02-16 18:49:30 +11:00
Maureen Helm 51fa1339f1 zephyr: Remove unused build files.
Removes zephyr port build files that aren't being used anymore.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2021-02-16 18:49:12 +11:00
Maureen Helm f49a73641a zephyr: Disable frozen source modules.
Disables frozen source modules in the zephyr port. They are deprecated
in the makefile rules and not implemented in the new cmake rules.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2021-02-16 18:38:13 +11:00
Maureen Helm 2aa57931a6 zephyr: Update to zephyr v2.5.0.
Updates the zephyr port build instructions and CI to use the latest
zephyr release tag.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2021-02-16 18:38:13 +11:00
Jim Mussared 4c54012373 unix/moduselect: Don't allow both posix and non-posix configurations.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-02-16 14:59:52 +11:00
Dan Halbert 0b8f1b9a90 wip: usb_cdc.serials 2021-02-15 20:06:18 -05:00
Dan Halbert 93d788543c Merge remote-tracking branch 'adafruit/main' into secondary-cdc 2021-02-15 20:03:53 -05:00
Lucian Copeland 6d5ffc677b is_free should not check never_reset 2021-02-15 10:29:05 -05:00
Thorsten von Eicken 902da05a18 esp32: Set MICROPY_USE_INTERNAL_ERRNO=0 to use toolchain's errno.h.
The underlying OS (the ESP-IDF) uses it's own internal errno codes and so
it's simpler and cleaner to use those rather than trying to convert
everything to the values defined in py/mperrno.h.
2021-02-15 23:47:02 +11:00
Thorsten von Eicken 771376a0cb esp32/modsocket: Remove unix socket error code translation.
The ESP-IDF has its own errno codes which should propagate out to the user.
2021-02-15 23:45:14 +11:00
Damien George f12462ddc4 esp32: Remove obsolete IDF v3 code wrapped in MICROPY_ESP_IDF_4.
Signed-off-by: Damien George <damien@micropython.org>
2021-02-15 23:22:05 +11:00
Damien George a915002177 esp32: Add support to build with ESP-IDF v4.2.
Signed-off-by: Damien George <damien@micropython.org>
2021-02-15 23:12:20 +11:00
Damien George d191d88cab esp32: Add support to build with ESP-IDF v4.1.1.
ESP-IDF v4.0.2 is still supported.

Signed-off-by: Damien George <damien@micropython.org>
2021-02-15 23:11:26 +11:00
Damien George e017f276f7 esp32/README: Update based on new IDF v4 cmake build process.
Signed-off-by: Damien George <damien@micropython.org>
2021-02-15 16:40:11 +11:00
Damien George da2b5fa1c1 esp32/boards: Enable BLE on all boards.
BLE was enabled by default on all boards in the existing make build.

Signed-off-by: Damien George <damien@micropython.org>
2021-02-15 16:40:07 +11:00
Damien George 26b17fd28a esp32/boards: Remove old IDF v3 sdkconfig values.
IDF v3 is no longer supported with the move to cmake.

Signed-off-by: Damien George <damien@micropython.org>
2021-02-15 16:40:03 +11:00
Damien George 9f035d6bb7 esp32: Remove traditional "make" capability.
It's now replaced by cmake/idf.py.  But a convenience Makefile is still
provided with traditional targets like "all" and "deploy".

Signed-off-by: Damien George <damien@micropython.org>
2021-02-15 16:37:58 +11:00
Damien George 97072b7224 esp32: Add explicit initialisers to silence compiler warnings.
This makes no functional change.  See similar commit
9aa58cf8ba

Signed-off-by: Damien George <damien@micropython.org>
2021-02-15 16:37:58 +11:00
Damien George 9c2231f47a esp32/esp32_rmt: Don't do unnecessary check for unsigned less than zero.
Signed-off-by: Damien George <damien@micropython.org>
2021-02-15 16:37:52 +11:00
Damien George 9b90882146 esp32: Add support to build using IDF with cmake.
This commit adds support for building the esp32 port with cmake, and in
particular it builds MicroPython as a component within the ESP-IDF.  Using
cmake and the ESP-IDF build infrastructure makes it much easier to maintain
the port, especially with the various new ESP32 MCUs and their required
toolchains.

Signed-off-by: Damien George <damien@micropython.org>
2021-02-15 12:48:39 +11:00