Partial Flashing disabled by default. Enabled for MakeCode builds
This commit is contained in:
parent
5d40fcf479
commit
26d7b6d420
3 changed files with 22 additions and 0 deletions
|
@ -298,6 +298,14 @@ extern uint32_t __etext;
|
|||
#define MICROBIT_BLE_DEVICE_INFORMATION_SERVICE 1
|
||||
#endif
|
||||
|
||||
// Enable/Disable BLE Service: MicroBitPartialFlashingService
|
||||
// This enables the flashing part of the partial flashing service.
|
||||
// Partial flashing is currently only possible for programs built using MakeCode
|
||||
// and is disabled by default.
|
||||
#ifndef MICROBIT_BLE_PARTIAL_FLASHING
|
||||
#define MICROBIT_BLE_PARTIAL_FLASHING 0
|
||||
#endif
|
||||
|
||||
//
|
||||
// Accelerometer options
|
||||
//
|
||||
|
|
|
@ -117,6 +117,10 @@
|
|||
#define MICROBIT_BLE_ADVERTISING_INTERVAL YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_ADVERTISING_INTERVAL
|
||||
#endif
|
||||
|
||||
#ifdef YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_PARTIAL_FLASHING
|
||||
#define MICROBIT_BLE_PARTIAL_FLASHING YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_PARTIAL_FLASHING
|
||||
#endif
|
||||
|
||||
//we check if the user has requested open mode, otherwise we will double def!
|
||||
#if (YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_OPEN == 0)
|
||||
|
||||
|
|
|
@ -113,6 +113,7 @@ void MicroBitPartialFlashingService::onDataWritten(const GattWriteCallbackParams
|
|||
|
||||
break;
|
||||
}
|
||||
#if CONFIG_ENABLED(MICROBIT_BLE_PARTIAL_FLASHING)
|
||||
case FLASH_DATA:
|
||||
{
|
||||
// Process FLASH data packet
|
||||
|
@ -129,6 +130,7 @@ void MicroBitPartialFlashingService::onDataWritten(const GattWriteCallbackParams
|
|||
MicroBitEvent evt(MICROBIT_ID_PARTIAL_FLASHING, END_OF_TRANSMISSION);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case MICROBIT_STATUS:
|
||||
{
|
||||
/*
|
||||
|
@ -157,6 +159,14 @@ void MicroBitPartialFlashingService::onDataWritten(const GattWriteCallbackParams
|
|||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
/* Return command unknown
|
||||
*/
|
||||
uint8_t unknownCommandBuffer[] = {data[0], 0xAB, 0xCD, 0xEF};
|
||||
ble.gattServer().notify(partialFlashCharacteristicHandle, (const uint8_t *)unknownCommandBuffer, sizeof(unknownCommandBuffer));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue