Commit Graph

72 Commits

Author SHA1 Message Date
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
Jonathan Protzenko b421ba5b69 A new check for -> on ManagedTypes. 2015-11-04 15:43:36 -08:00
Jonathan Protzenko 74542e66eb Change the refcount to a protected member variable. 2015-11-04 14:20:31 -08:00
Jonathan Protzenko 88b37e83bb Add an operator overload for ManagedType. 2015-11-02 13:20:38 -08: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
Robert May 1a1a5976a8 Silence GCC -Wall 2015-11-01 20:19:17 +00:00
Joe Finney e68e47512a microbit: Updated default evernt queue depth to match test cases 2015-11-01 18:23:54 +00:00
Joe Finney 194f19a428 Merge branch 'simplified-eventing' 2015-11-01 18:22:27 +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
Michal Moskal 7c4f87036f Remove left-behind code 2015-10-27 08:28:50 -07:00
Michal Moskal 3900962556 Remove specific panic codes for ref-counting. 2015-10-27 08:28:06 -07:00
Michal Moskal 59853855b0 Remove caching of getSerial(); use temporary for BLE init 2015-10-27 08:26:07 -07:00
Michal Moskal 2877fd68f2 Remove GCC warning pragmas 2015-10-27 08:23:14 -07:00
Michal Moskal c1050df0d9 Make the image width/height 16 bit wide 2015-10-27 08:02:42 -07:00
Joe Finney 7f64a4c703 microbit: BUGFIX Corrected incorrect handling of MicroBitMessageBus::add return values. 2015-10-26 16:37:12 +00:00
Joe Finney 823a956d68 microbit: First cut at updates to provide tight validation within the runtime code, with a view to moving
NOP/clamping behaviour out of teh micro:bit runtime and into the glue layers of higher level
languages.

 - 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.
2015-10-25 21:51:33 +00:00
Michal Moskal 7b82f3e8eb Improve comments; cleanup 2015-10-25 13:09:24 -07:00
Michal Moskal 98ffcc1fd1 Add status panic codes for ref-count errors 2015-10-25 12:59:45 -07:00
Michal Moskal d0b75c96d1 Add MicroBitImage::isReadOnly,clone.
Add MicroBitImage,ManagedString::leakData().
Work more on incr()/decr() protocol.
2015-10-25 10:03:14 -07:00
Michal Moskal 11c99d0b84 Make the reference count always odd to make it possible to distinguish it from a vtable 2015-10-25 08:30:05 -07:00
Michal Moskal 5df59c2f7e Remove VirtualRefCounted class; non-virtual <-> virtual casts are not no-ops. 2015-10-24 21:52:51 -07:00
Michal Moskal 4f82a6c37c Use RefCounted also for MicroBitImage. 2015-10-24 20:58:03 -07:00
Michal Moskal 9330b401d5 Move RefCounted class to a separate file 2015-10-24 20:30:15 -07:00
Michal Moskal 5a10bda561 First stab at more memory efficient strings 2015-10-24 19:34:04 -07:00
Michal Moskal 057158c9f3 Cache getSerial(); otherwise BLE information device initalization may crash 2015-10-24 19:28:36 -07:00
Joe Finney 424b825185 Merge branch 'master' into simplified-eventing
Conflicts:
	inc/MicroBitMessageBus.h
2015-10-18 18:20:03 +01: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 db3eccf6ff microbit: Final updates to BLE profile
Minor changes to BLE profile services (cleanup prior to merge with master branch):

  - Added temperature period characteristic to match design pattern of other sensors.
  - Updated endinaness of MicroBitLEDService Matrix to be more intuitive.
  - Cleaned up Microbit.cpp by removing unused reference to BLE services.
  - Exposed serial number and naming information thr BLE DeviceInformation and API.
  - Updated BLE advertisement period to be alightly more repsonsive (200ms vs 1000ms).
  - BUGFIX: micro:bit name is now always generated, regardless of BLE services.
  - BUGFIX: Scroll Period data length.
2015-10-18 14:46:42 +01:00
Joe Finney aca544677e microbit: Updates to enable queing of display animation calls
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.
2015-10-17 20:35:16 +01:00
Joe Finney 068822ff12 Merge branch 'matrix-point-optimisation' of https://github.com/dpgeorge/microbit-dal into dpgeorge-matrix-point-optimisation 2015-10-14 09:38:13 +01:00
Joe Finney 6764c732ea microbit: BUGFIX to MicroBtDFU Service
- Updates to UI handling to avoid starving out the processor.
  - Clears screen before entering DFU bootloader
2015-10-09 01:14:36 +01:00
Joe Finney ce2cc57bf1 microbit: Optimisation of internal Message Bus listeners
All message bus listeners with the micro:bit runtie are non blocking, and safe to be called
in an interrupt context. As such, these have now all been declared MESSAGE_BUS_LISTENER_IMMEDIATE
which should mitigate all unbounded event queueing effects.
2015-10-08 23:49:14 +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
Damien George 0dcb6834ec microbit: Use default constructor for MatrixPoint so data is ROMable.
Previous to this patch an explicit constructor was provided for creating
MatrixPoint instances, which meant that such objects could not be put in
ROM (since they needed to be constructed at runtime).

By using the defualt construction method for structs the MatrixPoint map
is now compiled into the rodata section, hence freeing up RAM.

Saves: 4 bytes data, 56 bytes bss, 148 bytes code.
2015-09-25 21:19:10 +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 3cfc7ec6e7 microbit: Ammendments to ensure fiber is never pages out due to eventing and minor cleanups
- 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.
2015-09-19 21:44:58 +01:00
Joe Finney 1e71169550 microbit: First draft of Magnetometer BLE service 2015-09-19 21:03:36 +01:00
Joe Finney ae0e5611c3 microbit: First draft of reconfigurable frequencies of MicroBitCompass 2015-09-19 21:00:38 +01:00
Damien George 9ccdd25e9f microbit: Allow to run the idle task within the current fiber's stack.
If there is only 1 main fiber (plus the idle fiber) then enabling this
new feature for the main fiber (using fiber_allow_run_idle_within())
will mean that no heap is needed to swap the stack out.
2015-09-19 11:45:45 +01:00
Joe Finney 2c9f63902c microbit: Message Bus updates to support URGENT events queue optimisations
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.
2015-09-18 23:20:44 +01:00
Joe Finney ec30695d7d microbit: BUGFIX MicroBit::reset() now operates correctly 2015-09-17 23:32:40 +01:00
Joe Finney a61bd49620 microbit: BUGFIX: Memory leak in ManagedType.h
Corrected corner case memory leak. Instances of ManagedType<> created using the default
constructor would create a reference counter by default, with a value of 0. However, if
destructor or copy-assigned in this state, this reference count would not be destroyed,
resulting in a 4 byte leak on the heap for each occurence.
2015-09-17 23:16:40 +01:00
Jonathan Protzenko 78ad8a1646 Small tweak for the new ignore function. 2015-09-16 12:08:09 -07:00
Jonathan Protzenko 3158445208 New setAnalogPeriodUs function.
Fixes bbc/microbit-extras#1389.
2015-09-16 11:52:25 -07:00