Add missing control stuff

This commit is contained in:
Michal Moskal 2016-04-02 20:47:27 -07:00
parent bd09754466
commit 5d40750542
2 changed files with 11 additions and 3 deletions

View File

@ -157,7 +157,6 @@ namespace control {
//% weight=20 blockGap=8 blockId="control_on_event" block="on event|from %src=control_event_source|with value %value=control_event_value" //% weight=20 blockGap=8 blockId="control_on_event" block="on event|from %src=control_event_source|with value %value=control_event_value"
//% blockExternalInputs=1 blockStatement=1 //% blockExternalInputs=1 blockStatement=1
void onEvent(int src, int value, Action handler) { void onEvent(int src, int value, Action handler) {
// not exposed yet registerWithDal(src, value, handler);
// bitvm::registerWithDal(src, value, handler);
} }
} }

View File

@ -221,6 +221,15 @@ namespace ks.rt.control {
export function reset() { export function reset() {
U.userError("reset not implemented in simulator yet") U.userError("reset not implemented in simulator yet")
} }
export function onEvent(id: number, evid: number, handler: RefAction) {
kindscript.registerWithDal(id, evid, handler)
}
export function raiseEvent(id: number, evid: number, mode: number) {
// TODO mode?
board().bus.queue(id, evid)
}
} }
namespace ks.rt.kindscript { namespace ks.rt.kindscript {
@ -469,7 +478,7 @@ namespace ks.rt.pins {
export function analogSetPitchPin(pinId: number) { export function analogSetPitchPin(pinId: number) {
let pin = getPin(pinId); let pin = getPin(pinId);
if (!pin) return; if (!pin) return;
board().pins.filter(p => !!p).forEach(p => p.pitch = false); board().pins.filter(p => !!p).forEach(p => p.pitch = false);
pin.pitch = true; pin.pitch = true;
} }