Commit Graph

224 Commits

Author SHA1 Message Date
Joe Finney 336c30f2ec microbit: Integrate Multicast peer to peer communications into MicroBit.cpp
- Added instance variable and constructor call in MircoBit.cpp
  - Added event definitions for RADIO related indications
2016-02-01 04:40:21 +00:00
Joe Finney d9d2343ab6 microbit: Add Multicast peer-to-peer radio capability
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.
2016-02-01 04:29:27 +00:00
Joe Finney e3a23988f6 microbit: Promote constants in MicroBitBLEManager to .h file
Moved configuration constants from .cpp to .h file, so that they can be reused
more easily from other code, such as the broadcast radio code.
2016-02-01 04:25:51 +00:00
James Devine 6b0e9cf489 microbit: integrated MicroBitLightSensor with MicroBitDisplay
Previously, to light sense a user would have to configure a
MicroBitLightSensor instance themselves, and flip the display mode
manually. This is difficult in languages that target our API.

This commit resolves that by adding a new method readLightLevel which
flips the display mode, and instantiates a light sensor.

When changing the mode, the tickSpeed is also modified to reduce
artefacts on the display.
2016-01-29 14:13:41 +00:00
James Devine 2049e63039 microbit: added MicroBitLightSensor
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!
2016-01-29 14:10:52 +00:00
James Devine 6e316dc741 microbit: added accessor/mutator for systemTick
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
MICROBIT_DEFAULT_TICK_PERIOD.
2016-01-29 14:07:36 +00:00
James Devine 6f812aa474 microbit: added new display mode, and accessor
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
display mode!
2016-01-29 14:03:24 +00:00
James Devine 6939ad25d9 microbit: formatting changes to MicroBitFiber
Corrected whitespace in MicroBitFiber.
2016-01-29 13:57:34 +00:00
Joe Finney 0bbb5b9123 microbit: Code cleanup
Removal of debugging information and redundant algorithms.
2016-01-28 17:09:01 +00:00
Joe Finney 8756bbd103 WIP: Lower RAM footprint compass calibration
- moved to single precision floats
- optimised transpose/multiply operation
- optimisation of algorithm
2016-01-26 21:52:22 +00:00
Joe Finney e3fdc5a290 microbit: Support for bonding only available in pairing mode
Update to BLE initialisation code. Ability to initiate pairing is now
restricted to pairing mode.
2016-01-25 21:05:15 +00:00
Joe Finney 99d7231945 microbit: Persistance of BLE Service Chnaged metadata
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.
2016-01-25 21:05:13 +00:00
Joe Finney 6a7436e5c7 Merge pull request #48 from remay/quiet-gcc-build
Tidy up gcc -Wall fixes

Thanks @remay!
2016-01-25 20:55:37 +00:00
Damien George 3160ba6268 Make MicroBit::seedRandom a public function with 2 variants.
seedRandom() seeds from the hardware RNG, whilst seedRandom(uint32_t)
seeds from the given 32-bit number.
2016-01-25 15:20:25 +00:00
Joe Finney a4c0915fff microbit: BUGFIX Prevent BLE Magnetometer service from initiating compass
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.
2016-01-19 00:32:02 +00:00
Joe Finney 4f1870fda9 Merge branch 'master' into ble-whitelisting 2016-01-17 00:44:35 +00:00
Joe Finney 13eb3c07e7 microbit: Add explicit service changed notification
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.
2016-01-17 00:23:00 +00:00
Joe Finney 1c9ae30d1c microbit: Added basic bond table management
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.
2016-01-16 21:05:46 +00:00
Joe Finney e754ecf3aa microbit: Setting of default BLE transmission power level
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.
2016-01-16 17:29:46 +00:00
Joe Finney 07852b0cd6 microbit: Added support for BLE transmission power control
Added new method to MicroBitBLEManager to allow the radio transmission power
to be controlled. Provides a linear power level scale in the range 0..7.
2016-01-16 17:07:20 +00:00
Joe Finney f17151a0bf microbit: Added optional support for whitelisting and limited advertising
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
2016-01-16 16:54:58 +00:00
James Devine b2484dcc97 microbit: patch for animation/scroll behaviour for images
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.
2016-01-14 12:56:58 +00:00
Robert May 098a2378e3 Merge lancaster-university/master and silence warnings. 2016-01-13 20:51:49 +01:00
James Devine acf6bf76eb microbit: further fixes to #73
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.
2016-01-13 16:25:34 +00:00
James Devine 1cc814da60 microbit: further formatting corrections
Corrected trailing whitespace, and tabulated lines with no content for:

* MicroBitCompass.h (.cpp)
* MicroBitDisplay.h (.cpp)
* MicroBitMessageBus.h (.cpp)
2016-01-13 16:16:18 +00:00
James Devine d8240cfb74 microbit: formatting changes to MicroBitAccelerometer.h (.cpp)
Removed trailing whitespace, and tabulated lines with no content.
2016-01-13 16:01:51 +00:00
James Devine a209857007 microbit: fix for #74
Replaced newer struct-style initialisation of CompassSample in MicroBit.cpp
with the more traditional constructor-style initialisation, to enfore
C98 compliance.

Closes #74
2016-01-13 15:12:13 +00:00
James Devine 7b7998e4eb microbit: formatting changes to MicroBit.h (.cpp)
Removed trailing whitespace, and tabulated lines with no content.
2016-01-13 15:04:29 +00:00
James Devine 8d3f3affbd microbit: fix for #73
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.
2016-01-13 14:15:50 +00:00
James Devine d2df88417b microbit: whitespace changes to MicroBitButton.h and .cpp
Cleared the files of trailing whitespace, and tabulated lines
2016-01-13 14:07:10 +00:00
Joe Finney 90cf35a38a WIP: compiling but untested first cut at whitelisting code 2016-01-13 00:20:37 +00:00
James Devine 983e9e1ad3 microbit: added Servo API to MicroBitPin
* 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.
2016-01-12 20:54:09 +00:00
James Devine 2650aaa569 microbit: MicroBitPin api additions
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.
2016-01-12 20:52:50 +00:00
James Devine 32c40cdc29 microbit: DynamicPwm fixes and additions
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.
2016-01-12 20:50:42 +00:00
James Devine 500f851991 microbit: whitespace corrections
Corrected additional whitespace on some lines of source/MicroBitPin.cpp
2016-01-12 20:50:42 +00:00
James Devine 643f408ed2 microbit: modified the behaviour of pwm allocation
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.
2016-01-12 20:50:42 +00:00
James Devine 68474c5e58 microbit: modified constructor for DynamicPwm
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
2016-01-12 20:50:42 +00:00
James Devine 6b1e020392 microbit: formatting corrections
There was some incorrect tabulation in a few lines of this file, this has now been corrected.
2016-01-12 20:50:42 +00:00
James Devine c04de3f93c Merge pull request #47 from remay/serial-baud
Remove unnecessary uBit.serial.baud() calls
2016-01-11 14:03:40 +00:00
Joe Finney 32961973bb microbit: Updates to MicroBitAccelerometer to use sample data accessor methods throughout.
All internal uses of accelerometer sample values now updated to access the
data via accessor methods. This now ensures consistent use irrespective of
the coordinate system used.
2016-01-09 19:32:30 +00:00
Joe Finney 0da7903e24 Merge branch 'master' into compass-autocalibration 2016-01-09 19:10:04 +00:00
Joe Finney db25d4c0c3 microbit: Further corrections to comment blocks 2016-01-09 18:47:15 +00:00
Joe Finney 0e7a6979da microbit: Comment Cleanup
corrections to comment blocks only.
2016-01-09 11:54:23 +00:00
Joe Finney 6916d506b8 microbit: Removed print funcitons from matrix class due to SRAM overhead of
native printf() call.

The Matrix4::print() function is useful, but non essential for most
applications, and the underlying printf() call required cost an
additional 1K of RAM on first use, which is currently above the budget for
micro:bit.
2016-01-09 10:25:26 +00:00
Joe Finney d51b1205f7 microbit: Added support for compass tilt compensation
An e-compass solution requires knowwlede two pieces of data to provide an
accurate heading:

  - Accurate calibration of the magnetometer hardware so that reliable
    measurements can be taken.
  - Knowledge of the pitch and roll of of device, so that the correct
    components of the X/Y and Z axis sensors of the magnetomer can be used
    to sense the magnetic field in a horizontal plane regardless of the tilt
    of the device.

This commit represent changes to the MicroBitAccelerometer and MicroBitCompass
classes to implemen tthese goals. More specifically, this commit provides:

 - The introduciton of an interactive calibration 'game', that can rapidly
   gather all the data required to calibrate the compass.

 - An improved calibration algorithm based on a Least Mean Squares approach of
   compass samples, as documened in Freescale Application Note AN4248.

 - The inclusion of a simple Matrix4 class to enable efficient Least Mean
   Squares implementation.

 - A change from asynchronous to synchronous calibration of the compass when
   first used. This is in repsonse to a feature request for this from users
   and high level languages using microbit-dal.

 - Support for detemrining tilt and roll angle in MicroBitAccelerometer

 - Support for multiple co-ordinate spaces in MicroBitAccelerometer and
   MicroBitCompass. Data can now be read in either RAW (unaltered) data.
   MICORBIT_SIMPLE_CARTESIAN (as used previously) or NORTH_EAST_DOWN
   (the industry convention in mobile phones, tablets and aviation)

 - Implementation of a tilt compensated algorithm, used when determining
   device heading.
2016-01-09 00:20:19 +00:00
Joe Finney 3416e54a36 microbit: increase sensitivity of freefall detection
Freefall now detected when the net force on the device drops below 0.4g,
rather than 0.2g as previously defined. This improves sensitivity, without
generating false positives under common use.

Also correction of minor typos / layout errors.
2016-01-05 16:23:47 +00:00
Joe Finney 17632adafa Merge branch 'master' into basic-gestures 2016-01-05 15:50:53 +00:00
Joe Finney d3587d888c microbit: code scrub of MicroBitAccelerometer gesture recognition code
- updated acceleration threshold event names to reflect numeric values e.g.
    GESTURE_3G, GESTURE_6G, GESTURE_8G.
  - Add scoping to elements of SimpleGesture enum.
  - Code scrub of code layout caused by editor with incorrect configuration.
  - rename of internal state variables and functions to better reflect use.
  - added clarification to some comments.
2016-01-05 15:44:57 +00:00
Joe Finney 55601f3e0e Merge branch 'master' into secure-ble 2016-01-05 01:25:52 +00:00
Joe Finney 6763a9ba6c Merge branch 'ble-disconnect-on-reset' of https://github.com/remay/microbit-dal into remay-ble-disconnect-on-reset 2016-01-05 00:13:26 +00:00
Joe Finney e1f75b2c4c microbit: Added read capability to MicroBitDFUService::ControlPoint characteristic
Whilst Android devices permit explicit initiation of the BLE pairing process,
IOS based devices are only  capable of implicit initiation of pairing based
on accessing a protected characteristic. Adding read capability to the
ControlPoint characteristic provides a safe and convenient way for IOS devices
to initiate pairing.
2016-01-04 23:41:22 +00:00
Joe Finney 7a71b58bd4 microbit: Revert explicit use of public addresses in pairing mode 2016-01-04 23:06:48 +00:00
Joe Finney 203246b975 WIP: Revert to public addresses pending further debug 2015-12-18 12:27:08 +00:00
Joe Finney c7ea0af6fe WIP: Analysing correct use of private resolvable addresses 2015-12-17 14:27:57 +00:00
Joe Finney 14831ac9b9 Updates to BLE 2.1.11 / ble-nrf51822 2.2.3
Minor amends:
  - bleDisconnectionCallback signature change
  - bleSetAdvertisingInterval now takes milliseconds as a parameter
  - event based invocation of DFU bootloader
2015-12-11 04:57:06 +00:00
Joe Finney 6d610f049a microbit: Updates to Pairing Mode to improve the user experience
More specifically:

- BLUEZONE mode renamed to PairingMode (by popular request).
- Added timeout of 90 seconds before automatic device reboot.
- Move from a scroll to a print based algorithm to improve the amount of time key is displayed fully.
- Added compulsory 'click to bond' button press.
- Improved response time of tick/cross being displayed.
2015-12-11 03:43:18 +00:00
Joe Finney 5a9f5d42bd microbit: Updates to enable anonymous advertising during normal operation
Changes to default BLE name. During normal operation, all micro:bits now have the same name: BBC micro:bit
When pairing mode (AKA BLUEZONE) is entered, device name details re appended as before, to give BBC micro:bit [<name>]

This is to provide a degree of anonymity to users, to make tracking of kids more difficult.
2015-12-11 02:09:31 +00:00
Joe Finney e042a55522 microbit: Added compile time option to enabe support for BLE private resolvable addresses.
Introduced MICROBIT_BLE_PRIVATE_ADDRESSES configuration option.
Disabled by default, as it did not resolve binds correctly on Android 4.4.2
2015-12-11 01:38:22 +00:00
Joe Finney 6f5ad99aa2 BUGFIX: Enabled BLE_COMMON_OPT_RADIO_CPU_MUTEX option
This option is now configured when the BLE stack is initialised. This ensures that SoftDevice is never
starved of CPU during periods of criticality. This does lock out the CPU for application use, but prevents
MIC failures caused by __disable_irq() operations (as found in the mbed Ticker API for example).
2015-12-11 01:16:48 +00:00
Joe Finney b6ca1365f7 microbit: Added explicit BLE disconnection requests on DFU and soft reset 2015-12-11 00:55:33 +00:00
Joe Finney 1e5d5c8dcf Updates to BLE 2.1.11 / ble-nrf51822 2.2.3
Minor amends:
  - bleDisconnectionCallback signature change
  - bleSetAdvertisingInterval now takes milliseconds as a parameter
  - event based invocation of DFU bootloader
2015-12-11 00:24:21 +00:00
Joe Finney 1b18ac8641 microbit: Added basic gesture recognition into MicroBitAccelerometer
The following postures of the device are now detected:
- TILT_UP
- TILT_DOWN
- TILT_LEFT
- TILT_RIGHT
- FACE_UP
- FACE_DOWN

In addition, the following gestures are inferred:

- NONE
- SHAKE
- FREEFALL
- WHEEE (>=3g)
- SICK (>=5g)
- UNCONSCIOUS (>=8g)

Events are now triggered on the MessageBus upon the transition from one posture/gesture to another,
and a synchronous getGesture() method is now also provided to interogate the last gesture recognised.

I should be noted that the default accelerator range of +/-2g will be insufficient to detect some of
the events noted above, and MicroBitAccelerometer::setRange() should be used to increase the range
if required.
2015-12-03 15:11:31 +00:00
Joe Finney f5cf8f2dd4 microbit: Minor optimisations to patch
- LFSR generated values in a subset of the range requested (rounded to the nearest lower power of 2).
   Corrected by increasing the number of bits usedby one, such that it now generated st least the power of 2 greater.

 - replaced enable/disable of interrupts with a local snapshot of randomValue. Much of the nordic software is sensitive to interrupt timings,
   so best avoided where possible. Chance of race condition is low, and effect is minimal (duplicate number returned).
2015-11-30 00:43:24 +00:00
Joe Finney 958136673f Merge branch 'fix-random' of https://github.com/remay/microbit-dal into remay-fix-random 2015-11-29 23:43:46 +00:00
Joe Finney ae93079a65 code cleanup 2015-11-25 21:21:04 +00:00
Joe Finney 6d1004fb28 Updates to DFU service to align with BLE standard BLE security
- Removed flashcode base authorization
- silenced unused parameter in MicroBitHeapAllocator
- bugfixed BLUEZONE mode so that sensor data is still available via BLE
2015-11-20 11:32:42 +00:00
Robert May 051575d911 Tidy up gcc -Wall fixes. 2015-11-18 23:13:57 +00:00
Robert May de681e68c3 Add diagnostic message to yotta/cmake output to remind us that we have silenced warnings. 2015-11-18 23:04:59 +00:00
Robert May 6c330079b1 Remove unnecessary uBit.serial.baud() calls
The serial baud rate is set duing construction of the uBit object.  We
don't need to do it again, and especially with fixed values that can't
be overridden.
2015-11-18 22:50:19 +00:00
Robert May 5333729644 Revert "Cchange random() to use libc srand()/rand()"
This reverts commit db5227872a.

return to using our own random implementation.
2015-11-18 15:50:44 +00:00
Robert May db5227872a Cchange random() to use libc srand()/rand()
Uisng libc's implementation is likely to be safer than rolling our own.  At least
the failure modes are well documented. (glibc's implementation of rand() is
actually not bad).
2015-11-18 14:15:17 +00:00
Robert May 1bb4377c8c Combine loops and fix max returned value. 2015-11-18 12:08:34 +00:00
Michal Moskal 845bf4838c Fix allocation size for ImageData (the header is 6, not 4 bytes long) 2015-11-17 15:57:19 -08:00
Robert May 901faaeec7 reset variable m in the correct place. 2015-11-17 18:51:10 +00:00
Robert May 892689c54a Fix Microbit::random() to be random
The LFSR used only provides 1 bit of random data each time it is cycled.
This implementation generates the minimum number of bits needed.  Further
it discards numbers that are bigger than required and re-calculates -
this keeps the distribution flat.
2015-11-17 18:33:34 +00:00
Joe Finney b44095f0c5 BUGFIX: String comparison operations
Corrected response of < and > operations where substrings are compared.
2015-11-17 17:20:30 +00:00
Joe Finney 9b5fa0fcfc minor bugfixes in MICROBIT_HEAP_DEBUG 2015-11-17 16:58:42 +00:00
Robert May 51ea69201e Disconnect BLE before hard reset
If BLE is connected when performing a hard reset, attempt to disconnect
first to allow the remote peer to handle the disconnect gracefully
without haing to wait for a supervision timeout.
2015-11-17 13:12:27 +00:00
Joe Finney ac381fa5dc microbit: Alpha version of standard BLE MITM passkey security
- refactored BLE funcitonality into BLEManager class.
- added security requirements standard BLE profile services.
- updated bluezone pairing process to use BLE passkey exchange.
2015-11-16 13:44:27 +00:00
Joe Finney 79c739674c first compiling build. 2015-11-15 14:31:44 +00:00
Joe Finney 6dca3ed8d4 microbit: pre-compilation backup only. 2015-11-13 20:38:37 +00:00
Michal Moskal 56a560e5bc Merge branch 'master' into flatstring
Conflicts:
	.gitignore
	inc/ErrorNo.h
	source/MicroBitDisplay.cpp
	source/MicroBitImage.cpp
2015-11-12 16:13:45 -08:00
Joe Finney ea51f396ca Added compatibility for builds under ARMCC 2015-11-08 18:04:17 +00:00
Joe Finney 435debffed Merge branch 'quiet-gcc-build' of https://github.com/remay/microbit-dal into remay-quiet-gcc-build 2015-11-08 13:50:33 +00:00
Joe Finney 13456c60c1 microbit: Removal of explicit Serial instance for debugging.
Debugging now runs via the standrad MicroBit::serial interface.
2015-11-01 23:42:53 +00:00
Joe Finney 1a65e4e7bc microbit: Added support for soft reset button in panic mode
Also recalibrated loop timers in MicroBitDisplay::Error(), as used by panic()...
strange these now seem off by several orders of magnitude.

TODO: Ensure CPU is running at correct internal frequency with an oscilloscope test...
2015-11-01 21:33:46 +00:00
Robert May b8083908a7 Correct warnings supression in more obvious way
Whilst a little more invasive change than the previous warnings
supression this is more correct and more obvious as to what's being done,
and what warnigns will remain in place for the rest of the comilation
unit.
2015-11-01 20:19:18 +00:00
Robert May 9591ef40dc Turn off -Wunused-parameter for include "nrf_soc.h"
Unfortunately we can't turn it off just while nrf_soc.h is being included
as the way the defines are used the compiler can't tell the parameters
are unused until the end of the compilation unit.  So we can't use the
more normal

as that pops the supression too early.

WARNING: including nrf_soc.h will turn off unused-function warnings for
the rest of the compilation unit - see included nrf_svc.h
2015-11-01 20:19:17 +00:00
Robert May 1a1a5976a8 Silence GCC -Wall 2015-11-01 20:19:17 +00:00
Robert May 3a8c72144f up the cmake version required to 2.8.12, which is required for target_compile_options. 2015-11-01 20:19:17 +00:00
Robert May a39ba7d4f7 Turn off GCC warnings when building the dependancies 2015-11-01 20:19:17 +00:00
Robert May b2d3417559 Fix build when $git_branch fails to be set correctly. 2015-11-01 20:19:17 +00:00
Joe Finney 194f19a428 Merge branch 'simplified-eventing' 2015-11-01 18:22:27 +00:00
Joe Finney 1b6d6038c1 Merge branch 'master' into tight-validation 2015-11-01 16:28:08 +00:00
Joe Finney 77af825df0 Merge branch 'master' into simplified-eventing 2015-11-01 16:27:15 +00:00
Joe Finney 39abf824dc microbit: More efficient handling of events
Removed unnecessary queing of item on the MessageBus, whilst maintaining causal ordering.
2015-11-01 15:16:27 +00:00
Joe Finney b2e9369771 microbit: BUGFIX DoS attacks on the MessageBus
- 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.
2015-11-01 12:59:52 +00:00
Joe Finney 84da6a4a09 microbit: Minor bug fixes and refinements
- 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.
2015-10-31 10:27:38 +00:00
Joe Finney 0fa8296048 microbit: BUGFIX safe deletion of listeners
also correction to minor bu in MicroBitFiber that could conceivably send more
notifications that it should...
2015-10-29 00:08:33 +00:00
Joe Finney 1eeaeca2c6 microbit: BUGFIX - correct initialization of MicroBitListener
code now correctly initiailizes the evt_queue filed needed to prevent
lockup during event processing (understandably!).
2015-10-28 14:17:12 +00:00