added wait-micros function

This commit is contained in:
Peli de Halleux
2016-08-16 17:04:21 -07:00
parent 851687dba8
commit 9159c297a5
5 changed files with 58 additions and 3 deletions

View File

@ -129,12 +129,22 @@ namespace control {
/**
* Resets the BBC micro:bit.
*/
//% weight=30 async help=control/reset
//% weight=30 async help=control/reset blockGap=8
//% blockId="control_reset" block="reset"
void reset() {
microbit_reset();
}
/**
* Blocks the current fiber for the given microseconds
* @param micros number of micro-seconds to wait. eg: 4
*/
//% help=control/wait-micros weight=29
//% blockId="control_wait_us" block="wait (µs)%micros"
void waitMicros(int micros) {
wait_us(micros);
}
/**
* Raises an event in the event bus.
* @param src ID of the MicroBit Component that generated the event e.g. MICROBIT_ID_BUTTON_A.

View File

@ -333,10 +333,18 @@ declare namespace control {
/**
* Resets the BBC micro:bit.
*/
//% weight=30 async help=control/reset
//% weight=30 async help=control/reset blockGap=8
//% blockId="control_reset" block="reset" shim=control::reset
function reset(): void;
/**
* Blocks the current fiber for the given microseconds
* @param micros number of micro-seconds to wait. eg: 4
*/
//% help=control/wait-micros weight=29
//% blockId="control_wait_us" block="wait (µs)%micros" shim=control::waitMicros
function waitMicros(micros: number): void;
/**
* Raises an event in the event bus.
* @param src ID of the MicroBit Component that generated the event e.g. MICROBIT_ID_BUTTON_A.