Commit Graph

6890 Commits

Author SHA1 Message Date
nm3210 929ee8d3b4 Fix pre-commit whitespace error 2021-04-30 14:16:13 -04:00
Scott Shawcroft d93a9a1dbc
Merge pull request #4683 from DavePutz/issue_4661
Issue #4661 - Wrap pulsein values when maxlen is exceeded.
2021-04-30 11:07:54 -07:00
microDev eebcd2eeaf
remove unsupported authmodes 2021-04-30 22:11:32 +05:30
microDev 6640db9555
make authmode settable 2021-04-30 21:35:02 +05:30
Jeff Epler e95e921ca1 codeformat: Fix filename matching
In #4683, tannewt noticed that uncrustify was not running on some
file in common-hal.

I investigated and found that it was not being run on a bunch of paths.

Rather than make incremental changes, I rewrote list_files to work
bsaed on regular expressions; these regular expressions are created from
the same git-style glob patterns.

I spot-checked some specific filenames after this change, and all looks good:

```
$ python3 tools/codeformat.py -v --dry-run tests/basics/int_small.py ports/raspberrypi/common-hal/pulseio/PulseIn.c extmod/virtpin.c tests/thread/thread_exit1.py  ports/raspberrypi/background.h extmod/re1.5/recursiveloop.c
tools/codeformat.py -v --dry-run tests/basics/int_small.py ports/raspberrypi/common-hal/pulseio/PulseIn.c extmod/virtpin.c tests/thread/thread_exit1.py ports/raspberrypi/background.h extmod/re1.5/recursiveloop.c
uncrustify -c /home/jepler/src/circuitpython/tools/uncrustify.cfg -lC --no-backup extmod/virtpin.c ports/raspberrypi/background.h ports/raspberrypi/common-hal/pulseio/PulseIn.c
black --fast --line-length=99 -v tests/thread/thread_exit1.py
```
recursiveloop and int_small are excluded, while PulseIn, virtpin,
and background are included.

Testing running from a subdirectory (not _specifically_ supported though):
```
(cd ports && python3 ../tools/codeformat.py -v --dry-run raspberrypi/common-hal/pulseio/PulseIn.c ../extmod/virtpin.c)
../tools/codeformat.py -v --dry-run raspberrypi/common-hal/pulseio/PulseIn.c ../extmod/virtpin.c
uncrustify -c /home/jepler/src/circuitpython/tools/uncrustify.cfg -lC --no-backup ../extmod/virtpin.c raspberrypi/common-hal/pulseio/PulseIn.
```

As a side-effect, a bunch more files are re-formatted now. :-P
2021-04-30 10:48:08 -05:00
Dan Halbert 353e55d710
Merge pull request #4688 from jepler/fix-pixelbuf-subscr
objtype: Restore our customized behavior of instance_subscr
2021-04-30 10:45:44 -04:00
Dan Halbert be7b2b00a8 uncrustify with newer version of uncrustify 2021-04-30 10:40:12 -04:00
nm3210 9c1466a330 Update Sparkfun Thing Plus RP2040 pins to match board
This fixes some missing and incorrectly-assigned pins for the SparkFun Thing Plus RP2040 protoboard so that they actually match what the board says. This also changes the default SPI pins from the SD card pins to the breakout pins on the side of the board.
2021-04-30 09:37:37 -04:00
microDev 7c845818b3
Merge branch 'main' into ap 2021-04-30 17:11:22 +05:30
Damien George 888664130c zephyr/boards: Add config for nucleo_wb55rg board.
This board does not work with CONFIG_NETWORKING enabled.  And
CONFIG_CONSOLE_SUBSYS is enabled so that ctrl-C works.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 15:32:16 +10:00
Damien George b46a033e25 zephyr/modmachine: Add machine.idle().
Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 15:32:16 +10:00
Damien George d120859857 zephyr: Run scheduled callbacks at REPL and during mp_hal_delay_ms.
And ctrl-C can now interrupt a time.sleep call.  This uses Zephyr's k_poll
API to wait efficiently for an event signal, and an optional semaphore.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 15:32:16 +10:00
Damien George e9e9c76ddf all: Rename mp_keyboard_interrupt to mp_sched_keyboard_interrupt.
To match mp_sched_exception() and mp_sched_schedule().

Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 15:13:43 +10:00
Damien George bd54eb566f nrf/boards/microbit: Use mp_sched_exception() where appropriate.
Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 15:13:43 +10:00
Damien George 7cbf826a95 py/scheduler: Add mp_sched_exception() to schedule a pending exception.
This helper is added to properly set a pending exception, to mirror
mp_sched_schedule(), which schedules a function.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 15:13:43 +10:00
Damien George a41cd150be esp8266/modnetwork: Use mp_handle_pending() to raise pending exception.
If MICROPY_ENABLE_SCHEDULER is enabled then MP_STATE_VM(sched_state) must
be updated after handling the pending exception, which is done by the
mp_handle_pending() function.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 15:13:43 +10:00
Tsutomu IKEGAMI 11a9372da3 Set Xtal, Aref, and NC pins to be IGNORE_ed in microcontroller.pin for Wio Terminal. 2021-04-30 13:06:09 +09:00
Tsutomu IKEGAMI d79d6ba688 Add I2S_* pin assignments to Wio Terminal board. 2021-04-30 13:03:29 +09:00
Mark 5ef9b10669
Merge pull request #4685 from microDev1/authmode
Add AuthMode class
2021-04-29 22:12:58 -05:00
Dan Halbert b5efce12cd delete hid .py; undo some debugging changes 2021-04-29 23:05:31 -04:00
iabdalkader a1111b83ed stm32/sdio: Allow configuring the SDMMC periph used for SDIO.
This can now be selected by setting MICROPY_HW_SDIO_SDMMC, which defaults
to 1, ie SDMMC1.  The pins can also be selected and default to the standard
C8/C9/C10/C11/C12/D2.
2021-04-30 11:26:04 +10:00
Mark 5679eb4fd7
Merge pull request #4677 from skerr92/add-cp-sapling-rev-b
Add cp sapling rev b
2021-04-29 19:22:49 -05:00
iabdalkader baa712b7f0 stm32/boards/PYBD_SF2: Enable RF switch compile option. 2021-04-30 10:16:15 +10:00
Seth Kerr 8b611d4b6b changing mpconfigboard makefile 2021-04-29 16:45:08 -06:00
Lucian Copeland 07b86fcb76 fix sleepmemory object redefine error 2021-04-29 17:28:06 -04:00
Jeff Epler 90bdb25219 ignore some pins to reclaim flash space 2021-04-29 14:36:29 -05:00
Jeff Epler 6498684f5e ignore some pins to reclaim flash space 2021-04-29 14:30:31 -05:00
Lucian Copeland bab5a22f0c Fix build issues
H7 compatibility problems in port.c and peripherals/exti
NRF build failures due to new use of const for PinAlarm pin objects
Isolated board flash overage on blackpill_with_flash, remove audio modules
2021-04-29 14:48:16 -04:00
Kattni Rembor 4d97680cae Fix board definition. 2021-04-29 13:45:39 -04:00
DavePutz 1ec59cd534
Fix up indentation 2021-04-29 12:38:13 -05:00
Kattni Rembor 0bf747870a Fixing board definition. 2021-04-29 12:41:23 -04:00
iabdalkader 80788154b3 stm32/sdio: Add functions to re/enable SDIO/SDIOIT. 2021-04-30 01:12:08 +10:00
iabdalkader 4d96786823 stm32/uart: Enable HW flow control for UART 1/5/7/8. 2021-04-30 01:10:02 +10:00
Damien George cf7e71fa43 stm32/sdcard: Allow configuring the SDMMC periph used for SD/MMC card.
This can now be selected by setting MICROPY_HW_SDCARD_SDMMC, which defaults
to 1, ie SDMMC1.  This commit also renames the SD pin configuration macros
from MICROPY_HW_SDMMC2_xxx to MICROPY_HW_SDCARD_xxx, as well as renaming
MICROPY_HW_SDMMC_BUS_WIDTH to MICROPY_HW_SDCARD_BUS_WIDTH.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 00:58:17 +10:00
Damien George 37494b8c8a stm32/mboot: Allow mboot to be placed at any location in flash.
A board can now define MBOOT_TEXT0_ADDR to place mboot at a location other
than 0x08000000.  This can be useful if, for example, there is already a
different bootloader on the device.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 00:42:59 +10:00
Damien George 58be5a5aa3 stm32/mboot: Allow a board to customise the linker scripts.
A board can now define MBOOT_LD_FILES (at the Makefile-level) to specify
custom linker scripts.  And stm32_generic.ld has been split into 2 pieces
so one or the other can be reused (usually stm32_sections.ld wolud be
reused by a board, and stm32_memory.ld redefined).

Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 00:42:59 +10:00
Damien George 97f09fda3e stm32/mboot: Fix mp_hal_delay_us() and add mp_hal_ticks_ms().
Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 00:42:59 +10:00
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