Bump pxt-core to 0.12.69

This commit is contained in:
Guillaume Jenkins 2017-05-15 11:11:34 -07:00
parent 4fec614b50
commit e5b40fb50c
6 changed files with 85 additions and 71 deletions

View File

@ -98,7 +98,7 @@ declare namespace bluetooth {
//% blockId=eddystone_advertise_url block="bluetooth advertise url %url|with power %power|connectable %connectable" //% blockId=eddystone_advertise_url block="bluetooth advertise url %url|with power %power|connectable %connectable"
//% parts=bluetooth weight=11 blockGap=8 //% parts=bluetooth weight=11 blockGap=8
//% help=bluetooth/advertise-url blockExternalInputs=1 shim=bluetooth::advertiseUrl //% help=bluetooth/advertise-url blockExternalInputs=1 shim=bluetooth::advertiseUrl
function advertiseUrl(url: string, power: number, connectable: boolean): void; function advertiseUrl(url: string, power: int32, connectable: boolean): void;
/** /**
* Advertise an Eddystone UID * Advertise an Eddystone UID
@ -107,7 +107,7 @@ declare namespace bluetooth {
* @param connectable true to keep bluetooth connectable for other services, false otherwise. * @param connectable true to keep bluetooth connectable for other services, false otherwise.
*/ */
//% parts=bluetooth weight=12 advanced=true shim=bluetooth::advertiseUidBuffer //% parts=bluetooth weight=12 advanced=true shim=bluetooth::advertiseUidBuffer
function advertiseUidBuffer(nsAndInstance: Buffer, power: number, connectable: boolean): void; function advertiseUidBuffer(nsAndInstance: Buffer, power: int32, connectable: boolean): void;
/** /**
* Sets the bluetooth transmit power between 0 (minimal) and 7 (maximum). * Sets the bluetooth transmit power between 0 (minimal) and 7 (maximum).
@ -115,7 +115,7 @@ declare namespace bluetooth {
*/ */
//% parts=bluetooth weight=5 help=bluetooth/set-transmit-power advanced=true //% parts=bluetooth weight=5 help=bluetooth/set-transmit-power advanced=true
//% blockId=bluetooth_settransmitpower block="bluetooth set transmit power %power" shim=bluetooth::setTransmitPower //% blockId=bluetooth_settransmitpower block="bluetooth set transmit power %power" shim=bluetooth::setTransmitPower
function setTransmitPower(power: number): void; function setTransmitPower(power: int32): void;
/** /**
* Stops advertising Eddystone end points * Stops advertising Eddystone end points

View File

@ -1,6 +1,16 @@
{ {
"Math.abs": "Returns the absolute value of a number (the value without regard to whether it is positive or negative). \nFor example, the absolute value of -5 is the same as the absolute value of 5.", "Math.abs": "Returns the absolute value of a number (the value without regard to whether it is positive or negative). \nFor example, the absolute value of -5 is the same as the absolute value of 5.",
"Math.abs|param|x": "A numeric expression for which the absolute value is needed.", "Math.abs|param|x": "A numeric expression for which the absolute value is needed.",
"Math.ceil": "Returns the smallest number greater than or equal to its numeric argument.",
"Math.ceil|param|x": "A numeric expression.",
"Math.floor": "Returns the greatest number less than or equal to its numeric argument.",
"Math.floor|param|x": "A numeric expression.",
"Math.idiv": "Returns the value of integer signed 32 bit division of two numbers.",
"Math.idiv|param|x": "The first number",
"Math.idiv|param|y": "The second number",
"Math.imul": "Returns the value of integer signed 32 bit multiplication of two numbers.",
"Math.imul|param|x": "The first number",
"Math.imul|param|y": "The second number",
"Math.max": "Returns the larger of two supplied numeric expressions.", "Math.max": "Returns the larger of two supplied numeric expressions.",
"Math.min": "Returns the smaller of two supplied numeric expressions.", "Math.min": "Returns the smaller of two supplied numeric expressions.",
"Math.pow": "Returns the value of a base expression taken to a specified power.", "Math.pow": "Returns the value of a base expression taken to a specified power.",
@ -8,10 +18,14 @@
"Math.pow|param|y": "The exponent value of the expression.", "Math.pow|param|y": "The exponent value of the expression.",
"Math.random": "Returns a pseudorandom number between 0 and `max`.", "Math.random": "Returns a pseudorandom number between 0 and `max`.",
"Math.randomBoolean": "Generates a `true` or `false` value randomly, just like flipping a coin.", "Math.randomBoolean": "Generates a `true` or `false` value randomly, just like flipping a coin.",
"Math.round": "Returns a supplied numeric expression rounded to the nearest number.",
"Math.round|param|x": "The value to be rounded to the nearest number.",
"Math.sign": "Returns the sign of the x, indicating whether x is positive, negative or zero.", "Math.sign": "Returns the sign of the x, indicating whether x is positive, negative or zero.",
"Math.sign|param|x": "The numeric expression to test", "Math.sign|param|x": "The numeric expression to test",
"Math.sqrt": "Returns the square root of a number.", "Math.sqrt": "Returns the square root of a number.",
"Math.sqrt|param|x": "A numeric expression.", "Math.sqrt|param|x": "A numeric expression.",
"Math.trunc": "Returns the number with the decimal part truncated.",
"Math.trunc|param|x": "A numeric expression.",
"String.charAt": "Returns the character at the specified index.", "String.charAt": "Returns the character at the specified index.",
"String.charAt|param|index": "The zero-based index of the desired character.", "String.charAt|param|index": "The zero-based index of the desired character.",
"String.charCodeAt": "Returns the Unicode value of the character at the specified location.", "String.charCodeAt": "Returns the Unicode value of the character at the specified location.",

114
libs/core/shims.d.ts vendored
View File

@ -32,7 +32,7 @@ declare interface Image {
*/ */
//% help=images/plot-image //% help=images/plot-image
//% parts="ledmatrix" xOffset.defl=0 shim=ImageMethods::plotImage //% parts="ledmatrix" xOffset.defl=0 shim=ImageMethods::plotImage
plotImage(xOffset?: number): void; plotImage(xOffset?: int32): void;
/** /**
* Shows an frame from the image at offset ``x offset``. * Shows an frame from the image at offset ``x offset``.
@ -41,7 +41,7 @@ declare interface Image {
//% help=images/show-image weight=80 blockNamespace=images //% help=images/show-image weight=80 blockNamespace=images
//% blockId=device_show_image_offset block="show image %sprite|at offset %offset" blockGap=8 //% blockId=device_show_image_offset block="show image %sprite|at offset %offset" blockGap=8
//% parts="ledmatrix" async interval.defl=400 shim=ImageMethods::showImage //% parts="ledmatrix" async interval.defl=400 shim=ImageMethods::showImage
showImage(xOffset: number, interval?: number): void; showImage(xOffset: int32, interval?: int32): void;
/** /**
* Draws the ``index``-th frame of the image on the screen. * Draws the ``index``-th frame of the image on the screen.
@ -49,7 +49,7 @@ declare interface Image {
*/ */
//% help=images/plot-frame weight=80 //% help=images/plot-frame weight=80
//% parts="ledmatrix" shim=ImageMethods::plotFrame //% parts="ledmatrix" shim=ImageMethods::plotFrame
plotFrame(xOffset: number): void; plotFrame(xOffset: int32): void;
/** /**
* Scrolls an image . * Scrolls an image .
@ -59,7 +59,7 @@ declare interface Image {
//% help=images/scroll-image weight=79 async blockNamespace=images //% help=images/scroll-image weight=79 async blockNamespace=images
//% blockId=device_scroll_image block="scroll image %sprite|with offset %frameoffset|and interval (ms) %delay" blockGap=8 //% blockId=device_scroll_image block="scroll image %sprite|with offset %frameoffset|and interval (ms) %delay" blockGap=8
//% parts="ledmatrix" shim=ImageMethods::scrollImage //% parts="ledmatrix" shim=ImageMethods::scrollImage
scrollImage(frameOffset: number, interval: number): void; scrollImage(frameOffset: int32, interval: int32): void;
/** /**
* Sets all pixels off. * Sets all pixels off.
@ -73,26 +73,26 @@ declare interface Image {
*/ */
//% //%
//% parts="ledmatrix" shim=ImageMethods::setPixelBrightness //% parts="ledmatrix" shim=ImageMethods::setPixelBrightness
setPixelBrightness(x: number, y: number, value: number): void; setPixelBrightness(x: int32, y: int32, value: int32): void;
/** /**
* Gets the pixel brightness ([0..255]) at a given position * Gets the pixel brightness ([0..255]) at a given position
*/ */
//% //%
//% parts="ledmatrix" shim=ImageMethods::pixelBrightness //% parts="ledmatrix" shim=ImageMethods::pixelBrightness
pixelBrightness(x: number, y: number): number; pixelBrightness(x: int32, y: int32): int32;
/** /**
* Gets the width in columns * Gets the width in columns
*/ */
//% help=functions/width shim=ImageMethods::width //% help=functions/width shim=ImageMethods::width
width(): number; width(): int32;
/** /**
* Gets the height in rows (always 5) * Gets the height in rows (always 5)
*/ */
//% shim=ImageMethods::height //% shim=ImageMethods::height
height(): number; height(): int32;
/** /**
* Set a pixel state at position ``(x,y)`` * Set a pixel state at position ``(x,y)``
@ -102,7 +102,7 @@ declare interface Image {
*/ */
//% help=images/set-pixel //% help=images/set-pixel
//% parts="ledmatrix" shim=ImageMethods::setPixel //% parts="ledmatrix" shim=ImageMethods::setPixel
setPixel(x: number, y: number, value: boolean): void; setPixel(x: int32, y: int32, value: boolean): void;
/** /**
* Get the pixel state at position ``(x,y)`` * Get the pixel state at position ``(x,y)``
@ -111,7 +111,7 @@ declare interface Image {
*/ */
//% help=images/pixel //% help=images/pixel
//% parts="ledmatrix" shim=ImageMethods::pixel //% parts="ledmatrix" shim=ImageMethods::pixel
pixel(x: number, y: number): boolean; pixel(x: int32, y: int32): boolean;
/** /**
* Shows a particular frame of the image strip. * Shows a particular frame of the image strip.
@ -119,7 +119,7 @@ declare interface Image {
*/ */
//% weight=70 help=images/show-frame //% weight=70 help=images/show-frame
//% parts="ledmatrix" interval.defl=400 shim=ImageMethods::showFrame //% parts="ledmatrix" interval.defl=400 shim=ImageMethods::showFrame
showFrame(frame: number, interval?: number): void; showFrame(frame: int32, interval?: int32): void;
} }
@ -138,7 +138,7 @@ declare namespace basic {
//% blockId=device_show_number block="show|number %number" blockGap=8 //% blockId=device_show_number block="show|number %number" blockGap=8
//% async //% async
//% parts="ledmatrix" interval.defl=150 shim=basic::showNumber //% parts="ledmatrix" interval.defl=150 shim=basic::showNumber
function showNumber(value: number, interval?: number): void; function showNumber(value: int32, interval?: int32): void;
/** /**
* Draws an image on the LED screen. * Draws an image on the LED screen.
@ -151,7 +151,7 @@ declare namespace basic {
//% blockId=device_show_leds //% blockId=device_show_leds
//% block="show leds" icon="\uf00a" //% block="show leds" icon="\uf00a"
//% parts="ledmatrix" interval.defl=400 shim=basic::showLeds //% parts="ledmatrix" interval.defl=400 shim=basic::showLeds
function showLeds(leds: string, interval?: number): void; function showLeds(leds: string, interval?: int32): void;
/** /**
* Display text on the display, one character at a time. If the string fits on the screen (i.e. is one letter), does not scroll. * Display text on the display, one character at a time. If the string fits on the screen (i.e. is one letter), does not scroll.
@ -164,7 +164,7 @@ declare namespace basic {
//% async //% async
//% blockId=device_print_message //% blockId=device_print_message
//% parts="ledmatrix" interval.defl=150 shim=basic::showString //% parts="ledmatrix" interval.defl=150 shim=basic::showString
function showString(text: string, interval?: number): void; function showString(text: string, interval?: int32): void;
/** /**
* Turn off all LEDs * Turn off all LEDs
@ -182,7 +182,7 @@ declare namespace basic {
*/ */
//% help=basic/show-animation imageLiteral=1 async //% help=basic/show-animation imageLiteral=1 async
//% parts="ledmatrix" interval.defl=400 shim=basic::showAnimation //% parts="ledmatrix" interval.defl=400 shim=basic::showAnimation
function showAnimation(leds: string, interval?: number): void; function showAnimation(leds: string, interval?: int32): void;
/** /**
* Draws an image on the LED screen. * Draws an image on the LED screen.
@ -207,7 +207,7 @@ declare namespace basic {
//% help=basic/pause weight=54 //% help=basic/pause weight=54
//% async block="pause (ms) %pause" //% async block="pause (ms) %pause"
//% blockId=device_pause icon="\uf110" shim=basic::pause //% blockId=device_pause icon="\uf110" shim=basic::pause
function pause(ms: number): void; function pause(ms: int32): void;
} }
@ -281,7 +281,7 @@ declare namespace input {
//% help=input/acceleration weight=58 //% help=input/acceleration weight=58
//% blockId=device_acceleration block="acceleration (mg)|%NAME" blockGap=8 //% blockId=device_acceleration block="acceleration (mg)|%NAME" blockGap=8
//% parts="accelerometer" shim=input::acceleration //% parts="accelerometer" shim=input::acceleration
function acceleration(dimension: Dimension): number; function acceleration(dimension: Dimension): int32;
/** /**
* Reads the light level applied to the LED screen in a range from ``0`` (dark) to ``255`` bright. * Reads the light level applied to the LED screen in a range from ``0`` (dark) to ``255`` bright.
@ -289,7 +289,7 @@ declare namespace input {
//% help=input/light-level weight=57 //% help=input/light-level weight=57
//% blockId=device_get_light_level block="light level" blockGap=8 //% blockId=device_get_light_level block="light level" blockGap=8
//% parts="ledmatrix" shim=input::lightLevel //% parts="ledmatrix" shim=input::lightLevel
function lightLevel(): number; function lightLevel(): int32;
/** /**
* Get the current compass heading in degrees. * Get the current compass heading in degrees.
@ -298,7 +298,7 @@ declare namespace input {
//% weight=56 //% weight=56
//% blockId=device_heading block="compass heading (°)" blockGap=8 //% blockId=device_heading block="compass heading (°)" blockGap=8
//% parts="compass" shim=input::compassHeading //% parts="compass" shim=input::compassHeading
function compassHeading(): number; function compassHeading(): int32;
/** /**
* Gets the temperature in Celsius degrees (°C). * Gets the temperature in Celsius degrees (°C).
@ -307,7 +307,7 @@ declare namespace input {
//% help=input/temperature //% help=input/temperature
//% blockId=device_temperature block="temperature (°C)" blockGap=8 //% blockId=device_temperature block="temperature (°C)" blockGap=8
//% parts="thermometer" shim=input::temperature //% parts="thermometer" shim=input::temperature
function temperature(): number; function temperature(): int32;
/** /**
* The pitch or roll of the device, rotation along the ``x-axis`` or ``y-axis``, in degrees. * The pitch or roll of the device, rotation along the ``x-axis`` or ``y-axis``, in degrees.
@ -316,7 +316,7 @@ declare namespace input {
//% help=input/rotation weight=52 //% help=input/rotation weight=52
//% blockId=device_get_rotation block="rotation (°)|%NAME" blockGap=8 //% blockId=device_get_rotation block="rotation (°)|%NAME" blockGap=8
//% parts="accelerometer" advanced=true shim=input::rotation //% parts="accelerometer" advanced=true shim=input::rotation
function rotation(kind: Rotation): number; function rotation(kind: Rotation): int32;
/** /**
* Get the magnetic force value in ``micro-Teslas`` (``µT``). This function is not supported in the simulator. * Get the magnetic force value in ``micro-Teslas`` (``µT``). This function is not supported in the simulator.
@ -326,7 +326,7 @@ declare namespace input {
//% blockId=device_get_magnetic_force block="magnetic force (µT)|%NAME" blockGap=8 //% blockId=device_get_magnetic_force block="magnetic force (µT)|%NAME" blockGap=8
//% parts="compass" //% parts="compass"
//% advanced=true shim=input::magneticForce //% advanced=true shim=input::magneticForce
function magneticForce(dimension: Dimension): number; function magneticForce(dimension: Dimension): int32;
/** /**
* Gets the number of milliseconds elapsed since power on. * Gets the number of milliseconds elapsed since power on.
@ -334,7 +334,7 @@ declare namespace input {
//% help=input/running-time weight=50 //% help=input/running-time weight=50
//% blockId=device_get_running_time block="running time (ms)" //% blockId=device_get_running_time block="running time (ms)"
//% advanced=true shim=input::runningTime //% advanced=true shim=input::runningTime
function runningTime(): number; function runningTime(): int32;
/** /**
* Obsolete, compass calibration is automatic. * Obsolete, compass calibration is automatic.
@ -381,7 +381,7 @@ declare namespace control {
*/ */
//% help=control/wait-micros weight=29 //% help=control/wait-micros weight=29
//% blockId="control_wait_us" block="wait (µs)%micros" shim=control::waitMicros //% blockId="control_wait_us" block="wait (µs)%micros" shim=control::waitMicros
function waitMicros(micros: number): void; function waitMicros(micros: int32): void;
/** /**
* Raises an event in the event bus. * Raises an event in the event bus.
@ -391,28 +391,28 @@ declare namespace control {
*/ */
//% weight=21 blockGap=12 blockId="control_raise_event" block="raise event|from source %src=control_event_source_id|with value %value=control_event_value_id" blockExternalInputs=1 //% weight=21 blockGap=12 blockId="control_raise_event" block="raise event|from source %src=control_event_source_id|with value %value=control_event_value_id" blockExternalInputs=1
//% mode.defl=1 shim=control::raiseEvent //% mode.defl=1 shim=control::raiseEvent
function raiseEvent(src: number, value: number, mode?: EventCreationMode): void; function raiseEvent(src: int32, value: int32, mode?: EventCreationMode): void;
/** /**
* Raises an event in the event bus. * Raises an event in the event bus.
*/ */
//% weight=20 blockGap=8 blockId="control_on_event" block="on event|from %src=control_event_source_id|with value %value=control_event_value_id" //% weight=20 blockGap=8 blockId="control_on_event" block="on event|from %src=control_event_source_id|with value %value=control_event_value_id"
//% blockExternalInputs=1 shim=control::onEvent //% blockExternalInputs=1 shim=control::onEvent
function onEvent(src: number, value: number, handler: () => void): void; function onEvent(src: int32, value: int32, handler: () => void): void;
/** /**
* Gets the value of the last event executed on the bus * Gets the value of the last event executed on the bus
*/ */
//% blockId=control_event_value" block="event value" //% blockId=control_event_value" block="event value"
//% weight=18 shim=control::eventValue //% weight=18 shim=control::eventValue
function eventValue(): number; function eventValue(): int32;
/** /**
* Gets the timestamp of the last event executed on the bus * Gets the timestamp of the last event executed on the bus
*/ */
//% blockId=control_event_timestamp" block="event timestamp" //% blockId=control_event_timestamp" block="event timestamp"
//% weight=19 blockGap=8 shim=control::eventTimestamp //% weight=19 blockGap=8 shim=control::eventTimestamp
function eventTimestamp(): number; function eventTimestamp(): int32;
/** /**
* Gets a friendly name for the device derived from the its serial number * Gets a friendly name for the device derived from the its serial number
@ -426,7 +426,7 @@ declare namespace control {
*/ */
//% blockId="control_device_serial_number" block="device serial number" weight=9 //% blockId="control_device_serial_number" block="device serial number" weight=9
//% advanced=true shim=control::deviceSerialNumber //% advanced=true shim=control::deviceSerialNumber
function deviceSerialNumber(): number; function deviceSerialNumber(): int32;
} }
@ -443,7 +443,7 @@ declare namespace led {
//% blockId=device_plot block="plot|x %x|y %y" blockGap=8 //% blockId=device_plot block="plot|x %x|y %y" blockGap=8
//% parts="ledmatrix" //% parts="ledmatrix"
//% x.min=0 x.max=4 y.min=0 y.max=4 shim=led::plot //% x.min=0 x.max=4 y.min=0 y.max=4 shim=led::plot
function plot(x: number, y: number): void; function plot(x: int32, y: int32): void;
/** /**
* Turn off the specified LED using x, y coordinates (x is horizontal, y is vertical). (0,0) is upper left. * Turn off the specified LED using x, y coordinates (x is horizontal, y is vertical). (0,0) is upper left.
@ -454,7 +454,7 @@ declare namespace led {
//% blockId=device_unplot block="unplot|x %x|y %y" blockGap=8 //% blockId=device_unplot block="unplot|x %x|y %y" blockGap=8
//% parts="ledmatrix" //% parts="ledmatrix"
//% x.min=0 x.max=4 y.min=0 y.max=4 shim=led::unplot //% x.min=0 x.max=4 y.min=0 y.max=4 shim=led::unplot
function unplot(x: number, y: number): void; function unplot(x: int32, y: int32): void;
/** /**
* Get the on/off state of the specified LED using x, y coordinates. (0,0) is upper left. * Get the on/off state of the specified LED using x, y coordinates. (0,0) is upper left.
@ -465,7 +465,7 @@ declare namespace led {
//% blockId=device_point block="point|x %x|y %y" //% blockId=device_point block="point|x %x|y %y"
//% parts="ledmatrix" //% parts="ledmatrix"
//% x.min=0 x.max=4 y.min=0 y.max=4 shim=led::point //% x.min=0 x.max=4 y.min=0 y.max=4 shim=led::point
function point(x: number, y: number): boolean; function point(x: int32, y: int32): boolean;
/** /**
* Get the screen brightness from 0 (off) to 255 (full bright). * Get the screen brightness from 0 (off) to 255 (full bright).
@ -474,7 +474,7 @@ declare namespace led {
//% blockId=device_get_brightness block="brightness" blockGap=8 //% blockId=device_get_brightness block="brightness" blockGap=8
//% parts="ledmatrix" //% parts="ledmatrix"
//% advanced=true shim=led::brightness //% advanced=true shim=led::brightness
function brightness(): number; function brightness(): int32;
/** /**
* Set the screen brightness from 0 (off) to 255 (full bright). * Set the screen brightness from 0 (off) to 255 (full bright).
@ -485,7 +485,7 @@ declare namespace led {
//% parts="ledmatrix" //% parts="ledmatrix"
//% advanced=true //% advanced=true
//% value.min=0 value.max=255 shim=led::setBrightness //% value.min=0 value.max=255 shim=led::setBrightness
function setBrightness(value: number): void; function setBrightness(value: int32): void;
/** /**
* Cancels the current animation and clears other pending animations. * Cancels the current animation and clears other pending animations.
@ -526,7 +526,7 @@ declare namespace pins {
*/ */
//% help=pins/digital-read-pin weight=30 //% help=pins/digital-read-pin weight=30
//% blockId=device_get_digital_pin block="digital read|pin %name" blockGap=8 shim=pins::digitalReadPin //% blockId=device_get_digital_pin block="digital read|pin %name" blockGap=8 shim=pins::digitalReadPin
function digitalReadPin(name: DigitalPin): number; function digitalReadPin(name: DigitalPin): int32;
/** /**
* Set a pin or connector value to either 0 or 1. * Set a pin or connector value to either 0 or 1.
@ -536,7 +536,7 @@ declare namespace pins {
//% help=pins/digital-write-pin weight=29 //% help=pins/digital-write-pin weight=29
//% blockId=device_set_digital_pin block="digital write|pin %name|to %value" //% blockId=device_set_digital_pin block="digital write|pin %name|to %value"
//% value.min=0 value.max=1 shim=pins::digitalWritePin //% value.min=0 value.max=1 shim=pins::digitalWritePin
function digitalWritePin(name: DigitalPin, value: number): void; function digitalWritePin(name: DigitalPin, value: int32): void;
/** /**
* Read the connector value as analog, that is, as a value comprised between 0 and 1023. * Read the connector value as analog, that is, as a value comprised between 0 and 1023.
@ -544,7 +544,7 @@ declare namespace pins {
*/ */
//% help=pins/analog-read-pin weight=25 //% help=pins/analog-read-pin weight=25
//% blockId=device_get_analog_pin block="analog read|pin %name" blockGap="8" shim=pins::analogReadPin //% blockId=device_get_analog_pin block="analog read|pin %name" blockGap="8" shim=pins::analogReadPin
function analogReadPin(name: AnalogPin): number; function analogReadPin(name: AnalogPin): int32;
/** /**
* Set the connector value as analog. Value must be comprised between 0 and 1023. * Set the connector value as analog. Value must be comprised between 0 and 1023.
@ -554,7 +554,7 @@ declare namespace pins {
//% help=pins/analog-write-pin weight=24 //% help=pins/analog-write-pin weight=24
//% blockId=device_set_analog_pin block="analog write|pin %name|to %value" blockGap=8 //% blockId=device_set_analog_pin block="analog write|pin %name|to %value" blockGap=8
//% value.min=0 value.max=1023 shim=pins::analogWritePin //% value.min=0 value.max=1023 shim=pins::analogWritePin
function analogWritePin(name: AnalogPin, value: number): void; function analogWritePin(name: AnalogPin, value: int32): void;
/** /**
* Configures the Pulse-width modulation (PWM) of the analog output to the given value in **microseconds** or `1/1000` milliseconds. * Configures the Pulse-width modulation (PWM) of the analog output to the given value in **microseconds** or `1/1000` milliseconds.
@ -564,7 +564,7 @@ declare namespace pins {
*/ */
//% help=pins/analog-set-period weight=23 blockGap=8 //% 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 //% blockId=device_set_analog_period block="analog set period|pin %pin|to (µs)%micros" shim=pins::analogSetPeriod
function analogSetPeriod(name: AnalogPin, micros: number): void; function analogSetPeriod(name: AnalogPin, micros: int32): void;
/** /**
* Configures this pin to a digital input, and generates events where the timestamp is the duration that this pin was either ``high`` or ``low``. * Configures this pin to a digital input, and generates events where the timestamp is the duration that this pin was either ``high`` or ``low``.
@ -581,7 +581,7 @@ declare namespace pins {
//% help=pins/pulse-duration advanced=true //% help=pins/pulse-duration advanced=true
//% blockId=pins_pulse_duration block="pulse duration (µs)" //% blockId=pins_pulse_duration block="pulse duration (µs)"
//% weight=21 blockGap=8 shim=pins::pulseDuration //% weight=21 blockGap=8 shim=pins::pulseDuration
function pulseDuration(): number; function pulseDuration(): int32;
/** /**
* Returns the duration of a pulse in microseconds * Returns the duration of a pulse in microseconds
@ -591,7 +591,7 @@ declare namespace pins {
*/ */
//% blockId="pins_pulse_in" block="pulse in (µs)|pin %name|pulsed %value" //% blockId="pins_pulse_in" block="pulse in (µs)|pin %name|pulsed %value"
//% weight=20 advanced=true maxDuration.defl=2000000 shim=pins::pulseIn //% weight=20 advanced=true maxDuration.defl=2000000 shim=pins::pulseIn
function pulseIn(name: DigitalPin, value: PulseValue, maxDuration?: number): number; function pulseIn(name: DigitalPin, value: PulseValue, maxDuration?: int32): int32;
/** /**
* Writes a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement). * Writes a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).
@ -602,7 +602,7 @@ declare namespace pins {
//% blockId=device_set_servo_pin block="servo write|pin %name|to %value" blockGap=8 //% blockId=device_set_servo_pin block="servo write|pin %name|to %value" blockGap=8
//% parts=microservo trackArgs=0 //% parts=microservo trackArgs=0
//% value.min=0 value.max=180 shim=pins::servoWritePin //% value.min=0 value.max=180 shim=pins::servoWritePin
function servoWritePin(name: AnalogPin, value: number): void; function servoWritePin(name: AnalogPin, value: int32): void;
/** /**
* Configures this IO pin as an analog/pwm output, configures the period to be 20 ms, and sets the pulse width, based on the value it is given **microseconds** or `1/1000` milliseconds. * Configures this IO pin as an analog/pwm output, configures the period to be 20 ms, and sets the pulse width, based on the value it is given **microseconds** or `1/1000` milliseconds.
@ -611,7 +611,7 @@ declare namespace pins {
*/ */
//% help=pins/servo-set-pulse weight=19 //% help=pins/servo-set-pulse weight=19
//% blockId=device_set_servo_pulse block="servo set pulse|pin %value|to (µs) %micros" shim=pins::servoSetPulse //% blockId=device_set_servo_pulse block="servo set pulse|pin %value|to (µs) %micros" shim=pins::servoSetPulse
function servoSetPulse(name: AnalogPin, micros: number): void; function servoSetPulse(name: AnalogPin, micros: int32): void;
/** /**
* Sets the pin used when using `analog pitch` or music. * Sets the pin used when using `analog pitch` or music.
@ -628,7 +628,7 @@ declare namespace pins {
*/ */
//% blockId=device_analog_pitch block="analog pitch %frequency|for (ms) %ms" //% blockId=device_analog_pitch block="analog pitch %frequency|for (ms) %ms"
//% help=pins/analog-pitch weight=4 async advanced=true blockGap=8 shim=pins::analogPitch //% help=pins/analog-pitch weight=4 async advanced=true blockGap=8 shim=pins::analogPitch
function analogPitch(frequency: number, ms: number): void; function analogPitch(frequency: int32, ms: int32): void;
/** /**
* Configures the pull of this pin. * Configures the pull of this pin.
@ -654,19 +654,19 @@ declare namespace pins {
* @param size number of bytes in the buffer * @param size number of bytes in the buffer
*/ */
//% shim=pins::createBuffer //% shim=pins::createBuffer
function createBuffer(size: number): Buffer; function createBuffer(size: int32): Buffer;
/** /**
* Read `size` bytes from a 7-bit I2C `address`. * Read `size` bytes from a 7-bit I2C `address`.
*/ */
//% repeat.defl=0 shim=pins::i2cReadBuffer //% repeat.defl=0 shim=pins::i2cReadBuffer
function i2cReadBuffer(address: number, size: number, repeat?: boolean): Buffer; function i2cReadBuffer(address: int32, size: int32, repeat?: boolean): Buffer;
/** /**
* Write bytes to a 7-bit I2C `address`. * Write bytes to a 7-bit I2C `address`.
*/ */
//% repeat.defl=0 shim=pins::i2cWriteBuffer //% repeat.defl=0 shim=pins::i2cWriteBuffer
function i2cWriteBuffer(address: number, buf: Buffer, repeat?: boolean): void; function i2cWriteBuffer(address: int32, buf: Buffer, repeat?: boolean): void;
/** /**
* Write to the SPI slave and return the response * Write to the SPI slave and return the response
@ -674,7 +674,7 @@ declare namespace pins {
*/ */
//% help=pins/spi-write weight=5 advanced=true //% help=pins/spi-write weight=5 advanced=true
//% blockId=spi_write block="spi write %value" shim=pins::spiWrite //% blockId=spi_write block="spi write %value" shim=pins::spiWrite
function spiWrite(value: number): number; function spiWrite(value: int32): int32;
} }
@ -726,7 +726,7 @@ declare namespace serial {
* @param length default buffer length, eg: 64 * @param length default buffer length, eg: 64
*/ */
//% help=serial/read-buffer advanced=true weight=5 shim=serial::readBuffer //% help=serial/read-buffer advanced=true weight=5 shim=serial::readBuffer
function readBuffer(length: number): Buffer; function readBuffer(length: int32): Buffer;
/** /**
* Dynamically configuring the serial instance to use pins other than USBTX and USBRX. * Dynamically configuring the serial instance to use pins other than USBTX and USBRX.
@ -749,29 +749,29 @@ declare interface Buffer {
* Write a number in specified format in the buffer. * Write a number in specified format in the buffer.
*/ */
//% shim=BufferMethods::setNumber //% shim=BufferMethods::setNumber
setNumber(format: NumberFormat, offset: number, value: number): void; setNumber(format: NumberFormat, offset: int32, value: int32): void;
/** /**
* Read a number in specified format from the buffer. * Read a number in specified format from the buffer.
*/ */
//% shim=BufferMethods::getNumber //% shim=BufferMethods::getNumber
getNumber(format: NumberFormat, offset: number): number; getNumber(format: NumberFormat, offset: int32): int32;
/** Returns the length of a Buffer object. */ /** Returns the length of a Buffer object. */
//% property shim=BufferMethods::length //% property shim=BufferMethods::length
length: number; length: int32;
/** /**
* Fill (a fragment) of the buffer with given value. * Fill (a fragment) of the buffer with given value.
*/ */
//% offset.defl=0 length.defl=-1 shim=BufferMethods::fill //% offset.defl=0 length.defl=-1 shim=BufferMethods::fill
fill(value: number, offset?: number, length?: number): void; fill(value: int32, offset?: int32, length?: int32): void;
/** /**
* Return a copy of a fragment of a buffer. * Return a copy of a fragment of a buffer.
*/ */
//% offset.defl=0 length.defl=-1 shim=BufferMethods::slice //% offset.defl=0 length.defl=-1 shim=BufferMethods::slice
slice(offset?: number, length?: number): Buffer; slice(offset?: int32, length?: int32): Buffer;
/** /**
* Shift buffer left in place, with zero padding. * Shift buffer left in place, with zero padding.
@ -780,7 +780,7 @@ declare interface Buffer {
* @param length number of elements in buffer. If negative, length is set as the buffer length minus start. eg: -1 * @param length number of elements in buffer. If negative, length is set as the buffer length minus start. eg: -1
*/ */
//% start.defl=0 length.defl=-1 shim=BufferMethods::shift //% start.defl=0 length.defl=-1 shim=BufferMethods::shift
shift(offset: number, start?: number, length?: number): void; shift(offset: int32, start?: int32, length?: int32): void;
/** /**
* Rotate buffer left in place. * Rotate buffer left in place.
@ -789,13 +789,13 @@ declare interface Buffer {
* @param length number of elements in buffer. If negative, length is set as the buffer length minus start. eg: -1 * @param length number of elements in buffer. If negative, length is set as the buffer length minus start. eg: -1
*/ */
//% start.defl=0 length.defl=-1 shim=BufferMethods::rotate //% start.defl=0 length.defl=-1 shim=BufferMethods::rotate
rotate(offset: number, start?: number, length?: number): void; rotate(offset: int32, start?: int32, length?: int32): void;
/** /**
* Write contents of `src` at `dstOffset` in current buffer. * Write contents of `src` at `dstOffset` in current buffer.
*/ */
//% shim=BufferMethods::write //% shim=BufferMethods::write
write(dstOffset: number, src: Buffer): void; write(dstOffset: int32, src: Buffer): void;
} }
// Auto-generated. Do not edit. Really. // Auto-generated. Do not edit. Really.

View File

@ -55,7 +55,7 @@ declare namespace devices {
*/ */
//% help=devices/signal-strength weight=24 //% help=devices/signal-strength weight=24
//% blockId=devices_signal_strength block="signal strength" blockGap=14 icon="\uf012" blockGap=14 shim=devices::signalStrength //% blockId=devices_signal_strength block="signal strength" blockGap=14 icon="\uf012" blockGap=14 shim=devices::signalStrength
function signalStrength(): number; function signalStrength(): int32;
/** /**
* Registers code to run when the device notifies about a change of signal strength. * Registers code to run when the device notifies about a change of signal strength.

18
libs/radio/shims.d.ts vendored
View File

@ -11,7 +11,7 @@ declare namespace radio {
//% help=radio/send-number //% help=radio/send-number
//% weight=60 //% weight=60
//% blockId=radio_datagram_send block="radio send number %value" blockGap=8 shim=radio::sendNumber //% blockId=radio_datagram_send block="radio send number %value" blockGap=8 shim=radio::sendNumber
function sendNumber(value: number): void; function sendNumber(value: int32): void;
/** /**
* Broadcasts a name / value pair along with the device serial number * Broadcasts a name / value pair along with the device serial number
@ -22,7 +22,7 @@ declare namespace radio {
//% help=radio/send-value //% help=radio/send-value
//% weight=59 //% weight=59
//% blockId=radio_datagram_send_value block="radio send|value %name|= %value" blockGap=8 shim=radio::sendValue //% blockId=radio_datagram_send_value block="radio send|value %name|= %value" blockGap=8 shim=radio::sendValue
function sendValue(name: string, value: number): void; function sendValue(name: string, value: int32): void;
/** /**
* Broadcasts a string along with the device serial number * Broadcasts a string along with the device serial number
@ -61,7 +61,7 @@ declare namespace radio {
//% weight=46 //% weight=46
//% blockId=radio_datagram_receive block="radio receive number" blockGap=8 //% blockId=radio_datagram_receive block="radio receive number" blockGap=8
//% deprecated=true shim=radio::receiveNumber //% deprecated=true shim=radio::receiveNumber
function receiveNumber(): number; function receiveNumber(): int32;
/** /**
* Registers code to run when a packet is received over radio. * Registers code to run when a packet is received over radio.
@ -91,7 +91,7 @@ declare namespace radio {
//% weight=40 //% weight=40
//% blockId=radio_datagram_rssi block="radio received signal strength" //% blockId=radio_datagram_rssi block="radio received signal strength"
//% deprecated=true shim=radio::receivedSignalStrength //% deprecated=true shim=radio::receivedSignalStrength
function receivedSignalStrength(): number; function receivedSignalStrength(): int32;
/** /**
* Sets the group id for radio communications. A micro:bit can only listen to one group ID at any time. * Sets the group id for radio communications. A micro:bit can only listen to one group ID at any time.
@ -101,7 +101,7 @@ declare namespace radio {
//% weight=10 blockGap=8 //% weight=10 blockGap=8
//% blockId=radio_set_group block="radio set group %ID" //% blockId=radio_set_group block="radio set group %ID"
//% id.min=0 id.max=255 shim=radio::setGroup //% id.min=0 id.max=255 shim=radio::setGroup
function setGroup(id: number): void; function setGroup(id: int32): void;
/** /**
* Change the output power level of the transmitter to the given value. * Change the output power level of the transmitter to the given value.
@ -112,7 +112,7 @@ declare namespace radio {
//% blockId=radio_set_transmit_power block="radio set transmit power %power" //% blockId=radio_set_transmit_power block="radio set transmit power %power"
//% power.min=0 power.max=7 //% power.min=0 power.max=7
//% advanced=true shim=radio::setTransmitPower //% advanced=true shim=radio::setTransmitPower
function setTransmitPower(power: number): void; function setTransmitPower(power: int32): void;
/** /**
* Set the radio to transmit the serial number in each message. * Set the radio to transmit the serial number in each message.
@ -130,7 +130,7 @@ declare namespace radio {
* contain a number. * contain a number.
*/ */
//% help=radio/received-number shim=radio::receivedNumber //% help=radio/received-number shim=radio::receivedNumber
function receivedNumber(): number; function receivedNumber(): int32;
/** /**
* Returns the serial number of the sender micro:bit from the last packet taken * Returns the serial number of the sender micro:bit from the last packet taken
@ -138,7 +138,7 @@ declare namespace radio {
* that packet did not send a serial number. * that packet did not send a serial number.
*/ */
//% help=radio/received-serial shim=radio::receivedSerial //% help=radio/received-serial shim=radio::receivedSerial
function receivedSerial(): number; function receivedSerial(): uint32;
/** /**
* Returns the string payload from the last packet taken from the radio queue * Returns the string payload from the last packet taken from the radio queue
@ -154,7 +154,7 @@ declare namespace radio {
* ``receiveString``, etc). * ``receiveString``, etc).
*/ */
//% help=radio/received-time shim=radio::receivedTime //% help=radio/received-time shim=radio::receivedTime
function receivedTime(): number; function receivedTime(): uint32;
} }
// Auto-generated. Do not edit. Really. // Auto-generated. Do not edit. Really.

View File

@ -38,6 +38,6 @@
"semantic-ui-less": "^2.2.4" "semantic-ui-less": "^2.2.4"
}, },
"dependencies": { "dependencies": {
"pxt-core": "0.12.67" "pxt-core": "0.12.69"
} }
} }