Added rise, fall, pulse HI and LO events.
The pulse Hi and LO event timestamp given in the MicroBitEvent is the
duration for which the input was HI or LO for.
eventOn(int eventType) is used to configure the events generated
from the pin instance.
Added an mbed Timer instance to maintain a microsecond level timestamp.
Added a function system_timer_current_time_us() which now returns the
time since power on in microseconds.
MicroBitEvents now call system_timer_current_time_us() giving
microsecond level timestamps.
There was a perspective mismatch with the UART service, where the
actual buffer size given in the constructor, did not reflect the size
of the user buffer that was available to the application. This was not
documented, and hence cause confusion. The patch applied in this
commit, increments the given buffer sizes by one, so that the
application buffer has the available size given in the constructor.
Additionally, some configuration options were lost during the component
refactor, these have now been restored.
fiber_wake_on_event used to crash after forking a FOB fiber.
It would attempt to obtain a new fiber context, and would place it on the wait queue.
Then when that fiber was paged in, the context of that fiber would not have been
initialised, as the function presumed schedule would be called immediately after
This patch catches that edge case.
The MicroBitDisplay::animate() and MicroBitDisplayAnimateAsync() function both
assumed that the display should be cleared once the requested animation was
This patch allows the user to control this funcitonality through an
addiitonal, optional boolean parameter to the animate() and animateAsync()
The default THREADING_MODE for event handlers is typically set to run through
the scheduler. However, it is possible to create and operate a MessageBus without the scheduler being initialised.
This patch changes the behaviour of the MessageBus to treat all registered
listeners as MESSAGE_BUS_LISTENER_IMMEDIATE (i.e. directly called) if no
scheduler is present. This default allows for a more user friendly experience
in this case.
There was a bug with Bluetooth pairing. If a user were to bond with the
micro:bit, and the KeyValueStore region had not been configured, the
class would attempt to write to flash in interrupt context, which
conflicted with soft device.
The fix is to do this initialisation in the constructor for
Added condition into MicroBitMessageBus::process(), such that all event
listeners are diretly invoked if no scheduler is present.
This provides a best effort base case for builds running without a scheduler.
MicroBitImage::paste() now assumes the image to be pasted should be positioned
at the top left of the image by default, with no transparency.
MicroBitImage::print() now assumes the char to be printed should be positioned
at the top left of the image by default.
The C type system connaot easily distinguish integer literals from character
literals. To promote a simpler API, the print() overload for numeric values
has been replaced with an explicit printChar() method.
Print operation on single byte strings have been ammended to act consistently
with printing a single digit.