diff --git a/libs/microbit-bluetooth/bluetooth.cpp b/libs/microbit-bluetooth/bluetooth.cpp index 594e5727..1bb5bdbd 100644 --- a/libs/microbit-bluetooth/bluetooth.cpp +++ b/libs/microbit-bluetooth/bluetooth.cpp @@ -30,4 +30,13 @@ namespace bluetooth { void startTemperatureService() { new MicroBitTemperatureService(*uBit.ble, uBit.thermometer); } + + /** + * Starts the magnetometer service + */ + //% help=bluetooth/start-magnetometer-service + //% blockId=bluetooth_start_magnetometer_service block="bluetooth magnetometer service" + void startMagnetometerService() { + new MicroBitMagnetometerService(*uBit.ble, uBit.compass); + } } diff --git a/libs/microbit-bluetooth/shims.d.ts b/libs/microbit-bluetooth/shims.d.ts index d96b38f8..37fc827c 100644 --- a/libs/microbit-bluetooth/shims.d.ts +++ b/libs/microbit-bluetooth/shims.d.ts @@ -25,6 +25,13 @@ declare namespace bluetooth { //% help=bluetooth/start-temperature-service //% blockId=bluetooth_start_temperature_service block="bluetooth temperature service" shim=bluetooth::startTemperatureService function startTemperatureService(): void; + + /** + * Starts the magnetometer service + */ + //% help=bluetooth/start-magnetometer-service + //% blockId=bluetooth_start_magnetometer_service block="bluetooth magnetometer service" shim=bluetooth::startMagnetometerService + function startMagnetometerService(): void; } // Auto-generated. Do not edit. Really. diff --git a/sim/libmbit.ts b/sim/libmbit.ts index 4a386ceb..0b59481c 100644 --- a/sim/libmbit.ts +++ b/sim/libmbit.ts @@ -624,6 +624,9 @@ namespace pxsim.bluetooth { export function startTemperatureService(): void { // TODO } + export function startMagnetometerService(): void { + // TODO + } } namespace pxsim.images {