move pins->map up in block list
This commit is contained in:
parent
d8c2d697b1
commit
1c8fa5eab6
@ -128,7 +128,7 @@ namespace pins {
|
||||
* @param name analog pin to set period to
|
||||
* @param micros period in micro seconds. eg:20000
|
||||
*/
|
||||
//% help=pins/analog-set-period weight=23
|
||||
//% help=pins/analog-set-period weight=23 blockGap=8
|
||||
//% blockId=device_set_analog_period block="analog set period|pin %pin|to (µs)%micros"
|
||||
void analogSetPeriod(AnalogPin name, int micros) {
|
||||
PINOP(setAnalogPeriodUs(micros));
|
||||
@ -148,10 +148,10 @@ namespace pins {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the duration of the last pulse in micro-seconds. This function should be called from a ``onPulse`` handler.
|
||||
* Gets the duration of the last pulse in micro-seconds. This function should be called from a ``onPulsed`` handler.
|
||||
*/
|
||||
//% help=pins/pulse-micros
|
||||
//% blockId=pins_pulse_duration block="pulse duration (us)"
|
||||
//% blockId=pins_pulse_duration block="pulse duration (µs)"
|
||||
//% weight=21
|
||||
int pulseDuration() {
|
||||
return pxt::lastEvent.timestamp;
|
||||
|
@ -11,7 +11,7 @@ namespace pins {
|
||||
* @param toLow the lower bound of the value's target range
|
||||
* @param toHigh the upper bound of the value's target range, eg: 4
|
||||
*/
|
||||
//% help=pins/map weight=3
|
||||
//% help=pins/map weight=22
|
||||
//% blockId=math_map block="map %value|from low %fromLow|from high %fromHigh|to low %toLow|to high %toHigh"
|
||||
export function map(value: number, fromLow: number, fromHigh: number, toLow: number, toHigh: number): number {
|
||||
return ((value - fromLow) * (toHigh - toLow)) / (fromHigh - fromLow) + toLow;
|
||||
|
6
libs/microbit/shims.d.ts
vendored
6
libs/microbit/shims.d.ts
vendored
@ -483,7 +483,7 @@ declare namespace pins {
|
||||
* @param name analog pin to set period to
|
||||
* @param micros period in micro seconds. eg:20000
|
||||
*/
|
||||
//% help=pins/analog-set-period weight=23
|
||||
//% help=pins/analog-set-period weight=23 blockGap=8
|
||||
//% blockId=device_set_analog_period block="analog set period|pin %pin|to (µs)%micros" shim=pins::analogSetPeriod
|
||||
function analogSetPeriod(name: AnalogPin, micros: number): void;
|
||||
|
||||
@ -495,10 +495,10 @@ declare namespace pins {
|
||||
function onPulsed(name: DigitalPin, pulse: PulseValue, body: () => void): void;
|
||||
|
||||
/**
|
||||
* Gets the duration of the last pulse in micro-seconds. This function should be called from a ``onPulse`` handler.
|
||||
* Gets the duration of the last pulse in micro-seconds. This function should be called from a ``onPulsed`` handler.
|
||||
*/
|
||||
//% help=pins/pulse-micros
|
||||
//% blockId=pins_pulse_duration block="pulse duration (us)"
|
||||
//% blockId=pins_pulse_duration block="pulse duration (µs)"
|
||||
//% weight=21 shim=pins::pulseDuration
|
||||
function pulseDuration(): number;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user