added serial events

This commit is contained in:
Peli de Halleux
2016-05-17 09:36:01 -07:00
parent 7704ad9f8d
commit 2e3d875b7d
5 changed files with 58 additions and 13 deletions

View File

@ -429,6 +429,11 @@ namespace pxsim.serial {
export function readString(): string {
return board().readSerial();
}
export function onDataReceived(delimiters: string, handler: RefAction) {
let b = board();
b.bus.listen(DAL.MICROBIT_ID_SERIAL, DAL.MICROBIT_SERIAL_EVT_DELIM_MATCH, handler);
}
}