Commit Graph

755 Commits

Author SHA1 Message Date
alennie1993 aacba5f36e Quick Clean up, added MIT Licence to some files and a spelling mistake corrected. Issues #269 & #287 resolved. 2017-06-14 10:03:51 +01:00
Aidan Lennie e098364e5f Adding MIT Licence 2017-06-13 17:19:32 +01:00
Martin Woolley 66fd96b098 Added magnetometer calibration characteristic to the Bluetooth Magnetometer Service 2017-06-06 07:50:03 +01:00
Martin Woolley 621e328df1 Added new Magnetometer Calibration characteristic to Magnetometer Service 2017-05-30 10:17:08 +01:00
Joe Finney b84f89d27c Merge pull request #292 from lancaster-university/bugfix_289
Bugfix 289
2017-05-27 14:27:48 +01:00
Joe Finney e19594c73e Update comment for accuracy 2017-05-27 14:26:50 +01:00
Joe Finney 89294e4637 Merge pull request #293 from lancaster-university/bugfix-286
Erase scratch pages after use [#286]
2017-05-27 11:09:19 +01:00
Joe Finney 66d6fb3f81 Erase scratch pages after use [#286]
MicrobitFileSystem occasionally needs to "refresh" FLASH page that have been
marked as deleted, such that they can be used again. When this happens, an
unused FLASH page is used to temporarily hold wanted data (a scratch page).
This is alloctaed ina round robin fashion from all available data pages to
load balance wear across pages.

This patch ensures that a page used in this fashion is erased after use, such
that it is ready for use again as a data page.

This patch may also address https://github.com/Microsoft/pxt/issues/1495
2017-05-27 10:57:21 +01:00
Joe Finney c0995137f0 Cleanup internal method names
- Rename isInput() to isActiveInput() to improve readability
  - Remove isOutput() method
2017-05-25 23:41:37 +01:00
Joe Finney 2fe103f70b Fix MicroBitIOPinService 8bit AnalogInput bug #289
- Analog Input now correctly reads values in the 8 bit range.
- Analog Output now reaches 100% duty cycle for 8 but input value of 255.
- Reintroduce notify() call into updateBLEInputs() method.
- Minor code cleanups
2017-05-25 16:12:24 +01:00
Joe Finney 0aaedaa5d9 Remove repeated code in MicroBitIOPinService 2017-05-25 13:38:40 +01:00
Joe Finney ac5a750757 Remove redundant code in MicroBitIOPinService 2017-05-25 13:25:50 +01:00
James Devine d5ee7d99b6 microbit-dal: Corrected bad validation in MicroBitImage.printImage
width was validated, height was not. Documentation also modified to have a better example that works.
2017-04-23 00:53:16 +01:00
James Devine 58f8f0f22e microbit-dal: ManagedString heap error
Some higher level languages initialise Strings and Images used RefCounted types. In certain scenarios, they could be initialised with NULL, there was no error checking for this case, and users observed error code 030 (a heap error). This was traced back to some error checking in RefCounted.cpp, where the reference is tested. In these initialisers the RefCounted type was NULL.

Added some additional error checking in ManagedString and ManagedImage.

Closes #283.
2017-04-23 00:27:18 +01:00
Joe Finney 74fa06c8d0 Bump to microbit-dal v2.0.0-rc9 2017-04-21 16:20:53 +01:00
Joe Finney 20cfd2bc3b microbit: Ensure MicroBitFileSystem status flags are always initialized.
Addresses Issue https://github.com/Microsoft/pxt/issues/1682
2017-04-21 00:23:20 +01:00
James Devine a85d014382 Merge pull request #247 from sh1boot/squash
Quadrature decoder hardware driver.
2017-04-07 10:13:47 +01:00
Simon Hosie c1626c208c Remove sentinel pinNC from QDEC; use NULL instead. 2017-04-06 22:27:22 -07:00
Simon Hosie e2ec932480 Use better quadrature decoder flag names.
Name the quadrature QDEC_USE_xx rather than QDEC_USING_xx, because they
represent intent rather than status.

Also fixes bug where system tick wouldn't be registered at start() when
configured to do so.
2017-04-06 22:00:08 -07:00
Simon Hosie 3fd457c2b8 Quadrature decoder hardware driver. 2017-04-02 02:17:39 -07:00
Joe Finney 2f32db3e14 microbit: Ensure LED matrix display is cleared when brightness is set to '0' (#281)
- Fixed optimsation case for when brightness is set to zero in render() method.
- Introduce equivalent optimsation case for renderGreyscale(), to
  promote consistent behaviour.
2017-03-24 16:27:36 +00:00
Joe Finney fe3a3dd1f4 Update target version for mbed-classic and ble-nrf51822 2017-03-01 17:51:51 +00:00
Joe Finney 1f4893d1ff Bump Revision to microbit-dal-rc8 2017-03-01 17:44:44 +00:00
Joe Finney 9adafccbf6 Merge pull request #276 from lancaster-university/sd-safe-storage
Sd safe storage
2017-03-01 17:43:55 +00:00
Joe Finney 4b3520daa6 Update to MicrobitBLEManager to allow safe storage of BLE bond information 2017-03-01 17:41:28 +00:00
Joe Finney 564e7d700c Set default FS Cache size to zero.
- Workaround for minor bug noted that can cause data corruption. #275
2017-03-01 16:48:57 +00:00
Joe Finney c25ac4a79f Update to use NRF Event to detect end of FLASH write/erase transaction 2017-03-01 16:48:24 +00:00
Joe Finney 73d51d8731 Add Support for Flash Erase / Write operations with BLE Enabled
Nordic's Soft Device is not tolerant to applications making direct access to
the non-volatile memory controller (NVMC) hardware. This patch adds a code
path to replace native NVMC calls with equivalent Soft Device calls when Soft
Device is enabled.

This patch is necessary to resolve issues related to lock ups when using
either MicroBitStorage or MicroBitFileSystem when BLE is enabled.
2017-03-01 02:48:45 +00:00
Joe Finney 96549fb657 Merge pull request #264 from lancaster-university/pwm-patch
Pwm patch + AnalogOut updates
2017-02-28 09:50:33 +00:00
James Devine b90c21de1c microbit-dal: DynamicPWM now has a static period member variable
Previously DynamicPWM had a per instance member variable that was not shared across all instances of DyanmicPWM which is not true to the hardware, that shares a period across all pwm channels.

This commit adds a static member variable, and sets the default to 20000 us - a default set at the mbed layer.
2017-02-24 10:22:51 +00:00
James Devine 15194f2ed2 microbit-dal: swapped pwm implementation for a more stable one
As per issue #218, pwm has always been unstable resulting in a clicking noise atwhen tones are amplified, and twitchy servo controllers.

This commit when combined with lancaster-university/mbed-classic#03f4fb and lancaster-university/mbed-classic#be51bd will produce a more stable waveform, whilst also maintaining the behaviour of DynamicPwm which has now been absorbed by the PWM driver itself.
2017-02-01 19:22:59 +00:00
James Devine 350aad7a90 microbit-dal: revised capability mapping for the MicroBitPin abstraction.
As per issue #115, AnalogOut was not capable on all IO even though there was no reason for this to be the case.

This commit adds a revised PinCapability enumeration, adding AnalogOut capability to all capable pins using the PIN_CAPABILITY_STANDARD enum, which combines PIN_CAPABILITY_DIGITAL and PIN_CAPABILITY_ANALOG_OUT.
2017-01-31 11:52:20 +00:00
Joe Finney f569f5f6d1 Merge pull request #253 from kartben/fix-uart-read
fix for issue #252: bug in MicroBitUARTService#read when buffer conta…
2017-01-06 17:09:04 +00:00
Joe Finney aa1dab73d1 Merge pull request #255 from bluetooth-mdw/master
Delayed disconnecting after pairing complete by 500ms
2016-12-21 11:31:00 +00:00
Martin Woolley 673c16c0ef Moved fiber_remove_idle_component inside condition which delays BLE disconnect 2016-12-20 17:31:40 +00:00
Martin Woolley 404c46251b Delayed disconnecting after pairing complete by 500ms 2016-12-20 13:30:37 +00:00
Martin Woolley ddbcec094e Delayed disconnecting after pairing complete by 500ms 2016-12-20 13:28:10 +00:00
Benjamin Cabé 192c9664b2 update condition to avoid reading an extra character after len characters have been read
Signed-off-by: Benjamin Cabé <benjamin@eclipse.org>
2016-12-20 10:15:50 +01:00
Benjamin Cabé 5ba5ccb712 fix for issue #252: bug in MicroBitUARTService#read when buffer contains NULL character
Signed-off-by: Benjamin Cabé <benjamin@eclipse.org>
2016-12-19 17:18:27 +01:00
James Devine 12bf127ae2 microbit-dal: moved to v2.0.0-rc7 2016-11-30 11:27:56 +00:00
James Devine 10ce2b9f7a microbit-dal: removed ManagedString APIs for Eddystone Uid
ManagedString should only be used for string based data.
The APIs removed by this commit presumed that this was not the case.
ManagedString implicitly contains error checking, which makes it
unsuitable for sequences of bytes that may contain null termination
characters (0x00).

Removing these APIs for now was the best option until a future time
when ManagedBuffer can be used within the runtime.
2016-11-30 11:22:54 +00:00
James Devine 95346586ab microbit-dal: Revisions to MicroBitEddystone.
This commit includes the addition of comments,
some validation and corrections to C++ definitions.

Also, a minor API revision for the Eddystone class, which
simple removes Eddystone from member functions, as it
it implicit that you will be setting a URL using Eddystone
in the MicroBitEddystone class.
2016-11-30 10:43:53 +00:00
James Devine b251a59b9d microbit-dal: moved to v2.0.0-rc6 2016-11-29 18:35:18 +00:00
Joe Finney 614083f5cf Merge pull request #231 from bluetooth-mdw/master
Refactored Eddystone support, added UID frame type
2016-10-31 21:23:30 +00:00
Martin Woolley 05c333172f Even prettier? 2016-10-28 14:17:23 +01:00
Martin Woolley 4857c83446 source code pretty formatted 2016-10-28 12:15:54 +01:00
Martin Woolley 15db7558f5 Refactored Eddystone support, introducing a new Eddystone class which separates the Eddystone message format from the more general responsibilities of the MicroBitBLEManager class. Hopefully the pattern paves the way for other beacon formats (e.g. iBeacon, AltBeacon) to be introduced via their own classes.
Added support for the Eddystone UID frame type.

Example use:

```
char UID_NAMESPACE[] = {0x0E,0x67,0x47,0x04,0x42,0xD0,0x14,0x06,0xD5,0x83}; // sha-1 hash of "com.bittysoftware"
char UID_INSTANCE[]  = {0x00 , 0x00, 0x00, 0x00, 0x00, 0x01};

uint8_t advertising = 0;
uint8_t tx_power_level = 6;

void startAdvertising() {
    uBit.bleManager.advertiseEddystoneUid(UID_NAMESPACE, UID_INSTANCE, tx_power_level, false);
    uBit.bleManager.setTransmitPower(6);
    uBit.display.scroll("ADVERTISING");
    advertising = 1;
}
```
2016-10-27 11:01:04 +01:00
Martin Woolley 75b26f8339 Made MicroBitBLEManager more singleton-like. Made class instance variable public static.
Refactored Eddystone support, moving frame content code to new MicroBitEddystone class in anticipation of adding other frame formats.
2016-10-26 14:58:09 +01:00
Martin Woolley 5d32e70367 Made MicroBitBLEManager more singleton-like
Refatcored Eddystone support, moving frame content code to new MicroBitEddystone class.
2016-10-26 14:15:56 +01:00
Joe Finney be56fff183 microbit: Add more detail to RSSI method documentation 2016-10-25 17:42:48 +01:00