added wait-micros function
This commit is contained in:
@ -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.
|
||||
|
10
libs/microbit/shims.d.ts
vendored
10
libs/microbit/shims.d.ts
vendored
@ -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.
|
||||
|
Reference in New Issue
Block a user