File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -144,6 +144,12 @@ static int rtctime_set (lua_State *L)
144144 return 0 ;
145145}
146146
147+ static int rtctime_set_rate (lua_State * L )
148+ {
149+ rtc_time_set_rate (luaL_checkinteger (L , 1 ));
150+ return 0 ;
151+ }
152+
147153// sec, usec = rtctime.get ()
148154static int rtctime_get (lua_State * L )
149155{
@@ -229,6 +235,7 @@ static int rtctime_epoch2cal (lua_State *L)
229235// Module function map
230236LROT_BEGIN (rtctime , NULL , 0 )
231237 LROT_FUNCENTRY ( set , rtctime_set )
238+ LROT_FUNCENTRY ( set_rate , rtctime_set_rate )
232239 LROT_FUNCENTRY ( get , rtctime_get )
233240 LROT_FUNCENTRY ( adjust_delta , rtctime_adjust_delta )
234241 LROT_FUNCENTRY ( dsleep , rtctime_dsleep )
Original file line number Diff line number Diff line change @@ -158,6 +158,12 @@ rtctime.set(1436430589, 0)
158158#### See also
159159[ ` sntp.sync() ` ] ( sntp.md#sntpsync )
160160
161+ ## rtctime.set_rate()
162+ Adjust the RTC rate, as per [ ` rtctime.set() ` ] ( #rtctimeset ) , but without also setting the time.
163+
164+ #### Syntax
165+ ` rtctime.set_rate(rate) `
166+
161167## rtctime.adjust_delta()
162168
163169This takes a time interval in 'system clock microseconds' based on the timestamps returned by ` tmr.now ` and returns
Original file line number Diff line number Diff line change @@ -540,7 +540,8 @@ stds.nodemcu_libs = {
540540 dsleep_aligned = empty ,
541541 epoch2cal = empty ,
542542 get = empty ,
543- set = empty
543+ set = empty ,
544+ set_rate = empty
544545 }
545546 },
546547 si7021 = {
You can’t perform that action at this time.
0 commit comments