2016-04-06 00:59:25 +02:00
|
|
|
/**
|
|
|
|
* Events and data from sensors
|
|
|
|
*/
|
2021-11-25 17:27:39 +01:00
|
|
|
//% color=#C90072 weight=99 icon="\uf192"
|
|
|
|
//% groups=['Events', 'States', 'Sensors', 'Configuration', 'System', 'others']
|
2016-03-10 23:01:04 +01:00
|
|
|
namespace input {
|
|
|
|
/**
|
2021-11-25 17:27:39 +01:00
|
|
|
* Returns the value of a C++ runtime constant
|
2016-03-10 23:01:04 +01:00
|
|
|
*/
|
2021-11-25 17:27:39 +01:00
|
|
|
//% weight=1 weight=19 blockId="control_button_event_value_id" block="%id"
|
|
|
|
//% shim=TD_ID advanced=true
|
|
|
|
//% blockHidden=true
|
|
|
|
export function buttonEventValueId(id: ButtonEvent): number {
|
|
|
|
return id;
|
2016-03-10 23:01:04 +01:00
|
|
|
}
|
|
|
|
|
2020-05-08 18:35:38 +02:00
|
|
|
/**
|
|
|
|
* Gets the number of milliseconds elapsed since power on.
|
|
|
|
*/
|
|
|
|
//% help=input/running-time weight=50 blockGap=8
|
|
|
|
//% blockId=device_get_running_time block="running time (ms)"
|
|
|
|
//% advanced=true
|
2021-11-25 17:27:39 +01:00
|
|
|
//% group="System"
|
2020-05-08 18:35:38 +02:00
|
|
|
export function runningTime() {
|
|
|
|
return control.millis();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the number of microseconds elapsed since power on.
|
|
|
|
*/
|
2021-11-25 17:27:39 +01:00
|
|
|
//% help=input/running-time-micros weight=49 blockGap=8
|
2020-05-08 18:35:38 +02:00
|
|
|
//% blockId=device_get_running_time_micros block="running time (micros)"
|
|
|
|
//% advanced=true
|
2021-11-25 17:27:39 +01:00
|
|
|
//% group="System"
|
2020-05-08 18:35:38 +02:00
|
|
|
export function runningTimeMicros() {
|
|
|
|
return control.micros();
|
|
|
|
}
|
2021-11-25 17:27:39 +01:00
|
|
|
|
2016-03-10 23:01:04 +01:00
|
|
|
}
|