adding namespace to api categories (#330)

* adding namespace to api categories

* add icon for led

* adding icons for control, game, images, pins and serial.
This commit is contained in:
Peli de Halleux 2017-01-05 07:01:50 -08:00 committed by GitHub
parent c713fe9bf4
commit 5d8ccd1d6d
19 changed files with 71 additions and 71 deletions

View File

@ -7,7 +7,7 @@ using namespace pxt;
/** /**
* Support for additional Bluetooth services. * Support for additional Bluetooth services.
*/ */
//% color=#0082FB weight=20 //% color=#0082FB weight=20 icon="\uf294"
namespace bluetooth { namespace bluetooth {
MicroBitUARTService *uart = NULL; MicroBitUARTService *uart = NULL;

View File

@ -1,7 +1,7 @@
/** /**
* Support for additional Bluetooth services. * Support for additional Bluetooth services.
*/ */
//% color=#0082FB weight=20 //% color=#0082FB weight=20 icon="\uf294"
namespace bluetooth { namespace bluetooth {
/** /**
* Writes to the Bluetooth UART service buffer. From there the data is transmitted over Bluetooth to a connected device. * Writes to the Bluetooth UART service buffer. From there the data is transmitted over Bluetooth to a connected device.

View File

@ -4,7 +4,7 @@
/** /**
* Support for additional Bluetooth services. * Support for additional Bluetooth services.
*/ */
//% color=#0082FB weight=20 //% color=#0082FB weight=20 icon="\uf294"
declare namespace bluetooth { declare namespace bluetooth {
/** /**

View File

@ -4,7 +4,7 @@
/** /**
* Provides access to basic micro:bit functionality. * Provides access to basic micro:bit functionality.
*/ */
//% color=#0078D7 weight=100 //% color=#0078D7 weight=100 icon="\uf00a"
namespace basic { namespace basic {
/** /**
@ -13,7 +13,7 @@ namespace basic {
*/ */
//% help=basic/show-number //% help=basic/show-number
//% weight=96 //% weight=96
//% blockId=device_show_number block="show|number %number" blockGap=8 icon="\uf1ec" //% blockId=device_show_number block="show|number %number" blockGap=8
//% async //% async
//% parts="ledmatrix" //% parts="ledmatrix"
void showNumber(int value, int interval = 150) { void showNumber(int value, int interval = 150) {
@ -50,7 +50,7 @@ namespace basic {
*/ */
//% help=basic/show-string //% help=basic/show-string
//% weight=87 blockGap=8 //% weight=87 blockGap=8
//% block="show|string %text" icon="\uf031" //% block="show|string %text"
//% async //% async
//% blockId=device_print_message //% blockId=device_print_message
//% parts="ledmatrix" //% parts="ledmatrix"
@ -73,7 +73,7 @@ namespace basic {
* Turn off all LEDs * Turn off all LEDs
*/ */
//% help=basic/clear-screen weight=79 //% help=basic/clear-screen weight=79
//% blockId=device_clear_display block="clear screen" icon="\uf12d" //% blockId=device_clear_display block="clear screen"
//% parts="ledmatrix" //% parts="ledmatrix"
void clearScreen() { void clearScreen() {
uBit.display.image.clear(); uBit.display.image.clear();

View File

@ -1,7 +1,7 @@
/** /**
* Runtime and event utilities. * Runtime and event utilities.
*/ */
//% weight=1 color="#333333" //% weight=1 color="#333333" icon="\uf233"
//% advanced=true //% advanced=true
namespace control { namespace control {

View File

@ -21,7 +21,7 @@ enum LedSpriteProperty {
/** /**
* A single-LED sprite game engine * A single-LED sprite game engine
*/ */
//% color=#008272 weight=32 //% color=#008272 weight=32 icon="\uf11b"
//% advanced=true //% advanced=true
namespace game { namespace game {
let _score: number = 0; let _score: number = 0;

View File

@ -3,7 +3,7 @@
/** /**
* Creation, manipulation and display of LED images. * Creation, manipulation and display of LED images.
*/ */
//% color=#5C2D91 weight=31 //% color=#5C2D91 weight=31 icon="\uf03e"
//% advanced=true //% advanced=true
namespace images { namespace images {
/** /**

View File

@ -112,7 +112,7 @@ enum class Gesture {
EightG = MICROBIT_ACCELEROMETER_EVT_8G EightG = MICROBIT_ACCELEROMETER_EVT_8G
}; };
//% color=300 weight=99 //% color=300 weight=99 icon="\uf192"
namespace input { namespace input {
/** /**
* Do something when a button (``A``, ``B`` or both ``A+B``) is pressed * Do something when a button (``A``, ``B`` or both ``A+B``) is pressed
@ -120,7 +120,7 @@ namespace input {
* @param body code to run when event is raised * @param body code to run when event is raised
*/ */
//% help=input/on-button-pressed weight=85 blockGap=8 //% help=input/on-button-pressed weight=85 blockGap=8
//% blockId=device_button_event block="on button|%NAME|pressed" icon="\uf192" //% blockId=device_button_event block="on button|%NAME|pressed"
//% parts="buttonpair" //% parts="buttonpair"
void onButtonPressed(Button button, Action body) { void onButtonPressed(Button button, Action body) {
registerWithDal((int)button, MICROBIT_BUTTON_EVT_CLICK, body); registerWithDal((int)button, MICROBIT_BUTTON_EVT_CLICK, body);
@ -132,7 +132,7 @@ namespace input {
* @param body code to run when gesture is raised * @param body code to run when gesture is raised
*/ */
//% help=input/on-gesture weight=84 blockGap=8 //% help=input/on-gesture weight=84 blockGap=8
//% blockId=device_gesture_event block="on |%NAME" icon="\uf135" //% blockId=device_gesture_event block="on |%NAME"
//% parts="accelerometer" //% parts="accelerometer"
void onGesture(Gesture gesture, Action body) { void onGesture(Gesture gesture, Action body) {
int gi = (int)gesture; int gi = (int)gesture;
@ -149,7 +149,7 @@ namespace input {
* @param body the code to run when the pin is pressed * @param body the code to run when the pin is pressed
*/ */
//% help=input/on-pin-pressed weight=83 //% help=input/on-pin-pressed weight=83
//% blockId=device_pin_event block="on pin %name|pressed" icon="\uf094" //% blockId=device_pin_event block="on pin %name|pressed"
void onPinPressed(TouchPin name, Action body) { void onPinPressed(TouchPin name, Action body) {
auto pin = getPin((int)name); auto pin = getPin((int)name);
if (!pin) return; if (!pin) return;
@ -165,7 +165,7 @@ namespace input {
* @param body the code to run when the pin is released * @param body the code to run when the pin is released
*/ */
//% help=input/on-pin-released weight=6 blockGap=8 //% help=input/on-pin-released weight=6 blockGap=8
//% blockId=device_pin_released block="on pin %NAME|released" icon="\uf094" //% blockId=device_pin_released block="on pin %NAME|released"
//% advanced=true //% advanced=true
void onPinReleased(TouchPin name, Action body) { void onPinReleased(TouchPin name, Action body) {
auto pin = getPin((int)name); auto pin = getPin((int)name);
@ -200,7 +200,7 @@ namespace input {
* @param name pin used to detect the touch, eg: TouchPin.P0 * @param name pin used to detect the touch, eg: TouchPin.P0
*/ */
//% help=input/pin-is-pressed weight=58 //% help=input/pin-is-pressed weight=58
//% blockId="device_pin_is_pressed" block="pin %NAME|is pressed" icon="\uf094" //% blockId="device_pin_is_pressed" block="pin %NAME|is pressed"
//% blockGap=8 //% blockGap=8
bool pinIsPressed(TouchPin name) { bool pinIsPressed(TouchPin name) {
auto pin = getPin((int)name); auto pin = getPin((int)name);
@ -218,7 +218,7 @@ namespace input {
* Get the acceleration value in milli-gravitys (when the board is laying flat with the screen up, x=0, y=0 and z=-1024) * Get the acceleration value in milli-gravitys (when the board is laying flat with the screen up, x=0, y=0 and z=-1024)
* @param dimension TODO * @param dimension TODO
*/ */
//% help=input/acceleration weight=58 icon="\uf135" //% 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" //% parts="accelerometer"
int acceleration(Dimension dimension) { int acceleration(Dimension dimension) {
@ -235,7 +235,7 @@ namespace input {
* 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.
*/ */
//% help=input/light-level weight=57 //% help=input/light-level weight=57
//% blockId=device_get_light_level block="light level" blockGap=8 icon="\uf185" //% blockId=device_get_light_level block="light level" blockGap=8
//% parts="ledmatrix" //% parts="ledmatrix"
int lightLevel() { int lightLevel() {
return uBit.display.readLightLevel(); return uBit.display.readLightLevel();
@ -245,7 +245,7 @@ namespace input {
* Get the current compass heading in degrees. * Get the current compass heading in degrees.
*/ */
//% help=input/compass-heading //% help=input/compass-heading
//% weight=56 icon="\uf14e" //% weight=56
//% blockId=device_heading block="compass heading (°)" blockGap=8 //% blockId=device_heading block="compass heading (°)" blockGap=8
//% parts="compass" //% parts="compass"
int compassHeading() { int compassHeading() {
@ -256,7 +256,7 @@ namespace input {
/** /**
* Gets the temperature in Celsius degrees (°C). * Gets the temperature in Celsius degrees (°C).
*/ */
//% weight=55 icon="\uf06d" //% weight=55
//% help=input/temperature //% help=input/temperature
//% blockId=device_temperature block="temperature (°C)" blockGap=8 //% blockId=device_temperature block="temperature (°C)" blockGap=8
//% parts="thermometer" //% parts="thermometer"
@ -269,7 +269,7 @@ namespace input {
* @param kind TODO * @param kind TODO
*/ */
//% help=input/rotation weight=52 //% help=input/rotation weight=52
//% blockId=device_get_rotation block="rotation (°)|%NAME" blockGap=8 icon="\uf197" //% blockId=device_get_rotation block="rotation (°)|%NAME" blockGap=8
//% parts="accelerometer" advanced=true //% parts="accelerometer" advanced=true
int rotation(Rotation kind) { int rotation(Rotation kind) {
switch (kind) { switch (kind) {
@ -284,7 +284,7 @@ namespace input {
* @param dimension TODO * @param dimension TODO
*/ */
//% help=input/magnetic-force weight=51 //% help=input/magnetic-force weight=51
//% blockId=device_get_magnetic_force block="magnetic force (µT)|%NAME" blockGap=8 icon="\uf076" //% blockId=device_get_magnetic_force block="magnetic force (µT)|%NAME" blockGap=8
//% parts="compass" //% parts="compass"
//% advanced=true //% advanced=true
int magneticForce(Dimension dimension) { int magneticForce(Dimension dimension) {
@ -304,7 +304,7 @@ namespace input {
* Gets the number of milliseconds elapsed since power on. * Gets the number of milliseconds elapsed since power on.
*/ */
//% help=input/running-time weight=50 //% help=input/running-time weight=50
//% blockId=device_get_running_time block="running time (ms)" icon="\uf017" //% blockId=device_get_running_time block="running time (ms)"
//% advanced=true //% advanced=true
int runningTime() { int runningTime() {
return system_timer_current_time(); return system_timer_current_time();
@ -321,7 +321,7 @@ namespace input {
* @param range a value describe the maximum strengh of acceleration measured * @param range a value describe the maximum strengh of acceleration measured
*/ */
//% help=input/set-accelerometer-range //% help=input/set-accelerometer-range
//% blockId=device_set_accelerometer_range block="set accelerometer|range %range" icon="\uf135" //% blockId=device_set_accelerometer_range block="set accelerometer|range %range"
//% weight=5 //% weight=5
//% parts="accelerometer" //% parts="accelerometer"
//% advanced=true //% advanced=true

View File

@ -1,7 +1,7 @@
/** /**
* Events and data from sensors * Events and data from sensors
*/ */
//% color=#B4009E weight=99 //% color=#B4009E weight=99 icon="\uf192"
namespace input { namespace input {
/** /**
* Attaches code to run when the screen is facing up. * Attaches code to run when the screen is facing up.

View File

@ -8,7 +8,7 @@ enum class DisplayMode_ {
// TODO DISPLAY_MODE_BLACK_AND_WHITE_LIGHT_SENSE // TODO DISPLAY_MODE_BLACK_AND_WHITE_LIGHT_SENSE
}; };
//% color=3 weight=35 //% color=3 weight=35 icon="\uf205"
namespace led { namespace led {
/** /**
@ -17,7 +17,7 @@ namespace led {
* @param y TODO * @param y TODO
*/ */
//% help=led/plot weight=78 //% help=led/plot weight=78
//% blockId=device_plot block="plot|x %x|y %y" icon="\uf205" blockGap=8 //% blockId=device_plot block="plot|x %x|y %y" blockGap=8
//% parts="ledmatrix" //% parts="ledmatrix"
void plot(int x, int y) { void plot(int x, int y) {
uBit.display.image.setPixelValue(x, y, 1); uBit.display.image.setPixelValue(x, y, 1);
@ -29,7 +29,7 @@ namespace led {
* @param y TODO * @param y TODO
*/ */
//% help=led/unplot weight=77 //% help=led/unplot weight=77
//% blockId=device_unplot block="unplot|x %x|y %y" icon="\uf204" blockGap=8 //% blockId=device_unplot block="unplot|x %x|y %y" blockGap=8
//% parts="ledmatrix" //% parts="ledmatrix"
void unplot(int x, int y) { void unplot(int x, int y) {
uBit.display.image.setPixelValue(x, y, 0); uBit.display.image.setPixelValue(x, y, 0);
@ -41,7 +41,7 @@ namespace led {
* @param y TODO * @param y TODO
*/ */
//% help=led/point weight=76 //% help=led/point weight=76
//% blockId=device_point block="point|x %x|y %y" icon="\uf10c" //% blockId=device_point block="point|x %x|y %y"
//% parts="ledmatrix" //% parts="ledmatrix"
bool point(int x, int y) { bool point(int x, int y) {
int pix = uBit.display.image.getPixelValue(x, y); int pix = uBit.display.image.getPixelValue(x, y);
@ -52,7 +52,7 @@ namespace led {
* Get the screen brightness from 0 (off) to 255 (full bright). * Get the screen brightness from 0 (off) to 255 (full bright).
*/ */
//% help=led/brightness weight=60 //% help=led/brightness weight=60
//% blockId=device_get_brightness block="brightness" icon="\uf042" blockGap=8 //% blockId=device_get_brightness block="brightness" blockGap=8
//% parts="ledmatrix" //% parts="ledmatrix"
//% advanced=true //% advanced=true
int brightness() { int brightness() {
@ -64,7 +64,7 @@ namespace led {
* @param value the brightness value, eg:255, 127, 0 * @param value the brightness value, eg:255, 127, 0
*/ */
//% help=led/set-brightness weight=59 //% help=led/set-brightness weight=59
//% blockId=device_set_brightness block="set brightness %value" icon="\uf042" //% blockId=device_set_brightness block="set brightness %value"
//% parts="ledmatrix" //% parts="ledmatrix"
//% advanced=true //% advanced=true
void setBrightness(int value) { void setBrightness(int value) {
@ -75,7 +75,7 @@ namespace led {
* Cancels the current animation and clears other pending animations. * Cancels the current animation and clears other pending animations.
*/ */
//% weight=50 help=led/stop-animation //% weight=50 help=led/stop-animation
//% blockId=device_stop_animation block="stop animation" icon="\uf04d" //% blockId=device_stop_animation block="stop animation"
//% parts="ledmatrix" //% parts="ledmatrix"
//% advanced=true //% advanced=true
void stopAnimation() { void stopAnimation() {
@ -95,7 +95,7 @@ namespace led {
/** /**
* Turns on or off the display * Turns on or off the display
*/ */
//% help=led/enable blockId=device_led_enable block="led enable %on" icon="\uf04d" //% help=led/enable blockId=device_led_enable block="led enable %on"
//% advanced=true parts="ledmatrix" //% advanced=true parts="ledmatrix"
void enable(bool on) { void enable(bool on) {
if (on) uBit.display.enable(); if (on) uBit.display.enable();

View File

@ -1,7 +1,7 @@
/** /**
* Control of the LED screen. * Control of the LED screen.
*/ */
//% color=#5C2D91 weight=97 //% color=#5C2D91 weight=97 icon="\uf205"
namespace led { namespace led {
// what's the current high value // what's the current high value

View File

@ -129,7 +129,7 @@ enum BeatFraction {
/** /**
* Generation of music tones through pin ``P0``. * Generation of music tones through pin ``P0``.
*/ */
//% color=#D83B01 weight=98 //% color=#D83B01 weight=98 icon="\uf025"
namespace music { namespace music {
let beatsPerMinute: number = 120; let beatsPerMinute: number = 120;
@ -139,7 +139,7 @@ namespace music {
* @param ms tone duration in milliseconds (ms) * @param ms tone duration in milliseconds (ms)
*/ */
//% help=music/play-tone weight=90 //% help=music/play-tone weight=90
//% blockId=device_play_note block="play|tone %note=device_note|for %duration=device_beat" icon="\uf025" blockGap=8 //% blockId=device_play_note block="play|tone %note=device_note|for %duration=device_beat" blockGap=8
//% parts="headphone" //% parts="headphone"
export function playTone(frequency: number, ms: number): void { export function playTone(frequency: number, ms: number): void {
pins.analogPitch(frequency, ms); pins.analogPitch(frequency, ms);
@ -150,7 +150,7 @@ namespace music {
* @param frequency pitch of the tone to play in Hertz (Hz) * @param frequency pitch of the tone to play in Hertz (Hz)
*/ */
//% help=music/ring-tone weight=80 //% help=music/ring-tone weight=80
//% blockId=device_ring block="ring tone (Hz)|%note=device_note" icon="\uf025" blockGap=8 //% blockId=device_ring block="ring tone (Hz)|%note=device_note" blockGap=8
//% parts="headphone" //% parts="headphone"
export function ringTone(frequency: number): void { export function ringTone(frequency: number): void {
pins.analogPitch(frequency, 0); pins.analogPitch(frequency, 0);

View File

@ -1,7 +1,7 @@
/** /**
* Control currents in Pins for analog/digital signals, servos, i2c, ... * Control currents in Pins for analog/digital signals, servos, i2c, ...
*/ */
//% color=#A80000 weight=30 //% color=#A80000 weight=30 icon="\uf140"
//% advanced=true //% advanced=true
namespace pins { namespace pins {
/** /**

View File

@ -34,7 +34,7 @@ enum Delimiters {
Hash = 6, Hash = 6,
}; };
//% weight=2 color=30 //% weight=2 color=30 icon="\uf287"
//% advanced=true //% advanced=true
namespace serial { namespace serial {
// note that at least one // followed by % is needed per declaration! // note that at least one // followed by % is needed per declaration!

View File

@ -1,7 +1,7 @@
/** /**
* Reading and writing data over a serial connection. * Reading and writing data over a serial connection.
*/ */
//% weight=2 color=#002050 //% weight=2 color=#002050 icon="\uf287"
//% advanced=true //% advanced=true
namespace serial { namespace serial {
/** /**

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

@ -4,7 +4,7 @@
/** /**
* Creation, manipulation and display of LED images. * Creation, manipulation and display of LED images.
*/ */
//% color=#5C2D91 weight=31 //% color=#5C2D91 weight=31 icon="\uf03e"
//% advanced=true //% advanced=true
declare namespace images { declare namespace images {
@ -126,7 +126,7 @@ declare interface Image {
/** /**
* Provides access to basic micro:bit functionality. * Provides access to basic micro:bit functionality.
*/ */
//% color=#0078D7 weight=100 //% color=#0078D7 weight=100 icon="\uf00a"
declare namespace basic { declare namespace basic {
/** /**
@ -135,7 +135,7 @@ declare namespace basic {
*/ */
//% help=basic/show-number //% help=basic/show-number
//% weight=96 //% weight=96
//% blockId=device_show_number block="show|number %number" blockGap=8 icon="\uf1ec" //% 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: number, interval?: number): void;
@ -160,7 +160,7 @@ declare namespace basic {
*/ */
//% help=basic/show-string //% help=basic/show-string
//% weight=87 blockGap=8 //% weight=87 blockGap=8
//% block="show|string %text" icon="\uf031" //% block="show|string %text"
//% 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
@ -170,7 +170,7 @@ declare namespace basic {
* Turn off all LEDs * Turn off all LEDs
*/ */
//% help=basic/clear-screen weight=79 //% help=basic/clear-screen weight=79
//% blockId=device_clear_display block="clear screen" icon="\uf12d" //% blockId=device_clear_display block="clear screen"
//% parts="ledmatrix" shim=basic::clearScreen //% parts="ledmatrix" shim=basic::clearScreen
function clearScreen(): void; function clearScreen(): void;
@ -211,7 +211,7 @@ declare namespace basic {
//% color=300 weight=99 //% color=300 weight=99 icon="\uf192"
declare namespace input { declare namespace input {
/** /**
@ -220,7 +220,7 @@ declare namespace input {
* @param body code to run when event is raised * @param body code to run when event is raised
*/ */
//% help=input/on-button-pressed weight=85 blockGap=8 //% help=input/on-button-pressed weight=85 blockGap=8
//% blockId=device_button_event block="on button|%NAME|pressed" icon="\uf192" //% blockId=device_button_event block="on button|%NAME|pressed"
//% parts="buttonpair" shim=input::onButtonPressed //% parts="buttonpair" shim=input::onButtonPressed
function onButtonPressed(button: Button, body: () => void): void; function onButtonPressed(button: Button, body: () => void): void;
@ -230,7 +230,7 @@ declare namespace input {
* @param body code to run when gesture is raised * @param body code to run when gesture is raised
*/ */
//% help=input/on-gesture weight=84 blockGap=8 //% help=input/on-gesture weight=84 blockGap=8
//% blockId=device_gesture_event block="on |%NAME" icon="\uf135" //% blockId=device_gesture_event block="on |%NAME"
//% parts="accelerometer" shim=input::onGesture //% parts="accelerometer" shim=input::onGesture
function onGesture(gesture: Gesture, body: () => void): void; function onGesture(gesture: Gesture, body: () => void): void;
@ -240,7 +240,7 @@ declare namespace input {
* @param body the code to run when the pin is pressed * @param body the code to run when the pin is pressed
*/ */
//% help=input/on-pin-pressed weight=83 //% help=input/on-pin-pressed weight=83
//% blockId=device_pin_event block="on pin %name|pressed" icon="\uf094" shim=input::onPinPressed //% blockId=device_pin_event block="on pin %name|pressed" shim=input::onPinPressed
function onPinPressed(name: TouchPin, body: () => void): void; function onPinPressed(name: TouchPin, body: () => void): void;
/** /**
@ -249,7 +249,7 @@ declare namespace input {
* @param body the code to run when the pin is released * @param body the code to run when the pin is released
*/ */
//% help=input/on-pin-released weight=6 blockGap=8 //% help=input/on-pin-released weight=6 blockGap=8
//% blockId=device_pin_released block="on pin %NAME|released" icon="\uf094" //% blockId=device_pin_released block="on pin %NAME|released"
//% advanced=true shim=input::onPinReleased //% advanced=true shim=input::onPinReleased
function onPinReleased(name: TouchPin, body: () => void): void; function onPinReleased(name: TouchPin, body: () => void): void;
@ -269,7 +269,7 @@ declare namespace input {
* @param name pin used to detect the touch, eg: TouchPin.P0 * @param name pin used to detect the touch, eg: TouchPin.P0
*/ */
//% help=input/pin-is-pressed weight=58 //% help=input/pin-is-pressed weight=58
//% blockId="device_pin_is_pressed" block="pin %NAME|is pressed" icon="\uf094" //% blockId="device_pin_is_pressed" block="pin %NAME|is pressed"
//% blockGap=8 shim=input::pinIsPressed //% blockGap=8 shim=input::pinIsPressed
function pinIsPressed(name: TouchPin): boolean; function pinIsPressed(name: TouchPin): boolean;
@ -277,7 +277,7 @@ declare namespace input {
* Get the acceleration value in milli-gravitys (when the board is laying flat with the screen up, x=0, y=0 and z=-1024) * Get the acceleration value in milli-gravitys (when the board is laying flat with the screen up, x=0, y=0 and z=-1024)
* @param dimension TODO * @param dimension TODO
*/ */
//% help=input/acceleration weight=58 icon="\uf135" //% 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): number;
@ -286,7 +286,7 @@ declare namespace input {
* 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.
*/ */
//% help=input/light-level weight=57 //% help=input/light-level weight=57
//% blockId=device_get_light_level block="light level" blockGap=8 icon="\uf185" //% 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(): number;
@ -294,7 +294,7 @@ declare namespace input {
* Get the current compass heading in degrees. * Get the current compass heading in degrees.
*/ */
//% help=input/compass-heading //% help=input/compass-heading
//% weight=56 icon="\uf14e" //% 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(): number;
@ -302,7 +302,7 @@ declare namespace input {
/** /**
* Gets the temperature in Celsius degrees (°C). * Gets the temperature in Celsius degrees (°C).
*/ */
//% weight=55 icon="\uf06d" //% weight=55
//% 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
@ -313,7 +313,7 @@ declare namespace input {
* @param kind TODO * @param kind TODO
*/ */
//% help=input/rotation weight=52 //% help=input/rotation weight=52
//% blockId=device_get_rotation block="rotation (°)|%NAME" blockGap=8 icon="\uf197" //% 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): number;
@ -322,7 +322,7 @@ declare namespace input {
* @param dimension TODO * @param dimension TODO
*/ */
//% help=input/magnetic-force weight=51 //% help=input/magnetic-force weight=51
//% blockId=device_get_magnetic_force block="magnetic force (µT)|%NAME" blockGap=8 icon="\uf076" //% 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): number;
@ -331,7 +331,7 @@ declare namespace input {
* Gets the number of milliseconds elapsed since power on. * Gets the number of milliseconds elapsed since power on.
*/ */
//% help=input/running-time weight=50 //% help=input/running-time weight=50
//% blockId=device_get_running_time block="running time (ms)" icon="\uf017" //% blockId=device_get_running_time block="running time (ms)"
//% advanced=true shim=input::runningTime //% advanced=true shim=input::runningTime
function runningTime(): number; function runningTime(): number;
@ -346,7 +346,7 @@ declare namespace input {
* @param range a value describe the maximum strengh of acceleration measured * @param range a value describe the maximum strengh of acceleration measured
*/ */
//% help=input/set-accelerometer-range //% help=input/set-accelerometer-range
//% blockId=device_set_accelerometer_range block="set accelerometer|range %range" icon="\uf135" //% blockId=device_set_accelerometer_range block="set accelerometer|range %range"
//% weight=5 //% weight=5
//% parts="accelerometer" //% parts="accelerometer"
//% advanced=true shim=input::setAccelerometerRange //% advanced=true shim=input::setAccelerometerRange
@ -427,7 +427,7 @@ declare namespace control {
//% color=3 weight=35 //% color=3 weight=35 icon="\uf205"
declare namespace led { declare namespace led {
/** /**
@ -436,7 +436,7 @@ declare namespace led {
* @param y TODO * @param y TODO
*/ */
//% help=led/plot weight=78 //% help=led/plot weight=78
//% blockId=device_plot block="plot|x %x|y %y" icon="\uf205" blockGap=8 //% blockId=device_plot block="plot|x %x|y %y" blockGap=8
//% parts="ledmatrix" shim=led::plot //% parts="ledmatrix" shim=led::plot
function plot(x: number, y: number): void; function plot(x: number, y: number): void;
@ -446,7 +446,7 @@ declare namespace led {
* @param y TODO * @param y TODO
*/ */
//% help=led/unplot weight=77 //% help=led/unplot weight=77
//% blockId=device_unplot block="unplot|x %x|y %y" icon="\uf204" blockGap=8 //% blockId=device_unplot block="unplot|x %x|y %y" blockGap=8
//% parts="ledmatrix" shim=led::unplot //% parts="ledmatrix" shim=led::unplot
function unplot(x: number, y: number): void; function unplot(x: number, y: number): void;
@ -456,7 +456,7 @@ declare namespace led {
* @param y TODO * @param y TODO
*/ */
//% help=led/point weight=76 //% help=led/point weight=76
//% blockId=device_point block="point|x %x|y %y" icon="\uf10c" //% blockId=device_point block="point|x %x|y %y"
//% parts="ledmatrix" shim=led::point //% parts="ledmatrix" shim=led::point
function point(x: number, y: number): boolean; function point(x: number, y: number): boolean;
@ -464,7 +464,7 @@ declare namespace led {
* Get the screen brightness from 0 (off) to 255 (full bright). * Get the screen brightness from 0 (off) to 255 (full bright).
*/ */
//% help=led/brightness weight=60 //% help=led/brightness weight=60
//% blockId=device_get_brightness block="brightness" icon="\uf042" 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(): number;
@ -474,7 +474,7 @@ declare namespace led {
* @param value the brightness value, eg:255, 127, 0 * @param value the brightness value, eg:255, 127, 0
*/ */
//% help=led/set-brightness weight=59 //% help=led/set-brightness weight=59
//% blockId=device_set_brightness block="set brightness %value" icon="\uf042" //% blockId=device_set_brightness block="set brightness %value"
//% parts="ledmatrix" //% parts="ledmatrix"
//% advanced=true shim=led::setBrightness //% advanced=true shim=led::setBrightness
function setBrightness(value: number): void; function setBrightness(value: number): void;
@ -483,7 +483,7 @@ declare namespace led {
* Cancels the current animation and clears other pending animations. * Cancels the current animation and clears other pending animations.
*/ */
//% weight=50 help=led/stop-animation //% weight=50 help=led/stop-animation
//% blockId=device_stop_animation block="stop animation" icon="\uf04d" //% blockId=device_stop_animation block="stop animation"
//% parts="ledmatrix" //% parts="ledmatrix"
//% advanced=true shim=led::stopAnimation //% advanced=true shim=led::stopAnimation
function stopAnimation(): void; function stopAnimation(): void;
@ -499,7 +499,7 @@ declare namespace led {
/** /**
* Turns on or off the display * Turns on or off the display
*/ */
//% help=led/enable blockId=device_led_enable block="led enable %on" icon="\uf04d" //% help=led/enable blockId=device_led_enable block="led enable %on"
//% advanced=true parts="ledmatrix" shim=led::enable //% advanced=true parts="ledmatrix" shim=led::enable
function enable(on: boolean): void; function enable(on: boolean): void;
@ -658,7 +658,7 @@ declare namespace pins {
//% weight=2 color=30 //% weight=2 color=30 icon="\uf287"
//% advanced=true //% advanced=true
declare namespace serial { declare namespace serial {

View File

@ -24,7 +24,7 @@ using namespace pxt;
// payload: string length (9), string (10 ... 28) // payload: string length (9), string (10 ... 28)
#define PACKET_TYPE_STRING 2 #define PACKET_TYPE_STRING 2
//% color=270 weight=34 //% color=270 weight=34 icon="\uf012"
namespace radio { namespace radio {
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------

View File

@ -1,7 +1,7 @@
/** /**
* Communicate data using radio packets * Communicate data using radio packets
*/ */
//% color=#E3008C weight=34 //% color=#E3008C weight=34 icon="\uf012"
namespace radio { namespace radio {
export class Packet { export class Packet {
/** /**

View File

@ -2,7 +2,7 @@
//% color=270 weight=34 //% color=270 weight=34 icon="\uf012"
declare namespace radio { declare namespace radio {
/** /**