1 Star 0 Fork 2

li357919/nodemcu

forked from zhangoneone/nodemcu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
utils.lua.tmp 486 Bytes
一键复制 编辑 原始数据 按行查看 历史
utils = {}
local sleep_tmr
local sleep_co
local function expire()
local status, val = coroutine.resume(sleep_co, 0)
if status == false then
print("sleep occur error\n")
end
end
function utils.init()
sleep_tmr =tmr.create()
sleep_co = coroutine.create(utils_daemon)
end
function utils.sleep(ms)
--begin record time
sleep_tmr:register(ms, tmr.ALARM_SINGLE, expire)
sleep_tmr:start()
--give up cpu
coroutine.yield(ms)
end
return utils
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Lua
1
https://gitee.com/li357919/nodemcu.git
git@gitee.com:li357919/nodemcu.git
li357919
nodemcu
nodemcu
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385