-
-
Save MaBecker/5294791104c8c873f337cc70866bc231 to your computer and use it in GitHub Desktop.
M5Stack Espruino initialization example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Also, need to change in ILI9341pal.js: | |
var LCD_WIDTH = 320; | |
var LCD_HEIGHT = 240; | |
*/ | |
BTN1 = D39 | |
BTN2 = D38 | |
BTN3 = D37 | |
SPKR = D25 | |
ILI9341 = { | |
LIGHT: D32, | |
RST: D33, | |
DC: D27, | |
CS: D14, | |
} | |
TFCARD = { | |
CS: D4, | |
} | |
MPU9250 = { | |
SDA: D21, | |
SCL: D22, | |
} | |
// Stop the noise | |
SPKR.write(0) | |
// Configure hardware SPI (currently slow on Espruino) | |
//var spi = SPI2; | |
//spi.setup({ sck: D18, miso: D19, mosi: D23, baud: 24000000 }); | |
// Configure software SPI | |
var spi = new SPI(); | |
spi.setup({ sck: D18, mosi: D23 }); | |
// Turn on backlight | |
analogWrite(ILI9341.LIGHT, 0.1) | |
var palette = new Uint16Array([0xFFFF, 0xF800, 0x001F, 0x0000]); | |
var g = require("ILI9341pal").connect( | |
palette, spi, ILI9341.DC, ILI9341.CS, ILI9341.RST, | |
function() { | |
g.setRotation(0, true) | |
g.clear(); | |
g.setFontVector(20); | |
g.setColor(1); | |
g.drawString("Espruino",0,10); | |
g.setColor(2); | |
g.drawString("Blynk",0,40); | |
g.flip(); | |
print('Draw OK') | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment