13
13
* @brief Header for M5Stack.cpp module
14
14
*
15
15
* \par Description
16
- * This file is a drive for M5Stack core .
16
+ * This file is a driver for M5Stack Core/Basic/Gray .
17
17
*
18
18
* \par Method List:
19
19
*
37
37
LCD:
38
38
M5.lcd.setBrightness(uint8_t brightness);
39
39
M5.Lcd.drawPixel(int16_t x, int16_t y, uint16_t color);
40
- M5.Lcd.drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t
41
- color); M5.Lcd.fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t
42
- color); M5.Lcd.fillScreen(uint16_t color); M5.Lcd.drawCircle(int16_t x0,
43
- int16_t y0, int16_t r, uint16_t color); M5.Lcd.drawCircleHelper(int16_t x0,
44
- int16_t y0, int16_t r, uint8_t cornername,uint16_t color);
40
+ M5.Lcd.drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color);
41
+ M5.Lcd.fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
42
+ M5.Lcd.fillScreen(uint16_t color); M5.Lcd.drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color);
43
+ M5.Lcd.drawCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername,uint16_t color);
45
44
M5.Lcd.fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color);
46
- M5.Lcd.fillCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t
47
- cornername,int16_t delta, uint16_t color); M5.Lcd.drawTriangle(int16_t x0,
48
- int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color);
49
- M5.Lcd.fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
50
- int16_t x2, int16_t y2, uint16_t color); M5.Lcd.drawRoundRect(int16_t x0,
51
- int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color);
52
- M5.Lcd.fillRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h,
53
- int16_t radius, uint16_t color); M5.Lcd.drawBitmap(int16_t x, int16_t y, const
54
- uint8_t bitmap[], int16_t w, int16_t h, uint16_t color);
55
- M5.Lcd.drawRGBBitmap(int16_t x, int16_t y, const uint16_t bitmap[],
56
- int16_t w, int16_t h), M5.Lcd.drawChar(uint16_t x, uint16_t y, char c, uint16_t
57
- color, uint16_t bg, uint8_t size); M5.Lcd.setCursor(uint16_t x0, uint16_t y0);
45
+ M5.Lcd.fillCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername,int16_t delta, uint16_t color);
46
+ M5.Lcd.drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color);
47
+ M5.Lcd.fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color);
48
+ M5.Lcd.drawRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color);
49
+ M5.Lcd.fillRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color);
50
+ M5.Lcd.drawBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h, uint16_t color);
51
+ M5.Lcd.drawRGBBitmap(int16_t x, int16_t y, const uint16_t bitmap[], int16_t w, int16_t h),
52
+ M5.Lcd.drawChar(uint16_t x, uint16_t y, char c, uint16_t color, uint16_t bg, uint8_t size);
53
+ M5.Lcd.setCursor(uint16_t x0, uint16_t y0);
58
54
M5.Lcd.setTextColor(uint16_t color);
59
55
M5.Lcd.setTextColor(uint16_t color, uint16_t backgroundcolor);
60
56
M5.Lcd.setTextSize(uint8_t size);
64
60
M5.Lcd.println();
65
61
M5.Lcd.drawCentreString(const char *string, int dX, int poY, int font);
66
62
M5.Lcd.drawRightString(const char *string, int dX, int poY, int font);
67
- M5.Lcd.drawJpg(const uint8_t *jpg_data, size_t jpg_len, uint16_t x,
68
- uint16_t y); M5.Lcd.drawJpgFile(fs::FS &fs, const char *path, uint16_t x,
69
- uint16_t y); M5.Lcd.drawBmpFile(fs::FS &fs, const char *path, uint16_t x,
70
- uint16_t y);
63
+ M5.Lcd.drawJpg(const uint8_t *jpg_data, size_t jpg_len, uint16_t x, uint16_t y);
64
+ M5.Lcd.drawJpgFile(fs::FS &fs, const char *path, uint16_t x, uint16_t y);
65
+ M5.Lcd.drawBmpFile(fs::FS &fs, const char *path, uint16_t x, uint16_t y);
71
66
72
67
Button:
73
- M5.BtnA/B/C.read();
68
+ M5.BtnA/B/C.read(); // Must be called in loop(), or via update()
74
69
M5.BtnA/B/C.isPressed();
75
70
M5.BtnA/B/C.isReleased();
76
71
M5.BtnA/B/C.wasPressed();
@@ -125,21 +120,30 @@ class M5Stack {
125
120
M5Stack ();
126
121
void begin (bool LCDEnable = true , bool SDEnable = true ,
127
122
bool SerialEnable = true , bool I2CEnable = false );
123
+
124
+ // Updates the status of hardware buttons, and ends any completed tone on the speaker.
125
+ // Recommended to be placed in loop()
128
126
void update ();
129
127
130
- // LCD
128
+ // LCD display, derived from TFT_eSPI. See examples
131
129
M5Display Lcd = M5Display();
132
130
133
- // Power
131
+ // Power and battery charge control. Call Power.begin() in setup().
134
132
POWER Power;
135
133
136
134
// Button API
137
135
#define DEBOUNCE_MS 10
136
+
137
+ // Hardware button A. Call read() before checking if isPressed()
138
138
Button BtnA = Button(BUTTON_A_PIN, true , DEBOUNCE_MS);
139
+
140
+ // Hardware button B. Call read() before checking if isPressed()
139
141
Button BtnB = Button(BUTTON_B_PIN, true , DEBOUNCE_MS);
142
+
143
+ // Hardware button C. Call read() before checking if isPressed()
140
144
Button BtnC = Button(BUTTON_C_PIN, true , DEBOUNCE_MS);
141
145
142
- // SPEAKER
146
+ // SPEAKER on DAC pin 25
143
147
SPEAKER Speaker;
144
148
145
149
// UART
@@ -154,7 +158,7 @@ class M5Stack {
154
158
SH200Q Sh200Q;
155
159
156
160
/* *
157
- * Function has been move to Power class. (for compatibility)
161
+ * Function has been moved to Power class (for compatibility)
158
162
* This name will be removed in a future release.
159
163
*/
160
164
void setPowerBoostKeepOn (bool en) __attribute__((deprecated));
0 commit comments