Hide DAL.x behind Enum
This commit is contained in:
@ -388,7 +388,7 @@
|
||||
"input.onLogoUp": "Attaches code to run when the logo is oriented upwards and the board is vertical.",
|
||||
"input.onLogoUp|param|body": "TODO",
|
||||
"input.onPinEvent": "Do something when a pin is touched and released again (while also touching the GND pin).",
|
||||
"input.onPinEvent|param|body": "the code to run when the pin is pressed",
|
||||
"input.onPinEvent|param|body": "the code to run when event is fired on pin",
|
||||
"input.onPinEvent|param|name": "the pin, eg: TouchPin.P0",
|
||||
"input.onScreenDown": "Attaches code to run when the screen is facing down.",
|
||||
"input.onScreenDown|param|body": "TODO",
|
||||
|
@ -323,9 +323,9 @@ namespace game {
|
||||
}
|
||||
|
||||
function unplugEvents(): void {
|
||||
input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => { });
|
||||
input.onButtonEvent(Button.B, DAL.MICROBIT_BUTTON_EVT_CLICK, () => { });
|
||||
input.onButtonEvent(Button.AB, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { });
|
||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => { });
|
||||
input.onButtonEvent(Button.AB, ButtonEvent.Click, () => {
|
||||
control.reset();
|
||||
});
|
||||
}
|
||||
|
@ -230,9 +230,9 @@ namespace input {
|
||||
/**
|
||||
* Do something when a pin is touched and released again (while also touching the GND pin).
|
||||
* @param name the pin, eg: TouchPin.P0
|
||||
* @param body the code to run when the pin is pressed
|
||||
* @param body the code to run when event is fired on pin
|
||||
*/
|
||||
//% help=input/on-pin-pressed weight=83 blockGap=32
|
||||
//% help=input/on-pin-event weight=83 blockGap=32
|
||||
//% blockId=device_pin_event block="on pin %name|is %eventType=control_button_event_value_id"
|
||||
void onPinEvent(TouchPin name, int eventType, Action body) {
|
||||
auto pin = getPin((int)name);
|
||||
|
4
libs/core/shims.d.ts
vendored
4
libs/core/shims.d.ts
vendored
@ -257,9 +257,9 @@ declare namespace input {
|
||||
/**
|
||||
* Do something when a pin is touched and released again (while also touching the GND pin).
|
||||
* @param name the pin, eg: TouchPin.P0
|
||||
* @param body the code to run when the pin is pressed
|
||||
* @param body the code to run when event is fired on pin
|
||||
*/
|
||||
//% help=input/on-pin-pressed weight=83 blockGap=32
|
||||
//% help=input/on-pin-event weight=83 blockGap=32
|
||||
//% blockId=device_pin_event block="on pin %name|is %eventType=control_button_event_value_id" shim=input::onPinEvent
|
||||
function onPinEvent(name: TouchPin, eventType: int32, body: () => void): void;
|
||||
|
||||
|
Reference in New Issue
Block a user