
No License
C++
2020年07月28日
#include <LGFX_TFT_eSPI.hpp>
#include "AXP192.h"
#include "utility/Config.h"
#include "utility/SH200Q.h"
#include "utility/MPU6886.h"
#include "utility/Button.h"
#include "utility/CommUtil.h"
#include "RTC.h"
#include "IMU.h"
#define BLACK 0x0000
#define NAVY 0x000F
#define DARKGREEN 0x03E0
#define DARKCYAN 0x03EF
#define MAROON 0x7800
#define PURPLE 0x780F
#define OLIVE 0x7BE0
#define LIGHTGREY 0xC618
#define DARKGREY 0x7BEF
#define BLUE 0x001F
#define GREEN 0x07E0
#define CYAN 0x07FF
#define RED 0xF800
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
#define ORANGE 0xFD20
#define GREENYELLOW 0xAFE5
#define PINK 0xF81F
class M5StickCBoth {
public:
void begin(bool LCDEnable = true, bool PowerEnable = true, bool SerialEnable = true) {
if (SerialEnable) {
Serial.begin(115200);
Serial.flush();
delay(50);
Serial.print("M5StickC initializing...");
}
if (PowerEnable) {
Axp.begin();
}
if (LCDEnable) {
Lcd.begin();
}
if (SerialEnable) {
Serial.println("OK");
}
Rtc.begin();
}
void update() {
BtnA.read();
BtnB.read();
}
TFT_eSPI Lcd;
AXP192 Axp = AXP192();
const int DEBOUNCE_MS = 10;
Button BtnA = Button(BUTTON_A_PIN, true, DEBOUNCE_MS);
Button BtnB = Button(BUTTON_B_PIN, true, DEBOUNCE_MS);
RTC Rtc;
IMU Imu;
CommUtil I2C = CommUtil();
MPU6886 Mpu6886;
SH200Q Sh200Q;
};
static M5StickCBoth M5;
void setup() {
M5.begin();
}
void loop() {
M5.Lcd.fillScreen(WHITE);
delay(1000);
M5.Lcd.fillScreen(BLACK);
delay(1000);
}
No one still commented. Please first comment.