Commit graph

34 commits

Author SHA1 Message Date
Joe Finney
9218e647e0 microbit: Refactor of periodc timer callbacks
- 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++
  functions.
- Updated all references in microbit-dal to use this refactored API.
2016-03-10 17:01:17 +00:00
Joe Finney
5231b5f526 First cut at a build without a global MicroBit singleton 2016-03-10 12:02:13 +00:00
Joe Finney
2f6d405e81 microbit: Introduced managed type for packet buffers.
Introduce PacketBuffer as a mutable reference counted type Radio operations
Updated send() and recv() to use PacketBuffer rather than ManagedString
2016-02-09 01:04:57 +00:00
Joe Finney
d1d78b9b35 microbit: added MicroBitStorage for Persistent data
Integrated simple 1K block buffer to host small amount of persistent
data and a 1K FLASH memory block located immediately below the FOTA/DFU
bootloader and APPDATA region that intended to hold core configuration
information, such as:

* BLE bonding information.
* Compass Calibration data.
* Thermometer Calibration data.

The block is resident at 0x0003B400 - 0x0003B800.
2016-02-02 21:22:49 +00:00
James Devine
97c49d3279 Merge pull request #87 from lancaster-university/broadcast-radio
Adding Multicast peer-to-peer radio support MicroBitRadio!
2016-02-01 21:50:54 +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
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
Robert May
098a2378e3 Merge lancaster-university/master and silence warnings. 2016-01-13 20:51:49 +01:00
Joe Finney
0da7903e24 Merge branch 'master' into compass-autocalibration 2016-01-09 19:10:04 +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
55601f3e0e Merge branch 'master' into secure-ble 2016-01-05 01:25:52 +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
Joe Finney
79c739674c first compiling build. 2015-11-15 14:31:44 +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
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
Michal Moskal
9330b401d5 Move RefCounted class to a separate file 2015-10-24 20:30:15 -07:00
Joe Finney
80f79f7faf Merge branch 'master' into ble-profile
Conflicts:
	source/CMakeLists.txt
	source/MicroBit.cpp
	source/MicroBitFiber.cpp
	source/MicroBitMessageBus.cpp
	source/MicroBitSuperMain.cpp
2015-10-18 17:54:37 +01:00
Joe Finney
85a26dc8e1 microbit: Updates to enable semantic versioning of the micro:bit runtime DAL
More specifically, the build system now uses the semantic versioning meta-data
held in module.json to define a major.minor.patch version. Additionally, is the branch
being compiled is *not* the master branch, the version is appended with <branchname><githash>.

Specific updates:

- Updates to CMake files to expose this to the micro:bit runtime code.
- Addition of uBit.systemVersion() to expose this to application code.
- Displaying of version string over serial if MICROBIT_DBG is enabled.
- Distribution of version string over BLE via the firmware revision characteristic.
2015-10-08 14:37:35 +01:00
Joe Finney
18236810a3 microbit: BLE Profile Beta 1
First functionally complete BLE profile, matching BLE speicfication v1.6.
More specifically, the following services are now functional:

  - AccelerometerService
  - MeganetometerService
  - EventService
  - TemperatureServide
  - IOPinService
  - DFUService
  - ButtonService
  - LEDService

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.
2015-09-28 21:40:44 +01:00
Joe Finney
4314b68643 microbit: First implementation of Temperature Service 2015-09-23 22:15:44 +01:00
Joe Finney
eb5ed28f74 microbit: First cut at MicroBitButtonService and microBitIOPinService
Strictly still development - untested code.
2015-09-22 16:13:08 +01:00
Joe Finney
ef613e9d86 microbit: Added BLE Magnetometer service compilation, initialization and configuration options 2015-09-19 22:19:57 +01:00
Joe Finney
037ef999eb microbit: Merge branch 'master' into ble-profile
Pulled in changes from MessageBusExtensions to support development of ble profiles.
2015-09-15 15:17:21 +01:00
Joe Finney
8ea2e953c8 microbit: Added C++ member function callback support into MicroBitMessageBus
Event callbacks can now be transparently added to any C++ member function
matching the MicroBitMessageBud signature:  void fn(MicroBitEvent e)
2015-09-10 00:04:27 +01:00
Joe Finney
609cb6f2d8 microbit: Added first draft of BLE Accelerometer service
n.b. this code is as yet untested.
2015-09-09 15:16:11 +01:00
Joe Finney
7e18131849 microbit: Added MicroBitLEDService
One of the standard services defiend with the Bluetooth SIG. Allows remote control
of the LED matrix display over BLE.
2015-09-07 17:09:17 +01:00
Joe Finney
574b408cd1 microbit: Code Structure Cleanup
Create subdirectories for assembler code and BLE specific functionality
2015-09-07 10:26:48 +01:00
Joe Finney
8e1a15c79f microbit: Added support for custom configuration files through yotta
A header file containing custom configuration options for the microbit:runtime can
now be defined through a yotaa configuration option.

For example, including the following inside a top level config.json file
will load configuration options from a file called "MicroBitCustomConfig.h" that is stored
alongside an application's main.cpp. Any options defined there will override the defaults
defined in microbit-dal/inc/MicroBitConfig.h :

{
   "microbit" :{
      "configfile" : "source/MicroBitCustomConfig.h"
   }
}
2015-09-04 00:08:20 +01:00
Joe Finney
f616011ac1 microbit: Integrate support for transparent gcc compiles
Custom CMakefile added to microbit-dal to automatically assemble the correct
version of CortexContextSwitch.s accordiong to the current build target.
2015-09-02 18:54:31 +01:00
Jonathan Protzenko
e258a52c79 My CMake skills are weak... properly implement the GCC/ARMCC switch for the S
file.
2015-08-24 10:55:22 -07:00
Jonathan Protzenko
8491b558e0 CMake tweak 2015-08-24 10:49:25 -07:00
Jonathan Protzenko
63b62e533f A version of microbit-dal that builds with both gcc and armcc.
Check in the CMakeLists.txt with a custom hook so that the library can build
with both compilers regardless.
2015-08-24 10:33:30 -07:00