Hide DAL.x behind Enum

This commit is contained in:
Amerlander
2020-02-20 17:00:11 +01:00
parent 004b1d9662
commit 07fe2645cf
56 changed files with 101 additions and 101 deletions

View File

@ -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",

View File

@ -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();
});
}

View File

@ -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);

View File

@ -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;