Skip to content

Commit 6aa8c09

Browse files
authored
Update M5Stack.h
Add/changed comments only
1 parent 2d56119 commit 6aa8c09

File tree

1 file changed

+31
-27
lines changed

1 file changed

+31
-27
lines changed

src/M5Stack.h

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* @brief Header for M5Stack.cpp module
1414
*
1515
* \par Description
16-
* This file is a drive for M5Stack core.
16+
* This file is a driver for M5Stack Core/Basic/Gray.
1717
*
1818
* \par Method List:
1919
*
@@ -37,24 +37,20 @@
3737
LCD:
3838
M5.lcd.setBrightness(uint8_t brightness);
3939
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);
4544
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);
5854
M5.Lcd.setTextColor(uint16_t color);
5955
M5.Lcd.setTextColor(uint16_t color, uint16_t backgroundcolor);
6056
M5.Lcd.setTextSize(uint8_t size);
@@ -64,13 +60,12 @@
6460
M5.Lcd.println();
6561
M5.Lcd.drawCentreString(const char *string, int dX, int poY, int font);
6662
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);
7166
7267
Button:
73-
M5.BtnA/B/C.read();
68+
M5.BtnA/B/C.read(); // Must be called in loop(), or via update()
7469
M5.BtnA/B/C.isPressed();
7570
M5.BtnA/B/C.isReleased();
7671
M5.BtnA/B/C.wasPressed();
@@ -125,21 +120,30 @@ class M5Stack {
125120
M5Stack();
126121
void begin(bool LCDEnable = true, bool SDEnable = true,
127122
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()
128126
void update();
129127

130-
// LCD
128+
// LCD display, derived from TFT_eSPI. See examples
131129
M5Display Lcd = M5Display();
132130

133-
// Power
131+
// Power and battery charge control. Call Power.begin() in setup().
134132
POWER Power;
135133

136134
// Button API
137135
#define DEBOUNCE_MS 10
136+
137+
// Hardware button A. Call read() before checking if isPressed()
138138
Button BtnA = Button(BUTTON_A_PIN, true, DEBOUNCE_MS);
139+
140+
// Hardware button B. Call read() before checking if isPressed()
139141
Button BtnB = Button(BUTTON_B_PIN, true, DEBOUNCE_MS);
142+
143+
// Hardware button C. Call read() before checking if isPressed()
140144
Button BtnC = Button(BUTTON_C_PIN, true, DEBOUNCE_MS);
141145

142-
// SPEAKER
146+
// SPEAKER on DAC pin 25
143147
SPEAKER Speaker;
144148

145149
// UART
@@ -154,7 +158,7 @@ class M5Stack {
154158
SH200Q Sh200Q;
155159

156160
/**
157-
* Function has been move to Power class.(for compatibility)
161+
* Function has been moved to Power class (for compatibility)
158162
* This name will be removed in a future release.
159163
*/
160164
void setPowerBoostKeepOn(bool en) __attribute__((deprecated));

0 commit comments

Comments
 (0)