Adding advanced attribute to blocks and categories (#273)
This commit is contained in:
parent
6e64e80c05
commit
9f5ebdfb78
@ -110,6 +110,7 @@ enum EventBusValue {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//% weight=1 color="#333333"
|
//% weight=1 color="#333333"
|
||||||
|
//% advanced=true
|
||||||
namespace control {
|
namespace control {
|
||||||
void fiberDone(void *a)
|
void fiberDone(void *a)
|
||||||
{
|
{
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
* Runtime and event utilities.
|
* Runtime and event utilities.
|
||||||
*/
|
*/
|
||||||
//% weight=1 color="#333333"
|
//% weight=1 color="#333333"
|
||||||
|
//% advanced=true
|
||||||
namespace control {
|
namespace control {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,6 +22,7 @@ enum LedSpriteProperty {
|
|||||||
* A single-LED sprite game engine
|
* A single-LED sprite game engine
|
||||||
*/
|
*/
|
||||||
//% color=#008272 weight=32
|
//% color=#008272 weight=32
|
||||||
|
//% advanced=true
|
||||||
namespace game {
|
namespace game {
|
||||||
let _score: number = 0;
|
let _score: number = 0;
|
||||||
let _life: number = 3;
|
let _life: number = 3;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
* Creation, manipulation and display of LED images.
|
* Creation, manipulation and display of LED images.
|
||||||
*/
|
*/
|
||||||
//% color=#5C2D91 weight=31
|
//% color=#5C2D91 weight=31
|
||||||
|
//% advanced=true
|
||||||
namespace images {
|
namespace images {
|
||||||
/**
|
/**
|
||||||
* Creates an image that fits on the LED screen.
|
* Creates an image that fits on the LED screen.
|
||||||
|
@ -143,6 +143,7 @@ namespace input {
|
|||||||
*/
|
*/
|
||||||
//% 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" icon="\uf094"
|
||||||
|
//% advanced=true
|
||||||
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;
|
||||||
@ -159,6 +160,7 @@ namespace input {
|
|||||||
*/
|
*/
|
||||||
//% 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" icon="\uf094"
|
||||||
|
//% advanced=true
|
||||||
void onPinReleased(TouchPin name, Action body) {
|
void onPinReleased(TouchPin name, Action body) {
|
||||||
auto pin = getPin((int)name);
|
auto pin = getPin((int)name);
|
||||||
if (!pin) return;
|
if (!pin) return;
|
||||||
@ -193,6 +195,7 @@ namespace input {
|
|||||||
//% help=input/pin-is-pressed weight=56
|
//% help=input/pin-is-pressed weight=56
|
||||||
//% blockId="device_pin_is_pressed" block="pin %NAME|is pressed" icon="\uf094"
|
//% blockId="device_pin_is_pressed" block="pin %NAME|is pressed" icon="\uf094"
|
||||||
//% blockGap=8
|
//% blockGap=8
|
||||||
|
//% advanced=true
|
||||||
bool pinIsPressed(TouchPin name) {
|
bool pinIsPressed(TouchPin name) {
|
||||||
auto pin = getPin((int)name);
|
auto pin = getPin((int)name);
|
||||||
return pin && pin->isTouched();
|
return pin && pin->isTouched();
|
||||||
@ -278,6 +281,7 @@ namespace input {
|
|||||||
//% 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 icon="\uf076"
|
||||||
//% parts="compass"
|
//% parts="compass"
|
||||||
|
//% advanced=true
|
||||||
int magneticForce(Dimension dimension) {
|
int magneticForce(Dimension dimension) {
|
||||||
if (!uBit.compass.isCalibrated())
|
if (!uBit.compass.isCalibrated())
|
||||||
uBit.compass.calibrate();
|
uBit.compass.calibrate();
|
||||||
@ -296,6 +300,7 @@ namespace input {
|
|||||||
*/
|
*/
|
||||||
//% 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)" icon="\uf017"
|
||||||
|
//% advanced=true
|
||||||
int runningTime() {
|
int runningTime() {
|
||||||
return system_timer_current_time();
|
return system_timer_current_time();
|
||||||
}
|
}
|
||||||
@ -314,6 +319,7 @@ namespace input {
|
|||||||
//% blockId=device_set_accelerometer_range block="set accelerometer|range %range" icon="\uf135"
|
//% blockId=device_set_accelerometer_range block="set accelerometer|range %range" icon="\uf135"
|
||||||
//% weight=5
|
//% weight=5
|
||||||
//% parts="accelerometer"
|
//% parts="accelerometer"
|
||||||
|
//% advanced=true
|
||||||
void setAccelerometerRange(AcceleratorRange range) {
|
void setAccelerometerRange(AcceleratorRange range) {
|
||||||
uBit.accelerometer.setRange((int)range);
|
uBit.accelerometer.setRange((int)range);
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,7 @@ namespace led {
|
|||||||
//% 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" icon="\uf042" blockGap=8
|
||||||
//% parts="ledmatrix"
|
//% parts="ledmatrix"
|
||||||
|
//% advanced=true
|
||||||
int brightness() {
|
int brightness() {
|
||||||
return uBit.display.getBrightness();
|
return uBit.display.getBrightness();
|
||||||
}
|
}
|
||||||
@ -65,6 +66,7 @@ namespace led {
|
|||||||
//% 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" icon="\uf042"
|
||||||
//% parts="ledmatrix"
|
//% parts="ledmatrix"
|
||||||
|
//% advanced=true
|
||||||
void setBrightness(int value) {
|
void setBrightness(int value) {
|
||||||
uBit.display.setBrightness(value);
|
uBit.display.setBrightness(value);
|
||||||
}
|
}
|
||||||
@ -75,6 +77,7 @@ namespace led {
|
|||||||
//% 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" icon="\uf04d"
|
||||||
//% parts="ledmatrix"
|
//% parts="ledmatrix"
|
||||||
|
//% advanced=true
|
||||||
void stopAnimation() {
|
void stopAnimation() {
|
||||||
uBit.display.stopAnimation();
|
uBit.display.stopAnimation();
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,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
|
||||||
|
//% advanced=true
|
||||||
namespace pins {
|
namespace pins {
|
||||||
/**
|
/**
|
||||||
* Re-maps a number from one range to another. That is, a value of ``from low`` would get mapped to ``to low``, a value of ``from high`` to ``to high``, values in-between to values in-between, etc.
|
* Re-maps a number from one range to another. That is, a value of ``from low`` would get mapped to ``to low``, a value of ``from high`` to ``to high``, values in-between to values in-between, etc.
|
||||||
|
@ -20,6 +20,7 @@ enum class BaudRate {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//% weight=2 color=30
|
//% weight=2 color=30
|
||||||
|
//% 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!
|
||||||
|
|
||||||
|
@ -2,6 +2,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
|
||||||
|
//% advanced=true
|
||||||
namespace serial {
|
namespace serial {
|
||||||
/**
|
/**
|
||||||
* Prints a line of text to the serial
|
* Prints a line of text to the serial
|
||||||
|
30
libs/core/shims.d.ts
vendored
30
libs/core/shims.d.ts
vendored
@ -5,6 +5,7 @@
|
|||||||
* Creation, manipulation and display of LED images.
|
* Creation, manipulation and display of LED images.
|
||||||
*/
|
*/
|
||||||
//% color=#5C2D91 weight=31
|
//% color=#5C2D91 weight=31
|
||||||
|
//% advanced=true
|
||||||
declare namespace images {
|
declare namespace images {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -238,7 +239,8 @@ 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" icon="\uf094"
|
||||||
|
//% advanced=true shim=input::onPinPressed
|
||||||
function onPinPressed(name: TouchPin, body: () => void): void;
|
function onPinPressed(name: TouchPin, body: () => void): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -247,7 +249,8 @@ 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" shim=input::onPinReleased
|
//% blockId=device_pin_released block="on pin %NAME|released" icon="\uf094"
|
||||||
|
//% advanced=true shim=input::onPinReleased
|
||||||
function onPinReleased(name: TouchPin, body: () => void): void;
|
function onPinReleased(name: TouchPin, body: () => void): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -266,7 +269,8 @@ declare namespace input {
|
|||||||
*/
|
*/
|
||||||
//% help=input/pin-is-pressed weight=56
|
//% help=input/pin-is-pressed weight=56
|
||||||
//% blockId="device_pin_is_pressed" block="pin %NAME|is pressed" icon="\uf094"
|
//% blockId="device_pin_is_pressed" block="pin %NAME|is pressed" icon="\uf094"
|
||||||
//% blockGap=8 shim=input::pinIsPressed
|
//% blockGap=8
|
||||||
|
//% advanced=true shim=input::pinIsPressed
|
||||||
function pinIsPressed(name: TouchPin): boolean;
|
function pinIsPressed(name: TouchPin): boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -319,14 +323,16 @@ declare namespace input {
|
|||||||
*/
|
*/
|
||||||
//% 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 icon="\uf076"
|
||||||
//% parts="compass" shim=input::magneticForce
|
//% parts="compass"
|
||||||
|
//% advanced=true shim=input::magneticForce
|
||||||
function magneticForce(dimension: Dimension): number;
|
function magneticForce(dimension: Dimension): number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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" shim=input::runningTime
|
//% blockId=device_get_running_time block="running time (ms)" icon="\uf017"
|
||||||
|
//% advanced=true shim=input::runningTime
|
||||||
function runningTime(): number;
|
function runningTime(): number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -342,13 +348,15 @@ declare namespace input {
|
|||||||
//% 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" icon="\uf135"
|
||||||
//% weight=5
|
//% weight=5
|
||||||
//% parts="accelerometer" shim=input::setAccelerometerRange
|
//% parts="accelerometer"
|
||||||
|
//% advanced=true shim=input::setAccelerometerRange
|
||||||
function setAccelerometerRange(range: AcceleratorRange): void;
|
function setAccelerometerRange(range: AcceleratorRange): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//% weight=1 color="#333333"
|
//% weight=1 color="#333333"
|
||||||
|
//% advanced=true
|
||||||
declare namespace control {
|
declare namespace control {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -457,7 +465,8 @@ declare namespace led {
|
|||||||
*/
|
*/
|
||||||
//% 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" icon="\uf042" blockGap=8
|
||||||
//% parts="ledmatrix" shim=led::brightness
|
//% parts="ledmatrix"
|
||||||
|
//% advanced=true shim=led::brightness
|
||||||
function brightness(): number;
|
function brightness(): number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -466,7 +475,8 @@ declare namespace led {
|
|||||||
*/
|
*/
|
||||||
//% 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" icon="\uf042"
|
||||||
//% parts="ledmatrix" shim=led::setBrightness
|
//% parts="ledmatrix"
|
||||||
|
//% advanced=true shim=led::setBrightness
|
||||||
function setBrightness(value: number): void;
|
function setBrightness(value: number): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -474,7 +484,8 @@ declare namespace led {
|
|||||||
*/
|
*/
|
||||||
//% 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" icon="\uf04d"
|
||||||
//% parts="ledmatrix" shim=led::stopAnimation
|
//% parts="ledmatrix"
|
||||||
|
//% advanced=true shim=led::stopAnimation
|
||||||
function stopAnimation(): void;
|
function stopAnimation(): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -636,6 +647,7 @@ declare namespace pins {
|
|||||||
|
|
||||||
|
|
||||||
//% weight=2 color=30
|
//% weight=2 color=30
|
||||||
|
//% advanced=true
|
||||||
declare namespace serial {
|
declare namespace serial {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -104,6 +104,7 @@ namespace radio {
|
|||||||
//% help=radio/write-value-to-serial
|
//% help=radio/write-value-to-serial
|
||||||
//% weight=3
|
//% weight=3
|
||||||
//% blockId=radio_write_value_serial block="radio write value to serial"
|
//% blockId=radio_write_value_serial block="radio write value to serial"
|
||||||
|
//% advanced=true
|
||||||
void writeValueToSerial() {
|
void writeValueToSerial() {
|
||||||
if (radioEnable() != MICROBIT_OK) return;
|
if (radioEnable() != MICROBIT_OK) return;
|
||||||
PacketBuffer p = uBit.radio.datagram.recv();
|
PacketBuffer p = uBit.radio.datagram.recv();
|
||||||
@ -198,6 +199,7 @@ namespace radio {
|
|||||||
//% help=radio/received-signal-strength
|
//% help=radio/received-signal-strength
|
||||||
//% weight=40
|
//% weight=40
|
||||||
//% blockId=radio_datagram_rssi block="radio received signal strength"
|
//% blockId=radio_datagram_rssi block="radio received signal strength"
|
||||||
|
//% advanced=true
|
||||||
int receivedSignalStrength() {
|
int receivedSignalStrength() {
|
||||||
if (radioEnable() != MICROBIT_OK) return 0;
|
if (radioEnable() != MICROBIT_OK) return 0;
|
||||||
return packet.getRSSI();
|
return packet.getRSSI();
|
||||||
@ -222,6 +224,7 @@ namespace radio {
|
|||||||
//% help=radio/set-transmit-power
|
//% help=radio/set-transmit-power
|
||||||
//% weight=9 blockGap=8
|
//% weight=9 blockGap=8
|
||||||
//% blockId=radio_set_transmit_power block="radio set transmit power %power"
|
//% blockId=radio_set_transmit_power block="radio set transmit power %power"
|
||||||
|
//% advanced=true
|
||||||
void setTransmitPower(int power) {
|
void setTransmitPower(int power) {
|
||||||
if (radioEnable() != MICROBIT_OK) return;
|
if (radioEnable() != MICROBIT_OK) return;
|
||||||
uBit.radio.setTransmitPower(power);
|
uBit.radio.setTransmitPower(power);
|
||||||
@ -233,6 +236,7 @@ namespace radio {
|
|||||||
//% help=radio/set-transmit-serial-number
|
//% help=radio/set-transmit-serial-number
|
||||||
//% weight=8 blockGap=8
|
//% weight=8 blockGap=8
|
||||||
//% blockId=radio_set_transmit_serial_number block="radio set transmit serial number %transmit"
|
//% blockId=radio_set_transmit_serial_number block="radio set transmit serial number %transmit"
|
||||||
|
//% advanced=true
|
||||||
void setTransmitSerialNumber(bool transmit) {
|
void setTransmitSerialNumber(bool transmit) {
|
||||||
if (radioEnable() != MICROBIT_OK) return;
|
if (radioEnable() != MICROBIT_OK) return;
|
||||||
transmitSerialNumber = transmit;
|
transmitSerialNumber = transmit;
|
||||||
|
12
libs/radio/shims.d.ts
vendored
12
libs/radio/shims.d.ts
vendored
@ -38,7 +38,8 @@ declare namespace radio {
|
|||||||
*/
|
*/
|
||||||
//% help=radio/write-value-to-serial
|
//% help=radio/write-value-to-serial
|
||||||
//% weight=3
|
//% weight=3
|
||||||
//% blockId=radio_write_value_serial block="radio write value to serial" shim=radio::writeValueToSerial
|
//% blockId=radio_write_value_serial block="radio write value to serial"
|
||||||
|
//% advanced=true shim=radio::writeValueToSerial
|
||||||
function writeValueToSerial(): void;
|
function writeValueToSerial(): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -79,7 +80,8 @@ declare namespace radio {
|
|||||||
*/
|
*/
|
||||||
//% help=radio/received-signal-strength
|
//% help=radio/received-signal-strength
|
||||||
//% weight=40
|
//% weight=40
|
||||||
//% blockId=radio_datagram_rssi block="radio received signal strength" shim=radio::receivedSignalStrength
|
//% blockId=radio_datagram_rssi block="radio received signal strength"
|
||||||
|
//% advanced=true shim=radio::receivedSignalStrength
|
||||||
function receivedSignalStrength(): number;
|
function receivedSignalStrength(): number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -97,7 +99,8 @@ declare namespace radio {
|
|||||||
*/
|
*/
|
||||||
//% help=radio/set-transmit-power
|
//% help=radio/set-transmit-power
|
||||||
//% weight=9 blockGap=8
|
//% weight=9 blockGap=8
|
||||||
//% blockId=radio_set_transmit_power block="radio set transmit power %power" shim=radio::setTransmitPower
|
//% blockId=radio_set_transmit_power block="radio set transmit power %power"
|
||||||
|
//% advanced=true shim=radio::setTransmitPower
|
||||||
function setTransmitPower(power: number): void;
|
function setTransmitPower(power: number): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -105,7 +108,8 @@ declare namespace radio {
|
|||||||
*/
|
*/
|
||||||
//% help=radio/set-transmit-serial-number
|
//% help=radio/set-transmit-serial-number
|
||||||
//% weight=8 blockGap=8
|
//% weight=8 blockGap=8
|
||||||
//% blockId=radio_set_transmit_serial_number block="radio set transmit serial number %transmit" shim=radio::setTransmitSerialNumber
|
//% blockId=radio_set_transmit_serial_number block="radio set transmit serial number %transmit"
|
||||||
|
//% advanced=true shim=radio::setTransmitSerialNumber
|
||||||
function setTransmitSerialNumber(transmit: boolean): void;
|
function setTransmitSerialNumber(transmit: boolean): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user