Added Partial Flashing (#1)

* Enter BLE mode using a MicroBitEvent

* Using Key/Value store rather than GPREGRET for Hard Reset persistance

* Skip timeout

* Updated tag

* Updated tag

* Updated tag

* Updated tag

* Removed Listener

* Updated animation

* Updated tag

* Updated tag

* Updated tag

* Updated tag

* Changed animation timing

* Updated tag

* Updated tag

* Updated tag

* Updated animation timing

* Added incomplete flash flag

* Updated tag

* Removed Event Listener from MicroBit.h
This commit is contained in:
Sam Kent 2018-05-04 14:46:40 +01:00 committed by GitHub
parent f4e7e01c1d
commit a6ab0e6c1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 6 deletions

View File

@ -4,7 +4,7 @@
"description": "A simple to use collection of the most commonly used components in the micro:bit runtime",
"license": "MIT",
"dependencies": {
"microbit-dal": "lancaster-university/microbit-dal#v2.0.0-rc10"
"microbit-dal": "microbit-sam/microbit-dal#pf_v0.2.4"
},
"extraIncludes": [
"inc"

View File

@ -130,16 +130,33 @@ void MicroBit::init()
status |= MICROBIT_INITIALIZED;
#if CONFIG_ENABLED(MICROBIT_BLE_PAIRING_MODE)
// Test if we need to enter BLE pairing mode...
int i=0;
// Test if we need to enter BLE pairing mode
// If a BLEMode Key has been set boot straight into BLE mode
KeyValuePair* BLEMode = storage.get("BLEMode");
KeyValuePair* flashIncomplete = storage.get("flashIncomplete");
sleep(100);
while (buttonA.isPressed() && buttonB.isPressed() && i<10)
// Animation
uint8_t x = 0; uint8_t y = 0;
while ((buttonA.isPressed() && buttonB.isPressed() && i<25) || BLEMode != NULL || flashIncomplete != NULL)
{
sleep(100);
i++;
display.image.setPixelValue(x,y,255);
sleep(50);
i++; x++;
if (i == 10)
// Gradually fill screen
if(x == 5){
y++; x = 0;
}
if (i == 25 || BLEMode != NULL)
{
// Remove KV if it exists
if(BLEMode != NULL){
storage.remove("BLEMode");
delete BLEMode;
}
#if CONFIG_ENABLED(MICROBIT_HEAP_ALLOCATOR) && CONFIG_ENABLED(MICROBIT_HEAP_REUSE_SD)
microbit_create_heap(MICROBIT_SD_GATT_TABLE_START + MICROBIT_SD_GATT_TABLE_SIZE, MICROBIT_SD_LIMIT);
#endif