Also:
- Use NO_PIN, not 0xff for I2SOut (cosmetic fix only; no actual functional change)
- Add VOLTAGE_MONITOR/BATTERY, ACCELEROMETER_INTERRUPT pins for LED Glasses Driver
The BLE workflow will be advertising and the scan's load of
identities conflicts with it. This change ensures scanning and
advertising happens exclusively.
This showed as an unknown error 3204.
Fixes https://github.com/adafruit/Adafruit_CircuitPython_BLE/issues/134
To keep things neat and tidy, we ensure that each file has 1 and only 1
newline at the end of each file.
Signed-off-by: David Lechner <david@pybricks.com>
Fixes a crash from trying to raise an exception when trying to
deinit a RESET wdt by not raising an exception.
Fixes a crash when raise a wdt exception in the REPL when waiting
for input. We now catch and print any exceptions raised.
Fixes#5261
There is a race between when we run background tasks and when we
sleep. If an interrupt happens between the two, then we may delay
executing the background task. On some ports we checked this for
TinyUSB already. On iMX RT, we didn't which caused USB issues.
This PR makes it more generic for all background tasks including
USB.
Fixes#5086 and maybe others.
This function can be used to enable and disable the DC/DC converter with or
without the Bluetooth stack enabled. It can also be used to query the
current state of the DC/DC.
This commit also adds a definition of ARRAY_SIZE needed by nrfx HAL-layer.
extmod/vfs_lfs.c needs to resolve `mp_hal_time_ns()` in order to calculate
a timestamp from 1970 epoch. A wall clock is not available in the nrf
port, hence the function is implemented to resolve compilation linkage
error. The function always return 0.
Set the default manifest to "modules/manifest.py". This includes files
from the folder "modules/scripts". The manifest default value is overriden
by all nrf51 boards that have SoftDevice present (SD=s110) to save flash.
Also add "modules/manifest.py" which is set to freeze
"modules/scripts/_mkfs.py".
Add a helper script _mkfs.py which automatically formats the file system if
nrf.Flash() is located and a VFS file system has been included in the
compilation.
The precedence is: first LFS1, LFS2 then FAT.
Update the Makefile to handle FROZEN_MANIFEST, and the README with some
small samples on how to use freeze manifests. And add BOARD_DIR to the
Makefile which can be referenced in boards/<board>/mpconfigboard.mk to
include a board specific manifest.
Enable the following features for all boards except
nrf51 boards with SoftDevice present:
- MICROPY_VFS
- MICROPY_PY_NRF
- MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE
Add posibility to override linker script "_fs_size" from make by adding the
FS_SIZE parameter. The syntax of value is linker script syntax. For
example, the value of 131072 bytes can be written as 128K like this:
FS_SIZE=128K.
If not set, default value for "_fs_size" from linker script will be used.
Disable MICROPY_FATFS_MULTI_PARTITION configuration because there is no
partition table in the flash for FATFS to read.
Also, set MICROPY_FATFS_MAX_SS to the size of a flash page. For nrf51 the
value 1024 is set. For nrf52/nrf91 the value 4096 is set.
This documents parameters that can be passed to make to enable a specific
file system to included in the build. Also, document the Makefile override
parameter "FS_SIZE" that can be used to tune the size of the flash region
to use as internal flash file system.
Update flash.c to also be compiled in when
MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE is enabled and SoftDevice is
present.
Update bluetooth/ble_drv.c to forward flash events to flash.c when
MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE is enabled.
This commit adds the "nrf" module for port specific modules and objects.
Included in it is the "Flash" object which exposes a block device
implementation to access internal SoC flash.
Thanks to @aykevl aka Ayke van Laethem for the initial implementation.
Calculate the unused flash area on the target device. The values will be
exposed by _unused_flash_start and _unused_flash_length. The start address
and the length are not aligned to either word or pages.
For consistency with other board-level config macros that begin with
MICROPY_HW_USB.
Also allow boards in the mimxrt, nrf and samd ports to configure these
values.
Signed-off-by: Damien George <damien@micropython.org>
Call `supervisor.disable_ble_workflow()` and the BLE workflow will
be disabled until the chip is reset.
This also includes a couple fixes:
1. Terminals can now be deinit by setting the tilegrid to NULL. This
prevents using the tilegrid before display is init.
2. Fix BLE serial send amount when sending more than a single packet.
Fixes#5049
On ESP ctrl-c during fake sleep will now stop the sleep. A crash
on real deep sleep is now fixed as well. (Exception string saving
was crashing on reading the deep sleep exception.) Fixes#4010
This also fixes nRF fake sleep after the first time. The internal
variable wasn't being reset early enough. Fixes#4869
Passing in a PWMOut still works but is deprecated. It will be
removed in CircuitPython 8.0.0
This also switches STM32 timer indices and channel indices to
0-based in our pin data rather than `- 1` everywhere. The latter is
more bug prone.
Most of the way for #3264
Tested on Metro M0, Metro M4, Feather S2, Feather nRF52840, Feather
STM32F4 and Arduino RP2040.
nRF CircuitPython boards will now provide the file transfer
service defined here: https://github.com/adafruit/Adafruit_CircuitPython_BLE_File_Transfer
USB capable boards will only advertise if previously bonded to a
device or if the reset button is pressed during the fast blue
flashes on start up. When pressed, the board will restart again but
the blue period will not flash.
Boards without USB will always advertise.
When previously bonded, the advertisement is private so that no
other peers can connect. If advertising publicly, the tx power is
lowered to reduce the likelihood of bonding from a distance.
This PR also fixes issues with loading identities of bonded peers
so that our address can now be resolved and we can resolve others'
addresses when scanning.
This moves mp_pending_exception from mp_state_vm_t to mp_state_thread_t.
This allows exceptions to be scheduled on a specific thread.
Signed-off-by: David Lechner <david@pybricks.com>
This commit adds a few math functions to the source list in the Makefile,
and implements the log2f function, so that ulab can be compiled on the nrf
boards. It also addresses part of #5162.
This configuration is used by @ladyada and more often than it should
we've discovered late that a change introduced problems building
there.
By adding this to regular CI, hopefully we learn about and fix these
issues sooner rather than later.
This also removes the need to pin share because we don't use the
status LED while user code is running.
The status flashes fallback to the HW_STATUS LED if no RGB LED is
present. Each status has a unique blink pattern as well.
One caveat is the REPL state. In order to not pin share, we set the
RGB color once. PWM and single color will be shutoff immediately but
DotStars and NeoPixels will hold the color until the user overrides
it.
Fixes#4133
After discussing with danh, I noticed that `a/**/b` would not match `a/b`.
After correcting this and re-running "pre-commit run --all", additional
files were reindented, including the codeformat script itself.
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
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