added led.enable (#294)

* added led.enable

* fixed simulator support for led.enable
This commit is contained in:
Peli de Halleux
2016-10-28 08:34:04 -07:00
committed by GitHub
parent c6e38bd7a9
commit 76adc3c00a
8 changed files with 98 additions and 20 deletions

View File

@ -84,14 +84,24 @@ namespace led {
/**
* Sets the display mode between black and white and greyscale for rendering LEDs.
* @param mode TODO
* @param mode mode the display mode in which the screen operates
*/
//% weight=1 help=led/set-display-mode
//% parts="ledmatrix"
//% parts="ledmatrix" advanced=true
void setDisplayMode(DisplayMode_ mode) {
uBit.display.setDisplayMode((DisplayMode)mode);
}
/**
* Turns on or off the display
*/
//% help=led/enable blockId=device_led_enable icon="\uf04d"
//% advanced=true parts="ledmatrix"
void enable(bool on) {
if (on) uBit.display.enable();
else uBit.display.disable();
}
/**
* Takes a screenshot of the LED screen and returns an image.
*/

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

@ -488,12 +488,19 @@ declare namespace led {
/**
* Sets the display mode between black and white and greyscale for rendering LEDs.
* @param mode TODO
* @param mode mode the display mode in which the screen operates
*/
//% weight=1 help=led/set-display-mode
//% parts="ledmatrix" shim=led::setDisplayMode
//% parts="ledmatrix" advanced=true shim=led::setDisplayMode
function setDisplayMode(mode: DisplayMode): void;
/**
* Turns on or off the display
*/
//% help=led/enable blockId=device_led_enable icon="\uf04d"
//% advanced=true parts="ledmatrix" shim=led::enable
function enable(on: boolean): void;
/**
* Takes a screenshot of the LED screen and returns an image.
*/