- 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++
- Updated all references in microbit-dal to use this refactored API.
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
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
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.
- Enures an event listener is not deleted whilst a fiber is activiely processing a queue
- Added support for resurrection of event listeners in cases where identical listeners are removed/added repetitively.
- Add maximum depth for event queues, to prevent buggy scripts causing total memory exhaustion.
- Suppress generation of A/B click events when A+B click is generated
- preservation of event ordering on messagebus for resursive event generation cases.
- bugfix of message bus processing to prevent occasional dual processing of events
- bugfix MicroBitDisplay to behave correctly when delay parameter is zero.
NOP/clamping behaviour out of teh micro:bit runtime and into the glue layers of higher level
- Updates to many functions to provide explicut return codes.
- Updates to many functions to remove heuristic calidation (NOP/clamping/defaults)
- Updates to ErrorNo.h to provide clearer return values, and place return values in a better scope
- Updates to MicroBitDisplay to use enums where appropriate.
Updates to change the behaviour of the scroll/print/animate faily of function away
from being pre-emtive and instead prroviding queing behaviour.
Minor updates to provide complete sets of async equivalent operations
Updates to the scheduler to provide wait/notify/waitone semantics.
First functionally complete BLE profile, matching BLE speicfication v1.6.
More specifically, the following services are now functional:
Also, updates to underlying device drivers to enable greater configurability:
- MicroBitCompass now supports variable sample rates and temperature sensing
- MicroBitAccelerometer now supports variable sample rates and ranges
- MicroBitThermometer introduced
- MicroBitMessageBus adapted to permit enumeration and block removal of listeners
Finally, MicroBit DFU Service has been changed to the new UUIDs specificed in v1.6 of BLE spec.
- renamed fiber flag to be more general.
- renamed idle to idleFiber to be consistent with the rest of the code.
- factored content of idle() into a funciton to avoid dupication.
- added test case to MessageBus::process() to avoid forking fibers if not requested.
- removed fiber_allow_run_idle_within mutator in favour of exposing currentFiber, as a more general solution.
Added new URGENT listener type, that ensures immediate, non queuing delivery of events.
Introduced two-pass algorithm into message bus. Only events with an event listener are now
queued at ingress - this reduces unecessary memory usage for 'uninteresting' events.
Events in the micro:bit runtime are normally launched through making an instance
of the MicroBitEvent class. This update added configuration support to all the
code creating the MicroBitEvent decide if the newly created event should then be
automatically queued on the MessageBus or processed immediately by event handlers.
MessageBus handlers can now have one of four concurrency modes for the eventuality
of an event being raised whilst a previous event is still being processed. An additional
(optional) parameter is provided to the listen() functions to allow this to be selected
on a per event handler basis. The permissable options are:
The event handler is fired with the new event, regardless of whether or not
a previous event is still be processed by that handler.
The new event is queued until such a time as the previous event has completed
execution. The new event is then processed. This option does not preclude the
processing of the new event by other event handlers.
The new event is dropped, and will never be processed the the event handler.
This option does not preclude the processing of the new event by other event handlers.
The event handler is self-declaring that it never blocks. This flag is used purely
for optimisation, as it permits direct execution of the event hadnelr without inducing
any overhead from the scheduler.
In addition, the following minor revisions were made in this release:
* Cleanup of the #include dependencies contained in the microbit-dal .h files
* Bugfix to the scheduler block on event matching code.
* Introduced a MICROBIT_ID_ALERT MessageBus channel, for general purpose eventing using nonces.
This release contains a widespread set of updates and optimisations to the micro:bit
runtime, with a view to reducing the SRAM footprint of the whole system. This is to
provide as much usable HEAP storage for application programs as possible.
Specific updates and optimisations include:
- Additional compilation flags to allow the core micro:bit runtime to be configured.
These are defined in MicroBitConfig.h
- A custom heap allocator. This is now included for two reasons:
1) To provide a simple mechanism to to utilise both the mbed heap space and other memory
regions (such as unused memory in the SoftDevice region) as a single virtual heap.
2) To address some issues that have been noted that are attributable to heap fragmentation.
The micro:bit heap allocator has a simple algorithm, but one that is chosen to respond
well to the relativelt high 'heap churn' found in the micro:bit environment.
All micro:bit components and user programs now use this heap allocator trasparently.
- Updates to BLE services to remove persistent references to their GATT services. This consumes
vast amounts SRAM, rather unecessarily. Instead only handles to the relevant GATT characteristics
are now stored. This specifically includes:
- Updates to the Fiber scheduler to save SRAM. More specifically:
+ Removed the need to hold an empty processor context to intialise fibers.
+ The IDLE fiber now runs without a stack
+ fiber stacks are now only created when a fiber is descheduled for the first time, thereby reducing heap churn.
+ the 'main' fiber is now recycled into the fiber_pool if it leaves app_main()
+ fibers created through invoke() now only maintains the necessary part of teh parent stack that is needed, thereby
reducing the stack size of spawned fibers.
- Updates to the Message Bus to reduce the overall memory footprint of processing events. More specifically:
+ Event handlers are now always called using invoke(), such that non-blocking event handlers no longer need
a dedicated fiber to execute - thereby saving SRAM and processor time.
+ Processing of events from the event queue is now rate paced. Events only continue to be processed as long as there
are no fibers on the run queue. i.e. event processing is no longer greedy, thereby reducing the number of fibers
created on the runqueue.
- Updates to BLUEZOENE code to bring up core BLE services even if they are not enabled by default. This allows
programs that do not require BLE to operate to benefit from the full range of SRAM, whilst still allowing the
device to be programmed over BLE.
- Updates to the Soft Device initialisation configuration, reducing the size of the GATT table held in the top 1.8K
of its 8K memory region to around 800 bytes. This is sufficient to run the default set of BLE services on the micro:bit
so the additional memory is configured as HEAP storage by MicroBitHeapAllocator.
- Minor changes to a range of components to integrate with the above changes.
+ rename of free() to release() in DynamicPWM to avoid namespace collision with MicroBitHeap free()
+ rename of fork_on_block to invoke() to enhance readbility.
- Many code cleanups and updates to out of date comments.
Updates the MicroBitMessageBus implementation to use fork_on_block() calls rather
than create_fiber() calls when servicing events. This provides greater optimisation
for non-blocking event handlers.
More specifically, this update:
- Replaces calls to create_fiber() ith fork_on_block during event send operations.
- Adds a queue of events, to ensure events generated from interrupt context are not serviced in interrupt context.
- Registers a listener with the idle process to empty the event queue.