Merge branch 'master' of https://github.com/Microsoft/pxt-microbit
This commit is contained in:
commit
16199cfcea
@ -7,7 +7,7 @@ namespace pxsim.input {
|
|||||||
b.useShake = true;
|
b.useShake = true;
|
||||||
runtime.queueDisplayUpdate();
|
runtime.queueDisplayUpdate();
|
||||||
}
|
}
|
||||||
pxt.registerWithDal(DAL.MICROBIT_ID_GESTURE, gesture, handler);
|
pxtcore.registerWithDal(DAL.MICROBIT_ID_GESTURE, gesture, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function acceleration(dimension: number): number {
|
export function acceleration(dimension: number): number {
|
||||||
|
@ -5,7 +5,7 @@ namespace pxsim.input {
|
|||||||
b.usesButtonAB = true;
|
b.usesButtonAB = true;
|
||||||
runtime.queueDisplayUpdate();
|
runtime.queueDisplayUpdate();
|
||||||
}
|
}
|
||||||
pxt.registerWithDal(button, DAL.MICROBIT_BUTTON_EVT_CLICK, handler);
|
pxtcore.registerWithDal(button, DAL.MICROBIT_BUTTON_EVT_CLICK, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function buttonIsPressed(button: number): boolean {
|
export function buttonIsPressed(button: number): boolean {
|
||||||
|
@ -3,14 +3,14 @@ namespace pxsim.input {
|
|||||||
let pin = getPin(pinId);
|
let pin = getPin(pinId);
|
||||||
if (!pin) return;
|
if (!pin) return;
|
||||||
pin.isTouched();
|
pin.isTouched();
|
||||||
pxt.registerWithDal(pin.id, DAL.MICROBIT_BUTTON_EVT_CLICK, handler);
|
pxtcore.registerWithDal(pin.id, DAL.MICROBIT_BUTTON_EVT_CLICK, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function onPinReleased(pinId: number, handler: RefAction) {
|
export function onPinReleased(pinId: number, handler: RefAction) {
|
||||||
let pin = getPin(pinId);
|
let pin = getPin(pinId);
|
||||||
if (!pin) return;
|
if (!pin) return;
|
||||||
pin.isTouched();
|
pin.isTouched();
|
||||||
pxt.registerWithDal(pin.id, DAL.MICROBIT_BUTTON_EVT_UP, handler);
|
pxtcore.registerWithDal(pin.id, DAL.MICROBIT_BUTTON_EVT_UP, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function pinIsPressed(pinId: number): boolean {
|
export function pinIsPressed(pinId: number): boolean {
|
||||||
|
@ -147,7 +147,7 @@ namespace pxsim.control {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function onEvent(id: number, evid: number, handler: RefAction) {
|
export function onEvent(id: number, evid: number, handler: RefAction) {
|
||||||
pxt.registerWithDal(id, evid, handler)
|
pxtcore.registerWithDal(id, evid, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function raiseEvent(id: number, evid: number, mode: number) {
|
export function raiseEvent(id: number, evid: number, mode: number) {
|
||||||
@ -156,7 +156,7 @@ namespace pxsim.control {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace pxsim.pxt {
|
namespace pxsim.pxtcore {
|
||||||
export function registerWithDal(id: number, evid: number, handler: RefAction) {
|
export function registerWithDal(id: number, evid: number, handler: RefAction) {
|
||||||
board().bus.listen(id, evid, handler);
|
board().bus.listen(id, evid, handler);
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ namespace pxsim.radio {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function onBroadcastMessageReceived(msg: number, handler: RefAction): void {
|
export function onBroadcastMessageReceived(msg: number, handler: RefAction): void {
|
||||||
pxt.registerWithDal(DAL.MES_BROADCAST_GENERAL_ID, msg, handler);
|
pxtcore.registerWithDal(DAL.MES_BROADCAST_GENERAL_ID, msg, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setGroup(id: number): void {
|
export function setGroup(id: number): void {
|
||||||
@ -152,7 +152,7 @@ namespace pxsim.radio {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function onDataReceived(handler: RefAction): void {
|
export function onDataReceived(handler: RefAction): void {
|
||||||
pxt.registerWithDal(DAL.MICROBIT_ID_RADIO, DAL.MICROBIT_RADIO_EVT_DATAGRAM, handler);
|
pxtcore.registerWithDal(DAL.MICROBIT_ID_RADIO, DAL.MICROBIT_RADIO_EVT_DATAGRAM, handler);
|
||||||
radio.receiveNumber();
|
radio.receiveNumber();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user