Skip to content

Commit 7a6105b

Browse files
committed
Code Format
1 parent f0b3224 commit 7a6105b

File tree

201 files changed

+35184
-33298
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

201 files changed

+35184
-33298
lines changed
Lines changed: 43 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,62 @@
11
/*
22
*******************************************************************************
3-
* Copyright (c) 2021 by M5Stack
3+
* Copyright (c) 2022 by M5Stack
44
* Equipped with M5Core sample source code
55
* 配套 M5Core 示例源代码
6-
* Visit the website for more information: https://docs.m5stack.com/en/core/gray
6+
* Visit for more information: https://docs.m5stack.com/en/core/gray
77
* 获取更多资料请访问: https://docs.m5stack.com/zh_CN/core/gray
88
*
9-
* describe: Display_Unicode. Unicode显示
10-
* date: 2021/7/23
9+
* Describe: Display_Unicode. Unicode显示
10+
* Date: 2021/7/23
1111
*******************************************************************************
1212
1313
-----PLEASE SEE THE README----
1414
------请在使用前看README文件----*/
1515
#define USE_M5_FONT_CREATOR
1616
#include <M5Stack.h>
17+
1718
#include "CUF_24px.h"
1819

19-
void setup()
20-
{
21-
M5.begin(); //Init M5Stack. 初始化M5Stack
22-
M5.Power.begin(); //Init power 初始化电源模块
23-
M5.Lcd.setFreeFont(&unicode_24px); //Set the GFX font to use. 设置要使用的GFX字体
24-
M5.Lcd.setTextDatum(TC_DATUM); //Set text alignment to center-up alignment. 设置文本对齐方式为居中向上对齐
20+
void setup() {
21+
M5.begin(); // Init M5Stack. 初始化M5Stack
22+
M5.Power.begin(); // Init power 初始化电源模块
23+
M5.Lcd.setFreeFont(
24+
&unicode_24px); // Set the GFX font to use. 设置要使用的GFX字体
25+
M5.Lcd.setTextDatum(TC_DATUM); // Set text alignment to center-up
26+
// alignment. 设置文本对齐方式为居中向上对齐
2527
}
2628

27-
void loop()
28-
{
29-
M5.Lcd.fillScreen(0);
30-
M5.Lcd.drawString("Hello world", 160, 60, 1); //Hello world is displayed in font 1 on (1600.60).
31-
M5.Lcd.drawString("你好 世界", 160, 90, 1); //在(160,60)处以字体1显示hello world
32-
M5.Lcd.drawString("Здравствуй мир", 160, 120, 1);
33-
M5.Lcd.drawString("こんにちは せかい", 160, 150, 1);
34-
delay(3000);
29+
void loop() {
30+
M5.Lcd.fillScreen(0);
31+
M5.Lcd.drawString("Hello world", 160, 60,
32+
1); // Hello world is displayed in font 1 on (1600.60).
33+
M5.Lcd.drawString("你好 世界", 160, 90,
34+
1); //在(160,60)处以字体1显示hello world
35+
M5.Lcd.drawString("Здравствуй мир", 160, 120, 1);
36+
M5.Lcd.drawString("こんにちは せかい", 160, 150, 1);
37+
delay(3000);
3538

36-
M5.Lcd.fillScreen(0); //Fill the screen with black (used to clear the screen) is equivalent to clear (). 使屏幕充满黑色(用来清屏)等同于clear()
37-
M5.Lcd.setCursor(0, 30); // Set the text cursor 0,30 position. 设置文本光标在(0,30)处
38-
M5.Lcd.printf("☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓☔☕☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♈♉♊♋♌♍♎♏♐♑♒♓♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚇⚈⚉⚊⚋⚌⚍⚎⚏⚐⚑⚒⚓⚔⚕⚖⚗⚘⚙⚚⚛⚜⚝⚞⚟A⚠⚡⚢⚣⚤⚥⚦⚧⚨⚩⚪⚫⚬⚭⚮⚯B⚰⚱⚲⚳⚴⚵⚶⚷⚸⚹⚺⚻⚼⚽⚾⚿C⛀⛁⛂⛃⛄⛅⛆⛇⛈⛉⛊⛋⛌⛍⛎⛏D⛐⛑⛒⛓⛔⛕⛖⛗⛘⛙⛚⛛⛜⛝⛞⛟E⛠⛡⛢");
39-
delay(3000);
39+
M5.Lcd.fillScreen(
40+
0); // Fill the screen with black (used to clear the screen) is
41+
// equivalent to clear (). 使屏幕充满黑色(用来清屏)等同于clear()
42+
M5.Lcd.setCursor(
43+
0, 30); // Set the text cursor 0,30 position. 设置文本光标在(0,30)处
44+
M5.Lcd.printf(
45+
"☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓☔☕☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♈♉♊♋♌♍"
46+
"♎♏♐♑♒♓♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚇⚈⚉⚊⚋⚌⚍⚎⚏⚐⚑⚒⚓"
47+
"⚔⚕⚖⚗⚘⚙⚚⚛⚜⚝⚞⚟A⚠⚡⚢⚣⚤⚥⚦⚧⚨⚩⚪⚫⚬⚭⚮⚯B⚰⚱⚲⚳⚴⚵⚶⚷⚸⚹⚺⚻⚼⚽⚾⚿C⛀⛁⛂⛃⛄⛅⛆⛇⛈⛉⛊⛋⛌⛍⛎⛏D⛐⛑⛒⛓⛔⛕"
48+
"⛖⛗⛘⛙⛚⛛⛜⛝⛞⛟E⛠⛡⛢");
49+
delay(3000);
4050

41-
M5.Lcd.fillScreen(0);
42-
M5.Lcd.setCursor(0, 30);
43-
M5.Lcd.printf("⛣⛤⛥⛦⛧⛨⛩⛪⛫⛬⛭⛮⛯F⛰⛱⛲⛳⛴⛵⛶⛷⛸⛹⛺⛻⛼⛽⛾⛿✀✁✂✃✄✅✆✇✈✉✊✋✌✍✎✏✐✑✒✓✔✕✖✗✘✙✚✛✜✝✞✟✠✡✢✣✤✥✦✧✨✩✪✫✬✭✮✯✰✱✲✳✴✵✶✷✸✹✺✻✼✽✾✿❀❁❂❃❄❅❆❇❈❉❊❋❌❍❎❏❐❑❒❓❔❕❖❗❘❙❚❛❜❝❞❟❠❡❢❣❤❥❦❧❨❩❪❫❬❭❮❯❰❱❲❳❴❵❶❷❸❹❺❻❼❽❾❿➀➁➂➃➄➅➆➇➈➉➊➋➌➍➎➏➐➑➒➓➔➕➖➗➘➙➚➛➜➝➞➟A➠➡➢➣➤➥➦➧➨➩➪➫➬➭➮➯B➰➱➲➳➴➵➶➷➸➹➺➻➼➽➾➿");
44-
delay(3000);
51+
M5.Lcd.fillScreen(0);
52+
M5.Lcd.setCursor(0, 30);
53+
M5.Lcd.printf(
54+
"⛣⛤⛥⛦⛧⛨⛩⛪⛫⛬⛭⛮⛯F⛰⛱⛲⛳⛴⛵⛶⛷⛸⛹⛺⛻⛼⛽⛾⛿✀✁✂✃✄✅✆✇✈✉✊✋✌✍✎✏✐✑✒✓✔✕✖✗✘✙✚✛✜✝✞✟✠✡✢"
55+
""
56+
""
57+
""
58+
"✦✧✨✩✪✫✬✭✮✯✰✱✲✳✴✵✶✷✸✹✺✻✼✽✾✿❀❁❂❃❄❅❆❇❈❉❊❋❌❍❎❏❐❑❒❓❔❕❖❗❘❙❚❛❜❝❞❟❠❡❢❣❤❥❦❧❨❩❪❫"
59+
"❬❭❮❯❰❱❲❳❴❵❶❷❸❹❺❻❼❽❾❿➀➁➂➃➄➅➆➇➈➉➊➋➌➍➎➏➐➑➒➓➔➕➖➗➘➙➚➛➜➝➞➟A➠➡➢➣➤➥➦➧➨➩➪➫➬➭➮➯B"
60+
"➰➱➲➳➴➵➶➷➸➹➺➻➼➽➾➿");
61+
delay(3000);
4562
}
Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,62 @@
11
/*
22
*******************************************************************************
3-
* Copyright (c) 2021 by M5Stack
3+
* Copyright (c) 2022 by M5Stack
44
* Equipped with M5Core sample source code
55
* 配套 M5Core 示例源代码
6-
* Visit the website for more information: https://docs.m5stack.com/en/core/gray
6+
* Visit for more information: https://docs.m5stack.com/en/core/gray
77
* 获取更多资料请访问: https://docs.m5stack.com/zh_CN/core/gray
88
*
9-
* describe: Character library. 字库
10-
* date: 2021/7/28
9+
* Describe: Character library. 字库
10+
* Date: 2021/7/28
1111
*******************************************************************************
1212
1313
-----PLEASE SEE THE README----
1414
------请在使用前看README文件----*/
1515

1616
#include <M5Stack.h>
17+
1718
#include "display_ch.h"
1819
#include "str.h"
1920

2021
DisplayCh displaych;
2122
void setup() {
22-
M5.begin(); //Init M5Stack. 初始化M5Stack
23-
M5.Power.begin(); //Init power 初始化电源模块
24-
displaych.loadHzk16(); //Load the Chinese character library (be sure to load before using the Chinese character library). 加载汉字库(务必在使用汉字库前加载)
25-
displaych.setTextColor(WHITE, BLACK); //Set the text color to white and the text background color to black (mandatory). 设置文字颜色为白色,文字背景颜色为黑色(必加)
26-
// Set text with red highlight color
27-
displaych.setHighlightColor(RED); //Set the text highlight color to red. 设置文字高亮颜色为红色
28-
displaych.setTextSize(1); //Set text size to 1. 设置字号大小为1 Set text size to 1(必加)
23+
M5.begin(); // Init M5Stack. 初始化M5Stack
24+
M5.Power.begin(); // Init power 初始化电源模块
25+
displaych.loadHzk16(); // Load the Chinese character library (be sure to
26+
// load before using the Chinese character library).
27+
// 加载汉字库(务必在使用汉字库前加载)
28+
displaych.setTextColor(
29+
WHITE, BLACK); // Set the text color to white and the text background
30+
// color to black (mandatory).
31+
// 设置文字颜色为白色,文字背景颜色为黑色(必加)
32+
// Set text with red highlight color
33+
displaych.setHighlightColor(
34+
RED); // Set the text highlight color to red. 设置文字高亮颜色为红色
35+
displaych.setTextSize(
36+
1); // Set text size to 1. 设置字号大小为1 Set text size to 1(必加)
2937
}
3038

3139
void loop() {
32-
displaych.setCursor(0,0,1); //Set the cursor at (0,0) and the size to 1(mandatory). 将光标设置在(0,0)处,并设置字号为1(必加)
33-
displaych.writeHzk(AscStr); //Display the contents of AscStr here (which can be changed in str.h). 在此处显示AscStr中的内容(可在str.h中更改)
34-
delay(1000); //delay 1000ms. 延迟1000ms
35-
displaych.setCursor(0,45);
36-
displaych.writeHzk(GbkStr); //Display the contents of GbkStr here (which can be changed in str.h). 在此处显示GbkStr中的内容(可在str.h中更改)
37-
delay(1000);
38-
//Highlight the text. 高亮显示文本
39-
displaych.highlight(true); //Turn on highlight. 开启高亮显示
40-
displaych.setCursor(0,65);
41-
displaych.writeHzk(GbkStr);
42-
delay(1000);
43-
displaych.fillScreen(BLACK); //Fill the screen with black color, equivalent to empty the screen. 填充屏幕颜色为黑色,等效于清空屏幕
44-
displaych.highlight(false); //Turn off highlight. 关闭高亮显示
45-
delay(500);
40+
displaych.setCursor(
41+
0, 0, 1); // Set the cursor at (0,0) and the size to 1(mandatory).
42+
// 将光标设置在(0,0)处,并设置字号为1(必加)
43+
displaych.writeHzk(
44+
AscStr); // Display the contents of AscStr here (which can be changed
45+
// in str.h). 在此处显示AscStr中的内容(可在str.h中更改)
46+
delay(1000); // delay 1000ms. 延迟1000ms
47+
displaych.setCursor(0, 45);
48+
displaych.writeHzk(
49+
GbkStr); // Display the contents of GbkStr here (which can be changed
50+
// in str.h). 在此处显示GbkStr中的内容(可在str.h中更改)
51+
delay(1000);
52+
// Highlight the text. 高亮显示文本
53+
displaych.highlight(true); // Turn on highlight. 开启高亮显示
54+
displaych.setCursor(0, 65);
55+
displaych.writeHzk(GbkStr);
56+
delay(1000);
57+
displaych.fillScreen(
58+
BLACK); // Fill the screen with black color, equivalent to empty the
59+
// screen. 填充屏幕颜色为黑色,等效于清空屏幕
60+
displaych.highlight(false); // Turn off highlight. 关闭高亮显示
61+
delay(500);
4662
}

examples/Advanced/Display/TFT_Ellipse/TFT_Ellipse.ino

Lines changed: 39 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,54 @@
11
/*
22
*******************************************************************************
3-
* Copyright (c) 2021 by M5Stack
3+
* Copyright (c) 2022 by M5Stack
44
* Equipped with M5Core sample source code
55
* 配套 M5Core 示例源代码
6-
* Visit the website for more information: https://docs.m5stack.com/en/core/gray
6+
* Visit for more information: https://docs.m5stack.com/en/core/gray
77
* 获取更多资料请访问: https://docs.m5stack.com/zh_CN/core/gray
88
*
9-
* describe: Ellipse drawing. 椭圆绘制
10-
* date: 2021/7/26
9+
* Describe: Ellipse drawing. 椭圆绘制
10+
* Date: 2021/7/26
1111
*******************************************************************************/
1212

1313
#include <M5Stack.h>
1414

1515
void setup(void) {
16-
M5.begin(); //Init M5Stack. 初始化M5Stack
17-
M5.Power.begin(); //Init power 初始化电源模块
16+
M5.begin(); // Init M5Stack. 初始化M5Stack
17+
M5.Power.begin(); // Init power 初始化电源模块
1818
}
1919

2020
void loop() {
21-
// Draw some random ellipses. 绘制一些随机形状的椭圆
22-
for (int i = 0; i < 40; i++)
23-
{
24-
int rx = random(60);
25-
int ry = random(60);
26-
int x = rx + random(320 - rx - rx);
27-
int y = ry + random(240 - ry - ry);
28-
M5.Lcd.fillEllipse(x, y, rx, ry, random(0xFFFF)); //At (x, y), draw a filled ellipse with random width and height of rx, ry with random color random (0xFFFF). 在(x,y)处以随机颜色random(0xFFFF),绘制一个随机宽高为rx,ry的填充椭圆
29-
}
30-
31-
delay(2000);
32-
M5.Lcd.clear(); //清空屏幕
33-
34-
for (int i = 0; i < 40; i++)
35-
{
36-
int rx = random(60);
37-
int ry = random(60);
38-
int x = rx + random(320 - rx - rx);
39-
int y = ry + random(240 - ry - ry);
40-
M5.Lcd.drawEllipse(x, y, rx, ry, random(0xFFFF));//At (x, y), draw an elliptical wire frame with a random width and height of rx, ry in a random color (0xFFFF). 在(x,y)处以随机颜色random(0xFFFF),绘制一个随机宽高为rx,ry的椭圆线框
41-
}
42-
43-
delay(2000);
21+
// Draw some random ellipses. 绘制一些随机形状的椭圆
22+
for (int i = 0; i < 40; i++) {
23+
int rx = random(60);
24+
int ry = random(60);
25+
int x = rx + random(320 - rx - rx);
26+
int y = ry + random(240 - ry - ry);
27+
M5.Lcd.fillEllipse(
28+
x, y, rx, ry,
29+
random(
30+
0xFFFF)); // At (x, y), draw a filled ellipse with random width
31+
// and height of rx, ry with random color random
32+
// (0xFFFF).
33+
// 在(x,y)处以随机颜色random(0xFFFF),绘制一个随机宽高为rx,ry的填充椭圆
34+
}
35+
36+
delay(2000);
37+
M5.Lcd.clear(); //清空屏幕
38+
39+
for (int i = 0; i < 40; i++) {
40+
int rx = random(60);
41+
int ry = random(60);
42+
int x = rx + random(320 - rx - rx);
43+
int y = ry + random(240 - ry - ry);
44+
M5.Lcd.drawEllipse(
45+
x, y, rx, ry,
46+
random(
47+
0xFFFF)); // At (x, y), draw an elliptical wire frame with a
48+
// random width and height of rx, ry in a random
49+
// color (0xFFFF).
50+
// 在(x,y)处以随机颜色random(0xFFFF),绘制一个随机宽高为rx,ry的椭圆线框
51+
}
52+
53+
delay(2000);
4454
}
45-
46-
47-

0 commit comments

Comments
 (0)