- Factored periodic timer funcitonality out of fiber scheduler and into a new SystemTimer module module.
- Enapsulated "ticks" variable within SystemTimer module, with accessor funciton.
- Added accessor/mutator functions to get and set the tick period.
- Added a class wrapper to permit periodic callbacks to both C and C++
functions.
- Updated all references in microbit-dal to use this refactored API.
Previously, we would rely on service changed to complete successfully
to signify a successful cccd state restore.
However, android doesn’t register for service_changed notifications,
and as a result sd_ble_gatts_service_changed always returns an error.
This meant that cccds would be erased when the complete flag was not
one, which would have been all the time.
Updates to MicroBitButton and MicroBitMultiButton to align the API through
which CLICK events are filtered. Also, updates to the mechanism through which
buttonA and buttonB CLICK/LONG_CLICK events are filtered by
MicroBitMultiButotn to reduce RAM footprint.
No changes to external behaviour of these classes.
This commit introduces a wait_ms before entering DFU mode to allow soft
device to communicate to an android handset that the current connection
should be terminated.
This commit addresses a number of outstanding issues:
* whitelisting behaviour, form the nrf51-sdk, where an address and an
irk were added to the whitelist
* bond management bugs, from the nrf51-sdk, where one device would
replace another.
closes#57, closes#56, closes#58, closes#59, closes#44, closes#60
Re-pairing the same BLE device under SoftDevice 8.0 Nordic SDK 10 appears to
add a second entry to the bonding table when private resolvable addresses are
used by the central device. This adversely affects whitelisting, as only the
first added matching entry will be succesfully added to the whitelist. i.e. A
central device will no longer be able to connect to a micro:bit after pairing
a second time as the older bond will take prescedence.
Althoguh reported to Nordic, a long term fix is not immediately forthcoming.
This patch applies a workaround, by simply reversing the order of the
whitelist before use. As the list is maintained in the order of insertion,
reversing the list guarantees that the entry added to the whitelist will be
the most recently bonded one for any given peer.
before resetting
Requests made for an optional timeout function to define the period of time in
which the device will remain in a panic state. This patch introduces a
setErrorTimeout() method with this functionality.
MicroBitMultiButton now provides an indication to MicroBitButton instances when an application is actively utilising that button as part of a button group. This
permits that MicroBitButton to more accurately filter events, and provide a
consistent abstraction.
More specifically, this patch:
- Extends the MessageBus functionality to indicate when listeners are
attached to events. This allows components to perform on demand tailoring
of their behaviour.
- Extends MicroBitMultiButton to indicate to relevant MicroBitButton
instances when they are part of a button group.
- Extends MicroBitButton to perform filtering of button events dynamically
(rather than statically) when part of a MultiButton group.
- Code cleanup of static functions that are more cleanly implemented as
methods.
Updates to MicroBitConfig options and initialisaiton code of the BLE stack to
allow Soft Device's GATT table to be of a given size. If this size is smaller
then the default, the runtime will reclaim that that memory as heap storage.
The nordic implementation of the mbed whitelist API introduces entries into
the table that are not bonds. This patch corrects an assumption in
microbit-dal that the number of entries in the bond table table corellates
with the number of bonds.
The BLE security options mandated for child protection can be highly
detrimental to the development process for new BLE services. This patch
introduces a configuration option to disable BLE security for this purpose.
Default BLE security settings remain unchanged.
Datagram receive code incorrectly calculated the payload length, resulting in
packets being delivered to applications that were two bytes shorter than they
should be.
This commit introduces persistent storage for the compass between
device resets.
setCalibration now also stores the data in FLASH if it differs from
what it contains.
In source/MicroBitSuperMain.cpp, the data is restored if there is
persistent data available that is non-zero.
(i.e. x, y and z are NOT zero).
This ensures that users can code without interference from persistent
storage.
There is an issue (https://github.com/bbc/microbit-extras/issues/2755)
whereby CCCD data is required to be persisted through device resets.
This commit integrates the new MicroBitStorage class, and persistently
stores this information in flash.
P.S. what a long night!
Integrated simple 1K block buffer to host small amount of persistent
data and a 1K FLASH memory block located immediately below the FOTA/DFU
bootloader and APPDATA region that intended to hold core configuration
information, such as:
* BLE bonding information.
* Compass Calibration data.
* Thermometer Calibration data.
The block is resident at 0x0003B400 - 0x0003B800.
The impact of the pixels at lower values was not distinct enough
this commit adds a blocking wait for the first two timings for
greyscale.
Additionally, this commit modifies the timings const array to
take into account the time taken for renderGreyscale to execute.
Previously the DAL relied upon an implementation of a timer that
was very imprecise and lacked resolution, this commit adds a reference
to a frozen repo with us_ticker.c modifications, so that a higher resolution
timer is utilised.
This fixes#13 (finally), and also fixes lower brightness levels when using
DISPLAY_MODE_BLACK_AND_WHITE to not cause a device lockup.
Missed a zero in a previous commit, that caused a system lockup due to
a missed timer event.
This commit also changes the minimum display brightness to 4, to also
minimise another feature that needs fixing in the future, where the
timer does not interrupt in the expected time frame.
Previously the range of MicrobitLightSensor read() was 0 - 100,
this didn't align with other APIs.
The new range is 0-255 which aligns with display brightness to give
a more consistent overall API.
Previous revisions of microbit-dal would handle the case of a bonding request
when the bond table was full by attempting to purge the bonding table on
demand. This suffered two flaws:
1) Nordic's device manager does not support the purging of the bonding table
while a connection is active (including a pairing request).
2) Some devices (e.g. Android 4.4.2 take two entries in the bonding table
when paired), thus making predictions of how 'full' the table is challenging.
This patch employs a simpler replacement policy. The maximum size of the bond
table has been increased to 6 (from 4). However, if the bond table contains 4
or more entries when entering pairing mode it will be purged in advance of any
pairing requetss being initiated.
* This commit fixes an exposed member variable
that was not intended to be public 'tickPeriod'
* normalised the light level to return values between 0 - 100
The BLE stack locks out the CPU for long periods of time when necessary. This
can be alleviated by eans of a flag that release the CPU between radio events.
(BLE_COMMON_OPT_RADIO_CPU_MUTEX).
This can cause issues from applications with tighter timing requirements.
This patch only enables this MUTEX when a BLE connection is active, rather
than automatically at startup. Therefore, application that do not actively use
BLE will not suffer this penalty.