added 'microbit-bluetooth' package
This commit is contained in:
		
							
								
								
									
										1
									
								
								libs/microbit-bluetooth/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								libs/microbit-bluetooth/README.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
# Bluetooth services
 | 
			
		||||
							
								
								
									
										15
									
								
								libs/microbit-bluetooth/bluetooth.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								libs/microbit-bluetooth/bluetooth.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
#include "pxt.h"
 | 
			
		||||
#include "MESEvents.h"
 | 
			
		||||
 | 
			
		||||
using namespace pxt;
 | 
			
		||||
//% color=156 weight=79
 | 
			
		||||
namespace bluetooth {
 | 
			
		||||
    /**
 | 
			
		||||
    *  Starts the Bluetooth IO pin service
 | 
			
		||||
    */
 | 
			
		||||
    //% help=reference/bluetooth/io-pin-service
 | 
			
		||||
    //% blockid=bluetooth-io-pin-service block="start io pin service"
 | 
			
		||||
    void startIOPinService() {
 | 
			
		||||
        new MicroBitIOPinService(*uBit.ble, uBit.io);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										5
									
								
								libs/microbit-bluetooth/enums.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								libs/microbit-bluetooth/enums.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
// Auto-generated. Do not edit.
 | 
			
		||||
declare namespace bluetooth {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Auto-generated. Do not edit. Really.
 | 
			
		||||
							
								
								
									
										24
									
								
								libs/microbit-bluetooth/pxt.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								libs/microbit-bluetooth/pxt.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
			
		||||
{
 | 
			
		||||
    "name": "microbit-bluetooth",
 | 
			
		||||
    "description": "Bluetooth services",
 | 
			
		||||
    "files": [
 | 
			
		||||
        "README.md",
 | 
			
		||||
        "enums.d.ts",
 | 
			
		||||
        "shims.d.ts",
 | 
			
		||||
        "bluetooth.cpp"
 | 
			
		||||
    ],
 | 
			
		||||
    "public": true,
 | 
			
		||||
    "dependencies": {
 | 
			
		||||
        "microbit": "file:../microbit"
 | 
			
		||||
    },
 | 
			
		||||
    "yotta": {
 | 
			
		||||
        "config": {
 | 
			
		||||
            "microbit-dal": {
 | 
			
		||||
                "bluetooth": {
 | 
			
		||||
                    "enabled": 1
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    "installedVersion": "prfndw"
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										16
									
								
								libs/microbit-bluetooth/shims.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								libs/microbit-bluetooth/shims.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
// Auto-generated. Do not edit.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    //% color=156 weight=79
 | 
			
		||||
declare namespace bluetooth {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     *  Starts the Bluetooth IO pin service
 | 
			
		||||
     */
 | 
			
		||||
    //% help=reference/bluetooth/io-pin-service
 | 
			
		||||
    //% blockid=bluetooth-io-pin-service block="start io pin service" shim=bluetooth::startIOPinService
 | 
			
		||||
    function startIOPinService(): void;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Auto-generated. Do not edit. Really.
 | 
			
		||||
@@ -204,7 +204,7 @@ namespace devices {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Registers code to run when the device notifies about a change of signal strength.
 | 
			
		||||
     * @param body TODO
 | 
			
		||||
     * @param body Code run when the signal strength changes.
 | 
			
		||||
     */
 | 
			
		||||
    //% weight=23 help=devices/on-signal-strength-changed
 | 
			
		||||
    //% blockId=devices_signal_strength_changed_event block="on signal strength changed" icon="\uf012"
 | 
			
		||||
@@ -213,4 +213,3 @@ namespace devices {
 | 
			
		||||
        registerWithDal(MES_SIGNAL_STRENGTH_ID, MICROBIT_EVT_ANY, body);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								libs/microbit-devices/shims.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								libs/microbit-devices/shims.d.ts
									
									
									
									
										vendored
									
									
								
							@@ -57,7 +57,7 @@ declare namespace devices {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Registers code to run when the device notifies about a change of signal strength.
 | 
			
		||||
     * @param body TODO
 | 
			
		||||
     * @param body Code run when the signal strength changes.
 | 
			
		||||
     */
 | 
			
		||||
    //% weight=23 help=devices/on-signal-strength-changed
 | 
			
		||||
    //% blockId=devices_signal_strength_changed_event block="on signal strength changed" icon="\uf012" shim=devices::onSignalStrengthChanged
 | 
			
		||||
 
 | 
			
		||||
@@ -29,8 +29,8 @@ namespace basic {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Draws an image on the LED screen.
 | 
			
		||||
     * @param leds TODO
 | 
			
		||||
     * @param interval TODO
 | 
			
		||||
     * @param leds the pattern of LED to turn on/off
 | 
			
		||||
     * @param interval time in milliseconds to pause after drawing
 | 
			
		||||
     */
 | 
			
		||||
    //% help=basic/show-leds 
 | 
			
		||||
    //% weight=95 blockGap=8
 | 
			
		||||
@@ -77,8 +77,8 @@ namespace basic {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Shows a sequence of LED screens as an animation.
 | 
			
		||||
     * @param leds TODO
 | 
			
		||||
     * @param interval TODO
 | 
			
		||||
     * @param leds pattern of LEDs to turn on/off
 | 
			
		||||
     * @param interval time in milliseconds between each redraw
 | 
			
		||||
     */
 | 
			
		||||
    //% help=basic/show-animation imageLiteral=1 async
 | 
			
		||||
    void showAnimation(ImageLiteral leds, int interval = 400) {
 | 
			
		||||
@@ -87,7 +87,7 @@ namespace basic {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Draws an image on the LED screen.
 | 
			
		||||
     * @param leds TODO
 | 
			
		||||
     * @param leds pattern of LEDs to turn on/off
 | 
			
		||||
     */
 | 
			
		||||
    //% help=basic/plot-leds weight=80
 | 
			
		||||
    void plotLeds(ImageLiteral leds) {
 | 
			
		||||
@@ -104,7 +104,7 @@ namespace basic {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Repeats the code forever in the background. On each iteration, allows other codes to run.
 | 
			
		||||
     * @param body TODO
 | 
			
		||||
     * @param body code to execute
 | 
			
		||||
     */
 | 
			
		||||
    //% help=basic/forever weight=55 blockGap=8
 | 
			
		||||
    //% blockId=device_forever block="forever" icon="\uf01e"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										12
									
								
								libs/microbit/shims.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								libs/microbit/shims.d.ts
									
									
									
									
										vendored
									
									
								
							@@ -128,8 +128,8 @@ declare namespace basic {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Draws an image on the LED screen.
 | 
			
		||||
     * @param leds TODO
 | 
			
		||||
     * @param interval TODO
 | 
			
		||||
     * @param leds the pattern of LED to turn on/off
 | 
			
		||||
     * @param interval time in milliseconds to pause after drawing
 | 
			
		||||
     */
 | 
			
		||||
    //% help=basic/show-leds 
 | 
			
		||||
    //% weight=95 blockGap=8
 | 
			
		||||
@@ -159,22 +159,22 @@ declare namespace basic {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Shows a sequence of LED screens as an animation.
 | 
			
		||||
     * @param leds TODO
 | 
			
		||||
     * @param interval TODO
 | 
			
		||||
     * @param leds pattern of LEDs to turn on/off
 | 
			
		||||
     * @param interval time in milliseconds between each redraw
 | 
			
		||||
     */
 | 
			
		||||
    //% help=basic/show-animation imageLiteral=1 async interval.defl=400 shim=basic::showAnimation
 | 
			
		||||
    function showAnimation(leds: string, interval?: number): void;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Draws an image on the LED screen.
 | 
			
		||||
     * @param leds TODO
 | 
			
		||||
     * @param leds pattern of LEDs to turn on/off
 | 
			
		||||
     */
 | 
			
		||||
    //% help=basic/plot-leds weight=80 imageLiteral=1 shim=basic::plotLeds
 | 
			
		||||
    function plotLeds(leds: string): void;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Repeats the code forever in the background. On each iteration, allows other codes to run.
 | 
			
		||||
     * @param body TODO
 | 
			
		||||
     * @param body code to execute
 | 
			
		||||
     */
 | 
			
		||||
    //% help=basic/forever weight=55 blockGap=8
 | 
			
		||||
    //% blockId=device_forever block="forever" icon="\uf01e" shim=basic::forever
 | 
			
		||||
 
 | 
			
		||||
@@ -7,6 +7,7 @@
 | 
			
		||||
        "libs/microbit",
 | 
			
		||||
        "libs/microbit-radio",
 | 
			
		||||
        "libs/microbit-devices",
 | 
			
		||||
        "libs/microbit-bluetooth",
 | 
			
		||||
        "libs/neopixel"
 | 
			
		||||
    ],
 | 
			
		||||
    "cloud": {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user