Skip to content

Commit

Permalink
Merge pull request lancaster-university#382 from microbit-sam/pf-yt-t…
Browse files Browse the repository at this point in the history
…oggle

Use config.json to enable / disable Partial Flashing Service
  • Loading branch information
finneyj committed Sep 7, 2018
2 parents 0c74614 + e08535a commit 34e46f0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions inc/core/MicroBitConfig.h
Expand Up @@ -303,6 +303,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
//
Expand Down
4 changes: 4 additions & 0 deletions inc/platform/yotta_cfg_mappings.h
Expand Up @@ -125,6 +125,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)

Expand Down
3 changes: 3 additions & 0 deletions source/bluetooth/MicroBitBLEManager.cpp
Expand Up @@ -383,6 +383,9 @@ void MicroBitBLEManager::init(ManagedString deviceName, ManagedString serialNumb
// Bring up core BLE services.
#if CONFIG_ENABLED(MICROBIT_BLE_DFU_SERVICE)
new MicroBitDFUService(*ble);
#endif

#if CONFIG_ENABLED(MICROBIT_BLE_PARTIAL_FLASHING)
new MicroBitPartialFlashingService(*ble, messageBus);
#endif

Expand Down

0 comments on commit 34e46f0

Please sign in to comment.