Skip to content

Instantly share code, notes, and snippets.

@vshymanskyy
Last active February 6, 2024 19:53
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vshymanskyy/49accf6355900346fd1418336d6be86e to your computer and use it in GitHub Desktop.
Save vshymanskyy/49accf6355900346fd1418336d6be86e to your computer and use it in GitHub Desktop.
M5Stack Espruino initialization example
/*
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')
});
@lgd20
Copy link

lgd20 commented Jul 10, 2018

Hi vshymanskyy, did you run this file directly from the Espruino IDE? And have you downloaded the ILI9341 module as a local directory or are you using the .min file from the web? Thanks for you help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment