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.
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
fiber initialisation.
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
complete.
This patch allows the user to control this funcitonality through an
addiitonal, optional boolean parameter to the animate() and animateAsync()
functions.
There was no common place to track event codes used in Events intended
for the shared channel using the ID MICROBIT_ID_NOTIFY. This commit
adds a common place for these Event codes.
Updated parameter of scheduler_init() to accpet a reference to an EventModel,
rather than a pointer. This is simply to promote consistency with the other
components.
- Introduction of core, drivers, types and bluetooth folders in source and inc
- Added all inc subfolfers to the search path
- Removed MicroBit.cpp and MicroBit.h (yay!)
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.
MicroBitSerial now uses a #define in MicroBitConfig.h to configure the default mode
for send and read calls.
send(char c, MicroBitSerialMode mode) has now been renamed to sendChar(char c, MicroBitSerialMode mode),
which means if users want to send an integer as a char, they have to do so explicitly.
MicroBitRadioDatagram
- Added constructor into managedString to allow conversion from PcketBuffer
- Added overload of MicroBitRadioDatagram::send() to accpet a string
Previously, MicroBitSerial inherited from Serial, which had a large
memory overhead.
n.b. This is due to a setbuf call in the underlying stdio library that
mallocs a massive struct, which is largely unused.
MicroBitSerial now inherits from RawSerial, which doesn’t use any
setbuf calls, thus reducing the static memory overhead of
MicroBitSerial to 8 bytes (448 bytes), when unused.
The definition for SERIAL_DEBUG in MicroBitConfig has now been updated
to use RawSerial instead of Serial.
Added additional information for the arrangement memory for a
KeyValueStore in persistent storage.
Also moved the storage page to an unused page after the BLE bond data,
and the scratch page to where application storage page was previously
located.
Added a new call fiber_wake_on_event which does not call schedule. This
means that execution continues after the context has been set until the
next use of schedule (i.e. fiber_sleep).
Removed references to direct nrf51 sdk calls, in favour of the mbed
PortOut class, which provides equivalent functionality whilst remaining
platform agnostic.
- moved all device specific utility funcitons into MicroBitDevice.cpp
- moved compass calibration funcitonality into a dedicated class
- moved panic() from MicroBitDisplay into MicroBitDevice
- introduced inline utility functions into MicroBit to promote a degree of
backward compatibility and easy of use.
- updated panic() to use platform agnostic mbed calls.
- Updates to ordering and default values for component constructors to improve
consistency, and to common default default values for parameters where
applicable.
- Updates to MiroBitDisplay MatrixMap to record physical geometry in addition
to logical geometry of LED matrix display layouts. This removes the need for
explicit (and unecessary) definition of display size by the user.
This implementation uses a circular buffer for both transmission and reception of data.
There are a number of new methods:
* redirect - which dynamically redirects the output of the serial module
* eventOn and eventAfter - which fire events based on delimeters, or x number of characters.
* operations on the circular buffers.
A main difference is the ability to select the mode you want to perform your operation in:
* ASYNC - reads directly from the circular buffer, returning immediately.
* SYNC_SPINWAIT - spins whilst reading from the circular buffer.
* SYNC_SLEEP - blocks the current fiber, but doesn't lock out the processor,
whilst reading from the circular buffer.
This should support a wide variety of operations. To see more specific details of the different methods,
it is advised to read the doxygen comments for each method.
MicroBitStorage accepts both ManagedString and char * variants, this
caused ambiguity at compile time, and meant that the ManagedString
variant was never selected when given character literals. This meant
that the only way to access the ManagedString variant, was to explicitly
wrap the character literals.
This applies to:
* put
* get
* remove
The fix was to apply a const prefix to all member functions accepting
a char *.
Previously, MicroBitThermometer was always added to fiber_components,
even in the case where it wasn't actually in use.
This commit introduces a similar behaviour to that introduced to the compass
and accelerometer classes in previous commits, where these components
are only added to fiber_components when in use.
Similarly, MicroBitThermometer now has an exposed updateSample() member
function that can be used to manually drive temperature updates, if
the fiber scheduler is not in use.
MicroBitThermometer now persists data using MicroBitStorage. An instance
of MicroBitStorage must be given at construction, if data is required to
be persisted.
The ability to calibrate the thermometer using an offset has been added
as well, produces the data that is then persisted by MicroBitStorage.
MicroBitStorage used to rely on a static struct as a memory
map when writing to flash "MicroBitConfigBlock", this solution
was constraining, and not fit for general purpose.
Whilst modularising the runtime, a cyclic dependency between
MicroBitStorage and MicroBitCompass was discovered, which meant
these two class could not be fully decoupled.
This version of MicroBitStorage is a Key Value Store, and allows
3 base operations:
* put - add a new KeyValuePair to flash
* get - retreive a KeyValuePair from flash
* remove - delete a KeyValuePair from flash
An instance of MicroBitStorage is also now a part of uBit (uBit.storage)
and this is now passed as a parameter to the constructors of BLEManager
and compass, both of which require the persistence of data.
There are also overloads for the constructors of MicroBitBLEManager
and MicroBitCompass, which do not require an instance of
MicroBitStorage to be passed.
disabled
Calls to synchronous/blocking display animations, e.g. scroll("HELLO!"), did
not terminate correctly due to over optimisation in the
MicroBitDisplay::FiberWait() method.
Also corrected potential deadlock caused by an animation being explicitly
terminated.
- Updated all BLE services from the standard profile to us the defualt registered event model
- Updates to trigger calibration (when necessary) when BLE MagnetometerService is activated
- Updates to compass calibration algorithm to be non blocking (reduce unecessary fiber stack overhead)
- Cleanup of unused/out of date MicroBitConfig BLE options
- Cleanup of MicroBitHeapAllocator related CONFIG options to add clarity
- Refactor of MicroBitHeapAllocator to provide more control over heap
initialisation.
- Creation of SERIAL_DEBUG macro in MicroBitConfig to permite external
definition of a debug console.
- Added validation cases to MicroBitFiber to protect against calls to fiber
operations when the scheduler has not been initialised.
Removed references to MicroBit.h in some header and cpp files.
As a result a number of changes had to be made in order to satisfy
include dependencies.