On NRF, the `rtc_reset()` function is never called. As a result,
calls to `time.time()` return a cryptic error>
```
>>> import time
>>> time.time()
'' object has no attribute 'datetime'
>>>
```
This is because `MP_STATE_VM(rtc_time_source)` is not initialized
due to `rtc_reset()` never being called.
If `CIRCUITPY_RTC` is enabled, call `rtc_reset()` as part of the
`reset_port()` call. This ensures that `time.time()` works as expected.
Signed-off-by: Sean Cross <sean@xobs.io>
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>
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>
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>
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>
Circuit Python supports saving a single word of data across reboots.
Previously, this data was placed immediately following the .bss.
However, this appeared to not work, as Circuit Python zeroes out the
heap when it starts up, and the heap begins immediately after the .bss.
Switch to using the new .uninitialized section in order to store this
word across resets.
Signed-off-by: Sean Cross <sean@xobs.io>
Previously, it was placed following .bss. However, now that there is a
new section after .bss, the heap must be moved forward.
Signed-off-by: Sean Cross <sean@xobs.io>
This section immediately follows the .bss section, and is designed to
contain uninitialized variables that should persist across reboots.
The section is placed directly after .bss, under the theory that the
size of Circuit Python's .bss + .data is bigger than the bootloader's
.bss + .data, so there is less likely to be a conflict.
Signed-off-by: Sean Cross <sean@xobs.io>
SPIM3 is faster than all other SPI blocks, and is capable of generating
a 32 MHz clock. However, it cannot be used at the same time as the BLE
radio without dedicating an additional 8 kB of RAM to it.
Therefore, some boards may want to disable this. Support pre-defining
NRFX_SPIM3_ENABLED on the command line to disable it on some bords.
Signed-off-by: Sean Cross <sean@xobs.io>
Simmel had USB HID disabled in order to save space. However, the board
configuration did not set USB_DEVICES, causing it to inherit the default
device bouquet of MSC,CDC,MIDI,HID. This in turn caused HID to be included
in the USB Configuration Descriptor.
For some reason, this was not a problem in an earlier version of tinyusb or
circuitpython. However, in the most recent version this has rightfully
caused asserts to appear during configuration.
Re-enable USB_HID for now, as it doesn't add too much in terms of space.
We may disable it again later on if we become pressed for space.
Signed-off-by: Sean Cross <sean@xobs.io>
This was not added as part of the initial v7.0.1 patchset because
.hex files are in this project's .gitignore, and so git ignored it.
Signed-off-by: Sean Cross <sean@xobs.io>
Previously, we were using v6.1.1 which worked, but was unsupported.
v7.0.1 is the first version of s140 that supports the nRF52833.
Signed-off-by: Sean Cross <sean@xobs.io>
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>
Conditionally set variables such as the softdevice RAM size, bootloader
size, and the spi m3 buffer size. This allows ports to adjust these
values to suit their needs.
Signed-off-by: Sean Cross <sean@xobs.io>
The BLE Config area needs to be subtracted from the size of the firmware.
THis is because the firmware is counted by walking backwards from the end
of memory, and the BLE config area is placed lower in memory than the
firmware. Subtracting the BLE config size ensures the internal flash
filesystem doesn't try to use the firmware as storage.
Signed-off-by: Sean Cross <sean@xobs.io>
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>
Ports can set CIRCUITPY_RGBMATRIX and CIRCUITPY_FRAMEBUFFERIO to 0
in their .mk file in order to prevent these from being built. This
is necessary for resource-constrained devices.
Signed-off-by: Sean Cross <sean@xobs.io>
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.
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.
The backlight enable is active low on our board so the driver doesn't like it.
Toggling to GPIO manually for now.
As fixed the improper SPI bus pins definitions and it works!
Signed-off-by: Michael Welling <mwelling@ieee.org>