updated latest eSPI version

This commit is contained in:
0x1abin
2018-05-07 17:16:01 +08:00
parent 59b5a32445
commit 7e863fb993
24 changed files with 6555 additions and 13841 deletions
+3 -39
View File
@@ -3,7 +3,7 @@
#include "M5Stack.h"
void M5Stack::begin() {
void M5Stack::begin(bool LCDEnable, bool SDEnable) {
// UART
Serial.begin(115200);
@@ -23,15 +23,10 @@ void M5Stack::begin() {
pinMode(BUTTON_C_PIN, INPUT_PULLUP);
// M5 LCD INIT
Lcd.begin();
Lcd.fillScreen(BLACK);
Lcd.setCursor(0, 0);
Lcd.setTextColor(WHITE);
Lcd.setTextSize(1);
Lcd.setBrightness(50);
if (LCDEnable) Lcd.begin();
// TF Card
SD.begin(TFCARD_CS_PIN, SPI, 27000000);
if (SDEnable) SD.begin(TFCARD_CS_PIN, SPI, 40000000);
// Set wakeup button
setWakeupButton(BUTTON_A_PIN);
@@ -55,37 +50,6 @@ void M5Stack::update() {
Speaker.update();
}
void M5Stack::startupLogo() {
static uint8_t brightness, pre_brightness;
uint32_t length = strlen((char*)m5stack_startup_music);
Lcd.setBrightness(0);
Lcd.drawBitmap(0, 0, 320, 240, (uint16_t *)gImage_logoM5);
for(int i=0; i<length; i++) {
dacWrite(SPEAKER_PIN, m5stack_startup_music[i]>>2);
delayMicroseconds(40);
brightness = (i/157);
if(pre_brightness != brightness) {
pre_brightness = brightness;
Lcd.setBrightness(brightness);
}
}
for(int i=255; i>=0; i--) {
lcd.setBrightness(i);
if(i<=32) {
dacWrite(SPEAKER_PIN, i);
}
delay(2);
}
Lcd.fillScreen(BLACK);
delay(800);
for(int i=0; i>=100; i++) {
Lcd.setBrightness(i);
delay(2);
}
}
void M5Stack::setWakeupButton(uint8_t button) {
_wakeupPin = button;
}