Commit graph

251 commits

Author SHA1 Message Date
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
James Devine
e46ca3fc34 version v1.4.5 2016-01-12 23:42:03 +00:00
James Devine
c568dd7cf0 Merge pull request #68 from lancaster-university/updating-dynamic-pwm
DynamicPwm behaviour modifications, and added a new Servo API to MicroBitPin
2016-01-12 21:14:29 +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
Joe Finney
59d0f09ea0 version v1.4.4 2016-01-12 17:37:53 +00:00
Joe Finney
56a495fbd7 microbit: Update of MESEvent codes to avoid MICROBIT_EVT_ANY collision
Events listed recorded in MESEvents.h were enumerated from zero.
This is not ideal, as MicroBitMessageBus uses a code of zero for
MICROBIT_EVT_ANY - a wildcard mechanism to register interest in all events
from a given ID.

All event values recorded in MESEvents.h have therefore incremented.
2016-01-12 17:29:54 +00:00
Joe Finney
09cc2d73f4 microbit: update of edge connector pin mappings to match updated hardware design.
Definitions of pins changed as follows:

MICROBIT_PIN_P6 =>  P0_12 (COL9)
MICROBIT_PIN_P7 =>  P0_11 (COL8)
MICROBIT_PIN_P9 =>  P0_10 (COL7)
2016-01-12 14:50:36 +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
James Devine
493e174fe8 microbit: Fixed duplicated id for Thermometer
There was a duplication in IDs for MICROBIT_ID_THERMOMETER and MICROBIT_ID_IO_P0
for the event bus. This has been rectified by appending the MICROBIT_ID_THERMOMETER
2016-01-11 13:39:56 +00:00
James Sheppard
13f6bce86b Merge pull request #69 from lancaster-university/events-definition
Events definition updated
2016-01-11 12:09:27 +00:00
James Sheppard
3491187a0d TODOs for DISPLAY_TOAST and PLAY_SOUND 2016-01-11 12:03:50 +00:00
Joe Finney
856a52d893 version v1.4.3 2016-01-09 19:47:39 +00:00
Joe Finney
b48d3f6304 Merge branch 'compass-autocalibration' 2016-01-09 19:40:08 +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
92905593f1 microbit: Added support for MicroBitHeapAllocator to allocate C++ style array
declarations

Added missing operator new[] wrapper in MicroBitHeapAllocator.h
Ammended defualt microBitConfig.h to allocate 90% of available heap, rather
than 95%. this is to leave a little more heap for external libraries.
2016-01-09 11:33:02 +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
James Sheppard
e82ca68521 MES_DEVICE_INCOMING_CALL and _MESSAGE values added 2016-01-08 16:22:20 +00:00
James Sheppard
41e2fc6b74 MES_PLAY_CONTROLLER removed (descoped) 2016-01-08 16:15:06 +00:00
James Sheppard
db436a4f09 MES_AUDIO_RECORDER events removed 2016-01-08 16:10:14 +00:00
Joe Finney
9a49436659 version v1.4.2 2016-01-05 16:53:55 +00:00
Joe Finney
fd79b2850f microbit: Added explicit version references for module dependencies 2016-01-05 16:53:23 +00:00
Joe Finney
b54cfa1ab6 version v1.4.1 2016-01-05 16:35:37 +00:00
Joe Finney
80b31681c1 Merge branch 'basic-gestures' 2016-01-05 16:32:04 +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
d8651d9129 version v1.4.0 2016-01-05 10:45:13 +00:00
Joe Finney
3c314794f0 Merge branch 'secure-ble' 2016-01-05 01:28:49 +00:00
Joe Finney
413e6a2116 microbit: removed sample hex file used for testing 2016-01-05 01:27:19 +00:00
Joe Finney
55601f3e0e Merge branch 'master' into secure-ble 2016-01-05 01:25:52 +00:00
Joe Finney
fd27a78f0c Merge branch 'remay-ble-disconnect-on-reset' into secure-ble 2016-01-05 00:14:29 +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