Skip to content
Permalink
Browse files

Bangle.js: add fake LED/LED1/LED2 as @allObjects suggested

  • Loading branch information
gfwilliams committed Dec 4, 2019
1 parent e03843e commit 3bdafd892fc243327b880788b166acb178e3be92
@@ -50,6 +50,8 @@
Bangle.js: Added heart rate autocorrelation, setHRMPower and 'HRM' event
Bangle.js: New 120x120 and 80x80 high speed buffered modes
Fixed REPL to allow chars with char code >=128
Fixed lex tokenToString for 'break'
Bangle.js: add fake LED/LED1/LED2 as @allObjects suggested

2v04 : Allow \1..\9 escape codes in RegExp
ESP8266: reading storage is not working for boot from user2 (fix #1507)
@@ -2103,3 +2103,45 @@ E.showAlert("These are\nLots of\nLines","My Title").then(function() {
To remove the window, call `E.showAlert()` with no arguments.
*/

/*JSON{
"type" : "variable",
"name" : "LED",
"generate" : "gen_jswrap_LED1",
"return" : ["JsVar","A `Pin` object for a fake LED which appears on "],
"ifdef" : "BANGLEJS"
}
On most Espruino board there are LEDs, in which case `LED` will be an actual Pin.
On Bangle.js there are no LEDs, so to remain compatible with example code that might
expect an LED, this is an object that behaves like a pin, but which just displays
a circle on the display
*/
/*JSON{
"type" : "variable",
"name" : "LED1",
"generate_js" : "libs/js/banglejs/LED1.min.js",
"return" : ["JsVar","A `Pin` object for a fake LED which appears on "],
"ifdef" : "BANGLEJS"
}
On most Espruino board there are LEDs, in which case `LED1` will be an actual Pin.
On Bangle.js there are no LEDs, so to remain compatible with example code that might
expect an LED, this is an object that behaves like a pin, but which just displays
a circle on the display
*/
/*JSON{
"type" : "variable",
"name" : "LED2",
"generate_js" : "libs/js/banglejs/LED2.min.js",
"return" : ["JsVar","A `Pin` object for a fake LED which appears on "],
"ifdef" : "BANGLEJS"
}
On most Espruino board there are LEDs, in which case `LED2` will be an actual Pin.
On Bangle.js there are no LEDs, so to remain compatible with example code that might
expect an LED, this is an object that behaves like a pin, but which just displays
a circle on the display
*/
@@ -0,0 +1,10 @@
(function() { // by @allObjects
return {
_v: false, // status on / off
read: function() { return this._v; },
set: function() { this.write(1); },
reset: function() { this.write(0); },
write: function(v) { g.setColor((this._v=!!v)?1:0,0,0).fillCircle(110,5,5); },
toggle: function() { this.write(!this._v); }
};
})

Some generated files are not rendered by default. Learn more.

@@ -0,0 +1,10 @@
(function() { // by @allObjects
return {
_v: false, // status on / off
read: function() { return this._v; },
set: function() { this.write(1); },
reset: function() { this.write(0); },
write: function(v) { g.setColor(0,(this._v=!!v)?1:0,0).fillCircle(130,5,5); },
toggle: function() { this.write(!this._v); }
};
})

Some generated files are not rendered by default. Learn more.

@@ -34,5 +34,7 @@ node ../../../EspruinoDocs/bin/minify.js banglejs/E_showMenu.js banglejs/E_showM
node ../../../EspruinoDocs/bin/minify.js banglejs/E_showMessage.js banglejs/E_showMessage.min.js
node ../../../EspruinoDocs/bin/minify.js banglejs/E_showPrompt.js banglejs/E_showPrompt.min.js
node ../../../EspruinoDocs/bin/minify.js banglejs/E_showAlert.js banglejs/E_showAlert.min.js
node ../../../EspruinoDocs/bin/minify.js banglejs/LED1.js banglejs/LED1.min.js
node ../../../EspruinoDocs/bin/minify.js banglejs/LED2.js banglejs/LED2.min.js


0 comments on commit 3bdafd8

Please sign in to comment.
You can’t perform that action at this time.