diff --git a/docs/en/api/system.md b/docs/en/api/system.md index 487c7967..d7881e83 100644 --- a/docs/en/api/system.md +++ b/docs/en/api/system.md @@ -1,120 +1,132 @@ -# 系统函数 +# System -## begin() +## begin() -**函数原型:** +**Syntax:** -void begin(bool LCDEnable=true, bool SDEnable=true, bool SerialEnable=true); +```arudino +void begin(bool LCDEnable=true, bool SDEnable=true, bool SerialEnable=true); +``` - +**Description:** -**功能:清串口缓冲区,设置串口波特率为 115200;初始化 LCD;初始化 SD 卡;设置按键 A 是睡眠唤醒按键。** +This function sets enable/disable LCD, TF Card and Serial port. + +**Definition:** -**函数实现** ```arduino void M5Stack::begin(bool LCDEnable, bool SDEnable, bool SerialEnable) { - if (isInited) return; - else isInited = true; - if (SerialEnable) { - Serial.begin(115200); - Serial.flush(); - delay(50); - Serial.print("M5Stack initializing..."); - } - if (LCDEnable) { - Lcd.begin(); - } - if (SDEnable) { - SD.begin(TFCARD_CS_PIN, SPI, 40000000); - } - setWakeupButton(BUTTON_A_PIN); + if (isInited) return; + else isInited = true; + if (SerialEnable) { + Serial.begin(115200); + Serial.flush(); + delay(50); + Serial.print("M5Stack initializing..."); + } + if (LCDEnable) { + Lcd.begin(); + } + if (SDEnable) { + SD.begin(TFCARD_CS_PIN, SPI, 40000000); + } + setWakeupButton(BUTTON_A_PIN); } ``` -**例程** +**Sample:** + ```arduino #include -void setup(){ - M5.begin(); +void setup() { + M5.begin(); } ``` -## update() +## update() -**函数原型:** +**Syntax:** -void update(); +```arduino +void update(); +``` - +**Description:** -**功能:读取按键 A, B, C 的状态。** +This function reads The State of Button A and B and C. + +**Definition:** -**函数实现** ```arduino void M5Stack::update() { - //Button update - BtnA.read(); - BtnB.read(); - BtnC.read(); + //Button update + BtnA.read(); + BtnB.read(); + BtnC.read(); - //Speaker update - Speaker.update(); + //Speaker update + Speaker.update(); } ``` -**例程** +**Sample:** + ```arduino #include -void setup(){ - M5.begin(); +void setup() { + M5.begin(); } -void loop(){ - M5.update(); +void loop() { + M5.update(); } ``` -## powerOFF() +## powerOFF() -**函数原型:** +**Syntax:** -void powerOFF(); +```arduino +void powerOFF(); +``` - +**Description:** -**功能:系统进入深度睡眠状态。** +This function turns off the power of M5. + +**Definition:** -**函数实现** ```arduino void M5Stack::powerOFF() { - #ifdef M5STACK_FIRE - // Keep power keep boost on - setPowerBoostKeepOn(true); - #endif +#ifdef M5STACK_FIRE + // Keep power keep boost on + setPowerBoostKeepOn(true); +#endif - // power off the Lcd - Lcd.setBrightness(0); - Lcd.sleep(); + // power off the Lcd + Lcd.setBrightness(0); + Lcd.sleep(); - // ESP32 into deep sleep - esp_sleep_enable_ext0_wakeup((gpio_num_t)_wakeupPin , LOW); + // ESP32 into deep sleep + esp_sleep_enable_ext0_wakeup((gpio_num_t)_wakeupPin , LOW); - while(digitalRead(_wakeupPin) == LOW) { - delay(10); - } - esp_deep_sleep_start(); + while (digitalRead(_wakeupPin) == LOW) { + delay(10); + } + esp_deep_sleep_start(); } ``` -**例程** +**Sample:** + ```arduino #include -void setup(){ +void setup() { M5.begin(); M5.Lcd.println("This is software power off demo"); M5.Lcd.println("Press the button A to power off."); @@ -122,9 +134,9 @@ void setup(){ } void loop() { - if(M5.BtnA.wasPressed()) { + M5.update(); + if (M5.BtnA.wasPressed()) { M5.powerOFF(); } - M5.update(); } ``` \ No newline at end of file diff --git a/docs/ja/api/system.md b/docs/ja/api/system.md index 487c7967..8a7c4356 100644 --- a/docs/ja/api/system.md +++ b/docs/ja/api/system.md @@ -1,120 +1,132 @@ -# 系统函数 +# システム -## begin() +## begin() -**函数原型:** +**説明:** -void begin(bool LCDEnable=true, bool SDEnable=true, bool SerialEnable=true); +LCD、TFカード、シリアルポートの有効化/無効化を設定します。 - +**構文:** -**功能:清串口缓冲区,设置串口波特率为 115200;初始化 LCD;初始化 SD 卡;设置按键 A 是睡眠唤醒按键。** +```arudino +void begin(bool LCDEnable=true, bool SDEnable=true, bool SerialEnable=true); +``` + +**定義:** -**函数实现** ```arduino void M5Stack::begin(bool LCDEnable, bool SDEnable, bool SerialEnable) { - if (isInited) return; - else isInited = true; - if (SerialEnable) { - Serial.begin(115200); - Serial.flush(); - delay(50); - Serial.print("M5Stack initializing..."); - } - if (LCDEnable) { - Lcd.begin(); - } - if (SDEnable) { - SD.begin(TFCARD_CS_PIN, SPI, 40000000); - } - setWakeupButton(BUTTON_A_PIN); + if (isInited) return; + else isInited = true; + if (SerialEnable) { + Serial.begin(115200); + Serial.flush(); + delay(50); + Serial.print("M5Stack initializing..."); + } + if (LCDEnable) { + Lcd.begin(); + } + if (SDEnable) { + SD.begin(TFCARD_CS_PIN, SPI, 40000000); + } + setWakeupButton(BUTTON_A_PIN); } ``` -**例程** +**使用例:** + ```arduino #include -void setup(){ - M5.begin(); +void setup() { + M5.begin(); } ``` -## update() +## update() -**函数原型:** +**説明:** -void update(); + ボタン A / B / C の読み取り状態を更新します。 - +**構文:** -**功能:读取按键 A, B, C 的状态。** +```arduino +void update(); +``` + +**定義:** -**函数实现** ```arduino void M5Stack::update() { - //Button update - BtnA.read(); - BtnB.read(); - BtnC.read(); + //ボタンアップデート + BtnA.read(); + BtnB.read(); + BtnC.read(); - //Speaker update - Speaker.update(); + //スピーカーアップデート + Speaker.update(); } ``` -**例程** +**使用例:** + ```arduino #include -void setup(){ - M5.begin(); +void setup() { + M5.begin(); } -void loop(){ - M5.update(); +void loop() { + M5.update(); } ``` -## powerOFF() +## powerOFF() -**函数原型:** +**構文:** -void powerOFF(); +**説明:** - +M5の電源をオフします。 -**功能:系统进入深度睡眠状态。** +```arduino +void powerOFF(); +``` + +**定義:** -**函数实现** ```arduino void M5Stack::powerOFF() { - #ifdef M5STACK_FIRE - // Keep power keep boost on - setPowerBoostKeepOn(true); - #endif +#ifdef M5STACK_FIRE + // 電源ブーストオン + setPowerBoostKeepOn(true); +#endif - // power off the Lcd - Lcd.setBrightness(0); - Lcd.sleep(); + // 画面オフ + Lcd.setBrightness(0); + Lcd.sleep(); - // ESP32 into deep sleep - esp_sleep_enable_ext0_wakeup((gpio_num_t)_wakeupPin , LOW); + // ESP32をディープスリープモードへ移行 + esp_sleep_enable_ext0_wakeup((gpio_num_t)_wakeupPin , LOW); - while(digitalRead(_wakeupPin) == LOW) { - delay(10); - } - esp_deep_sleep_start(); + while (digitalRead(_wakeupPin) == LOW) { + delay(10); + } + esp_deep_sleep_start(); } ``` -**例程** +**使用例:** + ```arduino #include -void setup(){ +void setup() { M5.begin(); M5.Lcd.println("This is software power off demo"); M5.Lcd.println("Press the button A to power off."); @@ -122,9 +134,9 @@ void setup(){ } void loop() { - if(M5.BtnA.wasPressed()) { + M5.update(); + if (M5.BtnA.wasPressed()) { M5.powerOFF(); } - M5.update(); } ``` \ No newline at end of file diff --git a/docs/zh_CN/api/system.md b/docs/zh_CN/api/system.md index 487c7967..d3f1547c 100644 --- a/docs/zh_CN/api/system.md +++ b/docs/zh_CN/api/system.md @@ -13,21 +13,21 @@ **函数实现** ```arduino void M5Stack::begin(bool LCDEnable, bool SDEnable, bool SerialEnable) { - if (isInited) return; - else isInited = true; - if (SerialEnable) { - Serial.begin(115200); - Serial.flush(); - delay(50); - Serial.print("M5Stack initializing..."); - } - if (LCDEnable) { - Lcd.begin(); - } - if (SDEnable) { - SD.begin(TFCARD_CS_PIN, SPI, 40000000); - } - setWakeupButton(BUTTON_A_PIN); + if (isInited) return; + else isInited = true; + if (SerialEnable) { + Serial.begin(115200); + Serial.flush(); + delay(50); + Serial.print("M5Stack initializing..."); + } + if (LCDEnable) { + Lcd.begin(); + } + if (SDEnable) { + SD.begin(TFCARD_CS_PIN, SPI, 40000000); + } + setWakeupButton(BUTTON_A_PIN); } ``` @@ -35,8 +35,8 @@ void M5Stack::begin(bool LCDEnable, bool SDEnable, bool SerialEnable) { ```arduino #include -void setup(){ - M5.begin(); +void setup() { + M5.begin(); } ``` @@ -54,13 +54,13 @@ void setup(){ ```arduino void M5Stack::update() { - //Button update - BtnA.read(); - BtnB.read(); - BtnC.read(); + //Button update + BtnA.read(); + BtnB.read(); + BtnC.read(); - //Speaker update - Speaker.update(); + //Speaker update + Speaker.update(); } ``` @@ -68,12 +68,12 @@ void M5Stack::update() { ```arduino #include -void setup(){ - M5.begin(); +void setup() { + M5.begin(); } -void loop(){ - M5.update(); +void loop() { + M5.update(); } ``` @@ -91,22 +91,22 @@ void loop(){ ```arduino void M5Stack::powerOFF() { - #ifdef M5STACK_FIRE - // Keep power keep boost on - setPowerBoostKeepOn(true); - #endif +#ifdef M5STACK_FIRE + // Keep power keep boost on + setPowerBoostKeepOn(true); +#endif - // power off the Lcd - Lcd.setBrightness(0); - Lcd.sleep(); + // power off the Lcd + Lcd.setBrightness(0); + Lcd.sleep(); - // ESP32 into deep sleep - esp_sleep_enable_ext0_wakeup((gpio_num_t)_wakeupPin , LOW); + // ESP32 into deep sleep + esp_sleep_enable_ext0_wakeup((gpio_num_t)_wakeupPin , LOW); - while(digitalRead(_wakeupPin) == LOW) { - delay(10); - } - esp_deep_sleep_start(); + while (digitalRead(_wakeupPin) == LOW) { + delay(10); + } + esp_deep_sleep_start(); } ``` @@ -114,7 +114,7 @@ void M5Stack::powerOFF() { ```arduino #include -void setup(){ +void setup() { M5.begin(); M5.Lcd.println("This is software power off demo"); M5.Lcd.println("Press the button A to power off."); @@ -122,9 +122,9 @@ void setup(){ } void loop() { - if(M5.BtnA.wasPressed()) { + M5.update(); + if (M5.BtnA.wasPressed()) { M5.powerOFF(); } - M5.update(); } ``` \ No newline at end of file