mirror of
https://github.com/m5stack/m5-docs.git
synced 2026-05-20 10:23:01 -07:00
add ZH-CN api
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
**Description:**
|
||||
|
||||
Load <EEPROM.h> before use
|
||||
|
||||
Open EEPROM,Size is the maximum address + 1 of the data bytes to be read and written, ranging from 1 to 4096.
|
||||
|
||||
**Function argument**
|
||||
@@ -24,6 +25,7 @@ Open EEPROM,Size is the maximum address + 1 of the data bytes to be read and wri
|
||||
**Description:**
|
||||
|
||||
Load <EEPROM.h> before use
|
||||
|
||||
Write data to storage space.
|
||||
|
||||
**Function argument**
|
||||
@@ -42,6 +44,7 @@ Write data to storage space.
|
||||
**Description:**
|
||||
|
||||
Load <EEPROM.h> before use
|
||||
|
||||
This function needs to be called every time an address is written.
|
||||
|
||||
**Function argument**
|
||||
@@ -57,6 +60,7 @@ None
|
||||
**Description:**
|
||||
|
||||
Load <EEPROM.h> before use
|
||||
|
||||
Reading data from storage space.
|
||||
|
||||
**Function argument**
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
**Description:**
|
||||
|
||||
Load <Ticker.h> before use
|
||||
|
||||
Execute a command in seconds, which is executed only once.
|
||||
|
||||
**Function argument**
|
||||
@@ -25,6 +26,7 @@ Execute a command in seconds, which is executed only once.
|
||||
**Description:**
|
||||
|
||||
Load <Ticker.h> before use
|
||||
|
||||
Execute a command in milliseconds, which is executed only once.
|
||||
|
||||
**Function argument**
|
||||
@@ -43,6 +45,7 @@ Execute a command in milliseconds, which is executed only once.
|
||||
**Description:**
|
||||
|
||||
Load <Ticker.h> before use
|
||||
|
||||
Execute commands with parameters after every seconds.
|
||||
|
||||
**Function argument**
|
||||
@@ -62,6 +65,7 @@ Execute commands with parameters after every seconds.
|
||||
**Description:**
|
||||
|
||||
Load <Ticker.h> before use
|
||||
|
||||
Execute commands with parameters after every milliseconds.
|
||||
|
||||
**Function argument**
|
||||
@@ -81,6 +85,7 @@ Execute commands with parameters after every milliseconds.
|
||||
**Description:**
|
||||
|
||||
Load <Ticker.h> before use
|
||||
|
||||
Execute the command after every second with no parameters.
|
||||
|
||||
**Function argument**
|
||||
@@ -99,13 +104,14 @@ Execute the command after every second with no parameters.
|
||||
**Description:**
|
||||
|
||||
Load <Ticker.h> before use
|
||||
|
||||
Execute the command after every milliseconds with no parameters.
|
||||
|
||||
**Function argument**
|
||||
|
||||
| Function argument |Type |Description |
|
||||
| --- | --- | --- |
|
||||
| seconds | float | Set time |
|
||||
| milliseconds | float | Set time |
|
||||
| callback | callback_t | Custom callback function |
|
||||
|
||||
## Usage {docsify-ignore}
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
## once()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>void once(float seconds, callback_t callback)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
使用前加载<Ticker.h>
|
||||
|
||||
在设定的时间点(s)只执行一次回调函数.
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| seconds | float | 设置秒 |
|
||||
| callback | callback_t | 回调函数 |
|
||||
|
||||
## once_ms()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>void once_ms(uint32_t milliseconds, callback_t callback)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
使用前加载<Ticker.h>
|
||||
|
||||
在设定的时间点(ms)回调函数只运行一次.
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| milliseconds | float | 毫秒 |
|
||||
| callback | callback_t | 回调函数 |
|
||||
|
||||
## attach()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>void attach(float seconds, void (*callback)(TArg), TArg arg)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
使用前加载 <Ticker.h>
|
||||
|
||||
每隔一段时间(s)执行一次带参数的回调函数.
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 参数 |类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| seconds | float | 秒 |
|
||||
| *callback | callback_t | 带参数回调函数 |
|
||||
| TArg | arg | 函数参数 |
|
||||
|
||||
## attach_ms()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>void attach_ms(uint32_t milliseconds, void (*callback)(TArg), TArg arg)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
使用前加载 <Ticker.h>
|
||||
|
||||
每隔一段时间(ms)执行一次带参数的回调函数
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| milliseconds | float | 毫秒 |
|
||||
| *callback | callback_t | 带参数回调函数 |
|
||||
| TArg | arg | 参数 |
|
||||
|
||||
## attach()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>void attach(float seconds, callback_t callback)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
使用前加载 <Ticker.h>
|
||||
|
||||
每隔一定时间(s)执行一次回调函数
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| seconds | float | 秒 |
|
||||
| callback | callback_t | 回调函数 |
|
||||
|
||||
## attach_ms()
|
||||
|
||||
**函数原型:**
|
||||
|
||||
<mark>void attach_ms(uint32_t milliseconds, callback_t callback)</mark>
|
||||
|
||||
**功能:**
|
||||
|
||||
使用前加载 <Ticker.h>
|
||||
|
||||
每隔一定时间(ms)执行一次回调函数
|
||||
|
||||
**函数参数**
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
| --- | --- | --- |
|
||||
| milliseconds | float | 毫秒 |
|
||||
| callback | callback_t | 回调函数 |
|
||||
|
||||
## Usage {docsify-ignore}
|
||||
|
||||
```arduino
|
||||
#include <M5Stack.h>
|
||||
#include <Ticker.h>
|
||||
|
||||
Ticker tickerSetHigh;
|
||||
Ticker tickerSetLow;
|
||||
|
||||
void display(int number) {
|
||||
M5.Lcd.setCursor(0, 0);
|
||||
M5.Lcd.print(number);
|
||||
}
|
||||
void setup() {
|
||||
M5.begin();
|
||||
tickerSetLow.attach_ms(1000, display, 0);
|
||||
tickerSetHigh.attach_ms(2000, display, 1);
|
||||
}
|
||||
void loop() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
```
|
||||
Reference in New Issue
Block a user