Commit Graph

440 Commits

Author SHA1 Message Date
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
Sean Cross ae950bc050 add WatchDogTimeout exception
This adds an exception to be raised when the WatchDogTimer times out.

Note that this currently causes a HardFault, and it's not clear why it's
not behaving properly.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross 8f46133917 nrf: watchdog: implement software watchdogtimer
This adds a software WatchDogTimer implementation that can be used for
testing.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross 595f6387c2 watchdog: rename module from `wdt` and move to `microcontroller`
This also places it under the `microcontroller` object.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross abd01c5fbb nrf: add watchdog module
Add common-hal bindings to allow the watchdog module to be used
on nrf platforms.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:48 +08:00
Scott Shawcroft ba724fffb4
Merge remote-tracking branch 'adafruit/master' into esp32s2_digitalio 2020-05-20 10:48:27 -07:00
Scott Shawcroft fd0420d432
Update digitalio api for other ports 2020-05-20 09:23:42 -07:00
Sean Cross c1bcc25b88 nrf: _bleio: clean up timeout calculation
The timeout value is calculated by the common-hal layer now, so we don't
need to be quite so clever about calculating it here.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-19 21:56:39 +08:00
Sean Cross 34f91f01c6 bleio: adapter: add advertising timeout and status
Add a field to allow specifying a timeout when initiating advertising.
As part of this, add a new property to determine if the device is still
advertising.

Additionally, have the `anonymous` property require a timeout, and set
the timeout to the maximum possible value if no timeout is specified.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-19 15:01:19 +08:00
Sean Cross cfe65742a3 _bleio: support anonymous advertising
Add a new parameter to the `start_advertising()` function to enable
anonymous advertising.  This forces a call to `sd_ble_gap_privacy_set()`
with `privacy_mode` set to `BLE_GAP_PRIVACY_MODE_DEVICE_PRIVACY` and
`private_addr_type` set to
`BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE`.

With this, addresses will cycle at a predefined rate (currently once
every 15 minutes).

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-19 15:01:18 +08:00
Scott Shawcroft 2c2b53303d
Merge pull request #2837 from k0d/serial-debug
Add support for a debug console, such as ST-Link VCP.
2020-05-18 18:13:31 -07:00
Mark Olsson 007c92ee6a Enable showing the console on a debug uart 2020-05-19 02:02:52 +02:00
Sean Cross 83680c41db nrf: rtc: persist rtc offset across reboots
Store the RTC value in the .uninitialized section, but make sure to
flank it with some known values.  That way we can determine if the RTC
value has been initialized, or if it's random uninitialized garbage.

As part of this, add a `common_hal_rtc_init()` routine to determine if
the value is correct, or reset it to 0 if it is not valid.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-18 11:52:27 +08:00
Dan Halbert b7836aeac6 address review comments 2020-05-04 19:51:08 -04:00
Dan Halbert bae7a5e433 make translate again 2020-05-04 17:26:59 -04:00
Dan Halbert d6c6f9f4f0 add PacketBuffer .incoming_ and .outgoing_packet_length 2020-05-04 15:59:45 -04:00
Dan Halbert f3078511a6 further cleanup and bug fixing 2020-04-29 23:18:08 -04:00
Dan Halbert 3d62f87e29 back to '.packet_size' for compatiblity 2020-04-29 22:10:56 -04:00
Dan Halbert 84cee1ab8d rename and improve PacketBuffer packet length property 2020-04-29 17:49:31 -04:00
Scott Shawcroft 755d404edf
Merge remote-tracking branch 'adafruit/master' into lower_power 2020-04-27 16:45:10 -07:00
Dan Halbert fbc8719fad ringbuf tested 2020-04-21 22:40:12 -04:00
Dan Halbert 77cd93ac2d merge from adafruit 2020-04-21 17:47:51 -04:00
Dan Halbert 38ec3bc574 further ringbuf cleanup 2020-04-21 17:38:20 -04:00
Sean Cross c04e6d6f52 nrf: bleio: parameterize softradio configuration
Allow for setting various softradio memory settings as part of a
board in order to support lower-memory configurations.  If a
parameter is unspecified then the previously-defined value is used.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-04-21 12:29:59 +08:00
Sean Cross 3ed5b87b8f nrf: add support for nrf52833
This adds preliminary support for the nRF52833, which is a variant of
the nRF52840 with half the RAM, half the flash, and fewer peripherals.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-04-21 12:29:56 +08:00
Scott Shawcroft bebf27e733
Merge remote-tracking branch 'adafruit/master' into lower_power
This isn't perfect and needs a bit more testing.
2020-04-20 18:25:13 -07:00
Jeff Epler 5fcc6d6286 RGBMatrix: finish renaming from Protomatter
This gets all the purely internal references.  Some uses of
protomatter/Protomatter/PROTOMATTER remain, as they are references
to symbols in the Protomatter C library itself.
2020-04-17 18:44:07 -05:00
Jeff Epler 3d6258f63d Rename Protomatter -> RGBMatrix
This is a quick rename, it changes the user-facing names but not the
internal names of things.
2020-04-17 18:43:57 -05:00
Jeff Epler a32337718d Rename _protomatter -> protomatter
I originally believed that there would be a wrapper library around it,
like with _pixelbuf; but this proves not to be the case, as there's
too little for the library to do.
2020-04-17 18:43:57 -05:00
Scott Shawcroft b580b34cbf
Merge remote-tracking branch 'adafruit/master' into lower_power 2020-04-14 17:14:44 -07:00
Jeff Epler 1d8a073c05 nrf: protomatter port 2020-04-14 18:24:58 -05:00
Scott Shawcroft 7e69d30c02
Fix nRF PulseIn 2020-04-03 14:22:56 -07:00
Scott Shawcroft 8fe512c7e9
Merge remote-tracking branch 'adafruit/master' into lower_power 2020-03-31 15:13:58 -07:00
Scott Shawcroft 8a5d3cd6c4
Add exception on small buffer and fix Connecion WRITE handling 2020-03-25 17:41:47 -07:00
Scott Shawcroft 3551b769a2
Fix connection handle tracking in PacketBuffer when a server. 2020-03-25 13:31:18 -07:00
William Moser c961ed9025 Added 31250 and 56000 to baudrate_map in UART.c, to parallel definitions in nrfx/mdk/nrf*_bitfields.h files 2020-03-24 13:25:02 -04:00
Scott Shawcroft 76ca13b6ed
Fix SAMD51 pulsein 2020-03-13 17:21:15 -07:00
Scott Shawcroft 48b5f2a384
Initial work on SAMD 2020-03-13 11:16:41 -07:00
Scott Shawcroft affd3fcc2a
Clear the pending IRQ in the NVIC as well. 2020-03-13 11:16:38 -07:00
Scott Shawcroft 00d5f63e7c
Hopefully fix PulseIn 2020-03-13 11:12:31 -07:00
Scott Shawcroft ed5cdd7e09
Hopefully fix flash flush and hopefully audio as well. 2020-03-13 11:12:31 -07:00
Scott Shawcroft 418333979a
Fix autoreload, neopixel, monotonic_ns and sleep w/o SD 2020-03-13 11:12:31 -07:00
Scott Shawcroft 6f60afe8c5
First try at lowering the power consumption 2020-03-13 11:12:30 -07:00
Dan Halbert 8435935429 update uses of assert_pin_free; remove redundant checks 2020-02-29 15:37:32 -05:00
Dan Halbert b6206406de new pin validation routines; don't use mp_const_none if NULL will do 2020-02-28 23:43:04 -05:00
Scott Shawcroft 28c7a1e9c3
Fix crash after empty REPL session
We were trying to reset bluetooth when it was off and then trying
to raise an exception without the heap.
2020-02-24 16:11:17 -08:00
Dan Halbert f63b2c0d0c use realloc instead 2020-02-21 17:36:15 -05:00
Dan Halbert 9cf46ec947 put neopixel_write buffer in root pointers 2020-02-21 08:44:25 -05:00
Dan Halbert 23d6a3dc1f merge from upstream 2020-02-20 22:27:16 -05:00