diff --git a/en-us/api/QuecPythonClasslib.md b/en-us/api/QuecPythonClasslib.md index b433654..e0e5ae5 100644 --- a/en-us/api/QuecPythonClasslib.md +++ b/en-us/api/QuecPythonClasslib.md @@ -5935,41 +5935,10 @@ It sets and gets RTC time. When there is no parameter, it gets the time, it sets (2020, 3, 12, 4, 12, 12, 14, 0) ``` -###### Set callback function - -> **rtc.register_callback(usrFun)** - -When RTC expiration time callback function is set (for BC25PA platform, if it is recovered from deep sleep or software shutdown, calling this function will immediately call usrfun once) - -* Parameter - -| Parameter | Type | Description | -| ------ | -------- | ------------------------------------------ | -| usrFun | function | Callback function, which is called when the set RTC time arrives. | - -* Note - - * usrFun requires parameters - -* Return Value - - * 0 Successful execution. - * -1 Failed execution. - -* Example - -```python ->>> def test(df): -... print('rtc test...',df) -... -... -... ->>> ->>> rtc.register_callback(test) -0 -``` ###### Set RTC expiration time +Support platform ec600u/ec200u/ec600n/ec800n/bc25 + rtc.set_alarm(data_e) Set the RTC expiration time. When the expiration time is reached, the registered callback function will be called @@ -6001,61 +5970,12 @@ Set the RTC expiration time. When the expiration time is reached, the registered >>> rtc.set_alarm(data_e) 0 ``` -###### Start / stop RTC timer - -rtc.enable_alarm(on_off) - -The timer can be started only when the callback function is set (bc25pa platform) - -* Parameter - -| Parameter | Type | Description | -| ----------- | ---- | ------------------------------------------------------------ | -| on_off | int | 0 - Turn off RTC timer. 1 - Start RTC timer. | - -* Return Value - - * 0 Successful execution. - * -1 Failed execution. - -* Example -```python ->>> rtc.enable_alarm(1) -0 -``` - - - -###### Set RTC alarm time - -Support platform ec600u/ec200u/ec600n/ec800n/bc25 - -> rtc.set_alarm([year, month, day, week, hour, minute, second, microsecond]) - -Set the RTC alarm time. The parameter week is not involved in the setting. The microsecond parameter is reserved and not used yet. The default is 0. - -* Parameter - -|Parameter | type | description| -| ----------- | ---- | ------------------------------------- | -|Year | int || -|Month | int | month, range 1 ~ 12| -|Day | int | day, range 1 ~ 31| -|Week | int | week, range 0 ~ 6, this parameter does not work, reserved| -|When hour | int | the range is 0 ~ 23| -|Minute | int | min, range 0 ~ 59| -|Second | int | second, range 0 ~ 59| -|Microsecond | int | microseconds, reserved parameters, unused temporarily, write 0| - -* Return Value - - * The integer value 0 is returned after setting successfully, and the integer value - 1 is returned after setting fails. - ###### Register RTC alarm callback Support platform ec600u/ec200u/ec600n/ec800n/bc25 +Note:When RTC expiration time callback function is set (for BC25PA platform, if it is recovered from deep sleep or software shutdown, calling this function will immediately call usrfun once) > rtc.register_callback(fun) @@ -6076,6 +5996,7 @@ Register RTC alarm callback handler ###### Switch RTC alarm function Support platform ec600u/ec200u/ec600n/ec800n/bc25 +Note:The timer can be started only when the callback function is set (bc25pa platform) > rtc.enable_alarm(on_off) diff --git a/zh-cn/api/QuecPythonClasslib.md b/zh-cn/api/QuecPythonClasslib.md index 1de95b1..2a3747b 100644 --- a/zh-cn/api/QuecPythonClasslib.md +++ b/zh-cn/api/QuecPythonClasslib.md @@ -6403,36 +6403,10 @@ if __name__ == '__main__': ``` -###### 设置回调函数 - -> **rtc.register_callback(usrFun)** - -当设置rtc到期时间回调函数(对于BC25PA平台,如果是从深休眠或者软件关机状态中恢复,调用此函数会立刻调用一次usrFun)。 - -* 参数 - -| 参数 | 参数类型 | 参数说明 | -| ------ | -------- | ------------------------------------------ | -| usrFun | function | 回调函数,当设置的RTC时间到达则调用此函数。 | - -注意:usrFun需要参数 +###### 设置RTC到期时间 -* 返回值 - 成功: 0 - 失败: -1 -* 示例 +支持平台EC600U/EC200U/EC600N/EC800N/BC25 -```python ->>> def test(df): -... print('rtc test...',df) -... -... -... ->>> ->>> rtc.register_callback(test) -0 -``` -###### 设置RTC到期时间 rtc.set_alarm(data_e) 设置RTC到期时间,当到了到期时间就会调用注册的回调函数。 * 参数 @@ -6460,51 +6434,6 @@ rtc.set_alarm(data_e) >>> rtc.set_alarm(data_e) 0 ``` -###### 启动/停止RTC定时器 -rtc.enable_alarm(on_off) -只有在设置回调函数时才能启动定时器(BC25PA平台) -* 参数 -| 参数 | 类型 | 说明 | -| ----------- | ---- | ------------------------------------------------------------ | -| on_off | int | 0 - 关闭RTC定时器. 1 - 启动RTC定时器. | - -* 返回值 - 成功: 0 - 失败: -1 -* 示例 -```python ->>> rtc.enable_alarm(1) -0 -``` - - - -###### 设置RTC alarm时间 - -支持平台EC600U/EC200U/EC600N/EC800N/BC25 - -> rtc.set_alarm([year, month, day, week, hour, minute, second, microsecond]) - -设置RTC alarm时间,参数week不参于设置,microsecond参数保留,暂未使用,默认是0。 - -* 参数 - -| 参数 | 类型 | 说明 | -| ----------- | ---- | ------------------------------------- | -| year | int | 年 | -| month | int | 月,范围1 ~ 12 | -| day | int | 日,范围1 ~ 31 | -| week | int | 星期,范围0 ~ 6,该参数不起作用,保留 | -| hour | int | 时,范围0 ~ 23 | -| minute | int | 分,范围0 ~ 59 | -| second | int | 秒,范围0 ~ 59 | -| microsecond | int | 微秒,保留参数,暂未使用,写0即可 | - -* 返回值 - -设置成功返回整型值0,设置失败返回整型值-1 。 - - ###### 注册RTC alarm回调 @@ -6529,6 +6458,7 @@ rtc.enable_alarm(on_off) ###### 开关RTC alarm功能 支持平台EC600U/EC200U/EC600N/EC800N/BC25 +注意:BC25PA平台只有设置回调函数,才能启动定时器. > rtc.enable_alarm(on_off)