Updates for V4 (#197)
* update yotta defaults for 16kb devices * refactor deprecated blocks * updates for button events * update button events * update refference * update docs * update docs * update button event blocks * update docs * update block id
This commit is contained in:
		@@ -426,7 +426,9 @@
 | 
			
		||||
  "input.acceleration": "Get the acceleration value in milli-gravitys (when the board is laying flat with the screen up, x=0, y=0 and z=-1024)",
 | 
			
		||||
  "input.acceleration|param|dimension": "x, y, or z dimension, eg: Dimension.X",
 | 
			
		||||
  "input.assumeCalibrationCompass": "Obsolete, compass calibration is automatic.",
 | 
			
		||||
  "input.buttonEventValueId": "Returns the value of a C++ runtime constant",
 | 
			
		||||
  "input.buttonEventClick": "Returns the ID of an Click Event",
 | 
			
		||||
  "input.buttonEventDown": "Returns the ID of an Down Event",
 | 
			
		||||
  "input.buttonEventValue": "Returns the ID of an Button Event",
 | 
			
		||||
  "input.buttonIsPressed": "Get the button state (pressed or not) for ``A`` and ``B``.",
 | 
			
		||||
  "input.buttonIsPressed|param|button": "the button to query the request, eg: Button.A",
 | 
			
		||||
  "input.calibrateCompass": "Obsolete, compass calibration is automatic.",
 | 
			
		||||
 
 | 
			
		||||
@@ -52,6 +52,7 @@
 | 
			
		||||
  "Button.AB|block": "A+B",
 | 
			
		||||
  "ButtonEvent.Click|block": "clicked",
 | 
			
		||||
  "ButtonEvent.Down|block": "pressed down",
 | 
			
		||||
  "ButtonEvent.Hold|block": "hold",
 | 
			
		||||
  "ButtonEvent.LongClick|block": "long clicked",
 | 
			
		||||
  "ButtonEvent.Up|block": "released up",
 | 
			
		||||
  "Colors.Blue|block": "blue",
 | 
			
		||||
@@ -335,7 +336,9 @@
 | 
			
		||||
  "images|block": "images",
 | 
			
		||||
  "input.acceleration|block": "acceleration (mg)|%NAME",
 | 
			
		||||
  "input.assumeCalibrationCompass|block": "assume calibration compass",
 | 
			
		||||
  "input.buttonEventValueId|block": "%id",
 | 
			
		||||
  "input.buttonEventClick|block": "clicked",
 | 
			
		||||
  "input.buttonEventDown|block": "pressed down",
 | 
			
		||||
  "input.buttonEventValue|block": "%id",
 | 
			
		||||
  "input.buttonIsPressed|block": "button|%NAME|is pressed",
 | 
			
		||||
  "input.calibrateCompass|block": "calibrate compass",
 | 
			
		||||
  "input.clearCalibrationCompass|block": "clear calibration compass",
 | 
			
		||||
@@ -344,12 +347,12 @@
 | 
			
		||||
  "input.isGesture|block": "is %gesture gesture",
 | 
			
		||||
  "input.lightLevel|block": "light level",
 | 
			
		||||
  "input.magneticForce|block": "magnetic force (µT)|%NAME",
 | 
			
		||||
  "input.onButtonEvent|block": "on button %NAME| %eventType=control_button_event_value_id",
 | 
			
		||||
  "input.onButtonEvent|block": "on button %NAME| %eventType",
 | 
			
		||||
  "input.onButtonPressed|block": "on button|%NAME|pressed",
 | 
			
		||||
  "input.onGesture|block": "on |%NAME",
 | 
			
		||||
  "input.onPinPressed|block": "on pin %name|pressed",
 | 
			
		||||
  "input.onPinReleased|block": "on pin %NAME|released",
 | 
			
		||||
  "input.onPinTouchEvent|block": "on pin %name| %eventType=control_button_event_value_id",
 | 
			
		||||
  "input.onPinTouchEvent|block": "on pin %name| %eventType",
 | 
			
		||||
  "input.pinIsPressed|block": "pin %NAME|is pressed",
 | 
			
		||||
  "input.rotation|block": "rotation (°)|%NAME",
 | 
			
		||||
  "input.runningTimeMicros|block": "running time (micros)",
 | 
			
		||||
 
 | 
			
		||||
@@ -116,6 +116,7 @@ namespace basic {
 | 
			
		||||
   /**
 | 
			
		||||
    * Sets the color on the build-in LED. Set to 0 to turn off.
 | 
			
		||||
    */
 | 
			
		||||
   //% help=basic/set-led-color
 | 
			
		||||
    //% blockId=device_set_led_color
 | 
			
		||||
    //% block="set led to %color=colorNumberPicker"
 | 
			
		||||
    //% color.defl=0xff0000
 | 
			
		||||
@@ -140,6 +141,7 @@ namespace basic {
 | 
			
		||||
    * Sets the color on the build-in LED. Set to 0 to turn off.
 | 
			
		||||
    */
 | 
			
		||||
    //% blockId=device_turn_rgb_led_off block="turn build-in LED off"
 | 
			
		||||
    //% help=basic/turn-rgb-led-off
 | 
			
		||||
    //% weight=10
 | 
			
		||||
    //% group="RGB LED"
 | 
			
		||||
    //% advanced=true
 | 
			
		||||
 
 | 
			
		||||
@@ -76,6 +76,7 @@ namespace basic {
 | 
			
		||||
     * @param blue value of the blue channel between 0 and 255. eg: 255
 | 
			
		||||
     */
 | 
			
		||||
    //% weight=3
 | 
			
		||||
    //% help=basic/rgb
 | 
			
		||||
    //% blockId="core_rgb" block="red %red|green %green|blue %blue"
 | 
			
		||||
    //% group="RGB LED"
 | 
			
		||||
    export function rgb(red: number, green: number, blue: number): number {
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@
 | 
			
		||||
    <block type="device_button_selected_event" x="0" y="0">
 | 
			
		||||
        <field name="NAME">Button.AB</field>
 | 
			
		||||
        <value name="eventType">
 | 
			
		||||
            <shadow type="control_button_event_value_id"></shadow>
 | 
			
		||||
            <shadow type="control_button_event_value"></shadow>
 | 
			
		||||
        </value>
 | 
			
		||||
        <statement name="HANDLER">
 | 
			
		||||
            <block type="variables_set">
 | 
			
		||||
@@ -129,13 +129,13 @@
 | 
			
		||||
    <block type="device_pin_custom_event" x="556" y="156">
 | 
			
		||||
        <field name="name">TouchPin.P0</field>
 | 
			
		||||
        <value name="eventType">
 | 
			
		||||
            <shadow type="control_button_event_value_id"></shadow>
 | 
			
		||||
            <shadow type="control_button_event_value"></shadow>
 | 
			
		||||
        </value>
 | 
			
		||||
    </block>
 | 
			
		||||
    <block type="device_pin_custom_event" x="560" y="274">
 | 
			
		||||
        <field name="name">TouchPin.P0</field>
 | 
			
		||||
        <value name="eventType">
 | 
			
		||||
            <shadow type="control_button_event_value_id"></shadow>
 | 
			
		||||
            <shadow type="control_button_event_value"></shadow>
 | 
			
		||||
        </value>
 | 
			
		||||
    </block>
 | 
			
		||||
</xml>
 | 
			
		||||
@@ -133,7 +133,7 @@
 | 
			
		||||
        </block>
 | 
			
		||||
        <block type="device_pin_custom_event" x="2009" y="121">
 | 
			
		||||
                <value name="eventType">
 | 
			
		||||
                        <shadow type="control_button_event_value_id"></shadow>
 | 
			
		||||
                        <shadow type="control_button_event_value"></shadow>
 | 
			
		||||
                </value>
 | 
			
		||||
                <statement name="HANDLER">
 | 
			
		||||
                        <block type="device_led_toggle">
 | 
			
		||||
@@ -435,7 +435,7 @@
 | 
			
		||||
        <block type="device_button_selected_event" x="896" y="634">
 | 
			
		||||
                <field name="NAME">Button.AB</field>
 | 
			
		||||
                <value name="eventType">
 | 
			
		||||
                        <shadow type="control_button_event_value_id"></shadow>
 | 
			
		||||
                        <shadow type="control_button_event_value"></shadow>
 | 
			
		||||
                </value>
 | 
			
		||||
                <statement name="HANDLER">
 | 
			
		||||
                        <block type="device_plot">
 | 
			
		||||
@@ -512,7 +512,7 @@
 | 
			
		||||
        </block>
 | 
			
		||||
        <block type="device_pin_custom_event" x="478" y="950">
 | 
			
		||||
                <value name="eventType">
 | 
			
		||||
                        <shadow type="control_button_event_value_id"></shadow>
 | 
			
		||||
                        <shadow type="control_button_event_value"></shadow>
 | 
			
		||||
                </value>
 | 
			
		||||
                <statement name="HANDLER"></statement>
 | 
			
		||||
        </block>
 | 
			
		||||
 
 | 
			
		||||
@@ -124,6 +124,7 @@ namespace basic {
 | 
			
		||||
     * @param interval the amount of time (milliseconds) to show the needle. Default is 600.
 | 
			
		||||
     */
 | 
			
		||||
    //% weight=50 blockGap=8
 | 
			
		||||
    //% help=basic/show-compass
 | 
			
		||||
    //% blockId=basic_show_compass
 | 
			
		||||
    //% block="show compass needle for $interval|ms"
 | 
			
		||||
    //% interval.shadow=timePicker
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										13
									
								
								libs/core/enums.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										13
									
								
								libs/core/enums.d.ts
									
									
									
									
										vendored
									
									
								
							@@ -41,17 +41,20 @@ declare namespace basic {
 | 
			
		||||
 | 
			
		||||
    declare const enum ButtonEvent {
 | 
			
		||||
    //% blockIdentity="input.buttonEventValueId"
 | 
			
		||||
    //% block="pressed down"
 | 
			
		||||
    Down = 1,  // MICROBIT_BUTTON_EVT_DOWN
 | 
			
		||||
    //% blockIdentity="input.buttonEventValueId"
 | 
			
		||||
    //% block="released up"
 | 
			
		||||
    Up = 2,  // MICROBIT_BUTTON_EVT_UP
 | 
			
		||||
    //% blockIdentity="input.buttonEventValueId"
 | 
			
		||||
    //% block="clicked"
 | 
			
		||||
    Click = 3,  // MICROBIT_BUTTON_EVT_CLICK
 | 
			
		||||
    //% blockIdentity="input.buttonEventValueId"
 | 
			
		||||
    //% block="long clicked"
 | 
			
		||||
    LongClick = 4,  // MICROBIT_BUTTON_EVT_LONG_CLICK
 | 
			
		||||
    //% blockIdentity="input.buttonEventValueId"
 | 
			
		||||
    //% block="pressed down"
 | 
			
		||||
    Down = 1,  // MICROBIT_BUTTON_EVT_DOWN
 | 
			
		||||
    //% blockIdentity="input.buttonEventValueId"
 | 
			
		||||
    //% block="released up"
 | 
			
		||||
    Up = 2,  // MICROBIT_BUTTON_EVT_UP
 | 
			
		||||
    //% block="hold"
 | 
			
		||||
    Hold = 5,  // MICROBIT_BUTTON_EVT_HOLD
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -8,6 +8,12 @@ enum class Button {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum class ButtonEvent {
 | 
			
		||||
    //% blockIdentity="input.buttonEventValueId"
 | 
			
		||||
    //% block="pressed down"
 | 
			
		||||
    Down = MICROBIT_BUTTON_EVT_DOWN,
 | 
			
		||||
    //% blockIdentity="input.buttonEventValueId"
 | 
			
		||||
    //% block="released up"
 | 
			
		||||
    Up = MICROBIT_BUTTON_EVT_UP,
 | 
			
		||||
    //% blockIdentity="input.buttonEventValueId"
 | 
			
		||||
    //% block="clicked"
 | 
			
		||||
    Click = MICROBIT_BUTTON_EVT_CLICK,
 | 
			
		||||
@@ -15,11 +21,8 @@ enum class ButtonEvent {
 | 
			
		||||
    //% block="long clicked"
 | 
			
		||||
    LongClick = MICROBIT_BUTTON_EVT_LONG_CLICK,
 | 
			
		||||
    //% blockIdentity="input.buttonEventValueId"
 | 
			
		||||
    //% block="pressed down"
 | 
			
		||||
    Down = MICROBIT_BUTTON_EVT_DOWN,
 | 
			
		||||
    //% blockIdentity="input.buttonEventValueId"
 | 
			
		||||
    //% block="released up"
 | 
			
		||||
    Up = MICROBIT_BUTTON_EVT_UP,
 | 
			
		||||
    //% block="hold"
 | 
			
		||||
    Hold = MICROBIT_BUTTON_EVT_HOLD,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum class Dimension {
 | 
			
		||||
@@ -176,6 +179,8 @@ enum class MesDpadButtonInfo {
 | 
			
		||||
 | 
			
		||||
//% color=#B4009E weight=99 icon="\uf192"
 | 
			
		||||
namespace input {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Do something when a button (A, B or both A+B) receives an event.
 | 
			
		||||
     * @param button the button
 | 
			
		||||
@@ -183,7 +188,8 @@ namespace input {
 | 
			
		||||
     * @param eventType event Type
 | 
			
		||||
     */
 | 
			
		||||
    //% help=input/on-button-event weight=100 blockGap=16
 | 
			
		||||
    //% blockId=device_button_selected_event block="on button %NAME| %eventType=control_button_event_value_id"
 | 
			
		||||
    //% blockId=device_button_selected_event block="on button %NAME| %eventType"
 | 
			
		||||
    //% eventType.shadow="control_button_event_click"
 | 
			
		||||
    //% parts="buttonpair"
 | 
			
		||||
    //% group="Events"
 | 
			
		||||
    void onButtonEvent(Button button, int eventType, Action body) {
 | 
			
		||||
@@ -231,7 +237,8 @@ namespace input {
 | 
			
		||||
     * @param body the code to run when event is fired on pin
 | 
			
		||||
     */
 | 
			
		||||
    //% help=input/on-pin-event weight=99 blockGap=16
 | 
			
		||||
    //% blockId=device_pin_custom_event block="on pin %name| %eventType=control_button_event_value_id"
 | 
			
		||||
    //% blockId=device_pin_custom_event block="on pin %name| %eventType"
 | 
			
		||||
    //% eventType.shadow="control_button_event_down"
 | 
			
		||||
    //% group="Events"
 | 
			
		||||
    void onPinTouchEvent(TouchPin name, int eventType, Action body) {
 | 
			
		||||
        auto pin = getPin((int)name);
 | 
			
		||||
@@ -273,7 +280,7 @@ namespace input {
 | 
			
		||||
    //% deprecated=true
 | 
			
		||||
    //% group="Events"
 | 
			
		||||
    void onButtonPressed(Button button, Action body) {
 | 
			
		||||
        registerWithDal((int)button, MICROBIT_BUTTON_EVT_CLICK, body);
 | 
			
		||||
        onButtonEvent(button, MICROBIT_BUTTON_EVT_CLICK, body);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -286,12 +293,7 @@ namespace input {
 | 
			
		||||
    //% group="Events"
 | 
			
		||||
    //% deprecated=true
 | 
			
		||||
    void onPinPressed(TouchPin name, Action body) {
 | 
			
		||||
        auto pin = getPin((int)name);
 | 
			
		||||
        if (!pin) return;
 | 
			
		||||
 | 
			
		||||
        // Forces the PIN to switch to makey-makey style detection.
 | 
			
		||||
        pin->isTouched();
 | 
			
		||||
        registerWithDal((int)name, MICROBIT_BUTTON_EVT_CLICK, body);
 | 
			
		||||
        onPinTouchEvent(name, MICROBIT_BUTTON_EVT_CLICK, body);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -305,12 +307,7 @@ namespace input {
 | 
			
		||||
    //% group="Events"
 | 
			
		||||
    //% deprecated=true
 | 
			
		||||
    void onPinReleased(TouchPin name, Action body) {
 | 
			
		||||
        auto pin = getPin((int)name);
 | 
			
		||||
        if (!pin) return;
 | 
			
		||||
 | 
			
		||||
        // Forces the PIN to switch to makey-makey style detection.
 | 
			
		||||
        pin->isTouched();
 | 
			
		||||
        registerWithDal((int)name, MICROBIT_BUTTON_EVT_UP, body);
 | 
			
		||||
        onPinTouchEvent(name, MICROBIT_BUTTON_EVT_UP, body);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -366,6 +363,7 @@ namespace input {
 | 
			
		||||
    /**
 | 
			
		||||
     * gets the level of loudness from 0 (silent) to 255 (loud)
 | 
			
		||||
     */
 | 
			
		||||
    //% help=input/sound-level
 | 
			
		||||
    //% blockId="soundLevel" weight=58
 | 
			
		||||
    //% block="soundLevel" blockGap=8
 | 
			
		||||
    //% group="Sensors"
 | 
			
		||||
 
 | 
			
		||||
@@ -4,16 +4,38 @@
 | 
			
		||||
//% color=#C90072 weight=99 icon="\uf192"
 | 
			
		||||
//% groups=['Events', 'States', 'Sensors', 'Configuration', 'System', 'others']
 | 
			
		||||
namespace input {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the value of a C++ runtime constant
 | 
			
		||||
     * Returns the ID of an Button Event
 | 
			
		||||
     */
 | 
			
		||||
    //% weight=1 weight=19 blockId="control_button_event_value_id" block="%id"
 | 
			
		||||
    //% help=input/button-event
 | 
			
		||||
    //% weight=19 blockId="control_button_event_value" block="%id"
 | 
			
		||||
    //% shim=TD_ID advanced=true
 | 
			
		||||
    //% blockHidden=true
 | 
			
		||||
    export function buttonEventValueId(id: ButtonEvent): number {
 | 
			
		||||
    //% group="Events"
 | 
			
		||||
    export function buttonEventValue(id: ButtonEvent): number {
 | 
			
		||||
        return id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the ID of an Click Event
 | 
			
		||||
     */
 | 
			
		||||
    //% blockId="control_button_event_click" block="clicked"
 | 
			
		||||
    //% advanced=true
 | 
			
		||||
    //% blockHidden=true
 | 
			
		||||
    export function buttonEventClick(): number {
 | 
			
		||||
        return ButtonEvent.Click;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the ID of an Down Event
 | 
			
		||||
     */
 | 
			
		||||
    //% blockId="control_button_event_down" block="pressed down"
 | 
			
		||||
    //% advanced=true
 | 
			
		||||
    //% blockHidden=true
 | 
			
		||||
    export function buttonEventDown(): number {
 | 
			
		||||
        return ButtonEvent.Down;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the number of milliseconds elapsed since power on.
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -116,17 +116,15 @@
 | 
			
		||||
                    "pairing_mode": 1,
 | 
			
		||||
                    "private_addressing": 0,
 | 
			
		||||
                    "open": 1,
 | 
			
		||||
                    "partial_flashing": 1,
 | 
			
		||||
                    "partial_flashing": 0,
 | 
			
		||||
                    "security_level": null,
 | 
			
		||||
                    "whitelist": 1,
 | 
			
		||||
                    "whitelist": 0,
 | 
			
		||||
                    "advertising_timeout": 0,
 | 
			
		||||
                    "tx_power": 6,
 | 
			
		||||
                    "dfu_service": 1,
 | 
			
		||||
                    "event_service": 0,
 | 
			
		||||
                    "device_info_service": 0
 | 
			
		||||
                    "event_service": 0
 | 
			
		||||
                },
 | 
			
		||||
                "stack_size": 1280,
 | 
			
		||||
                "gatt_table_size": "0x200",
 | 
			
		||||
                "gatt_table_size": "0x300",
 | 
			
		||||
                "panic_on_heap_full": 0,
 | 
			
		||||
                "debug": 0,
 | 
			
		||||
                "heap_debug": 0,
 | 
			
		||||
@@ -139,8 +137,15 @@
 | 
			
		||||
                "description": "32K RAM (mini v2 and some v1.3)",
 | 
			
		||||
                "config": {
 | 
			
		||||
                    "microbit-dal": {
 | 
			
		||||
                        "bluetooth": {
 | 
			
		||||
                            "pairing_mode": 1,
 | 
			
		||||
                            "partial_flashing": 1,
 | 
			
		||||
                            "dfu_service": 1,
 | 
			
		||||
                            "event_service": 1,
 | 
			
		||||
                            "device_info_service": 1
 | 
			
		||||
                        },
 | 
			
		||||
                        "stack_size": 2048,
 | 
			
		||||
                        "gatt_table_size": "0x700",
 | 
			
		||||
                        "gatt_table_size": "0x800",
 | 
			
		||||
                        "sram_end": "0x20008000",
 | 
			
		||||
                        "RAM_SIZE": "\"32K\""
 | 
			
		||||
                    }
 | 
			
		||||
@@ -150,8 +155,13 @@
 | 
			
		||||
                "description": "16K RAM (mini v1.3 and below)",
 | 
			
		||||
                "config": {
 | 
			
		||||
                    "microbit-dal": {
 | 
			
		||||
                        "bluetooth": {
 | 
			
		||||
                            "pairing_mode": 1,
 | 
			
		||||
                            "partial_flashing": 0,
 | 
			
		||||
                            "event_service": 0
 | 
			
		||||
                        },
 | 
			
		||||
                        "stack_size": 1280,
 | 
			
		||||
                        "gatt_table_size": "0x200",
 | 
			
		||||
                        "gatt_table_size": "0x300",
 | 
			
		||||
                        "sram_end": "0x20004000",
 | 
			
		||||
                        "RAM_SIZE": "\"16K\""
 | 
			
		||||
                    }
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										9
									
								
								libs/core/shims.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								libs/core/shims.d.ts
									
									
									
									
										vendored
									
									
								
							@@ -215,6 +215,7 @@ declare namespace basic {
 | 
			
		||||
    /**
 | 
			
		||||
     * Sets the color on the build-in LED. Set to 0 to turn off.
 | 
			
		||||
     */
 | 
			
		||||
    //% help=basic/set-led-color
 | 
			
		||||
    //% blockId=device_set_led_color
 | 
			
		||||
    //% block="set led to %color=colorNumberPicker"
 | 
			
		||||
    //%
 | 
			
		||||
@@ -226,6 +227,7 @@ declare namespace basic {
 | 
			
		||||
     * Sets the color on the build-in LED. Set to 0 to turn off.
 | 
			
		||||
     */
 | 
			
		||||
    //% blockId=device_turn_rgb_led_off block="turn build-in LED off"
 | 
			
		||||
    //% help=basic/turn-rgb-led-off
 | 
			
		||||
    //% weight=10
 | 
			
		||||
    //% group="RGB LED"
 | 
			
		||||
    //% advanced=true shim=basic::turnRgbLedOff
 | 
			
		||||
@@ -244,7 +246,8 @@ declare namespace input {
 | 
			
		||||
     * @param eventType event Type
 | 
			
		||||
     */
 | 
			
		||||
    //% help=input/on-button-event weight=100 blockGap=16
 | 
			
		||||
    //% blockId=device_button_selected_event block="on button %NAME| %eventType=control_button_event_value_id"
 | 
			
		||||
    //% blockId=device_button_selected_event block="on button %NAME| %eventType"
 | 
			
		||||
    //% eventType.shadow="control_button_event_click"
 | 
			
		||||
    //% parts="buttonpair"
 | 
			
		||||
    //% group="Events" shim=input::onButtonEvent
 | 
			
		||||
    function onButtonEvent(button: Button, eventType: int32, body: () => void): void;
 | 
			
		||||
@@ -278,7 +281,8 @@ declare namespace input {
 | 
			
		||||
     * @param body the code to run when event is fired on pin
 | 
			
		||||
     */
 | 
			
		||||
    //% help=input/on-pin-event weight=99 blockGap=16
 | 
			
		||||
    //% blockId=device_pin_custom_event block="on pin %name| %eventType=control_button_event_value_id"
 | 
			
		||||
    //% blockId=device_pin_custom_event block="on pin %name| %eventType"
 | 
			
		||||
    //% eventType.shadow="control_button_event_down"
 | 
			
		||||
    //% group="Events" shim=input::onPinTouchEvent
 | 
			
		||||
    function onPinTouchEvent(name: TouchPin, eventType: int32, body: () => void): void;
 | 
			
		||||
 | 
			
		||||
@@ -361,6 +365,7 @@ declare namespace input {
 | 
			
		||||
    /**
 | 
			
		||||
     * gets the level of loudness from 0 (silent) to 255 (loud)
 | 
			
		||||
     */
 | 
			
		||||
    //% help=input/sound-level
 | 
			
		||||
    //% blockId="soundLevel" weight=58
 | 
			
		||||
    //% block="soundLevel" blockGap=8
 | 
			
		||||
    //% group="Sensors" shim=input::soundLevel
 | 
			
		||||
 
 | 
			
		||||
@@ -30,6 +30,7 @@ namespace storage {
 | 
			
		||||
     * @param key the key for accesing the value
 | 
			
		||||
     * @param value value to store
 | 
			
		||||
     */
 | 
			
		||||
    //% help=storage/put-number
 | 
			
		||||
    //% weight=90 blockGap=16
 | 
			
		||||
    //% block="Save into number %key a value of %value"
 | 
			
		||||
    //% blockId=storage_put_number
 | 
			
		||||
@@ -43,6 +44,7 @@ namespace storage {
 | 
			
		||||
     * Reads a key value pair from the non volatile storage as a number
 | 
			
		||||
     * @param key the key for accesing the value
 | 
			
		||||
     */
 | 
			
		||||
    //% help=storage/get-number
 | 
			
		||||
    //% weight=70 blockGap=16
 | 
			
		||||
    //% block="read from number %key"
 | 
			
		||||
    //% blockId=storage_get_number
 | 
			
		||||
@@ -56,6 +58,7 @@ namespace storage {
 | 
			
		||||
     * Deletes the key from the non volatile storage
 | 
			
		||||
     * @param key the key for accesing the value
 | 
			
		||||
     */
 | 
			
		||||
    //% help=storage/remove-number
 | 
			
		||||
    //% weight=50 blockGap=16
 | 
			
		||||
    //% block="Clear number %key"
 | 
			
		||||
    //% blockId=storage_remove_key_int
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user