Commit Graph

590 Commits

Author SHA1 Message Date
jun2sak 3fab9f8b1b new wait-until-alarm design, don't use System OFF. 2021-03-07 01:09:54 +09: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
Jeff Epler 238484ec26 Merge remote-tracking branch 'origin/main' into update-protomatter-rp2 2021-03-01 15:18:32 -06: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
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
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
jun2sak 277a67d876 call touchalarm funcs as well as pin/timealarm. 2021-02-26 08:11:50 +09:00
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
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
jun2sak 61a69daae1 raise NotImplementedError when construct TouchAlarm. 2021-02-25 08:19:03 +09: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
jun2sak 9661d67cd3 replace MY_DEBUG_UART -> NRF_DEBUG_PRINT. 2021-02-25 01:49:57 +09:00
jun2sak 0f188befb6 set RAM retention just before deep sleep 2021-02-24 00:12:25 +09:00
jun2sak ec64fa6a29 move dump_xxx functions to debug_uart.c. 2021-02-23 12:16:37 +09:00
jun2sak 9df0f439f3 alarm/pin/__init__.c is no longer used. 2021-02-23 10:31:49 +09: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 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
jun2sak 26f8f532f1 safe mode fix. 2021-02-21 00:47:07 +09:00
Dan Halbert 5c37b73c6d fix typo to fix nrf builds 2021-02-18 11:09:32 -05: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
Dan Halbert d54b5861a3 wip 2021-02-12 19:01:14 -05:00
Jeff Epler ff1942cff6 Enable protomatter on RP2040 builds
Also found a race condition between timer_disable and redraw, which
would happen if I debugger-paused inside common_hal_rgbmatrix_timer_disable
or put a delay or print inside it.  That's what pausing inside reconstruct
fixes.

So that the "right timer" can be chosen, `timer_allocate` now gets the `self`
pointer.  It's guaranteed at this point that the pin information is accurate,
so you can e.g., find a PWM unit related to the pins themselves.
This required touching each port to add the parameter even though it's
unused everywhere but raspberrypi.
2021-02-12 08:25:15 -06:00
Dan Halbert f0564b4986 merge from upstream; complicated webusb merge 2021-02-11 18:50:02 -05:00
Dan Halbert 1b7f3d11e7 wip 2021-02-08 10:57:41 -05:00
BiffoBear 2656c84b01 Initial commit. Edited error messages in .c files 2021-02-03 05:49:40 +07:00
Bernhard Boser 16d54586c1 remove long read error message 2021-01-27 09:20:45 -08:00
Bernhard Boser e27dd26dc7 make translate, BEWARE adds the 'world' 2021-01-18 11:26:39 -08:00
Bernhard Boser 07a9593abc add flow control info to busio_uart_obj_t 2021-01-17 19:33:32 -08:00
Dan Halbert ccace62ac9 don't check length for remote characteristic or dedescriptor 2021-01-13 15:35:51 -05:00
Dan Halbert a397af9bdf Round BLE timing values; fix timeout check 2021-01-10 13:16:19 -05:00
Bernhard Boser c7dc5f2507 support RTS/CTS hardware flow control 2021-01-07 14:13:19 -08:00
microDev dc332baa87
update common_hal_reset_pin() 2020-12-28 20:04:00 +05:30
Dan Halbert a11ad25727 BLE fixes 2020-12-23 16:39:27 -05:00
Dan Halbert 8b7c23c1ee address review comments 2020-12-01 20:01:14 -05:00
Dan Halbert 104a089677 deep sleep working; deep sleep delay when connected 2020-11-26 22:06:37 -05:00
Dan Halbert a0f1ec3c4a wip 2020-11-22 19:10:09 -05:00
Dan Halbert 75559f35cc wip: ResetReason to microcontroller.cpu 2020-11-21 23:29:52 -05:00
Dan Halbert 5bb3c321e9 merge from main 2020-11-19 00:29:14 -05:00
Scott Shawcroft 66fb095069
Merge pull request #3667 from microDev1/watchdog-s2
ESP32S2: Support for WatchDog
2020-11-16 15:01:54 -08:00
Dan Halbert ffff02c053 Merge remote-tracking branch 'adafruit/main' into sleep 2020-11-16 12:06:11 -05:00
Scott Shawcroft 68eb809fbf
Update parallel bus signatures 2020-11-13 18:57:52 -08:00
microDev 10e8b8cf45
move port specific check 2020-11-11 00:24:01 +05:30
microDev 930cf14dce
Add check for invalid io, function to disable all alarms 2020-10-27 16:17:26 -07:00
microDev e35938971a
Add description of alarm modules 2020-10-27 16:16:55 -07:00
Scott Shawcroft 9fcf96cb64
Replace _bleio.ConnectionError with the native version
Replace uses of _bleio.ConnectionError with regular ConnectionError

Fixes #3008
2020-10-07 17:11:32 -07:00
Jeff Epler b3bdd4686b PacketBuffer: add missing 'break's, remove unneeded {} 2020-09-13 15:10:38 -05:00
Scott Shawcroft 9e722c8c99
Merge pull request #3375 from DavePutz/issue3296
Correction for Issue #3296 - ble hanging on nrf52840
2020-09-10 12:36:17 -07:00
root 2690faec43 Moved checks for invalid pin to common-hal/microcontroller/Pin.c 2020-09-05 11:42:06 -05:00
root ed6cc64c49 Corrected issue with BLE not working on nrf52840 2020-09-04 16:59:41 -05:00
Dan Halbert 6dbd369272 merge from upstream 2020-08-30 14:39:03 -04:00
Lucian Copeland 8021da08d3 Fix problematic whitespace on pulseout parameter errors 2020-08-27 11:07:47 -04:00
Scott Shawcroft 1527a3ce92
Merge remote-tracking branch 'adafruit/main' into add_pwmio 2020-08-24 18:25:18 -07:00
Scott Shawcroft 644d2ba7a2 Add more "extern" declarations for gcc10 compat
gcc has tightened the restrictions on forward declarations that lack
"extern".  Fix them up.
2020-08-21 14:39:37 -05:00
Scott Shawcroft a5b01f7361
Merge remote-tracking branch 'adafruit/main' into add_pwmio 2020-08-21 11:13:53 -07:00
Dan Halbert f714f53552 Merge remote-tracking branch 'adafruit/main' into ble_hci 2020-08-21 10:45:05 -04:00
Dan Halbert 0e30dd8bcc merge from upstream; working; includes debug_out code for debugging via Saleae for posterity 2020-08-20 20:29:57 -04:00
Scott Shawcroft 400701004b
Merge pull request #3279 from hierophect/esp32-pulseinout
ESP32-S2: Add PulseOut and PulseIn
2020-08-20 11:24:08 -07:00
Scott Shawcroft 6857f98426
Split pulseio.PWMOut into pwmio
This gives us better granularity when implementing new ports because
PWMOut is commonly implemented before PulseIn and PulseOut.

Fixes #3211
2020-08-18 13:08:33 -07:00
Lucian Copeland da75445cd5 Style changes, reposition runtime errors 2020-08-18 11:42:06 -04:00
Dan Halbert 94ecf33a5c
Merge pull request #3281 from dhalbert/fix-spim3-buffer-location
SPIM3 buffer must be in first 64kB of RAM
2020-08-17 19:28:03 -04:00
Scott Shawcroft 377503e61c
Merge pull request #3284 from dhalbert/fix-3171-evt-handler
Remove event handler before setting it to NULL
2020-08-17 15:02:29 -07:00
Dan Halbert ef40f83f99 Remove event handler before setting it to NULL 2020-08-15 14:39:53 -04:00
Dan Halbert cf0f3d70b5 SPIM3 buffer must be in first 64kB of RAM 2020-08-15 10:31:56 -04:00
Lucian Copeland 0fc730bc5a Expand PulseOut API, debug cleanup 2020-08-14 16:36:02 -04:00
Yihui Xiong 52990a332d fix 2020-08-14 17:48:15 +08:00
Yihui Xiong e7da652711 able to change ble mac address 2020-08-13 16:54:29 +08:00
Dan Halbert 44c9c43cd1 ble_uart_echo_test works 2020-08-13 00:03:39 -04:00
Jeff Epler 32fc8b0676 nrf: reset_pin_number: reset pin clears never-reset, mirroring samd 2020-08-12 07:32:18 -05:00
Jeff Epler 760a171903 nrf: Make port build with -Werror=undef
.. build-tested on particle_xenon
2020-08-12 07:32:18 -05:00
Dan Halbert 06f3b4048a fix #3228 for nrf; still needs to be fixed for HCI; tested 2020-08-11 16:21:16 -04:00
Dan Halbert 0f4b969d62 discovery of Nordic UART service working 2020-08-08 00:29:37 -04:00
Jeff Epler 93b373d617 "pop from empty %q"
Saves 12 bytes code on trinket m0
2020-08-04 18:42:09 -05:00
Jeff Epler c849b781c0 Combine 'index out of range' messages 2020-08-04 14:45:45 -05:00
Jeff Epler dddd25a776 Combine similar strings to reduce size of translations
This is a slight trade-off with code size, in places where a "_varg"
mp_raise variant is now used.  The net savings on trinket_m0 is
just 32 bytes.

It also means that the translation will include the original English
text, and cannot be translated.  These are usually names of Python
types such as int, set, or dict or special values such as "inf" or
"Nan".
2020-08-04 13:34:29 -05:00
Dan Halbert 0a60aee3e4 wip: compiles 2020-08-02 11:36:38 -04:00
Dan Halbert 6494bbdc64 snapshot 2020-07-16 23:14:49 -04:00
Jeff Epler dc74ae83da nRF: Always use sd_nvic_critical_region calls
The motivation for doing this is so that we can allow
common_hal_mcu_disable_interrupts in IRQ context, something that works
on other ports, but not on nRF with SD enabled.  This is because
when SD is enabled, calling sd_softdevice_is_enabled in the context
of an interrupt with priority 2 or 3 causes a HardFault.  We have chosen
to give the USB interrupt priority 2 on nRF, the highest priority that
is compatible with SD.

Since at least SoftDevice s130 v2.0.1, sd_nvic_critical_region_enter/exit
have been implemented as inline functions and are safe to call even if
softdevice is not enabled.  Reference kindly provided by danh:
 https://devzone.nordicsemi.com/f/nordic-q-a/29553/sd_nvic_critical_region_enter-exit-missing-in-s130-v2

Switching to these as the default/only way to enable/disable interrupts
simplifies things, and fixes several problems and potential problems:
 * Interrupts at priority 2 or 3 could not call common_hal_mcu_disable_interrupts
   because the call to sd_softdevice_is_enabled would HardFault
 * Hypothetically, the state of sd_softdevice_is_enabled
   could change from the disable to the enable call, meaning the calls
   would not match (__disable_irq() could be balanced with
   sd_nvic_critical_region_exit).

This also fixes a problem I believe would exist if disable() were called
twice when SD is enabled.  There is a single "is_nested_critical_region"
flag, and the second call would set it to 1.  Both of the enable()
calls that followed would call critical_region_exit(1), and interrupts
would not properly be reenabled.  In the new version of the code,
we use our own nesting_count value to track the intended state, so
now nested disable()s only call critical_region_enter() once, only
updating is_nested_critical_region once; and only the second enable()
call will call critical_region_exit, with the right value of i_n_c_r.

Finally, in port_sleep_until_interrupt, if !sd_enabled, we really do
need to __disable_irq, rather than using the common_hal_mcu routines;
the reason why is documented in a comment.
2020-07-15 09:26:47 -05:00
Dan Halbert f6869c69c5 wip: advertising; not tested 2020-07-12 19:45:23 -04:00
Scott Shawcroft c5fa9730a8
Compiles! 2020-06-24 12:47:59 -07:00
Scott Shawcroft a26102607e
Add UART support 2020-06-24 12:47:58 -07:00
Diego Elio Pettenò dd5d7c86d2 Fix up end of file and trailing whitespace.
This can be enforced by pre-commit, but correct it separately to make it easier to review.
2020-06-03 10:56:35 +01:00
Scott Shawcroft 959f7297da
Merge remote-tracking branch 'adafruit/master' into wdt-nrf 2020-06-01 17:01:16 -07:00
Scott Shawcroft 4146d6f872
Merge pull request #2890 from jepler/nrf-audio-tick
nrf: put supervisor enable/disable tick in place
2020-06-01 15:51:22 -07:00
Sean Cross aac5a4f178 watchdog: use common_hal_watchdog_* pattern
This pulls all common functionality into `shared-bindings` and keeps
platform-specific code inside `nrf`. Additionally, this performs most
validation in the `shared-bindings` site.

The only validation that occurs inside platform-specific `common-hal`
code is related to timeout limits that are platform-specific.

Additionally, all documentation is now inside the `shared-bindings`
directory.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:38:29 +08:00
Sean Cross 5edc29c6a5 nrf: microcontroller: use port reset path
For `microcontroller.reset()`, don't manually call NVIC_SystemReset().
Instead, call the `port_reset()` in case the port wants to do any
cleanup.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross c7efc94a33 watchdog: move timeout exception to shared-bindings
Make this exception globally available to all platforms that have
enabled the watchdog timer.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross 108409c6cd nrf: common-hal: finish reworking exceptions
This finishes the rework of the exception handler, which is once
again stored inside the watchdog timer module.

This also implements a `watchdog_reset()` that is used to disable the
RAISE watchdog, if one is enabled.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross bd086a102e Revert "add WatchDogTimeout exception"
This reverts commit 561e7e619095869f58fc728d428f3ff20e8bfc40.
2020-05-27 11:28:49 +08:00
Sean Cross 589cb1af6d nrf: watchdog: use nrfx_wdt driver
Instead of directly poking registers, use `nrfx_wdt`.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross 08362c9cab watchdogtimer: refactor to new api
This refactors the WatchDogTimer API to use the format proposed in
https://github.com/adafruit/circuitpython/pull/2933#issuecomment-632268227

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00