Added a new class called MicroBitLightSensor which interleaves sensing
with the display.
This class takes advantage of the previous commits which add a dynamic
system tick, and a new display mode for the display.
A future optimisation would be for the display to handle the instantion
of a light sensor when the display mode is changed!
This commit adds a mutator that dynamically reconfigures the
systemTicker to call systemTick at a different period to the default.
The accessor returns the current tick speed in milliseconds.
The accessor is now also used in scheduler_tick to keep timing as
accurate as possible.
MICROBIT_DISPLAY_REFRESH_PERIOD has now been removed, and replaced with
This commit introduces a new display mode,
DISPLAY_MODE_BLACK_AND_WHITE_LIGHT_SENSE, where the 4th render in
every “frame” is dropped allowing for other components that use the
display to use this dropped frame for processing. This is in
preparation for Light Sensing on the 5x5 LED matrix.
An accessor has also been added to MicroBitDisplay to check the current
BLE maintains metadata on its characterisitics, some of which record whether
or not a central device (phone/tablet) wishes to receive notifications when a
given BLE characteristic changes value. One such characterisitic is used as
part of a core BLE service to indicate of the BLE profile of a device has
IOS is heavily reliant on this feature, and expects the state of this metadata
to be persistent across device reboots. This patch ensures that this metadata
is always set to allow Service Changed indications to be propagated to central
MicroBitCompass initiates a calibration procedure on demand if a heading is
requested from an uncalibrated device. The BLE MagnetometerService also
attempts to retrieve a heading periodically, but it is not good behaviour to
initiate calibration as a response to this.
This patch introduces a check such that the BLE MagnetometerService will only
attempt to read heading data from a previously calibrated compass.
BLE central devices (such as mobile phones/tablets) are permitted to cache the
list of services and characteristics provided by a BLE peripheral such as the
micro:bit. This was causing compatibility problems with IOS during FOTA
flashing, as the the list of BLE services may change after flashing.
The Nordic BLE stack contains a fixed size bond table - a list of devices that
have paired with our device (in the case the micro:bit). The default mbed
wrapper around the nordic stack does not account for the case where the bond
table is full.
This patch implements basic bounds checking within the MicroBitBLEManager so
that this table cannot overrun. If a new device attempts to pair when the bond
table is full, the table is emptied prior to completing bonding.
Added configuration option in MicroBitConfig to allow the default power level
to be defined. Based on experiments undertaken by the BBC and subsequent policies defined by
the BBC's child protection panel, to is set by default it's lowest level (0),
in order to protect children's privacy.
It should be noted that this is 30dB below the device's default setting, so will
inevitably leave the device more susceptible to interference, and therefore
significantly reduce the reliability of the device. This will likely present
itself through increased packet loss, reduced thorughout, lost data and
connection drop outs. The normal BLE power level on commercial devices
translates to power level of 6.
The author has witnessed an inability to connect to a micro:bit from a
distance of 40cm under domestic conditions using a Samsung S5 mini
running Android 4.4.2.
See bbc/microbit-extras/issues/#1100 or lancaster-university/microbit-dal/issues/5 for full details.
A stride of 0 would lock the calling fiber indefinitely, which was not the expected behaviour
for many people.
This update fixes this issue in both animate and scroll, returning immediately when there is
a stride of zero.
issue #73 highlighted an issue whereby the destruction of an instance
registered as an idle or system component, would result in a hardfault.
This was due to not deregistering idle or system callbacks.
This patch has been applied to all components currently in use by the
idle or system callbacks.
The destructor for MicroBitButton didn't take into account the fact that
an instance can be destructed after registering a callback. This would then
result in a HardFault if an instance was destructed.
A clear repro case was registering a Touch input on a pin (abstracted as a button)
and swapping to a DigitalIn.
* Added a number of #defines to MicroBitPin.h which ultimately lead to retabulation of the #defines
* Added two new instance methods:
- setServoValue() which sets the default servo period (20ms) and accepts a value in the range
0 - 180, which maps to a duty cycle between 5% and 10% respectively. This
mapping is also configurable.
- setServoPulseUs() which accepts a pulse width in microseconds, and maps it onto the PWM
Based on the previous commit, the api for MicroBitPin
has two new accessor methods:
There are also whitespace changes in the MicroBitPin head file
as well as some minor textual changes.
This commit introduces an initial draft fix
for a bug where it would take two "setPeriods" for the
PWM class to update to the expected value.
This commit also adds three new methods to a DynamicPwm instance:
* write() - which is a lightweight wrapper around PwmOut write,
so that the value can be trapped. The trapping of the value
is necessary for the bug fix.
* getPeriod() - which returns the value of a static variable,
containing the current period shared across the pwm bus.
* getValue() - which returns a scaled value in the range 0-1024
representing the current duty cycle.
Dynamic pwm previously didn't round robin transient pwm channels,
and would therefore bias towards the first transient channel it found.
This update ensures that there is now an equal opportunity for all
channels to be considered for redirection.
Events listed recorded in MESEvents.h were enumerated from zero.
This is not ideal, as MicroBitMessageBus uses a code of zero for
MICROBIT_EVT_ANY - a wildcard mechanism to register interest in all events
from a given ID.
All event values recorded in MESEvents.h have therefore incremented.