From cf0372aeaa5f00c9b3ce9b31a209d999389810b5 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Tue, 14 Jun 2016 13:53:05 -0700 Subject: [PATCH] adding bluetooth button service. fix for #106 --- libs/microbit-bluetooth/bluetooth.cpp | 9 +++++++++ libs/microbit-bluetooth/shims.d.ts | 7 +++++++ sim/libmbit.ts | 3 +++ 3 files changed, 19 insertions(+) diff --git a/libs/microbit-bluetooth/bluetooth.cpp b/libs/microbit-bluetooth/bluetooth.cpp index 2f1f759a..7e6f63d9 100644 --- a/libs/microbit-bluetooth/bluetooth.cpp +++ b/libs/microbit-bluetooth/bluetooth.cpp @@ -48,4 +48,13 @@ namespace bluetooth { void startAccelerometerService() { new MicroBitAccelerometerService(*uBit.ble, uBit.accelerometer); } + + /** + * Starts the button service + */ + //% help=bluetooth/start-button-service + //% blockId=bluetooth_start_button_service block="bluetooth button service" blockGap=8 + void startButtonService() { + new MicroBitButtonService(*uBit.ble); + } } diff --git a/libs/microbit-bluetooth/shims.d.ts b/libs/microbit-bluetooth/shims.d.ts index 4979fbed..85393c00 100644 --- a/libs/microbit-bluetooth/shims.d.ts +++ b/libs/microbit-bluetooth/shims.d.ts @@ -39,6 +39,13 @@ declare namespace bluetooth { //% help=bluetooth/start-accelerometer-service //% blockId=bluetooth_start_accelerometer_service block="bluetooth accelerometer service" blockGap=8 shim=bluetooth::startAccelerometerService function startAccelerometerService(): void; + + /** + * Starts the button service + */ + //% help=bluetooth/start-button-service + //% blockId=bluetooth_start_button_service block="bluetooth button service" blockGap=8 shim=bluetooth::startButtonService + function startButtonService(): void; } // Auto-generated. Do not edit. Really. diff --git a/sim/libmbit.ts b/sim/libmbit.ts index 0e5ec72f..1e9a7a92 100644 --- a/sim/libmbit.ts +++ b/sim/libmbit.ts @@ -630,6 +630,9 @@ namespace pxsim.bluetooth { export function startAccelerometerService(): void { // TODO } + export function startButtonService(): void { + // TODO + } } namespace pxsim.images {