Commit Graph

1826 Commits

Author SHA1 Message Date
Dan Halbert d8231f1588 Implement safemode.py 2023-02-13 18:26:38 -05:00
Dan Halbert f826904995
Merge pull request #7468 from DavePutz/issue_6975
Fixes for microcontroller.on_next_reset() on NRF
2023-01-19 19:03:46 -05:00
root a30f69aaed Fixes for microcontroller.on_next_reset() on NRF 2023-01-19 15:58:03 -06:00
Scott Shawcroft dca66eb98c
Watch for ctrl-c over BLE workflow serial
Before this, it was impossible to interrupt a running program over
BLE.
2023-01-18 16:28:35 -08:00
Pontus Oldberg 14417a21d1
Merge branch 'adafruit:main' into main 2023-01-03 09:31:49 +01:00
Dan Halbert cc92ce4820 Use memory fence when disabling cache to avoid -O2 problems 2022-12-29 19:49:40 -05:00
Pontus Oldberg 9f266c361b Initializing external flash SPI speed to SPI_FLASH_MAX_BAUDRATE, instead of using driver default speed (32MHz), before probing JEDEC identifier. 2022-12-21 16:33:06 +01:00
Jeff Epler 56d4f8f552
can't use object-based calls at this time 2022-12-13 11:32:33 -06:00
Jeff Epler 31fd7cb51b
Merge remote-tracking branch 'origin/main' into dotenv-becomes-toml 2022-12-11 11:06:51 -06:00
Pontus Oldberg 66eca9c35e Updated formatting. 2022-12-11 17:25:26 +01:00
Pontus Oldberg f7e735b492 Added LDO control pin, new flash variants and support functions for the LDO control pin. 2022-12-11 17:11:24 +01:00
Pontus Oldberg 9ef5b7d118 Merge branch 'main' of https://github.com/PontusO/circuitpython 2022-12-11 13:02:03 +01:00
Pontus Oldberg da413094f8 Added LDO control pin and initial setup 2022-12-11 13:01:00 +01:00
Jeff Epler 2bf5d2bc07
Merge remote-tracking branch 'origin/main' into dotenv-becomes-toml 2022-12-10 15:39:50 -06:00
Jeff Epler 3cb628d290
fix nrf build 2022-12-08 16:45:58 -06:00
Jeff Epler 3459fe322b
Withdraw the _environ module
This existed solely for testing, so expose it a different way during
the unix coverage build

Also turn off os.getenv support on samd21.
2022-12-08 15:33:10 -06:00
Dan Halbert 4e7d65251f Add pin for charge rate for Seeed XIAO nRF52840 Sense 2022-12-08 14:09:44 -05:00
Jeff Epler ef2bfdb5db
dotenv becomes settings.toml 2022-12-08 12:44:20 -06:00
Dan Halbert 082b0d1aed
Merge pull request #7191 from jepler/fastpixelmap
Add a fast PixelMap-like class
2022-12-01 11:43:00 -05:00
Scott Shawcroft ad2d190507
Merge pull request #7247 from tannewt/picow_web_workflow
Enable* web workflow for Pico W
2022-11-28 14:19:42 -08:00
foamyguy c6ca2bdd59 disable pixelmap on bluemicro833 2022-11-24 09:09:48 -06:00
Dan Halbert 6d022733b3
Merge pull request #7162 from rhooper/boards-list
add boards list to make error message
2022-11-21 23:18:37 -05:00
foamyguy 19f1119994 Merge branch 'main' into fastpixelmap
# Conflicts:
#	shared-module/adafruit_pixelbuf/PixelBuf.c
2022-11-21 20:25:58 -06:00
Scott Shawcroft c3a96a63c0
Enable* web workflow for Pico W
* Except for circuitpython.local which depends on MDNS and will be
done in a follow up PR.

Progress on #7214
2022-11-21 16:24:05 -08:00
MicroDev 7c51201e88
fix nRF build directory naming 2022-11-19 00:23:03 +05:30
MicroDev c3c1717813
refactor common port specific Makefile code 2022-11-18 23:00:28 +05:30
MicroDev e2a3597263
add awesome new make error message
Copied from initial implementation on atmel-samd

Co-authored-by: Rose Hooper <rhooper@toybox.ca>
Co-authored-by: Jeff Epler <jepler@gmail.com>
2022-11-18 11:27:23 +05:30
Jeff Epler f5c637dc10
Add adafruit_pixelmap.PixelMap
.. a fast helper for animations. It is similar to and inspired by the
PixelMap helper in Adafruit LED Animation library, but with an extremely
fast 'paste' method for setting a series of pixels. This is a common
operation for many animations, and can give a substantial speed improvement.

It's named `adafruit_pixelmap` so that we can package a compatible version
in pure Python for systems that can't fit it in C in flash, or for
Blinka.

This is a proof of concept and can make a very fast comet animation:
```python
import time
import adafruit_pixelbuf
import adafruti_pixelmap
import board
import neopixel
from supervisor import ticks_ms
from adafruit_led_animation.animation.solid import Solid
from adafruit_led_animation import color

pixel_pin = board.GP0
pixel_num = 96

pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=1, auto_write=False, pixel_order="RGB")

evens = adafruit_pixelmap.PixelMap(pixels, tuple(range(0, pixel_num, 2)))
odd_indices = tuple((i, i+2) for i in range(1, pixel_num, 4))
print(odd_indices)
odds = adafruit_pixelbuf.PixelMap(pixels, odd_indices)
assert len(odds) == len(odd_indices)


comet_length = 16

comet1 = [color.calculate_intensity(color.GREEN, ((1+i) / comet_length) ** 2.4)
        for i in range(comet_length)]
comet2 = [color.calculate_intensity(color.PURPLE, ((1+i) / comet_length) ** 2.4)
        for i in range(comet_length)]

pos1 = 0
pos2 = 96//4

while True:
    evens.paste(comet1, pos1, wrap=True, reverse=False, others=0)
    pos1 = (pos1 + 1) % len(evens)

    odds.paste(comet2, pos2, wrap=True, reverse=True, others=0)
    pos2 = (pos2 - 1) % len(odds)
    pixels.show()

    m = ticks_ms()
    if m % 2000 > 1000:
        time.sleep(.02)
```
2022-11-11 07:54:33 -06:00
Kyle McCreery 1f332e7007 Adding pillbug initial commit 2022-11-09 23:15:38 -05:00
Dan Halbert 952812cdea
Merge pull request #7154 from dhalbert/alarm-lifetime
Save wake alarm info in static storage, simplifying recording of alarm
2022-10-30 12:28:50 -04:00
Neradoc 0aa41fa92e change BOARD_USER_SAFE_MODE_ACTION into a separate sentence 2022-10-30 01:55:42 +02:00
Dan Halbert ded134c346 store wake_alarm in a static object 2022-10-29 16:26:36 -04:00
Dan Halbert 9307b62ad5 wip 2022-10-27 22:42:04 -04:00
microDev b33a2b45dc
add coproc alarm 2022-10-20 18:38:20 +05:30
Dan Halbert 90f6096955 fix ai-thinker creation ids; fix some typos elsewhere 2022-10-03 15:29:03 -04:00
Dan Halbert 7bb90dbf45 remove redundant port/*/.gitignore; cleanup others 2022-10-01 11:52:36 -04:00
Dan Halbert db065a299f
Merge pull request #6933 from jepler/🥧🐮
Implement a useful subset of `wifi` and `socketpool` modules on 🥧🐮
2022-09-28 18:09:24 -04:00
Jeff Epler 346fff2e7c
cyw43 basic gpio support, hwaddr in boot_out 2022-09-28 10:06:33 -05:00
Dan Halbert ea15a9118a ringbuf cleanup 2022-09-21 10:03:05 -04:00
MicroDev 4a69dfa50c
Merge pull request #6907 from dhalbert/preserve-pins-on-deep-sleep
allow preserving pin state during deep sleep
2022-09-16 17:52:04 +05:30
Dan Halbert 3abfd212ec nrf: return None when UART.read() reads nothing 2022-09-15 19:40:02 -04:00
Dan Halbert 60f43b1703 allow preserving pin state during deep sleep 2022-09-15 17:35:14 -04:00
Dan Halbert 4cb69a51d5 Use MP_WEAK for default board.c routines 2022-09-08 07:36:50 -04:00
DavePutz c00a630f50
Update PulseOut.c
reorder the tests for zero-length
2022-08-23 15:58:27 -05:00
root 3daebb36c3 Fix handling of zero-length pulseout pulse 2022-08-23 15:17:54 -05:00
Dan Halbert 41bcd7b260 Remove support for auto-brightness 2022-08-09 22:40:21 -04:00
Dan Halbert 84807cd6eb Change I2C terminology from "peripheral" to "target" 2022-08-09 13:13:19 -04:00
Scott Shawcroft 83cbbc9946
Add BLE status to title bar 2022-08-04 16:33:10 -07:00
Arudinne a55aebc718 Added support for 8MB flash for Challenger 840 2022-07-26 20:34:01 -05:00
Neradoc eabe8b971a list extensions instead of macros names ("bin,uf2" not BIN_UF2)
the modules_support_matrix usees a dictionnary per board instead of a list
optionally include the frozen modules URLs in it
2022-07-26 18:15:59 +02:00
Neradoc d021d9ae4a Move build extensions to board directories
- define CIRCUITPY_BUILD_EXTENSIONS to predefined values
- set CIRCUITPY_BUILD_EXTENSIONS in port and board config
- reuse the support matrix "get_settings_from_makefile" to get it
- move the existing port and board specific values
- remove the C3 specific board values because it's not the default
- update build_release_files.py to use get_settings_from_makefile
2022-07-26 18:15:50 +02:00
Neradoc 5ca6d8953d use available constants instead of testing errors for length 2022-07-14 11:55:53 +02:00
Neradoc 50a9beda04 Retrieve the BLE name from dotenv if available
Format:
CIRCUITPY_BLE_NAME = My BLE Board

- the length is limited to 31 characters
- for the NRF version it repeatedly truncates the name if it's too long
- the ESP version defaults to "nimble" if the name is too long
2022-07-14 11:55:53 +02:00
Dan Halbert 8bb369cac5 refactor debug UART to console UART; get working on ESP32 2022-06-30 23:16:46 -04:00
Scott Shawcroft c27ecc9bb1
Merge pull request #6495 from DavePutz/issue_6451
Test for a BLE disconnect while reading
2022-06-17 09:37:07 -07:00
root cdc7140318 Test for a BLE disconnect while reading 2022-06-16 14:56:18 -05:00
Scott Shawcroft 894cea217d
Merge pull request #6486 from DavePutz/issue_6478
Fix for Issue #6478
2022-06-15 09:43:09 -07:00
root 8668dee3df Fix declaration of print_wakeup_cause 2022-06-14 20:51:07 -05:00
root 669e45497c Uncommented call to print_wakeup_cause 2022-06-14 13:27:15 -05:00
root 015e95807a Fix for Issue #6478 2022-06-14 12:14:05 -05:00
Scott Shawcroft 1a3d2a5b5e
Shrink nrf52833 builds
Make them CIRCUITPY_FULL_BUILD = 0 and rework the boards to have
the same modules enabled (ish.)

Also make ZLIB require FULL_BUILD and disable advanced `micropython`
module APIs by default on all builds.
2022-06-13 15:36:15 -07:00
iabdalkader 99d3a73d59 nrf/modules/uos/microbitfs: Fix MICROPY_MBFS build to use mp_obj_malloc.
Changes introduced in 0e7bfc88c6 missed
changing this call to mp_obj_malloc.
2022-06-11 21:09:58 +10:00
Dan Halbert 80ae14202a
Merge pull request #6416 from FoamyGuy/display_brightness_pwm
display brightness pwm 500hz frequency
2022-06-05 23:52:42 -04:00
foamyguy 260994d16e Merge branch 'main' into display_brightness_pwm 2022-06-04 11:32:15 -05:00
foamyguy cbff9dd8e3 add new argument for all boards with built-in display 2022-06-04 11:08:20 -05:00
Andrew Leech 494e8ba722 nrf/mpconfigport: Fix MICROPY_VFS IO build support. 2022-06-03 12:39:43 +10:00
Andrew Leech c5878dd1f9 nrf/mpconfigport: Enable extra features as defined by ROM levels.
This commit enables extra features from the ROM levels and further
simplifies mpconfigport.h.  The changes are:

- NRF51822 & BLUETOOTH_SD -> MICROPY_CONFIG_ROM_LEVEL_MINIMUM
    - no changes

- NRF51822 -> MICROPY_CONFIG_ROM_LEVEL_CORE_FEATURES
    - MICROPY_PY_IO = 1

- NRF52832 -> MICROPY_CONFIG_ROM_LEVEL_BASIC_FEATURES
    - MICROPY_PY_IO = 1

- NRF52840, NRF9160 -> MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES
    - MICROPY_COMP_MODULE_CONST = 1
    - MICROPY_COMP_TRIPLE_TUPLE_ASSIGN = 1
    - MICROPY_OPT_MPZ_BITWISE = 1
    - MICROPY_PY_ALL_SPECIAL_METHODS = 1
    - MICROPY_PY_BUILTINS_EXECFILE = 1
    - MICROPY_PY_BUILTINS_SLICE_ATTRS = 1
    - MICROPY_PY_BUILTINS_STR_CENTER = 1
    - MICROPY_PY_BUILTINS_STR_PARTITION = 1
    - MICROPY_PY_BUILTINS_STR_SPLITLINES = 1
    - MICROPY_PY_CMATH = 1
    - MICROPY_PY_COLLECTIONS_ORDEREDDICT = 1
    - MICROPY_PY_FRAMEBUF = 1
    - MICROPY_PY_IO = 1
    - MICROPY_PY_MATH_SPECIAL_FUNCTIONS = 1
    - MICROPY_PY_SYS_STDIO_BUFFER = 1
    - MICROPY_PY_UCTYPES = 1
    - MICROPY_PY_UHEAPQ = 1
    - MICROPY_PY_UJSON = 1
    - MICROPY_PY_URE = 1
    - MICROPY_PY_UZLIB = 1
    - MICROPY_REPL_EMACS_KEYS = 1
2022-06-03 12:37:12 +10:00
Andrew Leech 13f5d38f2e nrf/mpconfigport: Set MICROPY_CONFIG_ROM_LEVEL defines for each MCU.
This commit is a no-op change to simplify existing config.
2022-06-03 12:36:40 +10:00
Damien George efe23aca71 all: Remove third argument to MP_REGISTER_MODULE.
It's no longer needed because this macro is now processed after
preprocessing the source code via cpp (in the qstr extraction stage), which
means unused MP_REGISTER_MODULE's are filtered out by the preprocessor.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 16:31:37 +10:00
Scott Shawcroft 09c61efcff
Split partition from LTO enable 2022-06-01 11:12:14 -07:00
Scott Shawcroft 9d10a3da66
Conditionalize LTO 2022-05-27 12:59:54 -07:00
Dan Halbert 947f564672 tune LTO on nrf 2022-05-26 22:16:41 -04:00
Dan Halbert d74193c298 Use -flto and -flto-partition only as needed 2022-05-26 11:36:41 -04:00
Damien George 6e71cde6aa ports: Use default VFS config for import_stat and builtin_open.
For ports with MICROPY_VFS and MICROPY_PY_IO enabled their configuration
can now be simplified to use the defaults for mp_import_stat and
mp_builtin_open.

This commit makes no functional change, except for the following minor
points:
- the built-in "open" is removed from the minimal port (it previously did
  nothing)
- the duplicate built-in "input" is removed from the esp32 port
- qemu-arm now delegates to VFS import/open

Signed-off-by: Damien George <damien@micropython.org>
2022-05-25 13:04:45 +10:00
Damien George 5956466c0e py/builtin: Clean up and simplify import_stat and builtin_open config.
The following changes are made:

- If MICROPY_VFS is enabled then mp_vfs_import_stat and mp_vfs_open are
  automatically used for mp_import_stat and mp_builtin_open respectively.

- If MICROPY_PY_IO is enabled then "open" is automatically included in the
  set of builtins, and points to mp_builtin_open_obj.

This helps to clean up and simplify the most common port configuration.

Signed-off-by: Damien George <damien@micropython.org>
2022-05-25 13:04:45 +10:00
Paint Your Dragon 5ef1f2dd5a
Correctly scale analog reading per issue #4794 2022-05-24 08:45:14 -07:00
Dan Halbert a01dec1df9 message consolidation and more use of validators 2022-05-19 15:38:37 -04:00
Jim Mussared f67ac90fa9 nrf: Make port-specific modules use MP_REGISTER_MODULE.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18 20:57:09 +10:00
Jim Mussared 4eab44a1ec extmod: Make extmod modules use MP_REGISTER_MODULE.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18 20:49:12 +10:00
Scott Shawcroft 269d51d023
Add two stage reset for BLE
This lets the BLE stack run through the wait period after a VM run
when it may be waiting for more writes due to an auto-reload.

User BLE functionality will have their events stopped. Scanning and
advertising is also stopped.
2022-05-12 13:20:44 -07:00
Jim Mussared 0e7bfc88c6 all: Use mp_obj_malloc everywhere it's applicable.
This replaces occurences of

    foo_t *foo = m_new_obj(foo_t);
    foo->base.type = &foo_type;

with

    foo_t *foo = mp_obj_malloc(foo_t, &foo_type);

Excludes any places where base is a sub-field or when new0/memset is used.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-03 22:28:14 +10:00
Michael Wisslead e63a327107 Bound PulseIn start indexes to maxlen. 2022-04-28 02:28:34 +00:00
Dan Halbert 4eeaf41edc test and adjust NeoPixel timings on multiple products 2022-04-25 23:12:24 -04:00
Neradoc 17bba7b17d remove Adafruit_CircuitPython_BusDevice from frozen modules, it's built in now 2022-04-19 06:49:11 +02:00
Dan Halbert 2693a4cfe1
Merge pull request #6069 from gamblor21/uzlib-module
zlib Module
2022-04-06 12:06:44 -04:00
Pontus Oldberg 286e26edf0 Added support for 4MB flash. 2022-04-06 11:08:22 +02:00
Jeff Epler fe98248a3d
Merge remote-tracking branch 'origin/7.2.x' into merge-7.2.x 2022-04-05 08:45:13 -05:00
Jeff Epler fa4b4fa639
nrf: Correctly mark PWM unused during reset 2022-04-04 10:08:54 -05:00
Mark 8ed7b114cd
Merge branch 'main' into uzlib-module 2022-04-03 11:48:37 -05:00
Pontus Oldberg f2d10237d2
Merge branch 'adafruit:main' into main 2022-03-30 16:43:39 +02:00
Andrew Leech 303e222f70 nrf/modules: Include uasyncio in default board manifest. 2022-03-30 15:37:49 +11:00
Andrew Leech f92da1adc4 nrf/drivers/usb: Fix MP_STREAM_POLL_RD support on USB CDC.
This gets ipoll working on USB CDC stdin.
2022-03-30 15:34:25 +11:00
Andrew Leech dc8b43adc7 nrf/drivers/usb: Fix background events/scheduling while at USB REPL. 2022-03-30 15:33:29 +11:00
Scott Shawcroft fcde108d03
Merge pull request #6194 from jepler/revamp-duplicate-usb-check
Improve the USB vid:pid duplicate checker
2022-03-24 14:57:48 -07:00
jerryneedell bcec1e44f0 add status LED to nrf pca10059 dongdle 2022-03-24 15:05:02 -04:00
Jeff Epler d91ca7369c
Merge remote-tracking branch 'origin/main' into revamp-duplicate-usb-check 2022-03-24 09:44:41 -05:00
Jeff Epler a07ac72cc5
Improve the USB vid:pid duplicate checker
To me, it made more sense to track which boards go together in a cluster;
when reviewing a request to actually use a duplicate vid/pid, you want
to know what board(s) it is aliasing.

I also revamped the detection of non-USB boards so that a board .mk file
that couldn't be parsed by the code here would raise a problem instead
of just being skipped for the purposes of checking.

There were some lines with comments on the end, and some variation in
capitalization of the IDs. These are all normalized and a (sometimes
unfriendly!) error printed when it's incorrect.

Before this, here were some ways to trick the duplicate vid/pid checker:
```
USB_PID = 0XABCD
USB_PID = 0xAbCd
USB_PID = 0xABCD # harmless comment?
```
None of these things were ever done on purpose.
2022-03-24 09:42:11 -05:00
Pontus Oldberg c7b28eb2ef
Update ports/nrf/boards/challenger_840/pins.c
Co-authored-by: Dan Halbert <halbert@halwitz.org>
2022-03-23 17:14:49 +01:00
Pontus Oldberg d26297ae98
Update ports/nrf/boards/challenger_840/pins.c
Co-authored-by: Dan Halbert <halbert@halwitz.org>
2022-03-23 17:14:40 +01:00
Pontus Oldberg 7901850bb8
Update ports/nrf/boards/challenger_840/pins.c
Co-authored-by: Dan Halbert <halbert@halwitz.org>
2022-03-23 17:14:28 +01:00