Skip to content

Commit 7e863fb

Browse files
committed
updated latest eSPI version
1 parent 59b5a32 commit 7e863fb

24 files changed

Lines changed: 6555 additions & 13841 deletions

examples/Basics/FactoryTest/FactoryTest.ino

Lines changed: 52 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,46 @@
22
#include "utility/MPU9250.h"
33
#include "WiFi.h"
44

5+
extern const unsigned char gImage_logoM5[];
6+
extern const unsigned char m5stack_startup_music[];
7+
8+
#ifndef min
9+
#define min(a,b) (((a) < (b)) ? (a) : (b))
10+
#endif
11+
512
MPU9250 IMU;
613

14+
void startupLogo() {
15+
static uint8_t brightness, pre_brightness;
16+
uint32_t length = strlen((char*)m5stack_startup_music);
17+
M5.Lcd.setBrightness(0);
18+
M5.Lcd.pushImage(0, 0, 320, 240, (uint16_t *)gImage_logoM5);
19+
for(int i=0; i<length; i++) {
20+
dacWrite(SPEAKER_PIN, m5stack_startup_music[i]>>2);
21+
delayMicroseconds(40);
22+
brightness = (i/157);
23+
if(pre_brightness != brightness) {
24+
pre_brightness = brightness;
25+
M5.Lcd.setBrightness(brightness);
26+
}
27+
}
28+
29+
for(int i=255; i>=0; i--) {
30+
M5.Lcd.setBrightness(i);
31+
if(i<=32) {
32+
dacWrite(SPEAKER_PIN, i);
33+
}
34+
delay(2);
35+
}
36+
37+
M5.Lcd.fillScreen(BLACK);
38+
delay(800);
39+
for(int i=0; i>=100; i++) {
40+
M5.Lcd.setBrightness(i);
41+
delay(2);
42+
}
43+
}
44+
745
//TF card test
846
void listDir(fs::FS &fs, const char * dirname, uint8_t levels){
947
Serial.printf("Listing directory: %s\n", dirname);
@@ -142,6 +180,7 @@ void wifi_test() {
142180
M5.Lcd.println("");
143181
}
144182

183+
/*
145184
bool gpio_test_flg = 0;
146185
void GPIO_test() {
147186
// uint8_t gpio_table[] = {23,19,18,3,16,21,2,12,15,26,1,17,22,5,13,0,34};
@@ -179,7 +218,7 @@ void adc_test() {
179218
delay(500);
180219
}
181220
}
182-
221+
*/
183222
unsigned long testLines(uint16_t color)
184223
{
185224
unsigned long start, t;
@@ -418,25 +457,25 @@ unsigned long testFilledRoundRects()
418457
void setup() {
419458

420459
//gpio test
421-
pinMode(BUTTON_A_PIN, INPUT_PULLUP);
422-
if(digitalRead(BUTTON_A_PIN) == 0) {
423-
gpio_test_flg = 1;
424-
}
460+
// pinMode(BUTTON_A_PIN, INPUT_PULLUP);
461+
// if(digitalRead(BUTTON_A_PIN) == 0) {
462+
// gpio_test_flg = 1;
463+
// }
425464

426-
if (gpio_test_flg) {
427-
GPIO_test();
428-
}
465+
// if (gpio_test_flg) {
466+
// GPIO_test();
467+
// }
429468

430469
// initialize the M5Stack object
431470
M5.begin();
432471

433472
// dac test
434-
if (gpio_test_flg)
435-
{
436-
adc_test();
437-
}
473+
// if (gpio_test_flg)
474+
// {
475+
// adc_test();
476+
// }
438477

439-
M5.startupLogo();
478+
startupLogo();
440479
Wire.begin();
441480

442481
// Lcd display
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#include "bmp_map.h"
2-
31
const unsigned char gImage_logoM5[153600] = {/* 0X00,0X10,0X40,0X01,0XF0,0X00,0X01,0X1B, */
42
/* 0X10,0X10,0X01,0X40,0X00,0XF0,0X01,0X1B, */
53
0XEF, 0X7D, 0XEF, 0X7D, 0XEF, 0X7D, 0XEF, 0X7D, 0XEF, 0X7D, 0XEF, 0X7D, 0XEF, 0X7D, 0XEF, 0X7D,
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ void setup(){
77
M5.begin();
88

99
// LCD display
10-
M5.Lcd.printf("hello world");
10+
M5.Lcd.print("Hello World");
1111
}
1212

1313
// the loop routine runs over and over again forever

examples/Games/Tetris/Tetris.ino

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,9 @@ Block blocks[7] = {
3939
extern uint8_t tetris_img[];
4040
//========================================================================
4141
void setup(void) {
42-
Serial.begin(115200); // SERIAL
4342
M5.begin(); // M5STACK INITIALIZE
4443
M5.Lcd.setBrightness(200); // BRIGHTNESS = MAX 255
4544
M5.Lcd.fillScreen(BLACK); // CLEAR SCREEN
46-
M5.Lcd.setRotation(0); // SCREEN ROTATION = 0
4745
//----------------------------// Make Block ----------------------------
4846
make_block( 0, BLACK); // Type No, Color
4947
make_block( 1, 0x00F0); // DDDD RED
@@ -76,7 +74,7 @@ void Draw() { // Draw 120x240 in the center
7674
for (int i = 0; i < Width; ++i) for (int j = 0; j < Height; ++j)
7775
for (int k = 0; k < Length; ++k) for (int l = 0; l < Length; ++l)
7876
backBuffer[j * Length + l][i * Length + k] = BlockImage[screen[i][j]][k][l];
79-
M5.Lcd.drawBitmap(100, 0, 120, 240, (uint16_t *)backBuffer);
77+
M5.Lcd.pushImage(100, 0, 120, 240, (uint16_t *)backBuffer);
8078
}
8179
//========================================================================
8280
void PutStartPos() {

examples/Modules/DHT12/DHT12.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include <M5Stack.h>
2-
#include "utility/DHT12.h"
2+
#include "DHT12.h"
33
#include <Wire.h> //The DHT12 uses I2C comunication.
44
DHT12 dht12; //Preset scale CELSIUS and ID 0x5c.
55

0 commit comments

Comments
 (0)