Integration of new radio mode that permits simple local area multicast communication
directly between micro:bits using the device's on board radio hardware.
It should be noted that this implementation build directly on the nrf51822
hardware. It is not a BLE protocol, and must (currently) be operated with BLE
disabled.
A standard on the wire configuration is defined, to promote future
interoperability between projects and languages. A lightweight
packet format is also defined and adhered to, so as to promote future
extensibility without sacrificing compatibility. The notion of groups is also
introduced, that enable multiple groups of children to work in the same area
without compromising each other's projects.
In adition to a low level packet radio driver, two higher level protocols are
defined that allow simple user datagram communication between micro:bits and
an EventBus protocol that allows the micro:bit's MessageBus to be extended to
other micro:bits.
New registered eventcodes added for:
- Game controller functions in the micro:bit app
- General broadcast event ID in preparation for broadcast radio capability
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
changed.
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
devices.
As per https://github.com/lancaster-university/microbit-dal/issues/83 the comment in the MicroBitI2c.h file lacked context around a known hardware glitch. This commit rectifies this issue by adding a link to a collection PDF providing a more detailed explanation.
calibration
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.
Added MicroBitConfig.h option to enable/disable whitelisting
Added MicroBitConfig.h option to enable/disable limited period advertising
Added support for limited period advertising
Minor code cleanups
See bbc/microbit-extras/issues/#1100 or lancaster-university/microbit-dal/issues/5 for full details.
Summary:
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.
Replaced newer struct-style initialisation of CompassSample in MicroBit.cpp
with the more traditional constructor-style initialisation, to enfore
C98 compliance.
Closes#74
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
channel.
Based on the previous commit, the api for MicroBitPin
has two new accessor methods:
* getAnalogPeriodUs
* getAnalogPeriod
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.
Previously there would be the possibility of the period being reset
each time a new DynamicPwm was instantiated. This has now been
removed from the constructor, and the comments have been updated