From 56f0f8ed072ae9e70831a1d787b98c7c9a7bb008 Mon Sep 17 00:00:00 2001 From: luatos_bot Date: Mon, 16 Dec 2024 06:48:02 +0000 Subject: [PATCH] ci https://gitee.com/openLuat/LuatOS/commit/f76fb7f5fd51d25fdbcc46fa4f0f85ce77de1a9b --- _static/luatos-emulator/vs/snippet.json | 2 +- api/rtc.md | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/_static/luatos-emulator/vs/snippet.json b/_static/luatos-emulator/vs/snippet.json index cc36eae8..ed025a17 100644 --- a/_static/luatos-emulator/vs/snippet.json +++ b/_static/luatos-emulator/vs/snippet.json @@ -1 +1 @@ -{"_G": {"body": "_G(${0:...})", "description": "_G", "prefix": "_G"}, "_VERSION": {"body": "_VERSION(${0:...})", "description": "_VERSION", "prefix": "_VERSION"}, "assert": {"body": "assert(${1:v}${2:[, message]})", "description": "assert()", "prefix": "assert"}, "collectgarbage": {"body": "collectgarbage(${1:[opt]}${2:[, arg]})", "description": "collectgarbage()", "prefix": "collectgarbage"}, "coroutine.create": {"body": "coroutine.create( ${1:function} )", "description": "coroutine.create", "prefix": "coroutine.create"}, "coroutine.isyieldable": {"body": "coroutine.isyieldable( )", "description": "coroutine.isyieldable", "prefix": "coroutine.isyieldable"}, "coroutine.resume": {"body": "coroutine.resume( ${1:co}${2:[, val1, \u00b7\u00b7\u00b7]} )", "description": "coroutine.resume", "prefix": "coroutine.resume"}, "coroutine.running": {"body": "coroutine.running( )", "description": "coroutine.running", "prefix": "coroutine.running"}, "coroutine.status": {"body": "coroutine.status( ${1:co} )", "description": "coroutine.status", "prefix": "coroutine.status"}, "coroutine.wrap": {"body": "coroutine.wrap( ${1:function} )", "description": "coroutine.wrap", "prefix": "coroutine.wrap"}, "coroutine.yield": {"body": "coroutine.yield( ${1:...} )", "description": "coroutine.yield", "prefix": "coroutine.yield"}, "debug.debug": {"body": "debug.debug()", "description": "debug.debug ()", "prefix": "debug.debug"}, "debug.getfenv": {"body": "debug.getfenv(${0:...})", "description": "debug.getfenv (o)", "prefix": "debug.getfenv"}, "debug.gethook": {"body": "debug.gethook( ${1:[thread]} )", "description": "debug.gethook ([thread])", "prefix": "debug.gethook"}, "debug.getinfo": {"body": "debug.getinfo( ${1:[thread],}${2:f}${3:[, what]} )", "description": "debug.getinfo ([thread,] f [, what])", "prefix": "debug.getinfo"}, "debug.getlocal": {"body": "debug.getlocal( ${1:[thread],}${2:f}${3:[, local]} )", "description": "debug.getlocal ([thread,] f, local)", "prefix": "debug.getlocal"}, "debug.getmetatable": {"body": "debug.getmetatable( ${1:value} )", "description": "debug.getmetatable (value)", "prefix": "debug.getmetatable"}, "debug.getregistry": {"body": "debug.getregistry()", "description": "debug.getregistry ()", "prefix": "debug.getregistry"}, "debug.getupvalue": {"body": "debug.getupvalue( ${1:f}, ${2:up} )", "description": "debug.getupvalue (f, up)", "prefix": "debug.getupvalue"}, "debug.getuservalue": {"body": "debug.getuservalue(${0:...})", "description": "debug.getuservalue (u)", "prefix": "debug.getuservalue"}, "debug.getuservalue ": {"body": "debug.getuservalue ( ${1:u} )", "description": "debug.getuservalue (u)", "prefix": "debug.getuservalue "}, "debug.setfenv": {"body": "debug.setfenv(${0:...})", "description": "debug.setfenv (object, table)", "prefix": "debug.setfenv"}, "debug.sethook": {"body": "debug.sethook( ${1:[thead,]}${2:hook}, ${3:mask}${4:[, count]} )", "description": "debug.sethook ([thread,] hook, mask [, count])", "prefix": "debug.sethook"}, "debug.setlocal": {"body": "debug.setlocal( ${1:[thead,]}${2:level}, ${3:local}, ${4:value} )", "description": "debug.setlocal ([thread,] level, local, value)", "prefix": "debug.setlocal"}, "debug.setmetatable": {"body": "debug.setmetatable( ${1:value}, ${2:table} )", "description": "debug.setmetatable (value, table)", "prefix": "debug.setmetatable"}, "debug.setupvalue": {"body": "debug.setupvalue( ${1:f}, ${2:up}, ${3:value} )", "description": "debug.setupvalue (f, up, value)", "prefix": "debug.setupvalue"}, "debug.setuservalue": {"body": "debug.setuservalue( ${1:udata}, ${2:value} )", "description": "debug.setuservalue (udata, value)", "prefix": "debug.setuservalue"}, "debug.traceback": {"body": "debug.traceback( ${1:[thread,]}${2:[message]}${3:[, level]} )", "description": "debug.traceback ([thread,] [message [, level]])", "prefix": "debug.traceback"}, "debug.upvalueid": {"body": "debug.upvalueid( ${1:f}, ${2:n})", "description": "debug.upvalueid (f, n)", "prefix": "debug.upvalueid"}, "debug.upvaluejoin": {"body": "debug.upvaluejoin( ${1:f1}, ${2:n1}, ${3:f2}, ${4:n2} )", "description": "debug.upvaluejoin (f1, n1, f2, n2)", "prefix": "debug.upvaluejoin"}, "dofile": {"body": "dofile(${1:[filename]})", "description": "dofile ([filename])", "prefix": "dofile"}, "elif": {"body": "else if ${1:condition} then\n\t${0:-- body}\n", "description": "elif", "prefix": "elif"}, "error": {"body": "error(${0:...})", "description": "error (message [, level])", "prefix": "error"}, "file:close": {"body": "file:close(${0:...})", "description": "file:close ()", "prefix": "file:close"}, "file:flush": {"body": "file:flush(${0:...})", "description": "file:flush ()", "prefix": "file:flush"}, "file:lines": {"body": "file:lines(${0:...})", "description": "file:lines ()", "prefix": "file:lines"}, "file:read": {"body": "file:read(${0:...})", "description": "file:read (...)", "prefix": "file:read"}, "file:seek": {"body": "file:seek(${0:...})", "description": "file:seek ([whence] [, offset])", "prefix": "file:seek"}, "file:setvbuf": {"body": "file:setvbuf(${0:...})", "description": "file:setvbuf (mode [, size])", "prefix": "file:setvbuf"}, "file:write": {"body": "file:write(${0:...})", "description": "file:write (...)", "prefix": "file:write"}, "for": {"body": "for ${1:i}=${2:1},${3:10} do\n\t${0:print(i)}\nend", "description": "for i=1,10", "prefix": "for"}, "fori": {"body": "for ${1:i},${2:v} in ipairs(${3:table_name}) do\n\t${0:print(i,v)}\nend", "description": "for i,v in ipairs()", "prefix": "fori"}, "forp": {"body": "for ${1:k},${2:v} in pairs(${3:table_name}) do\n\t${0:print(k,v)}\nend", "description": "for k,v in pairs()", "prefix": "forp"}, "fun": {"body": "function ${1:function_name}( ${2:...} )\n\t${0:-- body}\nend", "description": "function", "prefix": "fun"}, "function": {"body": "function ${1:function_name}( ${2:...} )\n\t${0:-- body}\nend", "description": "function", "prefix": "function"}, "getfenv": {"body": "getfenv(${0:...})", "description": "getfenv ([f])", "prefix": "getfenv"}, "getmetatable": {"body": "getmetatable(${1:object})", "description": "getmetatable (object)", "prefix": "getmetatable"}, "if": {"body": "if ${1:condition} then\n\t${0:-- body}\nend", "description": "if", "prefix": "if"}, "ifel": {"body": "if ${1:condition} then\n\t${2:-- body}\nelse\n\t${0:-- body}\nend", "description": "ifel", "prefix": "ifel"}, "io.close": {"body": "io.close(${0:...})", "description": "io.close ([file])", "prefix": "io.close"}, "io.flush": {"body": "io.flush(${0:...})", "description": "io.flush ()", "prefix": "io.flush"}, "io.input": {"body": "io.input(${0:...})", "description": "io.input ([file])", "prefix": "io.input"}, "io.lines": {"body": "io.lines(${0:...})", "description": "io.lines ([filename])", "prefix": "io.lines"}, "io.open": {"body": "io.open(${0:...})", "description": "io.open (filename [, mode])", "prefix": "io.open"}, "io.output": {"body": "io.output(${0:...})", "description": "io.output ([file])", "prefix": "io.output"}, "io.popen": {"body": "io.popen(${0:...})", "description": "io.popen (prog [, mode])", "prefix": "io.popen"}, "io.read": {"body": "io.read(${0:...})", "description": "io.read (...)", "prefix": "io.read"}, "io.tmpfile": {"body": "io.tmpfile(${0:...})", "description": "io.tmpfile ()", "prefix": "io.tmpfile"}, "io.type": {"body": "io.type(${0:...})", "description": "io.type (obj)", "prefix": "io.type"}, "io.write": {"body": "io.write(${0:...})", "description": "io.write (...)", "prefix": "io.write"}, "ipairs": {"body": "ipairs(${0:...})", "description": "ipairs (t)", "prefix": "ipairs"}, "load": {"body": "load(${0:...})", "description": "load (func [, chunkname])", "prefix": "load"}, "loadfile": {"body": "loadfile(${0:...})", "description": "loadfile ([filename])", "prefix": "loadfile"}, "loadstring": {"body": "loadstring(${0:...})", "description": "loadstring (string [, chunkname])", "prefix": "loadstring"}, "local": {"body": "local ${1:x} = ${0:1}", "description": "local x = 1", "prefix": "local"}, "math.abs": {"body": "math.abs( ${1:x} )", "description": "math.abs", "prefix": "math.abs"}, "math.acos": {"body": "math.acos( ${1:x} )", "description": "math.acos", "prefix": "math.acos"}, "math.asin": {"body": "math.asin( ${1:x} )", "description": "math.asin", "prefix": "math.asin"}, "math.atan": {"body": "math.atan( ${1:y}${2:[, x]} )", "description": "math.atan", "prefix": "math.atan"}, "math.atan2": {"body": "math.atan2(${0:...})", "description": "math.atan2 (y, x)", "prefix": "math.atan2"}, "math.ceil": {"body": "math.ceil( ${1:x} )", "description": "math.ceil", "prefix": "math.ceil"}, "math.cos": {"body": "math.cos( ${1:x} )", "description": "math.cos", "prefix": "math.cos"}, "math.cosh": {"body": "math.cosh(${0:...})", "description": "math.cosh (x)", "prefix": "math.cosh"}, "math.deg": {"body": "math.deg( ${1:x} )", "description": "math.deg", "prefix": "math.deg"}, "math.exp": {"body": "math.exp( ${1:x} )", "description": "math.exp", "prefix": "math.exp"}, "math.floor": {"body": "math.floor( ${1:x} )", "description": "math.floor", "prefix": "math.floor"}, "math.fmod": {"body": "math.fmod( ${1:x},${2:y} )", "description": "math.fmod", "prefix": "math.fmod"}, "math.frexp": {"body": "math.frexp(${0:...})", "description": "math.frexp (x)", "prefix": "math.frexp"}, "math.huge": {"body": "math.huge(${0:...})", "description": "math.huge", "prefix": "math.huge"}, "math.ldexp": {"body": "math.ldexp(${0:...})", "description": "math.ldexp (m, e)", "prefix": "math.ldexp"}, "math.log": {"body": "math.log( ${1:x}${2:[, base]} )", "description": "math.log", "prefix": "math.log"}, "math.log10": {"body": "math.log10(${0:...})", "description": "math.log10 (x)", "prefix": "math.log10"}, "math.math.randomseed": {"body": "math.math.randomseed( ${1:x} )", "description": "math.math.randomseed", "prefix": "math.math.randomseed"}, "math.max": {"body": "math.max( ${1:x},${2:...} )", "description": "math.max", "prefix": "math.max"}, "math.maxinteger": {"body": "math.maxinteger(${0:...})", "description": "math.maxinteger", "prefix": "math.maxinteger"}, "math.min": {"body": "math.min( ${1:x},${2:...} )", "description": "math.min", "prefix": "math.min"}, "math.mininteger": {"body": "math.mininteger(${0:...})", "description": "math.mininteger", "prefix": "math.mininteger"}, "math.modf": {"body": "math.modf( ${1:x} )", "description": "math.modf", "prefix": "math.modf"}, "math.pi": {"body": "math.pi(${0:...})", "description": "math.pi", "prefix": "math.pi"}, "math.pow": {"body": "math.pow(${0:...})", "description": "math.pow (x, y)", "prefix": "math.pow"}, "math.rad": {"body": "math.rad(${0:...})", "description": "math.rad (x)", "prefix": "math.rad"}, "math.random": {"body": "math.random( ${1:[m]}${2:[, n]} )", "description": "math.random", "prefix": "math.random"}, "math.randomseed": {"body": "math.randomseed(${0:...})", "description": "math.randomseed (x)", "prefix": "math.randomseed"}, "math.sin": {"body": "math.sin( ${1:x} )", "description": "math.sin", "prefix": "math.sin"}, "math.sinh": {"body": "math.sinh(${0:...})", "description": "math.sinh (x)", "prefix": "math.sinh"}, "math.sqrt": {"body": "math.sqrt( ${1:x} )", "description": "math.sqrt", "prefix": "math.sqrt"}, "math.tan": {"body": "math.tan( ${1:x} )", "description": "math.tan", "prefix": "math.tan"}, "math.tanh": {"body": "math.tanh(${0:...})", "description": "math.tanh (x)", "prefix": "math.tanh"}, "math.tointeger": {"body": "math.tointeger( ${1:x} )", "description": "math.tointeger", "prefix": "math.tointeger"}, "math.type": {"body": "math.type( ${1:x} )", "description": "math.type", "prefix": "math.type"}, "math.ult": {"body": "math.ult(${0:...})", "description": "math.ult (m, n)", "prefix": "math.ult"}, "module": {"body": "module(${0:...})", "description": "module (name [, ...])", "prefix": "module"}, "next": {"body": "next(${1:table}${2:[, index]})", "description": "next (table [, index])", "prefix": "next"}, "os.clock": {"body": "os.clock()", "description": "os.clock() - \u8fd4\u56de\u7a0b\u5e8f\u4f7f\u7528\u7684\u6309\u79d2\u8ba1 CPU \u65f6\u95f4\u7684\u8fd1\u4f3c\u503c\n\u4f20\u5165\u503c\uff1a\nreturn \u65f6\u95f4\u6233\n\u4f8b\u5b50\uff1a\n-- \u4e0d\u63a8\u8350\u4f7f\u7528\u672cAPI\n-- \u5982\u9700\u8981\u83b7\u53d6 \u65f6\u95f4\u6233, \u8bf7\u4f7f\u7528 os.time()\n-- \u5982\u9700\u83b7\u53d6\u7cfb\u7edf\u8fd0\u884c\u65f6\u957f, \u8bf7\u4f7f\u7528 mcu.ticks()\n", "prefix": "os.clock"}, "os.date": {"body": "os.date(${1:fmt},${2:time})", "description": "os.date(fmt, time) - \u65e5\u671f\u51fd\u6570\n\u4f20\u5165\u503c\uff1a\nstring \u683c\u5f0f\u5316\u5b57\u7b26\u4e32,\u53ef\u4ee5\u662fnil\ntable \u65e5\u671f\u65f6\u95f4\u7684table\n\u8fd4\u56de\u503c\uff1a\ntable/string \u6839\u636efmt\u7684\u4e0d\u540c,\u8fd4\u56de\u503c\u4e0d\u540c\n\u4f8b\u5b50\uff1a\n\n-- \u503c\u5f97\u6ce8\u610f\u7684\u51e0\u70b9:\n-- 1. \u82e5\u9700\u8981UTC\u65f6\u95f4, fmt\u7684\u7b2c\u4e00\u4e2a\u5b57\u7b26\u5199\"!\"\n-- 2. fmt\u7684\u683c\u5f0f\u5316\u9075\u5faa C \u51fd\u6570 strftime, \u53ef\u4ee5\u67e5\u9605 https://developer.aliyun.com/article/320480\n\n-- \u83b7\u53d6\u672c\u5730\u65f6\u95f4\u5b57\u7b26\u4e32\nlog.info(\"\u672c\u5730\u65f6\u95f4\u5b57\u7b26\u4e32\", os.date())\n-- \u83b7\u53d6UTC\u65f6\u95f4\u5b57\u7b26\u4e32\nlog.info(\"UTC\u65f6\u95f4\u5b57\u7b26\u4e32\", os.date(\"!%c\"))\n-- \u683c\u5f0f\u5316\u672c\u5730\u65f6\u95f4\u5b57\u7b26\u4e32\nlog.info(\"\u672c\u5730\u65f6\u95f4\u5b57\u7b26\u4e32\", os.date(\"%Y-%m-%d %H:%M:%S\"))\n-- \u683c\u5f0f\u5316UTC\u65f6\u95f4\u5b57\u7b26\u4e32\nlog.info(\"UTC\u65f6\u95f4\u5b57\u7b26\u4e32\", os.date(\"!%Y-%m-%d %H:%M:%S\"))\n-- \u683c\u5f0f\u5316\u65f6\u95f4\u5b57\u7b26\u4e32\nlog.info(\"\u81ea\u5b9a\u4e49\u65f6\u95f4\u7684\u5b57\u7b26\u4e32\", os.date(\"!%Y-%m-%d %H:%M:%S\", os.time({year=2000, mon=1, day=1, hour=0, min=0, sec=0})))\n\n-- \u83b7\u53d6\u672c\u5730\u65f6\u95f4\u7684table\nlog.info(\"\u672c\u5730\u65f6\u95f4\u5b57\u7b26\u4e32\", json.encode(os.date(\"*t\")))\n-- \u83b7\u53d6UTC\u65f6\u95f4\u7684table\nlog.info(\"UTC\u65f6\u95f4\u5b57\u7b26\u4e32\", json.encode(os.date(\"!*t\")))\n", "prefix": "os.date"}, "os.difftime": {"body": "os.difftime(${1:timeA},${2:timeB})", "description": "os.difftime(timeA, timeB) - \u65f6\u95f4\u5dee\u503c\n\u4f20\u5165\u503c\uff1a\nint \u65f6\u95f4A,\u6570\u503c\u7c7b\u578b\nint \u65f6\u95f4B,\u6570\u503c\u7c7b\u578b\n\u8fd4\u56de\u503c\uff1a\nint \u65f6\u95f4\u5dee\u503c\n", "prefix": "os.difftime"}, "os.execute": {"body": "os.execute(${0:...})", "description": "os.execute ([command])", "prefix": "os.execute"}, "os.exit": {"body": "os.exit(${0:...})", "description": "os.exit ([code])", "prefix": "os.exit"}, "os.getenv": {"body": "os.getenv(${0:...})", "description": "os.getenv (varname)", "prefix": "os.getenv"}, "os.remove": {"body": "os.remove(${1:path})", "description": "os.remove(path) - \u79fb\u9664\u6587\u4ef6\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u79fb\u9664\u7684\u6587\u4ef6\u5b8c\u6574\u8def\u5f84\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5176\u4ed6\u60c5\u51b5\u8fd4\u56denil\nstring \u5931\u8d25\u65f6\u8fd4\u56de\u539f\u56e0\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u5220\u9664\u6839\u76ee\u5f55\u4e0b\u7684\u67d0\u4e2a\u6587\u4ef6\nos.remove(\"/1.txt\")\n-- \u6ce8\u610f, \u7ebf\u5237\u65f6\u7684\u6587\u4ef6, \u4e00\u822c\u5728 /luadb \u76ee\u5f55, \u8fd9\u4e2a\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\u662f\u53ea\u8bfb\u7684\n-- \u4e5f\u5c31\u662f\u65e0\u6cd5\u6267\u884c os.remove(\"/luadb/xxx.bin\")\n", "prefix": "os.remove"}, "os.rename": {"body": "os.rename(${1:old_path},${2:new_path})", "description": "os.rename(old_path, new_path) - \u6587\u4ef6\u91cd\u547d\u540d\n\u4f20\u5165\u503c\uff1a\nstring \u6e90\u6587\u4ef6\u5b8c\u6574\u8def\u5f84\nstring \u76ee\u6807\u6587\u4ef6\u5b8c\u6574\u8def\u5f84\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5176\u4ed6\u60c5\u51b5\u8fd4\u56denil\nstring \u5931\u8d25\u65f6\u8fd4\u56de\u539f\u56e0\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f, \u53ea\u6709\u5728\u76f8\u540c\u6587\u4ef6\u7cfb\u7edf\u4e0b\u7684\u6587\u4ef6\u53ef\u4ee5\u91cd\u547d\u540d\n-- \u4f8b\u5982:\nos.rename(\"/1.txt\", \"/2.txt\")\n-- \u4e0d\u540c\u6587\u4ef6\u7cfb\u7edf, \u6216\u8005\u6e90\u6587\u4ef6\u7cfb\u7edf\u662f\u53ea\u8bfb\u7684, \u5219\u65e0\u6cd5\u6267\u884c\n--os.rename(\"/luadb/1.txt\", \"/luadb/2.txt\")\n--os.rename(\"/luadb/1.txt\", \"/2.txt\")\n", "prefix": "os.rename"}, "os.setlocale": {"body": "os.setlocale(${0:...})", "description": "os.setlocale (locale [, category])", "prefix": "os.setlocale"}, "os.time": {"body": "os.time(${1:mytime})", "description": "os.time(mytime) - \u65f6\u95f4\u6233\u51fd\u6570\n\u4f20\u5165\u503c\uff1a\ntable \u65e5\u671f\u65f6\u95f4\u7684table\nreturn \u65f6\u95f4\u6233\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f\u6ce8\u610f, \u8fd9\u4e2a\u51fd\u6570\u8fd4\u56de\u7684\u662fUTC\u65f6\u95f4\u6233\n-- \u65f6\u95f4\u6233, \u4f46lua\u4e0b\u7684\u7cbe\u5ea6\u53ea\u80fd\u5230\u79d2\nlog.info(\"UTC\u65f6\u95f4\u6233\", os.time())\nlog.info(\"\u81ea\u5b9a\u4e49\u65f6\u95f4\u6233\", os.time({year=2000, mon=1, day=1, hour=0, min=0, sec=0}))\n", "prefix": "os.time"}, "os.tmpname": {"body": "os.tmpname(${0:...})", "description": "os.tmpname ()", "prefix": "os.tmpname"}, "package.config": {"body": "package.config(${0:...})", "description": "package.config", "prefix": "package.config"}, "package.cpath": {"body": "package.cpath(${0:...})", "description": "package.cpath", "prefix": "package.cpath"}, "package.loaded": {"body": "package.loaded(${0:...})", "description": "package.loaded", "prefix": "package.loaded"}, "package.loaders": {"body": "package.loaders(${0:...})", "description": "package.loaders", "prefix": "package.loaders"}, "package.loadlib": {"body": "package.loadlib(${0:...})", "description": "package.loadlib (libname, funcname)", "prefix": "package.loadlib"}, "package.path": {"body": "package.path(${0:...})", "description": "package.path", "prefix": "package.path"}, "package.preload": {"body": "package.preload(${0:...})", "description": "package.preload", "prefix": "package.preload"}, "package.searchers": {"body": "package.searchers(${0:...})", "description": "package.searchers", "prefix": "package.searchers"}, "package.searchpath": {"body": "package.searchpath(${0:...})", "description": "package.searchpath (name, path [, sep [, rep]])", "prefix": "package.searchpath"}, "package.seeall": {"body": "package.seeall(${0:...})", "description": "package.seeall (module)", "prefix": "package.seeall"}, "pairs": {"body": "pairs(${0:...})", "description": "pairs (t)", "prefix": "pairs"}, "pcall": {"body": "pcall(${0:...})", "description": "pcall (f, arg1, ...)", "prefix": "pcall"}, "print": {"body": "print(${1:...})", "description": "print(...)", "prefix": "print"}, "require": {"body": "require\"${1:module}\"", "description": "require()", "prefix": "require"}, "ret": {"body": "return ${1:...}", "description": "return ...", "prefix": "ret"}, "select": {"body": "select(${1:index}, ${2:...})", "description": "select (index, \u00b7\u00b7\u00b7)", "prefix": "select"}, "setfenv": {"body": "setfenv(${0:...})", "description": "setfenv (f, table)", "prefix": "setfenv"}, "setmetatable": {"body": "setmetatable(${1:table}, ${2:metatable})", "description": "setmetatable (table, metatable)", "prefix": "setmetatable"}, "tonumber": {"body": "tonumber(${1:e}${2:[, base]})", "description": "tonumber (e [, base])", "prefix": "tonumber"}, "tostring": {"body": "tostring(${1:v})", "description": "tostring (v)", "prefix": "tostring"}, "type": {"body": "type(${1:v})", "description": "type (v)", "prefix": "type"}, "unpack": {"body": "unpack(${0:...})", "description": "unpack (list [, i [, j]])", "prefix": "unpack"}, "xpcall": {"body": "xpcall(${0:...})", "description": "xpcall (f, err)", "prefix": "xpcall"}, "sys.publish(...)": {"body": "sys.publish(${1:...})", "description": "\u53d1\u5e03\u5185\u90e8\u6d88\u606f\uff0c\u5b58\u50a8\u5728\u5185\u90e8\u6d88\u606f\u961f\u5217\u4e2d\r\n\u8fd4\u56de\u503c\uff1a\r\n\u65e0\r\n\u4f8b\u5b50\uff1a\r\npublish(\"NET_STATUS_IND\")\r\n", "prefix": "sys.publish(...)"}, "sys.restart(r)": {"body": "sys.restart(${1:r})", "description": "\u8f6f\u4ef6\u91cd\u542f\r\n\u8fd4\u56de\u503c\uff1a\r\n\u65e0\r\n\u4f8b\u5b50\uff1a\r\nsys.restart('\u7a0b\u5e8f\u8d85\u65f6\u8f6f\u4ef6\u91cd\u542f')\r\n", "prefix": "sys.restart(r)"}, "sys.run()": {"body": "sys.run()", "description": "run()\u4ece\u5e95\u5c42\u83b7\u53d6core\u6d88\u606f\u5e76\u53ca\u65f6\u5904\u7406\u76f8\u5173\u6d88\u606f\uff0c\u67e5\u8be2\u5b9a\u65f6\u5668\u5e76\u8c03\u5ea6\u5404\u6ce8\u518c\u6210\u529f\u7684\u4efb\u52a1\u7ebf\u7a0b\u8fd0\u884c\u548c\u6302\u8d77\r\n\u8fd4\u56de\u503c\uff1a\r\n\u65e0\r\n\u4f8b\u5b50\uff1a\r\nsys.run()\r\n", "prefix": "sys.run()"}, "sys.setRollBack(flag, secs)": {"body": "sys.setRollBack(${1:flag},${2: secs})", "description": "\u8bbe\u7f6e\u201clua\u811a\u672c\u8fd0\u884c\u51fa\u9519\u65f6\uff0c\u662f\u5426\u56de\u9000\u539f\u59cb\u70e7\u5199\u7248\u672c\u201d\u7684\u529f\u80fd\u5f00\u5173\u3002\u5982\u679c\u6ca1\u6709\u8c03\u7528\u6b64\u63a5\u53e3\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u56de\u6eda\r\n\u8fd4\u56de\u503c\uff1a\r\nnil\r\n\u4f8b\u5b50\uff1a\r\nsys.setRollBack(true)\r\nsys.setRollBack(false)\r\n", "prefix": "sys.setRollBack(flag, secs)"}, "sys.subscribe(id, callback)": {"body": "sys.subscribe(${1:id},${2: callback})", "description": "\u8ba2\u9605\u6d88\u606f\r\n\u8fd4\u56de\u503c\uff1a\r\n\u65e0\r\n\u4f8b\u5b50\uff1a\r\nsubscribe(\"NET_STATUS_IND\", callback)\r\n", "prefix": "sys.subscribe(id, callback)"}, "sys.taskInit(fun, ...)": {"body": "sys.taskInit(${1:fun},${2: ...})", "description": "\u521b\u5efa\u4e00\u4e2a\u4efb\u52a1\u7ebf\u7a0b,\u5728\u6a21\u5757\u6700\u672b\u884c\u8c03\u7528\u8be5\u51fd\u6570\u5e76\u6ce8\u518c\u6a21\u5757\u4e2d\u7684\u4efb\u52a1\u51fd\u6570\uff0cmain.lua\u5bfc\u5165\u8be5\u6a21\u5757\u5373\u53ef\r\n\u8fd4\u56de\u503c\uff1a\r\nco \u8fd4\u56de\u8be5\u4efb\u52a1\u7684\u7ebf\u7a0b\u53f7\r\n\u4f8b\u5b50\uff1a\r\nsys.taskInit(task1,'a','b')\r\n", "prefix": "sys.taskInit(fun, ...)"}, "sys.timerIsActive(val, ...)": {"body": "sys.timerIsActive(${1:val},${2: ...})", "description": "\u5224\u65ad\u67d0\u4e2a\u5b9a\u65f6\u5668\u662f\u5426\u5904\u4e8e\u5f00\u542f\u72b6\u6001\r\n\u8fd4\u56de\u503c\uff1a\r\nnumber \u5f00\u542f\u72b6\u6001\u8fd4\u56detrue\uff0c\u5426\u5219nil", "prefix": "sys.timerIsActive(val, ...)"}, "sys.timerLoopStart(fnc, ms, ...)": {"body": "sys.timerLoopStart(${1:fnc},${2: ms},${3: ...})", "description": "\u5f00\u542f\u4e00\u4e2a\u5faa\u73af\u5b9a\u65f6\u5668\r\n\u8fd4\u56de\u503c\uff1a\r\nnumber \u5b9a\u65f6\u5668ID\uff0c\u5982\u679c\u5931\u8d25\uff0c\u8fd4\u56denil", "prefix": "sys.timerLoopStart(fnc, ms, ...)"}, "sys.timerStart(fnc, ms, ...)": {"body": "sys.timerStart(${1:fnc},${2: ms},${3: ...})", "description": "\u5f00\u542f\u4e00\u4e2a\u5b9a\u65f6\u5668\r\n\u8fd4\u56de\u503c\uff1a\r\nnumber \u5b9a\u65f6\u5668ID\uff0c\u5982\u679c\u5931\u8d25\uff0c\u8fd4\u56denil", "prefix": "sys.timerStart(fnc, ms, ...)"}, "sys.timerStop(val, ...)": {"body": "sys.timerStop(${1:val},${2: ...})", "description": "\u5173\u95ed\u5b9a\u65f6\u5668\r\n\u8fd4\u56de\u503c\uff1a\r\n\u65e0\r\n\u4f8b\u5b50\uff1a\r\ntimerStop(1)\r\n", "prefix": "sys.timerStop(val, ...)"}, "sys.timerStopAll(fnc)": {"body": "sys.timerStopAll(${1:fnc})", "description": "\u5173\u95ed\u540c\u4e00\u56de\u8c03\u51fd\u6570\u7684\u6240\u6709\u5b9a\u65f6\u5668\r\n\u8fd4\u56de\u503c\uff1a\r\n\u65e0\r\n\u4f8b\u5b50\uff1a\r\ntimerStopAll(cbFnc)\r\n", "prefix": "sys.timerStopAll(fnc)"}, "sys.unsubscribe(id, callback)": {"body": "sys.unsubscribe(${1:id},${2: callback})", "description": "\u53d6\u6d88\u8ba2\u9605\u6d88\u606f\r\n\u8fd4\u56de\u503c\uff1a\r\n\u65e0\r\n\u4f8b\u5b50\uff1a\r\nunsubscribe(\"NET_STATUS_IND\", callback)\r\n", "prefix": "sys.unsubscribe(id, callback)"}, "sys.wait(ms)": {"body": "sys.wait(${1:ms})", "description": "Task\u4efb\u52a1\u5ef6\u65f6\u51fd\u6570\uff0c\u53ea\u80fd\u7528\u4e8e\u4efb\u52a1\u51fd\u6570\u4e2d\r\n\u8fd4\u56de\u503c\uff1a\r\n\u5b9a\u65f6\u7ed3\u675f\u8fd4\u56denil,\u88ab\u5176\u4ed6\u7ebf\u7a0b\u5524\u8d77\u8fd4\u56de\u8c03\u7528\u7ebf\u7a0b\u4f20\u5165\u7684\u53c2\u6570\r\n\u4f8b\u5b50\uff1a\r\nsys.wait(30)\r\n", "prefix": "sys.wait(ms)"}, "sys.waitUntil(id, ms)": {"body": "sys.waitUntil(${1:id},${2: ms})", "description": "Task\u4efb\u52a1\u7684\u6761\u4ef6\u7b49\u5f85\u51fd\u6570\uff08\u5305\u62ec\u4e8b\u4ef6\u6d88\u606f\u548c\u5b9a\u65f6\u5668\u6d88\u606f\u7b49\u6761\u4ef6\uff09\uff0c\u53ea\u80fd\u7528\u4e8e\u4efb\u52a1\u51fd\u6570\u4e2d\u3002\r\n\u8fd4\u56de\u503c\uff1a\r\nresult \u63a5\u6536\u5230\u6d88\u606f\u8fd4\u56detrue\uff0c\u8d85\u65f6\u8fd4\u56defalse\r\n\u4f8b\u5b50\uff1a\r\nresult, data = sys.waitUntil(\"SIM_IND\", 120000)\r\n", "prefix": "sys.waitUntil(id, ms)"}, "sys.waitUntilExt(id, ms)": {"body": "sys.waitUntilExt(${1:id},${2: ms})", "description": "Task\u4efb\u52a1\u7684\u6761\u4ef6\u7b49\u5f85\u51fd\u6570\u6269\u5c55\uff08\u5305\u62ec\u4e8b\u4ef6\u6d88\u606f\u548c\u5b9a\u65f6\u5668\u6d88\u606f\u7b49\u6761\u4ef6\uff09\uff0c\u53ea\u80fd\u7528\u4e8e\u4efb\u52a1\u51fd\u6570\u4e2d\u3002\r\n\u8fd4\u56de\u503c\uff1a\r\nmessage \u63a5\u6536\u5230\u6d88\u606f\u8fd4\u56demessage\uff0c\u8d85\u65f6\u8fd4\u56defalse\r\n\u4f8b\u5b50\uff1a\r\nresult, data = sys.waitUntilExt(\"SIM_IND\", 120000)\r\n", "prefix": "sys.waitUntilExt(id, ms)"}, "table.concat(t,s)": {"body": "table.concat(${1:t},${2: s})", "description": "\u8868\u8fde\u63a5\r\n\u8fd4\u56de\u503c\uff1a\r\n \u5b57\u7b26\u4e32\r\n\u4f8b\u5b50\uff1a\r\nfruits = {\"banana\",\"orange\",\"apple\"}\r\n-- \u8fd4\u56de table \u8fde\u63a5\u540e\u7684\u5b57\u7b26\u4e32\r\nprint(\"\u8fde\u63a5\u540e\u7684\u5b57\u7b26\u4e32 \",table.concat(fruits))\r\n--\u8fde\u63a5\u540e\u7684\u5b57\u7b26\u4e32 bananaorangeapple\r\n\r\n-- \u6307\u5b9a\u8fde\u63a5\u5b57\u7b26\r\nprint(\"\u8fde\u63a5\u540e\u7684\u5b57\u7b26\u4e32 \",table.concat(fruits,\", \"))\r\n--\u8fde\u63a5\u540e\u7684\u5b57\u7b26\u4e32 banana, orange, apple\r\n\r\n-- \u6307\u5b9a\u7d22\u5f15\u6765\u8fde\u63a5 table\r\nprint(\"\u8fde\u63a5\u540e\u7684\u5b57\u7b26\u4e32 \",table.concat(fruits,\", \", 2,3))\r\n--\u8fde\u63a5\u540e\u7684\u5b57\u7b26\u4e32 orange, apple\r\n", "prefix": "table.concat()"}, "table.gsort(t, f)": {"body": "table.gsort(${1:t},${2: f})", "description": "\u8fd4\u56de\u4e00\u4e2a\u8fed\u4ee3\u5668\u51fd\u6570,\u6bcf\u6b21\u8c03\u7528\u51fd\u6570\u90fd\u4f1a\u8fd4\u56dehash\u8868\u7684\u6392\u5e8f\u540e\u7684\u952e\u503c\u5bf9\r\n\u8fd4\u56de\u503c\uff1a\r\nfunction.\r\n\u4f8b\u5b50\uff1a\r\ntest = {a=1,f=9,d=2,c=8,b=5}\r\nfor name,line in pairsByKeys(test) do print(name,line) end\r\n", "prefix": "table.gsort(t, f)"}, "table.insert(t,d)": {"body": "table.insert(${1:t},${2: d})", "description": "\u6dfb\u52a0table\u53c2\u6570\r\n\u8fd4\u56de\u503c\uff1a\r\n table\r\n\u4f8b\u5b50\uff1a\r\nfruits = {\"banana\",\"orange\",\"apple\"}\r\n\r\n-- \u5728\u672b\u5c3e\u63d2\u5165\r\ntable.insert(fruits,\"mango\")\r\nprint(\"\u7d22\u5f15\u4e3a 4 \u7684\u5143\u7d20\u4e3a \",fruits[4])\r\n--\u7d22\u5f15\u4e3a 4 \u7684\u5143\u7d20\u4e3a mango\r\n\r\n-- \u5728\u7d22\u5f15\u4e3a 2 \u7684\u952e\u5904\u63d2\u5165\r\ntable.insert(fruits,2,\"grapes\")\r\nprint(\"\u7d22\u5f15\u4e3a 2 \u7684\u5143\u7d20\u4e3a \",fruits[2])\r\n--\u7d22\u5f15\u4e3a 2 \u7684\u5143\u7d20\u4e3a grapes\r\n\r\nprint(\"\u6700\u540e\u4e00\u4e2a\u5143\u7d20\u4e3a \",fruits[5])\r\n--\u6700\u540e\u4e00\u4e2a\u5143\u7d20\u4e3a mango\r\n", "prefix": "table.insert()"}, "table.remove(t,i)": {"body": "table.remove(${1:t},${2: i})", "description": "\u79fb\u9664table\u53c2\u6570\r\n\u8fd4\u56de\u503c\uff1a\r\n table", "prefix": "table.remove()"}, "string.byte()": {"body": "string.byte()", "description": "\u63a5\u6536\u63a7\u5236\u5b57\u7b26\uff0c\u8fd4\u56deASCII\u7801\r\n\u8fd4\u56de\u503c\uff1a\r\n ASCII\u7801\r\n\u4f8b\u5b50\uff1a\r\nstring.byte(\"ABCD\") --65\r\nstring.byte(\"ABCD\",4) --68\r\n", "prefix": "string.byte()"}, "string.char()": {"body": "string.char()", "description": "\u63a5\u6536ASCII\u7801\uff0c\u8fd4\u56de\u5bf9\u5e94\u7684\u63a7\u5236\u5b57\u7b26\r\n\u8fd4\u56de\u503c\uff1a\r\n \u5b57\u7b26\r\n\u4f8b\u5b50\uff1a\r\nstring.char(97,98,99,100) --abcd\r\n", "prefix": "string.char()"}, "string.find()": {"body": "string.find()", "description": "\u67e5\u627e\u7b2c\u4e00\u4e2a\u5b57\u7b26\u4e32\u00a0s\u00a0\u4e2d\u5339\u914d\u5230\u7684\u00a0pattern\r\n\u8fd4\u56de\u503c\uff1a\r\n \u8fd4\u56de\u5339\u914d\u5b57\u7b26\u5177\u4f53\u4f4d\u7f6e\u3002\u4e0d\u5b58\u5728\u5219\u8fd4\u56de nil\r\n\u4f8b\u5b50\uff1a\r\nstring.find(\"Hello Lua user\", \"Lua\", 1) --7 9\r\n", "prefix": "string.find()"}, "string.format()": {"body": "string.format()", "description": "\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\r\n\u8fd4\u56de\u503c\uff1a\r\n \u5b57\u7b26\u4e32\r\n\u4f8b\u5b50\uff1a\r\nstring.format(\"the value is:%d\",4) --the value is:4\r\n", "prefix": "string.format()"}, "string.gsub()": {"body": "string.gsub()", "description": "\u5b57\u7b26\u4e32\u66ff\u6362", "prefix": "string.gsub()"}, "string.len()": {"body": "string.len()", "description": "\u8ba1\u7b97\u5b57\u7b26\u4e32\u957f\u5ea6\r\n\u8fd4\u56de\u503c\uff1a\r\n \u5b57\u7b26\u4e32\u957f\u5ea6\r\n\u4f8b\u5b50\uff1a\r\nstring.len(\"abc\") --3\r\n", "prefix": "string.len()"}, "string.lower()": {"body": "string.lower()", "description": "\u5b57\u7b26\u4e32\u5168\u90e8\u8f6c\u4e3a\u5c0f\u5199\u5b57\u6bcd\r\n\u8fd4\u56de\u503c\uff1a\r\n \u5c0f\u5199\u5b57\u6bcd\u5b57\u7b26\u4e32", "prefix": "string.lower()"}, "string.rep()": {"body": "string.rep()", "description": "\u5b57\u7b26\u4e32\u62f7\u8d1d\r\n\u8fd4\u56de\u503c\uff1a\r\n \u5b57\u7b26\u4e32\r\n\u4f8b\u5b50\uff1a\r\nstring.rep(\"abcd\",2) --abcdabcd\r\n", "prefix": "string.rep()"}, "string.reverse()": {"body": "string.reverse()", "description": "\u5b57\u7b26\u4e32\u53cd\u8f6c\r\n\u8fd4\u56de\u503c\uff1a\r\n \u53cd\u8f6c\u540e\u7684\u5b57\u7b26\u4e32\r\n\u4f8b\u5b50\uff1a\r\nstring.reverse(\"Luat\") --tauL\r\n", "prefix": "string.reverse()"}, "string.split(str, delimiter)": {"body": "string.split(${1:str},${2: delimiter})", "description": "\u6309\u7167\u6307\u5b9a\u5206\u9694\u7b26\u5206\u5272\u5b57\u7b26\u4e32\r\n\u8fd4\u56de\u503c\uff1a\r\n\u5206\u5272\u540e\u7684\u5b57\u7b26\u4e32\u5217\u8868\r\n\u4f8b\u5b50\uff1a\r\n\"123,456,789\":split(',') -> {'123','456','789'}\r\n", "prefix": "string.split(str, delimiter)"}, "string.upper()": {"body": "string.upper()", "description": "\u5b57\u7b26\u4e32\u5168\u90e8\u8f6c\u4e3a\u5927\u5199\u5b57\u6bcd\r\n\u8fd4\u56de\u503c\uff1a\r\n \u5927\u5199\u5b57\u6bcd\u5b57\u7b26\u4e32", "prefix": "string.upper()"}, "adc.open": {"body": "adc.open(${1:id})", "description": "adc.open(id) - \u6253\u5f00adc\u901a\u9053\n\u4f20\u5165\u503c\uff1a\nint \u901a\u9053id,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173,\u901a\u5e38\u4ece0\u5f00\u59cb\n\u8fd4\u56de\u503c\uff1a\nboolean \u6253\u5f00\u7ed3\u679c\n\u4f8b\u5b50\uff1a\n-- \u6253\u5f00adc\u901a\u90534,\u5e76\u8bfb\u53d6\nif adc.open(4) then\n log.info(\"adc\", adc.read(4)) -- \u8fd4\u56de\u503c\u67092\u4e2a, \u539f\u59cb\u503c\u548c\u8ba1\u7b97\u503c,\u901a\u5e38\u53ea\u9700\u8981\u540e\u8005\n log.info(\"adc\", adc.get(4)) -- \u8fd4\u56de\u503c\u67091\u4e2a, \u4ec5\u8ba1\u7b97\u503c\nend\nadc.close(4) -- \u82e5\u9700\u8981\u6301\u7eed\u8bfb\u53d6, \u5219\u4e0d\u9700\u8981close, \u529f\u8017\u4f1a\u9ad8\u4e00\u70b9.\n", "prefix": "adc.open"}, "adc.setRange": {"body": "adc.setRange(${1:range})", "description": "adc.setRange(range) - \u8bbe\u7f6eADC\u7684\u6d4b\u91cf\u8303\u56f4\uff0c\u6ce8\u610f\u8fd9\u4e2a\u548c\u5177\u4f53\u82af\u7247\u6709\u5173\uff0c\u76ee\u524d\u53ea\u652f\u6301air105/Air780E\u7cfb\u5217\n\u4f20\u5165\u503c\uff1a\nint range\u53c2\u6570,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173,\u6bd4\u5982air105\u586badc.ADC_RANGE_1_8\u548cadc.ADC_RANGE_3_6\nreturn nil\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u8981\u5728\u8c03\u7528adc.open\u4e4b\u524d\u5c31\u8c03\u7528, \u4e4b\u540e\u8c03\u7528\u65e0\u6548!!!\n\n-- \u5173\u95edair105\u5185\u90e8\u5206\u538b\nadc.setRange(adc.ADC_RANGE_1_8)\n-- \u6253\u5f00air105\u5185\u90e8\u5206\u538b\nadc.setRange(adc.ADC_RANGE_3_6)\n\n\n-- EC618\u7cfb\u5217(Air780E\u7b49)/EC718E\u7cfb\u5217(Air780EP/Air780EPV\u7b49)\u652f\u6301\u4ee5\u4e0b2\u79cd\nadc.setRange(adc.ADC_RANGE_1_2) -- \u5173\u95ed\u5206\u538b\nadc.setRange(adc.ADC_RANGE_3_8) -- \u542f\u7528\u5206\u538b\n", "prefix": "adc.setRange"}, "adc.read": {"body": "adc.read(${1:id})", "description": "adc.read(id) - \u8bfb\u53d6adc\u901a\u9053\n\u4f20\u5165\u503c\uff1a\nint \u901a\u9053id,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173,\u901a\u5e38\u4ece0\u5f00\u59cb\n\u8fd4\u56de\u503c\uff1a\nint \u539f\u59cb\u503c,\u4e00\u822c\u6ca1\u7528,\u53ef\u4ee5\u76f4\u63a5\u629b\u5f03\nint \u4ece\u539f\u59cb\u503c\u6362\u7b97\u5f97\u51fa\u7684\u5b9e\u9645\u503c\uff0c\u901a\u5e38\u5355\u4f4d\u662fmV\n\u4f8b\u5b50\uff1a\n-- \u6253\u5f00adc\u901a\u90532,\u5e76\u8bfb\u53d6\nif adc.open(2) then\n -- \u8fd9\u91cc\u4f7f\u7528\u7684\u662fadc.read\u4f1a\u8fd4\u56de2\u4e2a\u503c, \u63a8\u8350\u8d70adc.get\u51fd\u6570,\u76f4\u63a5\u53d6\u5b9e\u9645\u503c\n log.info(\"adc\", adc.read(2))\nend\nadc.close(2)\n", "prefix": "adc.read"}, "adc.get": {"body": "adc.get(${1:id})", "description": "adc.get(id) - \u83b7\u53d6adc\u8ba1\u7b97\u503c\n\u4f20\u5165\u503c\uff1a\nint \u901a\u9053id,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173,\u901a\u5e38\u4ece0\u5f00\u59cb\n\u8fd4\u56de\u503c\uff1a\nint \u5355\u4f4d\u901a\u5e38\u662fmV, \u90e8\u5206\u901a\u9053\u4f1a\u8fd4\u56de\u6e29\u5ea6\u503c,\u5355\u4f4d\u5343\u5206\u4e4b\u4e00\u6444\u6c0f\u5ea6. \u82e5\u8bfb\u53d6\u5931\u8d25,\u4f1a\u8fd4\u56de-1\n\u4f8b\u5b50\uff1a\n-- \u672cAPI \u5728 2022.10.01\u540e\u7f16\u8bd1\u7684\u56fa\u4ef6\u53ef\u7528\n-- \u6253\u5f00adc\u901a\u90532,\u5e76\u8bfb\u53d6\nif adc.open(2) then\n log.info(\"adc\", adc.get(2))\nend\nadc.close(2) -- \u6309\u9700\u5173\u95ed\n", "prefix": "adc.get"}, "adc.close": {"body": "adc.close(${1:id})", "description": "adc.close(id) - \u5173\u95edadc\u901a\u9053\n\u4f20\u5165\u503c\uff1a\nint \u901a\u9053id,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173,\u901a\u5e38\u4ece0\u5f00\u59cb\n\u4f8b\u5b50\uff1a\n-- \u6253\u5f00adc\u901a\u90532,\u5e76\u8bfb\u53d6\nif adc.open(2) then\n log.info(\"adc\", adc.read(2))\nend\nadc.close(2)\n", "prefix": "adc.close"}, "antbot.init": {"body": "antbot.init()", "description": "antbot.init() - \u521d\u59cb\u5316\n\u8fd4\u56de\u503c\uff1a\nint 0:\u6210\u529f \u5176\u4ed6\u503c\u4e3a\u5931\u8d25\n\u4f8b\u5b50\uff1a\n\n-- \u521d\u59cb\u5316\u8682\u8681\u94fe\u7684\u5e95\u5c42\u9002\u914d\nantbot.init()\n", "prefix": "antbot.init"}, "antbot.app_sta_get": {"body": "antbot.app_sta_get()", "description": "antbot.app_sta_get() - \u83b7\u53d6\u5ba2\u6237\u7aef\u72b6\u6001\n\u8fd4\u56de\u503c\uff1a\nint \u72b6\u6001\u7801\n", "prefix": "antbot.app_sta_get"}, "antbot.version_get": {"body": "antbot.version_get()", "description": "antbot.version_get() - \u83b7\u53d6SDK\u7248\u672c\u53f7\n\u8fd4\u56de\u503c\uff1a\nstring \u7248\u672c\u53f7,\u5982\u679c\u83b7\u53d6\u5931\u8d25\u8fd4\u56denil\n", "prefix": "antbot.version_get"}, "antbot.asset_register": {"body": "antbot.asset_register(${1:asset_id},${2:asset_type},${3:asset_dataver})", "description": "antbot.asset_register(asset_id, asset_type, asset_dataver) - asset\u8d44\u6e90\u6ce8\u518c\n\u4f20\u5165\u503c\uff1a\nstring asset_id \u8d44\u6e90ID\nstring asset_type \u8d44\u6e90\u7c7b\u578b\nstring asset_dataver \u8d44\u6e90\u6570\u636e\u7248\u672c\n\u8fd4\u56de\u503c\uff1a\nint 0:\u6210\u529f \u5176\u4ed6\u503c\u4e3a\u5931\u8d25\n", "prefix": "antbot.asset_register"}, "antbot.asset_data_publish": {"body": "antbot.asset_data_publish(${1:data})", "description": "antbot.asset_data_publish(data) - asset\u8d44\u6e90\u53d1\u5e03\n\u4f20\u5165\u503c\uff1a\nstring data \u8d44\u6e90\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nint 0:\u6210\u529f \u5176\u4ed6\u503c\u4e3a\u5931\u8d25\n", "prefix": "antbot.asset_data_publish"}, "antbot.device_status_get": {"body": "antbot.device_status_get()", "description": "antbot.device_status_get() - \u83b7\u53d6\u8bbe\u5907\u72b6\u6001\n\u8fd4\u56de\u503c\uff1a\nint \u8bbe\u5907\u72b6\u6001\n", "prefix": "antbot.device_status_get"}, "antbot.asset_status_get": {"body": "antbot.asset_status_get(${1:asset_id})", "description": "antbot.asset_status_get(asset_id) - \u83b7\u53d6assset\u72b6\u6001\n\u4f20\u5165\u503c\uff1a\nstring asset_id \u8d44\u6e90ID\n\u8fd4\u56de\u503c\uff1a\nint \u8d44\u6e90\u72b6\u6001\n", "prefix": "antbot.asset_status_get"}, "antbot.channel_switch": {"body": "antbot.channel_switch(${1:cmd})", "description": "antbot.channel_switch(cmd) - \u5207\u6362channel\n\u4f20\u5165\u503c\uff1a\nint 0 - \u5173\u95ed, 1 - \u5f00\u542f\n\u8fd4\u56de\u503c\uff1a\nint 0:\u6210\u529f \u5176\u4ed6\u503c\u4e3a\u5931\u8d25\n", "prefix": "antbot.channel_switch"}, "antbot.config_set": {"body": "antbot.config_set(${1:config})", "description": "antbot.config_set(config) - \u914d\u7f6e\u8bbe\u5907\n\u4f20\u5165\u503c\uff1a\nstring config \u914d\u7f6e\u5185\u5bb9\n\u8fd4\u56de\u503c\uff1a\nint 0:\u6210\u529f \u5176\u4ed6\u503c\u4e3a\u5931\u8d25\n", "prefix": "antbot.config_set"}, "antbot.config_get": {"body": "antbot.config_get()", "description": "antbot.config_get() - \u83b7\u53d6\u8bbe\u5907\u914d\u7f6e\n\u8fd4\u56de\u503c\uff1a\nstring \u914d\u7f6e\u5185\u5bb9\n", "prefix": "antbot.config_get"}, "audio.start": {"body": "audio.start(${1:id},${2:audio_format},${3:num_channels},${4:sample_rate},${5:bits_per_sample},${6:is_signed})", "description": "audio.start(id, audio_format, num_channels, sample_rate, bits_per_sample, is_signed) - \u542f\u52a8\u4e00\u4e2a\u591a\u5a92\u4f53\u901a\u9053\u51c6\u5907\u64ad\u653e\u97f3\u9891\n\u4f20\u5165\u503c\uff1a\nint \u591a\u5a92\u4f53\u64ad\u653e\u901a\u9053\u53f7\nint \u97f3\u9891\u683c\u5f0f\nint \u58f0\u97f3\u901a\u9053\u6570\nint \u91c7\u6837\u9891\u7387\nint \u91c7\u6837\u4f4d\u6570\nboolean \u662f\u5426\u6709\u7b26\u53f7\uff0c\u9ed8\u8ba4true\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529ftrue, \u5931\u8d25false\n\u4f8b\u5b50\uff1a\naudio.start(0, audio.PCM, 1, 16000, 16)\n", "prefix": "audio.start"}, "audio.record": {"body": "audio.record(${1:id},${2:record_type},${3:record_time},${4:amr_quailty},${5:path})", "description": "audio.record(id, record_type, record_time, amr_quailty, path) - \u5f55\u97f3\n\u4f20\u5165\u503c\uff1a\nint id \u591a\u5a92\u4f53\u64ad\u653e\u901a\u9053\u53f7\nint record_type \u5f55\u97f3\u97f3\u9891\u683c\u5f0f,\u652f\u6301 audio.AMR audio.PCM (\u90e8\u5206\u5e73\u53f0\u652f\u6301audio.AMR_WB)\nint record_time \u5f55\u5236\u65f6\u957f \u5355\u4f4d\u79d2,\u53ef\u9009\uff0c\u9ed8\u8ba40\u5373\u8868\u793a\u4e00\u76f4\u5f55\u5236\nint amr_quailty \u8d28\u91cf,audio.AMR\u4e0b\u6709\u6548\nstring path \u5f55\u97f3\u6587\u4ef6\u8def\u5f84,\u53ef\u9009,\u4e0d\u6307\u5b9a\u5219\u4e0d\u4fdd\u5b58,\u53ef\u5728audio.on\u56de\u8c03\u51fd\u6570\u4e2d\u5904\u7406\u539f\u59cbPCM\u6570\u636e\nint record_callback_time \u4e0d\u6307\u5b9a\u5f55\u97f3\u6587\u4ef6\u8def\u5f84\u65f6\uff0c\u5355\u6b21\u5f55\u97f3\u56de\u8c03\u65f6\u957f\uff0c\u5355\u4f4d\u662f100ms\u3002\u9ed8\u8ba41\uff0c\u65e2100ms\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nerr,info = audio.record(id, type, record_time, quailty, path)\n", "prefix": "audio.record"}, "audio.recordStop": {"body": "audio.recordStop(${1:id})", "description": "audio.recordStop(id) - \u5f55\u97f3\u505c\u6b62\n\u4f20\u5165\u503c\uff1a\nint id \u591a\u5a92\u4f53\u64ad\u653e\u901a\u9053\u53f7\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\naudio.recordStop(0)\n", "prefix": "audio.recordStop"}, "audio.write": {"body": "audio.write(${1:id},${2:data})", "description": "audio.write(id, data) - \u5f80\u4e00\u4e2a\u591a\u5a92\u4f53\u901a\u9053\u5199\u5165\u97f3\u9891\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring or zbuff \u97f3\u9891\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\naudio.write(0, \"xxxxxx\")\n", "prefix": "audio.write"}, "audio.stop": {"body": "audio.stop(${1:id})", "description": "audio.stop(id) - \u505c\u6b62\u6307\u5b9a\u7684\u591a\u5a92\u4f53\u901a\u9053\n\u4f20\u5165\u503c\uff1a\nint audio id,\u4f8b\u59820\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\naudio.stop(0)\n", "prefix": "audio.stop"}, "audio.pause": {"body": "audio.pause(${1:id},${2:pause})", "description": "audio.pause(id, pause) - \u6682\u505c/\u6062\u590d\u6307\u5b9a\u7684\u591a\u5a92\u4f53\u901a\u9053\n\u4f20\u5165\u503c\uff1a\nint audio id,\u4f8b\u59820\nboolean onoff true \u6682\u505c\uff0cfalse \u6062\u590d\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\naudio.pause(0, true) --\u6682\u505c\u901a\u90530\naudio.pause(0, false) --\u6062\u590d\u901a\u90530\n", "prefix": "audio.pause"}, "audio.on": {"body": "audio.on(${1:audio_id},${2:func})", "description": "audio.on(audio_id, func) - \u6ce8\u518caudio\u64ad\u653e\u4e8b\u4ef6\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nint audio id, audio 0\u51990, audio 1\u51991\nfunction \u56de\u8c03\u65b9\u6cd5\uff0c\u56de\u8c03\u65f6\u4f20\u5165\u53c2\u6570\u4e3a1\u3001int \u901a\u9053ID 2\u3001int \u6d88\u606f\u503c\uff0c\u53ea\u6709audio.MORE_DATA\u548caudio.DONE\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\naudio.on(0, function(audio_id, msg)\n log.info(\"msg\", audio_id, msg)\nend)\n", "prefix": "audio.on"}, "audio.play": {"body": "audio.play(${1:id},${2:path},${3:errStop})", "description": "audio.play(id, path, errStop) - \u64ad\u653e\u6216\u8005\u505c\u6b62\u64ad\u653e\u4e00\u4e2a\u6587\u4ef6\uff0c\u64ad\u653e\u5b8c\u6210\u540e\uff0c\u4f1a\u56de\u8c03\u4e00\u4e2aaudio.DONE\u6d88\u606f\uff0c\u53ef\u4ee5\u7528pause\u6765\u6682\u505c\u6216\u8005\u6062\u590d\uff0c\u5176\u4ed6API\u4e0d\u53ef\u7528\u3002\u8003\u8651\u5230\u8bfbSD\u5361\u901f\u5ea6\u6bd4\u8f83\u6162\u800c\u62d6\u7d2fluavm\u8fdb\u7a0b\u7684\u901f\u5ea6\uff0c\u6240\u4ee5\u5c3d\u91cf\u4f7f\u7528\u672cAPI\n\u4f20\u5165\u503c\uff1a\nint \u97f3\u9891\u901a\u9053\nstring/table \u6587\u4ef6\u540d\uff0c\u5982\u679c\u4e3a\u7a7a\uff0c\u5219\u8868\u793a\u505c\u6b62\u64ad\u653e\uff0c\u5982\u679c\u662ftable\uff0c\u5219\u8868\u793a\u8fde\u7eed\u64ad\u653e\u591a\u4e2a\u6587\u4ef6\uff0c\u4e3b\u8981\u5e94\u7528\u4e8e\u4e91\u5587\u53ed\uff0c\u76ee\u524d\u53ea\u6709EC618\u652f\u6301\uff0c\u5e76\u4e14\u4f1a\u7528\u5230errStop\u53c2\u6570\nboolean \u662f\u5426\u5728\u6587\u4ef6\u89e3\u7801\u5931\u8d25\u540e\u505c\u6b62\u89e3\u7801\uff0c\u53ea\u6709\u5728\u8fde\u7eed\u64ad\u653e\u591a\u4e2a\u6587\u4ef6\u65f6\u624d\u6709\u7528\uff0c\u9ed8\u8ba4true\uff0c\u9047\u5230\u89e3\u7801\u9519\u8bef\u81ea\u52a8\u505c\u6b62\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\naudio.play(0, \"xxxxxx\") --\u5f00\u59cb\u64ad\u653e\u67d0\u4e2a\u6587\u4ef6\naudio.play(0) --\u505c\u6b62\u64ad\u653e\u67d0\u4e2a\u6587\u4ef6\n", "prefix": "audio.play"}, "audio.tts": {"body": "audio.tts(${1:id},${2:data})", "description": "audio.tts(id, data) - TTS\u64ad\u653e\u6216\u8005\u505c\u6b62\n\u4f20\u5165\u503c\uff1a\nint \u97f3\u9891\u901a\u9053\nstring/zbuff \u9700\u8981\u64ad\u653e\u7684\u5185\u5bb9\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n", "prefix": "audio.tts"}, "audio.playStop": {"body": "audio.playStop(${1:id})", "description": "audio.playStop(id) - \u505c\u6b62\u64ad\u653e\u6587\u4ef6\uff0c\u548caudio.play(id)\u662f\u4e00\u6837\u7684\u4f5c\u7528\n\u4f20\u5165\u503c\uff1a\nint audio id,\u4f8b\u59820\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\naudio.playStop(0)\n", "prefix": "audio.playStop"}, "audio.isEnd": {"body": "audio.isEnd(${1:id})", "description": "audio.isEnd(id) - \u68c0\u67e5\u5f53\u524d\u6587\u4ef6\u662f\u5426\u5df2\u7ecf\u64ad\u653e\u7ed3\u675f\n\u4f20\u5165\u503c\uff1a\nint \u97f3\u9891\u901a\u9053\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\naudio.isEnd(0)\n\n", "prefix": "audio.isEnd"}, "audio.getError": {"body": "audio.getError(${1:id})", "description": "audio.getError(id) - \u83b7\u53d6\u6700\u8fd1\u4e00\u6b21\u64ad\u653e\u7ed3\u679c\uff0c\u4e0d\u662f\u6240\u6709\u5e73\u53f0\u90fd\u652f\u6301\u7684\uff0c\u76ee\u524d\u53ea\u6709EC618\u652f\u6301\n\u4f20\u5165\u503c\uff1a\nint \u97f3\u9891\u901a\u9053\n\u8fd4\u56de\u503c\uff1a\nboolean \u662f\u5426\u5168\u90e8\u64ad\u653e\u6210\u529f\uff0ctrue\u6210\u529f\uff0cfalse\u6709\u6587\u4ef6\u64ad\u653e\u5931\u8d25\nboolean \u5982\u679c\u64ad\u653e\u5931\u8d25\uff0c\u662f\u5426\u662f\u7528\u6237\u505c\u6b62\uff0ctrue\u662f\uff0cfalse\u4e0d\u662f\nint \u7b2c\u51e0\u4e2a\u6587\u4ef6\u5931\u8d25\u4e86\uff0c\u4ece1\u5f00\u59cb\n\u4f8b\u5b50\uff1a\nlocal result, user_stop, file_no = audio.getError(0)\n", "prefix": "audio.getError"}, "audio.config": {"body": "audio.config(${1:id},${2:paPin},${3:onLevel},${4:dacDelay},${5:paDelay},${6:dacPin},${7:dacLevel},${8:dacTimeDelay})", "description": "audio.config(id, paPin, onLevel, dacDelay, paDelay, dacPin, dacLevel, dacTimeDelay) - \u914d\u7f6e\u4e00\u4e2a\u97f3\u9891\u901a\u9053\u7684\u7279\u6027\uff0c\u6bd4\u5982\u5b9e\u73b0\u81ea\u52a8\u63a7\u5236PA\u5f00\u5173\u3002\u6ce8\u610f\u8fd9\u4e2a\u4e0d\u662f\u5fc5\u987b\u7684\uff0c\u4e00\u822c\u5728\u8c03\u7528play\u7684\u65f6\u5019\u624d\u9700\u8981\u81ea\u52a8\u63a7\u5236\uff0c\u5176\u4ed6\u60c5\u51b5\u6bd4\u5982\u4f60\u624b\u52a8\u63a7\u5236\u64ad\u653e\u65f6\uff0c\u5c31\u53ef\u4ee5\u81ea\u5df1\u63a7\u5236PA\u5f00\u5173\n\u4f20\u5165\u503c\uff1a\nint \u97f3\u9891\u901a\u9053\nint PA\u63a7\u5236IO\nint PA\u6253\u5f00\u65f6\u7684\u7535\u5e73\nint \u5728DAC\u542f\u52a8\u524d\u63d2\u5165\u7684\u5197\u4f59\u65f6\u95f4\uff0c\u5355\u4f4d100ms\uff0c\u4e00\u822c\u7528\u4e8e\u5916\u90e8DAC\nint \u5728DAC\u542f\u52a8\u540e\uff0c\u5ef6\u8fdf\u591a\u957f\u65f6\u95f4\u6253\u5f00PA\uff0c\u5355\u4f4d1ms\nint \u5916\u90e8dac\u7535\u6e90\u63a7\u5236IO\uff0c\u5982\u679c\u4e0d\u586b\uff0c\u5219\u8868\u793a\u4f7f\u7528\u5e73\u53f0\u9ed8\u8ba4IO\uff0c\u6bd4\u5982Air780E\u4f7f\u7528DACEN\u811a\uff0cair105\u5219\u4e0d\u542f\u7528\nint \u5916\u90e8dac\u6253\u5f00\u65f6\uff0c\u7535\u6e90\u63a7\u5236IO\u7684\u7535\u5e73\uff0c\u9ed8\u8ba4\u62c9\u9ad8\nint \u97f3\u9891\u64ad\u653e\u5b8c\u6bd5\u65f6\uff0cPA\u4e0eDAC\u5173\u95ed\u7684\u65f6\u95f4\u95f4\u9694\uff0c\u5355\u4f4d1ms\uff0c\u9ed8\u8ba40ms\n\u4f8b\u5b50\uff1a\naudio.config(0, pin.PC0, 1) --PA\u63a7\u5236\u811a\u662fPC0\uff0c\u9ad8\u7535\u5e73\u6253\u5f00\uff0cair105\u7528\u8fd9\u4e2a\u914d\u7f6e\u5c31\u53ef\u4ee5\u7528\u4e86\naudio.config(0, 25, 1, 6, 200) --PA\u63a7\u5236\u811a\u662fGPIO25\uff0c\u9ad8\u7535\u5e73\u6253\u5f00\uff0cAir780E\u4e91\u5587\u53ed\u677f\u7528\u8fd9\u4e2a\u914d\u7f6e\u5c31\u53ef\u4ee5\u7528\u4e86\n", "prefix": "audio.config"}, "audio.vol": {"body": "audio.vol(${1:id},${2:value})", "description": "audio.vol(id, value) - \u914d\u7f6e\u4e00\u4e2a\u97f3\u9891\u901a\u9053\u7684\u97f3\u91cf\u8c03\u8282\uff0c\u76f4\u63a5\u5c06\u539f\u59cb\u6570\u636e\u653e\u5927\u6216\u8005\u7f29\u5c0f\uff0c\u4e0d\u662f\u6240\u6709\u5e73\u53f0\u90fd\u652f\u6301\uff0c\u5efa\u8bae\u5c3d\u91cf\u7528\u786c\u4ef6\u65b9\u6cd5\u53bb\u7f29\u653e\n\u4f20\u5165\u503c\uff1a\nint \u97f3\u9891\u901a\u9053\nint \u97f3\u91cf\uff0c\u767e\u5206\u6bd4\uff0c1%~1000%\uff0c\u9ed8\u8ba4100%\uff0c\u5c31\u662f\u4e0d\u8c03\u8282\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524d\u97f3\u91cf\n\u4f8b\u5b50\uff1a\nlocal result = audio.vol(0, 90) --\u901a\u90530\u7684\u97f3\u91cf\u8c03\u8282\u523090%\uff0cresult\u5b58\u653e\u4e86\u8c03\u8282\u540e\u7684\u97f3\u91cf\u6c34\u5e73\uff0c\u6709\u53ef\u80fd\u4ecd\u7136\u662f100\n", "prefix": "audio.vol"}, "audio.micVol": {"body": "audio.micVol(${1:id},${2:value})", "description": "audio.micVol(id, value) - \u914d\u7f6e\u4e00\u4e2a\u97f3\u9891\u901a\u9053\u7684mic\u97f3\u91cf\u8c03\u8282\n\u4f20\u5165\u503c\uff1a\nint \u97f3\u9891\u901a\u9053\nint mic\u97f3\u91cf\uff0c\u767e\u5206\u6bd4\uff0c1%~100%\uff0c\u9ed8\u8ba4100%\uff0c\u5c31\u662f\u4e0d\u8c03\u8282\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524dmic\u97f3\u91cf\n\u4f8b\u5b50\uff1a\nlocal result = audio.vol(0, 90) --\u901a\u90530\u7684\u97f3\u91cf\u8c03\u8282\u523090%\uff0cresult\u5b58\u653e\u4e86\u8c03\u8282\u540e\u7684\u97f3\u91cf\u6c34\u5e73\uff0c\u6709\u53ef\u80fd\u4ecd\u7136\u662f100\n", "prefix": "audio.micVol"}, "audio.setBus": {"body": "audio.setBus(${1:id},${2:bus_type})", "description": "audio.setBus(id, bus_type) - \u914d\u7f6e\u4e00\u4e2a\u97f3\u9891\u901a\u9053\u7684\u786c\u4ef6\u8f93\u51fa\u603b\u7ebf\uff0c\u53ea\u6709\u5bf9\u5e94soc\u8f6f\u786c\u4ef6\u5e73\u53f0\u652f\u6301\u624d\u8bbe\u7f6e\u5bf9\u5e94\u7c7b\u578b\n\u4f20\u5165\u503c\uff1a\nint \u97f3\u9891\u901a\u9053,\u4f8b\u59820\nint \u603b\u7ebf\u7c7b\u578b, \u4f8b\u5982 audio.BUS_SOFT_DAC\nint \u786c\u4ef6id, \u4f8b\u5982 \u603b\u7ebf\u7c7b\u578b\u4e3aaudio.BUS_I2S\u65f6,\u786c\u4ef6id\u5373\u4e3ai2s codec\u7684i2c id\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\naudio.setBus(0, audio.BUS_SOFT_DAC) --\u901a\u90530\u7684\u786c\u4ef6\u8f93\u51fa\u901a\u9053\u8bbe\u7f6e\u4e3a\u8f6f\u4ef6DAC\naudio.setBus(0, audio.BUS_I2S) --\u901a\u90530\u7684\u786c\u4ef6\u8f93\u51fa\u901a\u9053\u8bbe\u7f6e\u4e3aI2S\n", "prefix": "audio.setBus"}, "audio.debug": {"body": "audio.debug(${1:on_off})", "description": "audio.debug(on_off) - \u914d\u7f6e\u8c03\u8bd5\u4fe1\u606f\u8f93\u51fa\n\u4f20\u5165\u503c\uff1a\nboolean true\u5f00 false\u5173\n", "prefix": "audio.debug"}, "audio.pm": {"body": "audio.pm(${1:id},${2:pm_mode})", "description": "audio.pm(id,pm_mode) - audio \u4f11\u7720\u63a7\u5236(\u4e00\u822c\u4f1a\u81ea\u52a8\u8c03\u7528\u4e0d\u9700\u8981\u624b\u52a8\u6267\u884c)\n\u4f20\u5165\u503c\uff1a\nint \u97f3\u9891\u901a\u9053\nint \u4f11\u7720\u6a21\u5f0f \n\u8fd4\u56de\u503c\uff1a\nboolean true\u6210\u529f\n\u4f8b\u5b50\uff1a\naudio.pm(multimedia_id,audio.RESUME)\n", "prefix": "audio.pm"}, "bit64.to32": {"body": "bit64.to32(${1:data64bit})", "description": "bit64.to32(data64bit) - 64bit\u6570\u636e\u8f6c\u621032bit\u8f93\u51fa\n\u4f20\u5165\u503c\uff1a\nstring 9\u5b57\u8282\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nany \u6839\u636e64bit\u6570\u636e\u8f93\u51faint\u6216\u8005number\n", "prefix": "bit64.to32"}, "bit64.to64": {"body": "bit64.to64(${1:data32bit})", "description": "bit64.to64(data32bit) - 32bit\u6570\u636e\u8f6c\u621064bit\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint/number 32bit\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nstring 9\u5b57\u8282\u6570\u636e\n", "prefix": "bit64.to64"}, "bit64.show": {"body": "bit64.show(${1:a},${2:type},${3:flag})", "description": "bit64.show(a,type,flag) - 64bit\u6570\u636e\u683c\u5f0f\u5316\u6253\u5370\u6210\u5b57\u7b26\u4e32\uff0c\u7528\u4e8e\u663e\u793a\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u6253\u5370\u768464bit\u6570\u636e\nint \u8fdb\u5236\uff0c10=10\u8fdb\u5236\uff0c16=16\u8fdb\u5236\uff0c\u9ed8\u8ba410\uff0c\u53ea\u652f\u630110\u6216\u800516\nboolean \u6574\u5f62\u662f\u5426\u6309\u7167\u65e0\u7b26\u53f7\u65b9\u5f0f\u6253\u5370\uff0ctrue\u662f\uff0cfalse\u4e0d\u662f\uff0c\u9ed8\u8ba4false\uff0c\u6d6e\u70b9\u5ffd\u7565\n\u8fd4\u56de\u503c\uff1a\nstring \u53ef\u4ee5\u6253\u5370\u7684\u503c\n", "prefix": "bit64.show"}, "bit64.plus": {"body": "bit64.plus(${1:a},${2:b},${3:flag1},${4:flag2})", "description": "bit64.plus(a,b,flag1,flag2) - 64bit\u6570\u636e\u52a0,a+b,a\u548cb\u4e2d\u6709\u4e00\u4e2a\u4e3a\u6d6e\u70b9\uff0c\u5219\u6309\u7167\u6d6e\u70b9\u8fd0\u7b97\n\u4f20\u5165\u503c\uff1a\nstring a\nstring/int/number b\nboolean \u6574\u5f62\u8fd0\u7b97\u65f6\u662f\u5426\u6309\u7167\u65e0\u7b26\u53f7\u65b9\u5f0f\uff0ctrue\u662f\uff0cfalse\u4e0d\u662f\uff0c\u9ed8\u8ba4false\uff0c\u6d6e\u70b9\u8fd0\u7b97\u5ffd\u7565\nboolean \u6d6e\u70b9\u8fd0\u7b97\u7ed3\u679c\u662f\u5426\u8981\u5f3a\u5236\u8f6c\u6210\u6574\u6570\uff0ctrue\u662f\uff0cfalse\u4e0d\u662f\uff0c\u9ed8\u8ba4false\uff0c\u6574\u5f62\u8fd0\u7b97\u5ffd\u7565\n\u8fd4\u56de\u503c\uff1a\nstring 9\u5b57\u8282\u6570\u636e\n", "prefix": "bit64.plus"}, "bit64.minus": {"body": "bit64.minus(${1:a},${2:b},${3:flag1},${4:flag2})", "description": "bit64.minus(a,b,flag1,flag2) - 64bit\u6570\u636e\u51cf,a-b,a\u548cb\u4e2d\u6709\u4e00\u4e2a\u4e3a\u6d6e\u70b9\uff0c\u5219\u6309\u7167\u6d6e\u70b9\u8fd0\u7b97\n\u4f20\u5165\u503c\uff1a\nstring a\nstring/int/number b\nboolean \u6574\u5f62\u8fd0\u7b97\u65f6\u662f\u5426\u6309\u7167\u65e0\u7b26\u53f7\u65b9\u5f0f\uff0ctrue\u662f\uff0cfalse\u4e0d\u662f\uff0c\u9ed8\u8ba4false\uff0c\u6d6e\u70b9\u8fd0\u7b97\u5ffd\u7565\nboolean \u6d6e\u70b9\u8fd0\u7b97\u7ed3\u679c\u662f\u5426\u8981\u5f3a\u5236\u8f6c\u6210\u6574\u6570\uff0ctrue\u662f\uff0cfalse\u4e0d\u662f\uff0c\u9ed8\u8ba4false\uff0c\u6574\u5f62\u8fd0\u7b97\u5ffd\u7565\n\u8fd4\u56de\u503c\uff1a\nstring 9\u5b57\u8282\u6570\u636e\n", "prefix": "bit64.minus"}, "bit64.multi": {"body": "bit64.multi(${1:a},${2:b},${3:flag1},${4:flag2})", "description": "bit64.multi(a,b,flag1,flag2) - 64bit\u6570\u636e\u4e58,a*b,a\u548cb\u4e2d\u6709\u4e00\u4e2a\u4e3a\u6d6e\u70b9\uff0c\u5219\u6309\u7167\u6d6e\u70b9\u8fd0\u7b97\n\u4f20\u5165\u503c\uff1a\nstring a\nstring/int/number b\nboolean \u6574\u5f62\u8fd0\u7b97\u65f6\u662f\u5426\u6309\u7167\u65e0\u7b26\u53f7\u65b9\u5f0f\uff0ctrue\u662f\uff0cfalse\u4e0d\u662f\uff0c\u9ed8\u8ba4false\uff0c\u6d6e\u70b9\u8fd0\u7b97\u5ffd\u7565\nboolean \u6d6e\u70b9\u8fd0\u7b97\u7ed3\u679c\u662f\u5426\u8981\u5f3a\u5236\u8f6c\u6210\u6574\u6570\uff0ctrue\u662f\uff0cfalse\u4e0d\u662f\uff0c\u9ed8\u8ba4false\uff0c\u6574\u5f62\u8fd0\u7b97\u5ffd\u7565\n\u8fd4\u56de\u503c\uff1a\nstring 9\u5b57\u8282\u6570\u636e\n", "prefix": "bit64.multi"}, "bit64.pide": {"body": "bit64.pide(${1:a},${2:b},${3:flag1},${4:flag2})", "description": "bit64.pide(a,b,flag1,flag2) - 64bit\u6570\u636e\u9664,a/b,a\u548cb\u4e2d\u6709\u4e00\u4e2a\u4e3a\u6d6e\u70b9\uff0c\u5219\u6309\u7167\u6d6e\u70b9\u8fd0\u7b97\n\u4f20\u5165\u503c\uff1a\nstring a\nstring/int/number b\nboolean \u6574\u5f62\u8fd0\u7b97\u65f6\u662f\u5426\u6309\u7167\u65e0\u7b26\u53f7\u65b9\u5f0f\uff0ctrue\u662f\uff0cfalse\u4e0d\u662f\uff0c\u9ed8\u8ba4false\uff0c\u6d6e\u70b9\u8fd0\u7b97\u5ffd\u7565\nboolean \u6d6e\u70b9\u8fd0\u7b97\u7ed3\u679c\u662f\u5426\u8981\u5f3a\u5236\u8f6c\u6210\u6574\u6570\uff0ctrue\u662f\uff0cfalse\u4e0d\u662f\uff0c\u9ed8\u8ba4false\uff0c\u6574\u5f62\u8fd0\u7b97\u5ffd\u7565\n\u8fd4\u56de\u503c\uff1a\nstring 9\u5b57\u8282\u6570\u636e\n", "prefix": "bit64.pide"}, "bit64.shift": {"body": "bit64.shift(${1:a},${2:b},${3:flag})", "description": "bit64.shift(a,b,flag) - 64bit\u6570\u636e\u4f4d\u79fb a>>b \u6216\u8005 a<>\uff0c\u9ed8\u8ba4false\n\u8fd4\u56de\u503c\uff1a\nstring 9\u5b57\u8282\u6570\u636e\n", "prefix": "bit64.shift"}, "bit64.strtoll": {"body": "bit64.strtoll(${1:data},${2:base})", "description": "bit64.strtoll(data, base) - \u5c06\u5b57\u7b26\u4e32\u8f6c\u4e3aLongLong\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u8f6c\u6362\u7684\u6570\u636e,\u5fc5\u987b\u5b58\u5728\nint \u8f6c\u6362\u8fdb\u5236, \u9ed8\u8ba410, \u53ef\u900916\u62168\n\u8fd4\u56de\u503c\uff1a\nstring 9\u5b57\u8282\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e 2023.10.27 \u6dfb\u52a0\n-- \u63d0\u9192, \u5982\u679c\u8f6c\u6362\u5931\u8d25, \u662f\u8fd4\u56de9\u4e2a\u5b57\u8282\u76840x00\nlocal data = bit64.strtoll(\"864040064024194\", 10)\nlog.info(\"data\", data:toHex())\nlog.info(\"data\", bit64.show(data))\n", "prefix": "bit64.strtoll"}, "camera.init": {"body": "camera.init(${1:InitReg_or_cspi_id},${2:cspi_speed},${3:mode},${4:is_msb},${5:rx_bit},${6:seq_type},${7:is_ddr},${8:only_y},${9:scan_mode},${10:w},${11:h})", "description": "camera.init(InitReg_or_cspi_id, cspi_speed, mode, is_msb, rx_bit, seq_type, is_ddr, only_y, scan_mode, w, h) - \u521d\u59cb\u5316\u6444\u50cf\u5934\n\u4f20\u5165\u503c\uff1a\ntable/integer \u5982\u679c\u662ftable,\u5219\u662fDVP\u6444\u50cf\u5934\u7684\u914d\u7f6e\u89c1demo/camera/AIR105,\u540c\u65f6\u5ffd\u7565\u540e\u7eed\u53c2\u6570;\u5982\u679c\u662f\u6570\u5b57,\u5219\u662fcamera spi\u603b\u7ebf\u5e8f\u53f7\nint camera spi\u603b\u7ebf\u901f\u5ea6\nint camera spi\u6a21\u5f0f,0~3\nint \u5b57\u8282\u7684bit\u987a\u5e8f\u662f\u5426\u662fmsb,0\u54261\u662f\nint \u540c\u65f6\u63a5\u6536bit\u6570,1,2,4\nint byte\u5e8f\u5217,0~1\nint \u53cc\u8fb9\u6cbf\u91c7\u6837\u914d\u7f6e,0\u4e0d\u542f\u7528,\u5176\u4ed6\u503c\u6839\u636e\u5b9e\u9645SOC\u51b3\u5b9a\nint \u53ea\u63a5\u6536Y\u5206\u91cf\uff0c0\u4e0d\u542f\u7528\uff0c1\u542f\u7528\uff0c\u626b\u7801\u5fc5\u987b\u542f\u7528\uff0c\u5426\u5219\u4f1a\u5931\u8d25\nint \u5de5\u4f5c\u6a21\u5f0f\uff0ccamera.AUTO\u81ea\u52a8,camera.SCAN\u626b\u7801\nint \u6444\u50cf\u5934\u5bbd\u5ea6\nint \u6444\u50cf\u5934\u9ad8\u5ea6\n\u8fd4\u56de\u503c\uff1a\nint/false \u6210\u529f\u8fd4\u56decamera_id\uff0c\u5931\u8d25\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\ncamera_id = camera.init(GC032A_InitReg)--\u5c4f\u5e55\u8f93\u51fargb\u56fe\u50cf\n--\u521d\u59cb\u5316\u540e\u9700\u8981start\u624d\u5f00\u59cb\u8f93\u51fa/\u626b\u7801\ncamera.start(camera_id)--\u5f00\u59cb\u6307\u5b9a\u7684camera\n", "prefix": "camera.init"}, "camera.on": {"body": "camera.on(${1:id},${2:event},${3:func})", "description": "camera.on(id, event, func) - \u6ce8\u518c\u6444\u50cf\u5934\u4e8b\u4ef6\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nint camera id, camera 0\u51990, camera 1\u51991\nstring \u4e8b\u4ef6\u540d\u79f0\nfunction \u56de\u8c03\u65b9\u6cd5\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\ncamera.on(0, \"scanned\", function(id, str)\n--id int camera id\n--str \u591a\u79cd\u7c7b\u578b false \u6444\u50cf\u5934\u6ca1\u6709\u6b63\u5e38\u5de5\u4f5c\uff0ctrue \u62cd\u7167\u6a21\u5f0f\u4e0b\u62cd\u7167\u6210\u529f\u5e76\u4fdd\u5b58\u5b8c\u6210\uff0c int \u539f\u59cb\u6570\u636e\u6a21\u5f0f\u4e0b\u672c\u6b21\u8fd4\u56de\u7684\u6570\u636e\u5927\u5c0f\uff0c string \u626b\u7801\u6a21\u5f0f\u4e0b\u626b\u7801\u6210\u529f\u540e\u7684\u89e3\u7801\u503c\n print(id, str)\nend)\n", "prefix": "camera.on"}, "camera.start": {"body": "camera.start(${1:id})", "description": "camera.start(id) - \u5f00\u59cb\u6307\u5b9a\u7684camera\n\u4f20\u5165\u503c\uff1a\nint camera id,\u4f8b\u59820\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\ncamera.start(0)\n", "prefix": "camera.start"}, "camera.stop": {"body": "camera.stop(${1:id})", "description": "camera.stop(id) - \u505c\u6b62\u6307\u5b9a\u7684camera\n\u4f20\u5165\u503c\uff1a\nint camera id,\u4f8b\u59820\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\ncamera.stop(0)\n", "prefix": "camera.stop"}, "camera.close": {"body": "camera.close(${1:id})", "description": "camera.close(id) - \u5173\u95ed\u6307\u5b9a\u7684camera\uff0c\u91ca\u653e\u76f8\u5e94\u7684IO\u8d44\u6e90\n\u4f20\u5165\u503c\uff1a\nint camera id,\u4f8b\u59820\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\ncamera.close(0)\n", "prefix": "camera.close"}, "camera.capture": {"body": "camera.capture(${1:id},${2:save_path},${3:quality})", "description": "camera.capture(id, save_path, quality) - camera\u62cd\u7167\n\u4f20\u5165\u503c\uff1a\nint camera id,\u4f8b\u59820\nstring/zbuff/nil save_path,\u6587\u4ef6\u4fdd\u5b58\u8def\u5f84\uff0c\u7a7a\u5219\u5199\u5728\u4e0a\u6b21\u8def\u5f84\u91cc\uff0c\u9ed8\u8ba4\u662f/capture.jpg\uff0c\u5982\u679c\u662fzbuff\uff0c\u5219\u5c06\u56fe\u7247\u4fdd\u5b58\u5728buff\u5185\u4e0d\u5199\u5165\u6587\u4ef6\u7cfb\u7edf\nint quality, jpeg\u538b\u7f29\u8d28\u91cf\uff0c1\u6700\u5dee\uff0c\u5360\u7528\u7a7a\u95f4\u5c0f\uff0c3\u6700\u9ad8\uff0c\u5360\u7528\u7a7a\u95f4\u6700\u5927\u800c\u4e14\u8d39\u65f6\u95f4\uff0c\u9ed8\u8ba41\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse,\u771f\u6b63\u5b8c\u6210\u540e\u901a\u8fc7camera.on\u8bbe\u7f6e\u7684\u56de\u8c03\u51fd\u6570\u56de\u8c03\u63a5\u6536\u5230\u7684\u957f\u5ea6\n\u4f8b\u5b50\uff1a\ncamera.capture(0)\n", "prefix": "camera.capture"}, "camera.video": {"body": "camera.video(${1:id},${2:w},${3:h},${4:out_path})", "description": "camera.video(id, w, h, out_path) - camera\u8f93\u51fa\u89c6\u9891\u6d41\u5230USB\n\u4f20\u5165\u503c\uff1a\nint camera id,\u4f8b\u59820\nint \u5bbd\u5ea6\nint \u9ad8\u5ea6\nint \u8f93\u51fa\u8def\u5f84\uff0c\u76ee\u524d\u53ea\u80fd\u7528\u865a\u62df\u4e32\u53e30\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\ncamera.video(0, 320, 240, uart.VUART_0)\n", "prefix": "camera.video"}, "camera.startRaw": {"body": "camera.startRaw(${1:id},${2:w},${3:h},${4:buff})", "description": "camera.startRaw(id, w, h, buff) - \u542f\u52a8camera\u8f93\u51fa\u539f\u59cb\u6570\u636e\u5230\u7528\u6237\u7684zbuff\u7f13\u5b58\u533a\uff0c\u8f93\u51fa1fps\u540e\u4f1a\u505c\u6b62\uff0c\u5e76\u901a\u8fc7camera.on\u8bbe\u7f6e\u7684\u56de\u8c03\u51fd\u6570\u56de\u8c03\u63a5\u6536\u5230\u7684\u957f\u5ea6\uff0c\u5982\u679c\u9700\u8981\u518d\u6b21\u8f93\u51fa\uff0c\u8bf7\u8c03\u7528camera.getRaw\n\u4f20\u5165\u503c\uff1a\nint camera id,\u4f8b\u59820\nint \u5bbd\u5ea6\nint \u9ad8\u5ea6\nzbuff \u7528\u4e8e\u5b58\u653e\u6570\u636e\u7684\u7f13\u5b58\u533a\uff0c\u5927\u5c0f\u5fc5\u987b\u4e0d\u5c0f\u4e8ew X h X 2 byte\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\ncamera.startRaw(0, 320, 240, buff)\n", "prefix": "camera.startRaw"}, "camera.getRaw": {"body": "camera.getRaw(${1:id})", "description": "camera.getRaw(id) - \u518d\u6b21\u542f\u52a8camera\u8f93\u51fa\u539f\u59cb\u6570\u636e\u5230\u7528\u6237\u7684zbuff\u7f13\u5b58\u533a\uff0c\u8f93\u51fa1fps\u540e\u4f1a\u505c\u6b62\uff0c\u5e76\u901a\u8fc7camera.on\u8bbe\u7f6e\u7684\u56de\u8c03\u51fd\u6570\u56de\u8c03\u63a5\u6536\u5230\u7684\u957f\u5ea6\uff0c\u5982\u679c\u9700\u8981\u518d\u6b21\u8f93\u51fa\uff0c\u8bf7\u7ee7\u7eed\u8c03\u7528\u672cAPI\n\u4f20\u5165\u503c\uff1a\nint camera id,\u4f8b\u59820\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\ncamera.getRaw(0)\n", "prefix": "camera.getRaw"}, "camera.preview": {"body": "camera.preview(${1:id},${2:onoff})", "description": "camera.preview(id, onoff) - \u542f\u505ccamera\u9884\u89c8\u529f\u80fd\uff0c\u76f4\u63a5\u8f93\u51fa\u5230LCD\u4e0a\uff0c\u53ea\u6709\u786c\u4ef6\u652f\u6301\u7684SOC\u53ef\u4ee5\u8fd0\u884c\n\u4f20\u5165\u503c\uff1a\nint camera id,\u4f8b\u59820\nboolean true\u5f00\u542f\uff0cfalse\u505c\u6b62\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\ncamera.preview(1, true)\n", "prefix": "camera.preview"}, "cc.lastNum": {"body": "cc.lastNum()", "description": "cc.lastNum() - \u83b7\u53d6\u6700\u540e\u4e00\u6b21\u901a\u8bdd\u7684\u53f7\u7801\n\u8fd4\u56de\u503c\uff1a\nstring \u83b7\u53d6\u6700\u540e\u4e00\u6b21\u901a\u8bdd\u7684\u53f7\u7801\n", "prefix": "cc.lastNum"}, "cc.dial": {"body": "cc.dial(${1:sim_id},${2:number})", "description": "cc.dial(sim_id, number) - \u62e8\u6253\u7535\u8bdd\n\u4f20\u5165\u503c\uff1a\nnumber sim_id\nstring \u7535\u8bdd\u53f7\u7801\n\u8fd4\u56de\u503c\uff1a\nbool \u62e8\u6253\u7535\u8bdd\u6210\u529f\u4e0e\u5426\n", "prefix": "cc.dial"}, "cc.hangUp": {"body": "cc.hangUp(${1:sim_id})", "description": "cc.hangUp(sim_id) - \u6302\u65ad\u7535\u8bdd\n\u4f20\u5165\u503c\uff1a\nnumber sim_id\n", "prefix": "cc.hangUp"}, "cc.accept": {"body": "cc.accept(${1:sim_id})", "description": "cc.accept(sim_id) - \u63a5\u542c\u7535\u8bdd\n\u4f20\u5165\u503c\uff1a\nnumber sim_id\n\u8fd4\u56de\u503c\uff1a\nbool \u63a5\u542c\u7535\u8bdd\u6210\u529f\u4e0e\u5426\n", "prefix": "cc.accept"}, "cc.init": {"body": "cc.init(${1:multimedia_id})", "description": "cc.init(multimedia_id) - \u521d\u59cb\u5316\u7535\u8bdd\u529f\u80fd\n\u4f20\u5165\u503c\uff1a\nnumber multimedia_id \u591a\u5a92\u4f53id\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\n", "prefix": "cc.init"}, "cc.record": {"body": "cc.record(${1:on_off},${2:upload_zbuff1},${3:upload_zbuff2},${4:download_zbuff1},${5:download_zbuff2})", "description": "cc.record(on_off,upload_zbuff1, upload_zbuff2, download_zbuff1, download_zbuff2) - \u5f55\u97f3\u901a\u8bdd\n\u4f20\u5165\u503c\uff1a\nboolean \u5f00\u542f\u5173\u95ed\u901a\u8bdd\u5f55\u97f3\u529f\u80fd\uff0cfalse\u6216\u8005nil\u5173\u95ed\uff0c\u5176\u4ed6\u5f00\u542f\nzbuff \u4e0a\u884c\u6570\u636e\u4fdd\u5b58\u533a1,zbuff\u521b\u5efa\u65f6\u7684\u7a7a\u95f4\u5bb9\u91cf\u5fc5\u987b\u662f640\u7684\u500d\u6570,\u4e0b\u540c\nzbuff \u4e0a\u884c\u6570\u636e\u4fdd\u5b58\u533a2,\u548c\u4e0a\u884c\u6570\u636e\u4fdd\u5b58\u533a1\u7ec4\u6210\u53cc\u7f13\u51b2\u533a\nzbuff \u4e0b\u884c\u6570\u636e\u4fdd\u5b58\u533a1\nzbuff \u4e0b\u884c\u6570\u636e\u4fdd\u5b58\u533a2,\u548c\u4e0b\u884c\u6570\u636e\u4fdd\u5b58\u533a1\u7ec4\u6210\u53cc\u7f13\u51b2\u533a\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\uff0c\u5982\u679c\u5904\u4e8e\u901a\u8bdd\u72b6\u6001\uff0c\u4f1a\u5931\u8d25\n\u4f8b\u5b50\uff1a\nbuff1 = zbuff.create(6400,0,zbuff.HEAP_AUTO)\nbuff2 = zbuff.create(6400,0,zbuff.HEAP_AUTO)\nbuff3 = zbuff.create(6400,0,zbuff.HEAP_AUTO)\nbuff4 = zbuff.create(6400,0,zbuff.HEAP_AUTO)\ncc.on(\"record\", function(type, buff_point)\n log.info(type, buff_point) -- type==true\u662f\u4e0b\u884c\u6570\u636e\uff0cfalse\u662f\u4e0a\u884c\u6570\u636e buff_point\u6307\u793a\u53cc\u7f13\u5b58\u4e2d\u8fd4\u56de\u4e86\u54ea\u4e00\u4e2a\nend)\ncc.record(true, buff1, buff2, buff3, buff4)\n", "prefix": "cc.record"}, "cc.quality": {"body": "cc.quality()", "description": "cc.quality() - \u83b7\u53d6\u5f53\u524d\u901a\u8bdd\u8d28\u91cf\n\u8fd4\u56de\u503c\uff1a\nint 1\u4e3a\u4f4e\u97f3\u8d28(8K)\uff0c2\u4e3a\u9ad8\u97f3\u8d28(16k)\uff0c0\u6ca1\u6709\u5728\u901a\u8bdd\n", "prefix": "cc.quality"}, "cc.on": {"body": "cc.on(${1:event},${2:func})", "description": "cc.on(event, func) - \u6ce8\u518c\u901a\u8bdd\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nstring \u4e8b\u4ef6\u540d\u79f0 \u97f3\u9891\u5f55\u97f3\u6570\u636e\u4e3a\"record\"\nfunction \u56de\u8c03\u65b9\u6cd5\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\ncc.on(\"record\", function(type, buff_point)\n log.info(type, buff_point) -- type==true\u662f\u4e0b\u884c\u6570\u636e\uff0cfalse\u662f\u4e0a\u884c\u6570\u636e buff_point\u6307\u793a\u53cc\u7f13\u5b58\u4e2d\u8fd4\u56de\u4e86\u54ea\u4e00\u4e2a\nend)\n", "prefix": "cc.on"}, "codec.create": {"body": "codec.create(${1:type},${2:isDecoder},${3:quality})", "description": "codec.create(type, isDecoder, quality) - \u521b\u5efa\u7f16\u89e3\u7801\u7528\u7684codec\n\u4f20\u5165\u503c\uff1a\nint \u591a\u5a92\u4f53\u7c7b\u578b\uff0c\u76ee\u524d\u652f\u6301codec.MP3 codec.AMR\nboolean \u662f\u5426\u662f\u89e3\u7801\u5668\uff0ctrue\u89e3\u7801\u5668\uff0cfalse\u7f16\u7801\u5668\uff0c\u9ed8\u8ba4true\uff0c\u662f\u89e3\u7801\u5668\nint \u7f16\u7801\u7b49\u7ea7\uff0c\u90e8\u5206bsp\u6709\u5185\u90e8\u7f16\u7801\u5668\uff0c\u53ef\u80fd\u9700\u8981\u63d0\u524d\u8f93\u5165\u7f16\u7801\u7b49\u7ea7\uff0c\u6bd4\u5982air780ep\u7684\u5185\u90e8amr\u7f16\u7801\u5668\n\u8fd4\u56de\u503c\uff1a\nuserdata \u6210\u529f\u8fd4\u56de\u4e00\u4e2a\u6570\u636e\u7ed3\u6784,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u521b\u5efa\u89e3\u7801\u5668\nlocal decoder = codec.create(codec.MP3)--\u521b\u5efa\u4e00\u4e2amp3\u7684decoder\n-- \u521b\u5efa\u7f16\u7801\u5668\nlocal encoder = codec.create(codec.AMR, false)--\u521b\u5efa\u4e00\u4e2aamr\u7684encoder\n-- \u521b\u5efa\u7f16\u7801\u5668\nlocal encoder = codec.create(codec.AMR_WB, false, 8)--\u521b\u5efa\u4e00\u4e2aamr-wb\u7684encoder\uff0c\u7f16\u7801\u7b49\u7ea7\u9ed8\u8ba48\n", "prefix": "codec.create"}, "codec.info": {"body": "codec.info(${1:decoder},${2:file_path})", "description": "codec.info(decoder, file_path) - decoder\u4ece\u6587\u4ef6\u4e2d\u89e3\u6790\u51fa\u97f3\u9891\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nuserdata \u89e3\u7801\u7528\u7684decoder\nstring \u6587\u4ef6\u8def\u5f84\n\u8fd4\u56de\u503c\uff1a\nboolean \u662f\u5426\u6210\u529f\u89e3\u6790\nint \u97f3\u9891\u683c\u5f0f\nint \u58f0\u97f3\u901a\u9053\u6570\nint \u91c7\u6837\u9891\u7387\nint \u91c7\u6837\u4f4d\u6570\nboolean \u662f\u5426\u6709\u7b26\u53f7\n\u4f8b\u5b50\uff1a\nlocal result, audio_format, num_channels, sample_rate, bits_per_sample, is_signed= codec.info(coder, \"xxx\")\n", "prefix": "codec.info"}, "codec.data": {"body": "codec.data(${1:decoder},${2:out_buff})", "description": "codec.data(decoder, out_buff) - decoder\u4ece\u6587\u4ef6\u4e2d\u89e3\u6790\u51fa\u539f\u59cb\u97f3\u9891\u6570\u636e\uff0c\u6bd4\u5982\u4eceMP3\u6587\u4ef6\u91cc\u89e3\u6790\u51faPCM\u6570\u636e\uff0c\u8fd9\u91cc\u7684\u6587\u4ef6\u8def\u5f84\u5df2\u7ecf\u5728codec.info\u4f20\u5165\uff0c\u4e0d\u9700\u8981\u518d\u6b21\u4f20\u5165\n\u4f20\u5165\u503c\uff1a\nuserdata \u89e3\u7801\u7528\u7684decoder\nzbuff \u5b58\u653e\u8f93\u51fa\u6570\u636e\u7684zbuff\uff0c\u7a7a\u95f4\u5fc5\u987b\u4e0d\u5c11\u4e8e16KB\nint \u6700\u5c11\u89e3\u7801\u51fa\u591a\u5c11\u5b57\u8282\u7684\u97f3\u9891\u6570\u636e,\u9ed8\u8ba416384\n\u8fd4\u56de\u503c\uff1a\nboolean \u662f\u5426\u6210\u529f\u89e3\u6790\n\u4f8b\u5b50\uff1a\n-- \u5927\u5185\u5b58\u8bbe\u5907\nlocal buff = zbuff.create(16*1024)\nlocal result = codec.data(coder, buff)\n-- \u5c0f\u5185\u5b58\u8bbe\u5907\nlocal buff = zbuff.create(8*1024)\nlocal result = codec.data(coder, buff, 4096)\n", "prefix": "codec.data"}, "codec.encode": {"body": "codec.encode(${1:coder},${2:in_buffer},${3:out_buffer},${4:mode})", "description": "codec.encode(coder, in_buffer, out_buffer, mode) - \u7f16\u7801\u97f3\u9891\u6570\u636e\uff0c\u7531\u4e8eflash\u548cram\u7a7a\u95f4\u4e00\u822c\u6bd4\u8f83\u6709\u9650\uff0c\u9664\u4e86\u90e8\u5206bsp\u6709\u5185\u90e8amr\u7f16\u7801\u529f\u80fd\uff0c\u76ee\u524d\u53ea\u652f\u6301amr-nb\u7f16\u7801\n\u4f20\u5165\u503c\uff1a\nuserdata codec.create\u521b\u5efa\u7684\u7f16\u89e3\u7801\u7528\u7684coder\nzbuff \u8f93\u5165\u7684\u6570\u636e,zbuff\u5f62\u5f0f,\u4ece0\u5230used\nzbuff \u8f93\u51fa\u7684\u6570\u636e,zbuff\u5f62\u5f0f,\u81ea\u52a8\u6dfb\u52a0\u5230buff\u7684\u5c3e\u90e8,\u5982\u679c\u7a7a\u95f4\u5927\u5c0f\u4e0d\u8db3,\u4f1a\u81ea\u52a8\u6269\u5c55,\u4f46\u662f\u4f1a\u989d\u5916\u6d88\u8017\u65f6\u95f4,\u751a\u81f3\u4f1a\u5931\u8d25,\u6240\u4ee5\u5c3d\u91cf\u4e00\u5f00\u59cb\u5c31\u7ed9\u8db3\u7a7a\u95f4\nint amr_nb\u7684\u7f16\u7801\u7b49\u7ea7 0~7(\u5373 MR475~MR122)\u503c\u8d8a\u5927\u6d88\u8017\u7684\u7a7a\u95f4\u8d8a\u591a,\u97f3\u8d28\u8d8a\u9ad8,\u9ed8\u8ba40 amr_wb\u7684\u7f16\u7801\u7b49\u7ea7 0~8,\u503c\u8d8a\u5927\u6d88\u8017\u7684\u7a7a\u95f4\u8d8a\u591a,\u97f3\u8d28\u8d8a\u9ad8,\u9ed8\u8ba40\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5931\u8d25\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\ncodec.encode(amr_coder, inbuf, outbuf, codec.AMR_)\n", "prefix": "codec.encode"}, "codec.release": {"body": "codec.release(${1:coder})", "description": "codec.release(coder) - \u91ca\u653e\u7f16\u89e3\u7801\u7528\u7684coder\n\u4f20\u5165\u503c\uff1a\ncoder codec.create\u521b\u5efa\u7684\u7f16\u89e3\u7801\u7528\u7684coder\n\u4f8b\u5b50\uff1a\ncodec.release(coder)\n", "prefix": "codec.release"}, "coremark.run": {"body": "coremark.run()", "description": "coremark.run() - \u5f00\u59cb\u8dd1\u5206\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c,\u7ed3\u679c\u76f4\u63a5\u6253\u5370\u5728\u65e5\u5fd7\u4e2d\n\u4f8b\u5b50\uff1a\n-- \u5927\u90e8\u5206\u60c5\u51b5\u4e0b, \u8fd9\u4e2a\u5e93\u90fd\u4e0d\u4f1a\u5305\u542b\u5728\u6b63\u5f0f\u7248\u56fa\u4ef6\u91cc\n-- \u82e5\u9700\u4f7f\u7528,\u53ef\u4ee5\u53c2\u8003wiki\u6587\u6863\u81ea\u884c\u7f16\u8bd1\u6216\u4f7f\u7528\u4e91\u7f16\u8bd1\n-- https://wiki.luatos.com/develop/compile.html\n\n-- \u8dd1\u5206\u7684main.lua \u5e94\u79fb\u9664\u786c\u72d7\u4ee3\u7801, \u9632\u6b62\u91cd\u542f\n-- \u82e5\u8bbe\u5907\u652f\u6301\u81ea\u52a8\u4f11\u7720, \u5e94\u5173\u95ed\u4f11\u7720\u529f\u80fd\n-- \u82e5\u8bbe\u5907\u652f\u6301\u66f4\u591a\u7684\u9891\u7387\u8fd0\u884c, \u5efa\u8bae\u8bbe\u7f6e\u5230\u6700\u9ad8\u9891\u7387\n-- \u4f7f\u7528 -O3 \u6bd4 -O2 -Os \u7684\u5206\u6570\u66f4\u9ad8, \u901a\u5e38\u60c5\u51b5\u4e0b\n\n-- \u4f1a\u4e00\u76f4\u72ec\u5360\u7ebf\u7a0b\u5230\u6267\u884c\u5b8c\u6bd5, \u7136\u540e\u5728\u63a7\u5236\u53f0\u8f93\u51fa\u7ed3\u679c\ncoremark.run()\n\n-- \u8dd1\u5206\u56fe\u4e00\u4e50^_^\n\n", "prefix": "coremark.run"}, "crypto.md5": {"body": "crypto.md5(${1:str})", "description": "crypto.md5(str) - \u8ba1\u7b97md5\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8ba1\u7b97\u7684\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nstring \u8ba1\u7b97\u5f97\u51fa\u7684md5\u503c\u7684hex\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97\u5b57\u7b26\u4e32\"abc\"\u7684md5\nlog.info(\"md5\", crypto.md5(\"abc\"))\n", "prefix": "crypto.md5"}, "crypto.hmac_md5": {"body": "crypto.hmac_md5(${1:str},${2:key})", "description": "crypto.hmac_md5(str, key) - \u8ba1\u7b97hmac_md5\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8ba1\u7b97\u7684\u5b57\u7b26\u4e32\nstring \u5bc6\u94a5\n\u8fd4\u56de\u503c\uff1a\nstring \u8ba1\u7b97\u5f97\u51fa\u7684hmac_md5\u503c\u7684hex\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97\u5b57\u7b26\u4e32\"abc\"\u7684hmac_md5\nlog.info(\"hmac_md5\", crypto.hmac_md5(\"abc\", \"1234567890\"))\n", "prefix": "crypto.hmac_md5"}, "crypto.sha1": {"body": "crypto.sha1(${1:str})", "description": "crypto.sha1(str) - \u8ba1\u7b97sha1\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8ba1\u7b97\u7684\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nstring \u8ba1\u7b97\u5f97\u51fa\u7684sha1\u503c\u7684hex\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97\u5b57\u7b26\u4e32\"abc\"\u7684sha1\nlog.info(\"sha1\", crypto.sha1(\"abc\"))\n", "prefix": "crypto.sha1"}, "crypto.hmac_sha1": {"body": "crypto.hmac_sha1(${1:str},${2:key})", "description": "crypto.hmac_sha1(str, key) - \u8ba1\u7b97hmac_sha1\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8ba1\u7b97\u7684\u5b57\u7b26\u4e32\nstring \u5bc6\u94a5\n\u8fd4\u56de\u503c\uff1a\nstring \u8ba1\u7b97\u5f97\u51fa\u7684hmac_sha1\u503c\u7684hex\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97\u5b57\u7b26\u4e32\"abc\"\u7684hmac_sha1\nlog.info(\"hmac_sha1\", crypto.hmac_sha1(\"abc\", \"1234567890\"))\n", "prefix": "crypto.hmac_sha1"}, "crypto.sha256": {"body": "crypto.sha256(${1:str})", "description": "crypto.sha256(str) - \u8ba1\u7b97sha256\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8ba1\u7b97\u7684\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nstring \u8ba1\u7b97\u5f97\u51fa\u7684sha256\u503c\u7684hex\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97\u5b57\u7b26\u4e32\"abc\"\u7684sha256\nlog.info(\"sha256\", crypto.sha256(\"abc\"))\n", "prefix": "crypto.sha256"}, "crypto.hmac_sha256": {"body": "crypto.hmac_sha256(${1:str},${2:key})", "description": "crypto.hmac_sha256(str, key) - \u8ba1\u7b97hmac_sha256\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8ba1\u7b97\u7684\u5b57\u7b26\u4e32\nstring \u5bc6\u94a5\n\u8fd4\u56de\u503c\uff1a\nstring \u8ba1\u7b97\u5f97\u51fa\u7684hmac_sha256\u503c\u7684hex\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97\u5b57\u7b26\u4e32\"abc\"\u7684hmac_sha256\nlog.info(\"hmac_sha256\", crypto.hmac_sha256(\"abc\", \"1234567890\"))\n", "prefix": "crypto.hmac_sha256"}, "crypto.sha512": {"body": "crypto.sha512(${1:str})", "description": "crypto.sha512(str) - \u8ba1\u7b97sha512\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8ba1\u7b97\u7684\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nstring \u8ba1\u7b97\u5f97\u51fa\u7684sha512\u503c\u7684hex\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97\u5b57\u7b26\u4e32\"abc\"\u7684sha512\nlog.info(\"sha512\", crypto.sha512(\"abc\"))\n", "prefix": "crypto.sha512"}, "crypto.hmac_sha512": {"body": "crypto.hmac_sha512(${1:str},${2:key})", "description": "crypto.hmac_sha512(str, key) - \u8ba1\u7b97hmac_sha512\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8ba1\u7b97\u7684\u5b57\u7b26\u4e32\nstring \u5bc6\u94a5\n\u8fd4\u56de\u503c\uff1a\nstring \u8ba1\u7b97\u5f97\u51fa\u7684hmac_sha512\u503c\u7684hex\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97\u5b57\u7b26\u4e32\"abc\"\u7684hmac_sha512\nlog.info(\"hmac_sha512\", crypto.hmac_sha512(\"abc\", \"1234567890\"))\n", "prefix": "crypto.hmac_sha512"}, "crypto.cipher_encrypt": {"body": "crypto.cipher_encrypt(${1:type},${2:padding},${3:str},${4:key},${5:iv})", "description": "crypto.cipher_encrypt(type, padding, str, key, iv) - \u5bf9\u79f0\u52a0\u5bc6\n\u4f20\u5165\u503c\uff1a\nstring \u7b97\u6cd5\u540d\u79f0, \u4f8b\u5982 AES-128-ECB/AES-128-CBC, \u53ef\u67e5\u9605crypto.cipher_list()\nstring \u5bf9\u9f50\u65b9\u5f0f, \u652f\u6301PKCS7/ZERO/ONE_AND_ZEROS/ZEROS_AND_LEN/NONE\nstring \u9700\u8981\u52a0\u5bc6\u7684\u6570\u636e\nstring \u5bc6\u94a5,\u9700\u8981\u5bf9\u5e94\u7b97\u6cd5\u7684\u5bc6\u94a5\u957f\u5ea6\nstring IV\u503c, \u975eECB\u7b97\u6cd5\u9700\u8981\n\u8fd4\u56de\u503c\uff1a\nstring \u52a0\u5bc6\u540e\u7684\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97AES\nlocal data = crypto.cipher_encrypt(\"AES-128-ECB\", \"PKCS7\", \"1234567890123456\", \"1234567890123456\")\nlocal data2 = crypto.cipher_encrypt(\"AES-128-CBC\", \"PKCS7\", \"1234567890123456\", \"1234567890123456\", \"1234567890666666\")\n", "prefix": "crypto.cipher_encrypt"}, "crypto.cipher_decrypt": {"body": "crypto.cipher_decrypt(${1:type},${2:padding},${3:str},${4:key},${5:iv})", "description": "crypto.cipher_decrypt(type, padding, str, key, iv) - \u5bf9\u79f0\u89e3\u5bc6\n\u4f20\u5165\u503c\uff1a\nstring \u7b97\u6cd5\u540d\u79f0, \u4f8b\u5982 AES-128-ECB/AES-128-CBC, \u53ef\u67e5\u9605crypto.cipher_list()\nstring \u5bf9\u9f50\u65b9\u5f0f, \u652f\u6301PKCS7/ZERO/ONE_AND_ZEROS/ZEROS_AND_LEN/NONE\nstring \u9700\u8981\u89e3\u5bc6\u7684\u6570\u636e\nstring \u5bc6\u94a5,\u9700\u8981\u5bf9\u5e94\u7b97\u6cd5\u7684\u5bc6\u94a5\u957f\u5ea6\nstring IV\u503c, \u975eECB\u7b97\u6cd5\u9700\u8981\n\u8fd4\u56de\u503c\uff1a\nstring \u89e3\u5bc6\u540e\u7684\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u7528AES\u52a0\u5bc6,\u7136\u540e\u7528AES\u89e3\u5bc6\nlocal data = crypto.cipher_encrypt(\"AES-128-ECB\", \"PKCS7\", \"1234567890123456\", \"1234567890123456\")\nlocal data2 = crypto.cipher_decrypt(\"AES-128-ECB\", \"PKCS7\", data, \"1234567890123456\")\n-- data\u7684hex\u4e3a 757CCD0CDC5C90EADBEEECF638DD0000\n-- data2\u7684\u503c\u4e3a 1234567890123456\n", "prefix": "crypto.cipher_decrypt"}, "crypto.crc16": {"body": "crypto.crc16(${1:method},${2:data},${3:poly},${4:initial},${5:finally},${6:inReversemoutReverse})", "description": "crypto.crc16(method, data, poly, initial, finally, inReversem outReverse) - \u8ba1\u7b97CRC16\n\u4f20\u5165\u503c\uff1a\nstring CRC16\u6a21\u5f0f\uff08\"IBM\",\"MAXIM\",\"USB\",\"MODBUS\",\"CCITT\",\"CCITT-FALSE\",\"X25\",\"XMODEM\",\"DNP\",\"USER-DEFINED\"\uff09\nstring \u5b57\u7b26\u4e32\nint poly\u503c\nint initial\u503c\nint finally\u503c\nint \u8f93\u5165\u53cd\u8f6c,1\u53cd\u8f6c,\u9ed8\u8ba40\u4e0d\u53cd\u8f6c\nint \u8f93\u5165\u53cd\u8f6c,1\u53cd\u8f6c,\u9ed8\u8ba40\u4e0d\u53cd\u8f6c\n\u8fd4\u56de\u503c\uff1a\nint \u5bf9\u5e94\u7684CRC16\u503c\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97CRC16\nlocal crc = crypto.crc16(\"\")\n", "prefix": "crypto.crc16"}, "crypto.crc16_modbus": {"body": "crypto.crc16_modbus(${1:data},${2:start})", "description": "crypto.crc16_modbus(data, start) - \u76f4\u63a5\u8ba1\u7b97modbus\u7684crc16\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u6570\u636e\nint \u521d\u59cb\u5316\u503c,\u9ed8\u8ba40xFFFF\n\u8fd4\u56de\u503c\uff1a\nint \u5bf9\u5e94\u7684CRC16\u503c\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97CRC16 modbus\nlocal crc = crypto.crc16_modbus(data)\n-- 2023.11.06 \u65b0\u589e\u521d\u59cb\u503c\u8bbe\u7f6e\ncrc = crypto.crc16_modbus(data, 0xFFFF)\n", "prefix": "crypto.crc16_modbus"}, "crypto.crc32": {"body": "crypto.crc32(${1:data})", "description": "crypto.crc32(data) - \u8ba1\u7b97crc32\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nint \u5bf9\u5e94\u7684CRC32\u503c\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97CRC32\nlocal crc = crypto.crc32(data)\n", "prefix": "crypto.crc32"}, "crypto.crc8": {"body": "crypto.crc8(${1:data},${2:poly},${3:start},${4:revert})", "description": "crypto.crc8(data, poly, start, revert) - \u8ba1\u7b97crc8\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u6570\u636e\nint crc\u591a\u9879\u5f0f\uff0c\u53ef\u9009\uff0c\u5982\u679c\u4e0d\u5199\uff0c\u5c06\u5ffd\u7565\u9664\u4e86\u6570\u636e\u5916\u6240\u6709\u53c2\u6570\nint crc\u521d\u59cb\u503c\uff0c\u53ef\u9009\uff0c\u9ed8\u8ba40\nboolean \u662f\u5426\u9700\u8981\u9006\u5e8f\u5904\u7406\uff0c\u9ed8\u8ba4\u5426\n\u8fd4\u56de\u503c\uff1a\nint \u5bf9\u5e94\u7684CRC8\u503c\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97CRC8\nlocal crc = crypto.crc8(data)\nlocal crc = crypto.crc8(data, 0x31, 0xff, false)\n", "prefix": "crypto.crc8"}, "crypto.crc7": {"body": "crypto.crc7(${1:data},${2:poly},${3:start})", "description": "crypto.crc7(data, poly, start) - \u8ba1\u7b97crc7\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u6570\u636e\nint crc\u591a\u9879\u5f0f\uff0c\u53ef\u9009\uff0c\u9ed8\u8ba40xE5\nint crc\u521d\u59cb\u503c\uff0c\u53ef\u9009\uff0c\u9ed8\u8ba40x00\n\u8fd4\u56de\u503c\uff1a\nint \u5bf9\u5e94\u7684CRC7\u503c\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97CRC7, \u672cAPI\u4e8e2023.10.07\u65b0\u589e\nlocal crc = crypto.crc7(data)\nlocal crc = crypto.crc7(data, 0x31, 0xff)\n", "prefix": "crypto.crc7"}, "crypto.trng": {"body": "crypto.trng(${1:len})", "description": "crypto.trng(len) - \u751f\u6210\u771f\u968f\u673a\u6570\n\u4f20\u5165\u503c\uff1a\nint \u6570\u636e\u957f\u5ea6\n\u8fd4\u56de\u503c\uff1a\nstring \u6307\u5b9a\u968f\u673a\u6570\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u751f\u621032\u4f4d\u968f\u673a\u6570ir\nlocal r = crypto.trng(4)\nlocal _, ir = pack.unpack(r, \"I\")\n", "prefix": "crypto.trng"}, "crypto.totp": {"body": "crypto.totp(${1:secret},${2:time})", "description": "crypto.totp(secret,time) - \u8ba1\u7b97TOTP\u52a8\u6001\u5bc6\u7801\u7684\u7ed3\u679c\n\u4f20\u5165\u503c\uff1a\nstring \u7f51\u7ad9\u63d0\u4f9b\u7684\u5bc6\u94a5\uff08\u5c31\u662fBASE32\u7f16\u7801\u540e\u7684\u7ed3\u679c\uff09\nint \u53ef\u9009\uff0c\u65f6\u95f4\u6233\uff0c\u9ed8\u8ba4\u5f53\u524d\u65f6\u95f4\n\u8fd4\u56de\u503c\uff1a\nint \u8ba1\u7b97\u5f97\u51fa\u7684\u516d\u4f4d\u6570\u7ed3\u679c \u8ba1\u7b97\u5931\u8d25\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n--\u4f7f\u7528\u5f53\u524d\u7cfb\u7edf\u65f6\u95f4\u8ba1\u7b97\nlocal otp = crypto.totp(\"asdfassdfasdfass\")\n", "prefix": "crypto.totp"}, "crypto.base64_encode": {"body": "crypto.base64_encode(${1:data})", "description": "crypto.base64_encode(data) - \u5c06\u6570\u636e\u8fdb\u884cbase64\u7f16\u7801\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u7f16\u7801\u7684\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nstring \u7f16\u7801\u540e\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u4e0e string.toBase64 \u662f\u540c\u4e00\u4e2a\nlocal data = \"123\"\nlocal bdata = crypto.base64_encode(data)\nlog.info(\"base64\", \"encode\", data, bdata)\ndata = crypto.base64_decode(data)\nlog.info(\"base64\", \"decode\", data, bdata)\n", "prefix": "crypto.base64_encode"}, "crypto.base64_decode": {"body": "crypto.base64_decode(${1:data})", "description": "crypto.base64_decode(data) - \u5c06\u6570\u636e\u8fdb\u884cbase64\u89e3\u7801\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u89e3\u7801\u7684\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nstring \u89e3\u7801\u540e\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u4e0e string.fromBase64 \u662f\u540c\u4e00\u4e2a\nlocal data = \"123\"\nlocal bdata = crypto.base64_encode(data)\nlog.info(\"base64\", \"encode\", data, bdata)\ndata = crypto.base64_decode(data)\nlog.info(\"base64\", \"decode\", data, bdata)\n", "prefix": "crypto.base64_decode"}, "crypto.cipher_list": {"body": "crypto.cipher_list()", "description": "crypto.cipher_list() - \u83b7\u53d6\u5f53\u524d\u56fa\u4ef6\u652f\u6301\u7684cipher\u5217\u8868\n\u8fd4\u56de\u503c\uff1a\ntable \u672c\u56fa\u4ef6\u652f\u6301\u7684cipher\u5217\u8868,\u5b57\u7b26\u4e32\u6570\u7ec4\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e2022.07.27\u6dfb\u52a0\nlocal ciphers = crypto.cipher_list()\nif ciphers then\n log.info(\"crypto\", \"ciphers list\", json.encode(ciphers))\nend\n", "prefix": "crypto.cipher_list"}, "crypto.cipher_suites": {"body": "crypto.cipher_suites()", "description": "crypto.cipher_suites() - \u83b7\u53d6\u5f53\u524d\u56fa\u4ef6\u652f\u6301\u7684cipher suites\u5217\u8868\n\u8fd4\u56de\u503c\uff1a\ntable \u672c\u56fa\u4ef6\u652f\u6301\u7684cipher suites\u5217\u8868,\u5b57\u7b26\u4e32\u6570\u7ec4\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e2022.11.16\u6dfb\u52a0\nlocal suites = crypto.cipher_suites()\nif suites then\n log.info(\"crypto\", \"ciphers suites\", json.encode(suites))\nend\n", "prefix": "crypto.cipher_suites"}, "crypto.md_file": {"body": "crypto.md_file(${1:tp},${2:path},${3:hmac})", "description": "crypto.md_file(tp, path, hmac) - \u8ba1\u7b97\u6587\u4ef6\u7684hash\u503c(md5/sha1/sha256\u53cahmac\u5f62\u5f0f)\n\u4f20\u5165\u503c\uff1a\nstring hash\u7c7b\u578b, \u5927\u5c0f\u5b57\u6bcd, \u4f8b\u5982 \"MD5\" \"SHA1\" \"SHA256\"\nstring \u6587\u4ef6\u8def\u5f84, \u4f8b\u5982 /luadb/logo.jpg\nstring hmac\u503c,\u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nstring HEX\u8fc7\u7684hash\u503c,\u82e5\u5931\u8d25\u4f1a\u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n\n-- \u65e0hmac\u7684hash\u503c\nlog.info(\"md5\", crypto.md_file(\"MD5\", \"/luadb/logo.jpg\"))\nlog.info(\"sha1\", crypto.md_file(\"SHA1\", \"/luadb/logo.jpg\"))\nlog.info(\"sha256\", crypto.md_file(\"SHA256\", \"/luadb/logo.jpg\"))\n\n-- \u5e26hmac\u7684hash\u503c\nlog.info(\"hmac_md5\", crypto.md_file(\"MD5\", \"/luadb/logo.jpg\", \"123456\"))\nlog.info(\"hmac_sha1\", crypto.md_file(\"SHA1\", \"/luadb/logo.jpg\", \"123456\"))\nlog.info(\"hmac_sha256\", crypto.md_file(\"SHA256\", \"/luadb/logo.jpg\", \"123456\"))\n", "prefix": "crypto.md_file"}, "crypto.md": {"body": "crypto.md(${1:tp},${2:data},${3:hmac})", "description": "crypto.md(tp, data, hmac) - \u8ba1\u7b97\u6570\u636e\u7684hash\u503c(md5/sha1/sha256\u53cahmac\u5f62\u5f0f)\n\u4f20\u5165\u503c\uff1a\nstring hash\u7c7b\u578b, \u5927\u5c0f\u5b57\u6bcd, \u4f8b\u5982 \"MD5\" \"SHA1\" \"SHA256\"\nstring \u5f85\u5904\u7406\u7684\u6570\u636e\nstring hmac\u503c,\u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nstring HEX\u8fc7\u7684hash\u503c,\u82e5\u5931\u8d25\u4f1a\u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n\n-- \u65e0hmac\u7684hash\u503c\nlog.info(\"md5\", crypto.md(\"MD5\", \"1234567890\"))\nlog.info(\"sha1\", crypto.md(\"SHA1\", \"1234567890\"))\nlog.info(\"sha256\", crypto.md(\"SHA256\", \"1234567890\"))\n\n-- \u5e26hmac\u7684hash\u503c\nlog.info(\"hmac_md5\", crypto.md(\"MD5\", \"1234567890\", \"123456\"))\nlog.info(\"hmac_sha1\", crypto.md(\"SHA1\", \"1234567890\", \"123456\"))\nlog.info(\"hmac_sha256\", crypto.md(\"SHA256\", \"1234567890\", \"123456\"))\n", "prefix": "crypto.md"}, "crypto.hash_init": {"body": "crypto.hash_init(${1:tp})", "description": "crypto.hash_init(tp) - \u521b\u5efa\u6d41\u5f0fhash\u7528\u7684stream\n\u4f20\u5165\u503c\uff1a\nstring hash\u7c7b\u578b, \u5927\u5199\u5b57\u6bcd, \u4f8b\u5982 \"MD5\" \"SHA1\" \"SHA256\"\nstring hmac\u503c\uff0c\u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nuserdata \u6210\u529f\u8fd4\u56de\u4e00\u4e2a\u6570\u636e\u7ed3\u6784,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u65e0hmac\u7684hash stream\nlocal md5_stream = crypto.hash_init(\"MD5\")\nlocal sha1_stream = crypto.hash_init(\"SHA1\")\nlocal sha256_stream = crypto.hash_init(\"SHA256\")\n\n-- \u5e26hmac\u7684hash stream\nlocal md5_stream = crypto.hash_init(\"MD5\", \"123456\")\nlocal sha1_stream = crypto.hash_init(\"SHA1\", \"123456\")\nlocal sha256_stream = crypto.hash_init(\"SHA256\", \"123456\")\n", "prefix": "crypto.hash_init"}, "crypto.hash_update": {"body": "crypto.hash_update(${1:stream},${2:data})", "description": "crypto.hash_update(stream, data) - \u6d41\u5f0fhash\u66f4\u65b0\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nuserdata crypto.hash_init()\u521b\u5efa\u7684stream, \u5fc5\u9009\nstring \u5f85\u8ba1\u7b97\u7684\u6570\u636e,\u5fc5\u9009\nreturn \u65e0\n\u4f8b\u5b50\uff1a\ncrypto.hash_update(stream, \"OK\")\n", "prefix": "crypto.hash_update"}, "crypto.hash_finish": {"body": "crypto.hash_finish(${1:stream})", "description": "crypto.hash_finish(stream) - \u83b7\u53d6\u6d41\u5f0fhash\u6821\u9a8c\u503c\u5e76\u91ca\u653e\u521b\u5efa\u7684stream\n\u4f20\u5165\u503c\uff1a\nuserdata crypto.hash_init()\u521b\u5efa\u7684stream,\u5fc5\u9009\n\u8fd4\u56de\u503c\uff1a\nstring \u6210\u529f\u8fd4\u56de\u8ba1\u7b97\u5f97\u51fa\u7684\u6d41\u5f0fhash\u503c\u7684hex\u5b57\u7b26\u4e32\uff0c\u5931\u8d25\u65e0\u8fd4\u56de\n\u4f8b\u5b50\uff1a\nlocal hashResult = crypto.hash_finish(stream)\n", "prefix": "crypto.hash_finish"}, "crypto.checksum": {"body": "crypto.checksum(${1:data},${2:mode})", "description": "crypto.checksum(data, mode) - \u8ba1\u7b97checksum\u6821\u9a8c\u548c\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u8ba1\u7b97\u7684\u6570\u636e,\u5fc5\u9009\nint \u6a21\u5f0f,\u7d2f\u52a0\u6a21\u5f0f, 0 - \u5f02\u6216, 1 - \u7d2f\u52a0, \u9ed8\u8ba4\u4e3a0\n\u8fd4\u56de\u503c\uff1a\nint checksum\u503c,\u6821\u9a8c\u548c\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5728 2022.12.28 \u6dfb\u52a0\n-- \u5355\u7eaf\u8ba1\u7b97checksum\u503c\nlocal ck = crypto.checksum(\"OK\")\nlog.info(\"checksum\", \"ok\", string.format(\"%02X\", ck))\n-- \u7b2c\u4e8c\u4e2a\u53c2\u6570mode\u57282023.5.23\u65e5\u6dfb\u52a0\n", "prefix": "crypto.checksum"}, "dac.open": {"body": "dac.open(${1:ch},${2:freq},${3:mode})", "description": "dac.open(ch, freq, mode) - \u6253\u5f00DAC\u901a\u9053,\u5e76\u914d\u7f6e\u53c2\u6570\n\u4f20\u5165\u503c\uff1a\nint \u901a\u9053\u7f16\u53f7,\u4f8b\u59820\nint \u8f93\u51fa\u9891\u7387,\u5355\u4f4dhz\nint \u6a21\u5f0f,\u9ed8\u8ba4\u4e3a0,\u9884\u7559\n\u8fd4\u56de\u503c\uff1a\ntrue \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\nint \u5e95\u5c42\u8fd4\u56de\u503c,\u8c03\u8bd5\u7528\n\u4f8b\u5b50\uff1a\nif dac.open(0, 44000) then\n log.info(\"dac\", \"dac ch0 is opened\")\nend\n\n", "prefix": "dac.open"}, "dac.write": {"body": "dac.write(${1:ch},${2:data})", "description": "dac.write(ch, data) - \u4ece\u6307\u5b9aDAC\u901a\u9053\u8f93\u51fa\u4e00\u6bb5\u6ce2\u5f62,\u6216\u8005\u5355\u4e2a\u503c\n\u4f20\u5165\u503c\uff1a\nint \u901a\u9053\u7f16\u53f7,\u4f8b\u59820\nstring \u82e5\u8f93\u51fa\u56fa\u5b9a\u503c,\u53ef\u4ee5\u586b\u6570\u503c, \u82e5\u8f93\u51fa\u6ce2\u5f62,\u586bstring\n\u8fd4\u56de\u503c\uff1a\ntrue \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\nint \u5e95\u5c42\u8fd4\u56de\u503c,\u8c03\u8bd5\u7528\n\u4f8b\u5b50\uff1a\nif dac.open(0, 44000) then\n log.info(\"dac\", \"dac ch0 is opened\")\n dac.write(0, string.fromHex(\"ABCDABCD\"))\nend\ndac.close(0)\n", "prefix": "dac.write"}, "dac.close": {"body": "dac.close(${1:ch})", "description": "dac.close(ch) - \u5173\u95edDAC\u901a\u9053\n\u4f20\u5165\u503c\uff1a\nint \u901a\u9053\u7f16\u53f7,\u4f8b\u59820\n\u8fd4\u56de\u503c\uff1a\ntrue \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\nint \u5e95\u5c42\u8fd4\u56de\u503c,\u8c03\u8bd5\u7528\n\u4f8b\u5b50\uff1a\nif dac.open(0, 44000) then\n log.info(\"dac\", \"dac ch0 is opened\")\n dac.write(0, string.fromHex(\"ABCDABCD\"))\nend\ndac.close(0)\n", "prefix": "dac.close"}, "disp.init": {"body": "disp.init(${1:conf})", "description": "disp.init(conf) - \u663e\u793a\u5c4f\u521d\u59cb\u5316,\u8bf7\u4f7f\u7528u8g2\u5e93\n\u4f20\u5165\u503c\uff1a\ntable conf \u914d\u7f6e\u4fe1\u606f\n\u8fd4\u56de\u503c\uff1a\nint \u6b63\u5e38\u521d\u59cb\u53161,\u5df2\u7ecf\u521d\u59cb\u5316\u8fc72,\u5185\u5b58\u4e0d\u591f3,\u521d\u59cb\u5316\u5931\u8d25\u8fd4\u56de4\n\u4f8b\u5b50\uff1a\n-- disp\u5e93\u7684\u6240\u6709API\u5747\u5df2\u5408\u5e76\u5230u8g2\u5e93\n-- disp\u5e93\u5df2\u7ecf\u6620\u5c04\u4e3au8g2\u5e93,\u6240\u6709API\u5747\u4ee3\u7406\u5230u8g2,\u8bf7\u67e5\u9605u8g2\u5e93\u7684API\n", "prefix": "disp.init"}, "eink.init": {"body": "eink.init(${1:tp},${2:args},${3:spi_device})", "description": "eink.init(tp, args,spi_device) - eink\u663e\u793a\u5c4f\u521d\u59cb\u5316\n\u4f20\u5165\u503c\uff1a\nnumber eink\u7c7b\u578b\uff0c\u5f53\u524d\u652f\u6301\uff1ahttps://wiki.luatos.com/api/eink.html#id1\ntable \u9644\u52a0\u53c2\u6570,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173\uff1a
pin_busy\uff08busy\uff09
port\uff1aspi\u7aef\u53e3,\u4f8b\u59820,1,2...\u5982\u679c\u4e3adevice\u65b9\u5f0f\u5219\u4e3a\"device\"
pin_dc\uff1aeink\u6570\u636e/\u547d\u4ee4\u9009\u62e9\u5f15\u811a
pin_rst\uff1aeink\u590d\u4f4d\u5f15\u811a\nuserdata spi\u8bbe\u5907,\u5f53port = \"device\"\u65f6\u6709\u6548\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316spi0\u7684eink.MODEL_4in2bc) \u6ce8\u610f:eink\u521d\u59cb\u5316\u4e4b\u524d\u9700\u8981\u5148\u521d\u59cb\u5316spi\nspi_eink = spi.deviceSetup(0,20,0,0,8,20000000,spi.MSB,1,1)\nlog.info(\"eink.init\",\neink.init(eink.MODEL_4in2bc,{port = \"device\",pin_dc = 17, pin_pwr = 7,pin_rst = 19,direction = 2,w = 160,h = 80,xoffset = 1,yoffset = 26},spi_eink))\n", "prefix": "eink.init"}, "eink.setup": {"body": "eink.setup(${1:full},${2:spiid},${3:pin_busy},${4:pin_reset},${5:pin_dc},${6:pin_cs})", "description": "eink.setup(full, spiid, pin_busy, pin_reset, pin_dc, pin_cs) - \u521d\u59cb\u5316eink\n\u4f20\u5165\u503c\uff1a\nint \u5168\u5c4f\u5237\u65b00,\u5c40\u90e8\u5237\u65b01,\u9ed8\u8ba4\u662f\u5168\u5c4f\u5237\u65b0\nint \u6240\u5728\u7684spi,\u9ed8\u8ba4\u662f0\nint Busy \u5fd9\u4fe1\u53f7\u7ba1\u811a\nint Reset \u590d\u4f4d\u7ba1\u811a\nint DC \u6570\u636e\u547d\u4ee4\u9009\u62e9\u7ba1\u811a\nint CS \u4f7f\u80fd\u7ba1\u811a\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n", "prefix": "eink.setup"}, "eink.sleep": {"body": "eink.sleep()", "description": "eink.sleep() - \u8fdb\u5165\u4f11\u7720\u6a21\u5f0f\uff0c\u518d\u6b21\u4f7f\u7528\u65f6\u9700\u8981\u91cd\u65b0\u521d\u59cb\u5316\n", "prefix": "eink.sleep"}, "eink.clear": {"body": "eink.clear(${1:color},${2:force})", "description": "eink.clear(color, force) - \u6e05\u9664\u7ed8\u56fe\u7f13\u51b2\u533a\uff0c\u9ed8\u8ba4\u4e0d\u4f1a\u9a6c\u4e0a\u5237\u65b0\u5230\u8bbe\u5907\n\u4f20\u5165\u503c\uff1a\nnumber color \u53ef\u9009\uff0c\u9ed8\u8ba41\u3002\u5237\u5c4f\u989c\u8272\nbool force \u53ef\u9009\uff0c\u9ed8\u8ba4false\u3002\u5982\u679c\u4e3atrue\u5219\u9a6c\u4e0a\u6e05\u5c4f\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "eink.clear"}, "eink.setWin": {"body": "eink.setWin(${1:width},${2:height},${3:rotate})", "description": "eink.setWin(width, height, rotate) - \u8bbe\u7f6e\u7a97\u53e3\n\u4f20\u5165\u503c\uff1a\nint width \u5bbd\u5ea6\nint height \u9ad8\u5ea6\nint rotate \u663e\u793a\u65b9\u5411,0/1/2/3, \u76f8\u5f53\u4e8e\u65cb\u8f6c0\u5ea6/90\u5ea6/180\u5ea6/270\u5ea6\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "eink.setWin"}, "eink.getWin": {"body": "eink.getWin()", "description": "eink.getWin() - \u83b7\u53d6\u7a97\u53e3\u4fe1\u606f\n\u8fd4\u56de\u503c\uff1a\nint width \u5bbd\nint height \u9ad8\nint rotate \u65cb\u8f6c\u65b9\u5411\n", "prefix": "eink.getWin"}, "eink.setFont": {"body": "eink.setFont(${1:font})", "description": "eink.setFont(font) - \u8bbe\u7f6e\u5b57\u4f53\n\u4f20\u5165\u503c\uff1a\nuserdata \u5b57\u4f53\n\u4f8b\u5b50\uff1a\n-- \u8bbe\u7f6e\u4e3a\u5b57\u4f53,\u5bf9\u4e4b\u540e\u7684print\u6709\u6548\neink.setFont(eink.font_opposansm12_chinese)\n", "prefix": "eink.setFont"}, "eink.print": {"body": "eink.print(${1:x},${2:y},${3:str},${4:colored})", "description": "eink.print(x, y, str, colored) - \u7ed8\u5236\u5b57\u7b26\u4e32\n\u4f20\u5165\u503c\uff1a\nint x\u5750\u6807\nint y\u5750\u6807\nstring \u5b57\u7b26\u4e32\nint \u989c\u8272, \u53ef\u4ee5\u662f0\u6216\u80051, \u9ed8\u8ba4\u662f0\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u5148\u8bbe\u7f6e\u5b57\u4f53, \u7136\u540e\u5199\u5b57\n-- \u53ef\u7528\u5b57\u4f53\u53d6\u51b3\u4e8e\u5177\u4f53\u7684\u56fa\u4ef6, \u5982\u679c\u6ca1\u6709\u4f60\u60f3\u8981\u7684\u5927\u5c0f,\u53ef\u4ee5\u4e91\u7f16\u8bd1\u4e00\u4efd\u81ea\u5b9a\u4e49\u56fa\u4ef6\n-- font_opposansm8_chinese\n-- font_opposansm10_chinese\n-- font_opposansm12_chinese\n-- font_opposansm14_chinese\n-- font_opposansm16_chinese\neink.setFont(eink.font_opposansm12_chinese)\neink.print(10, 20, \"LuatOS\")\n", "prefix": "eink.print"}, "eink.show": {"body": "eink.show(${1:x},${2:y},${3:noClear})", "description": "eink.show(x, y, noClear) - \u5c06\u7f13\u51b2\u533a\u56fe\u50cf\u8f93\u51fa\u5230\u5c4f\u5e55\n\u4f20\u5165\u503c\uff1a\nint x \u8f93\u51fa\u7684x\u5750\u6807,\u9ed8\u8ba40\nint y \u8f93\u51fa\u7684y\u5750\u6807,\u9ed8\u8ba40\nbool \u53ef\u9009\uff0c\u9ed8\u8ba4false\u3002\u5982\u679c\u4e3atrue\u5219\u4e0d\u8fdb\u884c\u6e05\u5c4f\uff0c\u76f4\u63a5\u5237\u4e0a\u65b0\u5185\u5bb9\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "eink.show"}, "eink.draw": {"body": "eink.draw(${1:buff},${2:buff2},${3:noclear})", "description": "eink.draw(buff, buff2, noclear) - \u76f4\u63a5\u8f93\u51fa\u6570\u636e\u5230\u5c4f\u5e55,\u652f\u6301\u53cc\u8272\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nuserdata zbuff\u6307\u9488\nuserdata zbuff\u6307\u9488\nbool \u53ef\u9009\uff0c\u9ed8\u8ba4false\u3002\u5982\u679c\u4e3atrue\u5219\u4e0d\u8fdb\u884c\u6e05\u5c4f\uff0c\u76f4\u63a5\u5237\u4e0a\u65b0\u5185\u5bb9\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "eink.draw"}, "eink.line": {"body": "eink.line(${1:x},${2:y},${3:x2},${4:y2},${5:colored})", "description": "eink.line(x, y, x2, y2, colored) - \u7f13\u51b2\u533a\u7ed8\u5236\u7ebf\n\u4f20\u5165\u503c\uff1a\nint \u8d77\u70b9x\u5750\u6807\nint \u8d77\u70b9y\u5750\u6807\nint \u7ec8\u70b9x\u5750\u6807\nint \u7ec8\u70b9y\u5750\u6807\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\neink.line(0, 0, 10, 20, 0)\n", "prefix": "eink.line"}, "eink.rect": {"body": "eink.rect(${1:x},${2:y},${3:x2},${4:y2},${5:colored},${6:fill})", "description": "eink.rect(x, y, x2, y2, colored, fill) - \u7f13\u51b2\u533a\u7ed8\u5236\u77e9\u5f62\n\u4f20\u5165\u503c\uff1a\nint \u5de6\u4e0a\u9876\u70b9x\u5750\u6807\nint \u5de6\u4e0a\u9876\u70b9y\u5750\u6807\nint \u53f3\u4e0b\u9876\u70b9x\u5750\u6807\nint \u53f3\u4e0b\u9876\u70b9y\u5750\u6807\nint \u9ed8\u8ba4\u662f0\nint \u662f\u5426\u586b\u5145,\u9ed8\u8ba4\u662f0,\u4e0d\u586b\u5145\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\neink.rect(0, 0, 10, 20)\neink.rect(0, 0, 10, 20,0, 1) -- Filled\n", "prefix": "eink.rect"}, "eink.circle": {"body": "eink.circle(${1:x},${2:y},${3:radius},${4:colored},${5:fill})", "description": "eink.circle(x, y, radius, colored, fill) - \u7f13\u51b2\u533a\u7ed8\u5236\u5706\u5f62\n\u4f20\u5165\u503c\uff1a\nint \u5706\u5fc3x\u5750\u6807\nint \u5706\u5fc3y\u5750\u6807\nint \u534a\u5f84\nint \u9ed8\u8ba4\u662f0\nint \u662f\u5426\u586b\u5145,\u9ed8\u8ba4\u662f0,\u4e0d\u586b\u5145\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\neink.circle(0, 0, 10)\neink.circle(0, 0, 10, 1, 1) -- Filled\n", "prefix": "eink.circle"}, "eink.qrcode": {"body": "eink.qrcode(${1:x},${2:y},${3:str},${4:size})", "description": "eink.qrcode(x, y, str, size) - \u7f13\u51b2\u533a\u7ed8\u5236QRCode\n\u4f20\u5165\u503c\uff1a\nint x\u5750\u6807\nint y\u5750\u6807\nstring \u4e8c\u7ef4\u7801\u7684\u5185\u5bb9\nint \u663e\u793a\u5927\u5c0f (\u6ce8\u610f:\u4e8c\u7ef4\u7801\u751f\u6210\u5927\u5c0f\u4e0e\u8981\u663e\u793a\u5185\u5bb9\u548c\u7ea0\u9519\u7b49\u7ea7\u6709\u5173,\u751f\u6210\u7248\u672c\u4e3a1-40(\u5bf9\u5e94 21x21 - 177x177)\u7684\u4e0d\u5b9a\u5927\u5c0f,\u5982\u679c\u548c\u8bbe\u7f6e\u5927\u5c0f\u4e0d\u540c\u4f1a\u81ea\u52a8\u5728\u6307\u5b9a\u7684\u533a\u57df\u4e2d\u95f4\u663e\u793a\u4e8c\u7ef4\u7801,\u5982\u4e8c\u7ef4\u7801\u672a\u663e\u793a\u8bf7\u67e5\u770b\u65e5\u5fd7\u63d0\u793a)\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "eink.qrcode"}, "eink.bat": {"body": "eink.bat(${1:x},${2:y},${3:bat})", "description": "eink.bat(x, y, bat) - \u7f13\u51b2\u533a\u7ed8\u5236\u7535\u6c60\n\u4f20\u5165\u503c\uff1a\nint x\u5750\u6807\nint y\u5750\u6807\nint \u7535\u6c60\u7535\u538b,\u5355\u4f4d\u6beb\u4f0f\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "eink.bat"}, "eink.weather_icon": {"body": "eink.weather_icon(${1:x},${2:y},${3:code})", "description": "eink.weather_icon(x, y, code) - \u7f13\u51b2\u533a\u7ed8\u5236\u5929\u6c14\u56fe\u6807\n\u4f20\u5165\u503c\uff1a\nint x\u5750\u6807\nint y\u5750\u6807\nint \u5929\u6c14\u4ee3\u53f7\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "eink.weather_icon"}, "eink.model": {"body": "eink.model(${1:m})", "description": "eink.model(m) - \u8bbe\u7f6e\u58a8\u6c34\u5c4f\u9a71\u52a8\u578b\u53f7\n\u4f20\u5165\u503c\uff1a\nint \u578b\u53f7\u540d\u79f0, \u4f8b\u5982 eink.model(eink.MODEL_1in54_V2)\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "eink.model"}, "eink.drawXbm": {"body": "eink.drawXbm(${1:x},${2:y},${3:w},${4:h},${5:data})", "description": "eink.drawXbm(x, y, w, h, data) - \u7ed8\u5236\u4f4d\u56fe\n\u4f20\u5165\u503c\uff1a\nint X\u5750\u6807\nint y\u5750\u6807\nint \u4f4d\u56fe\u5bbd\nint \u4f4d\u56fe\u9ad8\nint \u4f4d\u56fe\u6570\u636e,\u6bcf\u4e00\u4f4d\u4ee3\u8868\u4e00\u4e2a\u50cf\u7d20\n\u4f8b\u5b50\uff1a\n-- \u53d6\u6a21\u4f7f\u7528PCtoLCD2002\u8f6f\u4ef6\u5373\u53ef\n-- \u5728(0,0)\u4e3a\u5de6\u4e0a\u89d2,\u7ed8\u5236 16x16 \"\u4eca\" \u7684\u4f4d\u56fe\neink.drawXbm(0, 0, 16,16, string.char(\n 0x80,0x00,0x80,0x00,0x40,0x01,0x20,0x02,0x10,0x04,0x48,0x08,0x84,0x10,0x83,0x60,\n 0x00,0x00,0xF8,0x0F,0x00,0x08,0x00,0x04,0x00,0x04,0x00,0x02,0x00,0x01,0x80,0x00\n))\n", "prefix": "eink.drawXbm"}, "eink.setCtx": {"body": "eink.setCtx(${1:index})", "description": "eink.setCtx(index) - \u5207\u6362\u989c\u8272\u753b\u677f, \u9002\u5408\u591a\u8272\u58a8\u6c34\u5c4f\n\u4f20\u5165\u503c\uff1a\nint \u989c\u8272\u7d22\u5f15, \u9ed1\u8272\u4e3a0, \u7ea2\u8272\u4e3a1\n\u4f8b\u5b50\uff1a\n-- \u4ec5\u9002\u5408\u591a\u8272\u58a8\u6c34\u5c4f, \u5bf9\u5355\u8272\u58a8\u6c34\u5c4f(\u53ea\u6709\u9ed1\u767d)\u7684\u65e0\u6548\neink.setCtx(1)\n-- \u5207\u6362\u540e, \u6240\u6709drawXXX\u90fd\u4f1a\u64cd\u4f5c\u5728\u6307\u5b9a\u989c\u8272\u7684\u753b\u677f\n", "prefix": "eink.setCtx"}, "eink.async": {"body": "eink.async(${1:index})", "description": "eink.async(index) - \u5f02\u6b65\u65b9\u5f0f\uff0c\u4f7f\u7528\u6b64\u65b9\u5f0f\u9700\u8981\u5148 require(\"sysplus\") \u4e4b\u540e eink.clear().wait() eink.show().wait()\u8fdb\u884c\u5237\u5c4f\n\u4f20\u5165\u503c\uff1a\nint 1 \u4f7f\u7528\u5f02\u6b65\n\u4f8b\u5b50\uff1a\n eink.async(1)\n spi_eink = spi.deviceSetup(spi_id,pin_cs,0,0,8,20*1000*1000,spi.MSB,1,1)\n eink.init(eink.MODEL_1in54,\n {port = \"device\",pin_dc = pin_dc, pin_busy = pin_busy,pin_rst = pin_reset},\n spi_eink)\n eink.setWin(200, 200, 0)\n sys.wait(100)\n log.info(\"e-paper 1.54\", \"Testing Go\")\n eink.print(30, 20, \"LuatOS-AIR780E\",0x00)\n eink.show().wait()\n log.info(\"e-paper 1.54\", \"Testing End\")\n", "prefix": "eink.async"}, "ercoap.parse": {"body": "ercoap.parse(${1:data})", "description": "ercoap.parse(data) - \u89e3\u6790coap\u6570\u636e\u5305\n\u4f20\u5165\u503c\uff1a\nstring coap\u6570\u636e\u5305\n\u8fd4\u56de\u503c\uff1a\ntable \u6210\u529f\u8fd4\u56detable,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u662f\u89e3\u6790coap\u6570\u636e\u5305\nlocal rcoap = ercoap.parse(data)\nif rcoap then\n log.info(\"coap\", rcoap.type, rcoap.code, rcoap.payload)\n -- rcoap\u7684\u5c5e\u6027\n -- type \u6d88\u606f\u7c7b\u578b, 0 - CON \u9700\u8981\u7b54\u590d, 1 - NON \u65e0\u9700\u7b54\u590d, 2 - ACK \u5df2\u6536\u5230, 3 - RST \u51fa\u9519\u4e86\n -- msgid \u6d88\u606fid\n -- payload \u643a\u5e26\u7684\u6570\u636e\n -- code \u7c7b\u4f3c\u4e8ehttp\u7684statue code, \u901a\u8fc7\u6709 2xx \u6b63\u5e38, 4xx \u51fa\u9519\u4e86\nelse\n log.info(\"ercoap\", \"\u6570\u636e\u5305\u89e3\u6790\u5931\u8d25\")\nend\n", "prefix": "ercoap.parse"}, "ercoap.print": {"body": "ercoap.print(${1:data})", "description": "ercoap.print(data) - \u6253\u5370coap\u6570\u636e\u5305\n\u4f20\u5165\u503c\uff1a\nstring coap\u6570\u636e\u5305\n\u8fd4\u56de\u503c\uff1a\nboolean \u89e3\u6790\u6210\u529f\u8fd4\u56detrue\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5355\u7eaf\u5c31\u6253\u5370\u4e00\u4e0bcoap\u6570\u636e\u5305\n", "prefix": "ercoap.print"}, "ercoap.onenet": {"body": "ercoap.onenet(${1:tp},${2:product_id},${3:device_name},${4:token},${5:payload})", "description": "ercoap.onenet(tp, product_id, device_name, token, payload) - \u5feb\u901f\u751f\u6210onenet\u6570\u636e\u5305\n\u4f20\u5165\u503c\uff1a\nstring \u8bf7\u6c42\u7c7b\u578b,\u4f5c\u4e3areply\u65f6\u53ef\u9009,\u5176\u4ed6\u60c5\u51b5\u5fc5\u9009\nstring \u9879\u76eeid,\u5fc5\u987b\u586b\u5199\nstring \u8bbe\u5907\u540d\u79f0,\u5fc5\u987b\u586b\u5199\nstring token,\u5fc5\u987b\u586b\u5199\nstring \u7269\u6a21\u578bjson\u5b57\u7b26\u4e32,\u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nstring \u5408\u6210\u597d\u7684\u6570\u636e\u5305,\u53ef\u901a\u8fc7UDP\u4e0a\u884c\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003\u6587\u6863: coap\u63a5\u5165 https://open.iot.10086.cn/doc/v5/fuse/detail/924\n-- \u53c2\u8003\u6587\u6863: \u7269\u6a21\u578b https://open.iot.10086.cn/doc/v5/fuse/detail/902\n\n-- \u7c7b\u578b tp\u503c token\u6765\u6e90 payload\n-- \u767b\u9646 login iotauth.onenet\u51fd\u6570\u751f\u6210 \u65e0\n-- \u5fc3\u8df3 keep_live iotauth.onenet\u51fd\u6570\u751f\u6210 \u65e0\n-- \u767b\u51fa logout iotauth.onenet\u51fd\u6570\u751f\u6210 \u65e0\n-- \u5c5e\u6027\u4e0a\u62a5 thing/property/post login\u65f6\u83b7\u53d6 \u5fc5\u987b\u6709\n-- \u5c5e\u6027\u56de\u590d thing/property/reply login\u65f6\u83b7\u53d6 \u5fc5\u987b\u6709\n-- \u4e8b\u4ef6\u4e0a\u62a5 thing/event/post login\u65f6\u83b7\u53d6 \u5fc5\u987b\u6709\n-- \u8fdc\u7a0b\u8c03\u7528\u7b54\u590d \u65e0 login\u65f6\u83b7\u53d6 \u5fc5\u987b\u6709\n", "prefix": "ercoap.onenet"}, "errDump.dump": {"body": "errDump.dump(${1:zbuff},${2:type},${3:isDelete})", "description": "errDump.dump(zbuff, type, isDelete) - \u624b\u52a8\u8bfb\u53d6\u5f02\u5e38\u65e5\u5fd7\uff0c\u4e3b\u8981\u7528\u4e8e\u7528\u6237\u5c06\u65e5\u5fd7\u53d1\u9001\u7ed9\u81ea\u5df1\u7684\u670d\u52a1\u5668\u800c\u4e0d\u662fIOT\u5e73\u53f0\uff0c\u5982\u679c\u5728errDump.config\u914d\u7f6e\u4e86\u5468\u671f\u4e0a\u4f20\uff0c\u5219\u4e0d\u80fd\u4f7f\u7528\u672c\u51fd\u6570\n\u4f20\u5165\u503c\uff1a\nzbuff \u65e5\u5fd7\u4fe1\u606f\u7f13\u5b58\uff0c\u5982\u679c\u4e3anil\u5c31\u4e0d\u4f1a\u8bfb\u51fa\uff0c\u4e00\u822c\u5f53\nint \u65e5\u5fd7\u7c7b\u578b\uff0c\u76ee\u524d\u53ea\u6709errDump.TYPE_SYS\u548cerrDump.TYPE_USR\nboolean \u662f\u5426\u5220\u9664\u65e5\u5fd7\n\u8fd4\u56de\u503c\uff1a\nboolean true\u8868\u793a\u672c\u6b21\u8bfb\u53d6\u524d\u5e76\u6ca1\u6709\u5199\u5165\u6570\u636e\uff0cfalse\u53cd\u4e4b\uff0c\u5728\u5220\u9664\u65e5\u5fd7\u524d\uff0c\u6700\u597d\u518d\u8bfb\u4e00\u4e0b\u786e\u4fdd\u6ca1\u6709\u65b0\u7684\u6570\u636e\u5199\u5165\u4e86\n\u4f8b\u5b50\uff1a\nlocal result = errDump.dump(buff, errDump.TYPE_SYS, false) --\u8bfb\u51fa\u7cfb\u7edf\u8bb0\u5f55\u7684\u5f02\u5e38\u65e5\u5fd7\nlocal result = errDump.dump(nil, errDump.TYPE_SYS, true) --\u6e05\u9664\u7cfb\u7edf\u8bb0\u5f55\u7684\u5f02\u5e38\u65e5\u5fd7\n", "prefix": "errDump.dump"}, "errDump.record": {"body": "errDump.record(${1:string})", "description": "errDump.record(string) - \u5199\u5165\u7528\u6237\u7684\u5f02\u5e38\u65e5\u5fd7\uff0c\u6ce8\u610f\u6700\u5927\u53ea\u67094KB\uff0c\u8d85\u8fc7\u90e8\u5206\u65b0\u7684\u8986\u76d6\u65e7\u7684\uff0c\u5f00\u542f\u81ea\u52a8\u4e0a\u4f20\u540e\u4f1a\u4e0a\u4f20\u5230\u5408\u5b99IOT\u5e73\u53f0\n\u4f20\u5165\u503c\uff1a\nstring \u65e5\u5fd7\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nerrDump.record(\"socket long time no connect\") --\u8bb0\u5f55\u4e0b\"socket long time no connect\"\n", "prefix": "errDump.record"}, "errDump.config": {"body": "errDump.config(${1:enable},${2:period},${3:user_flag},${4:custom_id},${5:host},${6:port})", "description": "errDump.config(enable, period, user_flag, custom_id, host, port) - \u914d\u7f6e\u5173\u952e\u65e5\u5fd7\u4e0a\u4f20IOT\u5e73\u53f0\uff0c\u8fd9\u91cc\u7684\u65e5\u5fd7\u5305\u62ec\u5f15\u8d77luavm\u5f02\u5e38\u9000\u51fa\u7684\u65e5\u5fd7\u548c\u7528\u6237\u901a\u8fc7record\u5199\u5165\u7684\u65e5\u5fd7\uff0c\u7c7b\u4f3c\u4e8eair\u7684errDump\n\u4f20\u5165\u503c\uff1a\nboolean \u662f\u5426\u542f\u7528\u8bb0\u5f55\u529f\u80fd\uff0cfalse\u7684\u8bdd\u5c06\u4e0d\u4f1a\u8bb0\u5f55\u4efb\u4f55\u65e5\u5fd7\nint \u5b9a\u65f6\u4e0a\u4f20\u5468\u671f\uff0c\u5355\u4f4d\u79d2\uff0c\u9ed8\u8ba4600\u79d2\uff0c\u8fd9\u4e2a\u662f\u81ea\u52a8\u4e0a\u4f20\u65f6\u5019\u540e\u7684\u91cd\u8bd5\u65f6\u95f4\u65f6\u95f4\uff0c\u5728\u5f00\u673a\u540e\u6216\u8005\u6709record\u64cd\u4f5c\u540e\u4f1a\u5f88\u5feb\u5c1d\u8bd5\u4e0a\u4f20\u5230\u5408\u5b99IOT\u5e73\u53f0\u4e00\u6b21\uff0c\u5982\u679c\u4e3a0\uff0c\u5219\u4e0d\u4f1a\u4e0a\u4f20\uff0c\u7531\u7528\u6237dump\u540e\u81ea\u5df1\u4e0a\u4f20\u81ea\u5df1\u7684\u5e73\u53f0\nstring \u7528\u6237\u7684\u7279\u6b8a\u6807\u8bc6\uff0c\u53ef\u4ee5\u4e3a\u7a7a\nstring \u8bbe\u5907\u8bc6\u522b\u53f7, 4G\u8bbe\u5907\u9ed8\u8ba4\u662fimei,\u5176\u4ed6\u8bbe\u5907\u9ed8\u8ba4\u662fmcu.unique_id\nstring \u670d\u52a1\u5668\u57df\u540d,\u9ed8\u8ba4dev_msg1.openluat.com\nint \u670d\u52a1\u5668\u7aef\u53e3,\u9ed8\u8ba4\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nerrDump.config(true, 3600, \"12345678\") --\u4e00\u4e2a\u5c0f\u65f6\u5c1d\u8bd5\u4e0a\u6b21\u4e00\u6b21\uff0c\u4e0a\u4f20\u65f6\u4f1a\u5728imei\u540e\u9644\u52a0\u4e0a12345678\nerrDump.config(false) --\u5173\u95ed\u8bb0\u5f55\u529f\u80fd\uff0c\u4e0d\u518d\u4e0a\u4f20\nerrDump.config(true, 0) --\u8bb0\u5f55\uff0c\u4f46\u662f\u4e0d\u4f1a\u4e3b\u52a8\u4e0a\u4f20\uff0c\u7531\u7528\u6237\u5b9e\u73b0\u4e0a\u4f20\u529f\u80fd\n\n-- 2023.09.22\u65b0\u589ecustom_id\u53c2\u6570\nerrDump.config(true, 3600, nil, \"ABC\") --\u4e00\u4e2a\u5c0f\u65f6\u5c1d\u8bd5\u4e0a\u6b21\u4e00\u6b21\uff0c\u4e0a\u4f20\u65f6\u4f7f\u7528\u81ea\u5b9a\u4e49\u7684\u8bbe\u5907\u8bc6\u522b\u53f7ABC\n\n-- 2023.12.8 \u65b0\u589ehost\u548cport\u53c2\u6570\nerrDump.config(true, 3600, nil, nil, \"dev_msg1.openluat.com\", 12425)\n", "prefix": "errDump.config"}, "fastlz.compress": {"body": "fastlz.compress(${1:data},${2:level})", "description": "fastlz.compress(data, level) - \u5feb\u901f\u538b\u7f29\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u538b\u7f29\u7684\u6570\u636e, \u5c11\u4e8e400\u5b57\u8282\u7684\u6570\u636e\u4e0d\u5efa\u8bae\u538b\u7f29, \u4e14\u538b\u7f29\u540e\u7684\u6570\u636e\u4e0d\u80fd\u5927\u4e8e32k\nint \u538b\u7f29\u7ea7\u522b,\u9ed8\u8ba41, \u53ef\u90091\u6216\u80052, 2\u7684\u538b\u7f29\u6bd4\u66f4\u9ad8(\u6709\u65f6\u5019)\n\u8fd4\u56de\u503c\uff1a\nstring \u82e5\u538b\u7f29\u6210\u529f,\u8fd4\u56de\u6570\u636e\u5b57\u7b26\u4e32, \u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f, \u538b\u7f29\u8fc7\u7a0b\u7684\u5185\u5b58\u6d88\u8017\u5982\u4e0b\n-- \u7cfb\u7edf\u5185\u5b58, \u56fa\u5b9a32k\n-- lua\u5185\u5b58, \u539f\u59cb\u6570\u636e\u7684\u5927\u5c0f\u76841.05\u500d,\u6700\u5c0f\u5360\u75281024\u5b57\u8282.\n", "prefix": "fastlz.compress"}, "fastlz.uncompress": {"body": "fastlz.uncompress(${1:data},${2:maxout})", "description": "fastlz.uncompress(data, maxout) - \u5feb\u901f\u89e3\u538b\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u89e3\u538b\u7684\u6570\u636e\nint \u89e3\u538b\u540e\u7684\u6700\u5927\u5927\u5c0f, \u9ed8\u8ba4\u662f4k, \u53ef\u6309\u9700\u8c03\u6574\n\u8fd4\u56de\u503c\uff1a\nstring \u82e5\u89e3\u538b\u6210\u529f,\u8fd4\u56de\u6570\u636e\u5b57\u7b26\u4e32, \u5426\u5219\u8fd4\u56denil\n", "prefix": "fastlz.uncompress"}, "fatfs.mount": {"body": "fatfs.mount(${1:mode},${2:mount_point},${3:spiid_or_spidevice},${4:spi_cs},${5:spi_speed},${6:power_pin},${7:power_on_delay},${8:auto_format})", "description": "fatfs.mount(mode,mount_point, spiid_or_spidevice, spi_cs, spi_speed, power_pin, power_on_delay, auto_format) - \u6302\u8f7dfatfs\n\u4f20\u5165\u503c\uff1a\nint fatfs\u6a21\u5f0f,\u53ef\u9009fatfs.SPI,fatfs.SDIO,fatfs.RAM,fatfs.USB\nstring \u865a\u62df\u6587\u4ef6\u7cfb\u7edf\u7684\u6302\u8f7d\u70b9, \u9ed8\u8ba4\u662f /fatfs\nint \u4f20\u5165spi device\u6307\u9488,\u6216\u8005spi\u7684id,\u6216\u8005sdio\u7684id\nint \u7247\u9009\u811a\u7684GPIO \u53f7, spi\u6a21\u5f0f\u6709\u6548,\u82e5\u524d\u4e00\u4e2a\u53c2\u6570\u4f20\u7684\u662fspi device,\u8fd9\u4e2a\u53c2\u6570\u5c31\u4e0d\u9700\u8981\u4f20\nint SPI\u6700\u9ad8\u901f\u5ea6,\u9ed8\u8ba410M, \u82e5\u524d2\u4e2a\u53c2\u6570\u4f20\u7684\u662fspi device,\u8fd9\u4e2a\u53c2\u6570\u5c31\u4e0d\u9700\u8981\u4f20\nint TF\u5361\u7535\u6e90\u63a7\u5236\u811a,TF\u5361\u521d\u59cb\u524d\u5148\u62c9\u4f4e\u590d\u4f4d\u518d\u62c9\u9ad8,\u5982\u679c\u6ca1\u6709,\u6216\u8005\u662f\u5185\u7f6e\u7535\u6e90\u63a7\u5236\u65b9\u5f0f,\u8fd9\u4e2a\u53c2\u6570\u5c31\u4e0d\u9700\u8981\u4f20\nint TF\u5361\u7535\u6e90\u590d\u4f4d\u8fc7\u7a0b\u65f6\u95f4,\u5355\u4f4dms,\u9ed8\u8ba4\u503c\u662f1\nbool \u6302\u8f7d\u5931\u8d25\u662f\u5426\u5c1d\u8bd5\u683c\u5f0f\u5316,\u9ed8\u8ba4\u662ftrue,\u5373\u81ea\u52a8\u683c\u5f0f\u5316. \u672c\u53c2\u6570\u57282023.8.16\u6dfb\u52a0\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue, \u5426\u5219\u8fd4\u56denil\u6216\u8005false\nstring \u5931\u8d25\u7684\u539f\u56e0\n\u4f8b\u5b50\uff1a\n-- \u65b9\u6cd51, \u4f7f\u7528SPI\u6a21\u5f0f\n local spiId = 2\n local result = spi.setup(\n spiId,--\u4e32\u53e3id\n 255, -- \u4e0d\u4f7f\u7528\u9ed8\u8ba4CS\u811a\n 0,--CPHA\n 0,--CPOL\n 8,--\u6570\u636e\u5bbd\u5ea6\n 400*1000 -- \u521d\u59cb\u5316\u65f6\u4f7f\u7528\u8f83\u4f4e\u7684\u9891\u7387\n )\n local TF_CS = pin.PB3\n gpio.setup(TF_CS, 1)\n --fatfs.debug(1) -- \u82e5\u6302\u8f7d\u5931\u8d25,\u53ef\u4ee5\u5c1d\u8bd5\u6253\u5f00\u8c03\u8bd5\u4fe1\u606f,\u67e5\u627e\u539f\u56e0\n -- \u63d0\u9192, \u82e5TF/SD\u6a21\u5757\u5e26\u7535\u5e73\u8f6c\u6362, \u901a\u5e38\u4e0d\u652f\u630110M\u4ee5\u4e0a\u7684\u6ce2\u7279\u7387!!\n fatfs.mount(fatfs.SPI,\"SD\", spiId, TF_CS, 24000000)\n local data, err = fatfs.getfree(\"SD\")\n if data then\n log.info(\"fatfs\", \"getfree\", json.encode(data))\n else\n log.info(\"fatfs\", \"err\", err)\n end\n -- \u5f80\u4e0b\u7684\u64cd\u4f5c, \u4f7f\u7528 io.open(\"/sd/xxx\", \"w+\") \u7b49io\u5e93\u7684API\u5c31\u53ef\u4ee5\u4e86\n", "prefix": "fatfs.mount"}, "fatfs.unmount": {"body": "fatfs.unmount(${1:mount_point})", "description": "fatfs.unmount(mount_point) - \u53d6\u6d88\u6302\u8f7dfatfs\n\u4f20\u5165\u503c\uff1a\nstring \u865a\u62df\u6587\u4ef6\u7cfb\u7edf\u7684\u6302\u8f7d\u70b9, \u9ed8\u8ba4\u662f fatfs,\u5fc5\u987b\u4e0efatfs.mount\u4e00\u81f4\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u8fd4\u56de0, \u5426\u5219\u8fd4\u56de\u5931\u8d25\u7801\n\u4f8b\u5b50\uff1a\nfatfs.mount(\"SD\")\n", "prefix": "fatfs.unmount"}, "fatfs.getfree": {"body": "fatfs.getfree(${1:mount_point})", "description": "fatfs.getfree(mount_point) - \u83b7\u53d6\u53ef\u7528\u7a7a\u95f4\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nstring \u6302\u8f7d\u70b9, \u9700\u8981\u8ddffatfs.mount\u4f20\u5165\u7684\u503c\u4e00\u81f4\n\u8fd4\u56de\u503c\uff1a\ntable \u82e5\u6210\u529f\u4f1a\u8fd4\u56detable,\u5426\u5219\u8fd4\u56denil\nint \u5bfc\u81f4\u5931\u8d25\u7684\u5e95\u5c42\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- table\u5305\u542b\u7684\u5185\u5bb9\u6709\n-- total_sectors \u603b\u6247\u533a\u6570\u91cf\n-- free_sectors \u7a7a\u95f2\u6247\u533a\u6570\u91cf\n-- total_kb \u603b\u5b57\u8282\u6570,\u5355\u4f4dkb\n-- free_kb \u7a7a\u95f2\u5b57\u8282\u6570, \u5355\u4f4dkb\n-- \u6ce8\u610f,\u5f53\u524d\u6247\u533a\u5927\u5c0f\u56fa\u5b9a\u5728512\u5b57\u8282\n\n local data, err = fatfs.getfree(\"SD\")\n if data then\n log.info(\"fatfs\", \"getfree\", json.encode(data))\n else\n log.info(\"fatfs\", \"err\", err)\n end\n", "prefix": "fatfs.getfree"}, "fatfs.debug": {"body": "fatfs.debug(${1:value})", "description": "fatfs.debug(value) - \u8bbe\u7f6e\u8c03\u8bd5\u6a21\u5f0f\n\u4f20\u5165\u503c\uff1a\nbool \u662f\u5426\u8fdb\u5165\u8c03\u8bd5\u6a21\u5f0f,true\u4ee3\u8868\u8fdb\u5165\u8c03\u8bd5\u6a21\u5f0f,\u589e\u52a0\u8c03\u8bd5\u65e5\u5fd7\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "fatfs.debug"}, "fdb.kvdb_init": {"body": "fdb.kvdb_init(${1:name},${2:partition})", "description": "fdb.kvdb_init(name, partition) - \u521d\u59cb\u5316kv\u6570\u636e\u5e93\n\u4f20\u5165\u503c\uff1a\nstring \u6570\u636e\u5e93\u540d,\u5f53\u524d\u4ec5\u652f\u6301env\nstring FAL\u5206\u533a\u540d,\u5f53\u524d\u4ec5\u652f\u6301onchip_fdb\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- fdb\u5e93\u57fa\u4e8e flashdb , \u518d\u6b21\u8868\u793a\u611f\u8c22.\nif fdb.kvdb_init(\"env\", \"onchip_fdb\") then\n log.info(\"fdb\", \"kv\u6570\u636e\u5e93\u521d\u59cb\u5316\u6210\u529f\")\nend\n\n-- \u5173\u4e8e\u6e05\u7a7afdb\u5e93\n-- \u4e0b\u8f7d\u5de5\u5177\u662f\u6ca1\u6709\u63d0\u4f9b\u76f4\u63a5\u6e05\u9664fdb\u6570\u636e\u7684\u9014\u5f84\u7684, \u4f46\u6709\u6709\u529e\u6cd5\u89e3\u51b3\n-- \u5199\u4e00\u4e2amain.lua, \u6267\u884c fdb.kvdb_init \u540e \u6267\u884c fdb.clear() \u5373\u53ef\u5168\u6e05fdb\u6570\u636e.\n", "prefix": "fdb.kvdb_init"}, "fdb.kv_set": {"body": "fdb.kv_set(${1:key},${2:value})", "description": "fdb.kv_set(key, value) - \u8bbe\u7f6e\u4e00\u5bf9kv\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring key\u7684\u540d\u79f0,\u5fc5\u586b,\u4e0d\u80fd\u7a7a\u5b57\u7b26\u4e32\nstring \u7528\u6237\u6570\u636e,\u5fc5\u586b,\u4e0d\u80fdnil, \u652f\u6301\u5b57\u7b26\u4e32/\u6570\u503c/table/\u5e03\u5c14\u503c, \u6570\u636e\u957f\u5ea6\u6700\u5927255\u5b57\u8282\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\nnumber \u7b2c\u4e8c\u4e2a\u4e3a\u8fd4\u56de\u4e3aflashdb\u7684fdb_kv_set_blob\u8fd4\u56de\u8be6\u7ec6\u72b6\u6001,0\uff1a\u65e0\u9519\u8bef 1:\u64e6\u9664\u9519\u8bef 2:\u8bfb\u9519\u8bef 3:\u5199\u9519\u8bef 4:\u672a\u627e\u5230 5:kv\u540d\u5b57\u9519\u8bef 6:kv\u540d\u5b57\u5b58\u5728 7:\u5df2\u4fdd\u5b58 8:\u521d\u59cb\u5316\u9519\u8bef\n\u4f8b\u5b50\uff1a\nif fdb.kvdb_init(\"env\", \"onchip_fdb\") then\n log.info(\"fdb\", fdb.kv_set(\"wendal\", \"goodgoodstudy\"))\nend\n", "prefix": "fdb.kv_set"}, "fdb.kv_get": {"body": "fdb.kv_get(${1:key},${2:skey})", "description": "fdb.kv_get(key, skey) - \u6839\u636ekey\u83b7\u53d6\u5bf9\u5e94\u7684\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring key\u7684\u540d\u79f0,\u5fc5\u586b,\u4e0d\u80fd\u7a7a\u5b57\u7b26\u4e32\nstring \u53ef\u9009\u7684\u6b21\u7ea7key,\u4ec5\u5f53\u539f\u59cb\u503c\u4e3atable\u65f6\u6709\u6548,\u76f8\u5f53\u4e8e fdb.kv_get(key)[skey]\n\u8fd4\u56de\u503c\uff1a\nany \u5b58\u5728\u5219\u8fd4\u56de\u6570\u636e,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nif fdb.kvdb_init(\"env\", \"onchip_fdb\") then\n log.info(\"fdb\", fdb.kv_get(\"wendal\"))\nend\n", "prefix": "fdb.kv_get"}, "fdb.kv_del": {"body": "fdb.kv_del(${1:key})", "description": "fdb.kv_del(key) - \u6839\u636ekey\u5220\u9664\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring key\u7684\u540d\u79f0,\u5fc5\u586b,\u4e0d\u80fd\u7a7a\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nif fdb.kvdb_init(\"env\", \"onchip_fdb\") then\n log.info(\"fdb\", fdb.kv_del(\"wendal\"))\nend\n", "prefix": "fdb.kv_del"}, "fdb.kv_clr": {"body": "fdb.kv_clr()", "description": "fdb.kv_clr() - \u6e05\u7a7a\u6574\u4e2akv\u6570\u636e\u5e93\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u6e05\u7a7a\nfdb.kv_clr()\n", "prefix": "fdb.kv_clr"}, "fdb.kv_iter": {"body": "fdb.kv_iter()", "description": "fdb.kv_iter() - kv\u6570\u636e\u5e93\u8fed\u4ee3\u5668\n\u8fd4\u56de\u503c\uff1a\nuserdata \u6210\u529f\u8fd4\u56de\u8fed\u4ee3\u5668\u6307\u9488,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u6e05\u7a7a\nlocal iter = fdb.kv_iter()\nif iter then\n while 1 do\n local k = fdb.kv_next(iter)\n if not k then\n break\n end\n log.info(\"fdb\", k, \"value\", fdb.kv_get(k))\n end\nend\n", "prefix": "fdb.kv_iter"}, "fdb.kv_next": {"body": "fdb.kv_next(${1:iter})", "description": "fdb.kv_next(iter) - kv\u8fed\u4ee3\u5668\u83b7\u53d6\u4e0b\u4e00\u4e2akey\n\u4f20\u5165\u503c\uff1a\nuserdata fdb.kv_iter()\u8fd4\u56de\u7684\u6307\u9488\n\u8fd4\u56de\u503c\uff1a\nstring \u6210\u529f\u8fd4\u56de\u5b57\u7b26\u4e32key\u503c, \u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u6e05\u7a7a\nlocal iter = fdb.kv_iter()\nif iter then\n while 1 do\n local k = fdb.kv_next(iter)\n if not k then\n break\n end\n log.info(\"fdb\", k, \"value\", fdb.kv_get(k))\n end\nend\n", "prefix": "fdb.kv_next"}, "fdb.kv_stat": {"body": "fdb.kv_stat()", "description": "fdb.kv_stat() - \u83b7\u53d6kv\u6570\u636e\u5e93\u72b6\u6001\n\u8fd4\u56de\u503c\uff1a\nint \u5df2\u4f7f\u7528\u7684\u7a7a\u95f4,\u5355\u4f4d\u5b57\u8282\nint \u603b\u53ef\u7528\u7a7a\u95f4, \u5355\u4f4d\u5b57\u8282\nint \u603bkv\u952e\u503c\u5bf9\u6570\u91cf, \u5355\u4f4d\u4e2a\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e2022.07.23 \u6dfb\u52a0\nlocal used,maxs,kv_count = fdb.kv_stat()\nlog.info(\"fdb\", \"kv\", used,maxs,kv_count)\n", "prefix": "fdb.kv_stat"}, "fonts.list": {"body": "fonts.list(${1:tp})", "description": "fonts.list(tp) - \u8fd4\u56de\u56fa\u4ef6\u652f\u6301\u7684\u5b57\u4f53\u5217\u8868\n\u4f20\u5165\u503c\uff1a\nstring \u7c7b\u578b, \u9ed8\u8ba4 u8g2, \u8fd8\u53ef\u4ee5\u662flvgl\n\u8fd4\u56de\u503c\uff1a\ntable \u5b57\u4f53\u5217\u8868\n\u4f8b\u5b50\uff1a\n-- API\u65b0\u589e\u4e8e2022-07-12\nif fonts.list then\n log.info(\"fonts\", \"u8g2\", json.encode(fonts.list(\"u8g2\")))\nend\n", "prefix": "fonts.list"}, "fonts.u8g2_get": {"body": "fonts.u8g2_get(${1:name},${2:tp})", "description": "fonts.u8g2_get(name, tp) - \u83b7\u53d6\u5b57\u4f53\n\u4f20\u5165\u503c\uff1a\nstring \u5b57\u4f53\u540d\u79f0, \u4f8b\u5982opposansm8_chinese unifont_t_symbols\nstring \u7c7b\u578b, \u9ed8\u8ba4 u8g2, \u8fd8\u53ef\u4ee5\u662flvgl\n\u8fd4\u56de\u503c\uff1a\nuserdata \u82e5\u5b57\u4f53\u5b58\u653e,\u8fd4\u56de\u5b57\u4f53\u6307\u9488, \u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\noppo_8 = fonts.get(\"opposansm8_chinese\", \"u8g2\")\nif oppo_8 then\n u8g2.SetFont(oppo_8)\nelse\n log.warn(\"fonts\", \"no such font opposansm8_chinese\")\nend\n-- \u82e5\u4f7f\u7528\u4e91\u7f16\u8bd1\u7684\u81ea\u5b9a\u4e49\u5b57\u5e93, \u4f7f\u7528\u65b9\u5f0f\u5982\u4e0b\noppo_8 = fonts.get(\"oppo_bold_8\", \"u8g2\") -- oppo_bold_8 \u662f\u4e91\u7f16\u8bd1\u754c\u9762\u7684\u5b57\u5e93\u547d\u540d\nif oppo_8 then\n u8g2.SetFont(oppo_8)\nelse\n log.warn(\"fonts\", \"no such font opposansm8_chinese\")\nend\n", "prefix": "fonts.u8g2_get"}, "fonts.u8g2_load": {"body": "fonts.u8g2_load(${1:path},${2:path})", "description": "fonts.u8g2_load(path, path) - \u4ece\u6587\u4ef6\u52a0\u8f7d\u5b57\u4f53\n\u4f20\u5165\u503c\uff1a\nstring \u5b57\u4f53\u8def\u5f84, \u4f8b\u5982 /luadb/abc.bin\nstring \u7c7b\u578b, \u9ed8\u8ba4 u8g2. \u4e5f\u652f\u6301lvgl\n\u8fd4\u56de\u503c\uff1a\nuserdata \u82e5\u5b57\u4f53\u5b58\u653e,\u8fd4\u56de\u5b57\u4f53\u6307\u9488, \u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- API\u65b0\u589e\u4e8e2022-07-11\n-- \u63d0\u9192: \u82e5\u6587\u4ef6\u4f4d\u4e8e/luadb\u4e0b, \u4e0d\u9700\u8981\u5360\u7528\u5185\u5b58\n-- \u82e5\u6587\u4ef6\u5904\u4e8e\u5176\u4ed6\u8def\u5f84, \u4f8b\u5982tf/sd\u5361, spi flash, \u4f1a\u81ea\u52a8\u52a0\u8f7d\u5230\u5185\u5b58, \u6d88\u8017lua vm\u7684\u5185\u5b58\u7a7a\u95f4\n-- \u52a0\u8f7d\u540e\u8bf7\u9002\u5f53\u5f15\u7528, \u4e0d\u5fc5\u53cd\u590d\u52a0\u8f7d\u540c\u4e00\u4e2a\u5b57\u4f53\u6587\u4ef6\noppo12 = fonts.load(\"/luadb/oppo12.bin\")\nif oppo12 then\n u8g2.SetFont(oppo12)\nelse\n log.warn(\"fonts\", \"no such font file oppo12.bin\")\nend\n", "prefix": "fonts.u8g2_load"}, "fota.init": {"body": "fota.init(${1:storge_location},${2:len},${3:param1},${4:param2})", "description": "fota.init(storge_location, len, param1, param2) - \u521d\u59cb\u5316fota\u6d41\u7a0b\n\u4f20\u5165\u503c\uff1a\nint/string fota\u6570\u636e\u5b58\u50a8\u7684\u8d77\u59cb\u4f4d\u7f6e
\u5982\u679c\u662fint\uff0c\u5219\u662f\u7531\u82af\u7247\u5e73\u53f0\u5177\u4f53\u5224\u65ad
\u5982\u679c\u662fstring\uff0c\u5219\u5b58\u50a8\u5728\u6587\u4ef6\u7cfb\u7edf\u4e2d
\u5982\u679c\u4e3anil\uff0c\u5219\u7531\u5e95\u5c42\u51b3\u5b9a\u5b58\u50a8\u4f4d\u7f6e\nint \u6570\u636e\u5b58\u50a8\u7684\u6700\u5927\u7a7a\u95f4\nuserdata param1\uff0c\u5982\u679c\u6570\u636e\u5b58\u50a8\u5728spiflash\u65f6,\u4e3aspi_device\nint param2\uff0c\u76ee\u524d\u53ea\u7528\u4e8e\u5916\u90e8flash\u66f4\u65b0\u65f6, spiflash\u7535\u6e90\u63a7\u5236\u811a\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue, \u5931\u8d25\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316fota\u6d41\u7a0b\nlocal result = fota.init(0, 0x00300000, spi_device) --\u7531\u4e8e105\u7684flash\u4ece0x01000000\u5f00\u59cb\uff0c\u6240\u4ee50\u5c31\u662f\u5916\u90e8spiflash\nlocal result = fota.init() --ec618\u7cfb\u5217/EC7XX\u7cfb\u5217\u4f7f\u7528\u56fa\u5b9a\u5185\u90e8\u5730\u5740\uff0c\u6240\u4ee5\u4e0d\u9700\u8981\u53c2\u6570\u4e86\nlocal result = fota.init(0xe0000000, 0, spi_device, 27) --EC7XX\u7cfb\u5217\u5141\u8bb8\u4f7f\u7528\u5916\u90e8flash\u66f4\u65b0\uff0c\u4f46\u662f\u5730\u5740\u5fc5\u987b\u52a0\u4e0a0xe0000000\u7684\u504f\u79fb\n", "prefix": "fota.init"}, "fota.wait": {"body": "fota.wait()", "description": "fota.wait() - \u7b49\u5f85\u5e95\u5c42fota\u6d41\u7a0b\u51c6\u5907\u597d\n\u4f20\u5165\u503c\uff1a\nboolean \u662f\u5426\u5b8c\u6574\u8d70\u5b8c\u6d41\u7a0b\uff0ctrue \u8868\u793a\u6b63\u786e\u8d70\u5b8c\u6d41\u7a0b\u4e86\n\u8fd4\u56de\u503c\uff1a\nboolean \u51c6\u5907\u597d\u8fd4\u56detrue\n\u4f8b\u5b50\uff1a\nlocal isDone = fota.wait()\n", "prefix": "fota.wait"}, "fota.run": {"body": "fota.run(${1:buff},${2:offset},${3:len})", "description": "fota.run(buff, offset, len) - \u5199\u5165fota\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nzbuff/string fota\u6570\u636e\uff0c\u5c3d\u91cf\u7528zbuff\nint \u8d77\u59cb\u504f\u79fb\u91cf,\u4f20\u5165zbuff\u65f6\u6709\u6548,\u9ed8\u8ba4\u662f0\nint \u5199\u5165\u957f\u5ea6,\u4f20\u5165zbuff\u65f6\u6709\u6548,\u9ed8\u8ba4\u662fzbuff:used()\n\u8fd4\u56de\u503c\uff1a\nboolean \u6709\u5f02\u5e38\u8fd4\u56defalse\uff0c\u65e0\u5f02\u5e38\u8fd4\u56detrue\nboolean \u63a5\u6536\u5230\u6700\u540e\u4e00\u5757\u8fd4\u56detrue\nint \u8fd8\u672a\u5199\u5165\u7684\u6570\u636e\u91cf\uff0c\u8d85\u8fc764K\u5fc5\u987b\u505a\u7b49\u5f85\n\u4f8b\u5b50\uff1a\nlocal result, isDone, cache = fota.run(buf) -- \u5199\u5165fota\u6d41\u7a0b\n\n-- \u63d0\u793a: \uff0c\u5982\u679c\u4f20\u5165\u7684\u662fzbuff\uff0c\u5199\u5165\u6210\u529f\u540e\uff0c\u8bf7\u81ea\u884c\u6e05\u7a7azbuff\u5185\u7684\u6570\u636e\n\n-- 2024.4.3\u65b0\u589eoffset, len\u53c2\u6570, \u4ec5\u5bf9zbuff\u6709\u6548\nfota.run(buff, 0, 1024)\n", "prefix": "fota.run"}, "fota.file": {"body": "fota.file(${1:path})", "description": "fota.file(path) - \u4ece\u6307\u5b9a\u6587\u4ef6\u8bfb\u53d6fota\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring \u6587\u4ef6\u8def\u5f84\n\u8fd4\u56de\u503c\uff1a\nboolean \u6709\u5f02\u5e38\u8fd4\u56defalse\uff0c\u65e0\u5f02\u5e38\u8fd4\u56detrue\nboolean \u63a5\u6536\u5230\u6700\u540e\u4e00\u5757\u8fd4\u56detrue\nint \u8fd8\u672a\u5199\u5165\u7684\u6570\u636e\u91cf\uff0c\u8d85\u8fc764K\u5fc5\u987b\u505a\u7b49\u5f85\n\u4f8b\u5b50\uff1a\nlocal result, isDone, cache = fota.file(\"/xxx.bin\") -- \u5199\u5165fota\u6d41\u7a0b\n-- \u672cAPI\u4e8e2023.03.23 \u6dfb\u52a0\n", "prefix": "fota.file"}, "fota.isDone": {"body": "fota.isDone()", "description": "fota.isDone() - \u7b49\u5f85\u5e95\u5c42fota\u6d41\u7a0b\u5b8c\u6210\n\u8fd4\u56de\u503c\uff1a\nboolean \u6709\u5f02\u5e38\u8fd4\u56defalse\uff0c\u65e0\u5f02\u5e38\u8fd4\u56detrue\nboolean \u5199\u5165\u5230\u6700\u540e\u4e00\u5757\u8fd4\u56detrue\n\u4f8b\u5b50\uff1a\nlocal result, isDone = fota.isDone()\n", "prefix": "fota.isDone"}, "fota.finish": {"body": "fota.finish(${1:is_ok})", "description": "fota.finish(is_ok) - \u7ed3\u675ffota\u6d41\u7a0b\n\u4f20\u5165\u503c\uff1a\nboolean \u662f\u5426\u5b8c\u6574\u8d70\u5b8c\u6d41\u7a0b\uff0ctrue \u8868\u793a\u6b63\u786e\u8d70\u5b8c\u6d41\u7a0b\u4e86\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue, \u5931\u8d25\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u7ed3\u675ffota\u6d41\u7a0b\nlocal result = fota.finish(true)\n", "prefix": "fota.finish"}, "fs.fsstat": {"body": "fs.fsstat(${1:path})", "description": "fs.fsstat(path) - \u83b7\u53d6\u6587\u4ef6\u7cfb\u7edf\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nstring \u8def\u5f84,\u9ed8\u8ba4\"/\",\u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nboolean \u83b7\u53d6\u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\nint \u603b\u7684block\u6570\u91cf\nint \u5df2\u4f7f\u7528\u7684block\u6570\u91cf\nint block\u7684\u5927\u5c0f,\u5355\u4f4d\u5b57\u8282\nstring \u6587\u4ef6\u7cfb\u7edf\u7c7b\u578b,\u4f8b\u5982lfs\u4ee3\u8868littlefs\n\u4f8b\u5b50\uff1a\n-- \u6253\u5370\u6839\u5206\u533a\u7684\u4fe1\u606f\nlog.info(\"fsstat\", fs.fsstat(\"/\"))\n", "prefix": "fs.fsstat"}, "fs.fsize": {"body": "fs.fsize(${1:path})", "description": "fs.fsize(path) - \u83b7\u53d6\u6587\u4ef6\u5927\u5c0f\n\u4f20\u5165\u503c\uff1a\nstring \u6587\u4ef6\u8def\u5f84\n\u8fd4\u56de\u503c\uff1a\nint \u6587\u4ef6\u5927\u5c0f,\u82e5\u83b7\u53d6\u5931\u8d25\u4f1a\u8fd4\u56de0\n\u4f8b\u5b50\uff1a\n-- \u6253\u5370main.luac\u7684\u5927\u5c0f\nlog.info(\"fsize\", fs.fsize(\"/main.luac\"))\n", "prefix": "fs.fsize"}, "fskv.init": {"body": "fskv.init()", "description": "fskv.init() - \u521d\u59cb\u5316kv\u6570\u636e\u5e93\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nif fskv.init() then\n log.info(\"fdb\", \"kv\u6570\u636e\u5e93\u521d\u59cb\u5316\u6210\u529f\")\nend\n\n-- \u5173\u4e8e\u6e05\u7a7afdb\u5e93\n-- \u4e0b\u8f7d\u5de5\u5177\u662f\u6ca1\u6709\u63d0\u4f9b\u76f4\u63a5\u6e05\u9664fdb\u6570\u636e\u7684\u9014\u5f84\u7684, \u4f46\u6709\u529e\u6cd5\u89e3\u51b3\n-- \u5199\u4e00\u4e2amain.lua, \u6267\u884c fskv.kvdb_init \u540e \u6267\u884c fskv.clear() \u5373\u53ef\u5168\u6e05fdb\u6570\u636e.\n", "prefix": "fskv.init"}, "fskv.set": {"body": "fskv.set(${1:key},${2:value})", "description": "fskv.set(key, value) - \u8bbe\u7f6e\u4e00\u5bf9kv\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring key\u7684\u540d\u79f0,\u5fc5\u586b,\u4e0d\u80fd\u7a7a\u5b57\u7b26\u4e32\nstring \u7528\u6237\u6570\u636e,\u5fc5\u586b,\u4e0d\u80fdnil, \u652f\u6301\u5b57\u7b26\u4e32/\u6570\u503c/table/\u5e03\u5c14\u503c, \u6570\u636e\u957f\u5ea6\u6700\u59274095\u5b57\u8282\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u8bbe\u7f6e\u6570\u636e, \u5b57\u7b26\u4e32,\u6570\u503c,table,\u5e03\u5c14\u503c,\u5747\u53ef\n-- \u4f46\u4e0d\u53ef\u4ee5\u662fnil, function, userdata, task\nlog.info(\"fdb\", fskv.set(\"wendal\", \"goodgoodstudy\"))\nlog.info(\"fdb\", fskv.set(\"upgrade\", true))\nlog.info(\"fdb\", fskv.set(\"timer\", 1))\nlog.info(\"fdb\", fskv.set(\"bigd\", {name=\"wendal\",age=123}))\n", "prefix": "fskv.set"}, "fskv.sett": {"body": "fskv.sett(${1:key},${2:skey},${3:value})", "description": "fskv.sett(key, skey, value) - \u8bbe\u7f6etable\u5185\u7684\u952e\u503c\u5bf9\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring key\u7684\u540d\u79f0,\u5fc5\u586b,\u4e0d\u80fd\u7a7a\u5b57\u7b26\u4e32\nstring table\u7684key\u540d\u79f0, \u5fc5\u586b, \u4e0d\u80fd\u662f\u7a7a\u5b57\u7b26\u4e32\nstring \u7528\u6237\u6570\u636e,\u5fc5\u586b,\u652f\u6301\u5b57\u7b26\u4e32/\u6570\u503c/table/\u5e03\u5c14\u503c, \u6570\u636e\u957f\u5ea6\u6700\u59274095\u5b57\u8282\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse/nil\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u57282023.7.26\u65b0\u589e,\u6ce8\u610f\u4e0eset\u51fd\u6570\u533a\u522b\n-- \u8bbe\u7f6e\u6570\u636e, \u5b57\u7b26\u4e32,\u6570\u503c,table,\u5e03\u5c14\u503c,\u5747\u53ef\n-- \u4f46\u4e0d\u53ef\u4ee5\u662ffunction, userdata, task\nlog.info(\"fdb\", fskv.sett(\"mytable\", \"wendal\", \"goodgoodstudy\"))\nlog.info(\"fdb\", fskv.sett(\"mytable\", \"upgrade\", true))\nlog.info(\"fdb\", fskv.sett(\"mytable\", \"timer\", 1))\nlog.info(\"fdb\", fskv.sett(\"mytable\", \"bigd\", {name=\"wendal\",age=123}))\n\n-- \u4e0b\u5217\u8bed\u53e5\u5c06\u6253\u5370\u51fa4\u4e2a\u5143\u7d20\u7684table\nlog.info(\"fdb\", fskv.get(\"mytable\"), json.encode(fskv.get(\"mytable\")))\n-- \u6ce8\u610f: \u5982\u679ckey\u4e0d\u5b58\u5728, \u6216\u8005\u539f\u672c\u7684\u503c\u4e0d\u662ftable\u7c7b\u578b,\u5c06\u4f1a\u5b8c\u5168\u8986\u76d6\n-- \u4f8b\u5982\u4e0b\u5217\u5199\u6cd5,\u6700\u7ec8\u83b7\u53d6\u5230\u7684\u662ftable,\u800c\u975e\u7b2c\u4e00\u884c\u7684\u5b57\u7b26\u4e32\nlog.info(\"fdb\", fskv.set(\"mykv\", \"123\"))\nlog.info(\"fdb\", fskv.sett(\"mykv\", \"age\", \"123\")) -- \u4fdd\u5b58\u7684\u5c06\u662f {age:\"123\"}\n\n\n-- \u5982\u679c\u8bbe\u7f6e\u7684\u6570\u636e\u586bnil, \u4ee3\u8868\u5220\u9664\u5bf9\u5e94\u7684key\nlog.info(\"fdb\", fskv.sett(\"mykv\", \"name\", \"wendal\"))\nlog.info(\"fdb\", fskv.sett(\"mykv\", \"name\")) -- \u76f8\u5f53\u4e8e\u5220\u9664\n-- \n", "prefix": "fskv.sett"}, "fskv.get": {"body": "fskv.get(${1:key},${2:skey})", "description": "fskv.get(key, skey) - \u6839\u636ekey\u83b7\u53d6\u5bf9\u5e94\u7684\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring key\u7684\u540d\u79f0,\u5fc5\u586b,\u4e0d\u80fd\u7a7a\u5b57\u7b26\u4e32\nstring \u53ef\u9009\u7684\u6b21\u7ea7key,\u4ec5\u5f53\u539f\u59cb\u503c\u4e3atable\u65f6\u6709\u6548,\u76f8\u5f53\u4e8e fskv.get(key)[skey]\n\u8fd4\u56de\u503c\uff1a\nany \u5b58\u5728\u5219\u8fd4\u56de\u6570\u636e,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nif fskv.init() then\n log.info(\"fdb\", fskv.get(\"wendal\"))\nend\n\n-- \u82e5\u9700\u8981\"\u9ed8\u8ba4\u503c\", \u5bf9\u5e94\u975ebool\u5e03\u5c14\u503c, \u53ef\u4ee5\u8fd9\u6837\u5199\nlocal v = fskv.get(\"wendal\") or \"123\"\n", "prefix": "fskv.get"}, "fskv.del": {"body": "fskv.del(${1:key})", "description": "fskv.del(key) - \u6839\u636ekey\u5220\u9664\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring key\u7684\u540d\u79f0,\u5fc5\u586b,\u4e0d\u80fd\u7a7a\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nlog.info(\"fdb\", fskv.del(\"wendal\"))\n", "prefix": "fskv.del"}, "fskv.clear": {"body": "fskv.clear()", "description": "fskv.clear() - \u6e05\u7a7a\u6574\u4e2akv\u6570\u636e\u5e93\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u6e05\u7a7a\nfskv.clear()\n", "prefix": "fskv.clear"}, "fskv.iter": {"body": "fskv.iter()", "description": "fskv.iter() - kv\u6570\u636e\u5e93\u8fed\u4ee3\u5668\n\u8fd4\u56de\u503c\uff1a\nuserdata \u6210\u529f\u8fd4\u56de\u8fed\u4ee3\u5668\u6307\u9488,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u6e05\u7a7a\nlocal iter = fskv.iter()\nif iter then\n while 1 do\n local k = fskv.next(iter)\n if not k then\n break\n end\n log.info(\"fdb\", k, \"value\", fskv.kv_get(k))\n end\nend\n", "prefix": "fskv.iter"}, "fskv.next": {"body": "fskv.next(${1:iter})", "description": "fskv.next(iter) - kv\u8fed\u4ee3\u5668\u83b7\u53d6\u4e0b\u4e00\u4e2akey\n\u4f20\u5165\u503c\uff1a\nuserdata fskv.iter()\u8fd4\u56de\u7684\u6307\u9488\n\u8fd4\u56de\u503c\uff1a\nstring \u6210\u529f\u8fd4\u56de\u5b57\u7b26\u4e32key\u503c, \u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u6e05\u7a7a\nlocal iter = fskv.iter()\nif iter then\n while 1 do\n local k = fskv.next(iter)\n if not k then\n break\n end\n log.info(\"fskv\", k, \"value\", fskv.get(k))\n end\nend\n", "prefix": "fskv.next"}, "fskv.status": {"body": "fskv.status()", "description": "fskv.status() - \u83b7\u53d6kv\u6570\u636e\u5e93\u72b6\u6001\n\u8fd4\u56de\u503c\uff1a\nint \u5df2\u4f7f\u7528\u7684\u7a7a\u95f4,\u5355\u4f4d\u5b57\u8282\nint \u603b\u53ef\u7528\u7a7a\u95f4, \u5355\u4f4d\u5b57\u8282\nint \u603bkv\u952e\u503c\u5bf9\u6570\u91cf, \u5355\u4f4d\u4e2a\n\u4f8b\u5b50\uff1a\nlocal used, total,kv_count = fskv.status()\nlog.info(\"fdb\", \"kv\", used,total,kv_count)\n", "prefix": "fskv.status"}, "ftp.login": {"body": "ftp.login(${1:adapter},${2:ip_addr},${3:port},${4:username},${5:password})", "description": "ftp.login(adapter,ip_addr,port,username,password) - FTP\u5ba2\u6237\u7aef\n\u4f20\u5165\u503c\uff1a\nint \u9002\u914d\u5668\u5e8f\u53f7, \u53ea\u80fd\u662fsocket.ETH0, socket.STA, socket.AP,\u5982\u679c\u4e0d\u586b,\u4f1a\u9009\u62e9\u5e73\u53f0\u81ea\u5e26\u7684\u65b9\u5f0f,\u7136\u540e\u662f\u6700\u540e\u4e00\u4e2a\u6ce8\u518c\u7684\u9002\u914d\u5668\nstring ip_addr \u5730\u5740\nstring port \u7aef\u53e3,\u9ed8\u8ba421\nstring username \u7528\u6237\u540d\nstring password \u5bc6\u7801\nbool/table \u662f\u5426\u4e3assl\u52a0\u5bc6\u8fde\u63a5,\u9ed8\u8ba4\u4e0d\u52a0\u5bc6,true\u4e3a\u65e0\u8bc1\u4e66\u6700\u7b80\u5355\u7684\u52a0\u5bc6\uff0ctable\u4e3a\u6709\u8bc1\u4e66\u7684\u52a0\u5bc6
server_cert \u670d\u52a1\u5668ca\u8bc1\u4e66\u6570\u636e
client_cert \u5ba2\u6237\u7aefca\u8bc1\u4e66\u6570\u636e
client_key \u5ba2\u6237\u7aef\u79c1\u94a5\u52a0\u5bc6\u6570\u636e
client_password \u5ba2\u6237\u7aef\u79c1\u94a5\u53e3\u4ee4\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nbool/string \u6210\u529f\u8fd4\u56detrue \u5931\u8d25\u8fd4\u56destring\n\u4f8b\u5b50\uff1a\nftp_login = ftp.login(nil,\"xxx\")\n", "prefix": "ftp.login"}, "ftp.command": {"body": "ftp.command(${1:cmd})", "description": "ftp.command(cmd) - FTP\u547d\u4ee4\n\u4f20\u5165\u503c\uff1a\nstring cmd \u547d\u4ee4 \u76ee\u524d\u652f\u6301:NOOP SYST TYPE PWD MKD CWD CDUP RMD DELE LIST\n\u8fd4\u56de\u503c\uff1a\nstring \u6210\u529f\u8fd4\u56detrue \u5931\u8d25\u8fd4\u56destring\n\u4f8b\u5b50\uff1a\n // \u7a7a\u64cd\u4f5c\uff0c\u9632\u6b62\u8fde\u63a5\u65ad\u6389\n print(ftp.command(\"NOOP\").wait())\n // \u62a5\u544a\u8fdc\u7a0b\u7cfb\u7edf\u7684\u64cd\u4f5c\u7cfb\u7edf\u7c7b\u578b\n print(ftp.command(\"SYST\").wait())\n // \u6307\u5b9a\u6587\u4ef6\u7c7b\u578b\n print(ftp.command(\"TYPE I\").wait())\n // \u663e\u793a\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u540d\n print(ftp.command(\"PWD\").wait())\n // \u521b\u5efa\u76ee\u5f55\n print(ftp.command(\"MKD QWER\").wait())\n // \u6539\u53d8\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\n print(ftp.command(\"CWD /QWER\").wait())\n // \u8fd4\u56de\u4e0a\u4e00\u5c42\u76ee\u5f55\n print(ftp.command(\"CDUP\").wait())\n // \u5220\u9664\u76ee\u5f55\n print(ftp.command(\"RMD QWER\").wait())\n // \u83b7\u53d6\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\u540d\u5217\u8868\n print(ftp.command(\"LIST\").wait())\n // \u5220\u9664\u6587\u4ef6\n print(ftp.command(\"DELE /1/12222.txt\").wait())\n", "prefix": "ftp.command"}, "ftp.pull": {"body": "ftp.pull(${1:local_name},${2:remote_name})", "description": "ftp.pull(local_name,remote_name) - FTP\u6587\u4ef6\u4e0b\u8f7d\n\u4f20\u5165\u503c\uff1a\nstring local_name \u672c\u5730\u6587\u4ef6\nstring remote_name \u670d\u52a1\u5668\u6587\u4ef6\n\u8fd4\u56de\u503c\uff1a\nbool/string \u6210\u529f\u8fd4\u56detrue \u5931\u8d25\u8fd4\u56destring\n\u4f8b\u5b50\uff1a\nftp.pull(\"/1222.txt\",\"/1222.txt\").wait()\n", "prefix": "ftp.pull"}, "ftp.push": {"body": "ftp.push(${1:local_name},${2:remote_name})", "description": "ftp.push(local_name,remote_name) - FTP\u6587\u4ef6\u4e0a\u4f20\n\u4f20\u5165\u503c\uff1a\nstring local_name \u672c\u5730\u6587\u4ef6\nstring remote_name \u670d\u52a1\u5668\u6587\u4ef6\n\u8fd4\u56de\u503c\uff1a\nbool/string \u6210\u529f\u8fd4\u56detrue \u5931\u8d25\u8fd4\u56destring\n\u4f8b\u5b50\uff1a\nftp.push(\"/1222.txt\",\"/1222.txt\").wait()\n", "prefix": "ftp.push"}, "ftp.close": {"body": "ftp.close()", "description": "ftp.close() - FTP\u5ba2\u6237\u7aef\u5173\u95ed\n\u8fd4\u56de\u503c\uff1a\nbool/string \u6210\u529f\u8fd4\u56detrue \u5931\u8d25\u8fd4\u56destring\n\u4f8b\u5b50\uff1a\nftp.close().wait()\n", "prefix": "ftp.close"}, "ftp.debug": {"body": "ftp.debug(${1:onoff})", "description": "ftp.debug(onoff) - \u914d\u7f6e\u662f\u5426\u6253\u5f00debug\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nboolean \u662f\u5426\u6253\u5f00debug\u5f00\u5173\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "ftp.debug"}, "sm.sm2encrypt": {"body": "sm.sm2encrypt(${1:pkx},${2:pky},${3:data},${4:mode},${5:mode2})", "description": "sm.sm2encrypt(pkx,pky,data, mode, mode2) - sm2\u7b97\u6cd5\u52a0\u5bc6\n\u4f20\u5165\u503c\uff1a\nstring \u516c\u94a5x,\u5fc5\u9009. HEX\u5b57\u7b26\u4e32\nstring \u516c\u94a5y,\u5fc5\u9009. HEX\u5b57\u7b26\u4e32\nstring \u5f85\u8ba1\u7b97\u7684\u6570\u636e,\u5fc5\u9009,\u6700\u957f32\u5b57\u8282, \u975eHEX\u5b57\u7b26\u4e32\nboolean \u8f93\u51fa\u6a21\u5f0f,\u9ed8\u8ba4false. false-GMSSL\u9ed8\u8ba4\u683c\u5f0fDER, true-\u7f51\u7ad9\u517c\u5bb9\u6a21\u5f0f\nboolean \u6807\u51c6\u7248\u672c,\u9ed8\u8ba4false. false-C1C3C2\u65b0\u56fd\u9645, true-C1C2C3\u8001\u56fd\u9645\n\u8fd4\u56de\u503c\uff1a\nstring \u52a0\u5bc6\u540e\u7684\u5b57\u7b26\u4e32, \u539f\u6837\u8f93\u51fa,\u672a\u7ecfHEX\u8f6c\u6362. \u82e5\u52a0\u5bc6\u5931\u8d25\u4f1a\u8fd4\u56denil\u6216\u7a7a\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u63d0\u793a mode/mode2 \u53c2\u6570\u662f 2023.10.17 \u65b0\u589e\n-- \u7531\u4e8eSM2\u5728\u5404\u5e73\u53f0\u7684\u5b9e\u73b0\u90fd\u6709\u5dee\u5f02,\u7528\u6cd5\u52a1\u5fc5\u53c2\u8003demo\n", "prefix": "sm.sm2encrypt"}, "sm.sm2decrypt": {"body": "sm.sm2decrypt(${1:private},${2:data},${3:mode},${4:mode2})", "description": "sm.sm2decrypt(private,data,mode,mode2) - sm2\u7b97\u6cd5\u89e3\u5bc6\n\u4f20\u5165\u503c\uff1a\nstring \u79c1\u94a5,\u5fc5\u9009,HEX\u5b57\u7b26\u4e32\nstring \u5f85\u8ba1\u7b97\u7684\u6570\u636e,\u5fc5\u9009,\u539f\u59cb\u6570\u636e,\u975eHEX\u5b57\u7b26\u4e32\nboolean \u8f93\u51fa\u6a21\u5f0f,\u9ed8\u8ba4false. false-GMSSL\u9ed8\u8ba4\u683c\u5f0fDER, true-\u7f51\u7ad9\u517c\u5bb9\u6a21\u5f0f\nboolean \u6807\u51c6\u7248\u672c,\u9ed8\u8ba4false. false-C1C3C2\u65b0\u56fd\u9645, true-C1C2C3\u8001\u56fd\u9645\n\u8fd4\u56de\u503c\uff1a\nstring \u89e3\u5bc6\u540e\u7684\u5b57\u7b26\u4e32,\u672a\u7ecfHEX\u8f6c\u6362.\u82e5\u89e3\u5bc6\u5931\u8d25\u4f1a\u8fd4\u56denil\u6216\u7a7a\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u63d0\u793a mode/mode2 \u53c2\u6570\u662f 2023.10.17 \u65b0\u589e\n-- \u7531\u4e8eSM2\u5728\u5404\u5e73\u53f0\u7684\u5b9e\u73b0\u90fd\u6709\u5dee\u5f02,\u7528\u6cd5\u52a1\u5fc5\u53c2\u8003demo\n", "prefix": "sm.sm2decrypt"}, "sm.sm3": {"body": "sm.sm3(${1:data})", "description": "sm.sm3(data) - sm3\u7b97\u6cd5,\u7b97HASH\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u8ba1\u7b97\u7684\u6570\u636e,\u5fc5\u9009\n\u8fd4\u56de\u503c\uff1a\nstring \u5bf9\u5e94\u7684hash\u503c\n\u4f8b\u5b50\uff1a\nlocal encodeStr = gmssl.sm3(\"lqlq666lqlq946\")\nlog.info(\"testsm.sm3update\",string.toHex(encodeStr))\n", "prefix": "sm.sm3"}, "sm.sm3hmac": {"body": "sm.sm3hmac(${1:data},${2:key})", "description": "sm.sm3hmac(data, key) - sm3\u7b97\u6cd5,\u7b97HASH\u503c,\u4f46\u5e26HMAC\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u8ba1\u7b97\u7684\u6570\u636e,\u5fc5\u9009\nstring \u5bc6\u94a5\n\u8fd4\u56de\u503c\uff1a\nstring \u5bf9\u5e94\u7684hash\u503c\n\u4f8b\u5b50\uff1a\nlocal encodeStr = gmssl.sm3hmac(\"lqlq666lqlq946\", \"123\")\nlog.info(\"testsm.sm3update\",string.toHex(encodeStr))\n", "prefix": "sm.sm3hmac"}, "gmssl.sm4encrypt": {"body": "gmssl.sm4encrypt(${1:mode},${2:padding},${3:originStr},${4:password})", "description": "gmssl.sm4encrypt(mode,padding,originStr,password) - SM4\u52a0\u5bc6\u7b97\u6cd5\n\u4f20\u5165\u503c\uff1a\nstring \u52a0\u5bc6\u6a21\u5f0f, CBC\u6216ECB \nstring \u586b\u5145\u65b9\u5f0f, NONE/ZERO/PKCS5/PKCS7\nstring \u52a0\u5bc6\u7684\u5b57\u7b26\u4e32\nstring \u5bc6\u94a5\nstring \u504f\u79fb\u91cf\n\u8fd4\u56de\u503c\uff1a\nstring \u52a0\u5bc6\u540e\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\nlocal originStr = \"SM4 ECB ZeroPadding test\"\n--\u52a0\u5bc6\u6a21\u5f0f\uff1aECB\uff1b\u586b\u5145\u65b9\u5f0f\uff1aZeroPadding\uff1b\u5bc6\u94a5\uff1a1234567890123456\uff1b\u5bc6\u94a5\u957f\u5ea6\uff1a128 bit\nlocal encodeStr = gmssl.sm4encrypt(\"ECB\",\"ZERO\",originStr,\"1234567890123456\")\nprint(originStr,\"encrypt\",string.toHex(encodeStr))\nlog.info(\"testsm.decrypt\",gmssl.sm4decrypt(\"ECB\",\"ZERO\",encodeStr,\"1234567890123456\"))\n\noriginStr = \"SM4 ECB Pkcs5Padding test\"\n--\u52a0\u5bc6\u6a21\u5f0f\uff1aECB\uff1b\u586b\u5145\u65b9\u5f0f\uff1aPkcs5Padding\uff1b\u5bc6\u94a5\uff1a1234567890123456\uff1b\u5bc6\u94a5\u957f\u5ea6\uff1a128 bit\nencodeStr = gmssl.sm4encrypt(\"ECB\",\"PKCS5\",originStr,\"1234567890123456\")\nprint(originStr,\"encrypt\",string.toHex(encodeStr))\nlog.info(\"testsm.decrypt\",gmssl.sm4decrypt(\"ECB\",\"PKCS5\",encodeStr,\"1234567890123456\"))\n\noriginStr = \"SM4 CBC Pkcs5Padding test\"\n--\u52a0\u5bc6\u6a21\u5f0f\uff1aCBC\uff1b\u586b\u5145\u65b9\u5f0f\uff1aPkcs5Padding\uff1b\u5bc6\u94a5\uff1a1234567890123456\uff1b\u5bc6\u94a5\u957f\u5ea6\uff1a256 bit\uff1b\u504f\u79fb\u91cf\uff1a1234567890666666\nencodeStr = gmssl.sm4encrypt(\"CBC\",\"PKCS5\",originStr,\"1234567890123456\",\"1234567890666666\")\nprint(originStr,\"encrypt\",string.toHex(encodeStr))\nlog.info(\"testsm.decrypt\",gmssl.sm4decrypt(\"CBC\",\"PKCS5\",encodeStr,\"1234567890123456\",\"1234567890666666\"))\n", "prefix": "gmssl.sm4encrypt"}, "gmssl.sm4decrypt": {"body": "gmssl.sm4decrypt(${1:mode},${2:padding},${3:encodeStr},${4:password})", "description": "gmssl.sm4decrypt(mode,padding,encodeStr,password) - SM4\u89e3\u5bc6\u7b97\u6cd5\n\u4f20\u5165\u503c\uff1a\nstring \u52a0\u5bc6\u6a21\u5f0f, CBC\u6216ECB \nstring \u586b\u5145\u65b9\u5f0f, NONE/ZERO/PKCS5/PKCS7\nstring \u5df2\u52a0\u5bc6\u7684\u5b57\u7b26\u4e32\nstring \u5bc6\u94a5\nstring \u504f\u79fb\u91cf\n\u8fd4\u56de\u503c\uff1a\nstring \u89e3\u5bc6\u7684\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003gmssl.sm4encrypt\n", "prefix": "gmssl.sm4decrypt"}, "sm.sm2sign": {"body": "sm.sm2sign(${1:private},${2:data},${3:id})", "description": "sm.sm2sign(private,data,id) - sm2\u7b97\u6cd5\u7b7e\u540d\n\u4f20\u5165\u503c\uff1a\nstring \u79c1\u94a5,\u5fc5\u9009,HEX\u5b57\u7b26\u4e32\nstring \u5f85\u8ba1\u7b97\u7684\u6570\u636e,\u5fc5\u9009,\u539f\u59cb\u6570\u636e,\u975eHEX\u5b57\u7b26\u4e32\nstring id\u503c,\u975eHEX\u5b57\u7b26\u4e32,\u53ef\u9009,\u9ed8\u8ba4\u503c\"1234567812345678\"\n\u8fd4\u56de\u503c\uff1a\nstring \u524d\u9762\u5b57\u7b26\u4e32,\u672a\u7ecfHEX\u8f6c\u6362.\u82e5\u7b7e\u540d\u5931\u8d25\u4f1a\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e 2023.10.19 \u65b0\u589e\n-- \u5177\u4f53\u7528\u6cd5\u8bf7\u67e5\u9605demo\n", "prefix": "sm.sm2sign"}, "sm.sm2verify": {"body": "sm.sm2verify(${1:pkx},${2:pky},${3:data},${4:id},${5:sig})", "description": "sm.sm2verify(pkx, pky, data, id, sig) - sm2\u7b97\u6cd5\u9a8c\u7b7e\n\u4f20\u5165\u503c\uff1a\nstring \u516c\u94a5X,\u5fc5\u9009,HEX\u5b57\u7b26\u4e32\nstring \u516c\u94a5Y,\u5fc5\u9009,HEX\u5b57\u7b26\u4e32\nstring \u5f85\u8ba1\u7b97\u7684\u6570\u636e,\u5fc5\u9009,\u539f\u59cb\u6570\u636e,\u975eHEX\u5b57\u7b26\u4e32\nstring id\u503c,\u975eHEX\u5b57\u7b26\u4e32,\u53ef\u9009,\u9ed8\u8ba4\u503c\"1234567812345678\"\nstring \u7b7e\u540d\u6570\u636e,\u5fc5\u987b64\u5b57\u8282,\u975eHEX\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nboolean \u9a8c\u8bc1\u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e 2023.10.19 \u65b0\u589e\n-- \u5177\u4f53\u7528\u6cd5\u8bf7\u67e5\u9605demo\n", "prefix": "sm.sm2verify"}, "gpio.setup": {"body": "gpio.setup(${1:pin},${2:mode},${3:pull},${4:irq},${5:alt})", "description": "gpio.setup(pin, mode, pull, irq, alt) - \u8bbe\u7f6e\u7ba1\u811a\u529f\u80fd\n\u4f20\u5165\u503c\uff1a\nint pin gpio\u7f16\u53f7,\u5fc5\u987b\u662f\u6570\u503c\nany mode \u8f93\u5165\u8f93\u51fa\u6a21\u5f0f\uff1a
\u6570\u5b570/1\u4ee3\u8868\u8f93\u51fa\u6a21\u5f0f
nil\u4ee3\u8868\u8f93\u5165\u6a21\u5f0f
function\u4ee3\u8868\u4e2d\u65ad\u6a21\u5f0f\uff0c\u5982\u679c\u586bgpio.count\uff0c\u5219\u4e3a\u4e2d\u65ad\u8ba1\u6570\u529f\u80fd\uff0c\u4e2d\u65ad\u65f6\u4e0d\u56de\u8c03\nint pull \u4e0a\u62c9\u4e0b\u62c9\u6a21\u5f0f, \u53ef\u4ee5\u662f\u4e0a\u62c9\u6a21\u5f0f gpio.PULLUP \u6216\u4e0b\u62c9\u6a21\u5f0f gpio.PULLDOWN, \u6216\u8005\u5f00\u6f0f\u6a21\u5f0f 0. \u9700\u8981\u6839\u636e\u5b9e\u9645\u786c\u4ef6\u9009\u7528\nint irq \u4e2d\u65ad\u89e6\u53d1\u6a21\u5f0f,\u9ed8\u8ba4gpio.BOTH\u3002\u4e2d\u65ad\u89e6\u53d1\u6a21\u5f0f
\u4e0a\u5347\u6cbfgpio.RISING
\u4e0b\u964d\u6cbfgpio.FALLING
\u4e0a\u5347\u548c\u4e0b\u964d\u90fd\u89e6\u53d1gpio.BOTH \nint alt \u590d\u7528\u9009\u9879\uff0c\u76ee\u524d\u53ea\u6709EC618\u5e73\u53f0\u9700\u8981\u8fd9\u4e2a\u53c2\u6570\uff0c\u6709\u4e9bGPIO\u53ef\u4ee5\u590d\u7528\u5230\u4e0d\u540c\u5f15\u811a\u4e0a\uff0c\u53ef\u4ee5\u9009\u62e9\u590d\u7528\u9009\u9879\uff080\u6216\u80054\uff09\u4ece\u800c\u590d\u7528\u5230\u5bf9\u5e94\u7684\u5f15\u811a\u4e0a\n\u8fd4\u56de\u503c\uff1a\nany \u8f93\u51fa\u6a21\u5f0f\u8fd4\u56de\u8bbe\u7f6e\u7535\u5e73\u7684\u95ed\u5305, \u8f93\u5165\u6a21\u5f0f\u548c\u4e2d\u65ad\u6a21\u5f0f\u8fd4\u56de\u83b7\u53d6\u7535\u5e73\u7684\u95ed\u5305\n\u4f8b\u5b50\uff1a\n\n-- \u8bbe\u7f6egpio17\u4e3a\u8f93\u5165\ngpio.setup(17, nil)\n\n-- \u8bbe\u7f6egpio17\u4e3a\u8f93\u51fa,\u4e14\u521d\u59cb\u5316\u7535\u5e73\u4e3a\u4f4e,\u4f7f\u7528\u786c\u4ef6\u9ed8\u8ba4\u4e0a\u4e0b\u62c9\u914d\u7f6e\ngpio.setup(17, 0)\n\n-- \u8bbe\u7f6egpio17\u4e3a\u8f93\u51fa,\u4e14\u521d\u59cb\u5316\u7535\u5e73\u4e3a\u9ad8,\u4e14\u542f\u7528\u5185\u90e8\u4e0a\u62c9\ngpio.setup(17, 1, gpio.PULLUP)\n\n-- \u8bbe\u7f6egpio27\u4e3a\u4e2d\u65ad, \u9ed8\u8ba4\u53cc\u5411\u89e6\u53d1\ngpio.setup(27, function(val)\n print(\"IRQ_27\",val) -- \u63d0\u9192, val\u5e76\u4e0d\u4ee3\u8868\u89e6\u53d1\u65b9\u5411, \u4ec5\u4ee3\u8868\u4e2d\u65ad\u540e\u67d0\u4e2a\u65f6\u95f4\u70b9\u7684\u7535\u5e73\nend, gpio.PULLUP)\n\n-- \u8bbe\u7f6egpio27\u4e3a\u4e2d\u65ad, \u4ec5\u4e0a\u5347\u6cbf\u89e6\u53d1\ngpio.setup(27, function(val)\n print(\"IRQ_27\",val) -- \u63d0\u9192, val\u5e76\u4e0d\u4ee3\u8868\u89e6\u53d1\u65b9\u5411, \u4ec5\u4ee3\u8868\u4e2d\u65ad\u540e\u67d0\u4e2a\u65f6\u95f4\u70b9\u7684\u7535\u5e73\nend, gpio.PULLUP, gpio.RISING)\n\n-- \u4e2d\u65ad\u8ba1\u6570 \u4e8e2024.5.8\u65b0\u589e\n-- \u8bbe\u7f6egpio7\u4e3a\u4e2d\u65ad\u8ba1\u6570\uff0c\u8be6\u7ec6demo\u89c1gpio/gpio_irq_count\ngpio.setup(7, gpio.count)\n\n-- alt_func \u4e8e2023.7.2\u65b0\u589e\n-- \u672c\u529f\u80fd\u4ec5\u5bf9\u90e8\u5206\u5e73\u53f0\u6709\u6548, \u4e14\u4ec5\u7528\u4e8e\u8c03\u6574GPIO\u590d\u7528,\u5176\u4ed6\u590d\u7528\u65b9\u5f0f\u8bf7\u4f7f\u7528muc.iomux\u51fd\u6570\n-- \u4ee5\u4e0b\u793a\u4f8b\u4ee3\u7801, \u5c06I2S_DOUT\u590d\u7528\u6210gpio18\n-- AIR780E\u7684PIN33(\u6a21\u5757\u7ba1\u811a\u5e8f\u53f7), \u5bf9\u5e94paddr 38, \u9ed8\u8ba4\u529f\u80fd\u662fI2S_DOUT, \u590d\u7528\u6210gpio18\n-- \u65b9\u5411\u8f93\u51fa,\u4e14\u521d\u59cb\u5316\u7535\u5e73\u4e3a\u4f4e,\u4f7f\u7528\u786c\u4ef6\u9ed8\u8ba4\u4e0a\u4e0b\u62c9\u914d\u7f6e\n-- Air780E(EC618\u7cfb\u5217\u7684GPIO\u590d\u7528\u8bf7\u67e5\u9605 https://air780e.cn \u9996\u9875\u786c\u4ef6\u8d44\u6599\u8868\u683c\u4e2d\u7684Air780E&Air780EG&Air780EX&Air700E_GPIO_table_20231227.pdf)\n-- Air780EP(EC718P\u7cfb\u5217\u7684GPIO\u590d\u7528\u8bf7\u67e5\u9605 https://air780ep.cn \u9996\u9875\u786c\u4ef6\u8d44\u6599\u8868\u683c\u4e2d\u7684Air780E&Air780EG&Air780EX&Air700E_GPIO_table_20231227.pdf)\ngpio.setup(18, 0, nil, nil, 4)\n\n-- \u63d0\u9192: \n-- \u5f53\u7ba1\u811a\u4e3a\u8f93\u5165\u6a21\u5f0f\u6216\u4e2d\u65ad,\u624d\u80fd\u901a\u8fc7gpio.get()\u83b7\u53d6\u5230\u7535\u5e73\n-- \u5f53\u7ba1\u811a\u4e3a\u8f93\u51fa\u6a21\u5f0f,\u624d\u80fd\u901a\u8fc7gpio.set()\u8bbe\u7f6e\u7535\u5e73\n-- \u5f53\u7ba1\u811a\u4e3a\u8f93\u51fa\u6a21\u5f0f,\u901a\u8fc7gpio.get()\u603b\u4f1a\u5f97\u52300\n-- \u4e2d\u65ad\u56de\u8c03\u7684val\u53c2\u6570\u4e0d\u4ee3\u8868\u89e6\u53d1\u65b9\u5411, \u4ec5\u4ee3\u8868\u4e2d\u65ad\u540e\u67d0\u4e2a\u65f6\u95f4\u70b9\u7684\u7535\u5e73\n-- \u5bf9Cat.1\u6a21\u5757,EC618\u7cfb\u5217\u53ea\u6709AONGPIO\u624d\u80fd\u53cc\u5411\u89e6\u53d1\uff0c\u5176\u4ed6\u7cfb\u5217\u6240\u6709GPIO\u90fd\u80fd\u53cc\u5411\u89e6\u53d1\uff0c\u5177\u4f53\u770b\u786c\u4ef6\u624b\u518c\n-- \u9ed8\u8ba4\u8bbe\u7f6e\u4e0b,\u4e2d\u65ad\u662f\u6ca1\u6709\u9632\u6296\u65f6\u95f4\u7684,\u53ef\u4ee5\u901a\u8fc7gpio.set_debounce(pin, 50)\u6765\u8bbe\u7f6e\u9632\u6296\u65f6\u95f4\n\n-- pull\u53c2\u6570\u7684\u989d\u5916\u8bf4\u660e, \u4e0a\u62c9/\u4e0b\u62c9\u914d\u7f6e\n-- \u5bf9\u4e8e\u90e8\u5206\u7684BSP\u6765\u8bf4, \u53ea\u652f\u6301 gpio.PULLUP \u6216 gpio.PULLDOWN, \u4f46\u6709\u90e8\u5206BSP\u652f\u6301\u5f00\u6f0f\u6a21\u5f0f\n-- \u5bf9\u4e8e\u652f\u6301\u5f00\u6f0f\u7684bsp, pull\u53c2\u6570\u8981\u4f20 0 \u624d\u80fd\u5f00\u542f\u5f00\u6f0f\u6a21\u5f0f, \u4e0d\u662f\u4f20nil\n-- \u4f8b\u5982:\n-- EC618\u7cfb\u5217(Air780E/Air780EG/Air780EX/Air700E\u7b49)\n-- EC718\u7cfb\u5217(Air780EP/Air780EPV\u7b49)\n-- XT804\u7cfb\u5217(Air101/Air103/Air601)\n", "prefix": "gpio.setup"}, "gpio.caplevel": {"body": "gpio.caplevel(${1:pin},${2:level},${3:func})", "description": "gpio.caplevel(pin, level,func) - \u6355\u83b7\u7ba1\u811a\u7535\u5e73\u6301\u7eed\u65f6\u957f\uff0c\u5355\u4f4dus\n\u4f20\u5165\u503c\uff1a\nint pin GPIO\u7f16\u53f7,\u5fc5\u987b\u662f\u6570\u503c\nint level \u9700\u8981\u6355\u83b7\u7684\u7535\u5e73, \u53ef\u4ee5\u662f \u9ad8\u7535\u5e73gpio.HIGH, \u4f4e\u7535\u5e73gpio.LOW, \u6216\u8005\u76f4\u63a5\u5199\u6570\u503c1\u62160\uff0c\u5373\u7ba1\u811a\u4e0a\u6b63\u5e38\u65f6\u95f4\u5904\u4e8elevel\u7684\u53cd\uff0c\u6355\u83b7\u8bbe\u5b9a\u7684level\u6301\u7eed\u65f6\u95f4\nfunction func \u5b8c\u6210\u6355\u83b7\u540e\u7684\u56de\u8c03\u51fd\u6570\uff0c\u4ec5\u4e00\u4e2a\u53c2\u6570\uff0c\u53c2\u6570\u4e3a\u6355\u83b7\u5230\u7684\u65f6\u95f4\u957f\u5ea6number\u578b\u6570\u503c\uff0c\u5355\u4f4dus\n\u8fd4\u56de\u503c\uff1a\nany \u8fd4\u56de\u83b7\u53d6\u7535\u5e73\u7684\u95ed\u5305\n\u4f8b\u5b50\uff1a\n-- \u6355\u83b7pin.PA07\u4e3a\u9ad8\u7535\u5e73\u7684\u6301\u7eed\u65f6\u95f4\ngpio.caplevel(pin.PA07,1,function(val) print(val) end)\n", "prefix": "gpio.caplevel"}, "gpio.set": {"body": "gpio.set(${1:pin},${2:value})", "description": "gpio.set(pin, value) - \u8bbe\u7f6e\u7ba1\u811a\u7535\u5e73\n\u4f20\u5165\u503c\uff1a\nint pin GPIO\u7f16\u53f7,\u5fc5\u987b\u662f\u6570\u503c\nint value \u7535\u5e73, \u53ef\u4ee5\u662f \u9ad8\u7535\u5e73gpio.HIGH, \u4f4e\u7535\u5e73gpio.LOW, \u6216\u8005\u76f4\u63a5\u5199\u6570\u503c1\u62160\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u8bbe\u7f6egpio17\u4e3a\u4f4e\u7535\u5e73\ngpio.set(17, 0)\n", "prefix": "gpio.set"}, "gpio.get": {"body": "gpio.get(${1:pin})", "description": "gpio.get(pin) - \u83b7\u53d6\u7ba1\u811a\u7535\u5e73\n\u4f20\u5165\u503c\uff1a\nint pin GPIO\u7f16\u53f7,\u5fc5\u987b\u662f\u6570\u503c\n\u8fd4\u56de\u503c\uff1a\nvalue \u7535\u5e73, \u9ad8\u7535\u5e73gpio.HIGH, \u4f4e\u7535\u5e73gpio.LOW, \u5bf9\u5e94\u6570\u503c1\u548c0\n\u4f8b\u5b50\uff1a\n-- \u83b7\u53d6gpio17\u7684\u5f53\u524d\u7535\u5e73\ngpio.get(17)\n", "prefix": "gpio.get"}, "gpio.close": {"body": "gpio.close(${1:pin})", "description": "gpio.close(pin) - \u5173\u95ed\u7ba1\u811a\u529f\u80fd(\u9ad8\u963b\u8f93\u5165\u6001),\u5173\u6389\u4e2d\u65ad\n\u4f20\u5165\u503c\uff1a\nint pin GPIO\u7f16\u53f7,\u5fc5\u987b\u662f\u6570\u503c\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c,\u603b\u662f\u6267\u884c\u6210\u529f\n\u4f8b\u5b50\uff1a\n-- \u5173\u95edgpio17\ngpio.close(17)\n", "prefix": "gpio.close"}, "gpio.setDefaultPull": {"body": "gpio.setDefaultPull(${1:val})", "description": "gpio.setDefaultPull(val) - \u8bbe\u7f6eGPIO\u811a\u7684\u9ed8\u8ba4\u4e0a\u62c9/\u4e0b\u62c9\u8bbe\u7f6e, \u9ed8\u8ba4\u662f\u5e73\u53f0\u81ea\u5b9a\u4e49(\u4e00\u822c\u4e3a\u5f00\u6f0f).\n\u4f20\u5165\u503c\uff1a\nint val 0\u5e73\u53f0\u81ea\u5b9a\u4e49,1\u4e0a\u62c9, 2\u4e0b\u62c9\n\u8fd4\u56de\u503c\uff1a\nboolean \u4f20\u503c\u6b63\u786e\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u8bbe\u7f6egpio.setup\u7684pull\u9ed8\u8ba4\u503c\u4e3a\u4e0a\u62c9\ngpio.setDefaultPull(1)\n", "prefix": "gpio.setDefaultPull"}, "gpio.toggle": {"body": "gpio.toggle(${1:pin})", "description": "gpio.toggle(pin) - \u53d8\u6362GPIO\u811a\u8f93\u51fa\u7535\u5e73,\u4ec5\u8f93\u51fa\u6a21\u5f0f\u53ef\u7528\n\u4f20\u5165\u503c\uff1a\nint \u7ba1\u811a\u7684GPIO\u53f7\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e 2022.05.17 \u6dfb\u52a0\n-- \u5047\u8bbeGPIO16\u4e0a\u6709LED, \u6bcf500ms\u5207\u6362\u4e00\u6b21\u5f00\u5173\ngpio.setup(16, 0)\nsys.timerLoopStart(function()\n gpio.toggle(16)\nend, 500)\n", "prefix": "gpio.toggle"}, "gpio.pulse": {"body": "gpio.pulse(${1:pin},${2:level},${3:len},${4:delay})", "description": "gpio.pulse(pin,level,len,delay) - \u5728\u540c\u4e00\u4e2aGPIO\u8f93\u51fa\u4e00\u7ec4\u8109\u51b2, \u6ce8\u610f, len\u7684\u5355\u4f4d\u662fbit, \u9ad8\u4f4d\u5728\u524d.\n\u4f20\u5165\u503c\uff1a\nint gpio\u53f7\nint/string \u6570\u503c\u6216\u8005\u5b57\u7b26\u4e32.\nint len \u957f\u5ea6 \u5355\u4f4d\u662fbit, \u9ad8\u4f4d\u5728\u524d.\nint delay \u5ef6\u8fdf,\u5f53\u524d\u65e0\u56fa\u5b9a\u65f6\u95f4\u5355\u4f4d\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u901a\u8fc7PB06\u811a\u8f93\u51fa\u8f93\u51fa8\u4e2a\u7535\u5e73\u53d8\u5316.\ngpio.pulse(pin.PB06,0xA9, 8, 0)\n", "prefix": "gpio.pulse"}, "gpio.debounce": {"body": "gpio.debounce(${1:pin},${2:ms},${3:mode})", "description": "gpio.debounce(pin, ms, mode) - \u9632\u6296\u8bbe\u7f6e, \u6839\u636e\u786c\u4ef6ticks\u8fdb\u884c\u9632\u6296\n\u4f20\u5165\u503c\uff1a\nint gpio\u53f7, 0~127, \u4e0e\u786c\u4ef6\u76f8\u5173\nint \u9632\u6296\u65f6\u957f,\u5355\u4f4d\u6beb\u79d2, \u6700\u5927 65555 ms, \u8bbe\u7f6e\u4e3a0\u5219\u5173\u95ed\nint \u6a21\u5f0f, 0\u51b7\u5374\u6a21\u5f0f, 1\u5ef6\u65f6\u6a21\u5f0f. \u9ed8\u8ba4\u662f0\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u6d88\u6296\u6a21\u5f0f, \u5f53\u524d\u652f\u63012\u79cd, 2022.12.16\u5f00\u59cb\u652f\u6301mode=1\n-- 0 \u89e6\u53d1\u4e2d\u65ad\u540e,\u9a6c\u4e0a\u4e0a\u62a5\u4e00\u6b21, \u7136\u540e\u51b7\u5374N\u4e2a\u6beb\u79d2\u540e,\u91cd\u65b0\u63a5\u53d7\u4e2d\u65ad\n-- 1 \u89e6\u53d1\u4e2d\u65ad\u540e,\u5ef6\u8fdfN\u4e2a\u6beb\u79d2,\u671f\u95f4\u6ca1\u6709\u65b0\u4e2d\u65ad\u4e14\u7535\u5e73\u6ca1\u6709\u53d8\u5316,\u4e0a\u62a5\u4e00\u6b21\n\n-- \u5f00\u542f\u9632\u6296, \u6a21\u5f0f0-\u51b7\u5374, \u4e2d\u65ad\u540e\u9a6c\u4e0a\u4e0a\u62a5, \u4f46100ms\u5185\u53ea\u4e0a\u62a5\u4e00\u6b21\ngpio.debounce(7, 100) -- \u82e5\u82af\u7247\u652f\u6301pin\u5e93, \u53ef\u7528pin.PA7\u4ee3\u66ff\u6570\u5b577\n-- \u5f00\u542f\u9632\u6296, \u6a21\u5f0f1-\u5ef6\u65f6, \u4e2d\u65ad\u540e\u7b49\u5f85100ms,\u671f\u95f4\u82e5\u4fdd\u6301\u8be5\u7535\u5e73\u4e86,\u65f6\u95f4\u5230\u4e4b\u540e\u4e0a\u62a5\u4e00\u6b21\n-- \u5bf9\u5e94\u7684,\u5982\u679c\u8f93\u5165\u7684\u662f\u4e00\u4e2a 50hz\u7684\u65b9\u6ce2,\u90a3\u4e48\u4e0d\u4f1a\u89e6\u53d1\u4efb\u4f55\u4e0a\u62a5\ngpio.debounce(7, 100, 1)\n\n-- \u5173\u95ed\u9632\u6296,\u65f6\u95f4\u8bbe\u7f6e\u4e3a0\u5c31\u5173\u95ed\ngpio.debounce(7, 0)\n", "prefix": "gpio.debounce"}, "gpio.count": {"body": "gpio.count(${1:pin})", "description": "gpio.count(pin) - \u83b7\u53d6gpio\u4e2d\u65ad\u6570\u91cf\uff0c\u5e76\u6e05\u7a7a\u7d2f\u8ba1\u503c\uff0c\u7c7b\u4f3cair724\u7684\u8109\u51b2\u8ba1\u6570\n\u4f20\u5165\u503c\uff1a\nint gpio\u53f7, 0~127, \u4e0e\u786c\u4ef6\u76f8\u5173\n\u8fd4\u56de\u503c\uff1a\nint \u8fd4\u56de\u4ece\u4e0a\u6b21\u83b7\u53d6\u4e2d\u65ad\u6570\u91cf\u540e\u5230\u5f53\u524d\u7684\u4e2d\u65ad\u8ba1\u6570\n\u4f8b\u5b50\uff1a\nlog.info(\"irq cnt\", gpio.count(10))\n", "prefix": "gpio.count"}, "gtfont.init": {"body": "gtfont.init(${1:spi_device})", "description": "gtfont.init(spi_device) - \u521d\u59cb\u5316\u9ad8\u901a\u5b57\u4f53\u82af\u7247\n\u4f20\u5165\u503c\uff1a\nuserdata \u4ec5\u652f\u6301spi device \u751f\u6210\u7684\u6307\u9488\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u7279\u522b\u63d0\u9192: \u4f7f\u7528\u672c\u5e93\u7684\u4efb\u4f55\u4ee3\u7801, \u90fd\u9700\u8981 \u989d\u5916 \u7684 \u9ad8\u901a\u5b57\u4f53\u82af\u7247 !!\n-- \u6ca1\u6709\u989d\u5916\u82af\u7247\u662f\u8dd1\u4e0d\u4e86\u7684!!\ngtfont.init(spi_device)\n", "prefix": "gtfont.init"}, "hmeta.model": {"body": "hmeta.model()", "description": "hmeta.model() - \u83b7\u53d6\u6a21\u7ec4\u540d\u79f0\n\u8fd4\u56de\u503c\uff1a\nstring \u82e5\u80fd\u8bc6\u522b\u5230,\u8fd4\u56de\u6a21\u7ec4\u7c7b\u578b, \u5426\u5219\u4f1a\u662fnil\n\u4f8b\u5b50\uff1a\nsys.taskInit(function()\n while 1 do\n sys.wait(3000)\n -- hmeta\u8bc6\u522b\u5e95\u5c42\u6a21\u7ec4\u7c7b\u578b\u7684\n -- \u4e0d\u540c\u7684\u6a21\u7ec4\u53ef\u4ee5\u4f7f\u7528\u76f8\u540c\u7684bsp,\u4f46\u6839\u636e\u5c01\u88c5\u7684\u4e0d\u540c,\u6839\u636e\u5185\u90e8\u6570\u636e\u4ecd\u53ef\u8bc6\u522b\u51fa\u5177\u4f53\u6a21\u5757\n log.info(\"hmeta\", hmeta.model())\n log.info(\"bsp\", rtos.bsp())\n end\nend)\n", "prefix": "hmeta.model"}, "hmeta.hwver": {"body": "hmeta.hwver()", "description": "hmeta.hwver() - \u83b7\u53d6\u6a21\u7ec4\u7684\u786c\u4ef6\u7248\u672c\u53f7\n\u8fd4\u56de\u503c\uff1a\nstring \u82e5\u80fd\u8bc6\u522b\u5230,\u8fd4\u56de\u6a21\u7ec4\u7c7b\u578b, \u5426\u5219\u4f1a\u662fnil\n\u4f8b\u5b50\uff1a\nsys.taskInit(function()\n while 1 do\n sys.wait(3000)\n -- hmeta\u8bc6\u522b\u5e95\u5c42\u6a21\u7ec4\u7c7b\u578b\u7684\n -- \u4e0d\u540c\u7684\u6a21\u7ec4\u53ef\u4ee5\u4f7f\u7528\u76f8\u540c\u7684bsp,\u4f46\u6839\u636e\u5c01\u88c5\u7684\u4e0d\u540c,\u6839\u636e\u5185\u90e8\u6570\u636e\u4ecd\u53ef\u8bc6\u522b\u51fa\u5177\u4f53\u6a21\u5757\n log.info(\"hmeta\", hmeta.model(), hmeta.hwver())\n log.info(\"bsp\", rtos.bsp())\n end\nend)\n", "prefix": "hmeta.hwver"}, "hmeta.chip": {"body": "hmeta.chip()", "description": "hmeta.chip() - \u83b7\u53d6\u539f\u59cb\u82af\u7247\u578b\u53f7\n\u8fd4\u56de\u503c\uff1a\nstring \u82e5\u80fd\u8bc6\u522b\u5230,\u8fd4\u56de\u82af\u7247\u7c7b\u578b, \u5426\u5219\u4f1a\u662fnil\n\u4f8b\u5b50\uff1a\n-- \u82e5\u5e95\u5c42\u6b63\u786e\u5b9e\u73b0, \u8fd9\u4e2a\u51fd\u6570\u603b\u4f1a\u8fd4\u56de\u503c\n-- \u672c\u51fd\u6570\u4e8e 2024.12.5 \u65b0\u589e\n", "prefix": "hmeta.chip"}, "ht1621.setup": {"body": "ht1621.setup(${1:pin_cs},${2:pin_data},${3:pin_wr},${4:cmd_com_mode},${5:cmd_rc},${6:cmd_sysen})", "description": "ht1621.setup(pin_cs, pin_data, pin_wr, cmd_com_mode, cmd_rc, cmd_sysen) - \u521d\u59cb\u5316ht1621\n\u4f20\u5165\u503c\uff1a\nint \u7247\u9009\u5f15\u811a, \u586b\u6a21\u5757\u7684GPIO\u7f16\u7801\nint \u6570\u636e\u5f15\u811a, \u586b\u6a21\u5757\u7684GPIO\u7f16\u7801\nint WR\u5f15\u811a, \u586b\u6a21\u5757\u7684GPIO\u7f16\u7801\nint \u547d\u4ee4\u6a21\u5f0f, \u9ed8\u8ba4\u662f0x52\nint \u5185\u90e8RC\u632f\u8361\u5668,\u9ed8\u8ba40x30\nint \u7cfb\u7edf\u632f\u8361\u5668\u5f00,\u9ed8\u8ba40x02\n\u8fd4\u56de\u503c\uff1a\nuserdata \u8fd4\u56deht1621\u5bf9\u8c61\n\u4f8b\u5b50\uff1a\nlocal seg = ht1621.setup(4, 5, 3)\nht1621.data(seg, 0, 0xeb)\n", "prefix": "ht1621.setup"}, "ht1621.lcd": {"body": "ht1621.lcd(${1:seg},${2:onoff})", "description": "ht1621.lcd(seg, onoff) - LCD\u5f00\u5173\n\u4f20\u5165\u503c\uff1a\nuserdata ht1621.setup\u8fd4\u56de\u7684ht1621\u5bf9\u8c61\nboolean true\u5f00,false\u5173\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlocal seg = ht1621.setup(4, 5, 3)\nht1621.lcd(seg, true)\n", "prefix": "ht1621.lcd"}, "ht1621.data": {"body": "ht1621.data(${1:seg},${2:addr},${3:sdat})", "description": "ht1621.data(seg, addr, sdat) - \u5c55\u793a\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nuserdata ht1621.setup\u8fd4\u56de\u7684ht1621\u5bf9\u8c61\nint \u5730\u5740, 0-6, \u8d85\u8fc76\u65e0\u6548\nint \u6570\u636e, 0-255\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlocal seg = ht1621.setup(4, 5, 3)\nht1621.lcd(seg, true)\nht1621.data(seg, 0, 0xF1)\n-- \u9644\u6570\u5b570-9\u7684\u503c\u8868\n-- 0,1,2,3,4,5,6,7,8,9\n-- 0xeb,0x0a,0xad,0x8f,0x4e,0xc7,0xe7,0x8a,0xef,0xcf\n", "prefix": "ht1621.data"}, "ht1621.cmd": {"body": "ht1621.cmd(${1:seg},${2:cmd})", "description": "ht1621.cmd(seg, cmd) - \u53d1\u9001\u6307\u4ee4\n\u4f20\u5165\u503c\uff1a\nuserdata ht1621.setup\u8fd4\u56de\u7684ht1621\u5bf9\u8c61\nint \u6307\u4ee4, 0-255\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u5177\u4f53\u6307\u4ee4\u8bf7\u67e5\u9605\u786c\u4ef6\u624b\u518c\n", "prefix": "ht1621.cmd"}, "http.request": {"body": "http.request(${1:method},${2:url},${3:headers},${4:body},${5:opts},${6:ca_file},${7:client_ca},${8:client_key},${9:client_password})", "description": "http.request(method,url,headers,body,opts,ca_file,client_ca, client_key, client_password) - http\u5ba2\u6237\u7aef\n\u4f20\u5165\u503c\uff1a\nstring \u8bf7\u6c42\u65b9\u6cd5, \u652f\u6301 GET/POST \u7b49\u5408\u6cd5\u7684HTTP\u65b9\u6cd5\nstring url\u5730\u5740, \u652f\u6301 http\u548chttps, \u652f\u6301\u57df\u540d, \u652f\u6301\u81ea\u5b9a\u4e49\u7aef\u53e3\ntabal \u8bf7\u6c42\u5934 \u53ef\u9009 \u4f8b\u5982 {[\"Content-Type\"] = \"application/x-www-form-urlencoded\"}\nstring/zbuff body \u53ef\u9009\ntable \u989d\u5916\u914d\u7f6e \u53ef\u9009 \u5305\u542b timeout:\u8d85\u65f6\u65f6\u95f4\u5355\u4f4dms \u53ef\u9009,\u9ed8\u8ba410\u5206\u949f,\u51990\u5373\u6c38\u4e45\u7b49\u5f85 dst:\u4e0b\u8f7d\u8def\u5f84,\u53ef\u9009 adapter:\u9009\u62e9\u4f7f\u7528\u7f51\u5361,\u53ef\u9009 debug:\u662f\u5426\u6253\u5f00debug\u4fe1\u606f,\u53ef\u9009,ipv6:\u662f\u5426\u4e3aipv6 \u9ed8\u8ba4\u4e0d\u662f,\u53ef\u9009 callback:\u4e0b\u8f7d\u56de\u8c03\u51fd\u6570,\u53c2\u6570 content_len:\u603b\u957f\u5ea6 body_len:\u4ee5\u4e0b\u8f7d\u957f\u5ea6 userdata \u7528\u6237\u4f20\u53c2,\u53ef\u9009 userdata:\u56de\u8c03\u81ea\u5b9a\u4e49\u4f20\u53c2 \nstring \u670d\u52a1\u5668ca\u8bc1\u4e66\u6570\u636e, \u53ef\u9009, \u4e00\u822c\u4e0d\u9700\u8981\nstring \u5ba2\u6237\u7aefca\u8bc1\u4e66\u6570\u636e, \u53ef\u9009, \u4e00\u822c\u4e0d\u9700\u8981, \u53cc\u5411https\u8ba4\u8bc1\u624d\u9700\u8981\nstring \u5ba2\u6237\u7aef\u79c1\u94a5\u52a0\u5bc6\u6570\u636e, \u53ef\u9009, \u4e00\u822c\u4e0d\u9700\u8981, \u53cc\u5411https\u8ba4\u8bc1\u624d\u9700\u8981\nstring \u5ba2\u6237\u7aef\u79c1\u94a5\u53e3\u4ee4\u6570\u636e, \u53ef\u9009, \u4e00\u822c\u4e0d\u9700\u8981, \u53cc\u5411https\u8ba4\u8bc1\u624d\u9700\u8981\n\u8fd4\u56de\u503c\uff1a\nint code , \u670d\u52a1\u5668\u53cd\u9988\u7684\u503c>=100, \u6700\u5e38\u89c1\u7684\u662f200.\u5982\u679c\u662f\u5e95\u5c42\u9519\u8bef,\u4f8b\u5982\u8fde\u63a5\u5931\u8d25, \u8fd4\u56de\u503c\u5c0f\u4e8e0\ntabal headers \u5f53code>100\u65f6, \u4ee3\u8868\u670d\u52a1\u5668\u8fd4\u56de\u7684\u5934\u90e8\u6570\u636e \nstring/int body \u670d\u52a1\u5668\u54cd\u5e94\u7684\u5185\u5bb9\u5b57\u7b26\u4e32,\u5982\u679c\u662f\u4e0b\u8f7d\u6a21\u5f0f, \u5219\u8fd4\u56de\u6587\u4ef6\u5927\u5c0f\n\u4f8b\u5b50\uff1a\n\n--[[\ncode\u62a5\u9519\u4fe1\u606f\u5217\u8868:\n-1 HTTP_ERROR_STATE \u9519\u8bef\u7684\u72b6\u6001, \u4e00\u822c\u662f\u5e95\u5c42\u5f02\u5e38,\u8bf7\u62a5issue\n-2 HTTP_ERROR_HEADER \u9519\u8bef\u7684\u54cd\u5e94\u5934\u90e8, \u901a\u5e38\u662f\u670d\u52a1\u5668\u95ee\u9898\n-3 HTTP_ERROR_BODY \u9519\u8bef\u7684\u54cd\u5e94\u4f53,\u901a\u5e38\u662f\u670d\u52a1\u5668\u95ee\u9898\n-4 HTTP_ERROR_CONNECT \u8fde\u63a5\u670d\u52a1\u5668\u5931\u8d25, \u672a\u8054\u7f51,\u5730\u5740\u9519\u8bef,\u57df\u540d\u9519\u8bef\n-5 HTTP_ERROR_CLOSE \u63d0\u524d\u65ad\u5f00\u4e86\u8fde\u63a5, \u7f51\u7edc\u6216\u670d\u52a1\u5668\u95ee\u9898\n-6 HTTP_ERROR_RX \u63a5\u6536\u6570\u636e\u62a5\u9519, \u7f51\u7edc\u95ee\u9898\n-7 HTTP_ERROR_DOWNLOAD \u4e0b\u8f7d\u6587\u4ef6\u8fc7\u7a0b\u62a5\u9519, \u7f51\u7edc\u95ee\u9898\u6216\u4e0b\u8f7d\u8def\u5f84\u95ee\u9898\n-8 HTTP_ERROR_TIMEOUT \u8d85\u65f6, \u5305\u62ec\u8fde\u63a5\u8d85\u65f6,\u8bfb\u53d6\u6570\u636e\u8d85\u65f6\n-9 HTTP_ERROR_FOTA fota\u529f\u80fd\u62a5\u9519,\u901a\u5e38\u662f\u66f4\u65b0\u5305\u4e0d\u5408\u6cd5\n]]\n\n-- GET\u8bf7\u6c42\nlocal code, headers, body = http.request(\"GET\",\"http://site0.cn/api/httptest/simple/time\").wait()\nlog.info(\"http.get\", code, headers, body)\n-- POST\u8bf7\u6c42\nlocal code, headers, body = http.request(\"POST\",\"http://httpbin.com/post\", {}, \"abc=123\").wait()\nlog.info(\"http.post\", code, headers, body)\n\n-- GET\u8bf7\u6c42,\u4f46\u4e0b\u8f7d\u5230\u6587\u4ef6\nlocal code, headers, body = http.request(\"GET\",\"http://httpbin.com/\", {}, \"\", {dst=\"/data.bin\"}).wait()\nlog.info(\"http.get\", code, headers, body)\n\n-- \u81ea\u5b9a\u4e49\u8d85\u65f6\u65f6\u95f4, 5000ms\nhttp.request(\"GET\",\"http://httpbin.com/\", nil, nil, {timeout=5000}).wait()\n", "prefix": "http.request"}, "httpsrv.start": {"body": "httpsrv.start(${1:port},${2:func})", "description": "httpsrv.start(port, func) - \u542f\u52a8\u5e76\u76d1\u542c\u4e00\u4e2ahttp\u7aef\u53e3\n\u4f20\u5165\u503c\uff1a\nint \u7aef\u53e3\u53f7\nfunction \u56de\u8c03\u51fd\u6570\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue, \u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n\n-- \u76d1\u542c80\u7aef\u53e3\nhttpsrv.start(80, function(client, method, uri, headers, body)\n -- method \u662f\u5b57\u7b26\u4e32, \u4f8b\u5982 GET POST PUT DELETE\n -- uri \u4e5f\u662f\u5b57\u7b26\u4e32 \u4f8b\u5982 / /api/abc\n -- headers table\u7c7b\u578b\n -- body \u5b57\u7b26\u4e32\n log.info(\"httpsrv\", method, uri, json.encode(headers), body)\n if uri == \"/led/1\" then\n LEDA(1)\n return 200, {}, \"ok\"\n elseif uri == \"/led/0\" then\n LEDA(0)\n return 200, {}, \"ok\"\n end\n -- \u8fd4\u56de\u503c\u7684\u7ea6\u5b9a code, headers, body\n -- \u82e5\u6ca1\u6709\u8fd4\u56de\u503c, \u5219\u9ed8\u8ba4 404, {} ,\"\"\n return 404, {}, \"Not Found\" .. uri\nend)\n-- \u5173\u4e8e\u9759\u6001\u6587\u4ef6\n-- \u60c5\u51b51: / , \u6620\u5c04\u4e3a /index.html\n-- \u60c5\u51b52: /abc.html , \u5148\u67e5\u627e /abc.html, \u4e0d\u5b58\u5728\u7684\u8bdd\u67e5\u627e /abc.html.gz\n-- \u82e5gz\u5b58\u5728, \u4f1a\u81ea\u52a8\u4ee5\u538b\u7f29\u6587\u4ef6\u8fdb\u884c\u54cd\u5e94, \u7edd\u5927\u90e8\u5206\u6d4f\u89c8\u5668\u652f\u6301.\n-- \u5f53\u524d\u9ed8\u8ba4\u67e5\u627e /luadb/xxx \u4e0b\u7684\u6587\u4ef6,\u6682\u4e0d\u53ef\u914d\u7f6e\n", "prefix": "httpsrv.start"}, "httpsrv.stop": {"body": "httpsrv.stop(${1:port})", "description": "httpsrv.stop(port) - \u505c\u6b62http\u670d\u52a1\n\u4f20\u5165\u503c\uff1a\nint \u7aef\u53e3\u53f7\n\u8fd4\u56de\u503c\uff1a\nnil \u5f53\u524d\u65e0\u8fd4\u56de\u503c\n", "prefix": "httpsrv.stop"}, "i2c.exist": {"body": "i2c.exist(${1:id})", "description": "i2c.exist(id) - i2c\u7f16\u53f7\u662f\u5426\u5b58\u5728\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id, \u4f8b\u5982i2c1\u7684id\u4e3a1, i2c2\u7684id\u4e3a2\n\u8fd4\u56de\u503c\uff1a\nbool \u5b58\u5728\u5c31\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u68c0\u67e5i2c1\u662f\u5426\u5b58\u5728\nif i2c.exist(1) then\n log.info(\"\u5b58\u5728 i2c1\")\nend\n", "prefix": "i2c.exist"}, "i2c.setup": {"body": "i2c.setup(${1:id},${2:speed},${3:pullup})", "description": "i2c.setup(id, speed, pullup) - i2c\u521d\u59cb\u5316\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id, \u4f8b\u5982i2c1\u7684id\u4e3a1, i2c2\u7684id\u4e3a2\nint I2C\u901f\u5ea6, \u4f8b\u5982i2c.FAST\nbool \u662f\u5426\u8f6f\u4ef6\u4e0a\u62c9, \u9ed8\u8ba4\u4e0d\u5f00\u542f\uff0c\u9700\u8981\u786c\u4ef6\u652f\u6301\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u5c31\u8fd4\u56de1,\u5426\u5219\u8fd4\u56de0\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316i2c1\ni2c.setup(1, i2c.FAST) -- id\u6b63\u786e\u5c31\u4e00\u5b9a\u6210\u529f\n-- \u5982\u9700\u5224\u65adi2c id\u662f\u5426\u5408\u6cd5, \u8bf7\u4f7f\u7528 i2c.exist \u51fd\u6570\n", "prefix": "i2c.setup"}, "i2c.createSoft": {"body": "i2c.createSoft(${1:scl},${2:sda},${3:delay})", "description": "i2c.createSoft(scl,sda,delay) - \u65b0\u5efa\u4e00\u4e2a\u8f6f\u4ef6i2c\u5bf9\u8c61\n\u4f20\u5165\u503c\uff1a\nint i2c SCL\u5f15\u811a\u7f16\u53f7(GPIO\u7f16\u53f7)\nint i2c SDA\u5f15\u811a\u7f16\u53f7(GPIO\u7f16\u53f7)\nint \u6bcf\u4e2a\u64cd\u4f5c\u7684\u5ef6\u65f6, \u5355\u4f4dus, \u9ed8\u8ba45\n\u8fd4\u56de\u503c\uff1a\n\u8f6f\u4ef6I2C\u5bf9\u8c61 \u53ef\u5f53\u4f5ci2c\u7684id\u4f7f\u7528\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f\uff01\u8fd9\u4e2a\u63a5\u53e3\u662f\u8f6f\u4ef6\u6a21\u62dfi2c\uff0c\u901f\u5ea6\u53ef\u80fd\u4f1a\u6bd4\u786c\u4ef6\u7684\u6162\n-- \u4e0d\u9700\u8981\u8c03\u7528i2c.close\u63a5\u53e3\n-- \u521d\u59cb\u5316\u8f6f\u4ef6i2c\nlocal softI2C = i2c.createSoft(1, 2, 5)\ni2c.send(softI2C, 0x5C, string.char(0x0F, 0x2F))\n-- \u6ce8\u610f, \u7b2c3\u4e2a\u53c2\u6570\u662f 2023.06.19 \u6dfb\u52a0\u7684delay\n-- \u901a\u8fc7\u8c03\u6574delay\u53c2\u6570\u7684\u503c, \u53ef\u589e\u52a0\u6216\u964d\u4f4eI2C\u7684\u901f\u5ea6\n", "prefix": "i2c.createSoft"}, "i2c.send": {"body": "i2c.send(${1:id},${2:addr},${3:data},${4:stop})", "description": "i2c.send(id, addr, data,stop) - i2c\u53d1\u9001\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id, \u4f8b\u5982i2c1\u7684id\u4e3a1, i2c2\u7684id\u4e3a2\nint I2C\u5b50\u8bbe\u5907\u7684\u5730\u5740, 7\u4f4d\u5730\u5740\ninteger/string/table \u5f85\u53d1\u9001\u7684\u6570\u636e,\u81ea\u9002\u5e94\u53c2\u6570\u7c7b\u578b\ninteger \u53ef\u9009\u53c2\u6570 \u662f\u5426\u53d1\u9001\u505c\u6b62\u4f4d 1\u53d1\u9001 0\u4e0d\u53d1\u9001 \u9ed8\u8ba4\u53d1\u9001(105\u4e0d\u652f\u6301)\n\u8fd4\u56de\u503c\uff1a\ntrue/false \u53d1\u9001\u662f\u5426\u6210\u529f\n\u4f8b\u5b50\uff1a\n-- \u5f80i2c0\u53d1\u90011\u4e2a\u5b57\u8282\u7684\u6570\u636e\ni2c.send(0, 0x68, 0x75)\n-- \u5f80i2c1\u53d1\u90012\u4e2a\u5b57\u8282\u7684\u6570\u636e\ni2c.send(1, 0x5C, string.char(0x0F, 0x2F))\ni2c.send(1, 0x5C, {0x0F, 0x2F})\n", "prefix": "i2c.send"}, "i2c.recv": {"body": "i2c.recv(${1:id},${2:addr},${3:len})", "description": "i2c.recv(id, addr, len) - i2c\u63a5\u6536\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id, \u4f8b\u5982i2c1\u7684id\u4e3a1, i2c2\u7684id\u4e3a2\nint I2C\u5b50\u8bbe\u5907\u7684\u5730\u5740, 7\u4f4d\u5730\u5740\nint \u63a5\u6536\u6570\u636e\u7684\u957f\u5ea6\n\u8fd4\u56de\u503c\uff1a\nstring \u6536\u5230\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u4ecei2c1\u8bfb\u53d62\u4e2a\u5b57\u8282\u7684\u6570\u636e\nlocal data = i2c.recv(1, 0x5C, 2)\n", "prefix": "i2c.recv"}, "i2c.writeReg": {"body": "i2c.writeReg(${1:id},${2:addr},${3:reg},${4:data},${5:stop})", "description": "i2c.writeReg(id, addr, reg, data,stop) - i2c\u5199\u5bc4\u5b58\u5668\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id, \u4f8b\u5982i2c1\u7684id\u4e3a1, i2c2\u7684id\u4e3a2\nint I2C\u5b50\u8bbe\u5907\u7684\u5730\u5740, 7\u4f4d\u5730\u5740\nint \u5bc4\u5b58\u5668\u5730\u5740\nstring \u5f85\u53d1\u9001\u7684\u6570\u636e\ninteger \u53ef\u9009\u53c2\u6570 \u662f\u5426\u53d1\u9001\u505c\u6b62\u4f4d 1\u53d1\u9001 0\u4e0d\u53d1\u9001 \u9ed8\u8ba4\u53d1\u9001(105\u4e0d\u652f\u6301)\n\u8fd4\u56de\u503c\uff1a\ntrue/false \u53d1\u9001\u662f\u5426\u6210\u529f\n\u4f8b\u5b50\uff1a\n-- \u4ecei2c1\u7684\u5730\u5740\u4e3a0x5C\u7684\u8bbe\u5907\u7684\u5bc4\u5b58\u56680x01\u5199\u51652\u4e2a\u5b57\u8282\u7684\u6570\u636e\ni2c.writeReg(1, 0x5C, 0x01, string.char(0x00, 0xF2))\n", "prefix": "i2c.writeReg"}, "i2c.readReg": {"body": "i2c.readReg(${1:id},${2:addr},${3:reg},${4:len})", "description": "i2c.readReg(id, addr, reg, len) - i2c\u8bfb\u5bc4\u5b58\u5668\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id, \u4f8b\u5982i2c1\u7684id\u4e3a1, i2c2\u7684id\u4e3a2\nint I2C\u5b50\u8bbe\u5907\u7684\u5730\u5740, 7\u4f4d\u5730\u5740\nint \u5bc4\u5b58\u5668\u5730\u5740\nint \u5f85\u63a5\u6536\u7684\u6570\u636e\u957f\u5ea6\ninteger \u53ef\u9009\u53c2\u6570 \u662f\u5426\u53d1\u9001\u505c\u6b62\u4f4d 1\u53d1\u9001 0\u4e0d\u53d1\u9001 \u9ed8\u8ba4\u53d1\u9001(105\u4e0d\u652f\u6301)\n\u8fd4\u56de\u503c\uff1a\nstring \u6536\u5230\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u4ecei2c1\u7684\u5730\u5740\u4e3a0x5C\u7684\u8bbe\u5907\u7684\u5bc4\u5b58\u56680x01\u8bfb\u51fa2\u4e2a\u5b57\u8282\u7684\u6570\u636e\ni2c.readReg(1, 0x5C, 0x01, 2)\n", "prefix": "i2c.readReg"}, "i2c.close": {"body": "i2c.close(${1:id})", "description": "i2c.close(id) - \u5173\u95edi2c\u8bbe\u5907\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id, \u4f8b\u5982i2c1\u7684id\u4e3a1, i2c2\u7684id\u4e3a2\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u5173\u95edi2c1\ni2c.close(1)\n", "prefix": "i2c.close"}, "i2c.readDHT12": {"body": "i2c.readDHT12(${1:id})", "description": "i2c.readDHT12(id) - \u4ecei2c\u603b\u7ebf\u8bfb\u53d6DHT12\u7684\u6e29\u6e7f\u5ea6\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id, \u4f8b\u5982i2c1\u7684id\u4e3a1, i2c2\u7684id\u4e3a2\nint DHT12\u7684\u8bbe\u5907\u5730\u5740,\u9ed8\u8ba40x5C\n\u8fd4\u56de\u503c\uff1a\nboolean \u8bfb\u53d6\u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\nint \u6e7f\u5ea6\u503c,\u5355\u4f4d0.1%, \u4f8b\u5982 591 \u4ee3\u8868 59.1%\nint \u6e29\u5ea6\u503c,\u5355\u4f4d0.1\u6444\u6c0f\u5ea6, \u4f8b\u5982 292 \u4ee3\u8868 29.2\u6444\u6c0f\u5ea6\n\u4f8b\u5b50\uff1a\n-- \u4ecei2c0\u8bfb\u53d6DHT12\ni2c.setup(0)\nlocal re, H, T = i2c.readDHT12(0)\nif re then\n log.info(\"dht12\", H, T)\nend\n", "prefix": "i2c.readDHT12"}, "i2c.readSHT30": {"body": "i2c.readSHT30(${1:id},${2:addr})", "description": "i2c.readSHT30(id,addr) - \u4ecei2c\u603b\u7ebf\u8bfb\u53d6DHT30\u7684\u6e29\u6e7f\u5ea6\u6570\u636e(\u7531\"\u597d\u5947\u661f\"\u8d21\u732e)\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id, \u4f8b\u5982i2c1\u7684id\u4e3a1, i2c2\u7684id\u4e3a2\nint \u8bbe\u5907addr,SHT30\u7684\u8bbe\u5907\u5730\u5740,\u9ed8\u8ba40x44 bit7\n\u8fd4\u56de\u503c\uff1a\nboolean \u8bfb\u53d6\u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\nint \u6e7f\u5ea6\u503c,\u5355\u4f4d0.1%, \u4f8b\u5982 591 \u4ee3\u8868 59.1%\nint \u6e29\u5ea6\u503c,\u5355\u4f4d0.1\u6444\u6c0f\u5ea6, \u4f8b\u5982 292 \u4ee3\u8868 29.2\u6444\u6c0f\u5ea6\n\u4f8b\u5b50\uff1a\n-- \u4ecei2c0\u8bfb\u53d6SHT30\ni2c.setup(0)\nlocal re, H, T = i2c.readSHT30(0)\nif re then\n log.info(\"sht30\", H, T)\nend\n", "prefix": "i2c.readSHT30"}, "i2c.transfer": {"body": "i2c.transfer(${1:id},${2:addr},${3:txBuff},${4:rxBuff},${5:rxLen})", "description": "i2c.transfer(id, addr, txBuff, rxBuff, rxLen) - i2c\u901a\u7528\u4f20\u8f93\uff0c\u5305\u62ec\u53d1\u9001N\u5b57\u8282\uff0c\u53d1\u9001N\u5b57\u8282+\u63a5\u6536N\u5b57\u8282\uff0c\u63a5\u6536N\u5b57\u8282\u4e09\u79cd\u529f\u80fd\uff0c\u5728\u53d1\u9001\u8f6c\u63a5\u6536\u8fc7\u7a0b\u4e2d\u53d1\u9001reStart\u4fe1\u53f7,\u89e3\u51b3\u7c7b\u4f3cmlx90614\u5fc5\u987b\u5e26restart\u4fe1\u53f7\uff0c\u4f46\u662f\u53c8\u4e0d\u80fd\u7528i2c.send\u6765\u63a7\u5236\u7684\uff0c\u6bd4\u5982air105\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id, \u4f8b\u5982i2c1\u7684id\u4e3a1, i2c2\u7684id\u4e3a2\nint I2C\u5b50\u8bbe\u5907\u7684\u5730\u5740, 7\u4f4d\u5730\u5740\ninteger/string/zbuff \u5f85\u53d1\u9001\u7684\u6570\u636e,\u81ea\u9002\u5e94\u53c2\u6570\u7c7b\u578b\uff0c\u5982\u679c\u4e3anil\uff0c\u5219\u4e0d\u53d1\u9001\u6570\u636e\nzbuff \u5f85\u63a5\u6536\u6570\u636e\u7684zbuff \u5982\u679c\u4e0d\u7528zbuff\uff0c\u5219\u63a5\u6536\u6570\u636e\u5c06\u5728return\u8fd4\u56de\nint \u9700\u8981\u63a5\u6536\u7684\u6570\u636e\u957f\u5ea6\uff0c\u5982\u679c\u4e3a0\u6216nil\uff0c\u5219\u4e0d\u63a5\u6536\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nboolean true/false \u53d1\u9001\u662f\u5426\u6210\u529f\nstring or nil \u5982\u679c\u53c2\u65705\u662finterger\uff0c\u5219\u8fd4\u56de\u63a5\u6536\u5230\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\nlocal result, _ = i2c.transfer(0, 0x11, txbuff, rxbuff, 1)\nlocal result, _ = i2c.transfer(0, 0x11, txbuff, nil, 0) --\u53ea\u53d1\u9001txbuff\u91cc\u7684\u6570\u636e\uff0c\u4e0d\u63a5\u6536\u6570\u636e\uff0c\u5178\u578b\u5e94\u7528\u5c31\u662f\u5199\u5bc4\u5b58\u5668\u4e86\uff0c\u8fd9\u91cc\u5bc4\u5b58\u5668\u5730\u5740\u548c\u503c\u90fd\u653e\u5728\u4e86txbuff\u91cc\nlocal result, _ = i2c.transfer(0, 0x11, \"\\x01\\x02\\x03\", nil, 1) --\u53d1\u90010x01\uff0c 0x02\uff0c0x03\uff0c\u4e0d\u63a5\u6536\u6570\u636e\uff0c\u5982\u679c\u662feeprom\uff0c\u5c31\u662f\u5f800x01\u7684\u5730\u5740\u519902\u548c03\uff0c\u6216\u8005\u5f800x0102\u7684\u5730\u5740\u519903\uff0c\u770b\u5177\u4f53\u82af\u7247\u4e86\nlocal result, rxdata = i2c.transfer(0, 0x11, \"\\x01\\x02\", nil, 1) --\u53d1\u90010x01\uff0c 0x02\uff0c\u7136\u540e\u63a5\u65361\u4e2a\u5b57\u8282\uff0c\u5178\u578b\u5e94\u7528\u5c31\u662feeprom\nlocal result, rxdata = i2c.transfer(0, 0x11, 0x00, nil, 1) --\u53d1\u90010x00\uff0c\u7136\u540e\u63a5\u65361\u4e2a\u5b57\u8282\uff0c\u5178\u578b\u5e94\u7528\u5404\u79cd\u4f20\u611f\u5668\n", "prefix": "i2c.transfer"}, "i2c.xfer": {"body": "i2c.xfer(${1:id},${2:addr},${3:txBuff},${4:rxBuff},${5:rxLen},${6:transfer_done_topic},${7:timeout})", "description": "i2c.xfer(id, addr, txBuff, rxBuff, rxLen, transfer_done_topic, timeout) - i2c\u975e\u963b\u585e\u901a\u7528\u4f20\u8f93\uff0c\u7c7b\u4f3ctransfer\uff0c\u4f46\u662f\u4e0d\u4f1a\u7b49\u5230I2C\u4f20\u8f93\u5b8c\u6210\u624d\u8fd4\u56de\uff0c\u8c03\u7528\u672c\u51fd\u6570\u4f1a\u7acb\u523b\u8fd4\u56de\uff0cI2C\u4f20\u8f93\u5b8c\u6210\u540e\uff0c\u901a\u8fc7\u6d88\u606f\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id, \u4f8b\u5982i2c1\u7684id\u4e3a1, i2c2\u7684id\u4e3a2\nint I2C\u5b50\u8bbe\u5907\u7684\u5730\u5740, 7\u4f4d\u5730\u5740\nzbuff \u5f85\u53d1\u9001\u7684\u6570\u636e\uff0c\u7531\u4e8e\u7528\u7684\u975e\u963b\u585e\u6a21\u578b\uff0c\u4e3a\u4fdd\u8bc1\u52a8\u6001\u6570\u636e\u7684\u6709\u6548\u6027\uff0c\u53ea\u80fd\u4f7f\u7528zbuff\uff0c\u53d1\u9001\u7684\u6570\u636e\u4ecezbuff.addr\u5f00\u59cb\uff0c\u957f\u5ea6\u4e3azbuff.used\nzbuff \u5f85\u63a5\u6536\u6570\u636e\u7684zbuff\uff0c\u5982\u679c\u4e3anil\uff0c\u5219\u5ffd\u7565\u540e\u9762\u53c2\u6570\uff0c \u4e0d\u63a5\u6536\u6570\u636e\u3002\u63a5\u6536\u7684\u6570\u636e\u4f1a\u653e\u5728zbuff.addr\u5f00\u59cb\u7684\u4f4d\u7f6e\uff0c\u4f1a\u8986\u76d6\u6389\u4e4b\u524d\u7684\u6570\u636e\uff0c\u6ce8\u610fzhuff\u7684\u9884\u7559\u7a7a\u95f4\u8981\u8db3\u591f\nint \u9700\u8981\u63a5\u6536\u7684\u6570\u636e\u957f\u5ea6\uff0c\u5982\u679c\u4e3a0\u6216nil\uff0c\u5219\u4e0d\u63a5\u6536\u6570\u636e\nstring \u4f20\u8f93\u5b8c\u6210\u540e\u56de\u8c03\u7684\u6d88\u606f\nint \u8d85\u65f6\u65f6\u95f4\uff0c\u5982\u679c\u586bnil\uff0c\u5219\u4e3a100ms\n\u8fd4\u56de\u503c\uff1a\nboolean true/false \u672c\u6b21\u4f20\u8f93\u662f\u5426\u6b63\u786e\u542f\u52a8\uff0ctrue\uff0c\u542f\u52a8\uff0cfalse\uff0c\u6709\u9519\u8bef\u65e0\u6cd5\u542f\u52a8\u3002\u4f20\u8f93\u5b8c\u6210\u4f1a\u53d1\u5e03\u6d88\u606ftransfer_done_topic\u548cboolean\u578b\u7ed3\u679c\n\u4f8b\u5b50\uff1a\nlocal result = i2c.xfer(0, 0x11, txbuff, rxbuff, 1, \"I2CDONE\") if result then result, i2c_id, succ, error_code = sys.waitUntil(\"I2CDONE\") end if not result or not succ then log.info(\"i2c fail, error code\", error_code) else log.info(\"i2c ok\") end\n\n", "prefix": "i2c.xfer"}, "i2c.scan": {"body": "i2c.scan(${1:id},${2:speed})", "description": "i2c.scan(id,speed) - \u626b\u63cfi2c\u8bbe\u5907\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id, \u4f8b\u5982i2c1\u7684id\u4e3a1, i2c2\u7684id\u4e3a2\nint \u901f\u5ea6, \u53ef\u9009i2c.SLOW i2c.FAST i2c.PLUS i2c.HSMODE \u9ed8\u8ba4\u4e3ai2c.SLOW,\u5982\u63a2\u6d4b\u4e0d\u5230\u5219\u4fee\u6539\u6b64\u9879\n\u8fd4\u56de\u503c\uff1a\nnil \u5f53\u524d\u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u4e8e2023.07.04\u6dfb\u52a0\n-- \u8fd9\u4e2a\u51fd\u6570\u7684\u4e3b\u8981\u76ee\u6807\u662f\u4e3a\u4e86\u5728\u5f00\u53d1\u671f\u626b\u63cfi2c\u8bbe\u5907\n-- \u6709\u4e9bBSP\u5728\u6307\u5b9aaddr\u65e0\u54cd\u5e94\u65f6\u4f1a\u8f93\u51fa\u65e5\u5fd7,\u5bfc\u81f4\u8f93\u51fa\u4f1a\u88ab\u6253\u4e71\ni2c.scan()\n", "prefix": "i2c.scan"}, "i2s.setup": {"body": "i2s.setup(${1:id},${2:mode},${3:sample},${4:bitw},${5:channel},${6:format},${7:framebit})", "description": "i2s.setup(id, mode, sample, bitw, channel, format, framebit) - \u521d\u59cb\u5316i2s\n\u4f20\u5165\u503c\uff1a\nint i2s\u901a\u9053\u53f7,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173\nint \u6a21\u5f0f, 0 \u4e3b\u673a 1 \u4ece\u673a\nint \u91c7\u6837\u7387,\u9ed8\u8ba444100. \u53ef\u9009\nint \u6570\u636e\u4f4d\u6570,\u9ed8\u8ba416, \u53ef\u4ee5\u662f8\u7684\u500d\u6570\nint \u58f0\u9053, 0 \u5de6\u58f0\u9053, 1 \u53f3\u58f0\u9053, 2 \u7acb\u4f53\u58f0. \u53ef\u9009\nint \u683c\u5f0f, \u53ef\u9009MODE_I2S, MODE_LSB, MODE_MSB\nint 1\u4e2a\u58f0\u9053\u7684BCLK\u6570\u91cf, \u53ef\u900916\u548c32\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u4e0e\u5426\nint \u5e95\u5c42\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u4ee5\u9ed8\u8ba4\u53c2\u6570\u521d\u59cb\u5316i2s\ni2s.setup(0)\n-- \u4ee5\u8be6\u7ec6\u53c2\u6570\u521d\u59cb\u5316i2s, \u793a\u4f8b\u4e3a\u9ed8\u8ba4\u503c\ni2s.setup(0, 0, 44100, 16, 0, 0, 16)\n", "prefix": "i2s.setup"}, "i2s.send": {"body": "i2s.send(${1:id},${2:data},${3:len})", "description": "i2s.send(id, data, len) - \u53d1\u9001i2s\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u901a\u9053id\nstring \u6570\u636e, \u53ef\u4ee5\u662f\u5b57\u7b26\u4e32\u6216zbuff\nint \u6570\u636e\u957f\u5ea6,\u5355\u4f4d\u5b57\u8282, \u5b57\u7b26\u4e32\u9ed8\u8ba4\u4e3a\u5b57\u7b26\u4e32\u5168\u957f, zbuff\u9ed8\u8ba4\u4e3a\u6307\u9488\u4f4d\u7f6e\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u4e0e\u5426\nint \u5e95\u5c42\u8fd4\u56de\u503c,\u4f9b\u8c03\u8bd5\u7528\n\u4f8b\u5b50\uff1a\nlocal f = io.open(\"/luadb/abc.wav\")\nwhile 1 do\n local data = f:read(4096)\n if not data or #data == 0 then\n break\n end\n i2s.send(0, data)\n sys.wait(100)\nend\n", "prefix": "i2s.send"}, "i2s.recv": {"body": "i2s.recv(${1:id},${2:buffer},${3:len})", "description": "i2s.recv(id, buffer, len) - \u63a5\u6536i2s\u6570\u636e\uff0c\u6ce8\u610f\u5728\u6570\u636e\u5728\u56de\u8c03\u65f6\u5df2\u7ecf\u5b58\u653e\u5728zbuff\u91cc\uff0c\u76ee\u524d\u53ea\u6709air780e\u7cfb\u5217\u652f\u6301\n\u4f20\u5165\u503c\uff1a\nint \u901a\u9053id\nzbuff \u6570\u636e\u7f13\u5b58\u533a\nint \u5355\u6b21\u8fd4\u56de\u7684\u6570\u636e\u957f\u5ea6,\u5355\u4f4d\u5b57\u8282,\u5fc5\u987b\u4e0e\u4f20\u5165\u7684zbuff\u7684\u5927\u5c0f\u4e00\u81f4\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u4e0e\u5426\n\u4f8b\u5b50\uff1a\nlocal buffer = zbuff.create(3200)\nlocal succ = i2s.recv(0, buffer, 3200);\n", "prefix": "i2s.recv"}, "i2s.close": {"body": "i2s.close(${1:id})", "description": "i2s.close(id) - \u5173\u95edi2s\n\u4f20\u5165\u503c\uff1a\nint \u901a\u9053id\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\ni2s.close(0)\n", "prefix": "i2s.close"}, "i2s.on": {"body": "i2s.on(${1:id},${2:func})", "description": "i2s.on(id, func) - \u6ce8\u518cI2S\u4e8b\u4ef6\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nint i2s id, i2s0\u51990, i2s1\u51991\nfunction \u56de\u8c03\u65b9\u6cd5\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\ni2s.on(0, function(id, buff)\n if buff then\n log.info(\"i2s get data in zbuff\")\n else\n log.info(\"i2s tx one block done\")\n end\nend)\n", "prefix": "i2s.on"}, "i2s.txStat": {"body": "i2s.txStat(${1:id})", "description": "i2s.txStat(id) - \u83b7\u53d6i2s\u7684\u53d1\u9001\u7f13\u51b2\u533a\u72b6\u6001\n\u4f20\u5165\u503c\uff1a\nint i2s id, i2s0\u51990, i2s1\u51991\nreturn \u5e95\u5c42\u7f13\u51b2\u533a\u7684\u603b\u5927\u5c0f\nreturn \u5e95\u5c42\u7f13\u51b2\u533a\u7684\u5269\u4f59\u5f85\u53d1\u9001\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u8bfb\u53d6\u53d1\u9001\u7f13\u51b2\u533a\u7684\u72b6\u6001, \u4ece\u800c\u5224\u65ad\u662f\u5426\u9700\u8981\u7ee7\u7eed\u4f20\u5165\u97f3\u9891\u6570\u636e\nlocal max, remain = i2s.txStat(0)\nlog.info(\"i2s\u53d1\u9001\u7f13\u51b2\u533a\u72b6\u6001\", max, remain)\n", "prefix": "i2s.txStat"}, "i2s.getPara": {"body": "i2s.getPara(${1:id})", "description": "i2s.getPara(id) - \u83b7\u53d6I2S\u53c2\u6570\uff0c\u53c2\u6570\u5177\u4f53\u53c2\u8003setup\n\u4f20\u5165\u503c\uff1a\nint \u901a\u9053id\n\u8fd4\u56de\u503c\uff1a\nboolean \u662f\u5426\u5728\u5de5\u4f5c\u72b6\u6001 true\u662f\nint \u6a21\u5f0f, 0 \u4e3b\u673a 1 \u4ece\u673a\nint \u91c7\u6837\u7387\nint \u6570\u636e\u4f4d\u6570\nint \u58f0\u9053\nint \u683c\u5f0f\nint 1\u4e2a\u58f0\u9053\u7684BCLK\u6570\u91cf\n", "prefix": "i2s.getPara"}, "iconv.open": {"body": "iconv.open(${1:tocode},${2:fromcode})", "description": "iconv.open(tocode, fromcode) - \u6253\u5f00\u76f8\u5e94\u5b57\u7b26\u7f16\u7801\u8f6c\u6362\u51fd\u6570\n\u4f20\u5165\u503c\uff1a\nstring tocode$\u76ee\u6807\u7f16\u7801\u683c\u5f0f$gb2312/ucs2/ucs2be/utf8\nstring fromcode$\u6e90\u7f16\u7801\u683c\u5f0f$gb2312/ucs2/ucs2be/utf8\nreturn table$cd$\u7f16\u7801\u8f6c\u6362\u51fd\u6570\u7684\u8f6c\u6362\u53e5\u67c4$ \n\u4f8b\u5b50\uff1a\n--unicode\u5927\u7aef\u7f16\u7801 \u8f6c\u5316\u4e3a utf8\u7f16\u7801\nlocal cd = iconv.open(\"utf8\", \"ucs2be\")\n", "prefix": "iconv.open"}, "iconv:iconv": {"body": "iconv:iconv(${1:inbuf})", "description": "iconv:iconv(inbuf) - \u5b57\u7b26\u7f16\u7801\u8f6c\u6362\n\u4f20\u5165\u503c\uff1a\nstring \u91ca\u4e49\uff1a\u5f85\u8f6c\u6362\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nnumber \u91ca\u4e49\uff1a\u8fd4\u56de\u7f16\u7801\u8f6c\u6362\u540e\u7684\u7ed3\u679c
\u53d6\u503c\uff1a0\u6210\u529f,-1\u5931\u8d25\n\u4f8b\u5b50\uff1a\n--unicode\u5927\u7aef\u7f16\u7801 \u8f6c\u5316\u4e3a utf8\u7f16\u7801\nfunction ucs2beToUtf8(ucs2s)\n local iconv = iconv.open(\"utf8\", \"ucs2be\")\n return iconv:iconv(ucs2s)\nend\n", "prefix": "iconv:iconv"}, "cd:iconv": {"body": "cd:iconv(${1:inbuf})", "description": "cd:iconv(inbuf) - \u5b57\u7b26\u7f16\u7801\u8f6c\u6362\n\u4f20\u5165\u503c\uff1a\nstring inbuf$\u8f93\u5165\u5b57\u7b26\u4e32$\u4f8b\u5982:ucs2s \nreturn number$result$\u8fd4\u56de\u7f16\u7801\u8f6c\u6362\u540e\u7684\u7ed3\u679c$0\u6210\u529f,-1\u5931\u8d25\n\u4f8b\u5b50\uff1a\n--unicode\u5927\u7aef\u7f16\u7801 \u8f6c\u5316\u4e3a utf8\u7f16\u7801\nfunction ucs2beToUtf8(ucs2s)\n local cd = iconv.open(\"utf8\", \"ucs2be\")\n return cd:iconv(ucs2s)\nend\n", "prefix": "cd:iconv"}, "iconv.close": {"body": "iconv.close(${1:cd})", "description": "iconv.close(cd) - \u5173\u95ed\u5b57\u7b26\u7f16\u7801\u8f6c\u6362\n\u4f20\u5165\u503c\uff1a\nstring cd$iconv.open\u8fd4\u56de\u7684\u53e5\u67c4$ \nreturn \n\u4f8b\u5b50\uff1a\n--\u5173\u95ed\u5b57\u7b26\u7f16\u7801\u8f6c\u6362\nlocal cd = iconv.open(\"utf8\", \"ucs2be\")\niconv.close(cd)\n", "prefix": "iconv.close"}, "io.exists": {"body": "io.exists(${1:path})", "description": "io.exists(path) - \u5224\u65ad\u6587\u4ef6\u662f\u5426\u5b58\u5728\n\u4f20\u5165\u503c\uff1a\nstring \u6587\u4ef6\u8def\u5f84\n\u8fd4\u56de\u503c\uff1a\nbool \u5b58\u5728\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nlog.info(\"io\", \"file exists\", io.exists(\"/boottime\"))\n", "prefix": "io.exists"}, "io.fileSize": {"body": "io.fileSize(${1:path})", "description": "io.fileSize(path) - \u83b7\u53d6\u6587\u4ef6\u5927\u5c0f\n\u4f20\u5165\u503c\uff1a\nstring \u6587\u4ef6\u8def\u5f84\n\u8fd4\u56de\u503c\uff1a\nint \u6587\u4ef6\u6570\u636e,\u82e5\u6587\u4ef6\u4e0d\u5b58\u5728\u4f1a\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nlocal fsize = io.fileSize(\"/bootime\")\nif fsize and fsize > 1024 then\n log.info(\"io\", \"file size\", fsize)\nend\n", "prefix": "io.fileSize"}, "io.readFile": {"body": "io.readFile(${1:path},${2:mode},${3:offset},${4:len})", "description": "io.readFile(path, mode, offset, len) - \u8bfb\u53d6\u6574\u4e2a\u6587\u4ef6,\u8bf7\u6ce8\u610f\u5185\u5b58\u6d88\u8017\n\u4f20\u5165\u503c\uff1a\nstring \u6587\u4ef6\u8def\u5f84\nstring \u8bfb\u53d6\u6a21\u5f0f, \u9ed8\u8ba4 \"rb\"\nint \u8d77\u59cb\u4f4d\u7f6e,\u9ed8\u8ba40\nint \u8bfb\u53d6\u957f\u5ea6,\u9ed8\u8ba4\u6574\u4e2a\u6587\u4ef6\n\u8fd4\u56de\u503c\uff1a\nstring \u6587\u4ef6\u6570\u636e,\u82e5\u6587\u4ef6\u4e0d\u5b58\u5728\u4f1a\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nlocal data = io.readFile(\"/bootime\")\n-- \u6ce8\u610f: offset\u548clen\u53c2\u6570\u662f 2023.6.6\u6dfb\u52a0\u7684\n-- \u8bfb\u53d6abc.txt, \u5148\u8df3\u8fc7128\u5b57\u8282, \u7136\u540e\u8bfb\u53d6512\u5b57\u8282\u6570\u636e\nlocal data = io.readFile(\"/abc.txt\", \"rb\", 128, 512)\n", "prefix": "io.readFile"}, "io.writeFile": {"body": "io.writeFile(${1:path},${2:data})", "description": "io.writeFile(path, data) - \u5c06\u6570\u636e\u5199\u5165\u6587\u4ef6\n\u4f20\u5165\u503c\uff1a\nstring \u6587\u4ef6\u8def\u5f84\nstring \u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue, \u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nio.writeFile(\"/bootime\", \"1\")\n", "prefix": "io.writeFile"}, "io.fill": {"body": "io.fill(${1:buff},${2:offset},${3:len})", "description": "io.fill(buff, offset, len) - \u8bfb\u53d6\u6587\u4ef6\u5e76\u586b\u5145\u5230zbuff\u5185,\u4f46\u4e0d\u79fb\u52a8\u6307\u9488\u4f4d\u7f6e\n\u4f20\u5165\u503c\uff1a\nuserdata zbuff\u5b9e\u4f53\nint \u5199\u5165\u7684\u4f4d\u7f6e,\u9ed8\u8ba4\u662f0\nint \u5199\u5165\u7684\u957f\u5ea6,\u9ed8\u8ba4\u662fzbuff\u7684len\u51cf\u53bboffset\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\nint \u8fd4\u56de\u5b9e\u9645\u8bfb\u53d6\u5230\u7684\u957f\u5ea6\uff0c\u5982\u679c\u5c0f\u4e8e0\u4e5f\u8bf4\u660e\u662f\u8bfb\u53d6\u5931\u8d25\u4e86\n\u4f8b\u5b50\uff1a\nlocal buff = zbuff.create(1024)\nlocal f = io.open(\"/sd/test.txt\")\nif f then\n f:fill(buff)\nend\n", "prefix": "io.fill"}, "io.mkfs": {"body": "io.mkfs(${1:path})", "description": "io.mkfs(path) - \u683c\u5f0f\u5316\u6587\u4ef6\u7cfb\u7edf,\u9700\u6307\u5b9a\u6302\u8f7d\u70b9\n\u4f20\u5165\u503c\uff1a\nstring \u6302\u8f7d\u70b9\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\nint \u5e95\u5c42\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlocal ret, errio = io.mkfs(\"/sd\")\nlog.info(\"fs\", \"mkfs\", ret, errio)\n", "prefix": "io.mkfs"}, "io.mkdir": {"body": "io.mkdir(${1:path})", "description": "io.mkdir(path) - \u521b\u5efa\u6587\u4ef6\u5939\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u5efa\u7acb\u7684\u76ee\u5f55\u8def\u5f84\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\nint \u5e95\u5c42\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlocal ret, errio = io.mkdir(\"/data/\")\nlog.info(\"fs\", \"mkdir\", ret, errio)\n", "prefix": "io.mkdir"}, "io.rmdir": {"body": "io.rmdir(${1:path})", "description": "io.rmdir(path) - \u5220\u9664\u6587\u4ef6\u5939\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u79fb\u9664\u7684\u76ee\u5f55\u8def\u5f84\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\nint \u5e95\u5c42\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlocal ret, errio = io.rmdir(\"/data/\")\nlog.info(\"fs\", \"rmdir\", ret, errio)\n", "prefix": "io.rmdir"}, "io.lsdir": {"body": "io.lsdir(${1:path},${2:len},${3:offset})", "description": "io.lsdir(path, len, offset) - \u5217\u51fa\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u679a\u4e3e\u7684\u76ee\u5f55\u8def\u5f84\nint \u6700\u5927\u957f\u5ea6, \u9ed8\u8ba410, \u6700\u9ad850\nint \u504f\u79fb\u91cf, \u9ed8\u8ba40, \u5f53\u76ee\u5f55\u6587\u4ef6\u5f88\u591a\u65f6\u5206\u9875\u67e5\u8be2\u7528\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\nint \u5e95\u5c42\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlocal ret, data = io.lsdir(\"/data/\", 10, 0)\nif ret then\n log.info(\"fs\", \"lsdir\", json.encode(data))\nelse\n log.info(\"fs\", \"lsdir\", \"fail\", ret, data)\nend\n", "prefix": "io.lsdir"}, "io.lsmount": {"body": "io.lsmount()", "description": "io.lsmount() - \u5217\u51fa\u6240\u6709\u6302\u8f7d\u70b9\n\u8fd4\u56de\u503c\uff1a\ntable \u6302\u8f7d\u70b9\u5217\u8868\n\u4f8b\u5b50\uff1a\nlocal data = io.lsmount()\nlog.info(\"fs\", \"lsmount\", json.encode(data))\n", "prefix": "io.lsmount"}, "ioqueue.init": {"body": "ioqueue.init(${1:hwtimer_id},${2:cmd_cnt},${3:repeat_cnt})", "description": "ioqueue.init(hwtimer_id,cmd_cnt,repeat_cnt) - \u521d\u59cb\u5316\u4e00\u4e2aio\u64cd\u4f5c\u961f\u5217\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\uff0c\u9ed8\u8ba4\u75280\uff0c\u6839\u636e\u5b9e\u9645MCU\u786e\u5b9a\uff0cair105\u4e3a0~5\uff0c\u4e0epwm\u5171\u7528\uff0c\u540c\u4e00\u4e2a\u901a\u9053\u53f7\u4e0d\u80fd\u540c\u65f6\u4e3apwm\u548cioqueue\nint \u4e00\u4e2a\u5b8c\u6574\u5468\u671f\u9700\u8981\u7684\u547d\u4ee4\uff0c\u53ef\u4ee5\u6bd4\u5b9e\u9645\u7684\u591a\nint \u91cd\u590d\u6b21\u6570,\u9ed8\u8ba4\u662f1\uff0c\u5982\u679c\u51990\u5219\u8868\u793a\u65e0\u9650\u6b21\u6570\u5faa\u73af\nreturn \u65e0\n\u4f8b\u5b50\uff1a\nioqueue.init(0,10,5) --\u4ee5timer0\u4e3a\u65f6\u949f\u6e90\u521d\u59cb\u5316\u4e00\u4e2aio\u64cd\u4f5c\u961f\u5217\uff0c\u670910\u4e2a\u6709\u6548\u547d\u4ee4\uff0c\u5faa\u73af5\u6b21\n", "prefix": "ioqueue.init"}, "ioqueue.setdelay": {"body": "ioqueue.setdelay(${1:hwtimer_id},${2:time_us},${3:time_tick},${4:continue})", "description": "ioqueue.setdelay(hwtimer_id,time_us,time_tick,continue) - \u5bf9io\u64cd\u4f5c\u961f\u5217\u589e\u52a0\u5ef6\u65f6\u547d\u4ee4\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\nint \u5ef6\u65f6\u65f6\u95f4,0~65535us\nint \u5ef6\u65f6\u5fae\u8c03\u65f6\u95f4,0~255tick,\u603b\u7684\u5ef6\u65f6\u65f6\u95f4\u662ftime_us * 1us_tick + time_tick\nboolean \u662f\u5426\u8fde\u7eed\u662f\u8fde\u7eed\u5ef6\u65f6\uff0c\u9ed8\u8ba4\u5426\uff0c\u5982\u679c\u662f\uff0c\u5b9a\u65f6\u5668\u5728\u65f6\u95f4\u5230\u540e\u4e0d\u4f1a\u505c\u6b62\u800c\u662f\u91cd\u65b0\u8ba1\u65f6\uff0c\n", "prefix": "ioqueue.setdelay"}, "ioqueue.delay": {"body": "ioqueue.delay(${1:hwtimer_id})", "description": "ioqueue.delay(hwtimer_id) - \u5bf9io\u64cd\u4f5c\u961f\u5217\u589e\u52a0\u4e00\u6b21\u91cd\u590d\u5ef6\u65f6\uff0c\u5728\u524d\u9762\u5fc5\u987b\u6709setdelay\u4e14\u662f\u8fde\u7eed\u5ef6\u65f6\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\nreturn \u65e0\n\u4f8b\u5b50\uff1a\nioqueue.setdelay(0,9,15,true) --\u5ef6\u65f69us+15\u4e2atick,\u5728\u4e4b\u540e\u9047\u5230delay\u547d\u4ee4\u65f6\uff0c\u4f1a\u5ef6\u65f69us+15\u4e2atick\nioqueue.delay(0)\n", "prefix": "ioqueue.delay"}, "ioqueue.setgpio": {"body": "ioqueue.setgpio(${1:hwtimer_id},${2:pin},${3:is_input},${4:pull_mode},${5:init_level})", "description": "ioqueue.setgpio(hwtimer_id,pin,is_input,pull_mode,init_level) - \u5bf9io\u64cd\u4f5c\u961f\u5217\u589e\u52a0\u8bbe\u7f6egpio\u547d\u4ee4\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\nint pin\nboolean \u662f\u5426\u662f\u8f93\u5165\nint \u4e0a\u4e0b\u62c9\u6a21\u5f0f,\u53ea\u80fd\u662f0,gpio.PULLUP,gpio.PULLDOWN\nint \u521d\u59cb\u8f93\u51fa\u7535\u5e73\nreturn \u65e0\n\u4f8b\u5b50\uff1a\nioqueue.setgpio(0,pin.PB01,true,gpio.PULLUP,0) --PB01\u8bbe\u7f6e\u6210\u4e0a\u62c9\u8f93\u5165\nioqueue.setgpio(0,pin.PB01,false,0,1)--PB01\u8bbe\u7f6e\u6210\u9ed8\u8ba4\u4e0a\u4e0b\u62c9\u8f93\u51fa\u9ad8\u7535\u5e73\n", "prefix": "ioqueue.setgpio"}, "ioqueue.input": {"body": "ioqueue.input(${1:hwtimer_id},${2:pin})", "description": "ioqueue.input(hwtimer_id,pin) - \u5bf9io\u64cd\u4f5c\u961f\u5217\u589e\u52a0\u8bfb\u53d6gpio\u547d\u4ee4\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\nint pin\nreturn \u65e0\n\u4f8b\u5b50\uff1a\nioqueue.input(0,pin.PB01)\n\n", "prefix": "ioqueue.input"}, "ioqueue.output": {"body": "ioqueue.output(${1:hwtimer_id},${2:pin},${3:level})", "description": "ioqueue.output(hwtimer_id,pin,level) - \u5bf9io\u64cd\u4f5c\u961f\u5217\u589e\u52a0\u8f93\u51faGPIO\u547d\u4ee4\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\nint pin\nint \u8f93\u51fa\u7535\u5e73\nreturn \u65e0\n\u4f8b\u5b50\uff1a\nioqueue.output(0,pin.PB01,0)\n", "prefix": "ioqueue.output"}, "ioqueue.set_cap": {"body": "ioqueue.set_cap(${1:hwtimer_id},${2:pin},${3:pull_mode},${4:irq_mode},${5:max_tick})", "description": "ioqueue.set_cap(hwtimer_id,pin,pull_mode,irq_mode,max_tick) - \u5bf9io\u64cd\u4f5c\u961f\u5217\u589e\u52a0\u8bbe\u7f6e\u6355\u83b7\u67d0\u4e2aIO\u547d\u4ee4\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\nint pin\nint \u4e0a\u4e0b\u62c9\u6a21\u5f0f,\u53ea\u80fd\u662f0,gpio.PULLUP,gpio.PULLDOWN\nint \u4e2d\u65ad\u6a21\u5f0f,\u53ea\u80fd\u662fgpio.BOTH,gpio.RISING,gpio.FALLING\nint \u5b9a\u65f6\u5668\u6700\u5927\u8ba1\u65f6\u65f6\u95f4 \u8003\u8651\u5230lua\u662fint\u7c7b\u578b\uff0c\u6700\u5c0f0x10000, \u6700\u5927\u503c\u4e3a0x7fffffff\uff0c\u9ed8\u8ba4\u4e3a\u6700\u5927\u503c\nreturn \u65e0\n\u4f8b\u5b50\uff1a\nioqueue.setcap(0,pin.PB01,gpio.PULLUP,gpio.FALLING,48000000)\n", "prefix": "ioqueue.set_cap"}, "ioqueue.capture": {"body": "ioqueue.capture(${1:hwtimer_id})", "description": "ioqueue.capture(hwtimer_id) - \u5bf9io\u64cd\u4f5c\u961f\u5217\u589e\u52a0\u6355\u83b7\u4e00\u6b21IO\u72b6\u6001\u547d\u4ee4\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\nreturn \u65e0\n\u4f8b\u5b50\uff1a\nioqueue.capture(0)\n", "prefix": "ioqueue.capture"}, "ioqueue.capend": {"body": "ioqueue.capend(${1:hwtimer_id},${2:pin})", "description": "ioqueue.capend(hwtimer_id,pin) - \u5bf9io\u64cd\u4f5c\u961f\u5217\u589e\u52a0\u7ed3\u675f\u6355\u83b7\u67d0\u4e2aIO\u547d\u4ee4\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\nint pin\nreturn \u65e0\n\u4f8b\u5b50\uff1a\nioqueue.capend(0,pin.PB01)\n", "prefix": "ioqueue.capend"}, "ioqueue.get": {"body": "ioqueue.get(${1:hwtimer_id},${2:input_buff},${3:capture_buff})", "description": "ioqueue.get(hwtimer_id, input_buff, capture_buff) - * \u83b7\u53d6io\u64cd\u4f5c\u961f\u5217\u4e2d\u8f93\u5165\u548c\u6355\u83b7\u7684\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\nzbuff \u5b58\u653eIO\u8f93\u5165\u6570\u636e\u7684buff\uff0c\u6309\u71671byte pin + 1byte level \u5f62\u5f0f\u5b58\u653e\u6570\u636e\nzbuff \u5b58\u653eIO\u6355\u83b7\u6570\u636e\u7684buff\uff0c\u6309\u71671byte pin + 1byte level + 4byte tick\u5f62\u5f0f\u5b58\u653e\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nint \u8fd4\u56de\u591a\u5c11\u7ec4IO\u8f93\u5165\u6570\u636e\nint \u8fd4\u56de\u591a\u5c11\u7ec4IO\u6355\u83b7\u6570\u636e\n\u4f8b\u5b50\uff1a\nlocal input_cnt, capture_cnt = ioqueue.get(0, input_buff, capture_buff)\n", "prefix": "ioqueue.get"}, "ioqueue.start": {"body": "ioqueue.start(${1:hwtimer_id})", "description": "ioqueue.start(hwtimer_id) - \u542f\u52a8io\u64cd\u4f5c\u961f\u5217\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\nreturn \u65e0\n\u4f8b\u5b50\uff1a\nioqueue.start(0)\n", "prefix": "ioqueue.start"}, "ioqueue.stop": {"body": "ioqueue.stop(${1:hwtimer_id})", "description": "ioqueue.stop(hwtimer_id) - \u505c\u6b62io\u64cd\u4f5c\u961f\u5217\uff0c\u53ef\u4ee5\u901a\u8fc7start\u4ece\u5934\u5f00\u59cb\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\n\u8fd4\u56de\u503c\uff1a\nint \u8fd4\u56de\u5df2\u7ecf\u5faa\u73af\u7684\u6b21\u6570\uff0c\u5982\u679c\u662f0\uff0c\u8868\u793a\u4e00\u6b21\u5faa\u73af\u90fd\u6ca1\u6709\u5b8c\u6210\nint \u8fd4\u56de\u5355\u6b21\u5faa\u73af\u4e2d\u5df2\u7ecf\u6267\u884c\u7684cmd\u6b21\u6570\uff0c\u5982\u679c\u662f0\uff0c\u53ef\u80fd\u662f\u4e00\u6b21\u5faa\u73af\u521a\u521a\u7ed3\u675f\n\u4f8b\u5b50\uff1a\nioqueue.stop(0)\n", "prefix": "ioqueue.stop"}, "ioqueue.release": {"body": "ioqueue.release(${1:hwtimer_id})", "description": "ioqueue.release(hwtimer_id) - \u91ca\u653eio\u64cd\u4f5c\u961f\u5217\u7684\u8d44\u6e90\uff0c\u4e0b\u6b21\u4f7f\u7528\u5fc5\u987b\u91cd\u65b0init\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\nreturn \u65e0\n\u4f8b\u5b50\uff1a\nioqueue.clear(0)\n", "prefix": "ioqueue.release"}, "ioqueue.clear": {"body": "ioqueue.clear(${1:hwtimer_id})", "description": "ioqueue.clear(hwtimer_id) - \u6e05\u7a7aio\u64cd\u4f5c\u961f\u5217\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\nreturn \u65e0\n\u4f8b\u5b50\uff1a\nioqueue.clear(0)\n", "prefix": "ioqueue.clear"}, "ioqueue.done": {"body": "ioqueue.done(${1:hwtimer_id})", "description": "ioqueue.done(hwtimer_id) - \u68c0\u6d4bio\u64cd\u4f5c\u961f\u5217\u662f\u5426\u5df2\u7ecf\u6267\u884c\u5b8c\u6210\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\n\u8fd4\u56de\u503c\uff1a\nboolean \u961f\u5217\u662f\u5426\u6267\u884c\u5b8c\u6210\uff0c\n\u4f8b\u5b50\uff1a\nlocal result = ioqueue.done(0)\n", "prefix": "ioqueue.done"}, "ioqueue.exti": {"body": "ioqueue.exti(${1:pin},${2:pull_mode},${3:irq_mode},${4:onoff})", "description": "ioqueue.exti(pin,pull_mode,irq_mode,onoff) - \u542f\u52a8/\u505c\u6b62\u4e00\u4e2a\u5e26\u7cfb\u7edftick\u8fd4\u56de\u7684\u5916\u90e8\u4e2d\u65ad\n\u4f20\u5165\u503c\uff1a\nint pin\nint \u4e0a\u4e0b\u62c9\u6a21\u5f0f,\u53ea\u80fd\u662f0,gpio.PULLUP,gpio.PULLDOWN\nint \u4e2d\u65ad\u6a21\u5f0f,\u53ea\u80fd\u662fgpio.BOTH,gpio.RISING,gpio.FALLING\nboolean \u5f00\u5173\uff0c\u9ed8\u8ba4\u662ffalse\u5173\nreturn \u65e0\n\u4f8b\u5b50\uff1a\nioqueue.exti(pin.PB01, gpio.PULLUP, gpio.BOTH, true)\nioqueue.exti(pin.PB01)\n", "prefix": "ioqueue.exti"}, "iotauth.aliyun": {"body": "iotauth.aliyun(${1:product_key},${2:device_name},${3:device_secret},${4:method},${5:cur_timestamp})", "description": "iotauth.aliyun(product_key, device_name,device_secret,method,cur_timestamp) - \u963f\u91cc\u4e91\u7269\u8054\u7f51\u5e73\u53f0\u4e09\u5143\u7ec4\u751f\u6210\n\u4f20\u5165\u503c\uff1a\nstring product_key\nstring device_name\nstring device_secret\nstring method \u52a0\u5bc6\u65b9\u5f0f,\"hmacmd5\" \"hmacsha1\" \"hmacsha256\" \u53ef\u9009,\u9ed8\u8ba4\"hmacmd5\"\nnumber cur_timestamp \u53ef\u9009 \u9ed8\u8ba4\u4e3a 32472115200(2999-01-01 0:0:0)\nbool istls \u662f\u5426TLS\u76f4\u8fde true:TLS\u76f4\u8fde false:TCP\u76f4\u8fde\u6a21\u5f0f \u9ed8\u8ba4TCP\u76f4\u8fde\u6a21\u5f0f\n\u8fd4\u56de\u503c\uff1a\nstring mqtt\u4e09\u5143\u7ec4 client_id\nstring mqtt\u4e09\u5143\u7ec4 user_name\nstring mqtt\u4e09\u5143\u7ec4 password\n\u4f8b\u5b50\uff1a\nlocal client_id,user_name,password = iotauth.aliyun(\"123456789\",\"abcdefg\",\"Y877Bgo8X5owd3lcB5wWDjryNPoB\")\nprint(client_id,user_name,password)\n", "prefix": "iotauth.aliyun"}, "iotauth.onenet": {"body": "iotauth.onenet(${1:produt_id},${2:device_name},${3:key},${4:method},${5:cur_timestamp},${6:version})", "description": "iotauth.onenet(produt_id, device_name,key,method,cur_timestamp,version) - \u4e2d\u56fd\u79fb\u52a8\u7269\u8054\u7f51\u5e73\u53f0\u4e09\u5143\u7ec4\u751f\u6210\n\u4f20\u5165\u503c\uff1a\nstring produt_id \u4ea7\u54c1id\nstring device_name \u8bbe\u5907\u540d\u79f0\nstring key \u8bbe\u5907\u5bc6\u94a5\u6216\u8005\u9879\u76ee\u7684acess_key\nstring method \u52a0\u5bc6\u65b9\u5f0f,\"md5\" \"sha1\" \"sha256\" \u53ef\u9009,\u9ed8\u8ba4\"md5\"\nnumber \u65f6\u95f4\u6233, \u4e0d\u7528\u586b\nstring version \u53ef\u9009 \u9ed8\u8ba4\"2018-10-31\"\nstring \u5f53key\u662faccess_key\u65f6, \u586b \"products/\" .. product_id . \u672c\u53c2\u6570\u4e8e2024.1.29\u65b0\u589e\n\u8fd4\u56de\u503c\uff1a\nstring mqtt\u4e09\u5143\u7ec4 client_id\nstring mqtt\u4e09\u5143\u7ec4 user_name\nstring mqtt\u4e09\u5143\u7ec4 password\n\u4f8b\u5b50\uff1a\n-- OneNet\u5e73\u53f0\u5b98\u7f51: https://open.iot.10086.cn/\n-- OneNet\u6709\u591a\u79cd\u7248\u672c, \u6ce8\u610f\u533a\u5206, \u4e00\u822c\u6765\u8bf4produt_id\u7eaf\u6570\u5b57\u5c31\u662f\u8001\u7248\u672c, \u5426\u5219\u5c31\u662f\u65b0\u7248\u672c\n\n-- \u65b0\u7248OneNET\u5e73\u53f0, \u4ea7\u54c1id\u662f\u82f1\u6587\u5b57\u6bcd\u5b57\u7b26\u4e32\n-- \u5bf9\u5e94demo/onenet/studio\nlocal produt_id = \"Ck2AF9QD2K\"\nlocal device_name = \"test\"\nlocal device_key = \"KuF3NT/jUBJ62LNBB/A8XZA9CqS3Cu79B/ABmfA1UCw=\"\nlocal client_id,user_name,password = iotauth.onenet(produt_id, device_name, device_key)\nlog.info(\"onenet.new\", client_id,user_name,password)\n\n-- \u65e7\u7248OneNET\u5e73\u53f0, \u4ea7\u54c1id\u662f\u6570\u5b57\u5b57\u7b26\u4e32. 2024.1.29\u65b0\u589e\n-- \u5bf9\u5e94demo/onenet/old_mqtt\nlocal produt_id = \"12342334\"\nlocal device_name = \"test\"\nlocal access_key = \"adfasdfadsfadsf=\"\nlocal client_id,user_name,password = iotauth.onenet(produt_id, device_name, access_key, nil, nil, nil, \"products/\" .. produt_id)\nlog.info(\"onenet.old\", client_id,user_name,password)\n\n", "prefix": "iotauth.onenet"}, "iotauth.iotda": {"body": "iotauth.iotda(${1:device_id},${2:device_secret},${3:cur_timestamp})", "description": "iotauth.iotda(device_id,device_secret,cur_timestamp) - \u534e\u4e3a\u7269\u8054\u7f51\u5e73\u53f0\u4e09\u5143\u7ec4\u751f\u6210\n\u4f20\u5165\u503c\uff1a\nstring device_id\nstring device_secret\nnumber cur_timestamp \u53ef\u9009 \u5982\u4e0d\u586b\u5219\u4e0d\u6821\u9a8c\u65f6\u95f4\u6233\n\u8fd4\u56de\u503c\uff1a\nstring mqtt\u4e09\u5143\u7ec4 client_id\nstring mqtt\u4e09\u5143\u7ec4 user_name\nstring mqtt\u4e09\u5143\u7ec4 password\n\u4f8b\u5b50\uff1a\nlocal client_id,user_name,password = iotauth.iotda(\"6203cc94c7fb24029b110408_88888888\",\"123456789\")\nprint(client_id,user_name,password)\n", "prefix": "iotauth.iotda"}, "iotauth.qcloud": {"body": "iotauth.qcloud(${1:product_id},${2:device_name},${3:device_secret},${4:method},${5:cur_timestamp},${6:sdk_appid})", "description": "iotauth.qcloud(product_id, device_name,device_secret,method,cur_timestamp,sdk_appid) - \u817e\u8baf\u8054\u7f51\u5e73\u53f0\u4e09\u5143\u7ec4\u751f\u6210\n\u4f20\u5165\u503c\uff1a\nstring \u4ea7\u54c1id,\u521b\u5efa\u9879\u76ee\u540e\u53ef\u4ee5\u67e5\u770b\u5230,\u7c7b\u4f3c\u4e8eLD8S5J1L07\nstring \u8bbe\u5907\u540d\u79f0,\u4f8b\u5982\u8bbe\u5907\u7684imei\u53f7\nstring \u8bbe\u5907\u5bc6\u94a5,\u521b\u5efa\u8bbe\u5907\u540e,\u67e5\u770b\u8bbe\u5907\u8be6\u60c5\u53ef\u5f97\u5230\nstring method \u52a0\u5bc6\u65b9\u5f0f,\"sha1\" \"sha256\" \u53ef\u9009,\u9ed8\u8ba4\"sha256\"\nnumber cur_timestamp \u53ef\u9009 \u9ed8\u8ba4\u4e3a 32472115200(2999-01-01 0:0:0)\nstring sdk_appid \u53ef\u9009 \u9ed8\u8ba4\u4e3a\"12010126\"\n\u8fd4\u56de\u503c\uff1a\nstring mqtt\u4e09\u5143\u7ec4 client_id\nstring mqtt\u4e09\u5143\u7ec4 user_name\nstring mqtt\u4e09\u5143\u7ec4 password\n\u4f8b\u5b50\uff1a\nlocal client_id,user_name,password = iotauth.qcloud(\"LD8S5J1L07\",\"test\",\"acyv3QDJrRa0fW5UE58KnQ==\")\nprint(client_id,user_name,password)\n", "prefix": "iotauth.qcloud"}, "iotauth.tuya": {"body": "iotauth.tuya(${1:device_id},${2:device_secret},${3:cur_timestamp})", "description": "iotauth.tuya(device_id,device_secret,cur_timestamp) - \u6d82\u9e26\u8054\u7f51\u5e73\u53f0\u4e09\u5143\u7ec4\u751f\u6210\n\u4f20\u5165\u503c\uff1a\nstring device_id\nstring device_secret\nnumber cur_timestamp \u53ef\u9009 \u9ed8\u8ba47258089600(2200-01-01 0:0:0)\n\u8fd4\u56de\u503c\uff1a\nstring mqtt\u4e09\u5143\u7ec4 client_id\nstring mqtt\u4e09\u5143\u7ec4 user_name\nstring mqtt\u4e09\u5143\u7ec4 password\n\u4f8b\u5b50\uff1a\nlocal client_id,user_name,password = iotauth.tuya(\"6c95875d0f5ba69607nzfl\",\"fb803786602df760\")\nprint(client_id,user_name,password)\n", "prefix": "iotauth.tuya"}, "iotauth.baidu": {"body": "iotauth.baidu(${1:iot_core_id},${2:device_key},${3:device_secret},${4:method},${5:cur_timestamp})", "description": "iotauth.baidu(iot_core_id, device_key,device_secret,method,cur_timestamp) - \u767e\u5ea6\u7269\u8054\u7f51\u5e73\u53f0\u4e09\u5143\u7ec4\u751f\u6210\n\u4f20\u5165\u503c\uff1a\nstring iot_core_id\nstring device_key\nstring device_secret\nstring method \u52a0\u5bc6\u65b9\u5f0f,\"MD5\" \"SHA256\" \u53ef\u9009,\u9ed8\u8ba4\"MD5\"\nnumber cur_timestamp \u53ef\u9009 \u5982\u4e0d\u586b\u5219\u4e0d\u6821\u9a8c\u65f6\u95f4\u6233\n\u8fd4\u56de\u503c\uff1a\nstring mqtt\u4e09\u5143\u7ec4 client_id\nstring mqtt\u4e09\u5143\u7ec4 user_name\nstring mqtt\u4e09\u5143\u7ec4 password\n\u4f8b\u5b50\uff1a\nlocal client_id,user_name,password = iotauth.baidu(\"abcd123\",\"mydevice\",\"ImSeCrEt0I1M2jkl\")\nprint(client_id,user_name,password)\n", "prefix": "iotauth.baidu"}, "ir.sendNEC": {"body": "ir.sendNEC(${1:pin},${2:addr},${3:cmd},${4:repeat},${5:disablePWM})", "description": "ir.sendNEC(pin, addr, cmd, repeat, disablePWM) - \u53d1\u9001NEC\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u4f7f\u7528\u7684GPIO\u5f15\u811a\u7f16\u53f7\nint \u7528\u6237\u7801\uff08\u5927\u4e8e0xff\u5219\u91c7\u7528Extended NEC\u6a21\u5f0f\uff09\nint \u6570\u636e\u7801\nint \u53ef\u9009\uff0c\u5f15\u5bfc\u7801\u53d1\u9001\u6b21\u6570\uff08110ms\u4e00\u6b21\uff09\uff0c\u9ed8\u8ba40\u6b21\nbool \u53ef\u9009\uff0c\u662f\u5426\u7981\u6b62\u76f4\u63a5\u53d1\u9001pwm\u6ce2\uff0c\u9ed8\u8ba4false\n\u4f8b\u5b50\uff1a\n--\u76f4\u63a5\u53d1\nir.sendNEC(0, 0x11, 0x22)\n--\u5916\u63a5\u4e8638K\u7684PWM\u8f7d\u6ce2\uff0c\u53ea\u63a7\u5236\u7535\u5e73\nir.sendNEC(0, 0x11, 0x22,0,true)\n", "prefix": "ir.sendNEC"}, "json.encode": {"body": "json.encode(${1:obj},${2:t})", "description": "json.encode(obj,t) - \u5c06\u5bf9\u8c61\u5e8f\u5217\u5316\u4e3ajson\u5b57\u7b26\u4e32\n\u4f20\u5165\u503c\uff1a\nobj \u9700\u8981\u5e8f\u5217\u5316\u7684\u5bf9\u8c61\nstring \u6d6e\u70b9\u6570\u7cbe\u5ea6\u548c\u6a21\u5f0f,\u8fd9\u9879\u4e0d\u5b58\u5728\u7684\u65f6\u5019,\u4e3a\u9ed8\u8ba4\u503c\"7f\",\u6570\u5b57\u53ea\u652f\u6301\"0~14\",\u6a21\u5f0f\u53ea\u652f\u6301\"f/g\"\n\u8fd4\u56de\u503c\uff1a\nstring \u5e8f\u5217\u5316\u540e\u7684json\u5b57\u7b26\u4e32, \u5931\u8d25\u7684\u8bdd\u8fd4\u56denil\nstring \u5e8f\u5217\u5316\u5931\u8d25\u7684\u62a5\u9519\u4fe1\u606f\n\u4f8b\u5b50\uff1a\njson.encode(obj)-->\u6d6e\u70b9\u6570\u7528%.7g\u7684\u65b9\u5f0f\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\njson.encode(obj,\"12f\")-->\u6d6e\u70b9\u6570\u7528%.12f\u7684\u65b9\u5f0f\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\n\n-- 2024.1.9 \u8d77, \u9ed8\u8ba4\u4f7f\u75287f\u683c\u5f0f\u5316\u6d6e\u70b9\u6570\n-- \u4e4b\u524d\u7684\u7248\u672c\u4f7f\u7528 7g\u683c\u5f0f\u5316\u6d6e\u52a8\u6570\n", "prefix": "json.encode"}, "json.decode": {"body": "json.decode(${1:str})", "description": "json.decode(str) - \u5c06\u5b57\u7b26\u4e32\u53cd\u5e8f\u5217\u5316\u4e3a\u5bf9\u8c61\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u53cd\u5e8f\u5217\u5316\u7684json\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nobj \u53cd\u5e8f\u5217\u5316\u540e\u7684\u5bf9\u8c61(\u901a\u5e38\u662ftable), \u5931\u8d25\u7684\u8bdd\u8fd4\u56denil\nresult \u6210\u529f\u8fd4\u56de1,\u5426\u5219\u8fd4\u56de0\nerr \u53cd\u5e8f\u5217\u5316\u5931\u8d25\u7684\u62a5\u9519\u4fe1\u606f\n\u4f8b\u5b50\uff1a\njson.decode(\"[1,2,3,4,5,6]\")\n", "prefix": "json.decode"}, "keyboard.init": {"body": "keyboard.init(${1:port},${2:conf},${3:map},${4:debounce})", "description": "keyboard.init(port, conf, map, debounce) - \u521d\u59cb\u5316\u952e\u76d8\u77e9\u9635\n\u4f20\u5165\u503c\uff1a\nint \u9884\u7559, \u5f53\u524d\u586b0\nint \u542f\u7528\u7684keyboard\u7ba1\u811a\u63a9\u7801, \u4f8b\u5982\u4f7f\u7528keyboard0~9, \u5219\u63a9\u7801\u4e3a 0x1FF, \u82e5\u4f7f\u7528 0~3 \u5219 0xF\nint keyboard\u7ba1\u811a\u65b9\u5411\u6620\u5c04, \u5176\u4e2d\u8f93\u5165\u4e3a0,\u8f93\u51fa\u4e3a1, \u6309\u4f4d\u8bbe\u7f6e. \u4f8b\u5982 keyboard0~3\u4f5c\u4e3a\u8f93\u5165, keyboard4~7\u4e3a\u8f93\u5165, \u5219 0xF0\nint \u6d88\u6296\u914d\u7f6e,\u9884\u7559,\u53ef\u4ee5\u4e0d\u586b\n\u4f8b\u5b50\uff1a\n-- \u505a\u4e00\u4e2a 4*4 \u952e\u76d8\u77e9\u9635, \u4f7f\u7528 keyboard0~7, \u5176\u4e2d0~3\u505a\u8f93\u5165, 4~7\u505a\u8f93\u51fa\n-- \u4f7f\u7528 keyboard0~7, \u5bf9\u5e94conf\u4e3a 0xFF\n-- \u5176\u4e2d0~3\u505a\u8f93\u5165, 4~7\u505a\u8f93\u51fa, \u5bf9\u5e94map \u4e3a 0xF0\nkeyboard.init(0, 0xFF, 0xF0)\n\n-- \u505a\u4e00\u4e2a 2*3 \u952e\u76d8\u77e9\u9635, \u4f7f\u7528 keyboard0~4, \u5176\u4e2d0~1\u505a\u8f93\u5165, 2~4\u505a\u8f93\u51fa\n-- \u4f7f\u7528 keyboard0~4, \u4e8c\u8fdb\u5236\u4e3a 11111, \u5bf9\u5e94conf\u7684\u5341\u516d\u8fdb\u5236\u8868\u8fbe\u4e3a 0x1F\n-- \u5176\u4e2d0~1\u505a\u8f93\u5165, 2~4\u505a\u8f93\u51fa, \u4e8c\u8fdb\u5236\u4e3a 11100 \u5bf9\u5e94map \u4e3a 0x14\n-- keyboard.init(0, 0xFF, 0x14)\n\nsys.subscribe(\"KB_INC\", function(port, data, state)\n -- port \u5f53\u524d\u56fa\u5b9a\u4e3a0, \u53ef\u4ee5\u65e0\u89c6\n -- data, \u9700\u8981\u914d\u5408init\u7684map\u8fdb\u884c\u89e3\u6790\n -- state, 1 \u4e3a\u6309\u4e0b, 0 \u4e3a \u91ca\u653e\n -- TODO \u8be6\u7ec6\u4ecb\u7ecd\nend)\n", "prefix": "keyboard.init"}, "lcd.init": {"body": "lcd.init(${1:tp},${2:args},${3:spi_dev},${4:init_in_service})", "description": "lcd.init(tp, args, spi_dev, init_in_service) - lcd\u663e\u793a\u5c4f\u521d\u59cb\u5316\n\u4f20\u5165\u503c\uff1a\nstring lcd\u7c7b\u578b\uff0c\u5f53\u524d\u652f\u6301\uff1a
st7796
st7789
st7735
st7735v
st7735s
gc9a01
gc9106l
gc9306x
ili9486
custom\ntable \u9644\u52a0\u53c2\u6570,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173\uff1a
pin_pwr\uff08\u80cc\u5149\uff09\u4e3a\u53ef\u9009\u9879,\u53ef\u4e0d\u8bbe\u7f6e
port\uff1aspi\u7aef\u53e3,\u4f8b\u59820,1,2...\u5982\u679c\u4e3adevice\u65b9\u5f0f\u5219\u4e3a\"device\"
pin_dc\uff1alcd\u6570\u636e/\u547d\u4ee4\u9009\u62e9\u5f15\u811a
pin_rst\uff1alcd\u590d\u4f4d\u5f15\u811a
pin_pwr\uff1alcd\u80cc\u5149\u5f15\u811a \u53ef\u9009\u9879,\u53ef\u4e0d\u8bbe\u7f6e
direction\uff1alcd\u5c4f\u5e55\u65b9\u5411 0:0\u00b0 1:180\u00b0 2:270\u00b0 3:90\u00b0
w\uff1alcd \u6c34\u5e73\u5206\u8fa8\u7387
h\uff1alcd \u7ad6\u76f4\u5206\u8fa8\u7387
xoffset\uff1ax\u504f\u79fb(\u4e0d\u540c\u5c4f\u5e55ic \u4e0d\u540c\u5c4f\u5e55\u65b9\u5411\u4f1a\u6709\u5dee\u5f02)
yoffset\uff1ay\u504f\u79fb(\u4e0d\u540c\u5c4f\u5e55ic \u4e0d\u540c\u5c4f\u5e55\u65b9\u5411\u4f1a\u6709\u5dee\u5f02)
direction0\uff1a0\u00b0\u65b9\u5411\u547d\u4ee4\uff0c(\u4e0d\u540c\u5c4f\u5e55ic\u4f1a\u6709\u5dee\u5f02)
direction90\uff1a90\u00b0\u65b9\u5411\u547d\u4ee4\uff0c(\u4e0d\u540c\u5c4f\u5e55ic\u4f1a\u6709\u5dee\u5f02)
direction180\uff1a180\u00b0\u65b9\u5411\u547d\u4ee4\uff0c(\u4e0d\u540c\u5c4f\u5e55ic\u4f1a\u6709\u5dee\u5f02)
direction270\uff1a270\u00b0\u65b9\u5411\u547d\u4ee4\uff0c(\u4e0d\u540c\u5c4f\u5e55ic\u4f1a\u6709\u5dee\u5f02)
sleepcmd\uff1a\u7761\u7720\u547d\u4ee4\uff0c\u9ed8\u8ba40X10
wakecmd\uff1a\u5524\u9192\u547d\u4ee4\uff0c\u9ed8\u8ba40X11
interface_mode lcd\u6a21\u5f0f\uff0c\u9ed8\u8ba4lcd.WIRE_4_BIT_8_INTERFACE_I\nuserdata spi\u8bbe\u5907,\u5f53port = \"device\"\u65f6\u6709\u6548\nboolean \u5141\u8bb8\u521d\u59cb\u5316\u5728lcd service\u91cc\u8fd0\u884c\uff0c\u9ed8\u8ba4\u662ffalse\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316spi0\u7684st7735s \u6ce8\u610f:lcd\u521d\u59cb\u5316\u4e4b\u524d\u9700\u8981\u5148\u521d\u59cb\u5316spi\nspi_lcd = spi.deviceSetup(0,20,0,0,8,2000000,spi.MSB,1,1)\nlog.info(\"lcd.init\",\nlcd.init(\"st7735s\",{port = \"device\",pin_dc = 17, pin_pwr = 7,pin_rst = 19,direction = 2,w = 160,h = 80,xoffset = 1,yoffset = 26},spi_lcd))\n", "prefix": "lcd.init"}, "lcd.close": {"body": "lcd.close()", "description": "lcd.close() - \u5173\u95edlcd\u663e\u793a\u5c4f\n\u4f8b\u5b50\uff1a\n-- \u5173\u95edlcd\nlcd.close()\n", "prefix": "lcd.close"}, "lcd.on": {"body": "lcd.on()", "description": "lcd.on() - \u5f00\u542flcd\u663e\u793a\u5c4f\u80cc\u5149\n\u4f8b\u5b50\uff1a\n-- \u5f00\u542flcd\u663e\u793a\u5c4f\u80cc\u5149\nlcd.on()\n", "prefix": "lcd.on"}, "lcd.off": {"body": "lcd.off()", "description": "lcd.off() - \u5173\u95edlcd\u663e\u793a\u5c4f\u80cc\u5149\n\u4f8b\u5b50\uff1a\n-- \u5173\u95edlcd\u663e\u793a\u5c4f\u80cc\u5149\nlcd.off()\n", "prefix": "lcd.off"}, "lcd.sleep": {"body": "lcd.sleep()", "description": "lcd.sleep() - lcd\u7761\u7720\n\u4f8b\u5b50\uff1a\n-- lcd\u7761\u7720\nlcd.sleep()\n", "prefix": "lcd.sleep"}, "lcd.wakeup": {"body": "lcd.wakeup()", "description": "lcd.wakeup() - lcd\u5524\u9192\n\u4f8b\u5b50\uff1a\n-- lcd\u5524\u9192\nlcd.wakeup()\n", "prefix": "lcd.wakeup"}, "lcd.invon": {"body": "lcd.invon()", "description": "lcd.invon() - lcd\u53cd\u663e\n\u4f8b\u5b50\uff1a\n-- lcd\u53cd\u663e\nlcd.invon()\n", "prefix": "lcd.invon"}, "lcd.invoff": {"body": "lcd.invoff()", "description": "lcd.invoff() - lcd\u53cd\u663e\u5173\u95ed\n\u4f8b\u5b50\uff1a\n-- lcd\u53cd\u663e\u5173\u95ed\nlcd.invoff()\n", "prefix": "lcd.invoff"}, "lcd.cmd": {"body": "lcd.cmd(${1:cmd})", "description": "lcd.cmd(cmd) - lcd\u547d\u4ee4\n\u4f20\u5165\u503c\uff1a\nint cmd\n\u4f8b\u5b50\uff1a\n-- lcd\u547d\u4ee4\nlcd.cmd(0x21)\n", "prefix": "lcd.cmd"}, "lcd.data": {"body": "lcd.data(${1:data})", "description": "lcd.data(data) - lcd\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint data\n\u4f8b\u5b50\uff1a\n-- lcd\u6570\u636e\nlcd.data(0x21)\n", "prefix": "lcd.data"}, "lcd.setColor": {"body": "lcd.setColor(${1:back},${2:fore})", "description": "lcd.setColor(back,fore) - lcd\u989c\u8272\u8bbe\u7f6e\n\u4f20\u5165\u503c\uff1a\nint \u80cc\u666f\u8272\nint \u524d\u666f\u8272\n\u4f8b\u5b50\uff1a\n-- lcd\u989c\u8272\u8bbe\u7f6e\nlcd.setColor(0xFFFF,0x0000)\n", "prefix": "lcd.setColor"}, "lcd.draw": {"body": "lcd.draw(${1:x1},${2:y1},${3:x2},${4:y2},${5:color})", "description": "lcd.draw(x1, y1, x2, y2,color) - lcd\u989c\u8272\u586b\u5145\n\u4f20\u5165\u503c\uff1a\nint \u5de6\u4e0a\u8fb9\u7f18\u7684X\u4f4d\u7f6e.\nint \u5de6\u4e0a\u8fb9\u7f18\u7684Y\u4f4d\u7f6e.\nint \u53f3\u4e0b\u8fb9\u7f18\u7684X\u4f4d\u7f6e.\nint \u53f3\u4e0b\u8fb9\u7f18\u7684Y\u4f4d\u7f6e.\nstring \u5b57\u7b26\u4e32\u6216zbuff\u5bf9\u8c61\n\u4f8b\u5b50\uff1a\n-- lcd\u989c\u8272\u586b\u5145\nlocal buff = zbuff.create({201,1,16},0x001F)\nlcd.draw(20,30,220,30,buff)\n", "prefix": "lcd.draw"}, "lcd.clear": {"body": "lcd.clear(${1:color})", "description": "lcd.clear(color) - lcd\u6e05\u5c4f\n\u4f20\u5165\u503c\uff1a\nint \u5c4f\u5e55\u989c\u8272 \u53ef\u9009\u53c2\u6570,\u9ed8\u8ba4\u80cc\u666f\u8272\n\u4f8b\u5b50\uff1a\n-- lcd\u6e05\u5c4f\nlcd.clear()\n", "prefix": "lcd.clear"}, "lcd.fill": {"body": "lcd.fill(${1:x1},${2:y1},${3:x2},${4:y2},${5:color})", "description": "lcd.fill(x1, y1, x2, y2,color) - lcd\u989c\u8272\u586b\u5145\n\u4f20\u5165\u503c\uff1a\nint \u5de6\u4e0a\u8fb9\u7f18\u7684X\u4f4d\u7f6e.\nint \u5de6\u4e0a\u8fb9\u7f18\u7684Y\u4f4d\u7f6e.\nint \u53f3\u4e0b\u8fb9\u7f18\u7684X\u4f4d\u7f6e,\u4e0d\u542b\nint \u53f3\u4e0b\u8fb9\u7f18\u7684Y\u4f4d\u7f6e,\u4e0d\u542b\nint \u7ed8\u753b\u989c\u8272 \u53ef\u9009\u53c2\u6570,\u9ed8\u8ba4\u80cc\u666f\u8272\n\u4f8b\u5b50\uff1a\n-- lcd\u989c\u8272\u586b\u5145\nlcd.fill(20,30,220,30,0x0000)\n", "prefix": "lcd.fill"}, "lcd.drawPoint": {"body": "lcd.drawPoint(${1:x0},${2:y0},${3:color})", "description": "lcd.drawPoint(x0,y0,color) - \u753b\u4e00\u4e2a\u70b9.\n\u4f20\u5165\u503c\uff1a\nint \u70b9\u7684X\u4f4d\u7f6e.\nint \u70b9\u7684Y\u4f4d\u7f6e.\nint \u7ed8\u753b\u989c\u8272 \u53ef\u9009\u53c2\u6570,\u9ed8\u8ba4\u524d\u666f\u8272\n\u4f8b\u5b50\uff1a\nlcd.drawPoint(20,30,0x001F)\n", "prefix": "lcd.drawPoint"}, "lcd.drawLine": {"body": "lcd.drawLine(${1:x0},${2:y0},${3:x1},${4:y1},${5:color})", "description": "lcd.drawLine(x0,y0,x1,y1,color) - \u5728\u4e24\u70b9\u4e4b\u95f4\u753b\u4e00\u6761\u7ebf.\n\u4f20\u5165\u503c\uff1a\nint \u7b2c\u4e00\u4e2a\u70b9\u7684X\u4f4d\u7f6e.\nint \u7b2c\u4e00\u4e2a\u70b9\u7684Y\u4f4d\u7f6e.\nint \u7b2c\u4e8c\u4e2a\u70b9\u7684X\u4f4d\u7f6e.\nint \u7b2c\u4e8c\u4e2a\u70b9\u7684Y\u4f4d\u7f6e.\nint \u7ed8\u753b\u989c\u8272 \u53ef\u9009\u53c2\u6570,\u9ed8\u8ba4\u524d\u666f\u8272\n\u4f8b\u5b50\uff1a\nlcd.drawLine(20,30,220,30,0x001F)\n", "prefix": "lcd.drawLine"}, "lcd.drawRectangle": {"body": "lcd.drawRectangle(${1:x0},${2:y0},${3:x1},${4:y1},${5:color})", "description": "lcd.drawRectangle(x0,y0,x1,y1,color) - \u4ecex / y\u4f4d\u7f6e\uff08\u5de6\u4e0a\u8fb9\u7f18\uff09\u5f00\u59cb\u7ed8\u5236\u4e00\u4e2a\u6846\n\u4f20\u5165\u503c\uff1a\nint \u5de6\u4e0a\u8fb9\u7f18\u7684X\u4f4d\u7f6e.\nint \u5de6\u4e0a\u8fb9\u7f18\u7684Y\u4f4d\u7f6e.\nint \u53f3\u4e0b\u8fb9\u7f18\u7684X\u4f4d\u7f6e.\nint \u53f3\u4e0b\u8fb9\u7f18\u7684Y\u4f4d\u7f6e.\nint \u7ed8\u753b\u989c\u8272 \u53ef\u9009\u53c2\u6570,\u9ed8\u8ba4\u524d\u666f\u8272\n\u4f8b\u5b50\uff1a\nlcd.drawRectangle(20,40,220,80,0x001F)\n", "prefix": "lcd.drawRectangle"}, "lcd.drawCircle": {"body": "lcd.drawCircle(${1:x0},${2:y0},${3:r},${4:color})", "description": "lcd.drawCircle(x0,y0,r,color) - \u4ecex / y\u4f4d\u7f6e\uff08\u5706\u5fc3\uff09\u5f00\u59cb\u7ed8\u5236\u4e00\u4e2a\u5706\n\u4f20\u5165\u503c\uff1a\nint \u5706\u5fc3\u7684X\u4f4d\u7f6e.\nint \u5706\u5fc3\u7684Y\u4f4d\u7f6e.\nint \u534a\u5f84.\nint \u7ed8\u753b\u989c\u8272 \u53ef\u9009\u53c2\u6570,\u9ed8\u8ba4\u524d\u666f\u8272\n\u4f8b\u5b50\uff1a\nlcd.drawCircle(120,120,20,0x001F)\n", "prefix": "lcd.drawCircle"}, "lcd.drawQrcode": {"body": "lcd.drawQrcode(${1:x},${2:y},${3:str},${4:size})", "description": "lcd.drawQrcode(x, y, str, size) - \u7f13\u51b2\u533a\u7ed8\u5236QRCode\n\u4f20\u5165\u503c\uff1a\nint x\u5750\u6807\nint y\u5750\u6807\nstring \u4e8c\u7ef4\u7801\u7684\u5185\u5bb9\nint \u663e\u793a\u5927\u5c0f (\u6ce8\u610f:\u4e8c\u7ef4\u7801\u751f\u6210\u5927\u5c0f\u4e0e\u8981\u663e\u793a\u5185\u5bb9\u548c\u7ea0\u9519\u7b49\u7ea7\u6709\u5173,\u751f\u6210\u7248\u672c\u4e3a1-40(\u5bf9\u5e94 21x21 - 177x177)\u7684\u4e0d\u5b9a\u5927\u5c0f,\u5982\u679c\u548c\u8bbe\u7f6e\u5927\u5c0f\u4e0d\u540c\u4f1a\u81ea\u52a8\u5728\u6307\u5b9a\u7684\u533a\u57df\u4e2d\u95f4\u663e\u793a\u4e8c\u7ef4\u7801,\u5982\u4e8c\u7ef4\u7801\u672a\u663e\u793a\u8bf7\u67e5\u770b\u65e5\u5fd7\u63d0\u793a)\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "lcd.drawQrcode"}, "lcd.setFont": {"body": "lcd.setFont(${1:font},${2:indentation})", "description": "lcd.setFont(font, indentation) - \u8bbe\u7f6e\u5b57\u4f53\n\u4f20\u5165\u503c\uff1a\nint font lcd.font_XXX \u8bf7\u67e5\u9605\u5e38\u91cf\u8868\nint indentation, \u7b49\u5bbd\u5b57\u4f53ascii\u53f3\u4fa7\u7f29\u8fdb0~127\u4e2apixel\uff0c\u7b49\u5bbd\u5b57\u4f53\u7684ascii\u5b57\u7b26\u53ef\u80fd\u5728\u53f3\u4fa7\u6709\u5927\u7247\u7a7a\u767d\uff0c\u7528\u6237\u53ef\u4ee5\u9009\u62e9\u5220\u9664\u90e8\u5206\u3002\u7559\u7a7a\u6216\u8005\u8d85\u8fc7127\u5219\u76f4\u63a5\u5220\u9664\u53f3\u534a\u8fb9, \u975e\u7b49\u5bbd\u5b57\u4f53\u65e0\u6548\n\u4f8b\u5b50\uff1a\n-- \u8bbe\u7f6e\u4e3a\u5b57\u4f53,\u5bf9\u4e4b\u540e\u7684drawStr\u6709\u6548,\u8c03\u7528lcd.drawStr\u524d\u4e00\u5b9a\u8981\u5148\u8bbe\u7f6e\n\n-- \u82e5\u63d0\u793a \"only font pointer is allow\" , \u5219\u4ee3\u8868\u5f53\u524d\u56fa\u4ef6\u4e0d\u542b\u5bf9\u5e94\u5b57\u4f53, \u53ef\u4f7f\u7528\u4e91\u7f16\u8bd1\u670d\u52a1\u514d\u8d39\u5b9a\u5236\n-- \u4e91\u7f16\u8bd1\u6587\u6863: https://wiki.luatos.com/develop/compile/Cloud_compilation.html\n\n-- lcd\u5e93\u7684\u9ed8\u8ba4\u5b57\u4f53\u5747\u4ee5 lcd.font_ \u5f00\u5934\nlcd.setFont(lcd.font_opposansm12)\nlcd.drawStr(40,10,\"drawStr\")\nsys.wait(2000)\nlcd.setFont(lcd.font_opposansm12_chinese) -- \u5177\u4f53\u53d6\u503c\u53ef\u53c2\u8003api\u6587\u6863\u7684\u5e38\u91cf\u8868\nlcd.drawStr(40,40,\"drawStr\u6d4b\u8bd5\")\n", "prefix": "lcd.setFont"}, "lcd.drawStr": {"body": "lcd.drawStr(${1:x},${2:y},${3:str},${4:fg_color})", "description": "lcd.drawStr(x,y,str,fg_color) - \u663e\u793a\u5b57\u7b26\u4e32\n\u4f20\u5165\u503c\uff1a\nint x \u6a2a\u5750\u6807\nint y \u7ad6\u5750\u6807 \u6ce8\u610f:\u6b64(x,y)\u4e3a\u5de6\u4e0b\u8d77\u59cb\u5750\u6807\nstring str \u6587\u4ef6\u5185\u5bb9\nint fg_color str\u989c\u8272 \u6ce8\u610f:\u6b64\u53c2\u6570\u53ef\u9009\uff0c\u5982\u4e0d\u586b\u5199\u5219\u4f7f\u7528\u4e4b\u524d\u8bbe\u7f6e\u7684\u989c\u8272\uff0c\u7ed8\u5236\u53ea\u4f1a\u7ed8\u5236\u5b57\u4f53\u90e8\u5206\uff0c\u80cc\u666f\u9700\u8981\u81ea\u5df1\u6e05\u9664\n\u4f8b\u5b50\uff1a\n-- \u663e\u793a\u4e4b\u524d\u5148\u8bbe\u7f6e\u4e3a\u4e2d\u6587\u5b57\u4f53,\u5bf9\u4e4b\u540e\u7684drawStr\u6709\u6548\nlcd.setFont(lcd.font_opposansm12)\nlcd.drawStr(40,10,\"drawStr\")\nsys.wait(2000)\nlcd.setFont(lcd.font_opposansm16_chinese)\nlcd.drawStr(40,40,\"drawStr\u6d4b\u8bd5\")\n", "prefix": "lcd.drawStr"}, "lcd.drawGtfontGb2312": {"body": "lcd.drawGtfontGb2312(${1:str},${2:size},${3:x},${4:y})", "description": "lcd.drawGtfontGb2312(str,size,x,y) - \u4f7f\u7528gtfont\u663e\u793agb2312\u5b57\u7b26\u4e32\n\u4f20\u5165\u503c\uff1a\nstring str \u663e\u793a\u5b57\u7b26\u4e32\nint size \u5b57\u4f53\u5927\u5c0f (\u652f\u630116-192\u53f7\u5927\u5c0f\u5b57\u4f53)\nint x \u6a2a\u5750\u6807\nint y \u7ad6\u5750\u6807\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f, gtfont\u662f\u989d\u5916\u7684\u5b57\u4f53\u82af\u7247\u786c\u4ef6, \u9700\u8981\u5916\u6302\u5728SPI\u603b\u7ebf\u624d\u80fd\u8c03\u7528\u672c\u51fd\u6570\u7684\nlcd.drawGtfontGb2312(\"\u554a\u554a\u554a\",32,0,0)\n", "prefix": "lcd.drawGtfontGb2312"}, "lcd.drawGtfontGb2312Gray": {"body": "lcd.drawGtfontGb2312Gray(${1:str},${2:size},${3:gray},${4:x},${5:y})", "description": "lcd.drawGtfontGb2312Gray(str,size,gray,x,y) - \u4f7f\u7528gtfont\u7070\u5ea6\u663e\u793agb2312\u5b57\u7b26\u4e32\n\u4f20\u5165\u503c\uff1a\nstring str \u663e\u793a\u5b57\u7b26\u4e32\nint size \u5b57\u4f53\u5927\u5c0f (\u652f\u630116-192\u53f7\u5927\u5c0f\u5b57\u4f53)\nint gray \u7070\u5ea6[1\u9636/2\u9636/3\u9636/4\u9636]\nint x \u6a2a\u5750\u6807\nint y \u7ad6\u5750\u6807\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f, gtfont\u662f\u989d\u5916\u7684\u5b57\u4f53\u82af\u7247\u786c\u4ef6, \u9700\u8981\u5916\u6302\u5728SPI\u603b\u7ebf\u624d\u80fd\u8c03\u7528\u672c\u51fd\u6570\u7684\nlcd.drawGtfontGb2312Gray(\"\u554a\u554a\u554a\",32,4,0,40)\n", "prefix": "lcd.drawGtfontGb2312Gray"}, "lcd.drawGtfontUtf8": {"body": "lcd.drawGtfontUtf8(${1:str},${2:size},${3:x},${4:y})", "description": "lcd.drawGtfontUtf8(str,size,x,y) - \u4f7f\u7528gtfont\u663e\u793aUTF8\u5b57\u7b26\u4e32\n\u4f20\u5165\u503c\uff1a\nstring str \u663e\u793a\u5b57\u7b26\u4e32\nint size \u5b57\u4f53\u5927\u5c0f (\u652f\u630116-192\u53f7\u5927\u5c0f\u5b57\u4f53)\nint x \u6a2a\u5750\u6807\nint y \u7ad6\u5750\u6807\n\u4f8b\u5b50\uff1a\nlcd.drawGtfontUtf8(\"\u554a\u554a\u554a\",32,0,0)\n", "prefix": "lcd.drawGtfontUtf8"}, "lcd.drawGtfontUtf8Gray": {"body": "lcd.drawGtfontUtf8Gray(${1:str},${2:size},${3:gray},${4:x},${5:y})", "description": "lcd.drawGtfontUtf8Gray(str,size,gray,x,y) - \u4f7f\u7528gtfont\u7070\u5ea6\u663e\u793aUTF8\u5b57\u7b26\u4e32\n\u4f20\u5165\u503c\uff1a\nstring str \u663e\u793a\u5b57\u7b26\u4e32\nint size \u5b57\u4f53\u5927\u5c0f (\u652f\u630116-192\u53f7\u5927\u5c0f\u5b57\u4f53)\nint gray \u7070\u5ea6[1\u9636/2\u9636/3\u9636/4\u9636]\nint x \u6a2a\u5750\u6807\nint y \u7ad6\u5750\u6807\n\u4f8b\u5b50\uff1a\nlcd.drawGtfontUtf8Gray(\"\u554a\u554a\u554a\",32,4,0,40)\n", "prefix": "lcd.drawGtfontUtf8Gray"}, "lcd.getSize": {"body": "lcd.getSize()", "description": "lcd.getSize() - \u83b7\u53d6\u5c4f\u5e55\u5c3a\u5bf8\n\u8fd4\u56de\u503c\uff1a\nint \u5bbd, \u5982\u679c\u672a\u521d\u59cb\u5316\u4f1a\u8fd4\u56de0\nint \u9ad8, \u5982\u679c\u672a\u521d\u59cb\u5316\u4f1a\u8fd4\u56de0\n\u4f8b\u5b50\uff1a\nlog.info(\"lcd\", \"size\", lcd.getSize())\n", "prefix": "lcd.getSize"}, "lcd.drawXbm": {"body": "lcd.drawXbm(${1:x},${2:y},${3:w},${4:h},${5:data})", "description": "lcd.drawXbm(x, y, w, h, data) - \u7ed8\u5236\u4f4d\u56fe\n\u4f20\u5165\u503c\uff1a\nint X\u5750\u6807\nint y\u5750\u6807\nint \u4f4d\u56fe\u5bbd\nint \u4f4d\u56fe\u9ad8\nint \u4f4d\u56fe\u6570\u636e,\u6bcf\u4e00\u4f4d\u4ee3\u8868\u4e00\u4e2a\u50cf\u7d20\n\u4f8b\u5b50\uff1a\n-- \u53d6\u6a21\u4f7f\u7528PCtoLCD2002\u8f6f\u4ef6\u5373\u53ef \u9634\u7801 \u9010\u884c \u9006\u5411\n-- \u5728(0,0)\u4e3a\u5de6\u4e0a\u89d2,\u7ed8\u5236 16x16 \"\u4eca\" \u7684\u4f4d\u56fe\nlcd.drawXbm(0, 0, 16,16, string.char(\n 0x80,0x00,0x80,0x00,0x40,0x01,0x20,0x02,0x10,0x04,0x48,0x08,0x84,0x10,0x83,0x60,\n 0x00,0x00,0xF8,0x0F,0x00,0x08,0x00,0x04,0x00,0x04,0x00,0x02,0x00,0x01,0x80,0x00\n))\n", "prefix": "lcd.drawXbm"}, "lcd.showImage": {"body": "lcd.showImage(${1:x},${2:y},${3:file})", "description": "lcd.showImage(x, y, file) - \u663e\u793a\u56fe\u7247,\u5f53\u524d\u53ea\u652f\u6301jpg,jpeg\n\u4f20\u5165\u503c\uff1a\nint X\u5750\u6807\nint y\u5750\u6807\nstring \u6587\u4ef6\u8def\u5f84\n\u4f8b\u5b50\uff1a\nlcd.showImage(0,0,\"/luadb/logo.jpg\")\n", "prefix": "lcd.showImage"}, "lcd.flush": {"body": "lcd.flush()", "description": "lcd.flush() - \u4e3b\u52a8\u5237\u65b0\u6570\u636e\u5230\u754c\u9762, \u4ec5\u8bbe\u7f6ebuff\u4e14\u7981\u7528\u81ea\u52a8\u5c5e\u6027\u540e\u4f7f\u7528\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue, \u5426\u5219\u8fd4\u56denil/false\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e0e lcd.setupBuff lcd.autoFlush \u914d\u5408\u4f7f\u7528\nlcd.flush()\n", "prefix": "lcd.flush"}, "lcd.setupBuff": {"body": "lcd.setupBuff(${1:conf},${2:onheap})", "description": "lcd.setupBuff(conf, onheap) - \u8bbe\u7f6e\u663e\u793a\u7f13\u51b2\u533a, \u6240\u9700\u5185\u5b58\u5927\u5c0f\u4e3a 2\u00d7\u5bbd\u00d7\u9ad8 \u5b57\u8282. \u8bf7\u8861\u91cf\u5185\u5b58\u9700\u6c42\u4e0e\u4e1a\u52a1\u6240\u9700\u7684\u5237\u65b0\u9891\u6b21.\n\u4f20\u5165\u503c\uff1a\nuserdata conf\u6307\u9488, \u4e0d\u9700\u8981\u4f20\nbool true\u4f7f\u7528heap\u5185\u5b58, false\u4f7f\u7528vm\u5185\u5b58, \u9ed8\u8ba4\u4f7f\u7528vm\u5185\u5b58, \u4e0d\u9700\u8981\u4e3b\u52a8\u4f20\n\u8fd4\u56de\u503c\uff1a\nbool \u662f\u5426\u6210\u529f\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316lcd\u7684buff\u7f13\u51b2\u533a, \u53ef\u7406\u89e3\u4e3aFrameBuffer\u533a\u57df.\nlcd.setupBuff()\n", "prefix": "lcd.setupBuff"}, "lcd.autoFlush": {"body": "lcd.autoFlush(${1:enable})", "description": "lcd.autoFlush(enable) - \u8bbe\u7f6e\u81ea\u52a8\u5237\u65b0, \u9700\u914d\u5408lcd.setupBuff\u4f7f\u7528\n\u4f20\u5165\u503c\uff1a\nbool \u662f\u5426\u81ea\u52a8\u5237\u65b0,\u9ed8\u8ba4\u4e3atrue\n\u4f8b\u5b50\uff1a\n-- \u8bbe\u7f6ebuff \u5e76\u7981\u7528\u81ea\u52a8\u66f4\u65b0\nlcd.setupBuff()\nlcd.autoFlush(false)\n-- \u7981\u6b62\u81ea\u52a8\u66f4\u65b0\u540e, \u9700\u8981\u4f7f\u7528 lcd.flush() \u4e3b\u52a8\u5237\u65b0\u6570\u636e\u5230\u5c4f\u5e55\n", "prefix": "lcd.autoFlush"}, "lcd.rgb565": {"body": "lcd.rgb565(${1:r},${2:g},${3:b},${4:swap})", "description": "lcd.rgb565(r, g, b, swap) - RGB565\u989c\u8272\u751f\u6210\n\u4f20\u5165\u503c\uff1a\nint \u7ea2\u8272, 0x00 ~ 0xFF\nint \u7eff\u8272, 0x00 ~ 0xFF\nint \u84dd\u8272, 0x00 ~ 0xFF\nbool \u662f\u5426\u7ffb\u8f6c, true \u7ffb\u8f6c, false \u4e0d\u7ffb\u8f6c. \u9ed8\u8ba4\u7ffb\u8f6c\n\u8fd4\u56de\u503c\uff1a\nint \u989c\u8272\u503c\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u652f\u6301\u591a\u79cd\u6a21\u5f0f, \u53c2\u6570\u6570\u91cf\u5206\u522b\u662f 1, 2, 3, 4\n-- 1. \u5355\u53c2\u6570\u5f62\u5f0f, 24bit RGB\u503c, swap = true, \u63a8\u8350\nlocal red = lcd.rgb565(0xFF0000)\nlocal green = lcd.rgb565(0x00FF00)\nlocal blue = lcd.rgb565(0x0000FF)\n\n-- 2. \u4e24\u53c2\u6570\u5f62\u5f0f, 24bit RGB\u503c, \u589e\u52a0swap\u7684\u8bbe\u7f6e\nlocal red = lcd.rgb565(0xFF0000, true)\nlocal green = lcd.rgb565(0x00FF00, true)\nlocal blue = lcd.rgb565(0x0000FF, true)\n\n-- 3. \u4e09\u53c2\u6570\u5f62\u5f0f, \u7ea2/\u7eff/\u84dd, \u54048bit\nlocal red = lcd.rgb565(0xFF, 0x00, 0x00)\nlocal green = lcd.rgb565(0x00, 0xFF, 0x00)\nlocal blue = lcd.rgb565(0x00, 0x00, 0xFF)\n\n-- 4. \u56db\u53c2\u6570\u5f62\u5f0f, \u7ea2/\u7eff/\u84dd, \u54048bit, \u589e\u52a0swap\u7684\u8bbe\u7f6e\nlocal red = lcd.rgb565(0xFF, 0x00, 0x00, true)\nlocal green = lcd.rgb565(0x00, 0xFF, 0x00, true)\nlocal blue = lcd.rgb565(0x00, 0x00, 0xFF, true)\n", "prefix": "lcd.rgb565"}, "lcdseg.setup": {"body": "lcdseg.setup(${1:bias},${2:duty},${3:vlcd},${4:com_number},${5:fresh_rate},${6:com_mark},${7:seg_mark})", "description": "lcdseg.setup(bias, duty, vlcd, com_number, fresh_rate, com_mark, seg_mark) - \u521d\u59cb\u5316lcdseg\u5e93\n\u4f20\u5165\u503c\uff1a\nint bias\u503c,\u901a\u5e38\u4e3a 1/3 bias, \u5bf9\u5e94 lcdseg.BIAS_ONETHIRD\nint duty\u503c,\u901a\u5e38\u4e3a 1/4 duty, \u5bf9\u5e94 lcdseg.DUTY_ONEFOURTH\nint \u7535\u538b, \u5355\u4f4d100mV, \u4f8b\u59822.7v\u519927. air103\u652f\u6301\u7684\u503c\u6709 27/29/31/33\nint COM\u811a\u7684\u6570\u91cf, \u53d6\u51b3\u4e8e\u5177\u4f53\u6a21\u5757, air103\u652f\u63011-4\nint \u5237\u65b0\u7387,\u901a\u5e38\u4e3a60, \u5bf9\u5e9460HZ\nint COM\u542f\u7528\u4e0e\u5426\u7684\u63a9\u7801, \u9ed8\u8ba4\u4e3a0xFF,\u5168\u90e8\u542f\u7528.\u82e5\u53ea\u542f\u7528COM0/COM1, \u52190x03\nint seg\u542f\u7528\u4e0e\u5426\u7684\u63a9\u7801, \u9ed8\u8ba4\u4e3a0xFFFFFFFF,\u5373\u5168\u90e8\u542f\u7528. \u82e5\u53ea\u542f\u7528\u524d16\u4e2a, 0xFFFF\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316lcdseg\nif lcdseg.setup(lcdseg.BIAS_ONETHIRD, lcdseg.DUTY_ONEFOURTH, 33, 4, 60) then\n lcdseg.enable(1)\n\n lcdseg.seg_set(0, 1, 1)\n lcdseg.seg_set(2, 0, 1)\n lcdseg.seg_set(3, 31, 1)\nend\n", "prefix": "lcdseg.setup"}, "lcdseg.enable": {"body": "lcdseg.enable(${1:en})", "description": "lcdseg.enable(en) - \u542f\u7528\u6216\u7981\u7528lcdseg\u5e93\n\u4f20\u5165\u503c\uff1a\nint 1\u542f\u7528,0\u7981\u7528\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\n", "prefix": "lcdseg.enable"}, "lcdseg.power": {"body": "lcdseg.power(${1:en})", "description": "lcdseg.power(en) - \u542f\u7528\u6216\u7981\u7528lcdseg\u7684\u8f93\u51fa\n\u4f20\u5165\u503c\uff1a\nint 1\u542f\u7528,0\u7981\u7528\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\n", "prefix": "lcdseg.power"}, "lcdseg.seg_set": {"body": "lcdseg.seg_set(${1:com},${2:seg},${3:en})", "description": "lcdseg.seg_set(com, seg, en) - \u8bbe\u7f6e\u5177\u4f53\u4e00\u4e2a\u6bb5\u7801\u7684\u72b6\u6001\n\u4f20\u5165\u503c\uff1a\nint COM\u53f7\nint seg\u53f7 \u8981\u66f4\u6539\u7684\u5b57\u6bb5\u7684\u4f4d\u7d22\u5f15\nint 1\u542f\u7528,0\u7981\u7528\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\n", "prefix": "lcdseg.seg_set"}, "libcoap.new": {"body": "libcoap.new(${1:code},${2:uri},${3:headers},${4:payload})", "description": "libcoap.new(code, uri, headers, payload) - \u521b\u5efa\u4e00\u4e2acoap\u6570\u636e\u5305\n\u4f20\u5165\u503c\uff1a\nint coap\u7684code, \u4f8b\u5982libcoap.GET/libcoap.POST/libcoap.PUT/libcoap.DELETE\nstring \u76ee\u6807URI,\u5fc5\u987b\u586b\u5199, \u4e0d\u9700\u8981\u52a0\u4e0a/\u5f00\u5934\ntable \u8bf7\u6c42\u5934,\u7c7b\u4f3c\u4e8ehttp\u7684headers,\u53ef\u9009\nstring \u8bf7\u6c42\u4f53,\u7c7b\u4f3c\u4e8ehttp\u7684body,\u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nuserdata coap\u6570\u636e\u5305\n\u4f8b\u5b50\uff1a\n-- \u521b\u5efa\u4e00\u4e2a\u8bf7\u6c42\u670d\u52a1\u5668time\u7684\u6570\u636e\u5305\nlocal coapdata = libcoap.new(libcoap.GET, \"time\")\nlocal data = coapdata:rawdata()\n", "prefix": "libcoap.new"}, "libcoap.parse": {"body": "libcoap.parse(${1:str})", "description": "libcoap.parse(str) - \u89e3\u6790coap\u6570\u636e\u5305\n\u4f20\u5165\u503c\uff1a\nstring coap\u6570\u636e\u5305\n\u8fd4\u56de\u503c\uff1a\nuserdata coap\u6570\u636e\u5305,\u5982\u679c\u89e3\u6790\u5931\u8d25\u4f1a\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u89e3\u6790\u670d\u52a1\u5668\u4f20\u5165\u7684\u6570\u636e\u5305\nlocal coapdata = libcoap.parse(indata)\nlog.info(\"coapdata\", coapdata:hcode(), coapdata:data())\n", "prefix": "libcoap.parse"}, "coapdata:msgid": {"body": "coapdata:msgid()", "description": "coapdata:msgid() - \u83b7\u53d6coap\u6570\u636e\u5305\u7684msgid\n\u8fd4\u56de\u503c\uff1a\nint coap\u6570\u636e\u5305\u7684msgid\n\u4f8b\u5b50\uff1a\n-- \u89e3\u6790\u670d\u52a1\u5668\u4f20\u5165\u7684\u6570\u636e\u5305\nlocal coapdata = libcoap.parse(indata)\nlog.info(\"coapdata\", coapdata:msgid())\n", "prefix": "coapdata:msgid"}, "coapdata:token": {"body": "coapdata:token()", "description": "coapdata:token() - \u83b7\u53d6coap\u6570\u636e\u5305\u7684token\n\u8fd4\u56de\u503c\uff1a\nstring coap\u6570\u636e\u5305\u7684token\n\u4f8b\u5b50\uff1a\n-- \u89e3\u6790\u670d\u52a1\u5668\u4f20\u5165\u7684\u6570\u636e\u5305\nlocal coapdata = libcoap.parse(indata)\nlog.info(\"coapdata\", coapdata:token())\n", "prefix": "coapdata:token"}, "coapdata:rawdata": {"body": "coapdata:rawdata()", "description": "coapdata:rawdata() - \u83b7\u53d6coap\u6570\u636e\u5305\u7684\u4e8c\u8fdb\u5236\u6570\u636e,\u7528\u4e8e\u53d1\u9001\u5230\u670d\u52a1\u5668\n\u8fd4\u56de\u503c\uff1a\nstring coap\u6570\u636e\u5305\u7684\u4e8c\u8fdb\u5236\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u89e3\u6790\u670d\u52a1\u5668\u4f20\u5165\u7684\u6570\u636e\u5305\nlocal coapdata = libcoap.new(libcoap.GET, \"time\")\nnetc:send(coapdata:rawdata())\n", "prefix": "coapdata:rawdata"}, "coapdata:code": {"body": "coapdata:code()", "description": "coapdata:code() - \u83b7\u53d6coap\u6570\u636e\u5305\u7684code\n\u8fd4\u56de\u503c\uff1a\nint coap\u6570\u636e\u5305\u7684code\n\u4f8b\u5b50\uff1a\n-- \u89e3\u6790\u670d\u52a1\u5668\u4f20\u5165\u7684\u6570\u636e\u5305\nlocal coapdata = libcoap.parse(indata)\nlog.info(\"coapdata\", coapdata:code())\n", "prefix": "coapdata:code"}, "coapdata:hcode": {"body": "coapdata:hcode()", "description": "coapdata:hcode() - \u83b7\u53d6coap\u6570\u636e\u5305\u7684http code, \u6bd4coap\u539f\u59cb\u7684code\u8981\u53cb\u597d\n\u8fd4\u56de\u503c\uff1a\nint coap\u6570\u636e\u5305\u7684http code,\u4f8b\u5982200,205,404\n\u4f8b\u5b50\uff1a\n-- \u89e3\u6790\u670d\u52a1\u5668\u4f20\u5165\u7684\u6570\u636e\u5305\nlocal coapdata = libcoap.parse(indata)\nlog.info(\"coapdata\", coapdata:hcode())\n", "prefix": "coapdata:hcode"}, "coapdata:type": {"body": "coapdata:type(${1:t})", "description": "coapdata:type(t) - \u83b7\u53d6coap\u6570\u636e\u5305\u7684type, \u4f8b\u5982libcoap.CON/NON/ACK/RST\n\u4f20\u5165\u503c\uff1a\nint \u65b0\u7684type\u503c,\u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nint coap\u6570\u636e\u5305\u7684type\n\u4f8b\u5b50\uff1a\n-- \u89e3\u6790\u670d\u52a1\u5668\u4f20\u5165\u7684\u6570\u636e\u5305\nlocal coapdata = libcoap.parse(indata)\nlog.info(\"coapdata\", coapdata:type())\n", "prefix": "coapdata:type"}, "coapdata:data": {"body": "coapdata:data()", "description": "coapdata:data() - \u83b7\u53d6coap\u6570\u636e\u5305\u7684data\n\u8fd4\u56de\u503c\uff1a\nstring coap\u6570\u636e\u5305\u7684data\n\u4f8b\u5b50\uff1a\n-- \u89e3\u6790\u670d\u52a1\u5668\u4f20\u5165\u7684\u6570\u636e\u5305\nlocal coapdata = libcoap.parse(indata)\nlog.info(\"coapdata\", coapdata:data())\n", "prefix": "coapdata:data"}, "libgnss.parse": {"body": "libgnss.parse(${1:str})", "description": "libgnss.parse(str) - \u5904\u7406nmea\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring \u539f\u59cbnmea\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u89e3\u6790nmea\u6570\u636e\nlibgnss.parse(indata)\nlog.info(\"nmea\", json.encode(libgnss.getRmc(), \"11g\"))\n", "prefix": "libgnss.parse"}, "libgnss.isFix": {"body": "libgnss.isFix()", "description": "libgnss.isFix() - \u5f53\u524d\u662f\u5426\u5df2\u7ecf\u5b9a\u4f4d\u6210\u529f\n\u8fd4\u56de\u503c\uff1a\nboolean \u5b9a\u4f4d\u6210\u529f\u4e0e\u5426\n\u4f8b\u5b50\uff1a\nlog.info(\"nmea\", \"isFix\", libgnss.isFix())\n", "prefix": "libgnss.isFix"}, "libgnss.getIntLocation": {"body": "libgnss.getIntLocation(${1:speed_type})", "description": "libgnss.getIntLocation(speed_type) - \u83b7\u53d6\u4f4d\u7f6e\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nint \u901f\u5ea6\u5355\u4f4d,\u9ed8\u8ba4\u662fm/h\n\u8fd4\u56de\u503c\uff1a\nint lat\u6570\u636e, \u683c\u5f0f\u4e3a ddddddddd\nint lng\u6570\u636e, \u683c\u5f0f\u4e3a ddddddddd\nint speed\u6570\u636e, \u5355\u4f4d\u7c73. \u4e8e2023.9.26\u4fee\u6b63\n\u4f8b\u5b50\uff1a\n-- \u5efa\u8bae\u7528libgnss.getRmc(1)\nlog.info(\"nmea\", \"loc\", libgnss.getIntLocation())\n\n-- 2023.12.11 \u65b0\u589espeed_type\u53c2\u6570\n--[[\n\u901f\u5ea6\u5355\u4f4d\u53ef\u9009\u503c\n0 - m/h \u7c73/\u5c0f\u65f6, \u9ed8\u8ba4\u503c, \u6574\u578b\n1 - m/s \u7c73/\u79d2, \u6d6e\u70b9\u6570\n2 - km/h \u5343\u7c73/\u5c0f\u65f6, \u6d6e\u70b9\u6570\n3 - kn/h \u82f1\u91cc/\u5c0f\u65f6, \u6d6e\u70b9\u6570\n]]\n-- \u9ed8\u8ba4 \u7c73/\u5c0f\u65f6\nlog.info(\"nmea\", \"loc\", libgnss.getIntLocation())\n-- \u7c73/\u79d2\nlog.info(\"nmea\", \"loc\", libgnss.getIntLocation(1))\n-- \u5343\u7c73/\u5c0f\u65f6\nlog.info(\"nmea\", \"loc\", libgnss.getIntLocation(2))\n-- \u82f1\u91cc/\u5c0f\u65f6\nlog.info(\"nmea\", \"loc\", libgnss.getIntLocation(3))\n", "prefix": "libgnss.getIntLocation"}, "libgnss.getRmc": {"body": "libgnss.getRmc(${1:data_mode})", "description": "libgnss.getRmc(data_mode) - \u83b7\u53d6\u539f\u59cbRMC\u4f4d\u7f6e\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nint \u5750\u6807\u7c7b\u6570\u636e\u7684\u683c\u5f0f, 0-DDMM.MMM\u683c\u5f0f, 1-DDDDDDD\u683c\u5f0f, 2-DD.DDDDD\u683c\u5f0f, 3-\u539f\u59cbRMC\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\ntable \u539f\u59cbrmc\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u89e3\u6790nmea\nlog.info(\"nmea\", \"rmc\", json.encode(libgnss.getRmc(2)))\n-- \u5b9e\u4f8b\u8f93\u51fa\n--[[\n{\n \"course\":0,\n \"valid\":true, // true\u5b9a\u4f4d\u6210\u529f,false\u5b9a\u4f4d\u4e22\u5931\n \"lat\":23.4067, // \u7eac\u5ea6, \u6b63\u6570\u4e3a\u5317\u7eac, \u8d1f\u6570\u4e3a\u5357\u7eac\n \"lng\":113.231, // \u7ecf\u5ea6, \u6b63\u6570\u4e3a\u4e1c\u7ecf, \u8d1f\u6570\u4e3a\u897f\u7ecf\n \"variation\":0, // \u5730\u9762\u822a\u5411\uff0c\u5355\u4f4d\u4e3a\u5ea6\uff0c\u4ece\u5317\u5411\u8d77\u987a\u65f6\u9488\u8ba1\u7b97\n \"speed\":0 // \u5730\u9762\u901f\u5ea6, \u5355\u4f4d\u4e3a\"\u8282\"\n \"year\":2023, // \u5e74\u4efd\n \"month\":1, // \u6708\u4efd, 1-12\n \"day\":5, // \u6708\u4efd\u5929, 1-31\n \"hour\":7, // \u5c0f\u65f6,0-23\n \"min\":23, // \u5206\u949f,0-59\n \"sec\":20, // \u79d2,0-59\n}\n]]\n", "prefix": "libgnss.getRmc"}, "libgnss.getGsv": {"body": "libgnss.getGsv()", "description": "libgnss.getGsv() - \u83b7\u53d6\u539f\u59cbGSV\u4fe1\u606f\n\u8fd4\u56de\u503c\uff1a\ntable \u539f\u59cbGSV\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u89e3\u6790nmea\nlog.info(\"nmea\", \"gsv\", json.encode(libgnss.getGsv()))\n--[[\u5b9e\u4f8b\u8f93\u51fa\n{\n \"total_sats\":24, // \u603b\u53ef\u89c1\u536b\u661f\u6570\u91cf\n \"sats\":[\n {\n \"snr\":27, // \u4fe1\u566a\u6bd4\n \"azimuth\":278, // \u65b9\u5411\u89d2\n \"elevation\":59, // \u4ef0\u89d2\n \"tp\":0, // 0 - GPS, 1 - BD\n \"nr\":4 // \u536b\u661f\u7f16\u53f7\n },\n // \u8fd9\u91cc\u5ffd\u7565\u4e8622\u4e2a\u536b\u661f\u7684\u4fe1\u606f\n {\n \"snr\":0,\n \"azimuth\":107,\n \"elevation\":19,\n \"tp\":1,\n \"nr\":31\n }\n ]\n}\n]]\n", "prefix": "libgnss.getGsv"}, "libgnss.getGsa": {"body": "libgnss.getGsa(${1:data_mode})", "description": "libgnss.getGsa(data_mode) - \u83b7\u53d6\u539f\u59cbGSA\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nint \u6a21\u5f0f\n\u8fd4\u56de\u503c\uff1a\ntable \u539f\u59cbGSA\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u83b7\u53d6\nlog.info(\"nmea\", \"gsa\", json.encode(libgnss.getGsa(), \"11g\"))\n-- \u793a\u4f8b\u6570\u636e(\u6a21\u5f0f0, \u4e5f\u5c31\u662f\u9ed8\u8ba4\u6a21\u5f0f)\n--[[\n{\n \"sats\":[ // \u6b63\u5728\u4f7f\u7528\u7684\u536b\u661f\u7f16\u53f7\n 9,\n 6,\n 16,\n 16,\n 26,\n 21,\n 27,\n 27,\n 4,\n 36,\n 3,\n 7,\n 8,\n 194\n ],\n \"vdop\":0.03083333, // \u5782\u76f4\u7cbe\u5ea6\u56e0\u5b50\uff0c0.00 - 99.99\uff0c\u4e0d\u5b9a\u4f4d\u65f6\u503c\u4e3a 99.99\n \"pdop\":0.0455, // \u6c34\u5e73\u7cbe\u5ea6\u56e0\u5b50\uff0c0.00 - 99.99\uff0c\u4e0d\u5b9a\u4f4d\u65f6\u503c\u4e3a 99.99\n \"fix_type\":3, // \u5b9a\u4f4d\u6a21\u5f0f, 1-\u672a\u5b9a\u4f4d, 2-2D\u5b9a\u4f4d, 3-3D\u5b9a\u4f4d\n \"hdop\":0.0335 // \u4f4d\u7f6e\u7cbe\u5ea6\u56e0\u5b50\uff0c0.00 - 99.99\uff0c\u4e0d\u5b9a\u4f4d\u65f6\u503c\u4e3a 99.99\n}\n]]\n\n-- \u793a\u4f8b\u6570\u636e(\u6a21\u5f0f1), 2024.5.26\u65b0\u589e\n[\n {\"pdop\":7.8299999,\"sats\":[13,15,18,23],\"vdop\":3.2400000,\"hdop\":7.1300001,\"fix_type\":3},\n {\"pdop\":7.8299999,\"sats\":[20,35,8,13],\"vdop\":3.2400000,\"hdop\":7.1300001,\"fix_type\":3}\n]\n", "prefix": "libgnss.getGsa"}, "libgnss.getVtg": {"body": "libgnss.getVtg(${1:data_mode})", "description": "libgnss.getVtg(data_mode) - \u83b7\u53d6VTA\u901f\u5ea6\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nint \u53ef\u9009, 3-\u539f\u59cb\u5b57\u7b26\u4e32, \u4e0d\u4f20\u6216\u8005\u4f20\u5176\u4ed6\u503c, \u5219\u8fd4\u56de\u6d6e\u70b9\u503c\n\u8fd4\u56de\u503c\uff1a\ntable \u539f\u59cbVTA\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u89e3\u6790nmea\nlog.info(\"nmea\", \"vtg\", json.encode(libgnss.getVtg()))\n-- \u793a\u4f8b\n--[[\n{\n \"speed_knots\":0, // \u901f\u5ea6, \u82f1\u91cc/\u5c0f\u65f6\n \"true_track_degrees\":0, // \u771f\u5317\u65b9\u5411\u89d2\n \"magnetic_track_degrees\":0, // \u78c1\u5317\u65b9\u5411\u89d2\n \"speed_kph\":0 // \u901f\u5ea6, \u5343\u7c73/\u5c0f\u65f6\n}\n-- \u63d0\u9192: Air780EG\u548cAir510U,\u5728\u901f\u5ea6<5km/h\u65f6, \u4e0d\u4f1a\u8fd4\u56de\u65b9\u5411\u89d2\n]]\n", "prefix": "libgnss.getVtg"}, "libgnss.getZda": {"body": "libgnss.getZda()", "description": "libgnss.getZda() - \u83b7\u53d6\u539f\u59cbZDA\u65f6\u95f4\u548c\u65e5\u671f\u4fe1\u606f\n\u8fd4\u56de\u503c\uff1a\ntable \u539f\u59cbzda\u6570\u636e\n\u4f8b\u5b50\uff1a\nlog.info(\"nmea\", \"zda\", json.encode(libgnss.getZda()))\n-- \u5b9e\u4f8b\u8f93\u51fa\n--[[\n{\n \"minute_offset\":0, // \u672c\u5730\u65f6\u533a\u7684\u5206\u949f, \u4e00\u822c\u56fa\u5b9a\u8f93\u51fa0\n \"hour_offset\":0, // \u672c\u5730\u65f6\u533a\u7684\u5c0f\u65f6, \u4e00\u822c\u56fa\u5b9a\u8f93\u51fa0\n \"year\":2023 // UTC \u5e74\uff0c\u56db\u4f4d\u6570\u5b57\n \"month\":1, // UTC \u6708\uff0c\u4e24\u4f4d\uff0c01 ~ 12\n \"day\":5, // UTC \u65e5\uff0c\u4e24\u4f4d\u6570\u5b57\uff0c01 ~ 31\n \"hour\":7, // \u5c0f\u65f6\n \"min\":50, // \u5206\n \"sec\":14, // \u79d2\n}\n]]\n", "prefix": "libgnss.getZda"}, "libgnss.debug": {"body": "libgnss.debug(${1:mode})", "description": "libgnss.debug(mode) - \u8bbe\u7f6e\u8c03\u8bd5\u6a21\u5f0f\n\u4f20\u5165\u503c\uff1a\nbool true\u5f00\u542f\u8c03\u8bd5,false\u5173\u95ed\u8c03\u8bd5,\u9ed8\u8ba4\u4e3afalse\n\u4f8b\u5b50\uff1a\n-- \u5f00\u542f\u8c03\u8bd5, \u4f1a\u8f93\u51faGNSS\u539f\u59cb\u6570\u636e\u5230\u65e5\u5fd7\u4e2d\nlibgnss.debug(true)\n-- \u5173\u95ed\u8c03\u8bd5\nlibgnss.debug(false)\n", "prefix": "libgnss.debug"}, "libgnss.getGga": {"body": "libgnss.getGga(${1:data_mode})", "description": "libgnss.getGga(data_mode) - \u83b7\u53d6GGA\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u5750\u6807\u7c7b\u6570\u636e\u7684\u683c\u5f0f, 0-DDMM.MMM\u683c\u5f0f, 1-DDDDDDD\u683c\u5f0f, 2-DD.DDDDD\u683c\u5f0f, 3-\u539f\u59cb\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\ntable GGA\u6570\u636e, \u82e5\u5982\u4e0d\u5b58\u5728\u4f1a\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nlocal gga = libgnss.getGga(2)\nif gga then\n log.info(\"GGA\", json.encode(gga, \"11g\"))\nend\n--\u5b9e\u4f8b\u8f93\u51fa\n--[[\n{\n \"dgps_age\":0, // \u5dee\u5206\u6821\u6b63\u65f6\u5ef6\uff0c\u5355\u4f4d\u4e3a\u79d2\n \"fix_quality\":1, // \u5b9a\u4f4d\u72b6\u6001\u6807\u8bc6 0 - \u65e0\u6548,1 - \u5355\u70b9\u5b9a\u4f4d,2 - \u5dee\u5206\u5b9a\u4f4d\n \"satellites_tracked\":14, // \u53c2\u4e0e\u5b9a\u4f4d\u7684\u536b\u661f\u6570\u91cf\n \"altitude\":0.255, // \u6d77\u5e73\u9762\u5206\u79bb\u5ea6, \u6216\u8005\u6210\u4e3a\u6d77\u62d4, \u5355\u4f4d\u662f\u7c73,\n \"hdop\":0.0335, // \u6c34\u5e73\u7cbe\u5ea6\u56e0\u5b50\uff0c0.00 - 99.99\uff0c\u4e0d\u5b9a\u4f4d\u65f6\u503c\u4e3a 99.99\n \"longitude\":113.231, // \u7ecf\u5ea6, \u6b63\u6570\u4e3a\u4e1c\u7ecf, \u8d1f\u6570\u4e3a\u897f\u7ecf\n \"latitude\":23.4067, // \u7eac\u5ea6, \u6b63\u6570\u4e3a\u5317\u7eac, \u8d1f\u6570\u4e3a\u5357\u7eac\n \"height\":0 // \u692d\u7403\u9ad8\uff0c\u56fa\u5b9a\u8f93\u51fa 1 \u4f4d\u5c0f\u6570\n}\n]]\n", "prefix": "libgnss.getGga"}, "libgnss.getGll": {"body": "libgnss.getGll(${1:data_mode})", "description": "libgnss.getGll(data_mode) - \u83b7\u53d6GLL\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u5750\u6807\u7c7b\u6570\u636e\u7684\u683c\u5f0f, 0-DDMM.MMM\u683c\u5f0f, 1-DDDDDDD\u683c\u5f0f, 2-DD.DDDDD\u683c\u5f0f\n\u8fd4\u56de\u503c\uff1a\ntable GLL\u6570\u636e, \u82e5\u5982\u4e0d\u5b58\u5728\u4f1a\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nlocal gll = libgnss.getGll(2)\nif gll then\n log.info(\"GLL\", json.encode(gll, \"11g\"))\nend\n-- \u5b9e\u4f8b\u6570\u636e\n--[[\n{\n \"status\":\"A\", // \u5b9a\u4f4d\u72b6\u6001, A\u6709\u6548, B\u65e0\u6548\n \"mode\":\"A\", // \u5b9a\u4f4d\u6a21\u5f0f, V\u65e0\u6548, A\u5355\u70b9\u89e3, D\u5dee\u5206\u89e3\n \"sec\":20, // \u79d2, UTC\u65f6\u95f4\u4e3a\u51c6\n \"min\":23, // \u5206\u949f, UTC\u65f6\u95f4\u4e3a\u51c6\n \"hour\":7, // \u5c0f\u65f6, UTC\u65f6\u95f4\u4e3a\u51c6\n \"longitude\":113.231, // \u7ecf\u5ea6, \u6b63\u6570\u4e3a\u4e1c\u7ecf, \u8d1f\u6570\u4e3a\u897f\u7ecf\n \"latitude\":23.4067, // \u7eac\u5ea6, \u6b63\u6570\u4e3a\u5317\u7eac, \u8d1f\u6570\u4e3a\u5357\u7eac\n \"us\":0 // \u5fae\u5999\u6570, \u901a\u5e38\u4e3a0\n}\n]]\n", "prefix": "libgnss.getGll"}, "libgnss.clear": {"body": "libgnss.clear()", "description": "libgnss.clear() - \u6e05\u9664\u5386\u53f2\u5b9a\u4f4d\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u8be5\u64cd\u4f5c\u4f1a\u6e05\u9664\u6240\u6709\u5b9a\u4f4d\u6570\u636e\n", "prefix": "libgnss.clear"}, "libgnss.bind": {"body": "libgnss.bind(${1:id},${2:next_id})", "description": "libgnss.bind(id, next_id) - \u7ed1\u5b9auart\u7aef\u53e3\u8fdb\u884cGNSS\u6570\u636e\u8bfb\u53d6\n\u4f20\u5165\u503c\uff1a\nint uart\u7aef\u53e3\u53f7\nint \u8f6c\u53d1\u5230uart\u7684id, \u4f8b\u5982\u865a\u62dfuart.VUART_0\n\u4f8b\u5b50\uff1a\n-- \u914d\u7f6e\u4e32\u53e3\u4fe1\u606f, \u901a\u5e38\u4e3a 115200 8N1\nuart.setup(2, 115200)\n-- \u7ed1\u5b9auart, \u9a6c\u4e0a\u5f00\u59cb\u89e3\u6790GNSS\u6570\u636e\nlibgnss.bind(2)\n-- \u65e0\u9700\u518d\u8c03\u7528uart.on\u7136\u540e\u8c03\u7528libgnss.parse\n-- \u5f00\u53d1\u671f\u53ef\u6253\u5f00\u8c03\u8bd5\u65e5\u5fd7\nlibgnss.debug(true)\n\n-- 2023-01-02\u4e4b\u540e\u7f16\u8bd1\u7684\u56fa\u4ef6\u6709\u6548\n-- \u4eceuart2\u8bfb\u53d6\u5e76\u89e3\u6790, \u540c\u65f6\u8f6c\u53d1\u5230\u865a\u62df\u4e32\u53e30\nlibgnss.bind(2, uart.VUART_0)\n", "prefix": "libgnss.bind"}, "libgnss.locStr": {"body": "libgnss.locStr(${1:mode})", "description": "libgnss.locStr(mode) - \u83b7\u53d6\u4f4d\u7f6e\u5b57\u7b26\u4e32\n\u4f20\u5165\u503c\uff1a\nint \u5b57\u7b26\u4e32\u6a21\u5f0f. 0- Air780EG\u6240\u9700\u7684\u683c\u5f0f\nreturn \u6307\u5b9a\u6a21\u5f0f\u7684\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u4ec5\u63a8\u8350\u5728\u5b9a\u4f4d\u6210\u529f\u540e\u8c03\u7528\n", "prefix": "libgnss.locStr"}, "libgnss.rtcAuto": {"body": "libgnss.rtcAuto(${1:enable})", "description": "libgnss.rtcAuto(enable) - \u5b9a\u4f4d\u6210\u529f\u540e\u81ea\u52a8\u8bbe\u7f6eRTC\n\u4f20\u5165\u503c\uff1a\nbool \u5f00\u542f\u4e0e\u5426, \u9ed8\u8ba4\u662ffalse\u5173\u95ed\n\u4f8b\u5b50\uff1a\n-- \u5f00\u542f\u81ea\u52a8\u8bbe\u7f6eRTC\nlibgnss.rtcAuto(true)\n", "prefix": "libgnss.rtcAuto"}, "libgnss.on": {"body": "libgnss.on(${1:tp},${2:fn})", "description": "libgnss.on(tp, fn) - \u5e95\u5c42\u4e8b\u4ef6\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nstring \u4e8b\u4ef6\u7c7b\u578b,\u5f53\u524d\u652f\u6301\"raw\"\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u4e00\u822c\u7528\u4e8e\u8c03\u8bd5, \u7528\u4e8e\u83b7\u53d6\u5e95\u5c42\u5b9e\u9645\u6536\u5230\u7684\u6570\u636e\nlibgnss.on(\"raw\", function(data)\n log.info(\"GNSS\", data)\nend)\n", "prefix": "libgnss.on"}, "libgnss.getTxt": {"body": "libgnss.getTxt()", "description": "libgnss.getTxt() - \u83b7\u53d6\u975e\u6807\u7684GPTXT\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nreturn GPTXT\u6240\u643a\u5e26\u7684\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u4e8e2023.6.6 \u6dfb\u52a0\nlog.info(\"gnss\", \"txt\", libgnss.getTxt())\n\n-- \u6d4b\u8bd5\u8bed\u53e5\nlibgnss.parse(\"$GPTXT,01,01,01,ANTENNA SHORT*63\\r\\n\")\nlog.info(\"GNSS\", libgnss.getTxt())\nlibgnss.parse(\"$GPTXT,01,01,01,ANTENNA OPEN*25\\r\\n\")\nlog.info(\"GNSS\", libgnss.getTxt())\nlibgnss.parse(\"$GPTXT,01,01,01,ANTENNA OK*35\\r\\n\")\nlog.info(\"GNSS\", libgnss.getTxt())\n", "prefix": "libgnss.getTxt"}, "libgnss.casic_aid": {"body": "libgnss.casic_aid(${1:dt},${2:loc})", "description": "libgnss.casic_aid(dt, loc) - \u5408\u6210Air530Z\u6240\u9700\u8981\u7684\u8f85\u52a9\u5b9a\u4f4d\u6570\u636e\n\u4f20\u5165\u503c\uff1a\ntable \u65f6\u95f4\u4fe1\u606f\ntable \u7ecf\u7eac\u5ea6\u53ca\u6d77\u62d4\n\u8fd4\u56de\u503c\uff1a\nstring \u8f85\u52a9\u5b9a\u4f4d\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u9002\u5408CASIC\u7cfb\u5217GNSS\u6a21\u5757\u7684\u8f85\u52a9\u5b9a\u4f4d\u4fe1\u606f\u7684\u5408\u6210\n-- \u672c\u51fd\u6570 2023.11.14 \u65b0\u589e\n\n-- \u9996\u5148\u662f\u65f6\u95f4\u4fe1\u606f,\u6ce8\u610f\u662fUTC\u65f6\u95f4\n-- \u65f6\u95f4\u6765\u6e90\u5f88\u591a, \u4e00\u822c\u5efa\u8baesocket.sntp()\u65f6\u95f4\u540c\u6b65\u540e\u7684\u7cfb\u7edf\u65f6\u95f4\nlocal dt = os.date(\"!*t\")\n\n-- \u7136\u540e\u662f\u8f85\u52a9\u5b9a\u4f4d\u5750\u6807\n-- \u6765\u6e90\u6709\u5f88\u591a\u65b9\u5f0f:\n-- 1. \u4ece\u5386\u53f2\u5b9a\u4f4d\u6570\u636e\u5f97\u5230, \u4f8b\u5982\u4e4b\u524d\u5b9a\u4f4d\u6210\u529f\u540e\u4fdd\u5b58\u5230\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e86\n-- 2. \u901a\u8fc7\u57fa\u7ad9\u5b9a\u4f4d\u6216\u8005wifi\u5b9a\u4f4d\u83b7\u53d6\u5230\n-- 3. \u901a\u8fc7IP\u5b9a\u4f4d\u83b7\u53d6\u5230\u5927\u6982\u5750\u6807\n-- \u5750\u6807\u7cfb\u662fWGS84, \u4f46\u9274\u4e8e\u662f\u8f85\u52a9\u5b9a\u4f4d,\u7cbe\u5ea6\u4e0d\u662f\u5173\u952e\u56e0\u7d20\nlocal lla = {\n lat = 23.12,\n lng = 114.12\n}\n\nlocal aid = libgnss.casic_aid(dt, lla)\n", "prefix": "libgnss.casic_aid"}, "lf.init": {"body": "lf.init(${1:spi_device})", "description": "lf.init(spi_device) - \u521d\u59cb\u5316 little_flash\n\u4f20\u5165\u503c\uff1a\nint userdata spi_device\n\u8fd4\u56de\u503c\uff1a\nuserdata \u6210\u529f\u8fd4\u56de\u4e00\u4e2a\u6570\u636e\u7ed3\u6784,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n--spi_device\nspi_device = spi.deviceSetup(0,17,0,0,8,2000000,spi.MSB,1,0)\nlog.info(\"lf.init\",lf.init(spi_device))\n", "prefix": "lf.init"}, "lf.mount": {"body": "lf.mount(${1:flash},${2:mount_point},${3:offset},${4:maxsize})", "description": "lf.mount(flash, mount_point, offset, maxsize) - \u6302\u8f7d little_flash lfs\u6587\u4ef6\u7cfb\u7edf\n\u4f20\u5165\u503c\uff1a\nuserdata flash Flash \u8bbe\u5907\u5bf9\u8c61 lf.init()\u8fd4\u56de\u7684\u6570\u636e\u7ed3\u6784\nstring mount_point \u6302\u8f7d\u76ee\u5f55\u540d\nint \u8d77\u59cb\u504f\u79fb\u91cf,\u9ed8\u8ba40\nint \u603b\u5927\u5c0f, \u9ed8\u8ba4\u662f\u6574\u4e2aflash\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue\n\u4f8b\u5b50\uff1a\nlog.info(\"lf.mount\",lf.mount(little_flash_device,\"/little_flash\"))\n", "prefix": "lf.mount"}, "log.setLevel": {"body": "log.setLevel(${1:level})", "description": "log.setLevel(level) - \u8bbe\u7f6e\u65e5\u5fd7\u7ea7\u522b\n\u4f20\u5165\u503c\uff1a\nstring level \u65e5\u5fd7\u7ea7\u522b,\u53ef\u7528\u5b57\u7b26\u4e32\u6216\u6570\u503c, \u5b57\u7b26\u4e32\u4e3a(SILENT,DEBUG,INFO,WARN,ERROR,FATAL), \u6570\u503c\u4e3a(0,1,2,3,4,5)\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u8bbe\u7f6e\u65e5\u5fd7\u7ea7\u522b\u4e3aINFO\nlog.setLevel(\"INFO\")\n", "prefix": "log.setLevel"}, "log.style": {"body": "log.style(${1:val})", "description": "log.style(val) - \u8bbe\u7f6e\u65e5\u5fd7\u98ce\u683c\n\u4f20\u5165\u503c\uff1a\nint \u65e5\u5fd7\u98ce\u683c,\u9ed8\u8ba4\u4e3a0, \u4e0d\u4f20\u5c31\u662f\u83b7\u53d6\u5f53\u524d\u503c\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524d\u7684\u65e5\u5fd7\u98ce\u683c\n\u4f8b\u5b50\uff1a\n-- \u4ee5 log.info(\"ABC\", \"DEF\", 123) \u4e3a\u4f8b, \u5047\u8bbe\u8be5\u4ee3\u7801\u4f4d\u4e8emain.lua\u768412\u884c\n-- \u9ed8\u8ba4\u65e5\u5fd70\n-- I/user.ABC DEF 123\n-- \u8c03\u8bd5\u98ce\u683c1, \u6dfb\u52a0\u989d\u5916\u7684\u8c03\u8bd5\u4fe1\u606f\n-- I/main.lua:12 ABC DEF 123\n-- \u8c03\u8bd5\u98ce\u683c2, \u6dfb\u52a0\u989d\u5916\u7684\u8c03\u8bd5\u4fe1\u606f, \u4f4d\u7f6e\u6709\u6240\u533a\u522b\n-- I/user.ABC main.lua:12 DEF 123\n\nlog.style(0) -- \u9ed8\u8ba4\u98ce\u683c0\nlog.style(1) -- \u8c03\u8bd5\u98ce\u683c1\nlog.style(2) -- \u8c03\u8bd5\u98ce\u683c2\n", "prefix": "log.style"}, "log.getLevel": {"body": "log.getLevel()", "description": "log.getLevel() - \u83b7\u53d6\u65e5\u5fd7\u7ea7\u522b\n\u8fd4\u56de\u503c\uff1a\nint \u65e5\u5fd7\u7ea7\u522b\u5bf9\u5e940,1,2,3,4,5\n\u4f8b\u5b50\uff1a\n-- \u5f97\u5230\u65e5\u5fd7\u7ea7\u522b\nlog.getLevel()\n", "prefix": "log.getLevel"}, "log.debug": {"body": "log.debug(${1:tag},${2:val},${3:val2},${4:val3},${5:...})", "description": "log.debug(tag, val, val2, val3, ...) - \u8f93\u51fa\u65e5\u5fd7,\u7ea7\u522bdebug\n\u4f20\u5165\u503c\uff1a\nstring tag \u65e5\u5fd7\u6807\u8bc6,\u5fc5\u987b\u662f\u5b57\u7b26\u4e32\n... \u9700\u6253\u5370\u7684\u53c2\u6570\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u65e5\u5fd7\u8f93\u51fa D/onenet connect ok\nlog.debug(\"onenet\", \"connect ok\")\n", "prefix": "log.debug"}, "log.info": {"body": "log.info(${1:tag},${2:val},${3:val2},${4:val3},${5:...})", "description": "log.info(tag, val, val2, val3, ...) - \u8f93\u51fa\u65e5\u5fd7,\u7ea7\u522binfo\n\u4f20\u5165\u503c\uff1a\nstring tag \u65e5\u5fd7\u6807\u8bc6,\u5fc5\u987b\u662f\u5b57\u7b26\u4e32\n... \u9700\u6253\u5370\u7684\u53c2\u6570\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u65e5\u5fd7\u8f93\u51fa I/onenet connect ok\nlog.info(\"onenet\", \"connect ok\")\n", "prefix": "log.info"}, "log.warn": {"body": "log.warn(${1:tag},${2:val},${3:val2},${4:val3},${5:...})", "description": "log.warn(tag, val, val2, val3, ...) - \u8f93\u51fa\u65e5\u5fd7,\u7ea7\u522bwarn\n\u4f20\u5165\u503c\uff1a\nstring tag \u65e5\u5fd7\u6807\u8bc6,\u5fc5\u987b\u662f\u5b57\u7b26\u4e32\n... \u9700\u6253\u5370\u7684\u53c2\u6570\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u65e5\u5fd7\u8f93\u51fa W/onenet connect ok\nlog.warn(\"onenet\", \"connect ok\")\n", "prefix": "log.warn"}, "log.error": {"body": "log.error(${1:tag},${2:val},${3:val2},${4:val3},${5:...})", "description": "log.error(tag, val, val2, val3, ...) - \u8f93\u51fa\u65e5\u5fd7,\u7ea7\u522berror\n\u4f20\u5165\u503c\uff1a\nstring tag \u65e5\u5fd7\u6807\u8bc6,\u5fc5\u987b\u662f\u5b57\u7b26\u4e32\n... \u9700\u6253\u5370\u7684\u53c2\u6570\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u65e5\u5fd7\u8f93\u51fa E/onenet connect ok\nlog.error(\"onenet\", \"connect ok\")\n", "prefix": "log.error"}, "lora.init": {"body": "lora.init(${1:ic},${2:loraconfig},${3:spiconfig})", "description": "lora.init(ic, loraconfig,spiconfig) - lora\u521d\u59cb\u5316\n\u4f20\u5165\u503c\uff1a\nstring lora \u578b\u53f7\uff0c\u5f53\u524d\u652f\u6301\uff1a
llcc68
sx1268\ntable lora\u914d\u7f6e\u53c2\u6570,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173\n\u4f8b\u5b50\uff1a\nlora.init(\"llcc68\",\n {\n id = 0, -- SPI id\n cs = pin.PB04, -- SPI \u7247\u9009\u7684GPIO\u53f7,\u5982\u679c\u6ca1\u6709pin\u5e93,\u586bGPIO\u6570\u5b57\u7f16\u53f7\u5c31\u884c\n res = pin.PB00, -- \u590d\u4f4d\u811a\u8fde\u63a5\u7684GPIO\u53f7,\u5982\u679c\u6ca1\u6709pin\u5e93,\u586bGPIO\u6570\u5b57\u7f16\u53f7\u5c31\u884c\n busy = pin.PB01, -- \u5fd9\u68c0\u6d4b\u811a\u7684GPIO\u53f7\n dio1 = pin.PB06, -- \u6570\u636e\u8f93\u5165\u4e2d\u65ad\u811a\n lora_init = true -- \u662f\u5426\u53d1\u9001\u521d\u59cb\u5316\u547d\u4ee4. \u5982\u679c\u662f\u5524\u9192\u540e\u76f4\u63a5\u8bfb\u53d6, \u5c31\u4f20false\n }\n)\n", "prefix": "lora.init"}, "lora.set_channel": {"body": "lora.set_channel(${1:freq})", "description": "lora.set_channel(freq) - \u8bbe\u7f6e\u9891\u9053\u9891\u7387\n\u4f20\u5165\u503c\uff1a\nnumber \u9891\u7387\n\u4f8b\u5b50\uff1a\nlora.set_channel(433000000)\n", "prefix": "lora.set_channel"}, "lora.set_txconfig": {"body": "lora.set_txconfig(${1:ic},${2:txconfig})", "description": "lora.set_txconfig(ic, txconfig) - lora\u914d\u7f6e\u53d1\u9001\u53c2\u6570\n\u4f20\u5165\u503c\uff1a\nstring lora \u578b\u53f7\uff0c\u5f53\u524d\u652f\u6301\uff1a
llcc68
sx1268\ntable lora\u53d1\u9001\u914d\u7f6e\u53c2\u6570,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173\n\u4f8b\u5b50\uff1a\nlora.set_txconfig(\"llcc68\",\n {\n mode=1,\n power=22,\n fdev=0,\n bandwidth=0,\n datarate=9,\n coderate=4,\n preambleLen=8,\n fixLen=false,\n crcOn=true,\n freqHopOn=0,\n hopPeriod=0,\n iqInverted=false,\n timeout=3000\n }\n)\n", "prefix": "lora.set_txconfig"}, "lora.set_rxconfig": {"body": "lora.set_rxconfig(${1:ic},${2:set_rxconfig})", "description": "lora.set_rxconfig(ic, set_rxconfig) - lora\u914d\u7f6e\u63a5\u6536\u53c2\u6570\n\u4f20\u5165\u503c\uff1a\nstring lora \u578b\u53f7\uff0c\u5f53\u524d\u652f\u6301\uff1a
llcc68
sx1268\ntable lora\u63a5\u6536\u914d\u7f6e\u53c2\u6570,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173\n\u4f8b\u5b50\uff1a\nlora.set_rxconfig(\"llcc68\",\n {\n mode=1,\n bandwidth=0,\n datarate=9,\n coderate=4,\n bandwidthAfc=0,\n preambleLen=8,\n symbTimeout=0,\n fixLen=false,\n payloadLen=0,\n crcOn=true,\n freqHopOn=0,\n hopPeriod=0,\n iqInverted=false,\n rxContinuous=false\n }\n)\n", "prefix": "lora.set_rxconfig"}, "lora.send": {"body": "lora.send(${1:data})", "description": "lora.send(data) - \u53d1\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring \u5199\u5165\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\nlora.send(\"PING\")\n", "prefix": "lora.send"}, "lora.recv": {"body": "lora.recv(${1:timeout})", "description": "lora.recv(timeout) - \u5f00\u542f\u6536\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nnumber \u8d85\u65f6\u65f6\u95f4\uff0c\u9ed8\u8ba41000 \u5355\u4f4dms\n\u4f8b\u5b50\uff1a\nsys.subscribe(\"LORA_RX_DONE\", function(data, size)\n log.info(\"LORA_RX_DONE: \", data, size)\n lora.send(\"PING\")\nend)\n-- \u8001\u7248\u672c\u6ca1\u6709recv, \u53ef\u4ee5\u6539\u6210 lora.recive\nlora.recv(1000)\n", "prefix": "lora.recv"}, "lora.mode": {"body": "lora.mode(${1:mode})", "description": "lora.mode(mode) - \u8bbe\u7f6e\u8fdb\u5165\u6a21\u5f0f(\u4f11\u7720\uff0c\u6b63\u5e38\u7b49)\n\u4f20\u5165\u503c\uff1a\nnumber \u6a21\u5f0f \u6b63\u5e38\u6a21\u5f0f:lora.STANDBY \u4f11\u7720\u6a21\u5f0f:lora.SLEEP \u9ed8\u8ba4\u4e3a\u6b63\u5e38\u6a21\u5f0f\n\u4f8b\u5b50\uff1a\nlora.mode(lora.STANDBY)\n", "prefix": "lora.mode"}, "lora2.init": {"body": "lora2.init(${1:ic},${2:loraconfig},${3:spiconfig})", "description": "lora2.init(ic, loraconfig,spiconfig) - lora\u521d\u59cb\u5316\n\u4f20\u5165\u503c\uff1a\nstring lora \u578b\u53f7\uff0c\u5f53\u524d\u652f\u6301\uff1a
llcc68
sx1268\ntable lora\u914d\u7f6e\u53c2\u6570,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173\n\u8fd4\u56de\u503c\uff1a\nuserdata \u82e5\u6210\u529f\u4f1a\u8fd4\u56delora\u5bf9\u8c61,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nspi_lora = spi.deviceSetup(spi_id,pin_cs,0,0,8,10*1000*1000,spi.MSB,1,0)\nlora_device = lora2.init(\"llcc68\",{res = pin_reset,busy = pin_busy,dio1 = pin_dio1},spi_lora)\n", "prefix": "lora2.init"}, "lora_device:set_channel": {"body": "lora_device:set_channel(${1:freq})", "description": "lora_device:set_channel(freq) - \u8bbe\u7f6e\u9891\u9053\u9891\u7387\n\u4f20\u5165\u503c\uff1a\nnumber \u9891\u7387\n\u4f8b\u5b50\uff1a\nlora_device:set_channel(433000000)\n", "prefix": "lora_device:set_channel"}, "lora_device:set_txconfig": {"body": "lora_device:set_txconfig(${1:txconfig})", "description": "lora_device:set_txconfig(txconfig) - lora\u914d\u7f6e\u53d1\u9001\u53c2\u6570\n\u4f20\u5165\u503c\uff1a\ntable lora\u53d1\u9001\u914d\u7f6e\u53c2\u6570,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173\n\u4f8b\u5b50\uff1a\nlora_device:set_txconfig(\n {\n mode=1,\n power=22,\n fdev=0,\n bandwidth=0,\n datarate=9,\n coderate=4,\n preambleLen=8,\n fixLen=false,\n crcOn=true,\n freqHopOn=0,\n hopPeriod=0,\n iqInverted=false,\n timeout=3000\n }\n)\n", "prefix": "lora_device:set_txconfig"}, "lora_device:set_rxconfig": {"body": "lora_device:set_rxconfig(${1:set_rxconfig})", "description": "lora_device:set_rxconfig(set_rxconfig) - lora\u914d\u7f6e\u63a5\u6536\u53c2\u6570\n\u4f20\u5165\u503c\uff1a\ntable lora\u63a5\u6536\u914d\u7f6e\u53c2\u6570,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173\n\u4f8b\u5b50\uff1a\nlora_device:set_rxconfig(\n {\n mode=1,\n bandwidth=0,\n datarate=9,\n coderate=4,\n bandwidthAfc=0,\n preambleLen=8,\n symbTimeout=0,\n fixLen=false,\n payloadLen=0,\n crcOn=true,\n freqHopOn=0,\n hopPeriod=0,\n iqInverted=false,\n rxContinuous=false\n }\n)\n", "prefix": "lora_device:set_rxconfig"}, "lora_device:send": {"body": "lora_device:send(${1:data})", "description": "lora_device:send(data) - \u53d1\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring \u5199\u5165\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\nlora_device:send(\"PING\")\n", "prefix": "lora_device:send"}, "lora_device:recv": {"body": "lora_device:recv(${1:timeout})", "description": "lora_device:recv(timeout) - \u5f00\u542f\u6536\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nnumber \u8d85\u65f6\u65f6\u95f4\uff0c\u9ed8\u8ba41000 \u5355\u4f4dms\n\u4f8b\u5b50\uff1a\nsys.subscribe(\"LORA_RX_DONE\", function(data, size)\n log.info(\"LORA_RX_DONE: \", data, size)\n lora_device:send(\"PING\")\nend)\nlora_device:recv(1000)\n", "prefix": "lora_device:recv"}, "lora_device:mode": {"body": "lora_device:mode(${1:mode})", "description": "lora_device:mode(mode) - \u8bbe\u7f6e\u8fdb\u5165\u6a21\u5f0f(\u4f11\u7720\uff0c\u6b63\u5e38\u7b49)\n\u4f20\u5165\u503c\uff1a\nnumber \u6a21\u5f0f \u6b63\u5e38\u6a21\u5f0f:lora.STANDBY \u4f11\u7720\u6a21\u5f0f:lora.SLEEP \u9ed8\u8ba4\u4e3a\u6b63\u5e38\u6a21\u5f0f\n\u4f8b\u5b50\uff1a\nlora_device:mode(lora.STANDBY)\n", "prefix": "lora_device:mode"}, "lora_device:on": {"body": "lora_device:on(${1:cb})", "description": "lora_device:on(cb) - \u6ce8\u518clora\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nfunction cb lora\u56de\u8c03,\u53c2\u6570\u5305\u62eclora_device, event, data, size\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlora_device:on(function(lora_device, event, data, size)\n log.info(\"lora\", \"event\", event, lora_device, data, size)\n if event == \"tx_done\" then\n lora_device:recv(1000)\n elseif event == \"rx_done\" then\n lora_device:send(\"PING\")\n elseif event == \"tx_timeout\" then\n\n elseif event == \"rx_timeout\" then\n lora_device:recv(1000)\n elseif event == \"rx_error\" then\n\n end\nend)\n--[[\nevent\u53ef\u80fd\u51fa\u73b0\u7684\u503c\u6709\n tx_done -- \u53d1\u9001\u5b8c\u6210\n rx_done -- \u63a5\u6536\u5b8c\u6210\n tx_timeout -- \u53d1\u9001\u8d85\u65f6\n rx_timeout -- \u63a5\u6536\u8d85\u65f6\n rx_error -- \u63a5\u6536\u9519\u8bef\n]]\n", "prefix": "lora_device:on"}, "lvgl.draw_mask_radius_param_t": {"body": "lvgl.draw_mask_radius_param_t()", "description": "lvgl.draw_mask_radius_param_t() - \u521b\u5efa\u4e00\u4e2alv_draw_mask_radius_param_t\n\u8fd4\u56de\u503c\uff1a\nuserdata lv_draw_mask_radius_param_t\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal radius = lvgl.draw_mask_radius_param_t()\n", "prefix": "lvgl.draw_mask_radius_param_t"}, "lvgl.draw_mask_radius_param_t_free": {"body": "lvgl.draw_mask_radius_param_t_free(${1:radius})", "description": "lvgl.draw_mask_radius_param_t_free(radius) - \u91ca\u653e\u4e00\u4e2alv_draw_mask_radius_param_t\n\u4f8b\u5b50\uff1a\nlocal lvgl.draw_mask_radius_param_t_free(radius)\n", "prefix": "lvgl.draw_mask_radius_param_t_free"}, "lvgl.draw_mask_line_param_t": {"body": "lvgl.draw_mask_line_param_t()", "description": "lvgl.draw_mask_line_param_t() - \u521b\u5efa\u4e00\u4e2alv_draw_mask_line_param_t\n\u8fd4\u56de\u503c\uff1a\nuserdata lv_draw_mask_line_param_t\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal line = lvgl.draw_mask_line_param_t()\n", "prefix": "lvgl.draw_mask_line_param_t"}, "lvgl.draw_mask_line_param_t_free": {"body": "lvgl.draw_mask_line_param_t_free(${1:line})", "description": "lvgl.draw_mask_line_param_t_free(line) - \u91ca\u653e\u4e00\u4e2alv_draw_mask_line_param_t\n\u4f8b\u5b50\uff1a\nlocal lvgl.draw_mask_line_param_t_free(line)\n", "prefix": "lvgl.draw_mask_line_param_t_free"}, "lvgl.draw_mask_fade_param_t": {"body": "lvgl.draw_mask_fade_param_t()", "description": "lvgl.draw_mask_fade_param_t() - \u521b\u5efa\u4e00\u4e2alv_draw_mask_fade_param_t\n\u8fd4\u56de\u503c\uff1a\nuserdata lv_draw_mask_fade_param_t\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal fade = lvgl.draw_mask_fade_param_t()\n", "prefix": "lvgl.draw_mask_fade_param_t"}, "lvgl.draw_mask_fade_param_t_free": {"body": "lvgl.draw_mask_fade_param_t_free(${1:fade})", "description": "lvgl.draw_mask_fade_param_t_free(fade) - \u91ca\u653e\u4e00\u4e2alv_draw_mask_fade_param_t\n\u4f8b\u5b50\uff1a\nlocal lvgl.draw_mask_fade_param_t_free(fade)\n", "prefix": "lvgl.draw_mask_fade_param_t_free"}, "lvgl.font_get": {"body": "lvgl.font_get(${1:name})", "description": "lvgl.font_get(name) - \u83b7\u53d6\u5185\u7f6e\u5b57\u4f53\n\u4f20\u5165\u503c\uff1a\nstring \u5b57\u4f53\u540d\u79f0+\u5b57\u53f7, \u4f8b\u5982 opposans_m_10\n\u8fd4\u56de\u503c\uff1a\nuserdata \u5b57\u4f53\u6307\u9488\n\u4f8b\u5b50\uff1a\n\nlocal font = lvgl.font_get(\"opposans_m_12\")\n", "prefix": "lvgl.font_get"}, "lvgl.font_load": {"body": "lvgl.font_load(${1:path/spi_device},${2:size},${3:bpp},${4:thickness},${5:cache_size},${6:sty_zh},${7:sty_en})", "description": "lvgl.font_load(path/spi_device,size,bpp,thickness,cache_size,sty_zh,sty_en) - \u4ece\u6587\u4ef6\u7cfb\u7edf\u52a0\u8f7d\u5b57\u4f53\n\u4f20\u5165\u503c\uff1a\nstring/userdata \u5b57\u4f53\u8def\u5f84/spi_device (spi_device\u4e3a\u4f7f\u7528\u5916\u7f6e\u9ad8\u901a\u77e2\u91cf\u5b57\u5e93\u82af\u7247)\nnumber size \u53ef\u9009,\u5b57\u53f7 16-192 \u9ed8\u8ba416(\u4f7f\u7528\u9ad8\u901a\u77e2\u91cf\u5b57\u5e93)\nnumber bpp \u53ef\u9009 \u6df1\u5ea6 \u9ed8\u8ba44(\u4f7f\u7528\u9ad8\u901a\u77e2\u91cf\u5b57\u5e93)\nnumber thickness \u53ef\u9009 \u7c97\u7ec6\u503c \u9ed8\u8ba4size * bpp(\u4f7f\u7528\u9ad8\u901a\u77e2\u91cf\u5b57\u5e93)\nnumber cache_size \u53ef\u9009 \u9ed8\u8ba40(\u4f7f\u7528\u9ad8\u901a\u77e2\u91cf\u5b57\u5e93)\nnumber sty_zh \u53ef\u9009 \u9009\u62e9\u5b57\u4f53 \u9ed8\u8ba41(\u4f7f\u7528\u9ad8\u901a\u77e2\u91cf\u5b57\u5e93)\nnumber sty_en \u53ef\u9009 \u9009\u62e9\u5b57\u4f53 \u9ed8\u8ba43(\u4f7f\u7528\u9ad8\u901a\u77e2\u91cf\u5b57\u5e93)\n\u8fd4\u56de\u503c\uff1a\nuserdata \u5b57\u4f53\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal font = lvgl.font_load(\"/font_32.bin\")\n--local font = lvgl.font_load(spi_device,16)(\u9ad8\u901a\u77e2\u91cf\u5b57\u5e93)\n", "prefix": "lvgl.font_load"}, "lvgl.font_free": {"body": "lvgl.font_free(${1:font})", "description": "lvgl.font_free(font) - \u91ca\u653e\u5b57\u4f53,\u614e\u7528!!!\u4ec5\u901a\u8fc7font_load\u52a0\u8f7d\u7684\u5b57\u4f53\u5141\u8bb8\u5378\u8f7d,\u901a\u8fc7font_get\u83b7\u53d6\u7684\u5b57\u4f53\u4e0d\u5141\u8bb8\u5378\u8f7d\n\u4f20\u5165\u503c\uff1a\nstring \u5b57\u4f53\u8def\u5f84\n\u8fd4\u56de\u503c\uff1a\nuserdata \u5b57\u4f53\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal font = lvgl.font_load(\"/font_32.bin\")\n-- N N N N \u64cd\u4f5c\n-- \u786e\u5b9a\u5b57\u4f53\u4e0d\u88ab\u4f7f\u7528,\u4e0d\u88ab\u5f15\u7528,\u4e14\u5185\u5b58\u7d27\u5f20\u9700\u8981\u91ca\u653e\nlvgl.font_free(font)\n", "prefix": "lvgl.font_free"}, "lvgl.obj_set_event_cb": {"body": "lvgl.obj_set_event_cb(${1:obj},${2:func})", "description": "lvgl.obj_set_event_cb(obj, func) - \u8bbe\u7f6e\u7ec4\u4ef6\u7684\u4e8b\u4ef6\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nuserdata lvgl\u7ec4\u4ef6\u6307\u9488\nfunc lua\u51fd\u6570, \u53c2\u6570\u67092\u4e2a (obj, event), \u5176\u4e2dobj\u662f\u5f53\u524d\u5bf9\u8c61, event\u662f\u4e8b\u4ef6\u7c7b\u578b, \u4e3a\u6574\u578b\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "lvgl.obj_set_event_cb"}, "lvgl.obj_set_signal_cb": {"body": "lvgl.obj_set_signal_cb(${1:obj},${2:func})", "description": "lvgl.obj_set_signal_cb(obj, func) - \u8bbe\u7f6e\u7ec4\u4ef6\u7684\u4fe1\u53f7\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nuserdata lvgl\u7ec4\u4ef6\u6307\u9488\nfunc lua\u51fd\u6570, \u53c2\u6570\u67092\u4e2a (obj, signal), \u5176\u4e2dobj\u662f\u5f53\u524d\u5bf9\u8c61, signal\u662f\u4fe1\u53f7\u7c7b\u578b, \u4e3a\u6574\u578b\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "lvgl.obj_set_signal_cb"}, "lvgl.anim_set_exec_cb": {"body": "lvgl.anim_set_exec_cb(${1:anim},${2:func})", "description": "lvgl.anim_set_exec_cb(anim, func) - \u8bbe\u7f6e\u52a8\u753b\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nuserdata \u52a8\u753b\u6307\u9488\nuserdata lvgl\u7ec4\u4ef6\u6307\u9488\nfunc lua\u51fd\u6570, \u53c2\u6570\u67092\u4e2a (obj, value), \u5176\u4e2dobj\u662f\u5f53\u524d\u5bf9\u8c61, signal\u662f\u4fe1\u53f7\u7c7b\u578b, \u4e3a\u6574\u578b\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "lvgl.anim_set_exec_cb"}, "lvgl.anim_set_ready_cb": {"body": "lvgl.anim_set_ready_cb(${1:anim},${2:func})", "description": "lvgl.anim_set_ready_cb(anim, func) - \u8bbe\u7f6e\u52a8\u753b\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nuserdata \u52a8\u753b\u6307\u9488\nuserdata lvgl\u7ec4\u4ef6\u6307\u9488\nfunc lua\u51fd\u6570, \u53c2\u6570\u67091\u4e2a (anim), \u5176\u4e2danim\u662f\u5f53\u524d\u5bf9\u8c61\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "lvgl.anim_set_ready_cb"}, "lvgl.anim_path_set_cb": {"body": "lvgl.anim_path_set_cb(${1:path},${2:func})", "description": "lvgl.anim_path_set_cb(path, func) - \u8bbe\u7f6e\u52a8\u753b\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nuserdata \u52a8\u753b\u6307\u9488\nuserdata lvgl\u7ec4\u4ef6\u6307\u9488\nfunc lua\u51fd\u6570, \u53c2\u6570\u67091\u4e2a (path), \u5176\u4e2dpath\u662f\u5f53\u524d\u5bf9\u8c61\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "lvgl.anim_path_set_cb"}, "lvgl.event_send": {"body": "lvgl.event_send(${1:obj},${2:ent})", "description": "lvgl.event_send(obj, ent) - \u53d1\u9001\u4e8b\u4ef6\u7ed9\u7ec4\u4ef6\n\u4f20\u5165\u503c\uff1a\nuserdata \u7ec4\u4ef6\u6307\u9488\nint \u4e8b\u4ef6id, \u4f8b\u5982 lvgl.EVENT_PRESSED\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue, \u5bf9\u8c61\u5df2\u88ab\u5220\u9664\u7684\u8bdd\u8fd4\u56defalse\u6216\u8005nil\nint \u5e95\u5c42\u8fd4\u56de\u503c,\u5982\u679cobj\u4e3anil\u5c31\u8fd4\u56denil\n", "prefix": "lvgl.event_send"}, "lvgl.scr_act": {"body": "lvgl.scr_act()", "description": "lvgl.scr_act() - \u83b7\u53d6\u5f53\u524d\u6d3b\u8dc3\u7684screen\u5bf9\u8c61\n\u8fd4\u56de\u503c\uff1a\n\u6307\u9488 screen\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal scr = lvgl.scr_act()\n\n", "prefix": "lvgl.scr_act"}, "lvgl.layer_top": {"body": "lvgl.layer_top()", "description": "lvgl.layer_top() - \u83b7\u53d6layer_top\n\u8fd4\u56de\u503c\uff1a\n\u6307\u9488 layer\u6307\u9488\n", "prefix": "lvgl.layer_top"}, "lvgl.layer_sys": {"body": "lvgl.layer_sys()", "description": "lvgl.layer_sys() - \u83b7\u53d6layer_sys\n\u8fd4\u56de\u503c\uff1a\n\u6307\u9488 layer\u6307\u9488\n", "prefix": "lvgl.layer_sys"}, "lvgl.scr_load": {"body": "lvgl.scr_load(${1:scr})", "description": "lvgl.scr_load(scr) - \u8f7d\u5165\u6307\u5b9a\u7684screen\n\u4f20\u5165\u503c\uff1a\nuserdata screen\u6307\u9488\n\u4f8b\u5b50\uff1a\n local scr = lvgl.obj_create(nil, nil)\n local btn = lvgl.btn_create(scr)\n lvgl.obj_align(btn, lvgl.scr_act(), lvgl.ALIGN_CENTER, 0, 0)\n local label = lvgl.label_create(btn)\n lvgl.label_set_text(label, \"LuatOS!\")\n lvgl.scr_load(scr)\n", "prefix": "lvgl.scr_load"}, "lvgl.scr_load_anim": {"body": "lvgl.scr_load_anim(${1:scr})", "description": "lvgl.scr_load_anim(scr) - \u8f7d\u5165\u6307\u5b9a\u7684screen\u5e76\u4f7f\u7528\u6307\u5b9a\u7684\u8f6c\u573a\u52a8\u753b\n\u4f20\u5165\u503c\uff1a\nuserdata screen\u6307\u9488\n\u4f8b\u5b50\uff1a\n local scr = lvgl.obj_create(nil, nil)\n local btn = lvgl.btn_create(scr)\n lvgl.obj_align(btn, lvgl.scr_act(), lvgl.ALIGN_CENTER, 0, 0)\n local label = lvgl.label_create(btn)\n lvgl.label_set_text(label, \"LuatOS!\")\n\n local scr2 = lvgl.obj_create(nil,nil)\n local btn2 = lvgl.btn_create(scr2)\n lvgl.obj_align(btn, scr2, lvgl.ALIGN_CENTER, 0, 20)\n local label2 = lvgl.label_create(btn2)\n lvgl.label_set_text(label2, \"Btn2\")\n lvgl.scr_load(scr)\n --sys.wait(1000);\n lvgl.scr_load_anim(scr2,lvgl.SCR_LOAD_ANIM_OVER_LEFT,100,100,false)\n\u539f\u51fd\u6570\uff1alv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t time, uint32_t delay, bool auto_del)\n", "prefix": "lvgl.scr_load_anim"}, "lvgl.theme_set_act": {"body": "lvgl.theme_set_act(${1:name})", "description": "lvgl.theme_set_act(name) - \u8bbe\u7f6e\u4e3b\u9898\n\u4f20\u5165\u503c\uff1a\nstring \u4e3b\u9898\u540d\u79f0,\u53ef\u9009\u503c\u6709 default/mono/empty/material_light/material_dark/material_no_transition/material_no_focus\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u9ed1\u767d\u4e3b\u9898\nlvgl.theme_set_act(\"mono\")\n-- \u7a7a\u767d\u4e3b\u9898\nlvgl.theme_set_act(\"empty\")\n", "prefix": "lvgl.theme_set_act"}, "lvgl.sleep": {"body": "lvgl.sleep(${1:enable})", "description": "lvgl.sleep(enable) - LVGL\u4f11\u7720\u63a7\u5236\uff0c\u6682\u505c/\u6062\u590d\u5237\u65b0\u5b9a\u65f6\u5668\uff0c\u76ee\u524d\u53ea\u6709105\u548cEC618\u53ef\u4ee5\u7528\n\u4f20\u5165\u503c\uff1a\nboolean true\u6682\u505c false\u6062\u590d\n\u4f8b\u5b50\uff1a\nlvgl.sleep(true) --\u6682\u505c\u5237\u65b0\uff0c\u7cfb\u7edf\u53ef\u4ee5\u4f11\u7720\nlvgl.sleep(false) --\u6062\u590d\u5237\u65b0\uff0c\u7cfb\u7edf\u4e0d\u4f11\u7720\n", "prefix": "lvgl.sleep"}, "lvgl.init": {"body": "lvgl.init(${1:w},${2:h},${3:lcd},${4:buff_size},${5:buff_mode})", "description": "lvgl.init(w, h, lcd, buff_size, buff_mode) - \u521d\u59cb\u5316LVGL\n\u4f20\u5165\u503c\uff1a\nint \u5c4f\u5e55\u5bbd,\u53ef\u9009,\u9ed8\u8ba4\u4ecelcd\u53d6\nint \u5c4f\u5e55\u9ad8,\u53ef\u9009,\u9ed8\u8ba4\u4ecelcd\u53d6\nuserdata lcd\u6307\u9488,\u53ef\u9009,lcd\u521d\u59cb\u5316\u540e\u6709\u9ed8\u8ba4\u503c,\u9884\u7559\u7684\u591a\u5c4f\u5165\u53e3\nint \u7f13\u51b2\u533a\u5927\u5c0f,\u9ed8\u8ba4\u5bbd*10, \u4e0d\u542b\u8272\u6df1.\nint \u7f13\u51b2\u6a21\u5f0f,\u9ed8\u8ba40, \u5355buff\u6a21\u5f0f, \u53ef\u90091,\u53ccbuff\u6a21\u5f0f\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n", "prefix": "lvgl.init"}, "lvgl.anim_create": {"body": "lvgl.anim_create()", "description": "lvgl.anim_create() - \u521b\u5efa\u5e76\u521d\u59cb\u5316\u4e00\u4e2aanim\n\u8fd4\u56de\u503c\uff1a\nuserdata anim\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal anim = lvgl.anim_create()\n", "prefix": "lvgl.anim_create"}, "lvgl.anim_free": {"body": "lvgl.anim_free(${1:anim})", "description": "lvgl.anim_free(anim) - \u91ca\u653e\u4e00\u4e2aanim\n\u4f8b\u5b50\uff1a\nlocal lvgl.anim_free(anim)\n", "prefix": "lvgl.anim_free"}, "lvgl.anim_path_t": {"body": "lvgl.anim_path_t()", "description": "lvgl.anim_path_t() - \u521b\u5efa\u4e00\u4e2alv_anim_path_t\n\u8fd4\u56de\u503c\uff1a\nuserdata lv_anim_path_t\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal anim_path_t = lvgl.anim_path_t()\n", "prefix": "lvgl.anim_path_t"}, "lvgl.anim_path_t_free": {"body": "lvgl.anim_path_t_free(${1:anim_path_t})", "description": "lvgl.anim_path_t_free(anim_path_t) - \u91ca\u653e\u4e00\u4e2alv_anim_path_t\n\u4f8b\u5b50\uff1a\nlocal lvgl.anim_path_t_free(anim_path_t)\n", "prefix": "lvgl.anim_path_t_free"}, "lvgl.anim_set_path_str": {"body": "lvgl.anim_set_path_str(${1:anim},${2:tp})", "description": "lvgl.anim_set_path_str(anim, tp) - \u8bbe\u7f6e\u52a8\u753b\u8def\u5f84\u65b9\u5f0f\n\u4f20\u5165\u503c\uff1a\nuserdata \u52a8\u753b\u6307\u9488\nstring \u7c7b\u578b, \u652f\u6301 linear/ease_in/ease_out/ease_in_out/overshoot/bounce/step\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "lvgl.anim_set_path_str"}, "lvgl.qrcode_create": {"body": "lvgl.qrcode_create(${1:parent},${2:size},${3:dark_color},${4:light_color})", "description": "lvgl.qrcode_create(parent, size, dark_color, light_color) - \u521b\u5efaqrcode\u7ec4\u4ef6\n\u4f20\u5165\u503c\uff1a\nuserdata \u7236\u7ec4\u4ef6\nint \u957f\u5ea6,\u56e0\u4e3aqrcode\u662f\u6b63\u65b9\u5f62\nint \u4e8c\u7ef4\u7801\u4e2d\u6570\u636e\u70b9\u7684\u989c\u8272, RGB\u989c\u8272, \u9ed8\u8ba4 0x3333ff\nint \u4e8c\u7ef4\u7801\u4e2d\u80cc\u666f\u70b9\u7684\u989c\u8272, RGB\u989c\u8272, \u9ed8\u8ba4 0xeeeeff\n\u8fd4\u56de\u503c\uff1a\nuserdata qrcode\u7ec4\u4ef6\n\u4f8b\u5b50\uff1a\n-- \u521b\u5efa\u5e76\u663e\u793aqrcode\nlocal qrcode = lvgl.qrcode_create(scr, 100)\nlvgl.qrcode_update(qrcode, \"https://luatos.com\")\nlvgl.obj_align(qrcode, lvgl.scr_act(), lvgl.ALIGN_CENTER, -100, -100)\n", "prefix": "lvgl.qrcode_create"}, "lvgl.qrcode_update": {"body": "lvgl.qrcode_update(${1:qrcode},${2:cnt})", "description": "lvgl.qrcode_update(qrcode, cnt) - \u8bbe\u7f6eqrcode\u7ec4\u4ef6\u7684\u4e8c\u7ef4\u7801\u5185\u5bb9,\u914d\u5408qrcode_create\u4f7f\u7528\n\u4f20\u5165\u503c\uff1a\nuserdata qrcode\u7ec4\u4ef6,\u7531qrcode_create\u521b\u5efa\nstring \u4e8c\u7ef4\u7801\u7684\u5185\u5bb9\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nbool \u66f4\u65b0\u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse. \u901a\u5e38\u53ea\u6709\u6570\u636e\u592a\u957f\u65e0\u6cd5\u5bb9\u7eb3\u624d\u4f1a\u8fd4\u56defalse\n", "prefix": "lvgl.qrcode_update"}, "lvgl.qrcode_delete": {"body": "lvgl.qrcode_delete(${1:qrcode})", "description": "lvgl.qrcode_delete(qrcode) - \u5220\u9664qrcode\u7ec4\u4ef6\n\u4f20\u5165\u503c\uff1a\nuserdata qrcode\u7ec4\u4ef6,\u7531qrcode_create\u521b\u5efa\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "lvgl.qrcode_delete"}, "lvgl.style_t": {"body": "lvgl.style_t()", "description": "lvgl.style_t() - \u521b\u5efa\u4e00\u4e2astyle\n\u8fd4\u56de\u503c\uff1a\nuserdata style\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal style = lvgl.style_t()\nlvgl.style_init(style)\n", "prefix": "lvgl.style_t"}, "lvgl.style_create": {"body": "lvgl.style_create()", "description": "lvgl.style_create() - \u521b\u5efa\u4e00\u4e2astyle\u5e76\u521d\u59cb\u5316\n\u8fd4\u56de\u503c\uff1a\nuserdata style\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal style = lvgl.style_create()\n", "prefix": "lvgl.style_create"}, "lvgl.style_list_create": {"body": "lvgl.style_list_create()", "description": "lvgl.style_list_create() - \u521b\u5efa\u4e00\u4e2astyle_list\n\u8fd4\u56de\u503c\uff1a\nuserdata style\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal style_list = lvgl.style_list_create()\n", "prefix": "lvgl.style_list_create"}, "lvgl.style_list_t": {"body": "lvgl.style_list_t()", "description": "lvgl.style_list_t() - \u521b\u5efa\u4e00\u4e2astyle_list\n\u8fd4\u56de\u503c\uff1a\nuserdata style\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal style = lvgl.style_list_t()\n", "prefix": "lvgl.style_list_t"}, "lvgl.style_delete": {"body": "lvgl.style_delete(${1:style})", "description": "lvgl.style_delete(style) - \u5220\u9664style,\u614e\u7528,\u901a\u5e38\u4e0d\u4f1a\u6267\u884c\u5220\u9664\u64cd\u4f5c\n\u4f20\u5165\u503c\uff1a\nuserdata style\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal style = lvgl.style_create()\n-- ...\n-- ...\n-- lvgl.style_delete(style)\n", "prefix": "lvgl.style_delete"}, "lvgl.style_list_delete": {"body": "lvgl.style_list_delete(${1:style})", "description": "lvgl.style_list_delete(style) - \u5220\u9664style_list,\u614e\u7528,\u901a\u5e38\u4e0d\u4f1a\u6267\u884c\u5220\u9664\u64cd\u4f5c\n\u4f20\u5165\u503c\uff1a\nuserdata style\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal style_list = lvgl.style_list_create()\n-- ...\n-- ...\n-- lvgl.style_list_delete(style_list)\n", "prefix": "lvgl.style_list_delete"}, "lvgl.demo_benchmark": {"body": "lvgl.demo_benchmark()", "description": "lvgl.demo_benchmark() - lvgl benchmark demo\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlvgl.init()\nlvgl.demo_benchmark()\n", "prefix": "lvgl.demo_benchmark"}, "lvgl.demo_keypad_encoder": {"body": "lvgl.demo_keypad_encoder()", "description": "lvgl.demo_keypad_encoder() - lvgl keypad_encoder demo\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlvgl.init()\nlvgl.demo_keypad_encoder()\n", "prefix": "lvgl.demo_keypad_encoder"}, "lvgl.demo_music": {"body": "lvgl.demo_music()", "description": "lvgl.demo_music() - lvgl music demo\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlvgl.init()\nlvgl.demo_music()\n", "prefix": "lvgl.demo_music"}, "lvgl.demo_printer": {"body": "lvgl.demo_printer()", "description": "lvgl.demo_printer() - lvgl printer demo\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlvgl.init()\nlvgl.demo_printer()\n", "prefix": "lvgl.demo_printer"}, "lvgl.demo_stress": {"body": "lvgl.demo_stress()", "description": "lvgl.demo_stress() - lvgl stress demo\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlvgl.init()\nlvgl.demo_stress()\n", "prefix": "lvgl.demo_stress"}, "lvgl.demo_widgets": {"body": "lvgl.demo_widgets()", "description": "lvgl.demo_widgets() - lvgl widgets demo\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlvgl.init()\nlvgl.demo_widgets()\n", "prefix": "lvgl.demo_widgets"}, "lvgl.indev_drv_register": {"body": "lvgl.indev_drv_register(${1:tp},${2:dtp})", "description": "lvgl.indev_drv_register(tp, dtp) - \u6ce8\u518c\u8f93\u5165\u8bbe\u5907\u9a71\u52a8\n\u4f20\u5165\u503c\uff1a\nstring \u8bbe\u5907\u7c7b\u578b\uff0c\u5f53\u524d\u652f\u6301\"pointer\",\u6307\u9488\u7c7b/\u89e6\u6478\u7c7b\u5747\u53ef\uff0c\"keyboard\",\u952e\u76d8\u7c7b\u578b\nstring \u8bbe\u5907\u578b\u53f7\uff0c\u5f53\u524d\u652f\u6301\"emulator\",\u6a21\u62df\u5668\u7c7b\u578b\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nlvgl.indev_drv_register(\"pointer\", \"emulator\")\n", "prefix": "lvgl.indev_drv_register"}, "lvgl.indev_point_emulator_update": {"body": "lvgl.indev_point_emulator_update(${1:x},${2:y},${3:state})", "description": "lvgl.indev_point_emulator_update(x, y, state) - \u66f4\u65b0\u6a21\u62df\u8f93\u5165\u8bbe\u5907\u7684\u5750\u6807\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint x\u5750\u6807,\u4ee5\u5de6\u4e0a\u89d2\u4e3a0,\u53f3\u4e0b\u89d2\u4e3a\u6700\u5927\u503c\nint y\u5750\u6807,\u4ee5\u5de6\u4e0a\u89d2\u4e3a0,\u53f3\u4e0b\u89d2\u4e3a\u6700\u5927\u503c\nint \u72b6\u6001, 0 \u4e3a \u91ca\u653e, 1 \u4e3a\u6309\u4e0b\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u6a21\u62df\u5728\u5c4f\u5e55\u4e0a\u7684\u70b9\u51fb,\u901a\u8fc7timeout\u6a21\u62df\u957f\u6309\u548c\u77ed\u6309\nsys.taskInit(function(x, y, timeout)\n lvgl.indev_point_emulator_update(x, y, 1)\n sys.wait(timeout)\n lvgl.indev_point_emulator_update(x, y, 0)\nend, 240, 120, 50)\n", "prefix": "lvgl.indev_point_emulator_update"}, "lvgl.indev_kb_update": {"body": "lvgl.indev_kb_update(${1:key})", "description": "lvgl.indev_kb_update(key) - \u66f4\u65b0\u952e\u76d8\u8f93\u5165\u8bbe\u5907\u7684\u6309\u952e\u503c\n\u4f20\u5165\u503c\uff1a\nint \u6309\u952e\u503c\uff0c\u9ed8\u8ba4\u4e3a0\uff0c\u6309\u952e\u62ac\u8d77\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "lvgl.indev_kb_update"}, "lvgl.gif_create": {"body": "lvgl.gif_create(${1:parent},${2:path})", "description": "lvgl.gif_create(parent, path) - \u521b\u5efagif\u7ec4\u4ef6\n\u4f20\u5165\u503c\uff1a\nuserdata \u7236\u7ec4\u4ef6,\u53ef\u4ee5\u662fnil,\u4f46\u901a\u5e38\u4e0d\u4f1a\u662fnil\nstring \u6587\u4ef6\u8def\u5f84\n\u8fd4\u56de\u503c\uff1a\nuserdata \u7ec4\u4ef6\u6307\u9488,\u82e5\u5931\u8d25\u4f1a\u8fd4\u56denil,\u5efa\u8bae\u68c0\u67e5\n\u4f8b\u5b50\uff1a\nlocal gif = lvgl.gif_create(scr, \"S/emtry.gif\")\nif gif then\n log.info(\"gif\", \"create ok\")\nend\n\n", "prefix": "lvgl.gif_create"}, "lvgl.gif_restart": {"body": "lvgl.gif_restart(${1:gif})", "description": "lvgl.gif_restart(gif) - \u91cd\u65b0\u64ad\u653egif\u7ec4\u4ef6\n\u4f20\u5165\u503c\uff1a\nuserdata gif\u7ec4\u4ef6\u652f\u6301, \u7531gif_create\u65b9\u6cd5\u8fd4\u56de\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlocal gif = lvgl.gif_create(scr, \"S/emtry.gif\")\nif gif then\n log.info(\"gif\", \"create ok\")\nend\n\n", "prefix": "lvgl.gif_restart"}, "max30102.init": {"body": "max30102.init(${1:i2c_id},${2:int})", "description": "max30102.init(i2c_id,int) - \u521d\u59cb\u5316MAX30102\u4f20\u611f\u5668\n\u4f20\u5165\u503c\uff1a\nint \u4f20\u611f\u5668\u6240\u5728\u7684i2c\u603b\u7ebfid,\u9ed8\u8ba4\u4e3a0\nint int\u5f15\u811a\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue, \u5426\u5219\u8fd4\u56denil\u6216\u8005false\n\u4f8b\u5b50\uff1a\nif max30102.init(0,pin.PC05) then\n log.info(\"max30102\", \"init ok\")\nelse\n log.info(\"max30102\", \"init fail\")\nend\n", "prefix": "max30102.init"}, "max30102.get": {"body": "max30102.get()", "description": "max30102.get() - \u83b7\u53d6\u5fc3\u7387\u8840\u6c27(\u5927\u6982\u9700\u898110s\u65f6\u95f4\u6d4b\u91cf)\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue, \u5426\u5219\u8fd4\u56denil\u6216\u8005false\nnumber \u5fc3\u7387\nnumber \u8840\u6c27\n", "prefix": "max30102.get"}, "max30102.shutdown": {"body": "max30102.shutdown()", "description": "max30102.shutdown() - \u5173\u95edmax30102\n", "prefix": "max30102.shutdown"}, "mcu.setClk": {"body": "mcu.setClk(${1:mhz})", "description": "mcu.setClk(mhz) - \u8bbe\u7f6e\u4e3b\u9891,\u5355\u4f4dMHZ\n\u4f20\u5165\u503c\uff1a\nint \u4e3b\u9891,\u6839\u636e\u8bbe\u5907\u7684\u4e0d\u540c\u6709\u4e0d\u540c\u7684\u6709\u6548\u503c,\u8bf7\u67e5\u9605\u624b\u518c\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n\n-- \u6ce8\u610f: \u5e76\u975e\u6240\u6709\u6a21\u5757\u90fd\u652f\u6301\u4e3b\u9891\u8c03\u6574,\u8bf7\u67e5\u9605\u624b\u518c\n-- Air101/Air103/Air601 \u652f\u6301\u8bbe\u7f6e\u6210 2/40/80/160/240. \u7279\u522b\u63d0\u9192, \u8bbe\u7f6e\u52302M\u540e, \u5982\u679c\u8981\u4f11\u7720, \u5fc5\u987b\u5148\u8bbe\u7f6e\u523080M\n-- ESP32\u7cfb\u5217\u652f\u6301\u8bbe\u7f6e\u6210 40/80/160/240 , \u9700\u89812024.1.1\u4e4b\u540e\u7684\u56fa\u4ef6\n-- Air780\u7cfb\u5217, Air105, \u4e0d\u652f\u6301\u8bbe\u7f6e\u4e3b\u9891\n-- Air780\u7cfb\u5217, \u8fdb\u5165\u4f11\u7720\u6a21\u5f0f\u65f6\u81ea\u52a8\u964d\u9891\u523024M\n\n-- \u8bbe\u7f6e\u523080MHZ\nmcu.setClk(80)\nsys.wait(1000)\n-- \u8bbe\u7f6e\u5230240MHZ\nmcu.setClk(240)\nsys.wait(1000)\n-- \u8bbe\u7f6e\u52302MHZ\nmcu.setClk(2)\nsys.wait(1000)\n", "prefix": "mcu.setClk"}, "mcu.getClk": {"body": "mcu.getClk()", "description": "mcu.getClk() - \u83b7\u53d6\u4e3b\u9891,\u5355\u4f4dMHZ\n\u8fd4\u56de\u503c\uff1a\nint \u82e5\u5931\u8d25\u8fd4\u56de-1,\u5426\u5219\u8fd4\u56de\u4e3b\u9891\u6570\u503c,\u82e5\u7b49\u4e8e0,\u53ef\u80fd\u5904\u4e8e32k\u6676\u632f\u7684\u7701\u7535\u6a21\u5f0f\n\u4f8b\u5b50\uff1a\nlocal mhz = mcu.getClk()\nprint(\"Boom\", mhz)\n", "prefix": "mcu.getClk"}, "mcu.unique_id": {"body": "mcu.unique_id()", "description": "mcu.unique_id() - \u83b7\u53d6\u8bbe\u5907\u552f\u4e00id. \u6ce8\u610f,\u53ef\u80fd\u5305\u542b\u4e0d\u53ef\u89c1\u5b57\u7b26,\u5982\u9700\u67e5\u770b\u5efa\u8baetoHex()\u540e\u6253\u5370\n\u8fd4\u56de\u503c\uff1a\nstring \u8bbe\u5907\u552f\u4e00id.\u82e5\u4e0d\u652f\u6301, \u4f1a\u8fd4\u56de\u7a7a\u5b57\u7b26\u4e32.\n\u4f8b\u5b50\uff1a\nlocal unique_id = mcu.unique_id()\nprint(\"unique_id\", unique_id)\n", "prefix": "mcu.unique_id"}, "mcu.ticks": {"body": "mcu.ticks()", "description": "mcu.ticks() - \u83b7\u53d6\u542f\u52a8\u540e\u7684tick\u6570,\u672c\u8eab\u662f\u65e0\u7b26\u53f7\u503c,\u8303\u56f40~0xffffffff,lua\u662f\u6709\u7b26\u53f7\u8ba1\u7b97,\u8ba1\u7b97\u65f6\u8d85\u8fc70x7fffffff\u4f1a\u53d8\u8d1f\u6570\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524dtick\u503c\n\u4f8b\u5b50\uff1a\nlocal tick = mcu.ticks()\nprint(\"ticks\", tick)\n-- \u5982\u9700\u4e0d\u4f1a\u6ea2\u51fa\u7684\u503c, \u53ef\u7528mcu.ticks32(), \u4e8e2024.5.7\u65b0\u589e\n", "prefix": "mcu.ticks"}, "mcu.hz": {"body": "mcu.hz()", "description": "mcu.hz() - \u83b7\u53d6\u6bcf\u79d2\u7684tick\u6570\u91cf\n\u8fd4\u56de\u503c\uff1a\nint \u6bcf\u79d2\u7684tick\u6570\u91cf,\u901a\u5e38\u4e3a1000\n\u4f8b\u5b50\uff1a\nlocal hz = mcu.hz()\nprint(\"mcu.hz\", hz)\n", "prefix": "mcu.hz"}, "mcu.reg32": {"body": "mcu.reg32(${1:address},${2:value},${3:mask})", "description": "mcu.reg32(address, value, mask) - \u8bfb\u5199mcu\u768432bit\u5bc4\u5b58\u5668\u6216\u8005ram,\u8c28\u614e\u4f7f\u7528\u5199\u529f\u80fd,\u8bf7\u719f\u6089mcu\u7684\u5bc4\u5b58\u5668\u4f7f\u7528\u65b9\u6cd5\u540e\u518d\u4f7f\u7528\n\u4f20\u5165\u503c\uff1a\nint \u5bc4\u5b58\u5668\u6216\u8005ram\u5730\u5740\nint \u5199\u5165\u7684\u503c,\u5982\u679c\u6ca1\u6709,\u5219\u76f4\u63a5\u8fd4\u56de\u5f53\u524d\u503c\nint \u4f4d\u63a9\u7801,\u53ef\u4ee5\u5bf9\u7279\u5b9a\u51e0\u4e2a\u4f4d\u7f6e\u7684bit\u505a\u4fee\u6539, \u9ed8\u8ba40xffffffff,\u4fee\u6539\u5168\u90e832bit\n\u8fd4\u56de\u503c\uff1a\nint \u8fd4\u56de\u5f53\u524d\u5bc4\u5b58\u7684\u503c\n\u4f8b\u5b50\uff1a\nlocal value = mcu.reg32(0x2009FFFC, 0x01, 0x01) --\u5bf90x2009FFFC\u5730\u5740\u4e0a\u7684\u503c,\u4fee\u6539bit0\u4e3a1\n", "prefix": "mcu.reg32"}, "mcu.x32": {"body": "mcu.x32(${1:value})", "description": "mcu.x32(value) - \u8f6c\u636210\u8fdb\u5236\u6570\u4e3a16\u8fdb\u5236\u5b57\u7b26\u4e32\u8f93\u51fa\n\u4f20\u5165\u503c\uff1a\nint \u9700\u8981\u8f6c\u6362\u7684\u503c\n\u8fd4\u56de\u503c\uff1a\nstring 16\u8fdb\u5236\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\nlocal value = mcu.x32(0x2009FFFC) --\u8f93\u51fa\"0x2009fffc\"\n", "prefix": "mcu.x32"}, "mcu.tick64": {"body": "mcu.tick64()", "description": "mcu.tick64() - \u83b7\u53d6\u542f\u52a8\u540e\u7684\u9ad8\u7cbe\u5ea6tick\uff0c\u5982\u679c\u652f\u6301bit64\u5e93\uff0c\u53ef\u4ee5\u76f4\u63a5\u8f93\u51fa\u8f6c\u6362\u597d\u7684bit64\u7ed3\u6784\n\u4f20\u5165\u503c\uff1a\nboolean \u662f\u5426\u8f93\u51fabit64\u7ed3\u6784,true\u662f,\u5176\u4ed6\u90fd\u662ffalse,\u7559\u7a7a\u4e5f\u662ffalse,\u7528\u4e8e\u517c\u5bb9\u65e7\u7684demo\n\u8fd4\u56de\u503c\uff1a\nstring \u5f53\u524dtick\u503c,8\u4e2a\u5b57\u8282\u7684uint64,\u5982\u679c\u652f\u630164bit\u5e93,\u540c\u65f6\u8981\u6c42\u8f93\u51fa64bit\u7ed3\u6784\u7684\u8bdd,\u4f1a\u8f93\u51fa9\u5b57\u8282\u7684string\nint 1us\u6709\u51e0\u4e2atick,0\u8868\u793a\u672a\u77e5\n\u4f8b\u5b50\uff1a\nlocal tick_str, tick_per = mcu.tick64()\nprint(\"ticks\", tick_str, tick_per)\n", "prefix": "mcu.tick64"}, "mcu.dtick64": {"body": "mcu.dtick64(${1:tick1},${2:tick2},${3:check_value})", "description": "mcu.dtick64(tick1, tick2, check_value) - \u8ba1\u7b972\u4e2a64bit tick\u7684\u5dee\u503c\n\u4f20\u5165\u503c\uff1a\nstring 64bit\u7684string\nstring 64bit\u7684string\nint \u53c2\u8003\u503c,\u53ef\u9009\u9879,\u5982\u679c\u4e3a0,\u5219\u8fd4\u56de\u7ed3\u679c\u4e2d\u7b2c\u4e00\u4e2a\u9879\u76ee\u4e3atrue\n\u8fd4\u56de\u503c\uff1a\nboolean \u4e0e\u53c2\u8003\u503c\u6bd4\u8f83,\u5982\u679c\u5927\u4e8e\u7b49\u4e8e\u4e3atrue,\u53cd\u4e4b\u4e3afalse\nint \u5dee\u503ctick1 - tick2,\u5982\u679c\u8d85\u8fc7\u4e860x7fffffff,\u7ed3\u679c\u53ef\u80fd\u662f\u9519\u7684\n\u4f8b\u5b50\uff1a\nlocal result, diff_tick = mcu.dtick64(tick1, tick2)\nprint(\"ticks\", result, diff_tick)\n", "prefix": "mcu.dtick64"}, "mcu.setXTAL": {"body": "mcu.setXTAL(${1:source_main},${2:source_32k},${3:delay})", "description": "mcu.setXTAL(source_main, source_32k, delay) - \u9009\u62e9\u65f6\u949f\u6e90,\u5f53\u524d\u4ec5air105\u652f\u6301\n\u4f20\u5165\u503c\uff1a\nboolean \u9ad8\u901f\u65f6\u949f\u662f\u5426\u4f7f\u7528\u5916\u90e8\u65f6\u949f\u6e90,\u5982\u679c\u4e3a\u7a7a\u5219\u4e0d\u6539\u53d8\nboolean \u4f4e\u901f32K\u662f\u5426\u4f7f\u7528\u5916\u90e8\u65f6\u949f\u6e90,\u5982\u679c\u4e3a\u7a7a\u5219\u4e0d\u6539\u53d8\nint PLL\u7a33\u5b9a\u65f6\u95f4,\u5728\u5207\u6362\u9ad8\u901f\u65f6\u949f\u7684\u65f6\u5019,\u6839\u636e\u786c\u4ef6\u73af\u5883,\u9700\u8981delay\u4e00\u6bb5\u65f6\u95f4\u7b49\u5f85PLL\u7a33\u5b9a,\u9ed8\u8ba4\u662f1200,\u5efa\u8bae\u4e0d\u5c0f\u4e8e1024\n\u4f8b\u5b50\uff1a\nmcu.setXTAL(true, true, 1248) --\u9ad8\u901f\u65f6\u949f\u4f7f\u7528\u5916\u90e8\u65f6\u949f,\u4f4e\u901f32K\u4f7f\u7528\u5916\u90e8\u6676\u632f, delay1248\n", "prefix": "mcu.setXTAL"}, "mcu.hardfault": {"body": "mcu.hardfault(${1:mode})", "description": "mcu.hardfault(mode) - mcu\u6b7b\u673a\u65f6\u5904\u7406\u6a21\u5f0f\uff0c\u76ee\u524d\u53ea\u6709EC618\u5e73\u53f0\u9002\u7528\n\u4f20\u5165\u503c\uff1a\nint \u5904\u7406\u6a21\u5f0f\uff0c0\u6b7b\u673a\u505c\u673a\uff0c1\u6b7b\u673a\u540e\u91cd\u542f\uff0c2\u6b7b\u673a\u540e\u5c3d\u91cf\u5c06\u9519\u8bef\u4fe1\u606f\u63d0\u4ea4\u7ed9\u5916\u90e8\u5de5\u5177\u540e\u91cd\u542f 3.\u6b7b\u673a\u65f6\u5199\u5165\u5173\u952e\u4fe1\u606f\u5230flash\u540e\u7acb\u523b\u91cd\u542f\n\u4f8b\u5b50\uff1a\nmcu.hardfault(0) --\u6b7b\u673a\u540e\u505c\u673a\uff0c\u4e00\u822c\u7528\u4e8e\u8c03\u8bd5\u72b6\u6001\nmcu.hardfault(1) --\u6b7b\u673a\u540e\u91cd\u542f\uff0c\u4e00\u822c\u7528\u4e8e\u6b63\u5f0f\u4ea7\u54c1\nmcu.hardfault(2) --\u6b7b\u673a\u540e\u5c3d\u91cf\u5c06\u9519\u8bef\u4fe1\u606f\u63d0\u4ea4\u7ed9\u5916\u90e8\u5de5\u5177\u540e\u91cd\u542f\uff0c\u4e00\u822c\u7528\u4e8e\u538b\u529b\u6d4b\u8bd5\u6216\u8005\u6b63\u5f0f\u4ea7\u54c1\n", "prefix": "mcu.hardfault"}, "mcu.iomux": {"body": "mcu.iomux(${1:type},${2:channel},${3:value})", "description": "mcu.iomux(type, channel, value) - \u5728\u5916\u8bbe\u6253\u5f00\u524d\uff0c\u5c06\u5916\u8bbeIO\u590d\u7528\u5230\u975e\u9ed8\u8ba4\u914d\u7f6e\u4e0a\uff0c\u76ee\u524d\u53ea\u652f\u6301Air780E\u7684\u90e8\u5206\u5916\u8bbe\u590d\u7528\u5230\u5176\u4ed6\u914d\u7f6e\uff0c\u8fd9\u662f\u4e00\u4e2a\u4e34\u65f6\u63a5\u53e3\uff0c\u5982\u679c\u540e\u7eed\u6709\u66f4\u5408\u9002\u7684api\uff0c\u672c\u63a5\u53e3\u5c06\u4e0d\u518d\u66f4\u65b0\n\u4f20\u5165\u503c\uff1a\nint \u5916\u8bbe\u7c7b\u578b\uff0c\u76ee\u524d\u53ea\u6709mcu.UART,mcu.I2C\nint \u603b\u7ebf\u5e8f\u53f7\uff0c0~N\uff0c\nint \u65b0\u7684\u914d\u7f6e\uff0c\u8fd9\u4e2a\u9700\u8981\u6839\u636e\u5177\u4f53\u5e73\u53f0\u51b3\u5b9a\n\u4f8b\u5b50\uff1a\nmcu.iomux(mcu.UART, 2, 1) -- Air780E\u7684UART2\u590d\u7528\u5230gpio12\u548cgpio13(Air780EG\u9ed8\u8ba4\u662f\u8fd9\u4e2a\u590d\u7528\uff0c\u4e0d\u8981\u52a8)\nmcu.iomux(mcu.UART, 2, 2) -- Air780E\u7684UART2\u590d\u7528\u5230gpio6\u548cgpio7\nmcu.iomux(mcu.I2C, 0, 1) -- Air780E\u7684I2C0\u590d\u7528\u5230gpio12\u548cgpio13\nmcu.iomux(mcu.I2C, 0, 2) -- Air780E\u7684I2C0\u590d\u7528\u5230gpio16\u548cgpio17\nmcu.iomux(mcu.I2C, 1, 1) -- Air780E\u7684I2C1\u590d\u7528\u5230gpio4\u548cgpio5\n", "prefix": "mcu.iomux"}, "mcu.altfun": {"body": "mcu.altfun(${1:type},${2:sn},${3:pad_index},${4:alt_fun},${5:is_input})", "description": "mcu.altfun(type, sn, pad_index, alt_fun, is_input) - IO\u5916\u8bbe\u529f\u80fd\u590d\u7528\u9009\u62e9\uff0c\u6ce8\u610f\u666e\u901aMCU\u662f\u4ee5GPIO\u53f7\u4e3a\u5e8f\u53f7\uff0c\u4f46\u662f\u4e13\u7528SOC\uff0c\u6bd4\u5982CAT1\u7684\uff0c\u662f\u4ee5PAD\u53f7\u4e3a\u5e8f\u53f7\u3002\u672c\u51fd\u6570\u4e0d\u662f\u6240\u6709\u5e73\u53f0\u9002\u7528\n\u4f20\u5165\u503c\uff1a\nint \u5916\u8bbe\u7c7b\u578b\uff0c\u76ee\u524d\u6709mcu.UART,mcu.I2C,mcu.SPI,mcu.PWM,mcu.GPIO,mcu.I2S,mcu.LCD,mcu.CAM\uff0c\u5177\u4f53\u9700\u8981\u770b\u5e73\u53f0\nint \u603b\u7ebf\u5e8f\u53f7\uff0c0~N\uff0c\u5982\u679c\u662fmcu.GPIO\uff0c\u5219\u662fGPIO\u53f7\u3002\u5177\u4f53\u770b\u5e73\u53f0\u7684IOMUX\u590d\u7528\u8868\nint pad\u53f7\uff0c\u5982\u679c\u7559\u7a7a\u4e0d\u5199\uff0c\u5219\u8868\u793a\u6e05\u9664\u914d\u7f6e\uff0c\u4f7f\u7528\u5e73\u53f0\u7684\u9ed8\u8ba4\u914d\u7f6e\u3002\u5177\u4f53\u770b\u5e73\u53f0\u7684IOMUX\u590d\u7528\u8868\nint \u590d\u7528\u529f\u80fd\u5e8f\u53f7\uff0c0~N\u3002\u5177\u4f53\u770b\u5e73\u53f0\u7684IOMUX\u590d\u7528\u8868\nboolean \u662f\u5426\u662f\u8f93\u5165\u529f\u80fd\uff0ctrue\u662f\uff0c\u7559\u7a7a\u662ffalse\n\u4f8b\u5b50\uff1a\n-- \u4ee5 Air780EP \u4e3a\u4f8b\n-- \u5c06GPIO46\u6620\u5c04\u5230paddr 32 alt 1\nmcu.altfun(mcu.GPIO, 46, 32, 1, 0)\n-- mcu.altfun(mcu.GPIO, 46) -- \u8fd8\u539f\u6210\u9ed8\u8ba4\u914d\u7f6e\n\n-- UART2\u590d\u7528\u5230paddr 25/26 alt 3\nmcu.altfun(mcu.UART,2, 25, 3, 1)\nmcu.altfun(mcu.UART,2, 26, 3, 0)\n", "prefix": "mcu.altfun"}, "mcu.ticks2": {"body": "mcu.ticks2(${1:mode})", "description": "mcu.ticks2(mode) - \u83b7\u53d6\u9ad8\u7cbe\u5ea6\u7684\u8ba1\u6570\n\u4f20\u5165\u503c\uff1a\nint \u6a21\u5f0f, \u770b\u540e\u9762\u7684\u7528\u6cd5\u8bf4\u660e\n\u8fd4\u56de\u503c\uff1a\nint \u6839\u636emode\u7684\u4e0d\u540c,\u8fd4\u56de\u503c\u7684\u542b\u4e49\u4e0d\u540c\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u4e8e2024.5.7\u65b0\u589e\n-- \u4e0emcu.ticks()\u7684\u533a\u522b\u662f,\u5e95\u5c42\u8ba1\u6570\u5668\u662f64bit\u7684, \u5728\u53ef\u9884\u8ba1\u7684\u5c06\u6765\u4e0d\u4f1a\u6ea2\u51fa\n-- \u6240\u4ee5\u672c\u51fd\u6570\u8fd4\u56de\u7684\u503c\u603b\u662f\u9012\u589e\u7684, \u800c\u4e1432bit\u56fa\u4ef6\u4e5f\u80fd\u5904\u7406\n\n-- \u6a21\u5f0f\u53ef\u9009\u503c \u53ca \u5bf9\u5e94\u7684\u8fd4\u56de\u503c\n-- 0: \u8fd4\u56de\u5fae\u79d2\u6570, \u4ee5\u79d2\u4e3a\u5206\u5272, \u4f8b\u5982 1234567890us \u8fd4\u56de2\u4e2a\u503c: 1234, 567890\n-- 1: \u8fd4\u56de\u6beb\u79d2\u6570, \u4ee5\u5343\u79d2\u4e3a\u5206\u5272, \u4f8b\u5982 1234567890ms \u8fd4\u56de2\u4e2a\u503c: 1234, 567890\n-- 2: \u8fd4\u56de\u79d2\u6570, \u4ee5\u767e\u4e07\u79d2\u4e3a\u5206\u5272, \u4f8b\u5982 1234567890s \u8fd4\u56de2\u4e2a\u503c: 1234, 567890\n\nlocal us_h, us_l = mcu.ticks2(0)\nlocal ms_h, ms_l = mcu.ticks2(1)\nlocal sec_h, sec_l = mcu.ticks2(2)\nlog.info(\"us_h\", us_h, \"us_l\", us_l)\nlog.info(\"ms_h\", ms_h, \"ms_l\", ms_l)\nlog.info(\"sec_h\", sec_h, \"sec_l\", sec_l)\n", "prefix": "mcu.ticks2"}, "mcu.XTALRefOutput": {"body": "mcu.XTALRefOutput(${1:source_main},${2:source_32k})", "description": "mcu.XTALRefOutput(source_main, source_32k) - \u6676\u632f\u53c2\u8003\u65f6\u949f\u8f93\u51fa\n\u4f20\u5165\u503c\uff1a\nboolean \u9ad8\u901f\u6676\u632f\u53c2\u8003\u65f6\u949f\u662f\u5426\u8f93\u51fa\nboolean \u4f4e\u901f32K\u6676\u632f\u53c2\u8003\u65f6\u949f\u662f\u5426\u8f93\u51fa\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u4e8e2024.5.17\u65b0\u589e\n-- \u5f53\u524d\u4ec5Air780EP\u7cfb\u5217\u652f\u6301\nmcu.XTALRefOutput(true, false) --\u9ad8\u901f\u6676\u632f\u53c2\u8003\u65f6\u949f\u8f93\u51fa,\u4f4e\u901f32K\u4e0d\u8f93\u51fa\n", "prefix": "mcu.XTALRefOutput"}, "miniz.compress": {"body": "miniz.compress(${1:data},${2:flags})", "description": "miniz.compress(data, flags) - \u5feb\u901f\u538b\u7f29,\u9700\u8981165kb\u7684\u7cfb\u7edf\u5185\u5b58\u548c32kb\u7684LuaVM\u5185\u5b58\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u538b\u7f29\u7684\u6570\u636e, \u5c11\u4e8e400\u5b57\u8282\u7684\u6570\u636e\u4e0d\u5efa\u8bae\u538b\u7f29, \u4e14\u538b\u7f29\u540e\u7684\u6570\u636e\u4e0d\u80fd\u5927\u4e8e32k.\nflags \u538b\u7f29\u53c2\u6570,\u9ed8\u8ba4\u662f miniz.WRITE_ZLIB_HEADER , \u5373\u5199\u5165zlib\u5934\u90e8\n\u8fd4\u56de\u503c\uff1a\nstring \u82e5\u538b\u7f29\u6210\u529f,\u8fd4\u56de\u6570\u636e\u5b57\u7b26\u4e32, \u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n\nlocal bigdata = \"123jfoiq4hlkfjbnasdilfhuqwo;hfashfp9qw38hrfaios;hfiuoaghfluaeisw\"\nlocal cdata = miniz.compress(bigdata)\nif cdata then\n log.info(\"miniz\", \"before\", #bigdata, \"after\", #cdata)\n log.info(\"miniz\", \"cdata as hex\", cdata:toHex())\nend\n\n", "prefix": "miniz.compress"}, "miniz.uncompress": {"body": "miniz.uncompress(${1:data},${2:flags})", "description": "miniz.uncompress(data, flags) - \u5feb\u901f\u89e3\u538b,\u9700\u898132kb\u7684LuaVM\u5185\u5b58\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u89e3\u538b\u7684\u6570\u636e, \u89e3\u538b\u540e\u7684\u6570\u636e\u4e0d\u80fd\u5927\u4e8e32k\nflags \u89e3\u538b\u53c2\u6570,\u9ed8\u8ba4\u662f miniz.PARSE_ZLIB_HEADER , \u5373\u89e3\u6790zlib\u5934\u90e8\n\u8fd4\u56de\u503c\uff1a\nstring \u82e5\u89e3\u538b\u6210\u529f,\u8fd4\u56de\u6570\u636e\u5b57\u7b26\u4e32, \u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n\nlocal bigdata = \"123jfoiq4hlkfjbnasdilfhuqwo;hfashfp9qw38hrfaios;hfiuoaghfluaeisw\"\nlocal cdata = miniz.compress(bigdata)\nif cdata then\n log.info(\"miniz\", \"before\", #bigdata, \"after\", #cdata)\n log.info(\"miniz\", \"cdata as hex\", cdata:toHex())\n\n local udata = miniz.uncompress(cdata)\n log.info(\"miniz\", \"udata\", udata)\nend\n", "prefix": "miniz.uncompress"}, "mlx90640.init": {"body": "mlx90640.init(${1:i2c_id},${2:refresh_rate)(\u6ce8\u610f:2023.5.15\u4e4b\u540e\u4f7f\u7528\u6b64\u63a5\u53e3},${3:\u7528\u6237\u9700\u8981\u81ea\u884c\u521d\u59cb\u5316i2c\u63a5\u53e3})", "description": "mlx90640.init(i2c_id,refresh_rate) (\u6ce8\u610f:2023.5.15\u4e4b\u540e\u4f7f\u7528\u6b64\u63a5\u53e3,\u7528\u6237\u9700\u8981\u81ea\u884c\u521d\u59cb\u5316i2c\u63a5\u53e3) - \u521d\u59cb\u5316MLX90640\u4f20\u611f\u5668\n\u4f20\u5165\u503c\uff1a\nint \u4f20\u611f\u5668\u6240\u5728\u7684i2c\u603b\u7ebfid\u6216\u8005\u8f6fi2c\u5bf9\u8c61,\u9ed8\u8ba4\u4e3a0\nint \u4f20\u611f\u5668\u7684\u6d4b\u91cf\u901f\u7387,\u9ed8\u8ba4\u4e3a4Hz\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue, \u5426\u5219\u8fd4\u56denil\u6216\u8005false\n\u4f8b\u5b50\uff1a\ni2c.setup(i2cid,i2c_speed)\nif mlx90640.init(0,mlx90640.FPS4HZ) then\n log.info(\"mlx90640\", \"init ok\")\n sys.wait(500) -- \u7a0d\u7b49\u7247\u523b\n while 1 do\n mlx90640.feed() -- \u53d6\u4e00\u5e27\u6570\u636e\n mlx90640.draw2lcd(0, 0 ,1)-- \u9700\u63d0\u524d\u628alcd\u521d\u59cb\u5316\u597d\n sys.wait(250) -- \u9ed8\u8ba4\u662f4HZ\n end\nelse\n log.info(\"mlx90640\", \"init fail\")\nend\n\n", "prefix": "mlx90640.init"}, "mlx90640.feed": {"body": "mlx90640.feed()", "description": "mlx90640.feed() - \u53d6\u4e00\u5e27\u6570\u636e\n", "prefix": "mlx90640.feed"}, "mlx90640.raw_data": {"body": "mlx90640.raw_data()", "description": "mlx90640.raw_data() - \u83b7\u53d6\u5e95\u5c42\u88f8\u6570\u636e,\u6d6e\u70b9\u6570\u77e9\u9635\n\u8fd4\u56de\u503c\uff1a\ntable \u6d6e\u70b9\u6570\u6570\u636e,768\u4e2a\u50cf\u7d20\u5bf9\u5e94\u7684\u6e29\u5ea6\u503c\n", "prefix": "mlx90640.raw_data"}, "mlx90640.raw_point": {"body": "mlx90640.raw_point(${1:index})", "description": "mlx90640.raw_point(index) - \u83b7\u53d6\u5355\u4e00\u70b9\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u7d22\u5f15\u503c(0-767)\n\u8fd4\u56de\u503c\uff1a\nnumber \u5355\u70b9\u6e29\u5ea6\u503c\n", "prefix": "mlx90640.raw_point"}, "mlx90640.ta_temp": {"body": "mlx90640.ta_temp()", "description": "mlx90640.ta_temp() - \u83b7\u53d6\u5916\u58f3\u6e29\u5ea6\n\u8fd4\u56de\u503c\uff1a\nnumber \u5916\u58f3\u6e29\u5ea6\n", "prefix": "mlx90640.ta_temp"}, "mlx90640.max_temp": {"body": "mlx90640.max_temp()", "description": "mlx90640.max_temp() - \u83b7\u53d6\u6700\u9ad8\u6e29\u5ea6\n\u8fd4\u56de\u503c\uff1a\nnumber \u6700\u9ad8\u6e29\u5ea6\nnumber \u6700\u9ad8\u6e29\u5ea6\u4f4d\u7f6e\n", "prefix": "mlx90640.max_temp"}, "mlx90640.min_temp": {"body": "mlx90640.min_temp()", "description": "mlx90640.min_temp() - \u83b7\u53d6\u6700\u4f4e\u6e29\u5ea6\n\u8fd4\u56de\u503c\uff1a\nnumber \u6700\u4f4e\u6e29\u5ea6\nnumber \u6700\u4f4e\u6e29\u5ea6\u4f4d\u7f6e\n", "prefix": "mlx90640.min_temp"}, "mlx90640.average_temp": {"body": "mlx90640.average_temp()", "description": "mlx90640.average_temp() - \u83b7\u53d6\u5e73\u5747\u6e29\u5ea6\n\u8fd4\u56de\u503c\uff1a\nnumber \u5e73\u5747\u6e29\u5ea6\n", "prefix": "mlx90640.average_temp"}, "mlx90640.get_vdd": {"body": "mlx90640.get_vdd()", "description": "mlx90640.get_vdd() - \u83b7\u53d6vdd\n\u8fd4\u56de\u503c\uff1a\nnumber vdd\n", "prefix": "mlx90640.get_vdd"}, "mlx90640.draw2lcd": {"body": "mlx90640.draw2lcd(${1:x},${2:y},${3:fold})", "description": "mlx90640.draw2lcd(x, y, fold) - \u7ed8\u5236\u5230lcd\n\u4f20\u5165\u503c\uff1a\nint \u5de6\u4e0a\u89d2x\u5750\u6807\nint \u5de6\u4e0a\u89d2y\u5750\u6807\nint \u653e\u5927\u500d\u6570,\u5fc5\u987b\u4e3a2\u7684\u6307\u6570\u500d(1,2,4,8,16...)\u9ed8\u8ba4\u4e3a1\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n", "prefix": "mlx90640.draw2lcd"}, "mobile.imei": {"body": "mobile.imei(${1:index})", "description": "mobile.imei(index) - \u83b7\u53d6IMEI\n\u4f20\u5165\u503c\uff1a\nint \u7f16\u53f7,\u9ed8\u8ba40. \u5728\u652f\u6301\u53cc\u5361\u7684\u6a21\u5757\u4e0a\u624d\u4f1a\u51fa\u73b00\u62161\u7684\u60c5\u51b5\n\u8fd4\u56de\u503c\uff1a\nstring \u5f53\u524d\u7684IMEI\u503c,\u82e5\u5931\u8d25\u8fd4\u56denil\n", "prefix": "mobile.imei"}, "mobile.imsi": {"body": "mobile.imsi(${1:index})", "description": "mobile.imsi(index) - \u83b7\u53d6IMSI\n\u4f20\u5165\u503c\uff1a\nint \u7f16\u53f7,\u9ed8\u8ba40. \u5728\u652f\u6301\u53cc\u5361\u7684\u6a21\u5757\u4e0a\u624d\u4f1a\u51fa\u73b00\u62161\u7684\u60c5\u51b5\n\u8fd4\u56de\u503c\uff1a\nstring \u5f53\u524d\u7684IMSI\u503c,\u82e5\u5931\u8d25\u8fd4\u56denil\n", "prefix": "mobile.imsi"}, "mobile.sn": {"body": "mobile.sn()", "description": "mobile.sn() - \u83b7\u53d6SN\n\u8fd4\u56de\u503c\uff1a\nstring \u5f53\u524d\u7684SN\u503c,\u82e5\u5931\u8d25\u8fd4\u56denil. \u6ce8\u610f, SN\u53ef\u80fd\u5305\u542b\u4e0d\u53ef\u89c1\u5b57\u7b26\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f, \u51fa\u5382\u672a\u5fc5\u6709\u5199SN\n-- \u4e00\u822c\u7528\u9014\u7684\u552f\u4e00id, \u53ef\u4ee5\u7528mobile.imei()\u4ee3\u66ff\n-- \u5982\u9700\u8981\u771f\u6b63\u7684\u552f\u4e00ID, \u4f7f\u7528 mcu.unique_id()\n", "prefix": "mobile.sn"}, "mobile.muid": {"body": "mobile.muid()", "description": "mobile.muid() - \u83b7\u53d6MUID\n\u8fd4\u56de\u503c\uff1a\nstring \u5f53\u524d\u7684MUID\u503c,\u82e5\u5931\u8d25\u8fd4\u56denil\n", "prefix": "mobile.muid"}, "mobile.iccid": {"body": "mobile.iccid(${1:id})", "description": "mobile.iccid(id) - \u83b7\u53d6\u6216\u8bbe\u7f6eICCID\n\u4f20\u5165\u503c\uff1a\nint SIM\u5361\u7684\u7f16\u53f7, \u4f8b\u59820, 1, \u9ed8\u8ba40\n\u8fd4\u56de\u503c\uff1a\nstring ICCID\u503c,\u82e5\u5931\u8d25\u8fd4\u56denil\n", "prefix": "mobile.iccid"}, "mobile.number": {"body": "mobile.number(${1:id})", "description": "mobile.number(id) - \u83b7\u53d6\u624b\u673a\u5361\u53f7\uff0c\u6ce8\u610f\uff0c\u53ea\u6709\u5199\u5165\u4e86\u624b\u673a\u53f7\u624d\u80fd\u8bfb\u51fa\uff0c\u56e0\u6b64\u6709\u53ef\u80fd\u8bfb\u51fa\u6765\u662f\u7a7a\u7684\n\u4f20\u5165\u503c\uff1a\nint SIM\u5361\u7684\u7f16\u53f7, \u4f8b\u59820, 1, \u9ed8\u8ba40\n\u8fd4\u56de\u503c\uff1a\nstring number\u503c,\u82e5\u5931\u8d25\u8fd4\u56denil\n", "prefix": "mobile.number"}, "mobile.simid": {"body": "mobile.simid(${1:id})", "description": "mobile.simid(id) - \u83b7\u53d6\u5f53\u524dSIM\u5361\u69fd,\u6216\u8005\u5207\u6362\u5361\u69fd\n\u4f20\u5165\u503c\uff1a\nint SIM\u5361\u7684\u7f16\u53f7, \u4f8b\u59820, 1, \u5982\u679c\u652f\u6301\u53cc\u5361\uff0c\u6bd4\u5982EC618\uff0c\u53ef\u4ee5\u586b2\u6765\u81ea\u9002\u5e94\uff0c\u4f46\u662f\u4f1a\u5360\u7528\u63894\u4e2aIO(gpio4/5/6/23)\u3002\u5982\u679c\u4e0d\u586b\u5c31\u76f4\u63a5\u8bfb\u53d6\u5f53\u524d\u5361\u69fd\nboolean \u662f\u5426\u4f18\u5148\u7528SIM0\uff0c\u53ea\u6709SIM\u5361\u7f16\u53f7\u51992\u81ea\u9002\u5e94\u624d\u6709\u7528\uff01\uff01\uff01\u3002true\u4f18\u5148\u7528SIM0\uff0cfalse\u5219\u7531\u5177\u4f53\u5e73\u53f0\u51b3\u5b9a\uff0c\u652f\u6301\u53cc\u5361\u53cc\u5f85SIM0\u4f18\u5148\uff0c\u4e0d\u652f\u6301\u7684\u662f\u4e0a\u4e00\u6b21\u68c0\u6d4b\u5230\u7684\u4f18\u5148\uff0c\u9ed8\u8ba4\u662ffalse\uff0c\u5fc5\u987b\u5728\u5f00\u673a\u5c31\u914d\u7f6e\uff0c\u5426\u5219\u5c31\u65e0\u6548\u4e86\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524dsim\u5361\u69fd\u7f16\u53f7,\u82e5\u5931\u8d25\u8fd4\u56de-1\n\u4f8b\u5b50\uff1a\nmobile.simid(0) -- \u56fa\u5b9a\u4f7f\u7528SIM0\nmobile.simid(1) -- \u56fa\u4ef6\u4f7f\u7528SIM1\nmobile.simid(2) -- \u81ea\u52a8\u8bc6\u522bSIM0, SIM1, \u4f18\u5148\u7ea7\u770b\u5177\u4f53\u5e73\u53f0\nmobile.simid(2, true) -- -- \u81ea\u52a8\u8bc6\u522bSIM0, SIM1, \u4e14SIM0\u4f18\u5148\n-- \u63d0\u9192, \u81ea\u52a8\u8bc6\u522b\u662f\u4f1a\u589e\u52a0\u65f6\u95f4\u7684\n", "prefix": "mobile.simid"}, "mobile.simPin": {"body": "mobile.simPin(${1:id},${2:operation},${3:pin1},${4:pin2})", "description": "mobile.simPin(id,operation,pin1,pin2) - \u68c0\u6d4b\u5f53\u524dSIM\u5361\u662f\u5426\u51c6\u5907\u597d\uff0c\u5bf9SIM\u5361\u7684PIN\u7801\u505a\u76f8\u5173\u64cd\u4f5c\n\u4f20\u5165\u503c\uff1a\nint SIM\u5361\u7684\u7f16\u53f7, \u4f8b\u59820, 1, \u652f\u6301\u53cc\u5361\u53cc\u5f85\u7684\u624d\u9700\u8981\u9009\u62e9\nint PIN\u7801\u64cd\u4f5c\u7c7b\u578b\uff0c\u53ea\u80fd\u662fmobile.PIN_XXXX\uff0c\u4e0d\u64cd\u4f5c\u5c31\u7559\u7a7a\nstring \u66f4\u6362pin\u65f6\u64cd\u4f5c\u7684pin\u7801\uff0c\u6216\u8005\u9a8c\u8bc1\u64cd\u4f5c\u7684pin\u7801\uff0c\u6216\u8005\u89e3\u9501pin\u7801\u65f6\u7684PUK\uff0c4~8\u5b57\u8282\nstring \u66f4\u6362pin\u7801\u64cd\u4f5c\u65f6\u7684\u65b0\u7684pin\u7801\uff0c\u89e3\u9501pin\u7801\u65f6\u7684\u65b0PIN\uff0c4~8\u5b57\u8282\n\u8fd4\u56de\u503c\uff1a\nboolean \u5f53\u65e0PIN\u64cd\u4f5c\u65f6\uff0c\u8fd4\u56deSIM\u5361\u662f\u5426\u51c6\u5907\u597d\uff0c\u6709PIN\u64cd\u4f5c\u65f6\uff0c\u8fd4\u56de\u662f\u5426\u6210\u529f\n\u4f8b\u5b50\uff1a\nlocal cpin_is_ready = mobile.simPin() -- \u5f53\u524dsim\u5361\u662f\u5426\u51c6\u5907\u597d\uff0c\u4e00\u822c\u8fd4\u56defalse\u5c31\u662f\u6ca1\u5361\nlocal succ = mobile.simPin(0, mobile.PIN_VERIFY, \"1234\") -- \u8f93\u5165pin\u7801\u9a8c\u8bc1\n", "prefix": "mobile.simPin"}, "mobile.rtime": {"body": "mobile.rtime(${1:time},${2:auto_reset_stack},${3:data_first})", "description": "mobile.rtime(time, auto_reset_stack, data_first) - \u8bbe\u7f6eRRC\u81ea\u52a8\u91ca\u653e\u65f6\u95f4\u95f4\u9694\uff0c\u5f53\u5f00\u542f\u65f6\u540e\uff0c\u9047\u5230\u6781\u5f31\u4fe1\u53f7+\u9891\u7e41\u6570\u636e\u64cd\u4f5c\u53ef\u80fd\u4f1a\u5f15\u8d77\u7f51\u7edc\u4e25\u91cd\u6545\u969c\uff0c\u56e0\u6b64\u9700\u8981\u989d\u5916\u8bbe\u7f6e\u81ea\u52a8\u91cd\u542f\u534f\u8bae\u6808\n\u4f20\u5165\u503c\uff1a\nint RRC\u81ea\u52a8\u91ca\u653e\u65f6\u95f4\uff0c\u7b49\u540c\u4e8eAir724\u7684AT+RTIME\uff0c\u5355\u4f4d\u79d2\uff0c\u51990\u6216\u8005\u4e0d\u5199\u5219\u662f\u505c\u7528\uff0c\u4e0d\u8981\u8d85\u8fc720\u79d2\uff0c\u6ca1\u6709\u610f\u4e49\nboolean \u7f51\u7edc\u9047\u5230\u4e25\u91cd\u6545\u969c\u65f6\u5c1d\u8bd5\u81ea\u52a8\u6062\u590d\uff0c\u548c\u98de\u884c\u6a21\u5f0f/SIM\u5361\u5207\u6362\u51b2\u7a81\uff0ctrue\u5f00\u542f\uff0cfalse\u5173\u95ed\uff0c\u7559\u7a7a\u65f6\uff0c\u5982\u679c\u8bbe\u7f6e\u4e86\u65f6\u95f4\u5219\u81ea\u52a8\u5f00\u542f\u3002\u672c\u53c2\u6570\u4e8e2023\u5e749\u670814\u65e5\u5df2\u5e9f\u5f03\nboolean \u662f\u5426\u542f\u7528\u6570\u636e\u4f20\u8f93\u4f18\u5316\uff0ctrue\u542f\u7528\uff0cfalse\u5173\u95ed\uff0c\u7559\u7a7a\u4e3afalse\uff0c\u5f00\u542f\u540e\u5fc5\u987b\u7b49\u5230TCP\u6570\u636eACK\u6216\u8005\u8d85\u65f6\u5931\u8d25\uff0c\u6216\u8005socket CONNECT\u5b8c\u6210\uff08\u65e0\u8bba\u6210\u529f\u6216\u8005\u5931\u8d25\uff09\u624d\u5141\u8bb8RRC\u63d0\u524d\u91ca\u653e\uff0c\u53ef\u80fd\u4f1a\u589e\u52a0\u529f\u8017\u3002\u672c\u53c2\u6570\u4e8e2024\u5e748\u670812\u65e5\u542f\u7528\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nmobile.rtime(3) --\u4e0e\u57fa\u7ad9\u65e0\u6570\u636e\u4ea4\u4e923\u79d2\u540e\u63d0\u524d\u91ca\u653eRRC\nmobile.rtime(3,nil,true) --\u542f\u7528\u6570\u636e\u4f20\u8f93\u4f18\u5316\uff0c\u4e0e\u57fa\u7ad9\u65e0\u6570\u636e\u4ea4\u4e923\u79d2\u540e\uff0c\u63d0\u524d\u91ca\u653eRRC\n", "prefix": "mobile.rtime"}, "mobile.setAuto": {"body": "mobile.setAuto(${1:check_sim_period},${2:get_cell_period},${3:search_cell_time},${4:auto_reset_stack},${5:network_check_period})", "description": "mobile.setAuto(check_sim_period, get_cell_period, search_cell_time, auto_reset_stack, network_check_period) - \u8bbe\u7f6e\u4e00\u4e9b\u8f85\u52a9\u5468\u671f\u6027\u6216\u8005\u81ea\u52a8\u529f\u80fd\uff0c\u76ee\u524d\u652f\u6301SIM\u5361\u6682\u65f6\u8131\u79bb\u540e\u6062\u590d\uff0c\u5468\u671f\u6027\u83b7\u53d6\u5c0f\u533a\u4fe1\u606f\uff0c\u7f51\u7edc\u9047\u5230\u4e25\u91cd\u6545\u969c\u65f6\u5c1d\u8bd5\u81ea\u52a8\u6062\u590d\n\u4f20\u5165\u503c\uff1a\nint SIM\u5361\u81ea\u52a8\u6062\u590d\u65f6\u95f4\uff0c\u5355\u4f4d\u6beb\u79d2\uff0c\u5efa\u8bae5000~10000\uff0c\u548c\u98de\u884c\u6a21\u5f0f/SIM\u5361\u5207\u6362\u51b2\u7a81\uff0c\u4e0d\u80fd\u518d\u540c\u4e00\u65f6\u95f4\u4f7f\u7528\uff0c\u5fc5\u987b\u9519\u5f00\u6267\u884c\u3002\u51990\u6216\u8005\u4e0d\u5199\u5219\u662f\u5173\u95ed\u529f\u80fd\nint \u5468\u671f\u6027\u83b7\u53d6\u5c0f\u533a\u4fe1\u606f\u7684\u65f6\u95f4\u95f4\u9694\uff0c\u5355\u4f4d\u6beb\u79d2\u3002\u83b7\u53d6\u5c0f\u533a\u4fe1\u606f\u4f1a\u589e\u52a0\u90e8\u5206\u529f\u8017\u3002\u51990\u6216\u8005\u4e0d\u5199\u5219\u662f\u5173\u95ed\u529f\u80fd\nint \u6bcf\u6b21\u641c\u7d22\u5c0f\u533a\u65f6\u6700\u5927\u641c\u7d22\u65f6\u95f4\uff0c\u5355\u4f4d\u79d2\u3002\u4e0d\u8981\u8d85\u8fc78\u79d2\nboolean \u7f51\u7edc\u9047\u5230\u4e25\u91cd\u6545\u969c\u65f6\u5c1d\u8bd5\u81ea\u52a8\u6062\u590d\uff0c\u548c\u98de\u884c\u6a21\u5f0f/SIM\u5361\u5207\u6362\u51b2\u7a81\uff0ctrue\u5f00\u542f\uff0cfalse\u5173\u95ed\uff0c\u5f00\u59cb\u72b6\u6001\u662ffalse\uff0c\u7559\u7a7a\u5219\u4e0d\u505a\u6539\u53d8\nint \u8bbe\u7f6e\u5b9a\u65f6\u68c0\u6d4b\u7f51\u7edc\u662f\u5426\u6b63\u5e38\u5e76\u4e14\u5728\u68c0\u6d4b\u5230\u957f\u65f6\u95f4\u65e0\u7f51\u65f6\u901a\u8fc7\u91cd\u542f\u534f\u8bae\u6808\u6765\u6062\u590d\uff0c\u65e0\u7f51\u6062\u590d\u65f6\u957f\uff0c\u5355\u4f4dms\uff0c\u5efa\u8bae60000\u4ee5\u4e0a\uff0c\u4e3a\u7f51\u7edc\u641c\u7d22\u7f51\u7edc\u4fdd\u7559\u8db3\u591f\u7684\u65f6\u95f4\uff0c\u7559\u7a7a\u5219\u4e0d\u505a\u66f4\u6539\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "mobile.setAuto"}, "mobile.apn": {"body": "mobile.apn(${1:index},${2:cid},${3:new_apn_name},${4:user_name},${5:password},${6:ip_type},${7:protocol})", "description": "mobile.apn(index, cid, new_apn_name, user_name, password, ip_type, protocol) - \u83b7\u53d6\u6216\u8bbe\u7f6eAPN\uff0c\u8bbe\u7f6eAPN\u5fc5\u987b\u5728\u5165\u7f51\u524d\u5c31\u8bbe\u7f6e\u597d\uff0c\u6bd4\u5982\u5728SIM\u5361\u8bc6\u522b\u5b8c\u6210\u524d\u5c31\u8bbe\u7f6e\u597d\n\u4f20\u5165\u503c\uff1a\nint \u7f16\u53f7,\u9ed8\u8ba40. \u5728\u652f\u6301\u53cc\u5361\u7684\u6a21\u5757\u4e0a\u624d\u4f1a\u51fa\u73b00\u62161\u7684\u60c5\u51b5\nint cid, \u9ed8\u8ba40\uff0c\u5982\u679c\u8981\u7528\u975e\u9ed8\u8ba4APN\u6765\u6fc0\u6d3b\uff0c\u5fc5\u987b>0\nstring \u65b0\u7684APN,\u4e0d\u586b\u5c31\u662f\u83b7\u53d6APN, \u586b\u4e86\u5c31\u662f\u8bbe\u7f6eAPN, \u662f\u5426\u652f\u6301\u8bbe\u7f6e\u53d6\u51b3\u4e8e\u5e95\u5c42\u5b9e\u73b0\nstring \u65b0\u7684APN\u7684username,\u5982\u679cAPN\u4e0d\u662f\u7a7a,\u90a3\u5fc5\u987b\u586b\u5199,\u5982\u679c\u6ca1\u6709\u7559\u4e2a\u7a7a\u5b57\u7b26\u4e32\"\"\u3002\u5982\u679cAPN\u662f\u7a7a\u7684\uff0c\u90a3\u53ef\u4ee5nil\nstring \u65b0\u7684APN\u7684password,\u5982\u679cAPN\u4e0d\u662f\u7a7a,\u90a3\u5fc5\u987b\u586b\u5199,\u5982\u679c\u6ca1\u6709\u7559\u4e2a\u7a7a\u5b57\u7b26\u4e32\"\"\u3002\u5982\u679cAPN\u662f\u7a7a\u7684\uff0c\u90a3\u53ef\u4ee5nil\nint \u6fc0\u6d3bAPN\u65f6\u7684IP TYPE,1=IPV4 2=IPV6 3=IPV4V6,\u9ed8\u8ba4\u662f1\nint \u6fc0\u6d3bAPN\u65f6,\u5982\u679c\u9700\u8981username\u548cpassword,\u5c31\u8981\u5199\u9274\u6743\u534f\u8bae\u7c7b\u578b,1~3,\u9ed8\u8ba43,\u4ee3\u88681\u548c2\u90fd\u5c1d\u8bd5\u4e00\u4e0b\u3002\u4e0d\u9700\u8981\u9274\u6743\u7684\u51990\nboolean \u662f\u5426\u5220\u9664APN,true\u662f,\u5176\u4ed6\u90fd\u5426,\u53ea\u6709\u53c2\u65703\u65b0\u7684APN\u4e0d\u662fstring\u7684\u65f6\u5019\u624d\u6709\u6548\u679c\n\u8fd4\u56de\u503c\uff1a\nstring \u5982\u679c\u7f51\u7edc\u6ce8\u518c\u6210\u529f\uff0c\u8fd4\u56de\u6ce8\u518c\u7528\u7684APN\u503c\uff0c\u53cd\u4e4b\u662fnil\u3002\u8bbe\u7f6e\u597d\u4e0d\u4f1a\u7acb\u523b\u6709\u8fd4\u56de\u503c\uff0c\u9700\u8981\u7b49\u7f51\u7edc\u6ce8\u518c\u6210\u529f\n\u4f8b\u5b50\uff1a\nmobile.apn(0,1,\"cmiot\",\"\",\"\",nil,0) -- \u79fb\u52a8\u516c\u7f51\u5361\u8bbe\u7f6eAPN\u4e3acmiot,\u4e00\u822c\u4e0d\u7528\u8bbe\u7f6e\nmobile.apn(0,1,\"name\",\"user\",\"password\",nil,3) -- \u4e13\u7f51\u5361\u8bbe\u7f6e\u7684demo\uff0cname\uff0cuser\uff0cpassword\u8054\u7cfb\u5361\u5546\u83b7\u53d6\n", "prefix": "mobile.apn"}, "mobile.ipv6": {"body": "mobile.ipv6(${1:onff})", "description": "mobile.ipv6(onff) - \u662f\u5426\u9ed8\u8ba4\u5f00\u542fIPV6\u529f\u80fd\uff0c\u5fc5\u987b\u5728LTE\u7f51\u7edc\u8fde\u63a5\u524d\u5c31\u8bbe\u7f6e\u597d\n\u4f20\u5165\u503c\uff1a\nboolean \u5f00\u5173 true\u5f00\u542f false \u5173\u95ed\n\u8fd4\u56de\u503c\uff1a\nboolean true \u5f53\u524d\u662f\u5f00\u542f\u7684\uff0cfalse \u5f53\u524d\u662f\u5173\u95ed\u7684\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f, \u5f00\u542fipv6\u540e, \u5f00\u673a\u8054\u7f51\u4f1a\u61622~3\u79d2\n", "prefix": "mobile.ipv6"}, "mobile.csq": {"body": "mobile.csq()", "description": "mobile.csq() - \u83b7\u53d6csq\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524dCSQ\u503c, \u82e5\u5931\u8d25\u8fd4\u56de0. \u8303\u56f4 0 - 31, \u8d8a\u5927\u8d8a\u597d\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f, 4G\u6a21\u5757\u7684CSQ\u503c\u4ec5\u4f9b\u53c2\u8003, rsrp/rsrq\u624d\u662f\u771f\u6b63\u7684\u4fe1\u53f7\u5f3a\u5ea6\u6307\u6807\n", "prefix": "mobile.csq"}, "mobile.rssi": {"body": "mobile.rssi()", "description": "mobile.rssi() - \u83b7\u53d6rssi\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524drssi\u503c,\u82e5\u5931\u8d25\u8fd4\u56de0. \u8303\u56f4 0 \u5230 -114, \u8d8a\u5c0f\u8d8a\u597d\n", "prefix": "mobile.rssi"}, "mobile.rsrp": {"body": "mobile.rsrp()", "description": "mobile.rsrp() - \u83b7\u53d6rsrp,\u53c2\u8003\u4fe1\u53f7\u63a5\u6536\u529f\u7387\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524drsrp\u503c,\u82e5\u5931\u8d25\u8fd4\u56de0. \u53d6\u503c\u8303\u56f4: -44 ~ -140 \uff0c\u503c\u8d8a\u5927\u8d8a\u597d\n", "prefix": "mobile.rsrp"}, "mobile.rsrq": {"body": "mobile.rsrq()", "description": "mobile.rsrq() - \u83b7\u53d6rsrq,\u53c2\u8003\u4fe1\u53f7\u53d1\u9001\u529f\u7387\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524drsrq\u503c,\u82e5\u5931\u8d25\u8fd4\u56de0. \u53d6\u503c\u8303\u56f4: -3 ~ -19.5 \uff0c\u503c\u8d8a\u5927\u8d8a\u597d\n", "prefix": "mobile.rsrq"}, "mobile.snr": {"body": "mobile.snr()", "description": "mobile.snr() - \u83b7\u53d6snr,\u4fe1\u566a\u6bd4\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524dsnq\u503c,\u82e5\u5931\u8d25\u8fd4\u56de0.\u8303\u56f4 0 - 30, \u8d8a\u5927\u8d8a\u597d\n", "prefix": "mobile.snr"}, "mobile.eci": {"body": "mobile.eci()", "description": "mobile.eci() - \u83b7\u53d6\u5f53\u524d\u670d\u52a1\u5c0f\u533a\u7684ECI(E-UTRAN Cell Identifier)\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524deci\u503c,\u82e5\u5931\u8d25\u8fd4\u56de-1\n", "prefix": "mobile.eci"}, "mobile.tac": {"body": "mobile.tac()", "description": "mobile.tac() - \u83b7\u53d6\u5f53\u524d\u670d\u52a1\u5c0f\u533a\u7684TAC\u6216\u8005LAC\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524deci\u503c,\u82e5\u5931\u8d25\u8fd4\u56de-1. \u5982\u679c\u5c1a\u672a\u6ce8\u518c\u5230\u7f51\u7edc,\u4f1a\u8fd4\u56de0\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e 2023.7.9 \u65b0\u589e\n", "prefix": "mobile.tac"}, "mobile.enbid": {"body": "mobile.enbid()", "description": "mobile.enbid() - \u83b7\u53d6\u5f53\u524d\u670d\u52a1\u5c0f\u533a\u7684eNBID(eNodeB Identifier)\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524denbid\u503c,\u82e5\u5931\u8d25\u8fd4\u56de-1\n", "prefix": "mobile.enbid"}, "mobile.scell": {"body": "mobile.scell()", "description": "mobile.scell() - \u83b7\u53d6\u5f53\u524d\u670d\u52a1\u5c0f\u533a\u66f4\u8be6\u7ec6\u7684\u4fe1\u606f\n\u8fd4\u56de\u503c\uff1a\ntable \u670d\u52a1\u5c0f\u533a\u7684\u4fe1\u606f\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e 2024.9.12 \u65b0\u589e\nlog.info(\"cell\", json.encode(mobile.scell()))\n-- \u8fd4\u56de\u503c\u793a\u4f8b\n{\n \"mnc\": 11,\n \"mcc\": 460,\n \"rssi\": -78,\n \"pci\": 115,\n \"rsrp\": -107,\n \"tac\": 30005,\n \"eci\": 124045360,\n \"cid\": 124045360,\n \"rsrq\": -9,\n \"snr\": 15,\n \"earfcn\": 1850\n}\n", "prefix": "mobile.scell"}, "mobile.flymode": {"body": "mobile.flymode(${1:index},${2:enable})", "description": "mobile.flymode(index, enable) - \u8fdb\u51fa\u98de\u884c\u6a21\u5f0f\n\u4f20\u5165\u503c\uff1a\nint \u7f16\u53f7,\u9ed8\u8ba40. \u5728\u652f\u6301\u53cc\u5361\u7684\u6a21\u5757\u4e0a\u624d\u4f1a\u51fa\u73b00\u62161\u7684\u60c5\u51b5\nbool \u662f\u5426\u8bbe\u7f6e\u4e3a\u98de\u884c\u6a21\u5f0f,true\u4e3a\u8bbe\u7f6e, false\u4e3a\u9000\u51fa,\u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nbool \u539f\u98de\u884c\u6a21\u5f0f\u7684\u72b6\u6001\n", "prefix": "mobile.flymode"}, "mobile.syncTime": {"body": "mobile.syncTime(${1:enable})", "description": "mobile.syncTime(enable) - \u914d\u7f6e\u57fa\u7ad9\u540c\u6b65\u65f6\u95f4\u5f00\u5173\uff0c\u9ed8\u8ba4\u5f00\u542f\n\u4f20\u5165\u503c\uff1a\nbool \u5f00\u542f,true\u5f00\u542f, false\u5173\u95ed, nil\u4e0d\u8bbe\u7f6e\n\u8fd4\u56de\u503c\uff1a\nbool \u5f53\u524d\u5f00\u5173\u72b6\u6001\n\u4f8b\u5b50\uff1a\nmobile.syncTime() --\u83b7\u53d6\u5f53\u524d\u5f00\u5173\u72b6\u6001\nmobile.syncTime(false) --\u5173\u95ed\u57fa\u7ad9\u540c\u6b65\u65f6\u95f4\n", "prefix": "mobile.syncTime"}, "mobile.status": {"body": "mobile.status()", "description": "mobile.status() - \u83b7\u53d6\u7f51\u7edc\u72b6\u6001\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524d\u7f51\u7edc\u72b6\u6001\n\u4f8b\u5b50\uff1a\n-- \u72b6\u6001\u63cf\u8ff0\n-- 0:\u7f51\u7edc\u672a\u6ce8\u518c\n-- 1:\u7f51\u7edc\u5df2\u6ce8\u518c\n-- 2:\u6b63\u5728\u641c\u7f51\u4e2d\n-- 3:\u7f51\u7edc\u6ce8\u518c\u88ab\u62d2\u7edd\n-- 4:\u7f51\u7edc\u72b6\u6001\u672a\u77e5\n-- 5:\u6f2b\u6e38,\u4e14\u5df2\u6ce8\u518c\n-- 6:\u4ec5SMS\u53ef\u7528\n-- 7:\u4ec5SMS\u53ef\u7528,\u4e14\u6f2b\u6e38\u72b6\u6001\n-- 8:\u4ec5\u7d27\u6025\u547c\u53eb. \u6ce8\u610f, \u56fd\u5185\u4e0d\u652f\u6301\u6b64\u72b6\u6001,\u6a21\u5757\u4e5f\u4e0d\u652f\u6301\u7d27\u6025\u547c\u53eb\n\n-- \u4e0d\u63a8\u8350\u4f7f\u7528\u672cAPI\u5224\u65ad\u8054\u7f51\u72b6\u6001, \u5efa\u8bae\u4f7f\u7528socket.localIP()\u6765\u5224\u65ad\n", "prefix": "mobile.status"}, "mobile.getCellInfo": {"body": "mobile.getCellInfo()", "description": "mobile.getCellInfo() - \u83b7\u53d6\u57fa\u7ad9\u4fe1\u606f\n\u8fd4\u56de\u503c\uff1a\ntable \u5305\u542b\u57fa\u7ad9\u6570\u636e\u7684\u6570\u7ec4\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f: \u4ece2023.06.20\u5f00\u59cb, \u9700\u8981\u4e3b\u52a8\u8bf7\u6c42\u4e00\u6b21reqCellInfo\u624d\u4f1a\u6709\u57fa\u7ad9\u6570\u636e.\n\n--\u793a\u4f8b\u8f93\u51fa(\u539f\u59cb\u6570\u636e\u662ftable, \u4e0b\u9762\u662fjson\u683c\u5f0f\u5316\u540e\u7684\u5185\u5bb9)\n--[[\n[\n {\"rsrq\":-10,\"rssi\":-55,\"cid\":124045360,\"mnc\":17,\"pci\":115,\"earfcn\":1850,\"snr\":15,\"rsrp\":-85,\"mcc\":1120,\"tdd\":0},\n {\"pci\":388,\"rsrq\":-11,\"mnc\":17,\"earfcn\":2452,\"snr\":5,\"rsrp\":-67,\"mcc\":1120,\"cid\":124045331},\n {\"pci\":100,\"rsrq\":-9,\"mnc\":17,\"earfcn\":75,\"snr\":17,\"rsrp\":-109,\"mcc\":1120,\"cid\":227096712}\n]\n]]\n\nmobile.reqCellInfo(60)\n-- \u8ba2\u9605\nsys.subscribe(\"CELL_INFO_UPDATE\", function()\n log.info(\"cell\", json.encode(mobile.getCellInfo()))\nend)\n\n-- \u5b9a\u671f\u8f6e\u8bad\u5f0f\nsys.taskInit(function()\n sys.wait(3000)\n while 1 do\n mobile.reqCellInfo(15)\n sys.waitUntil(\"CELL_INFO_UPDATE\", 15000)\n log.info(\"cell\", json.encode(mobile.getCellInfo()))\n end\nend)\n", "prefix": "mobile.getCellInfo"}, "mobile.reqCellInfo": {"body": "mobile.reqCellInfo(${1:timeout})", "description": "mobile.reqCellInfo(timeout) - \u53d1\u8d77\u57fa\u7ad9\u4fe1\u606f\u67e5\u8be2,\u542b\u4e34\u8fd1\u5c0f\u533a\n\u4f20\u5165\u503c\uff1a\nint \u8d85\u65f6\u65f6\u957f,\u5355\u4f4d\u79d2,\u9ed8\u8ba415. \u6700\u5c115, \u6700\u9ad860\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003 mobile.getCellInfo \u51fd\u6570\n", "prefix": "mobile.reqCellInfo"}, "mobile.lockCell": {"body": "mobile.lockCell(${1:mode},${2:earfcn},${3:pci})", "description": "mobile.lockCell(mode, earfcn, pci) - \u9501\u5b9a/\u89e3\u9501\u5c0f\u533a\uff0c\u4ec5\u7528\u4e8e\u5916\u573a\u6d4b\u8bd5\uff0c\u6ca1\u63a5\u89e6\u8fc7\u7684\uff0c\u6216\u8005\u751f\u4ea7\u73af\u5883\u4e2d\u8bf7\u52ff\u4f7f\u7528\n\u4f20\u5165\u503c\uff1a\nint \u64cd\u4f5c\u7801 0\u5220\u9664\u4f18\u5148\u7684\u9891\u70b9\uff0c1\u8bbe\u7f6e\u4f18\u5148\u9891\u70b9\uff0c2\u9501\u5b9a\u5c0f\u533a\uff0c3\u89e3\u9501\u5c0f\u533a\nint \u4e0b\u884c\u9891\u70b9\nint phycellid\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529ftrue \u5931\u8d25false\n\u4f8b\u5b50\uff1a\nmobile.lockCell(2,1860,32) --\u9501\u5b9a\u5c0f\u533a\nmobile.lockCell(3) --\u89e3\u9501\u5c0f\u533a\n", "prefix": "mobile.lockCell"}, "mobile.reset": {"body": "mobile.reset()", "description": "mobile.reset() - \u91cd\u542f\u534f\u8bae\u6808\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u91cd\u542fLTE\u534f\u8bae\u6808\nmobile.reset()\n", "prefix": "mobile.reset"}, "mobile.dataTraffic": {"body": "mobile.dataTraffic(${1:clearUplink},${2:clearDownlink})", "description": "mobile.dataTraffic(clearUplink, clearDownlink) - \u6570\u636e\u91cf\u6d41\u91cf\u5904\u7406\n\u4f20\u5165\u503c\uff1a\nboolean \u6e05\u7a7a\u4e0a\u884c\u6d41\u91cf\u7d2f\u8ba1\u503c\uff0ctrue\u6e05\u7a7a\uff0c\u5176\u4ed6\u5ffd\u7565\nboolean \u6e05\u7a7a\u4e0b\u884c\u6d41\u91cf\u7d2f\u8ba1\u503c\uff0ctrue\u6e05\u7a7a\uff0c\u5176\u4ed6\u5ffd\u7565\n\u8fd4\u56de\u503c\uff1a\nint \u4e0a\u884c\u6d41\u91cfGB\nint \u4e0a\u884c\u6d41\u91cfB\nint \u4e0b\u884c\u6d41\u91cfGB\nint \u4e0b\u884c\u6d41\u91cfB\n\u4f8b\u5b50\uff1a\n-- \u83b7\u53d6\u4e0a\u4e0b\u884c\u6d41\u91cf\u7d2f\u8ba1\u503c\n-- \u4e0a\u884c\u6d41\u91cf\u503cByte = uplinkGB * 1024 * 1024 * 1024 + uplinkB\n-- \u4e0b\u884c\u6d41\u91cf\u503cByte = downlinkGB * 1024 * 1024 * 1024 + downlinkB\nlocal uplinkGB, uplinkB, downlinkGB, downlinkB = mobile.dataTraffic()\n\n-- \u6e05\u7a7a\u4e0a\u4e0b\u884c\u6d41\u91cf\u7d2f\u8ba1\u503c\nmobile.dataTraffic(true, true)\n\n-- \u4ec5\u8bb0\u5f55\u5f00\u673a\u540e\u7684\u6d41\u91cf,\u590d\u4f4d/\u91cd\u542f\u4f1a\u5f52\u96f6\n", "prefix": "mobile.dataTraffic"}, "mobile.config": {"body": "mobile.config(${1:item},${2:value})", "description": "mobile.config(item, value) - \u7f51\u7edc\u7279\u6b8a\u914d\u7f6e\n\u4f20\u5165\u503c\uff1a\nint \u914d\u7f6e\u9879\u76ee\uff0c\u770bmobile.CONF_XXX\nint \u914d\u7f6e\u503c,\u6839\u636e\u5177\u4f53\u914d\u7f6e\u7684item\u51b3\u5b9a\n\u8fd4\u56de\u503c\uff1a\nboolean \u662f\u5426\u6210\u529f\n\u4f8b\u5b50\uff1a\n--\u9488\u5bf9\u4e0d\u540c\u5e73\u53f0\u6709\u4e0d\u540c\u7684\u914d\u7f6e\uff0c\u8c28\u614e\u4f7f\u7528\uff0c\u76ee\u524d\u53ea\u6709EC618/EC718\u7cfb\u5217\n\n-- EC618\u914d\u7f6e\u5c0f\u533a\u91cd\u9009\u4fe1\u53f7\u5dee\u503c\u95e8\u9650\uff0c\u4e0d\u80fd\u5927\u4e8e15dbm\uff0c\u5fc5\u987b\u5728\u98de\u884c\u6a21\u5f0f\u4e0b\u624d\u80fd\u7528\nmobile.flymode(0,true)\nmobile.config(mobile.CONF_RESELTOWEAKNCELL, 15)\nmobile.config(mobile.CONF_STATICCONFIG, 1) --\u5f00\u542f\u7f51\u7edc\u9759\u6001\u4f18\u5316\nmobile.flymode(0,false)\n\n-- EC618\u8bbe\u7f6eSIM\u5199\u5165\u6b21\u6570\u7684\u7edf\u8ba1\n-- \u5173\u95ed\u7edf\u8ba1\nmobile.config(mobile.CONF_SIM_WC_MODE, 0)\n-- \u5f00\u542f\u7edf\u8ba1, \u9ed8\u8ba4\u4e5f\u662f\u5f00\u542f\u7684.\nmobile.config(mobile.CONF_SIM_WC_MODE, 1)\n-- \u8bfb\u53d6\u7edf\u8ba1\u503c,\u5f02\u6b65, \u9700\u8981\u901a\u8fc7\u7cfb\u7edf\u6d88\u606fSIM_IND\u83b7\u53d6\nsys.subscribe(\"SIM_IND\", function(stats, value)\n log.info(\"SIM_IND\", stats)\n if stats == \"SIM_WC\" then\n log.info(\"sim\", \"write counter\", value)\n end\nend)\nmobile.config(mobile.CONF_SIM_WC_MODE, 2)\n-- \u6e05\u7a7a\u7edf\u8ba1\u503c\nmobile.config(mobile.CONF_SIM_WC_MODE, 3)\n", "prefix": "mobile.config"}, "mobile.getBand": {"body": "mobile.getBand(${1:band},${2:is_default})", "description": "mobile.getBand(band, is_default) - \u83b7\u53d6\u5f53\u524d\u4f7f\u7528/\u652f\u6301\u7684band\n\u4f20\u5165\u503c\uff1a\nzbuff \u8f93\u51faband\nboolean true\u9ed8\u8ba4\u652f\u6301\uff0cfalse\u5f53\u524d\u652f\u6301\u7684\uff0c\u9ed8\u8ba4\u662ffalse\uff0c\u5f53\u524d\u662f\u9884\u7559\u529f\u80fd\uff0c\u4e0d\u8981\u5199true\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue\uff0c\u5931\u8d25\u653e\u56defalse\n\u4f8b\u5b50\uff1a\nlocal buff = zbuff.create(40)\nmobile.getBand(buff) --\u8f93\u51fa\u5f53\u524d\u4f7f\u7528\u7684band\uff0cband\u53f7\u653e\u5728buff\u5185\uff0cbuff[0]\uff0cbuff[1]\uff0cbuff[2] .. buff[buff:used() - 1]\n", "prefix": "mobile.getBand"}, "mobile.setBand": {"body": "mobile.setBand(${1:band},${2:num})", "description": "mobile.setBand(band, num) - \u8bbe\u7f6e\u4f7f\u7528\u7684band\n\u4f20\u5165\u503c\uff1a\nzbuff \u8f93\u5165\u4f7f\u7528\u7684band\nint band\u6570\u91cf\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue\uff0c\u5931\u8d25\u653e\u56defalse\n\u4f8b\u5b50\uff1a\nlocal buff = zbuff.create(40)\nbuff[0] = 3\nbuff[1] = 5\nbuff[2] = 8\nbuff[3] = 40\nmobile.setBand(buff, 4) --\u8bbe\u7f6e\u4f7f\u7528\u7684band\u4e00\u51714\u4e2a\uff0c\u4e3a3,5,8,40\n", "prefix": "mobile.setBand"}, "mobile.nstOnOff": {"body": "mobile.nstOnOff(${1:onoff},${2:uart_id})", "description": "mobile.nstOnOff(onoff, uart_id) - RF\u6d4b\u8bd5\u5f00\u5173\u548c\u914d\u7f6e\n\u4f20\u5165\u503c\uff1a\nboolean true\u5f00\u542f\u6d4b\u8bd5\u6a21\u5f0f\uff0cfalse\u5173\u95ed\nint \u4e32\u53e3\u53f7\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nmobile.nstOnOff(true, uart.VUART_0) --\u6253\u5f00\u6d4b\u8bd5\u6a21\u5f0f\uff0c\u5e76\u4e14\u7528\u865a\u62df\u4e32\u53e3\u53d1\u9001\u7ed3\u679c\nmobile.nstOnOff(false) --\u5173\u95ed\u6d4b\u8bd5\u6a21\u5f0f\n", "prefix": "mobile.nstOnOff"}, "mobile.nstInput": {"body": "mobile.nstInput(${1:data})", "description": "mobile.nstInput(data) - RF\u6d4b\u8bd5\u6570\u636e\u8f93\u5165\n\u4f20\u5165\u503c\uff1a\nstring or zbuff \u7528\u6237\u4ece\u4e32\u53e3\u83b7\u53d6\u7684\u6570\u636e\uff0c\u6ce8\u610f\uff0c\u5f53\u83b7\u53d6\u5b8c\u6240\u6709\u6570\u636e\u540e\uff0c\u9700\u8981\u518d\u4f20\u4e00\u4e2anil\u6765\u4f5c\u4e3a\u4f20\u8f93\u7ed3\u675f\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nmobile.nstInput(uart_data)\nmobile.nstInput(nil)\n", "prefix": "mobile.nstInput"}, "mobile.vsimInit": {"body": "mobile.vsimInit()", "description": "mobile.vsimInit() - \u521d\u59cb\u5316\u5185\u7f6e\u9ed8\u8ba4\u865a\u62df\u5361\u529f\u80fd(\u4e0d\u53ef\u7528)\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nmobile.vsimInit()\n", "prefix": "mobile.vsimInit"}, "mobile.vsimOnOff": {"body": "mobile.vsimOnOff(${1:enable})", "description": "mobile.vsimOnOff(enable) - \u5207\u6362\u5185\u7f6e\u865a\u62df\u5361\u548c\u5916\u7f6e\u5b9e\u4f53\u5361\uff0c2024\u5e748\u670813\u65e5\u542f\u7528\uff0c\u865a\u62df\u5361\u9700\u8981\u56fa\u4ef6\u652f\u6301\uff0c\u5426\u5219\u5207\u6362\u540e\u65e0\u7f51\u7edc\uff0c\u9700\u8981\u5728\u98de\u884c\u6a21\u5f0f\u4e0b\u5207\u6362\uff0c\u6216\u8005\u5207\u6362\u540e\u91cd\u542f\u534f\u8bae\u6808\n\u4f20\u5165\u503c\uff1a\nbool \u5f00\u542f,true\u5f00\u542f, false\u5173\u95ed\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nmobile.vsimOnOff(true) --\u4f7f\u7528\u5185\u7f6e\u865a\u62df\u5361\nmobile.vsimOnOff(false) --\u4f7f\u7528\u5916\u7f6e\u5b9e\u4f53\u5361\n", "prefix": "mobile.vsimOnOff"}, "mobile.apnTableInit": {"body": "mobile.apnTableInit()", "description": "mobile.apnTableInit() - \u521d\u59cb\u5316\u81ea\u5b9a\u4e49APN\u5217\u8868\uff0c\u4e3b\u8981\u7528\u4e8e\u6d77\u5916SIM\u5361\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nmobile.apnTableInit()\n", "prefix": "mobile.apnTableInit"}, "mobile.apnTableAdd": {"body": "mobile.apnTableAdd(${1:mcc},${2:mnc},${3:ip_type},${4:protocol},${5:apn_name},${6:user_name},${7:password})", "description": "mobile.apnTableAdd(mcc, mnc, ip_type, protocol, apn_name, user_name, password) - \u5f80\u81ea\u5b9a\u4e49APN\u5217\u8868\u6dfb\u52a0\u4e00\u6761APN\u4fe1\u606f\uff0c\u4e3b\u8981\u7528\u4e8e\u6d77\u5916SIM\u5361\n\u4f20\u5165\u503c\uff1a\nint MCC\u7801,16\u8fdb\u5236BCD\u7801\nint MNC\u7801,16\u8fdb\u5236BCD\u7801\nint \u6fc0\u6d3bAPN\u65f6\u7684IP TYPE,1=IPV4 2=IPV6 3=IPV4V6,\u9ed8\u8ba4\u662f1\nint \u6fc0\u6d3bAPN\u65f6,\u5982\u679c\u9700\u8981username\u548cpassword,\u5c31\u8981\u5199\u9274\u6743\u534f\u8bae\u7c7b\u578b,1~3,\u9ed8\u8ba43,\u4ee3\u88681\u548c2\u90fd\u5c1d\u8bd5\u4e00\u4e0b\u3002\u4e0d\u9700\u8981\u9274\u6743\u7684\u51990\nstring APN name,\u4e0d\u80fd\u4e3a\u7a7a\nstring APN\u7684username\nstring APN\u7684password\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nmobile.apnTableInit() -- \u5148\u521d\u59cb\u5316\uff0c\u5fc5\u987b\u653e\u5728SIM\u5361\u8bc6\u522b\u5b8c\u6210\u524d\u52a0\u5165\uff0c\u6700\u597d\u5c31\u662f\u5199\u5728\u5f00\u5934\nmobile.apnTableAdd(0x460,0x00,3,0,\"cmiot\",\"\",\"\") -- \u5355\u72ec\u6dfb\u52a0\u4e00\u6761APN\u4fe1\u606f\uff0c\u5fc5\u987b\u653e\u5728SIM\u5361\u8bc6\u522b\u5b8c\u6210\u524d\u52a0\u5165\uff0c\u6700\u597d\u5c31\u662f\u5199\u5728\u5f00\u5934\uff0c\u79fb\u52a8\u516c\u7f51\u5361\u8bbe\u7f6eAPN\u4e3acmiot\uff08\u4e00\u822c\u4e0d\u7528\u8bbe\u7f6e\uff0c\u8fd9\u91cc\u53ea\u662f\u4e3e\u4e2a\u4f8b\u5b50\uff09\n\n", "prefix": "mobile.apnTableAdd"}, "mobile.apnTablePrint": {"body": "mobile.apnTablePrint(${1:mcc},${2:mnc})", "description": "mobile.apnTablePrint(mcc, mnc) - \u6253\u5370\u81ea\u5b9a\u4e49APN\u5217\u8868\u91cc\u7684\u4e00\u6761\u4fe1\u606f\uff0c\u5728\u6ca1\u6709\u62ff\u5230\u5361\u7684\u60c5\u51b5\u4e0b\uff0c\u6d4b\u8bd5\u4e00\u4e0b\u5bf9\u5e94\u7684APN\u4fe1\u606f\u662f\u5426\u548c\u8fd0\u8425\u5546\u63d0\u4f9b\u7684\u5339\u914d\n\u4f20\u5165\u503c\uff1a\nint MCC\u7801,16\u8fdb\u5236BCD\u7801\nint MNC\u7801,16\u8fdb\u5236BCD\u7801\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nmobile.apnTableInit()\nmobile.apnTablePrint(0x202, 0x01)\n", "prefix": "mobile.apnTablePrint"}, "mqttc:subscribe": {"body": "mqttc:subscribe(${1:topic},${2:qos})", "description": "mqttc:subscribe(topic, qos) - \u8ba2\u9605\u4e3b\u9898\n\u4f20\u5165\u503c\uff1a\nstring/table \u4e3b\u9898\nint topic\u4e3astring\u65f6\u751f\u6548 0/1/2 \u9ed8\u8ba40\n\u8fd4\u56de\u503c\uff1a\nint \u6d88\u606fid,\u5f53qos\u4e3a1/2\u65f6\u6709\u6548, \u82e5\u5e95\u5c42\u8fd4\u56de\u5931\u8d25,\u4f1a\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u8ba2\u9605\u5355\u4e2atopic, \u4e14qos=0\nmqttc:subscribe(\"/luatos/123456\", 0)\n-- \u8ba2\u9605\u5355\u4e2atopic, \u4e14qos=1\nmqttc:subscribe(\"/luatos/12345678\", 1)\n-- \u8ba2\u9605\u591a\u4e2atopic, \u4e14\u4f7f\u7528\u4e0d\u540c\u7684qos\nmqttc:subscribe({[\"/luatos/1234567\"]=1,[\"/luatos/12345678\"]=2})\n", "prefix": "mqttc:subscribe"}, "mqttc:unsubscribe": {"body": "mqttc:unsubscribe(${1:topic})", "description": "mqttc:unsubscribe(topic) - \u53d6\u6d88\u8ba2\u9605\u4e3b\u9898\n\u4f20\u5165\u503c\uff1a\nstring/table \u4e3b\u9898\n\u4f8b\u5b50\uff1a\nmqttc:unsubscribe(\"/luatos/123456\")\nmqttc:unsubscribe({\"/luatos/1234567\",\"/luatos/12345678\"})\n", "prefix": "mqttc:unsubscribe"}, "mqttc:debug": {"body": "mqttc:debug(${1:onoff})", "description": "mqttc:debug(onoff) - \u914d\u7f6e\u662f\u5426\u6253\u5f00debug\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nboolean \u662f\u5426\u6253\u5f00debug\u5f00\u5173\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "mqttc:debug"}, "mqtt.create": {"body": "mqtt.create(${1:adapter},${2:host},${3:port},${4:ssl},${5:isipv6})", "description": "mqtt.create(adapter,host,port,ssl,isipv6) - mqtt\u5ba2\u6237\u7aef\u521b\u5efa\n\u4f20\u5165\u503c\uff1a\nint \u9002\u914d\u5668\u5e8f\u53f7, \u53ea\u80fd\u662fsocket.ETH0, socket.STA, socket.AP,\u5982\u679c\u4e0d\u586b,\u4f1a\u9009\u62e9\u5e73\u53f0\u81ea\u5e26\u7684\u65b9\u5f0f,\u7136\u540e\u662f\u6700\u540e\u4e00\u4e2a\u6ce8\u518c\u7684\u9002\u914d\u5668\nstring \u670d\u52a1\u5668\u5730\u5740,\u53ef\u4ee5\u662f\u57df\u540d, \u4e5f\u53ef\u4ee5\u662fip\nint \u7aef\u53e3\u53f7\nbool/table \u662f\u5426\u4e3assl\u52a0\u5bc6\u8fde\u63a5,\u9ed8\u8ba4\u4e0d\u52a0\u5bc6,true\u4e3a\u65e0\u8bc1\u4e66\u6700\u7b80\u5355\u7684\u52a0\u5bc6\uff0ctable\u4e3a\u6709\u8bc1\u4e66\u7684\u52a0\u5bc6
server_cert \u670d\u52a1\u5668ca\u8bc1\u4e66\u6570\u636e
client_cert \u5ba2\u6237\u7aef\u8bc1\u4e66\u6570\u636e
client_key \u5ba2\u6237\u7aef\u79c1\u94a5\u52a0\u5bc6\u6570\u636e
client_password \u5ba2\u6237\u7aef\u79c1\u94a5\u53e3\u4ee4\u6570\u636e
verify \u662f\u5426\u5f3a\u5236\u6821\u9a8c 0\u4e0d\u6821\u9a8c/1\u53ef\u9009\u6821\u9a8c/2\u5f3a\u5236\u6821\u9a8c \u9ed8\u8ba42\nbool/table bool \u662f\u5426\u4e3aipv6\uff0c\u9ed8\u8ba4\u4e0d\u662f table mqtt\u6269\u5c55\u53c2\u6570, ipv6 \u662f\u5426\u4e3aipv6, rxSize \u63a5\u6536\u7f13\u51b2\u533a\u5927\u5c0f\n\u8fd4\u56de\u503c\uff1a\nuserdata \u82e5\u6210\u529f\u4f1a\u8fd4\u56demqtt\u5ba2\u6237\u7aef\u5b9e\u4f8b,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u666e\u901aTCP\u94fe\u63a5\nmqttc = mqtt.create(nil,\"120.55.137.106\", 1884)\n-- \u666e\u901aTCP\u94fe\u63a5,mqtt\u63a5\u6536\u7f13\u51b2\u533a4096\nmqttc = mqtt.create(nil,\"120.55.137.106\", 1884, nil, {rxSize = 4096})\n-- \u52a0\u5bc6TCP\u94fe\u63a5,\u4e0d\u9a8c\u8bc1\u670d\u52a1\u5668\u8bc1\u4e66\nmqttc = mqtt.create(nil,\"120.55.137.106\", 8883, true)\n-- \u52a0\u5bc6TCPTCP\u94fe\u63a5,\u5355\u670d\u52a1\u5668\u8bc1\u4e66\u9a8c\u8bc1\nmqttc = mqtt.create(nil,\"120.55.137.106\", 8883, {server_cert=io.readFile(\"/luadb/ca.crt\")})\n-- \u52a0\u5bc6TCPTCP\u94fe\u63a5,\u5355\u670d\u52a1\u5668\u8bc1\u4e66\u9a8c\u8bc1, \u4f46\u53ef\u9009\u8ba4\u8bc1\nmqttc = mqtt.create(nil,\"120.55.137.106\", 8883, {server_cert=io.readFile(\"/luadb/ca.crt\"), verify=1})\n-- \u52a0\u5bc6TCPTCP\u94fe\u63a5,\u53cc\u5411\u8bc1\u4e66\u9a8c\u8bc1\nmqttc = mqtt.create(nil,\"120.55.137.106\", 8883, {\n server_cert=io.readFile(\"/luadb/ca.crt\"),\n client_cert=io.readFile(\"/luadb/client.pem\"),\n client_key=\"123456\",\n client_password=\"123456\",\n })\n", "prefix": "mqtt.create"}, "mqttc:auth": {"body": "mqttc:auth(${1:client_id},${2:username},${3:password},${4:cleanSession})", "description": "mqttc:auth(client_id,username,password,cleanSession) - mqtt\u4e09\u5143\u7ec4\u914d\u7f6e\u53cacleanSession\n\u4f20\u5165\u503c\uff1a\nstring \u8bbe\u5907\u8bc6\u522bid,\u5bf9\u4e8e\u540c\u4e00\u4e2amqtt\u670d\u52a1\u5668\u6765\u8bf4, \u901a\u5e38\u8981\u6c42\u552f\u4e00,\u76f8\u540cclient_id\u4f1a\u4e92\u76f8\u8e22\u4e0b\u7ebf\nstring \u8d26\u53f7 \u53ef\u9009\nstring \u5bc6\u7801 \u53ef\u9009\nbool \u6e05\u9664session,\u9ed8\u8ba4true,\u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u65e0\u8d26\u53f7\u5bc6\u7801\u767b\u5f55,\u4ec5clientId\nmqttc:auth(\"123456789\")\n-- \u5e26\u8d26\u53f7\u5bc6\u7801\u767b\u5f55\nmqttc:auth(\"123456789\",\"username\",\"password\")\n-- \u989d\u5916\u914d\u7f6ecleanSession,\u4e0d\u6e05\u9664\nmqttc:auth(\"123456789\",\"username\",\"password\", false)\n-- \u65e0clientId\u6a21\u5f0f, \u670d\u52a1\u5668\u968f\u673a\u751f\u6210id, cleanSession\u4e0d\u53ef\u914d\u7f6e\nmqttc:auth()\n", "prefix": "mqttc:auth"}, "mqttc:keepalive": {"body": "mqttc:keepalive(${1:time})", "description": "mqttc:keepalive(time) - mqtt\u5fc3\u8df3\u8bbe\u7f6e\n\u4f20\u5165\u503c\uff1a\nint \u53ef\u9009 \u5355\u4f4ds \u9ed8\u8ba4240s. \u6700\u514815,\u6700\u9ad8600\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nmqttc:keepalive(30)\n", "prefix": "mqttc:keepalive"}, "mqttc:on": {"body": "mqttc:on(${1:cb})", "description": "mqttc:on(cb) - \u6ce8\u518cmqtt\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nfunction cb mqtt\u56de\u8c03,\u53c2\u6570\u5305\u62ecmqtt_client, event, data, payload\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nmqttc:on(function(mqtt_client, event, data, payload, metas)\n -- \u7528\u6237\u81ea\u5b9a\u4e49\u4ee3\u7801\n log.info(\"mqtt\", \"event\", event, mqtt_client, data, payload)\nend)\n--[[\nevent\u53ef\u80fd\u51fa\u73b0\u7684\u503c\u6709\n conack -- \u670d\u52a1\u5668\u9274\u6743\u5b8c\u6210,mqtt\u8fde\u63a5\u5df2\u7ecf\u5efa\u7acb, \u53ef\u4ee5\u8ba2\u9605\u548c\u53d1\u5e03\u6570\u636e\u4e86,\u6ca1\u6709\u9644\u52a0\u6570\u636e\n recv -- \u63a5\u6536\u5230\u6570\u636e,\u7531\u670d\u52a1\u5668\u4e0b\u53d1, data\u4e3atopic\u503c(string), payload\u4e3a\u4e1a\u52a1\u6570\u636e(string).metas\u662f\u5143\u6570\u636e(table), \u4e00\u822c\u4e0d\u5904\u7406. \n -- metas\u5305\u542b\u4ee5\u4e0b\u5185\u5bb9\n -- qos \u53d6\u503c\u8303\u56f40,1,2\n -- retain \u53d6\u503c\u8303\u56f4 0,1\n -- dup \u53d6\u503c\u8303\u56f4 0,1\n sent -- \u53d1\u9001\u5b8c\u6210, qos0\u4f1a\u9a6c\u4e0a\u901a\u77e5, qos1/qos2\u4f1a\u5728\u670d\u52a1\u5668\u5e94\u7b54\u4f1a\u56de\u8c03, data\u4e3a\u6d88\u606fid\n disconnect -- \u670d\u52a1\u5668\u65ad\u5f00\u8fde\u63a5,\u7f51\u7edc\u95ee\u9898\u6216\u670d\u52a1\u5668\u8e22\u4e86\u5ba2\u6237\u7aef,\u4f8b\u5982clientId\u91cd\u590d,\u8d85\u65f6\u672a\u4e0a\u62a5\u4e1a\u52a1\u6570\u636e\n pong -- \u6536\u5230\u670d\u52a1\u5668\u5fc3\u8df3\u5e94\u7b54,\u6ca1\u6709\u9644\u52a0\u6570\u636e\n]]\n", "prefix": "mqttc:on"}, "mqttc:connect": {"body": "mqttc:connect()", "description": "mqttc:connect() - \u8fde\u63a5\u670d\u52a1\u5668\n\u8fd4\u56de\u503c\uff1a\nboolean \u53d1\u8d77\u6210\u529f\u8fd4\u56detrue, \u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u5f00\u59cb\u5efa\u7acb\u8fde\u63a5\nmqttc:connect()\n-- \u672c\u51fd\u6570\u4ec5\u4ee3\u8868\u53d1\u8d77\u6210\u529f, \u540e\u7eed\u4ecd\u9700\u6839\u636eready\u51fd\u6570\u5224\u65admqtt\u662f\u5426\u8fde\u63a5\u6b63\u5e38\n", "prefix": "mqttc:connect"}, "mqttc:disconnect": {"body": "mqttc:disconnect()", "description": "mqttc:disconnect() - \u65ad\u5f00\u670d\u52a1\u5668\u8fde\u63a5(\u4e0d\u4f1a\u91ca\u653e\u8d44\u6e90)\n\u8fd4\u56de\u503c\uff1a\nboolean \u53d1\u8d77\u6210\u529f\u8fd4\u56detrue, \u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u65ad\u5f00\u8fde\u63a5\nmqttc:disconnect()\n", "prefix": "mqttc:disconnect"}, "mqttc:autoreconn": {"body": "mqttc:autoreconn(${1:reconnect},${2:reconnect_time})", "description": "mqttc:autoreconn(reconnect, reconnect_time) - \u81ea\u52a8\u91cd\u8fde\n\u4f20\u5165\u503c\uff1a\nbool \u662f\u5426\u81ea\u52a8\u91cd\u8fde\nint \u81ea\u52a8\u91cd\u8fde\u5468\u671f \u5355\u4f4dms \u9ed8\u8ba43000ms\n\u4f8b\u5b50\uff1a\nmqttc:autoreconn(true)\n", "prefix": "mqttc:autoreconn"}, "mqttc:publish": {"body": "mqttc:publish(${1:topic},${2:data},${3:qos},${4:retain})", "description": "mqttc:publish(topic, data, qos, retain) - \u53d1\u5e03\u6d88\u606f\n\u4f20\u5165\u503c\uff1a\nstring \u4e3b\u9898,\u5fc5\u586b\nstring \u6d88\u606f,\u5fc5\u586b,\u4f46\u957f\u5ea6\u53ef\u4ee5\u662f0\nint \u6d88\u606f\u7ea7\u522b 0/1 \u9ed8\u8ba40\nint \u662f\u5426\u5b58\u6863, 0/1,\u9ed8\u8ba40\n\u8fd4\u56de\u503c\uff1a\nint \u6d88\u606fid, \u5f53qos\u4e3a1\u62162\u65f6\u4f1a\u6709\u6548\u503c. \u82e5\u5e95\u5c42\u8fd4\u56de\u662f\u5426, \u4f1a\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nmqttc:publish(\"/luatos/123456\", \"123\")\n", "prefix": "mqttc:publish"}, "mqttc:close": {"body": "mqttc:close()", "description": "mqttc:close() - mqtt\u5ba2\u6237\u7aef\u5173\u95ed(\u5173\u95ed\u540e\u8d44\u6e90\u91ca\u653e\u65e0\u6cd5\u518d\u4f7f\u7528)\n\u4f8b\u5b50\uff1a\nmqttc:close()\n", "prefix": "mqttc:close"}, "mqttc:ready": {"body": "mqttc:ready()", "description": "mqttc:ready() - mqtt\u5ba2\u6237\u7aef\u662f\u5426\u5c31\u7eea\n\u8fd4\u56de\u503c\uff1a\nbool \u5ba2\u6237\u7aef\u662f\u5426\u5c31\u7eea\n\u4f8b\u5b50\uff1a\nlocal error = mqttc:ready()\n", "prefix": "mqttc:ready"}, "mqttc:state": {"body": "mqttc:state()", "description": "mqttc:state() - mqtt\u5ba2\u6237\u7aef\u72b6\u6001\n\u8fd4\u56de\u503c\uff1a\nnumber \u5ba2\u6237\u7aef\u72b6\u6001\n\u4f8b\u5b50\uff1a\nlocal state = mqttc:state()\n-- \u5df2\u77e5\u72b6\u6001:\n-- 0: MQTT_STATE_DISCONNECT\n-- 1: MQTT_STATE_CONNECTING\n-- 2: MQTT_STATE_CONNECTED\n-- 3: MQTT_STATE_READY\n-- 4: MQTT_STATE_ERROR\n", "prefix": "mqttc:state"}, "mqttc:will": {"body": "mqttc:will(${1:topic},${2:payload},${3:qos},${4:retain})", "description": "mqttc:will(topic, payload, qos, retain) - \u8bbe\u7f6e\u9057\u5631\u6d88\u606f\n\u4f20\u5165\u503c\uff1a\nstring \u9057\u5631\u6d88\u606f\u7684topic\nstring \u9057\u5631\u6d88\u606f\u7684payload\nstring \u9057\u5631\u6d88\u606f\u7684qos, \u9ed8\u8ba40, \u53ef\u4ee5\u4e0d\u586b\nstring \u9057\u5631\u6d88\u606f\u7684retain, \u9ed8\u8ba40, \u53ef\u4ee5\u4e0d\u586b\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u8981\u5728connect\u4e4b\u524d\u8c03\u7528\nmqttc:will(\"/xxx/xxx\", \"xxxxxx\")\n", "prefix": "mqttc:will"}, "napt.init": {"body": "napt.init(${1:adapter})", "description": "napt.init(adapter) - \u521d\u59cb\u5316NAPT\n\u4f20\u5165\u503c\uff1a\nint adapter \u76ee\u6807\u7f51\u5361\u7d22\u5f15, \u9ed8\u8ba4\u662fsocket.LWIP_AP, \u8fd9\u91cc\u6307\u5185\u7f51\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "napt.init"}, "napt.rebuild": {"body": "napt.rebuild(${1:buff},${2:is_inet},${3:adapter})", "description": "napt.rebuild(buff, is_inet, adapter) - \u91cd\u5efaMAC\u5305\n\u4f20\u5165\u503c\uff1a\nuserdata \u5f85\u5904\u7406\u7684MAC\u5305,\u5fc5\u987b\u662fzbuff\u5bf9\u8c61\nbool \u6765\u6e90\u662f\u4e0d\u662f\u5185\u7f51\nint \u76ee\u6807\u7f51\u7edc\u9002\u914d\u5668\u7684\u7d22\u5f15, \u4f8b\u5982socket.LWIP_GP\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5931\u8d25\u8fd4\u56defalse\n", "prefix": "napt.rebuild"}, "napt.check": {"body": "napt.check()", "description": "napt.check() - \u68c0\u67e5\u548c\u6e05\u7406NAT\u8868\n\u4f20\u5165\u503c\uff1a\nreturn nil\n\u4f8b\u5b50\uff1a\n-- \u4e24\u6b21check\u4e4b\u95f4\u6ca1\u6709\u6570\u636e\u5305\u7684\u6620\u5c04\u8bb0\u5f55,\u4f1a\u88ab\u6e05\u7406\n", "prefix": "napt.check"}, "nes.init": {"body": "nes.init(${1:file_path})", "description": "nes.init(file_path) - nes\u6a21\u62df\u5668\u521d\u59cb\u5316\n\u4f20\u5165\u503c\uff1a\nstring file_path \u6587\u4ef6\u8def\u5f84\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nnes.init(\"/luadb/super_mario.nes\")\n", "prefix": "nes.init"}, "nes.key": {"body": "nes.key(${1:key},${2:val})", "description": "nes.key(key,val) - nes\u6a21\u62df\u5668\u521d\u59cb\u5316\n\u4f20\u5165\u503c\uff1a\nnumber key \u6309\u952e\nnumber val \u72b6\u6001 1\u6309\u4e0b 0\u62ac\u8d77\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nnes.init(\"/luadb/super_mario.nes\")\n", "prefix": "nes.key"}, "nimble.init": {"body": "nimble.init(${1:name})", "description": "nimble.init(name) - \u521d\u59cb\u5316BLE\u4e0a\u4e0b\u6587,\u5f00\u59cb\u5bf9\u5916\u5e7f\u64ad/\u626b\u63cf\n\u4f20\u5165\u503c\uff1a\nstring \u84dd\u7259\u8bbe\u5907\u540d\u79f0,\u53ef\u9009,\u5efa\u8bae\u586b\u5199\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003 demo/nimble\n-- \u672c\u51fd\u6570\u5bf9\u6240\u6709\u6a21\u5f0f\u90fd\u9002\u7528\n", "prefix": "nimble.init"}, "nimble.deinit": {"body": "nimble.deinit()", "description": "nimble.deinit() - \u5173\u95edBLE\u4e0a\u4e0b\u6587\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u4ec5\u90e8\u5206\u8bbe\u5907\u652f\u6301,\u5f53\u524d\u53ef\u80fd\u90fd\u4e0d\u652f\u6301\n-- \u672c\u51fd\u6570\u5bf9\u6240\u6709\u6a21\u5f0f\u90fd\u9002\u7528\n", "prefix": "nimble.deinit"}, "nimble.mode": {"body": "nimble.mode(${1:tp})", "description": "nimble.mode(tp) - \u8bbe\u7f6e\u6a21\u5f0f\n\u4f20\u5165\u503c\uff1a\nint \u6a21\u5f0f, \u9ed8\u8ba4server/peripheral, \u53ef\u9009 client/central\u6a21\u5f0f nimble.MODE_BLE_CLIENT\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003 demo/nimble\n-- \u5fc5\u987b\u5728nimble.init()\u4e4b\u524d\u8c03\u7528\n-- nimble.mode(nimble.MODE_BLE_CLIENT) -- \u7b80\u79f0\u4ece\u673a\u6a21\u5f0f,\u672a\u5b8c\u5584\n", "prefix": "nimble.mode"}, "nimble.connok": {"body": "nimble.connok()", "description": "nimble.connok() - \u662f\u5426\u5df2\u7ecf\u5efa\u7acb\u8fde\u63a5\n\u8fd4\u56de\u503c\uff1a\nbool \u5df2\u8fde\u63a5\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nlog.info(\"ble\", \"connected?\", nimble.connok())\n-- \u4ece\u673aperipheral\u6a21\u5f0f, \u8bbe\u5907\u662f\u5426\u5df2\u7ecf\u88ab\u8fde\u63a5\n-- \u4e3b\u673acentral\u6a21\u5f0f, \u662f\u5426\u5df2\u7ecf\u8fde\u63a5\u5230\u8bbe\u5907\n-- ibeacon\u6a21\u5f0f, \u65e0\u610f\u4e49\n", "prefix": "nimble.connok"}, "nimble.send_msg": {"body": "nimble.send_msg(${1:conn},${2:handle},${3:data})", "description": "nimble.send_msg(conn, handle, data) - \u53d1\u9001\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nint \u8fde\u63a5id, \u5f53\u524d\u56fa\u5b9a\u586b1\nint \u5904\u7406id, \u5f53\u524d\u56fa\u5b9a\u586b0\nstring \u6570\u636e\u5b57\u7b26\u4e32,\u53ef\u5305\u542b\u4e0d\u53ef\u89c1\u5b57\u7b26\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003 demo/nimble\n-- \u672c\u51fd\u6570\u5bf9peripheral/\u4ece\u673a\u6a21\u5f0f\u9002\u7528\n", "prefix": "nimble.send_msg"}, "nimble.setUUID": {"body": "nimble.setUUID(${1:tp},${2:addr})", "description": "nimble.setUUID(tp, addr) - \u8bbe\u7f6eserver/peripheral\u7684UUID\n\u4f20\u5165\u503c\uff1a\nstring \u914d\u7f6e\u5b57\u7b26\u4e32,\u540e\u9762\u7684\u793a\u4f8b\u6709\u8bf4\u660e\nstring \u5730\u5740\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003 demo/nimble, 2023-02-25\u4e4b\u540e\u7f16\u8bd1\u7684\u56fa\u4ef6\u652f\u6301\u672cAPI\n-- \u5fc5\u987b\u5728nimble.init()\u4e4b\u524d\u8c03\u7528\n-- \u672c\u51fd\u6570\u5bf9peripheral/\u4ece\u673a\u6a21\u5f0f\u9002\u7528\n\n-- \u8bbe\u7f6eSERVER/Peripheral\u6a21\u5f0f\u4e0b\u7684UUID, \u652f\u6301\u8bbe\u7f6e3\u4e2a\n-- \u5730\u5740\u652f\u6301 2/4/16\u5b57\u8282, \u9700\u8981\u4e8c\u8fdb\u5236\u6570\u636e\n-- 2\u5b57\u8282\u5730\u5740\u793a\u4f8b: AABB, \u5199 string.fromHex(\"AABB\") ,\u6216\u8005 string.char(0xAA, 0xBB)\n-- 4\u5b57\u8282\u5730\u5740\u793a\u4f8b: AABBCCDD , \u5199 string.fromHex(\"AABBCCDD\") ,\u6216\u8005 string.char(0xAA, 0xBB, 0xCC, 0xDD)\nnimble.setUUID(\"srv\", string.fromHex(\"380D\")) -- \u670d\u52a1\u4e3bUUID , \u9ed8\u8ba4\u503c 180D\nnimble.setUUID(\"write\", string.fromHex(\"FF31\")) -- \u5f80\u672c\u8bbe\u5907\u5199\u6570\u636e\u7684UUID, \u9ed8\u8ba4\u503c FFF1\nnimble.setUUID(\"indicate\", string.fromHex(\"FF32\")) -- \u8ba2\u9605\u672c\u8bbe\u5907\u7684\u6570\u636e\u7684UUID,\u9ed8\u8ba4\u503c FFF2\n", "prefix": "nimble.setUUID"}, "nimble.mac": {"body": "nimble.mac(${1:mac})", "description": "nimble.mac(mac) - \u83b7\u53d6\u84dd\u7259MAC\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u8bbe\u7f6e\u7684MAC\u5730\u5740, 6\u5b57\u8282, \u4e0d\u4f20\u5c31\u662f\u5355\u83b7\u53d6\n\u8fd4\u56de\u503c\uff1a\nstring \u84dd\u7259MAC\u5730\u5740,6\u5b57\u8282\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003 demo/nimble, 2023-02-25\u4e4b\u540e\u7f16\u8bd1\u7684\u56fa\u4ef6\u652f\u6301\u672cAPI\n-- \u672c\u51fd\u6570\u5bf9\u6240\u6709\u6a21\u5f0f\u90fd\u9002\u7528\nlocal mac = nimble.mac()\nlog.info(\"ble\", \"mac\", mac and mac:toHex() or \"Unknwn\")\n\n-- \u4fee\u6539MAC\u5730\u5740, 2024.06.05 \u65b0\u589e, \u5f53\u524d\u4ec5Air601\u652f\u6301, \u4fee\u6539\u540e\u91cd\u542f\u751f\u6548\nnimble.mac(string.fromHex(\"1234567890AB\"))\n", "prefix": "nimble.mac"}, "nimble.sendNotify": {"body": "nimble.sendNotify(${1:srv_uuid},${2:chr_uuid},${3:data})", "description": "nimble.sendNotify(srv_uuid, chr_uuid, data) - \u53d1\u9001notify\n\u4f20\u5165\u503c\uff1a\nstring \u670d\u52a1\u7684UUID,\u9884\u7559,\u5f53\u524d\u586bnil\u5c31\u884c\nstring \u7279\u5f81\u7684UUID,\u5fc5\u987b\u586b\u5199\nstring \u6570\u636e, \u5fc5\u586b, \u8ddfMTU\u5927\u5c0f\u76f8\u5173, \u4e00\u822c\u4e0d\u8981\u8d85\u8fc7256\u5b57\u8282\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e 2023.07.31 \u65b0\u589e\n-- \u672c\u51fd\u6570\u5bf9peripheral\u6a21\u5f0f\u9002\u7528\nnimble.sendNotify(nil, string.fromHex(\"FF01\"), string.char(0x31, 0x32, 0x33, 0x34, 0x35))\n", "prefix": "nimble.sendNotify"}, "nimble.sendIndicate": {"body": "nimble.sendIndicate(${1:srv_uuid},${2:chr_uuid},${3:data})", "description": "nimble.sendIndicate(srv_uuid, chr_uuid, data) - \u53d1\u9001indicate\n\u4f20\u5165\u503c\uff1a\nstring \u670d\u52a1\u7684UUID,\u9884\u7559,\u5f53\u524d\u586bnil\u5c31\u884c\nstring \u7279\u5f81\u7684UUID,\u5fc5\u987b\u586b\u5199\nstring \u6570\u636e, \u5fc5\u586b, \u8ddfMTU\u5927\u5c0f\u76f8\u5173, \u4e00\u822c\u4e0d\u8981\u8d85\u8fc7256\u5b57\u8282\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e 2023.07.31 \u65b0\u589e\n-- \u672c\u51fd\u6570\u5bf9peripheral\u6a21\u5f0f\u9002\u7528\nnimble.sendIndicate(nil, string.fromHex(\"FF01\"), string.char(0x31, 0x32, 0x33, 0x34, 0x35))\n", "prefix": "nimble.sendIndicate"}, "nimble.advParams": {"body": "nimble.advParams(${1:conn_mode},${2:disc_mode},${3:itvl_min},${4:itvl_max},${5:channel_map},${6:filter_policy},${7:high_duty_cycle})", "description": "nimble.advParams(conn_mode, disc_mode, itvl_min, itvl_max, channel_map, filter_policy, high_duty_cycle) - \u8bbe\u7f6e\u5e7f\u64ad\u53c2\u6570\n\u4f20\u5165\u503c\uff1a\nint \u5e7f\u64ad\u6a21\u5f0f, 0 - \u4e0d\u53ef\u8fde\u63a5, 1 - \u5b9a\u5411\u8fde\u63a5, 2 - \u672a\u5b9a\u5411\u8fde\u63a5, \u9ed8\u8ba40\nint \u53d1\u73b0\u6a21\u5f0f, 0 - \u4e0d\u53ef\u53d1\u73b0, 1 - \u9650\u5236\u53d1\u73b0, 3 - \u901a\u7528\u53d1\u73b0, \u9ed8\u8ba40\nint \u6700\u5c0f\u5e7f\u64ad\u95f4\u9694, 0 - \u4f7f\u7528\u9ed8\u8ba4\u503c, \u8303\u56f4 1 - 65535, \u5355\u4f4d0.625ms, \u9ed8\u8ba40\nint \u6700\u5927\u5e7f\u64ad\u95f4\u9694, 0 - \u4f7f\u7528\u9ed8\u8ba4\u503c, \u8303\u56f4 1 - 65535, \u5355\u4f4d0.625ms, \u9ed8\u8ba40\nint \u5e7f\u64ad\u901a\u9053, \u9ed8\u8ba40, \u4e00\u822c\u4e0d\u9700\u8981\u8bbe\u7f6e\nint \u8fc7\u6ee4\u89c4\u5219, \u9ed8\u8ba40, \u4e00\u822c\u4e0d\u9700\u8981\u8bbe\u7f6e\nint \u5f53\u5e7f\u64ad\u6a21\u5f0f\u4e3a\"\u5b9a\u5411\u8fde\u63a5\"\u65f6,\u662f\u5426\u4f7f\u7528\u9ad8\u5360\u7a7a\u6bd4\u6a21\u5f0f, \u9ed8\u8ba40, \u53ef\u90091\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u5f53\u524d\u4ec5ibeacon\u6a21\u5f0f/peripheral/\u4ece\u673a\u53ef\u4f7f\u7528\n-- \u4f8b\u5982\u8bbe\u7f6e \u4e0d\u53ef\u8fde\u63a5 + \u9650\u5236\u53d1\u73b0\n-- \u9700\u8981\u5728nimble.init\u4e4b\u524d\u8bbe\u7f6e\u597d\nnimble.advParams(0, 1)\n-- \u6ce8\u610fperipheral\u6a21\u5f0f\u4e0b\u81ea\u52a8\u914d\u7f6e conn_mode \u548c disc_mode\n", "prefix": "nimble.advParams"}, "nimble.setChr": {"body": "nimble.setChr(${1:index},${2:uuid},${3:flags})", "description": "nimble.setChr(index, uuid, flags) - \u8bbe\u7f6echr\u7684\u7279\u5f81\n\u4f20\u5165\u503c\uff1a\nint chr\u7684\u7d22\u5f15, \u9ed8\u8ba40-3\nint chr\u7684UUID, \u53ef\u4ee5\u662f2/4/16\u5b57\u8282\nint chr\u7684FLAGS, \u8bf7\u67e5\u9605\u5e38\u91cf\u8868\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u4ec5peripheral/\u4ece\u673a\u53ef\u4f7f\u7528\nnimble.setChr(0, string.fromHex(\"FF01\"), nimble.CHR_F_WRITE_NO_RSP | nimble.CHR_F_NOTIFY)\nnimble.setChr(1, string.fromHex(\"FF02\"), nimble.CHR_F_READ | nimble.CHR_F_NOTIFY)\nnimble.setChr(2, string.fromHex(\"FF03\"), nimble.CHR_F_WRITE_NO_RSP)\n-- \u53ef\u67e5\u9605 demo/nimble/kt6368a\n", "prefix": "nimble.setChr"}, "nimble.config": {"body": "nimble.config(${1:id},${2:value})", "description": "nimble.config(id, value) - \u8bbe\u7f6echr\u7684\u7279\u5f81\n\u4f20\u5165\u503c\uff1a\nint \u914d\u7f6e\u7684id,\u8bf7\u67e5\u9605\u5e38\u91cf\u8868\nany \u6839\u636e\u914d\u7f6e\u7684\u4e0d\u540c, \u6709\u4e0d\u540c\u7684\u53ef\u9009\u503c\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5728\u4efb\u610f\u6a21\u5f0f\u53ef\u7528\n-- \u672cAPI\u4e8e 2023.07.31 \u65b0\u589e\n-- \u4f8b\u5982\u8bbe\u7f6e\u5730\u5740\u8f6c\u6362\u7684\u5927\u5c0f\u7aef, \u9ed8\u8ba4\u662f0, \u517c\u5bb9\u8001\u7684\u4ee3\u7801\n-- \u8bbe\u7f6e\u62101, \u670d\u52a1UUID\u548cchr\u7684UUID\u66f4\u76f4\u89c2\nnimble.config(nimble.CFG_ADDR_ORDER, 1)\n", "prefix": "nimble.config"}, "nimble.ibeacon": {"body": "nimble.ibeacon(${1:data},${2:major},${3:minor},${4:measured_power})", "description": "nimble.ibeacon(data, major, minor, measured_power) - \u914d\u7f6eiBeacon\u7684\u53c2\u6570,\u4ec5iBeacon\u6a21\u5f0f\u53ef\u7528\n\u4f20\u5165\u503c\uff1a\nstring \u6570\u636e, \u5fc5\u987b\u662f16\u5b57\u8282\nint \u4e3b\u7248\u672c\u53f7,\u9ed8\u8ba42, \u53ef\u9009, \u8303\u56f4 0 ~ 65536\nint \u6b21\u7248\u672c\u53f7,\u9ed8\u8ba410,\u53ef\u9009, \u8303\u56f4 0 ~ 65536\nint \u540d\u4e49\u529f\u7387, \u9ed8\u8ba40, \u8303\u56f4 -126 \u5230 20 \n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003 demo/nimble, 2023-02-25\u4e4b\u540e\u7f16\u8bd1\u7684\u56fa\u4ef6\u652f\u6301\u672cAPI\n-- \u672c\u51fd\u6570\u5bf9ibeacon\u6a21\u5f0f\u9002\u7528\nnimble.ibeacon(data, 2, 10, 0)\nnimble.init()\n", "prefix": "nimble.ibeacon"}, "nimble.advData": {"body": "nimble.advData(${1:data},${2:flags})", "description": "nimble.advData(data, flags) - \u914d\u7f6e\u5e7f\u64ad\u6570\u636e,\u4ec5iBeacon\u6a21\u5f0f\u53ef\u7528\n\u4f20\u5165\u503c\uff1a\nstring \u5e7f\u64ad\u6570\u636e, \u5f53\u524d\u6700\u9ad8128\u5b57\u8282\nint \u5e7f\u64ad\u6807\u8bc6, \u53ef\u9009, \u9ed8\u8ba4\u503c\u662f 0x06,\u5373 \u4e0d\u652f\u6301\u4f20\u7edf\u84dd\u7259(0x04) + \u666e\u901a\u53d1\u73b0\u6a21\u5f0f(0x02)\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003 demo/nimble/adv_free, 2023-03-18\u4e4b\u540e\u7f16\u8bd1\u7684\u56fa\u4ef6\u652f\u6301\u672cAPI\n-- \u672c\u51fd\u6570\u5bf9ibeacon\u6a21\u5f0f\u9002\u7528\n-- \u6570\u636e\u6765\u6e90\u53ef\u4ee5\u591a\u79cd\u591a\u6837\nlocal data = string.fromHex(\"123487651234876512348765123487651234876512348765\")\n-- local data = crypto.trng(25)\n-- local data = string.char(0x11, 0x13, 0xA3, 0x5A, 0x11, 0x13, 0xA3, 0x5A, 0x11, 0x13, 0xA3, 0x5A, 0x11, 0x13, 0xA3, 0x5A)\nnimble.advData(data)\nnimble.init()\n\n-- nimble\u652f\u6301\u5728init\u4e4b\u540e\u7684\u4efb\u610f\u65f6\u523b\u518d\u6b21\u8c03\u7528, \u4ee5\u5b9e\u73b0\u6570\u636e\u66f4\u65b0\n-- \u4f8b\u5982 1\u5206\u949f\u53d8\u4e00\u6b21\nwhile 1 do\n sys.wait(60000)\n local data = crypto.trng(25)\n nimble.advData(data)\nend\n", "prefix": "nimble.advData"}, "nimble.scan": {"body": "nimble.scan(${1:timeout})", "description": "nimble.scan(timeout) - \u626b\u63cf\u4ece\u673a\n\u4f20\u5165\u503c\uff1a\nint \u8d85\u65f6\u65f6\u95f4,\u5355\u4f4d\u79d2,\u9ed8\u8ba428\u79d2\n\u8fd4\u56de\u503c\uff1a\nbool \u542f\u52a8\u626b\u63cf\u6210\u529f\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003 demo/nimble/scan\n-- \u672c\u51fd\u6570\u5bf9central/\u4e3b\u673a\u6a21\u5f0f\u9002\u7528\n-- \u672c\u51fd\u6570\u4f1a\u76f4\u63a5\u8fd4\u56de, \u7136\u540e\u901a\u8fc7\u5f02\u6b65\u56de\u8c03\u8fd4\u56de\u7ed3\u679c\n\n-- \u8c03\u7528\u672c\u51fd\u6570\u524d, \u9700\u8981\u5148\u786e\u4fdd\u5df2\u7ecfnimble.init()\nnimble.scan()\n-- timeout\u53c2\u6570\u4e8e 2023.7.11 \u6dfb\u52a0\n", "prefix": "nimble.scan"}, "nimble.connect": {"body": "nimble.connect(${1:mac})", "description": "nimble.connect(mac) - \u8fde\u63a5\u5230\u4ece\u673a\n\u4f20\u5165\u503c\uff1a\nstring \u8bbe\u5907\u7684MAC\u5730\u5740\n\u8fd4\u56de\u503c\uff1a\nbool \u542f\u52a8\u8fde\u63a5\u6210\u529f\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5bf9central/\u4e3b\u673a\u6a21\u5f0f\u9002\u7528\n-- \u672c\u51fd\u6570\u4f1a\u76f4\u63a5\u8fd4\u56de, \u7136\u540e\u901a\u8fc7\u5f02\u6b65\u56de\u8c03\u8fd4\u56de\u7ed3\u679c\n", "prefix": "nimble.connect"}, "nimble.disconnect": {"body": "nimble.disconnect()", "description": "nimble.disconnect() - \u65ad\u5f00\u4e0e\u4ece\u673a\u7684\u8fde\u63a5\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5bf9central/\u4e3b\u673a\u6a21\u5f0f\u9002\u7528\n-- \u672c\u51fd\u6570\u4f1a\u76f4\u63a5\u8fd4\u56de\n", "prefix": "nimble.disconnect"}, "nimble.discSvr": {"body": "nimble.discSvr()", "description": "nimble.discSvr() - \u626b\u63cf\u4ece\u673a\u7684\u670d\u52a1\u5217\u8868\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5bf9central/\u4e3b\u673a\u6a21\u5f0f\u9002\u7528\n-- \u672c\u51fd\u6570\u4f1a\u76f4\u63a5\u8fd4\u56de,\u7136\u540e\u5f02\u6b65\u8fd4\u56de\u7ed3\u679c\n-- \u8fd9\u4e2aAPI\u901a\u5e38\u4e0d\u9700\u8981\u8c03\u7528, \u5728\u8fde\u63a5\u4ece\u673a\u5b8c\u6210\u540e,\u4f1a\u4e3b\u52a8\u8c03\u7528\u4e00\u6b21\n", "prefix": "nimble.discSvr"}, "nimble.listSvr": {"body": "nimble.listSvr()", "description": "nimble.listSvr() - \u83b7\u53d6\u4ece\u673a\u7684\u670d\u52a1\u5217\u8868\n\u8fd4\u56de\u503c\uff1a\ntable \u670d\u52a1UUID\u7684\u6570\u7ec4\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5bf9central/\u4e3b\u673a\u6a21\u5f0f\u9002\u7528\n", "prefix": "nimble.listSvr"}, "nimble.discChr": {"body": "nimble.discChr(${1:svr_uuid})", "description": "nimble.discChr(svr_uuid) - \u626b\u63cf\u4ece\u673a\u7684\u6307\u5b9a\u670d\u52a1\u7684\u7279\u5f81\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u6307\u5b9a\u670d\u52a1\u7684UUID\u503c\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u542f\u52a8\u626b\u63cf\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5bf9central/\u4e3b\u673a\u6a21\u5f0f\u9002\u7528\n", "prefix": "nimble.discChr"}, "nimble.listChr": {"body": "nimble.listChr(${1:svr_uuid})", "description": "nimble.listChr(svr_uuid) - \u83b7\u53d6\u4ece\u673a\u7684\u6307\u5b9a\u670d\u52a1\u7684\u7279\u5f81\u503c\u5217\u8868\n\u4f20\u5165\u503c\uff1a\nstring \u6307\u5b9a\u670d\u52a1\u7684UUID\u503c\n\u8fd4\u56de\u503c\uff1a\ntable \u7279\u5f81\u503c\u5217\u8868,\u5305\u542bUUID\u548cflags\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5bf9central/\u4e3b\u673a\u6a21\u5f0f\u9002\u7528\n", "prefix": "nimble.listChr"}, "nimble.discDsc": {"body": "nimble.discDsc(${1:svr_uuid},${2:chr_uuid})", "description": "nimble.discDsc(svr_uuid, chr_uuid) - \u626b\u63cf\u4ece\u673a\u7684\u6307\u5b9a\u670d\u52a1\u7684\u7279\u5f81\u503c\u7684\u5176\u4ed6\u5c5e\u6027\n\u4f20\u5165\u503c\uff1a\nstring \u6307\u5b9a\u670d\u52a1\u7684UUID\u503c\nstring \u7279\u5f81\u503c\u7684UUID\u503c\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u542f\u52a8\u626b\u63cf\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5bf9central/\u4e3b\u673a\u6a21\u5f0f\u9002\u7528\n", "prefix": "nimble.discDsc"}, "nimble.writeChr": {"body": "nimble.writeChr(${1:svr_uuid},${2:chr_uuid},${3:data})", "description": "nimble.writeChr(svr_uuid, chr_uuid, data) - \u5f80\u6307\u5b9a\u7684\u670d\u52a1\u7684\u6307\u5b9a\u7279\u5f81\u503c\u5199\u5165\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring \u6307\u5b9a\u670d\u52a1\u7684UUID\u503c\nstring \u6307\u5b9a\u7279\u5f81\u503c\u7684UUID\u503c\nstring \u5f85\u5199\u5165\u7684\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u542f\u52a8\u5199\u5165\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5bf9central/\u4e3b\u673a\u6a21\u5f0f\u9002\u7528\n", "prefix": "nimble.writeChr"}, "nimble.readChr": {"body": "nimble.readChr(${1:svr_uuid},${2:chr_uuid})", "description": "nimble.readChr(svr_uuid, chr_uuid) - \u4ece\u6307\u5b9a\u7684\u670d\u52a1\u7684\u6307\u5b9a\u7279\u5f81\u503c\u8bfb\u53d6\u6570\u636e(\u5f02\u6b65)\n\u4f20\u5165\u503c\uff1a\nstring \u6307\u5b9a\u670d\u52a1\u7684UUID\u503c\nstring \u6307\u5b9a\u7279\u5f81\u503c\u7684UUID\u503c\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u542f\u52a8\u5199\u5165\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5bf9central/\u4e3b\u673a\u6a21\u5f0f\u9002\u7528\n-- \u8be6\u7ec6\u7528\u6cd5\u8bf7\u53c2\u6570 demo/nimble/central\n", "prefix": "nimble.readChr"}, "nimble.subChr": {"body": "nimble.subChr(${1:svr_uuid},${2:chr_uuid})", "description": "nimble.subChr(svr_uuid, chr_uuid) - \u8ba2\u9605\u6307\u5b9a\u7684\u670d\u52a1\u7684\u6307\u5b9a\u7279\u5f81\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u6307\u5b9a\u670d\u52a1\u7684UUID\u503c\nstring \u6307\u5b9a\u7279\u5f81\u503c\u7684UUID\u503c\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u542f\u52a8\u8ba2\u9605\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5bf9central/\u4e3b\u673a\u6a21\u5f0f\u9002\u7528\n-- \u8be6\u7ec6\u7528\u6cd5\u8bf7\u53c2\u6570 demo/nimble/central\n", "prefix": "nimble.subChr"}, "nimble.unsubChr": {"body": "nimble.unsubChr(${1:svr_uuid},${2:chr_uuid})", "description": "nimble.unsubChr(svr_uuid, chr_uuid) - \u53d6\u6d88\u8ba2\u9605\u6307\u5b9a\u7684\u670d\u52a1\u7684\u6307\u5b9a\u7279\u5f81\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u6307\u5b9a\u670d\u52a1\u7684UUID\u503c\nstring \u6307\u5b9a\u7279\u5f81\u503c\u7684UUID\u503c\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u542f\u52a8\u53d6\u6d88\u8ba2\u9605\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5bf9central/\u4e3b\u673a\u6a21\u5f0f\u9002\u7528\n-- \u8be6\u7ec6\u7528\u6cd5\u8bf7\u53c2\u6570 demo/nimble/central\n", "prefix": "nimble.unsubChr"}, "onewire.ds18b20": {"body": "onewire.ds18b20(${1:mode},${2:pin},${3:check})", "description": "onewire.ds18b20(mode, pin, check) - \u8bfb\u53d6DS18B20\n\u4f20\u5165\u503c\uff1a\nint GPIO\u6a21\u5f0f\u5bf9\u5e94GPIO\u7f16\u53f7, HW\u6a21\u5f0f\u6839\u636e\u5b9e\u9645\u786c\u4ef6\u6765\u786e\u5b9a\nboolean \u662f\u5426\u68c0\u67e5\u6570\u636e\u7684CRC\u503c,\u53ef\u9009\nint \u6a21\u5f0f, \u53ea\u80fd\u662f onewire.GPIO \u6216\u8005 onewire.HW,\u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nnumber \u6210\u529f\u8fd4\u56de\u6e29\u5ea6\u503c,\u5426\u5219\u8fd4\u56denil.\u5355\u4f4d 0.1\u6444\u6c0f\u5ea6\n\u4f8b\u5b50\uff1a\n\n-- GPIO\u6a21\u5f0f,\u63a5 GPIO 9\nlocal temp = onewire.ds18b20(9, true, onewire.GPIO)\nif temp then\n log.info(\"\u8bfb\u53d6\u5230\u7684\u6e29\u5ea6\u503c\", temp)\nelse\n log.info(\"\u8bfb\u53d6\u5931\u8d25\")\nend\n\n", "prefix": "onewire.ds18b20"}, "onewire.dht1x": {"body": "onewire.dht1x(${1:mode},${2:pin},${3:check})", "description": "onewire.dht1x(mode, pin, check) - \u8bfb\u53d6DHT11\n\u4f20\u5165\u503c\uff1a\nint GPIO\u6a21\u5f0f\u5bf9\u5e94GPIO\u7f16\u53f7, HW\u6a21\u5f0f\u6839\u636e\u5b9e\u9645\u786c\u4ef6\u6765\u786e\u5b9a\nboolean \u662f\u5426\u68c0\u67e5\u6570\u636e\u7684CRC\u503c,\u53ef\u9009\nint \u6a21\u5f0f, \u53ea\u80fd\u662f onewire.GPIO \u6216\u8005 onewire.HW,\u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nnumber \u6210\u529f\u8fd4\u56de\u6e29\u5ea6\u503c,\u5426\u5219\u8fd4\u56denil.\u5355\u4f4d 0.01\u6444\u6c0f\u5ea6\nnumber \u6210\u529f\u8fd4\u56de\u76f8\u5bf9\u6e7f\u5ea6,\u5426\u5219\u8fd4\u56denil.\u5355\u4f4d 0.01%\n\u4f8b\u5b50\uff1a\n\n-- GPIO\u6a21\u5f0f,\u63a5 GPIO 9\nlocal temp = onewire.dht1x(onewire.GPIO, 9, true)\nif temp then\n log.info(\"\u8bfb\u53d6\u5230\u7684\u6e29\u5ea6\u503c\", temp)\nelse\n log.info(\"\u8bfb\u53d6\u5931\u8d25\")\nend\n\n", "prefix": "onewire.dht1x"}, "otp.read": {"body": "otp.read(${1:zone},${2:offset},${3:len})", "description": "otp.read(zone, offset, len) - \u8bfb\u53d6\u6307\u5b9aOTP\u533a\u57df\u8bfb\u53d6\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u533a\u57df, \u901a\u5e38\u4e3a0/1/2/3, \u4e0e\u5177\u4f53\u786c\u4ef6\u76f8\u5173\nint \u504f\u79fb\u91cf\nint \u8bfb\u53d6\u957f\u5ea6, \u5355\u4f4d\u5b57\u8282, \u5fc5\u987b\u662f4\u7684\u500d\u6570, \u4e0d\u80fd\u8d85\u8fc74096\u5b57\u8282\n\u8fd4\u56de\u503c\uff1a\nstring \u6210\u529f\u8fd4\u56de\u5b57\u7b26\u4e32, \u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n\nlocal otpdata = otp.read(0, 0, 64)\nif otpdata then\n log.info(\"otp\", otpdata:toHex())\nend\n", "prefix": "otp.read"}, "otp.write": {"body": "otp.write(${1:zone},${2:data},${3:offset})", "description": "otp.write(zone, data, offset) - \u5f80\u6307\u5b9aOTP\u533a\u57df\u5199\u5165\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u533a\u57df, \u901a\u5e38\u4e3a0/1/2/3, \u4e0e\u5177\u4f53\u786c\u4ef6\u76f8\u5173\nstring \u6570\u636e, \u957f\u5ea6\u5fc5\u987b\u662f4\u4e2a\u500d\u6570\nint \u504f\u79fb\u91cf\n\u8fd4\u56de\u503c\uff1a\nbooL \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n", "prefix": "otp.write"}, "otp.erase": {"body": "otp.erase(${1:zone})", "description": "otp.erase(zone) - \u64e6\u9664\u6307\u5b9aOTP\u533a\u57df\n\u4f20\u5165\u503c\uff1a\nint \u533a\u57df, \u901a\u5e38\u4e3a0/1/2/3, \u4e0e\u5177\u4f53\u786c\u4ef6\u76f8\u5173\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n", "prefix": "otp.erase"}, "otp.lock": {"body": "otp.lock(${1:zone})", "description": "otp.lock(zone) - \u9501\u5b9aOTP\u533a\u57df. \u7279\u522b\u6ce8\u610f!!\u4e00\u65e6\u52a0\u9501\u5373\u65e0\u6cd5\u89e3\u9501,OTP\u53d8\u6210\u53ea\u8bfb!!!\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n", "prefix": "otp.lock"}, "pack.unpack": {"body": "pack.unpack(${1:string},${2:format},${3:init})", "description": "pack.unpack( string, format, init) - \u89e3\u5305\u5b57\u7b26\u4e32\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u89e3\u5305\u7684\u5b57\u7b26\u4e32\nstring \u683c\u5f0f\u5316\u7b26\u53f7\nint \u9ed8\u8ba4\u503c\u4e3a1\uff0c\u6807\u8bb0\u89e3\u5305\u5f00\u59cb\u7684\u4f4d\u7f6e\n\u8fd4\u56de\u503c\uff1a\nint \u5b57\u7b26\u4e32\u6807\u8bb0\u7684\u4f4d\u7f6e\nany \u7b2c\u4e00\u4e2a\u89e3\u5305\u7684\u503c, \u6839\u636eformat\u503c,\u53ef\u80fd\u6709N\u4e2a\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlocal _,a = pack.unpack(x,\">h\") --\u89e3\u5305\u6210short (2\u5b57\u8282)\n", "prefix": "pack.unpack"}, "pack.pack": {"body": "pack.pack(${1:format},${2:val1},${3:val2},${4:val3},${5:valn})", "description": "pack.pack( format, val1, val2, val3, valn ) - \u6253\u5305\u5b57\u7b26\u4e32\u7684\u503c\n\u4f20\u5165\u503c\uff1a\nstring format \u683c\u5f0f\u5316\u7b26\u53f7\nany \u7b2c\u4e00\u4e2a\u9700\u6253\u5305\u7684\u503c\nany \u7b2c\u4e8c\u4e2a\u9700\u6253\u5305\u7684\u503c\nany \u7b2c\u4e8c\u4e2a\u9700\u6253\u5305\u7684\u503c\nany \u7b2cn\u4e2a\u9700\u6253\u5305\u7684\u503c\n\u8fd4\u56de\u503c\uff1a\nstring \u4e00\u4e2a\u5305\u542b\u6240\u6709\u683c\u5f0f\u5316\u53d8\u91cf\u7684\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\nlocal data = pack.pack('= 2\u662f, \u6700\u5927\u4f11\u7720\u65f6\u957f\u662f740\u5c0f\u65f6\n", "prefix": "pm.dtimerStart"}, "pm.dtimerStop": {"body": "pm.dtimerStop(${1:id})", "description": "pm.dtimerStop(id) - \u5173\u95ed\u5e95\u5c42\u5b9a\u65f6\u5668\n\u4f20\u5165\u503c\uff1a\nint \u5b9a\u65f6\u5668id\n\u4f8b\u5b50\uff1a\n-- \u5173\u95ed\u5e95\u5c42\u5b9a\u65f6\u5668\npm.dtimerStop(0) -- \u5173\u95edid=0\u7684\u5e95\u5c42\u5b9a\u65f6\u5668\n", "prefix": "pm.dtimerStop"}, "pm.dtimerCheck": {"body": "pm.dtimerCheck(${1:id})", "description": "pm.dtimerCheck(id) - \u68c0\u67e5\u5e95\u5c42\u5b9a\u65f6\u5668\u662f\u4e0d\u662f\u5728\u8fd0\u884c\n\u4f20\u5165\u503c\uff1a\nint \u5b9a\u65f6\u5668id\n\u8fd4\u56de\u503c\uff1a\nboolean \u5904\u7406\u7ed3\u679c,true\u8fd8\u5728\u8fd0\u884c\uff0cfalse\u4e0d\u5728\u8fd0\u884c\nnumber \u5982\u679c\u8fd0\u884c,\u8fd0\u884c\u5269\u4f59\u65f6\u95f4,\u5355\u4f4d\u6beb\u79d2(\u9700bsp\u652f\u6301)\n\u4f8b\u5b50\uff1a\n-- \u68c0\u67e5\u5e95\u5c42\u5b9a\u65f6\u5668\u662f\u4e0d\u662f\u5728\u8fd0\u884c\npm.dtimerCheck(0) -- \u68c0\u67e5id=0\u7684\u5e95\u5c42\u5b9a\u65f6\u5668\n", "prefix": "pm.dtimerCheck"}, "dtimerWkId": {"body": "dtimerWkId()", "description": "dtimerWkId() - \u68c0\u67e5\u5b9a\u65f6\u5524\u9192\u662f\u54ea\u4e00\u4e2a\u5b9a\u65f6\u5668\uff0c\u5982\u679c\u4e0d\u662f\u5b9a\u65f6\u5524\u9192\u7684\uff0c\u8fd4\u56de-1\n\u8fd4\u56de\u503c\uff1a\nint \u5904\u7406\u7ed3\u679c >=0 \u662f\u672c\u6b21\u5b9a\u65f6\u5524\u9192\u7684\u5b9a\u65f6\u5668ID\uff0c\u5176\u4ed6\u9519\u8bef\uff0c\u8bf4\u660e\u4e0d\u662f\u5b9a\u65f6\u5524\u9192\u7684\n\u4f8b\u5b50\uff1a\nlocal timer_id = pm.dtimerWkId()\n", "prefix": "dtimerWkId"}, "pm.lastReson": {"body": "pm.lastReson()", "description": "pm.lastReson() - \u5f00\u673a\u539f\u56e0,\u7528\u4e8e\u5224\u65ad\u662f\u4ece\u4f11\u7720\u6a21\u5757\u5f00\u673a,\u8fd8\u662f\u7535\u6e90/\u590d\u4f4d\u5f00\u673a\n\u8fd4\u56de\u503c\uff1a\nint 0-\u4e0a\u7535/\u590d\u4f4d\u5f00\u673a, 1-RTC\u5f00\u673a, 2-WakeupIn/Pad/IO\u5f00\u673a, 3-\u672a\u77e5\u539f\u56e0(Wakeup/RTC\u7686\u6709\u53ef\u80fd)\u5f00\u673a,\u76ee\u524d\u53ea\u6709air101,air103\u4f1a\u6709\u8fd9\u4e2a\u8fd4\u56de\u503c\nint 0-\u666e\u901a\u5f00\u673a(\u4e0a\u7535/\u590d\u4f4d),3-\u6df1\u7761\u7720\u5f00\u673a,4-\u4f11\u7720\u5f00\u673a\nint \u590d\u4f4d\u5f00\u673a\u8be6\u7ec6\u539f\u56e0\uff1a0-powerkey\u6216\u8005\u4e0a\u7535\u5f00\u673a 1-\u5145\u7535\u6216\u8005AT\u6307\u4ee4\u4e0b\u8f7d\u5b8c\u6210\u540e\u5f00\u673a 2-\u95f9\u949f\u5f00\u673a 3-\u8f6f\u4ef6\u91cd\u542f 4-\u672a\u77e5\u539f\u56e0 5-RESET\u952e 6-\u5f02\u5e38\u91cd\u542f 7-\u5de5\u5177\u63a7\u5236\u91cd\u542f 8-\u5185\u90e8\u770b\u95e8\u72d7\u91cd\u542f 9-\u5916\u90e8\u91cd\u542f 10-\u5145\u7535\u5f00\u673a\n\u4f8b\u5b50\uff1a\n-- \u662f\u54ea\u79cd\u65b9\u5f0f\u5f00\u673a\u5462\nlog.info(\"pm\", \"last power reson\", pm.lastReson())\n", "prefix": "pm.lastReson"}, "pm.force": {"body": "pm.force(${1:mode})", "description": "pm.force(mode) - \u5f3a\u5236\u8fdb\u5165\u6307\u5b9a\u7684\u4f11\u7720\u6a21\u5f0f\uff0c\u5ffd\u7565\u67d0\u4e9b\u5916\u8bbe\u7684\u5f71\u54cd\uff0c\u6bd4\u5982USB\n\u4f20\u5165\u503c\uff1a\nint \u4f11\u7720\u6a21\u5f0f\n\u8fd4\u56de\u503c\uff1a\nboolean \u5904\u7406\u7ed3\u679c,\u82e5\u8fd4\u56de\u6210\u529f,\u5927\u6982\u7387\u4f1a\u9a6c\u4e0a\u8fdb\u5165\u8be5\u4f11\u7720\u6a21\u5f0f\n\u4f8b\u5b50\uff1a\n-- \u8bf7\u6c42\u8fdb\u5165\u4f11\u7720\u6a21\u5f0f\npm.force(pm.HIB)\n-- \u79fb\u82afCAT1\u5e73\u53f0\u7cfb\u5217(Air780E/Air700E/Air780EP\u7b49\u7b49), \u8be5\u64cd\u4f5c\u4f1a\u5173\u95edUSB\u901a\u4fe1\n-- \u5524\u9192\u540e\u5982\u9700\u5f00\u542fUSB, \u8bf7\u6253\u5f00USB\u7535\u538b\n--pm.power(pm.USB, true)\n", "prefix": "pm.force"}, "pm.check": {"body": "pm.check()", "description": "pm.check() - \u68c0\u67e5\u4f11\u7720\u72b6\u6001\n\u8fd4\u56de\u503c\uff1a\nboolean \u5904\u7406\u7ed3\u679c,\u5982\u679c\u80fd\u987a\u5229\u8fdb\u5165\u4f11\u7720,\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\nint \u5e95\u5c42\u8fd4\u56de\u503c,0\u4ee3\u8868\u80fd\u8fdb\u5165\u6700\u5e95\u5c42\u4f11\u7720,\u5176\u4ed6\u503c\u4ee3\u8868\u6700\u4f4e\u53ef\u4f11\u7720\u7ea7\u522b\n\u4f8b\u5b50\uff1a\n-- \u8bf7\u6c42\u8fdb\u5165\u4f11\u7720\u6a21\u5f0f,\u7136\u540e\u68c0\u67e5\u662f\u5426\u80fd\u771f\u7684\u4f11\u7720\npm.request(pm.HIB)\nif pm.check() then\n log.info(\"pm\", \"it is ok to hib\")\nelse\n -- \u79fb\u82afCAT1\u5e73\u53f0\u7cfb\u5217(Air780E/Air700E/Air780EP\u7b49\u7b49), \u8be5\u64cd\u4f5c\u4f1a\u5173\u95edUSB\u901a\u4fe1\n pm.force(pm.HIB) -- \u5f3a\u5236\u4f11\u7720\n -- \u5524\u9192\u540e\u5982\u9700\u5f00\u542fUSB, \u8bf7\u6253\u5f00USB\u7535\u538b\n --sys.wait(100)\n --pm.power(pm.USB, true)\nend\n", "prefix": "pm.check"}, "pm.shutdown": {"body": "pm.shutdown()", "description": "pm.shutdown() - \u5173\u673a\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u5f53\u524d\u652f\u6301\u79fb\u82afCAT1\u5e73\u53f0\u7cfb\u5217(Air780E/Air700E/Air780EP\u7b49\u7b49)\n-- \u9700\u89812022-12-22\u4e4b\u540e\u7f16\u8bd1\u7684\u56fa\u4ef6\npm.shutdown()\n", "prefix": "pm.shutdown"}, "pm.reboot": {"body": "pm.reboot()", "description": "pm.reboot() - \u91cd\u542f\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "pm.reboot"}, "pm.power": {"body": "pm.power(${1:id},${2:onoff})", "description": "pm.power(id, onoff) - \u5f00\u542f\u5185\u90e8\u7684\u7535\u6e90\u63a7\u5236\uff0c\u6ce8\u610f\u4e0d\u662f\u6240\u6709\u7684\u5e73\u53f0\u90fd\u652f\u6301\uff0c\u53ef\u80fd\u90e8\u5206\u5e73\u53f0\u652f\u6301\u90e8\u5206\u9009\u9879\uff0c\u770b\u786c\u4ef6\n\u4f20\u5165\u503c\uff1a\nint \u7535\u6e90\u63a7\u5236id,pm.USB pm.GPS\u4e4b\u7c7b\nboolean or int \u5f00\u5173true/1\u5f00\uff0cfalse/0\u5173\uff0c\u9ed8\u8ba4\u5173\uff0c\u90e8\u5206\u9009\u9879\u652f\u6301\u6570\u503c\n\u8fd4\u56de\u503c\uff1a\nboolean \u5904\u7406\u7ed3\u679ctrue\u6210\u529f\uff0cfalse\u5931\u8d25\n\u4f8b\u5b50\uff1a\n-- \u5173\u95edUSB\u7535\u6e90, \u53cd\u4e4b\u5f00\u542f\u5c31\u662f\u4f20true\npm.power(pm.USB, false) \n\n-- Air780EG,\u4e3a\u5185\u7f6e\u7684GPS\u82af\u7247\u4e0a\u7535. \u6ce8\u610f, Air780EG\u7684GPS\u548cGPS_ANT\u662f\u4e00\u8d77\u63a7\u5236\u7684,\u6240\u4ee5\u5408\u5e76\u4e86.\npm.power(pm.GPS, true)\n\n-- \u79fb\u82afCAT1\u5e73\u53f0\u7cfb\u5217(Air780E/Air700E/Air780EP\u7b49\u7b49)\u5f00\u542fpwrkey\u5f00\u673a\u9632\u6296\n-- \u6ce8\u610f: \u5f00\u542f\u540e, \u590d\u4f4d\u952e\u5c31\u53d8\u6210\u5173\u673a\u4e86!!! pwrkey\u8981\u957f\u63092\u79d2\u624d\u80fd\u5f00\u673a\n-- pm.power(pm.PWK_MODE, true)\n\n-- \u79fb\u82afCAT1\u5e73\u53f0\u7cfb\u5217(Air780E/Air700E/Air780EP\u7b49\u7b49)PSM+\u4f4e\u529f\u8017\u8bbe\u7f6e\n-- \u79fb\u82afCAT1\u5e73\u53f0\u7cfb\u5217(Air780E/Air700E/Air780EP\u7b49\u7b49)\u8282\u80fd\u6a21\u5f0f\uff0c0~3\uff0c0\u5b8c\u5168\u5173\u95ed\uff0c1\u6027\u80fd\u4f18\u5148\uff0c2\u5e73\u8861\uff0c3\u6781\u81f4\u529f\u8017\n-- \u8be6\u60c5\u8bbf\u95ee: https://airpsm.cn\n-- pm.power(pm.WORK_MODE, 1)\n", "prefix": "pm.power"}, "pm.ioVol": {"body": "pm.ioVol(${1:id},${2:val})", "description": "pm.ioVol(id, val) - IO\u9ad8\u7535\u5e73\u7535\u538b\u63a7\u5236\n\u4f20\u5165\u503c\uff1a\nint \u7535\u5e73id,\u76ee\u524d\u53ea\u6709pm.IOVOL_ALL_GPIO\nint \u7535\u5e73\u503c,\u5355\u4f4d\u6beb\u4f0f\n\u8fd4\u56de\u503c\uff1a\nboolean \u5904\u7406\u7ed3\u679ctrue\u6210\u529f\uff0cfalse\u5931\u8d25\n\u4f8b\u5b50\uff1a\n-- \u79fb\u82afCAT1\u5e73\u53f0\u7cfb\u5217(Air780E/Air700E/Air780EP\u7b49\u7b49)\u8bbe\u7f6eIO\u7535\u5e73, \u8303\u56f4 1650 ~ 2000\uff0c2650~3400 , \u5355\u4f4d\u6beb\u4f0f, \u6b65\u8fdb50mv\n-- \u6ce8\u610f, \u8fd9\u91cc\u7684\u8bbe\u7f6e\u4f18\u5148\u7ea7\u4f1a\u9ad8\u4e8e\u786c\u4ef6IOSEL\u811a\u7684\u914d\u7f6e\n-- \u4f46\u5f00\u673a\u65f6\u4f9d\u7136\u5148\u4f7f\u7528\u786c\u4ef6\u914d\u7f6e,\u76f4\u81f3\u8c03\u7528\u672cAPI\u8fdb\u884c\u914d\u7f6e, \u6240\u4ee5io\u7535\u5e73\u4f1a\u53d8\u5316\n-- pm.ioVol(pm.IOVOL_ALL_GPIO, 3300) -- \u6240\u6709GPIO\u9ad8\u7535\u5e73\u8f93\u51fa3.3V\n-- pm.ioVol(pm.IOVOL_ALL_GPIO, 1800) -- \u6240\u6709GPIO\u9ad8\u7535\u5e73\u8f93\u51fa1.8V\n", "prefix": "pm.ioVol"}, "pm.wakeupPin": {"body": "pm.wakeupPin(${1:pin},${2:level})", "description": "pm.wakeupPin(pin,level) - \u914d\u7f6e\u5524\u9192\u5f15\u811a (\u5f53\u524d\u4ec5\u4ec5esp\u7cfb\u5217\u53ef\u7528)\n\u4f20\u5165\u503c\uff1a\nint/table gpio\u5f15\u811a\nint \u5524\u9192\u7535\u538b \u53ef\u9009,\u9ed8\u8ba4\u4f4e\u7535\u5e73\u5524\u9192\n\u8fd4\u56de\u503c\uff1a\nboolean \u5904\u7406\u7ed3\u679c\n\u4f8b\u5b50\uff1a\npm.wakeupPin(8,0)\n", "prefix": "pm.wakeupPin"}, "protobuf.load": {"body": "protobuf.load(${1:pbdata})", "description": "protobuf.load(pbdata) - \u52a0\u8f7dpb\u4e8c\u8fdb\u5236\u5b9a\u4e49\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring \u901a\u8fc7protoc.exe\u7a0b\u5e8f\u8f6c\u6362\u5f97\u5230\u7684\u6570\u636e,\u901a\u5e38\u4ece\u6587\u4ef6\u8bfb\u53d6\u5f97\u5230\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\nint \u8bfb\u53d6\u4e86\u591a\u957f, \u8c03\u8bd5\u7528\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f, \u540c\u4e00\u4e2a\u6587\u4ef6\u53ea\u9700\u8981\u52a0\u8f7d\u4e00\u6b21, \u9664\u975e\u8c03\u7528\u8fc7protobuf.clear()\nprotobuf.load(io.readFile(\"/luadb/person.pb\"))\n", "prefix": "protobuf.load"}, "protobuf.clear": {"body": "protobuf.clear()", "description": "protobuf.clear() - \u6e05\u9664\u5df2\u52a0\u8f7d\u7684\u4e8c\u8fdb\u5236\u5b9a\u4e49\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c, \u603b\u662f\u6210\u529f\n\u4f8b\u5b50\uff1a\n-- \u6e05\u9664\u6240\u6709\u5df2\u52a0\u8f7d\u7684\u5b9a\u4e49\u6570\u636e\nprotobuf.clear()\n", "prefix": "protobuf.clear"}, "protobuf.encode": {"body": "protobuf.encode(${1:tpname},${2:data})", "description": "protobuf.encode(tpname, data) - \u7f16\u7801protobuffs\u6570\u636e\u5305\n\u4f20\u5165\u503c\uff1a\nstring \u6570\u636e\u7c7b\u578b\u540d\u79f0, \u5b9a\u4e49\u5728pb\u6587\u4ef6\u4e2d, \u7531protobuf.load\u52a0\u8f7d\ntable \u5f85\u7f16\u7801\u6570\u636e, \u5fc5\u987b\u662ftable, \u5185\u5bb9\u7b26\u5408pb\u6587\u4ef6\u91cc\u7684\u5b9a\u4e49\n\u8fd4\u56de\u503c\uff1a\nstring \u7f16\u7801\u540e\u7684\u6570\u636e,\u82e5\u5931\u8d25\u4f1a\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u6570\u636e\u7f16\u7801\nlocal tb = {\n name = \"wendal\"\n}\nlocal pbdata = protobuf.encode(\"Person\", tb)\nif pbdata then\n -- \u6ce8\u610f, \u7f16\u7801\u540e\u7684\u6570\u636e\u901a\u5e38\u5e26\u4e0d\u53ef\u89c1\u5b57\u7b26\n log.info(\"protobuf\", #pbdata, pbdata:toHex())\nend\n", "prefix": "protobuf.encode"}, "protobuf.decode": {"body": "protobuf.decode(${1:tpname},${2:data})", "description": "protobuf.decode(tpname, data) - \u89e3\u7801protobuffs\u6570\u636e\u5305\n\u4f20\u5165\u503c\uff1a\nstring \u6570\u636e\u7c7b\u578b\u540d\u79f0, \u5b9a\u4e49\u5728pb\u6587\u4ef6\u4e2d, \u7531protobuf.load\u52a0\u8f7d\nstring \u5f85\u7f16\u7801\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\ntable \u89e3\u7801\u540e\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u6570\u636e\u7f16\u7801\nlocal tb = {\n name = \"wendal\"\n}\nlocal pbdata = protobuf.encode(\"Person\", tb)\nif pbdata then\n -- \u6ce8\u610f, \u7f16\u7801\u540e\u7684\u6570\u636e\u901a\u5e38\u5e26\u4e0d\u53ef\u89c1\u5b57\u7b26\n log.info(\"protobuf\", #pbdata, pbdata:toHex())\nend\n", "prefix": "protobuf.decode"}, "pwm.open": {"body": "pwm.open(${1:channel},${2:period},${3:pulse},${4:pnum},${5:precision})", "description": "pwm.open(channel, period, pulse, pnum, precision) - \u5f00\u542f\u6307\u5b9a\u7684PWM\u901a\u9053\n\u4f20\u5165\u503c\uff1a\nint PWM\u901a\u9053\nint \u9891\u7387, 1-1000000hz\nint \u5360\u7a7a\u6bd4 0-\u5206\u9891\u7cbe\u5ea6\nint \u8f93\u51fa\u5468\u671f 0\u4e3a\u6301\u7eed\u8f93\u51fa, 1\u4e3a\u5355\u6b21\u8f93\u51fa, \u5176\u4ed6\u4e3a\u6307\u5b9a\u8109\u51b2\u6570\u8f93\u51fa\nint \u5206\u9891\u7cbe\u5ea6, 100/256/1000, \u9ed8\u8ba4\u4e3a100, \u82e5\u8bbe\u5907\u4e0d\u652f\u6301\u4f1a\u6709\u65e5\u5fd7\u63d0\u793a\n\u8fd4\u56de\u503c\uff1a\nboolean \u5904\u7406\u7ed3\u679c,\u6210\u529f\u8fd4\u56detrue,\u5931\u8d25\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u6253\u5f00PWM5, \u9891\u73871kHz, \u5360\u7a7a\u6bd450%\npwm.open(5, 1000, 50)\n-- \u6253\u5f00PWM5, \u9891\u738710kHz, \u5206\u9891\u4e3a 31/256\npwm.open(5, 10000, 31, 0, 256)\n", "prefix": "pwm.open"}, "pwm.close": {"body": "pwm.close(${1:channel})", "description": "pwm.close(channel) - \u5173\u95ed\u6307\u5b9a\u7684PWM\u901a\u9053\n\u4f20\u5165\u503c\uff1a\nint PWM\u901a\u9053\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u5904\u7406\u7ed3\u679c\n\u4f8b\u5b50\uff1a\n-- \u5173\u95edPWM5\npwm.close(5)\n", "prefix": "pwm.close"}, "pwm.capture": {"body": "pwm.capture(${1:channel})", "description": "pwm.capture(channel) - PWM\u6355\u83b7\n\u4f20\u5165\u503c\uff1a\nint PWM\u901a\u9053\nint \u6355\u83b7\u9891\u7387\n\u8fd4\u56de\u503c\uff1a\nboolean \u5904\u7406\u7ed3\u679c,\u6210\u529f\u8fd4\u56detrue,\u5931\u8d25\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- PWM0\u6355\u83b7\nwhile 1 do\n pwm.capture(0,1000)\n local ret,channel,pulse,pwmH,pwmL = sys.waitUntil(\"PWM_CAPTURE\", 2000)\n if ret then\n log.info(\"PWM_CAPTURE\",\"channel\"..channel,\"pulse\"..pulse,\"pwmH\"..pwmH,\"pwmL\"..pwmL)\n end\nend\n", "prefix": "pwm.capture"}, "repl.enable": {"body": "repl.enable(${1:re})", "description": "repl.enable(re) - \u542f\u7528\u6216\u7981\u7528REPL\u529f\u80fd\n\u4f20\u5165\u503c\uff1a\nbool \u542f\u7528\u4e0e\u5426,\u9ed8\u8ba4\u662f\u542f\u7528\nreturn \u4e4b\u524d\u7684\u8bbe\u7f6e\u72b6\u6001\n\u4f8b\u5b50\uff1a\n-- \u82e5\u56fa\u4ef6\u652f\u6301REPL,\u5373\u7f16\u8bd1\u65f6\u542f\u7528\u4e86REPL,\u662f\u9ed8\u8ba4\u542f\u7528REPL\u529f\u80fd\u7684\n-- \u672c\u51fd\u6570\u662f\u63d0\u4f9b\u5173\u95edREPL\u7684\u9014\u5f84\nrepl.enable(false)\n", "prefix": "repl.enable"}, "repl.push": {"body": "repl.push(${1:data})", "description": "repl.push(data) - \u4e3b\u52a8\u63a8\u9001\u5f85\u5904\u7406\u7684\u6570\u636e\u5230\u5e95\u5c42\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u5904\u7406\u7684\u6570\u636e,\u901a\u5e38\u4ece\u4e32\u53e3\u6765\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u865a\u62df\u4e32\u53e3\u7684\u8bbe\u5907\u624d\u9700\u8981\u8fd9\u4e2a\u51fd\u6570\n", "prefix": "repl.push"}, "rsa.encrypt": {"body": "rsa.encrypt(${1:key},${2:data})", "description": "rsa.encrypt(key, data) - RSA\u52a0\u5bc6\n\u4f20\u5165\u503c\uff1a\nstring \u516c\u94a5\u6570\u636e,\u4ec5\u652f\u6301PEM\u683c\u5f0f\nstring \u5f85\u52a0\u5bc6\u6570\u636e, \u4e0d\u80fd\u8d85\u8fc7\u516c\u94a5\u4f4d\u6570\u7684\u4e00\u534a, \u4f8b\u5982 2048bit\u7684\u516c\u94a5, \u53ea\u80fd\u52a0\u5bc6128\u5b57\u8282\u7684\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nstring \u52a0\u5bc6\u6210\u529f\u540e\u7684\u6570\u636e,\u82e5\u5931\u8d25\u4f1a\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u4e0b\u9762\u4ee3\u7801\u4e2d\u7684 \"abc\" \u662f\u5f85\u52a0\u5bc6\u6570\u636e\nlocal res = rsa.encrypt((io.readFile(\"/luadb/public.pem\")), \"abc\")\n-- \u6253\u5370\u7ed3\u679c\nlog.info(\"rsa\", \"encrypt\", res and #res or 0, res and res:toHex() or \"\")\n", "prefix": "rsa.encrypt"}, "rsa.decrypt": {"body": "rsa.decrypt(${1:key},${2:data},${3:pwd})", "description": "rsa.decrypt(key, data, pwd) - RSA\u89e3\u5bc6\n\u4f20\u5165\u503c\uff1a\nstring \u79c1\u94a5\u6570\u636e,\u4ec5\u652f\u6301PEM\u683c\u5f0f\nstring \u5f85\u89e3\u5bc6\u6570\u636e\nstring \u79c1\u94a5\u7684\u5bc6\u7801,\u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nstring \u89e3\u5bc6\u6210\u529f\u540e\u7684\u6570\u636e,\u82e5\u5931\u8d25\u4f1a\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f, \u89e3\u5bc6\u901a\u5e38\u5f88\u6162, \u5efa\u8bae\u5728\u670d\u52a1\u5668\u7aef\u8fdb\u884c\n-- res \u662f\u5f85\u89e3\u5bc6\u7684\u6570\u636e\nlocal dst = rsa.decrypt((io.readFile(\"/luadb/privkey.pem\")), res, \"\")\nlog.info(\"rsa\", \"decrypt\", dst and #dst or 0, dst and dst:toHex() or \"\")\n", "prefix": "rsa.decrypt"}, "rsa.verify": {"body": "rsa.verify(${1:key},${2:md},${3:hash},${4:sig})", "description": "rsa.verify(key, md, hash, sig) - RSA\u9a8c\u7b7e\n\u4f20\u5165\u503c\uff1a\nstring \u516c\u94a5\u6570\u636e,\u4ec5\u652f\u6301PEM\u683c\u5f0f\nint \u7b7e\u540d\u6a21\u5f0f, \u4f8b\u5982 rsa.MD_SHA1 , rsa.MD_SHA256\nstring hash\u6570\u636e, \u5982\u679c\u662fHEX\u5b57\u7b26\u4e32,\u8bb0\u5f97fromHex\u8f6c\u4e8c\u8fdb\u5236\u6570\u636e\nstring sig\u6570\u636e, \u5982\u679c\u662fHEX\u5b57\u7b26\u4e32,\u8bb0\u5f97fromHex\u8f6c\u4e8c\u8fdb\u5236\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nbool \u6709\u6548\u8fd4\u56detrue,\u5426\u5219\u4e3afalse,\u51fa\u9519\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nlocal ret = rsa.verify((io.readFile(\"/luadb/public.pem\")), rsa.MD_SHA1, hash, sig)\nlog.info(\"rsa\", \"verify\", ret)\n", "prefix": "rsa.verify"}, "rsa.sign": {"body": "rsa.sign(${1:key},${2:md},${3:hash},${4:pwd})", "description": "rsa.sign(key, md, hash, pwd) - RSA\u7b7e\u540d\n\u4f20\u5165\u503c\uff1a\nstring \u79c1\u94a5\u6570\u636e,\u4ec5\u652f\u6301PEM\u683c\u5f0f\nint \u7b7e\u540d\u6a21\u5f0f, \u4f8b\u5982 rsa.MD_SHA1 , rsa.MD_SHA256\nstring hash\u6570\u636e, \u5982\u679c\u662fHEX\u5b57\u7b26\u4e32,\u8bb0\u5f97fromHex\u8f6c\u4e8c\u8fdb\u5236\u6570\u636e\nstring \u79c1\u94a5\u5bc6\u7801, \u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nstring \u6210\u529f\u8fd4\u56desig\u6570\u636e, \u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nlocal sig = rsa.sign((io.readFile(\"/luadb/privkey.pem\")), rsa.MD_SHA1, hash, \"\")\nlog.info(\"rsa\", \"sign\", sig and #sig or 0, sig and sig:toHex() or \"\")\n", "prefix": "rsa.sign"}, "rtc.set": {"body": "rtc.set(${1:tab})", "description": "rtc.set(tab) - \u8bbe\u7f6e\u65f6\u949f\n\u4f20\u5165\u503c\uff1a\ntable or int \u65f6\u949f\u53c2\u6570,\u89c1\u793a\u4f8b\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56denil\u6216false\n\u4f8b\u5b50\uff1a\nrtc.set({year=2021,mon=8,day=31,hour=17,min=8,sec=43})\n--\u76ee\u524d\u53ea\u6709Air101/Air103/Air105/EC618\u7cfb\u5217\u652f\u6301\u65f6\u95f4\u6233\u65b9\u5f0f\nrtc.set(1652230554)\n", "prefix": "rtc.set"}, "rtc.get": {"body": "rtc.get()", "description": "rtc.get() - \u83b7\u53d6\u65f6\u949f\n\u8fd4\u56de\u503c\uff1a\ntable \u65f6\u949f\u53c2\u6570,\u89c1\u793a\u4f8b\n\u4f8b\u5b50\uff1a\nlocal t = rtc.get()\n-- {year=2021,mon=8,day=31,hour=17,min=8,sec=43}\nlog.info(\"rtc\", json.encode(t))\n", "prefix": "rtc.get"}, "rtc.timerStart": {"body": "rtc.timerStart(${1:id},${2:tab})", "description": "rtc.timerStart(id, tab) - \u8bbe\u7f6eRTC\u5524\u9192\u65f6\u95f4\n\u4f20\u5165\u503c\uff1a\nint \u65f6\u949fid,\u901a\u5e38\u53ea\u652f\u63010\ntable \u65f6\u949f\u53c2\u6570,\u89c1\u793a\u4f8b\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56denil\u6216false\n\u4f8b\u5b50\uff1a\n-- \u76ee\u524d\u8be5\u63a5\u53e3\u4e0d\u9002\u7528\u4e8e\u79fb\u82af\u6a21\u5757780E/700E/780EP\u7cfb\u5217\uff0c\u9700\u8981\u5b9a\u65f6\u5524\u9192\u53ef\u4f7f\u7528pm.dtimerStart()\n-- \u4f7f\u7528\u524d\u5efa\u8bae\u5148rtc.set\u8bbe\u7f6e\u4e3a\u6b63\u786e\u7684\u65f6\u95f4\nrtc.timerStart(0, {year=2021,mon=9,day=1,hour=17,min=8,sec=43})\n", "prefix": "rtc.timerStart"}, "rtc.timerStop": {"body": "rtc.timerStop(${1:id})", "description": "rtc.timerStop(id) - \u53d6\u6d88RTC\u5524\u9192\u65f6\u95f4\n\u4f20\u5165\u503c\uff1a\nint \u65f6\u949fid,\u901a\u5e38\u53ea\u652f\u63010\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56denil\u6216false\n\u4f8b\u5b50\uff1a\nrtc.timerStop(0)\n", "prefix": "rtc.timerStop"}, "rtc.setBaseYear": {"body": "rtc.setBaseYear(${1:Base_year})", "description": "rtc.setBaseYear(Base_year) - \u8bbe\u7f6eRTC\u57fa\u51c6\u5e74,\u4e0d\u63a8\u8350\n\u4f20\u5165\u503c\uff1a\nint \u57fa\u51c6\u5e74Base_year,\u901a\u5e381900\n\u4f8b\u5b50\uff1a\nrtc.setBaseYear(1900)\n", "prefix": "rtc.setBaseYear"}, "rtc.timezone": {"body": "rtc.timezone(${1:tz})", "description": "rtc.timezone(tz) - \u8bfb\u53d6\u6216\u8bbe\u7f6e\u65f6\u533a\n\u4f20\u5165\u503c\uff1a\nint \u65f6\u533a\u503c,\u6ce8\u610f\u5355\u4f4d\u662f1/4\u65f6\u533a.\u4f8b\u5982\u4e1c\u516b\u533a\u662f 32,\u800c\u975e8. \u53ef\u4ee5\u4e0d\u4f20\nreturn \u5f53\u524d/\u8bbe\u7f6e\u540e\u7684\u65f6\u533a\u503c\n\u4f8b\u5b50\uff1a\n-- \u8bbe\u7f6e\u4e3a\u4e1c8\u533a\nrtc.timezone(32)\n-- \u8bbe\u7f6e\u4e3a\u4e1c3\u533a\nrtc.timezone(12)\n-- \u8bbe\u7f6e\u4e3a\u897f4\u533a\nrtc.timezone(-16)\n-- \u6ce8\u610f: \u65e0\u8bba\u8bbe\u7f6e\u65f6\u533a\u662f\u591a\u5c11, rtc.get/set\u603b\u662fUTC\u65f6\u95f4\n-- \u65f6\u533a\u5f71\u54cd\u7684\u662f os.date/os.time \u51fd\u6570\n-- \u53ea\u6709\u90e8\u5206\u6a21\u5757\u652f\u6301\u8bbe\u7f6e\u65f6\u533a, \u4e14\u9ed8\u8ba4\u503c\u4e00\u822c\u4e3a32, \u5373\u4e1c\u516b\u533a\n", "prefix": "rtc.timezone"}, "rtos.receive": {"body": "rtos.receive(${1:timeout})", "description": "rtos.receive(timeout) - \u63a5\u53d7\u5e76\u5904\u7406\u5e95\u5c42\u6d88\u606f\u961f\u5217.\n\u4f20\u5165\u503c\uff1a\nint \u8d85\u65f6\u65f6\u957f,\u901a\u5e38\u662f-1,\u6c38\u4e45\u7b49\u5f85\n\u8fd4\u56de\u503c\uff1a\nmsgid \u5982\u679c\u662f\u5b9a\u65f6\u5668\u6d88\u606f,\u4f1a\u8fd4\u56de\u5b9a\u65f6\u5668\u6d88\u606fid\u53ca\u9644\u52a0\u4fe1\u606f, \u5176\u4ed6\u6d88\u606f\u7531\u5e95\u5c42\u51b3\u5b9a,\u4e0d\u5411lua\u5c42\u8fdb\u884c\u4efb\u4f55\u4fdd\u8bc1.\n", "prefix": "rtos.receive"}, "rtos.timer_start": {"body": "rtos.timer_start(${1:id},${2:timeout},${3:_repeat})", "description": "rtos.timer_start(id,timeout,_repeat) - \u542f\u52a8\u4e00\u4e2a\u5b9a\u65f6\u5668\n\u4f20\u5165\u503c\uff1a\nint \u5b9a\u65f6\u5668id\nint \u8d85\u65f6\u65f6\u957f,\u5355\u4f4d\u6beb\u79d2\nint \u91cd\u590d\u6b21\u6570,\u9ed8\u8ba4\u662f0\n\u8fd4\u56de\u503c\uff1a\nid \u5982\u679c\u662f\u5b9a\u65f6\u5668\u6d88\u606f,\u4f1a\u8fd4\u56de\u5b9a\u65f6\u5668\u6d88\u606fid\u53ca\u9644\u52a0\u4fe1\u606f, \u5176\u4ed6\u6d88\u606f\u7531\u5e95\u5c42\u51b3\u5b9a,\u4e0d\u5411lua\u5c42\u8fdb\u884c\u4efb\u4f55\u4fdd\u8bc1.\n\u4f8b\u5b50\uff1a\n-- \u7528\u6237\u4ee3\u7801\u8bf7\u4f7f\u7528 sys.timerStart\n-- \u542f\u52a8\u4e00\u4e2a3\u79d2\u7684\u5faa\u73af\u5b9a\u65f6\u5668\nrtos.timer_start(10000, 3000, -1)\n", "prefix": "rtos.timer_start"}, "rtos.timer_stop": {"body": "rtos.timer_stop(${1:id})", "description": "rtos.timer_stop(id) - \u5173\u95ed\u5e76\u91ca\u653e\u4e00\u4e2a\u5b9a\u65f6\u5668\n\u4f20\u5165\u503c\uff1a\nint \u5b9a\u65f6\u5668id\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u7528\u6237\u4ee3\u7801\u8bf7\u4f7f\u7528sys.timerStop\nrtos.timer_stop(id)\n", "prefix": "rtos.timer_stop"}, "rtos.reboot": {"body": "rtos.reboot()", "description": "rtos.reboot() - \u8bbe\u5907\u91cd\u542f\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "rtos.reboot"}, "rtos.buildDate": {"body": "rtos.buildDate()", "description": "rtos.buildDate() - \u83b7\u53d6\u56fa\u4ef6\u7f16\u8bd1\u65e5\u671f\n\u8fd4\u56de\u503c\uff1a\nstring \u56fa\u4ef6\u7f16\u8bd1\u65e5\u671f\n\u4f8b\u5b50\uff1a\n-- \u83b7\u53d6\u7f16\u8bd1\u65e5\u671f\nlocal d = rtos.buildDate()\n", "prefix": "rtos.buildDate"}, "rtos.bsp": {"body": "rtos.bsp()", "description": "rtos.bsp() - \u83b7\u53d6\u786c\u4ef6bsp\u578b\u53f7\n\u8fd4\u56de\u503c\uff1a\nstring \u786c\u4ef6bsp\u578b\u53f7\n\u4f8b\u5b50\uff1a\n-- \u83b7\u53d6\u786c\u4ef6bsp\u578b\u53f7\nlocal bsp = rtos.bsp()\n", "prefix": "rtos.bsp"}, "rtos.version": {"body": "rtos.version()", "description": "rtos.version() - \u83b7\u53d6\u56fa\u4ef6\u7248\u672c\u53f7\n\u8fd4\u56de\u503c\uff1a\nstring \u56fa\u4ef6\u7248\u672c\u53f7,\u4f8b\u5982\"V0001\"\n\u4f8b\u5b50\uff1a\n-- \u8bfb\u53d6\u7248\u672c\u53f7\nlocal luatos_version = rtos.version()\n", "prefix": "rtos.version"}, "rtos.standy": {"body": "rtos.standy(${1:timeout})", "description": "rtos.standy(timeout) - \u8fdb\u5165\u5f85\u673a\u6a21\u5f0f, \u4ec5\u90e8\u5206\u8bbe\u5907\u53ef\u7528, \u672cAPI\u5df2\u5e9f\u5f03, \u63a8\u8350\u4f7f\u7528pm\u5e93\n\u4f20\u5165\u503c\uff1a\nint \u4f11\u7720\u65f6\u957f,\u5355\u4f4d\u6beb\u79d2\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u8fdb\u5165\u5f85\u673a\u6a21\u5f0f\nrtos.standby(5000)\n", "prefix": "rtos.standy"}, "rtos.meminfo": {"body": "rtos.meminfo(${1:type})", "description": "rtos.meminfo(type) - \u83b7\u53d6\u5185\u5b58\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\ntype \"sys\"\u7cfb\u7edf\u5185\u5b58, \"lua\"\u865a\u62df\u673a\u5185\u5b58,\"psram\"psram\u5185\u5b58, \u9ed8\u8ba4\u4e3alua\u865a\u62df\u673a\u5185\u5b58\n\u8fd4\u56de\u503c\uff1a\nint \u603b\u5185\u5b58\u5927\u5c0f,\u5355\u4f4d\u5b57\u8282\nint \u5f53\u524d\u5df2\u4f7f\u7528\u7684\u5185\u5b58\u5927\u5c0f,\u5355\u4f4d\u5b57\u8282\nint \u5386\u53f2\u6700\u9ad8\u5df2\u4f7f\u7528\u7684\u5185\u5b58\u5927\u5c0f,\u5355\u4f4d\u5b57\u8282\n\u4f8b\u5b50\uff1a\n-- \u6253\u5370\u5185\u5b58\u5360\u7528\nlog.info(\"mem.lua\", rtos.meminfo())\nlog.info(\"mem.sys\", rtos.meminfo(\"sys\"))\n", "prefix": "rtos.meminfo"}, "rtos.firmware": {"body": "rtos.firmware()", "description": "rtos.firmware() - \u8fd4\u56de\u5e95\u5c42\u63cf\u8ff0\u4fe1\u606f,\u683c\u5f0f\u4e3a LuatOS_$VERSION_$BSP,\u53ef\u7528\u4e8eOTA\u5347\u7ea7\u5224\u65ad\u5e95\u5c42\u4fe1\u606f\n\u8fd4\u56de\u503c\uff1a\nstring \u5e95\u5c42\u63cf\u8ff0\u4fe1\u606f\n\u4f8b\u5b50\uff1a\n-- \u6253\u5370\u5e95\u5c42\u63cf\u8ff0\u4fe1\u606f\nlog.info(\"firmware\", rtos.firmware())\n", "prefix": "rtos.firmware"}, "rtos.setPaths": {"body": "rtos.setPaths(${1:pathA},${2:pathB},${3:pathC},${4:pathD})", "description": "rtos.setPaths(pathA, pathB, pathC, pathD) - \u8bbe\u7f6e\u81ea\u5b9a\u4e49lua\u811a\u672c\u641c\u7d22\u8def\u5f84,\u4f18\u5148\u7ea7\u9ad8\u4e8e\u5185\u7f6e\u8def\u5f84\n\u4f20\u5165\u503c\uff1a\nstring \u8def\u5f84A, \u4f8b\u5982 \"/sdcard/%s.luac\",\u82e5\u4e0d\u4f20\u503c,\u5c06\u9ed8\u8ba4\u4e3a\"\",\u53e6\u5916,\u6700\u5927\u957f\u5ea6\u4e0d\u80fd\u8d85\u8fc723\u5b57\u8282\nstring \u8def\u5f84B, \u4f8b\u5982 \"/sdcard/%s.lua\"\nstring \u8def\u5f84C, \u4f8b\u5982 \"/lfs2/%s.luac\"\nstring \u8def\u5f84D, \u4f8b\u5982 \"/lfs2/%s.lua\"\n\u4f8b\u5b50\uff1a\n-- \u6302\u8f7dsd\u5361\u6216\u8005spiflash\u540e\nrtos.setPaths(\"/sdcard/user/%s.luac\", \"/sdcard/user/%s.lua\")\nrequire(\"sd_user_main\") -- \u5c06\u641c\u7d22\u5e76\u52a0\u8f7d /sdcard/user/sd_user_main.luac \u548c /sdcard/user/sd_user_main.lua\n", "prefix": "rtos.setPaths"}, "rtos.nop": {"body": "rtos.nop()", "description": "rtos.nop() - \u7a7a\u51fd\u6570,\u4ec0\u4e48\u90fd\u4e0d\u505a\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u8fd9\u4e2a\u51fd\u6570\u5355\u7eaf\u5c31\u662f lua -> c -> lua \u8d70\u4e00\u904d\n-- \u6ca1\u6709\u53c2\u6570,\u6ca1\u6709\u8fd4\u56de\u503c,\u6ca1\u6709\u903b\u8f91\u5904\u7406\n-- \u5728\u7edd\u5927\u591a\u6570\u60c5\u51b5\u4e0b,\u4e0d\u4f1a\u9047\u5230\u8fd9\u4e2a\u51fd\u6570\u7684\u8c03\u7528\n-- \u5b83\u901a\u5e38\u53ea\u4f1a\u51fa\u73b0\u5728\u6027\u80fd\u6d4b\u8bd5\u7684\u4ee3\u7801\u91cc, \u56e0\u4e3a\u5b83\u4ec0\u4e48\u90fd\u4e0d\u5e72.\nrtos.nop()\n", "prefix": "rtos.nop"}, "rtos.autoCollectMem": {"body": "rtos.autoCollectMem(${1:period},${2:warning_level},${3:force_level})", "description": "rtos.autoCollectMem(period, warning_level, force_level) - \u5185\u5b58\u81ea\u52a8\u6536\u96c6\u914d\u7f6e\uff0c\u662flua\u672c\u8eab\u6536\u96c6\u673a\u5236\u7684\u4e00\u79cd\u8865\u5145\uff0c\u4e0d\u662f\u5fc5\u8981\u7684\uff0c\u800c\u4e14\u53ea\u5728luavm\u7a7a\u95f2\u65f6\u89e6\u53d1\n\u4f20\u5165\u503c\uff1a\nint \u81ea\u52a8\u6536\u96c6\u7684\u5468\u671f\uff0c\u7b49\u540c\u4e8ereceive\u8c03\u7528\u6b21\u6570\uff0c0~60000\u3002\u5982\u679c\u662f0\uff0c\u5219\u5173\u95ed\u81ea\u52a8\u6536\u96c6\u529f\u80fd\uff0c\u9ed8\u8ba4\u662f100\nint \u5185\u5b58\u4f7f\u7528\u8b66\u6212\u6c34\u4f4d\u7ebf\uff0c\u662f\u603bluavm\u5185\u5b58\u91cf\u7684\u767e\u5206\u6bd4\uff0c50~95\uff0c\u5185\u5b58\u8fbe\u5230(>=)\u8b66\u6212\u7ebf\u65f6\u624d\u4f1a\u5f00\u59cb\u5224\u65ad\u662f\u5426\u8981\u6536\u96c6\u3002\u9ed8\u8ba4\u662f80\nint \u5185\u5b58\u4f7f\u7528\u5f3a\u5236\u6536\u96c6\u6c34\u4f4d\u7ebf\uff0c\u662f\u603bluavm\u5185\u5b58\u91cf\u7684\u767e\u5206\u6bd4\uff0c50~95\uff0c\u5185\u5b58\u8fbe\u5230(>=)\u5f3a\u5236\u6536\u96c6\u7ebf\u65f6\u4f1a\u5f3a\u5236\u6536\u96c6\u3002\u9ed8\u8ba4\u662f90\uff0c\u5fc5\u987b\u6bd4\u8b66\u6212\u6c34\u4f4d\u7ebf\u5927\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nrtos.autoCollectMem(100, 80, 90)\n", "prefix": "rtos.autoCollectMem"}, "sdio.init": {"body": "sdio.init(${1:id})", "description": "sdio.init(id) - \u521d\u59cb\u5316sdio\n\u4f20\u5165\u503c\uff1a\nint \u901a\u9053id,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173,\u901a\u5e38\u4ece0\u5f00\u59cb,\u9ed8\u8ba40\n\u8fd4\u56de\u503c\uff1a\nboolean \u6253\u5f00\u7ed3\u679c\n", "prefix": "sdio.init"}, "sdio.sd_read": {"body": "sdio.sd_read(${1:id},${2:offset},${3:len})", "description": "sdio.sd_read(id, offset, len) - \u76f4\u63a5\u8bfb\u5199sd\u5361\u4e0a\u7684\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint sdio\u603b\u7ebfid\nint \u504f\u79fb\u91cf,\u5fc5\u987b\u662f512\u7684\u500d\u6570\nint \u957f\u5ea6,\u5fc5\u987b\u662f512\u7684\u500d\u6570\n\u8fd4\u56de\u503c\uff1a\nstring \u82e5\u8bfb\u53d6\u6210\u529f,\u8fd4\u56de\u5b57\u7b26\u4e32,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316sdio\u5e76\u76f4\u63a5\u8bfb\u53d6sd\u5361\u6570\u636e\nsdio.init(0)\nlocal t = sdio.sd_read(0, 0, 1024)\nif t then\n --- xxx\nend\n", "prefix": "sdio.sd_read"}, "sdio.sd_write": {"body": "sdio.sd_write(${1:id},${2:data},${3:offset})", "description": "sdio.sd_write(id, data, offset) - \u76f4\u63a5\u5199sd\u5361\n\u4f20\u5165\u503c\uff1a\nint sdio\u603b\u7ebfid\nstring \u5f85\u5199\u5165\u7684\u6570\u636e,\u957f\u5ea6\u5fc5\u987b\u662f512\u7684\u500d\u6570\nint \u504f\u79fb\u91cf,\u5fc5\u987b\u662f512\u7684\u500d\u6570\n\u8fd4\u56de\u503c\uff1a\nbool \u82e5\u8bfb\u53d6\u6210\u529f,\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316sdio\u5e76\u76f4\u63a5\u8bfb\u53d6sd\u5361\u6570\u636e\nsdio.init(0)\nlocal t = sdio.sd_write(0, data, 0)\nif t then\n --- xxx\nend\n", "prefix": "sdio.sd_write"}, "sensor.ds18b20": {"body": "sensor.ds18b20(${1:pin},${2:check_crc})", "description": "sensor.ds18b20(pin, check_crc) - \u83b7\u53d6DS18B20\u7684\u6e29\u5ea6\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint gpio\u7aef\u53e3\u53f7\nboolean \u662f\u5426\u6821\u9a8ccrc\u503c,\u9ed8\u8ba4\u4e3atrue. \u4e0d\u6821\u9a8ccrc\u503c\u80fd\u63d0\u9ad8\u8bfb\u53d6\u6210\u529f\u7684\u6982\u7387,\u4f46\u53ef\u80fd\u4f1a\u8bfb\u53d6\u5230\u9519\u8bef\u7684\u503c\n\u8fd4\u56de\u503c\uff1a\nint \u6e29\u5ea6\u6570\u636e,\u5355\u4f4d0.1\u6444\u6c0f\u5ea6\uff0c\u8bfb\u53d6\u5931\u8d25\u65f6\u8fd4\u56de\u9519\u8bef\u7801\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nwhile 1 do\n sys.wait(5000)\n local val,result = sensor.ds18b20(17, true) -- GPIO17\u4e14\u6821\u9a8cCRC\u503c\n -- val 301 == 30.1\u6444\u6c0f\u5ea6\n -- result true \u8bfb\u53d6\u6210\u529f\n log.info(\"ds18b20\", val, result)\nend\n", "prefix": "sensor.ds18b20"}, "sensor.w1_reset": {"body": "sensor.w1_reset(${1:pin})", "description": "sensor.w1_reset(pin) - \u5355\u603b\u7ebf\u534f\u8bae,\u590d\u4f4d\u8bbe\u5907\n\u4f20\u5165\u503c\uff1a\nint gpio\u7aef\u53e3\u53f7\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\n", "prefix": "sensor.w1_reset"}, "sensor.w1_connect": {"body": "sensor.w1_connect(${1:pin})", "description": "sensor.w1_connect(pin) - \u5355\u603b\u7ebf\u534f\u8bae,\u8fde\u63a5\u8bbe\u5907\n\u4f20\u5165\u503c\uff1a\nint gpio\u7aef\u53e3\u53f7\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5931\u8d25\u8fd4\u56defalse\n", "prefix": "sensor.w1_connect"}, "sensor.w1_write": {"body": "sensor.w1_write(${1:pin},${2:data1},${3:data2})", "description": "sensor.w1_write(pin, data1,data2) - \u5355\u603b\u7ebf\u534f\u8bae,\u5f80\u603b\u7ebf\u5199\u5165\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint gpio\u7aef\u53e3\u53f7\nint \u7b2c\u4e00\u4e2a\u6570\u636e\nint \u7b2c\u4e8c\u4e2a\u6570\u636e, \u53ef\u4ee5\u5199N\u4e2a\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "sensor.w1_write"}, "sensor.w1_read": {"body": "sensor.w1_read(${1:pin},${2:len})", "description": "sensor.w1_read(pin, len) - \u5355\u603b\u7ebf\u534f\u8bae,\u4ece\u603b\u7ebf\u8bfb\u53d6\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint gpio\u7aef\u53e3\u53f7\nint \u8bfb\u53d6\u7684\u957f\u5ea6\n\u8fd4\u56de\u503c\uff1a\nint \u6309\u8bfb\u53d6\u7684\u957f\u5ea6\u8fd4\u56deN\u4e2a\u6574\u6570\n", "prefix": "sensor.w1_read"}, "sensor.hx711": {"body": "sensor.hx711(${1:pin_date},${2:pin_clk})", "description": "sensor.hx711(pin_date,pin_clk) - \u83b7\u53d6Hx711\u7684\u538b\u529b\u4f20\u611f\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u6570\u636e\u7684gpio\u7aef\u53e3\u53f7\nint \u65f6\u949f\u7684gpio\u7aef\u53e3\u53f7\n\u8fd4\u56de\u503c\uff1a\nint hx711\u8bfb\u5230\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u5982\u679c\u8bbe\u5907\u4e0d\u5b58\u5728\u4f1a\u5361\u5728\u8bfb\u53d6\u63a5\u53e3\nsys.taskInit(\n function()\n sys.wait(1000)\n local maopi = sensor.hx711(0,7)\n while true do\n sys.wait(2000)\n a = sensor.hx711(0,7) - maopi\n if a > 0 then\n log.info(\"tag\", a / 4.6)\n end\n end\n end\n)\n", "prefix": "sensor.hx711"}, "sensor.cs1237": {"body": "sensor.cs1237(${1:pin_date},${2:pin_clk})", "description": "sensor.cs1237(pin_date,pin_clk) - \u83b7\u53d6cs1237\u4f20\u611f\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u6570\u636e\u7684gpio\u7aef\u53e3\u53f7\nint \u65f6\u949f\u7684gpio\u7aef\u53e3\u53f7\n\u8fd4\u56de\u503c\uff1a\nint cs1237\u8bfb\u5230\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u5982\u679c\u8bbe\u5907\u4e0d\u5b58\u5728\u4f1a\u5361\u5728\u8bfb\u53d6\u63a5\u53e3\nsys.taskInit(\n function()\n sys.wait(1000)\n local cs1237_data = sensor.cs1237(0,7)\n while true do\n sys.wait(2000)\n cs1237_data = sensor.cs1237(0,7) - maopi\n log.info(\"cs1237_data:\", cs1237_data)--\u5f97\u5230\u539f\u59cb\u6570\u636e\n end\n end\n)\n", "prefix": "sensor.cs1237"}, "sensor.ws2812b": {"body": "sensor.ws2812b(${1:pin},${2:data},${3:T0H},${4:T0L},${5:T1H},${6:T1L})", "description": "sensor.ws2812b(pin,data,T0H,T0L,T1H,T1L) - \u8bbe\u7f6ews2812b\u8f93\u51fa(gpio\u9a71\u52a8\u65b9\u5f0f)\n\u4f20\u5165\u503c\uff1a\nint ws2812b\u7684gpio\u7aef\u53e3\u53f7\nstring/zbuff \u5f85\u53d1\u9001\u7684\u6570\u636e\uff08\u5982\u679c\u4e3azbuff\u6570\u636e\uff0c\u5219\u4f1a\u65e0\u89c6\u6307\u9488\u4f4d\u7f6e\u59cb\u7ec8\u4ece0\u504f\u79fb\u5f00\u59cb\uff09\nint T0H\u65f6\u95f4\uff0c\u8868\u793a\u5ef6\u65f6\u591a\u5c11\u4e2anop\uff0c\u6bcf\u4e2a\u578b\u53f7\u4e0d\u4e00\u6837\uff0c\u81ea\u5df1\u8c03\nint T0L\u65f6\u95f4\uff0c\u8868\u793a\u5ef6\u65f6\u591a\u5c11\u4e2anop\nint T1H\u65f6\u95f4\uff0c\u8868\u793a\u5ef6\u65f6\u591a\u5c11\u4e2anop\nint T1L\u65f6\u95f4\uff0c\u8868\u793a\u5ef6\u65f6\u591a\u5c11\u4e2anop\n\u4f8b\u5b50\uff1a\nlocal buff = zbuff.create({8,8,24})\nbuff:drawLine(1,2,5,6,0x00ffff)\nsensor.ws2812b(7,buff,300,700,700,700)\n", "prefix": "sensor.ws2812b"}, "sensor.ws2812b_pwm": {"body": "sensor.ws2812b_pwm(${1:pin},${2:data})", "description": "sensor.ws2812b_pwm(pin,data) - \u8bbe\u7f6ews2812b\u8f93\u51fa(pwm\u9a71\u52a8\u65b9\u5f0f,\u9700\u8981pwm\u80fd\u8f93\u51fa800k\u9891\u7387\uff0c\u5426\u5219\u65e0\u6cd5\u4f7f\u7528\u6b64\u65b9\u6cd5)\n\u4f20\u5165\u503c\uff1a\nint pwm\u7aef\u53e3\u53f7\nstring/zbuff \u5f85\u53d1\u9001\u7684\u6570\u636e\uff08\u5982\u679c\u4e3azbuff\u6570\u636e\uff0c\u5219\u4f1a\u65e0\u89c6\u6307\u9488\u4f4d\u7f6e\u59cb\u7ec8\u4ece0\u504f\u79fb\u5f00\u59cb\uff09\n\u4f8b\u5b50\uff1a\nlocal buff = zbuff.create({8,8,24})\nbuff:setFrameBuffer(8,8,24,0x0000ff)\nsensor.ws2812b_pwm(7,buff)\n", "prefix": "sensor.ws2812b_pwm"}, "sensor.ws2812b_spi": {"body": "sensor.ws2812b_spi(${1:pin},${2:data})", "description": "sensor.ws2812b_spi(pin,data) - \u8bbe\u7f6ews2812b\u8f93\u51fa(spi\u9a71\u52a8\u65b9\u5f0f,\u9700\u8981spi\u80fd\u8f93\u51fa5M\u9891\u7387\uff0c\u5426\u5219\u65e0\u6cd5\u4f7f\u7528\u6b64\u65b9\u6cd5)\n\u4f20\u5165\u503c\uff1a\nint spi\u7aef\u53e3\u53f7\nstring/zbuff \u5f85\u53d1\u9001\u7684\u6570\u636e\uff08\u5982\u679c\u4e3azbuff\u6570\u636e\uff0c\u5219\u4f1a\u65e0\u89c6\u6307\u9488\u4f4d\u7f6e\u59cb\u7ec8\u4ece0\u504f\u79fb\u5f00\u59cb\uff09\n\u4f8b\u5b50\uff1a\nlocal buff = zbuff.create({8,8,24})\nbuff:setFrameBuffer(8,8,24,0x0000ff)\nsensor.ws2812b_spi(2,buff)\n", "prefix": "sensor.ws2812b_spi"}, "sensor.dht1x": {"body": "sensor.dht1x(${1:pin})", "description": "sensor.dht1x(pin) - \u83b7\u53d6DHT11/DHT12\u7684\u6e29\u6e7f\u5ea6\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint gpio\u7aef\u53e3\u53f7\nboolean \u662f\u5426\u6821\u9a8ccrc\u503c,\u9ed8\u8ba4\u4e3atrue. \u4e0d\u6821\u9a8ccrc\u503c\u80fd\u63d0\u9ad8\u8bfb\u53d6\u6210\u529f\u7684\u6982\u7387,\u4f46\u53ef\u80fd\u4f1a\u8bfb\u53d6\u5230\u9519\u8bef\u7684\u503c\n\u8fd4\u56de\u503c\uff1a\nint \u6e7f\u5ea6\u6570\u636e,\u5355\u4f4d0.01%\uff0c\u8bfb\u53d6\u5931\u8d25\u65f6\u8fd4\u56de\u9519\u8bef\u503c\nint \u6e29\u5ea6\u6570\u636e,\u5355\u4f4d0.01\u6444\u6c0f\u5ea6\uff0c\u8bfb\u53d6\u5931\u8d25\u65f6\u8fd4\u56de\u9519\u8bef\u503c\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nwhile 1 do\n sys.wait(1000)\n local h,t,r = sensor.dht1x(17, true) -- GPIO17\u4e14\u6821\u9a8cCRC\u503c\n log.info(\"dht11\", h/100,t/100,r)--90.1 23.22\nend\n", "prefix": "sensor.dht1x"}, "sensor.sc12a": {"body": "sensor.sc12a(${1:sda},${2:scl})", "description": "sensor.sc12a(sda,scl) - \u83b7\u53d6sc12a\u88ab\u89e6\u6478\u7684\u901a\u9053\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u6570\u636e\u7684gpio\u7aef\u53e3\u53f7\nint \u65f6\u949f\u7684gpio\u7aef\u53e3\u53f7\n\u8fd4\u56de\u503c\uff1a\nint \u8bfb\u53d6\u6210\u529f\u8fd4\u56de\u6574\u5f62\u6570\u636e\uff0c\u8bfb\u53d6\u5931\u8d25\u65f6\u8fd4\u56de\u9519\u8bef\u503c\n\u4f8b\u5b50\uff1a\nwhile true do\n local temp1=sensor.sc12a(4,7)\n if bit.rshift(bit.band( temp1, 0x8000), 15 )==0x01 then\n log.info(\"\u88ab\u6309\u4e0b\u7684\u6709\u901a\u90530\")\n end\n if bit.rshift(bit.band( temp1, 0x4000), 14 )==0x01 then\n log.info(\"\u88ab\u6309\u4e0b\u7684\u6709\u901a\u90531\")\n end\n if bit.rshift(bit.band( temp1, 0x2000), 13 )==0x01 then\n log.info(\"\u88ab\u6309\u4e0b\u7684\u6709\u901a\u90532\")\n end\n if bit.rshift(bit.band( temp1, 0x1000), 12 )==0x01 then\n log.info(\"\u88ab\u6309\u4e0b\u7684\u6709\u901a\u90533\")\n end\n if bit.rshift(bit.band( temp1, 0x800), 11 )==0x01 then\n log.info(\"\u88ab\u6309\u4e0b\u7684\u6709\u901a\u90534\")\n end\n if bit.rshift(bit.band( temp1, 0x400), 10 )==0x01 then\n log.info(\"\u88ab\u6309\u4e0b\u7684\u6709\u901a\u90535\")\n end\n if bit.rshift(bit.band( temp1, 0x200), 9 )==0x01 then\n log.info(\"\u88ab\u6309\u4e0b\u7684\u6709\u901a\u90536\")\n end\n if bit.rshift(bit.band( temp1, 0x100), 8 )==0x01 then\n log.info(\"\u88ab\u6309\u4e0b\u7684\u6709\u901a\u90537\")\n end\n if bit.rshift(bit.band( temp1, 0x80), 7 )==0x01 then\n log.info(\"\u88ab\u6309\u4e0b\u7684\u6709\u901a\u90538\")\n end\n if bit.rshift(bit.band( temp1, 0x40), 6 )==0x01 then\n log.info(\"\u88ab\u6309\u4e0b\u7684\u6709\u901a\u90539\")\n end\n if bit.rshift(bit.band( temp1, 0x20), 5 )==0x01 then\n log.info(\"\u88ab\u6309\u4e0b\u7684\u6709\u901a\u905310\")\n end\n if bit.rshift(bit.band( temp1, 0x10), 4 )==0x01 then\n log.info(\"\u88ab\u6309\u4e0b\u7684\u6709\u901a\u905311\")\n end\n sys.wait(200)\nend\n", "prefix": "sensor.sc12a"}, "sensor.yhm27xxx": {"body": "sensor.yhm27xxx(${1:pin},${2:chip_id},${3:reg},${4:data})", "description": "sensor.yhm27xxx(pin, chip_id, reg, data) - \u5355\u603b\u7ebf\u547d\u4ee4\u8bfb\u5199YHM27XX\n\u4f20\u5165\u503c\uff1a\nint gpio\u7aef\u53e3\u53f7\nint \u82af\u7247ID\nint \u5bc4\u5b58\u5668\u5730\u5740\nint \u8981\u5199\u5165\u7684\u6570\u636e\uff0c\u5982\u679c\u6ca1\u586b\uff0c\u5219\u8868\u793a\u4ece\u5bc4\u5b58\u5668\u8bfb\u53d6\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5931\u8d25\u8fd4\u56defalse\nint \u8bfb\u53d6\u6210\u529f\u8fd4\u56de\u5bc4\u5b58\u5668\u503c\uff0c\u5199\u5165\u6210\u529f\u65e0\u8fd4\u56de\n\u4f8b\u5b50\uff1a\nwhile 1 do\n sys.wait(1000)\n local result, data = sensor.yhm27xxx(15, 0x04, 0x05)\n log.info(\"yhm27xxx\", result, data)\nend\n", "prefix": "sensor.yhm27xxx"}, "sfd.init": {"body": "sfd.init(${1:type},${2:spi_id},${3:spi_cs})", "description": "sfd.init(type, spi_id, spi_cs) - \u521d\u59cb\u5316spi flash\n\u4f20\u5165\u503c\uff1a\nstring \u7c7b\u578b, \u53ef\u4ee5\u662f\"spi\", \u4e5f\u53ef\u4ee5\u662f\"zbuff\", \u6216\u8005\"onchip\"\nint SPI\u603b\u7ebf\u7684id, \u6216\u8005 zbuff\u5b9e\u4f8b\nint SPI FLASH\u7684\u7247\u9009\u811a\u5bf9\u5e94\u7684GPIO, \u5f53\u7c7b\u578b\u662fspi\u65f6\u624d\u9700\u8981\u4f20\n\u8fd4\u56de\u503c\uff1a\nuserdata \u6210\u529f\u8fd4\u56de\u4e00\u4e2a\u6570\u636e\u7ed3\u6784,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nlocal drv = sfd.init(\"spi\", 0, 17)\nif drv then\n log.info(\"sfd\", \"chip id\", sfd.id(drv):toHex())\nend\n-- 2023.01.15\u4e4b\u540e\u7684\u56fa\u4ef6\u652f\u6301onchip\u7c7b\u578b, \u652f\u6301\u76f4\u63a5\u8bfb\u5199\u7247\u4e0aflash\u7684\u4e00\u5c0f\u5757\u533a\u57df,\u4e00\u822c\u662f64k\n-- \u8fd9\u5757\u533a\u57df\u901a\u5e38\u662ffdb/fskv\u5e93\u6240\u5728\u7684\u533a\u57df, \u6240\u4ee5\u4e0d\u8981\u6df7\u7740\u7528\nlocal onchip = sfd.init(\"onchip\")\nlocal data = sfd.read(onchip, 0x100, 256)\nsfd.erase(onchip, 0x100)\nsfd.write(onchip, 0x100, data or \"Hi\")\n\n", "prefix": "sfd.init"}, "sfd.status": {"body": "sfd.status(${1:drv})", "description": "sfd.status(drv) - \u68c0\u67e5spi flash\u72b6\u6001\n\u4f20\u5165\u503c\uff1a\nuserdata sfd.init\u8fd4\u56de\u7684\u6570\u636e\u7ed3\u6784\n\u8fd4\u56de\u503c\uff1a\nint \u72b6\u6001\u503c, 0 \u672a\u521d\u59cb\u5316\u6210\u529f,1\u521d\u59cb\u5316\u6210\u529f\u4e14\u7a7a\u95f2,2\u6b63\u5fd9\n\u4f8b\u5b50\uff1a\nlocal drv = sfd.init(\"spi\", 0, 17)\nif drv then\n log.info(\"sfd\", \"status\", sfd.status(drv))\nend\n", "prefix": "sfd.status"}, "sfd.read": {"body": "sfd.read(${1:drv},${2:offset},${3:len})", "description": "sfd.read(drv, offset, len) - \u8bfb\u53d6\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nuserdata sfd.init\u8fd4\u56de\u7684\u6570\u636e\u7ed3\u6784\nint \u8d77\u59cb\u504f\u79fb\u91cf\nint \u8bfb\u53d6\u957f\u5ea6,\u5f53\u524d\u9650\u5236\u5728256\u4ee5\u5185\n\u8fd4\u56de\u503c\uff1a\nstring \u6570\u636e\n\u4f8b\u5b50\uff1a\nlocal drv = sfd.init(\"spi\", 0, 17)\nif drv then\n log.info(\"sfd\", \"read\", sfd.read(drv, 0x100, 256))\nend\n", "prefix": "sfd.read"}, "sfd.write": {"body": "sfd.write(${1:drv},${2:offset},${3:data})", "description": "sfd.write(drv, offset, data) - \u5199\u5165\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nuserdata sfd.init\u8fd4\u56de\u7684\u6570\u636e\u7ed3\u6784\nint \u8d77\u59cb\u504f\u79fb\u91cf\nstring \u9700\u8981\u5199\u5165\u7684\u6570\u636e,\u5f53\u524d\u652f\u6301256\u5b57\u8282\u53ca\u4ee5\u4e0b\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5931\u8d25\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nlocal drv = sfd.init(\"spi\", 0, 17)\nif drv then\n log.info(\"sfd\", \"write\", sfd.write(drv, 0x100, \"hi,luatos\"))\nend\n", "prefix": "sfd.write"}, "sfd.erase": {"body": "sfd.erase(${1:drv},${2:offset})", "description": "sfd.erase(drv, offset) - \u64e6\u9664\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nuserdata sfd.init\u8fd4\u56de\u7684\u6570\u636e\u7ed3\u6784\nint \u8d77\u59cb\u504f\u79fb\u91cf\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5931\u8d25\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nlocal drv = sfd.init(\"spi\", 0, 17)\nif drv then\n log.info(\"sfd\", \"write\", sfd.erase(drv, 0x100))\nend\n", "prefix": "sfd.erase"}, "sfd.id": {"body": "sfd.id(${1:drv})", "description": "sfd.id(drv) - \u82af\u7247\u552f\u4e00id\n\u4f20\u5165\u503c\uff1a\nuserdata sfd.init\u8fd4\u56de\u7684\u6570\u636e\u7ed3\u6784\n\u8fd4\u56de\u503c\uff1a\nstring 8\u5b57\u8282(64bit)\u7684\u82af\u7247id\n\u4f8b\u5b50\uff1a\nlocal drv = sfd.init(\"spi\", 0, 17)\nif drv then\n log.info(\"sfd\", \"chip id\", sfd.id(drv))\nend\n", "prefix": "sfd.id"}, "sfud.init": {"body": "sfud.init(${1:spi_id},${2:spi_cs},${3:spi_bandrate)/sfud.init(spi_device})", "description": "sfud.init(spi_id, spi_cs, spi_bandrate)/sfud.init(spi_device) - \u521d\u59cb\u5316sfud\n\u4f20\u5165\u503c\uff1a\nint spi_id SPI\u7684ID/userdata spi_device\nint spi_cs SPI\u7684\u7247\u9009\nint spi_bandrate SPI\u7684\u9891\u7387\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n--spi\nlog.info(\"sfud.init\",sfud.init(0,20,20 * 1000 * 1000))\n--spi_device\nlocal spi_device = spi.deviceSetup(0,17,0,0,8,2000000,spi.MSB,1,0)\nlog.info(\"sfud.init\",sfud.init(spi_device))\n", "prefix": "sfud.init"}, "sfud.getDeviceNum": {"body": "sfud.getDeviceNum()", "description": "sfud.getDeviceNum() - \u83b7\u53d6flash\u8bbe\u5907\u4fe1\u606f\u8868\u4e2d\u7684\u8bbe\u5907\u603b\u6570\n\u8fd4\u56de\u503c\uff1a\nint \u8fd4\u56de\u8bbe\u5907\u603b\u6570\n\u4f8b\u5b50\uff1a\nlog.info(\"sfud.getDeviceNum\",sfud.getDeviceNum())\n", "prefix": "sfud.getDeviceNum"}, "sfud.getDevice": {"body": "sfud.getDevice(${1:index})", "description": "sfud.getDevice(index) - \u901a\u8fc7flash\u4fe1\u606f\u8868\u4e2d\u7684\u7d22\u5f15\u83b7\u53d6flash\u8bbe\u5907\n\u4f20\u5165\u503c\uff1a\nint index flash\u4fe1\u606f\u8868\u4e2d\u7684\u7d22\u5f15\n\u8fd4\u56de\u503c\uff1a\nuserdata \u6210\u529f\u8fd4\u56de\u4e00\u4e2a\u6570\u636e\u7ed3\u6784,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nlocal sfud_device = sfud.getDevice(1)\n", "prefix": "sfud.getDevice"}, "sfud.getDeviceTable": {"body": "sfud.getDeviceTable()", "description": "sfud.getDeviceTable() - \u83b7\u53d6flash\u8bbe\u5907\u4fe1\u606f\u8868\n\u8fd4\u56de\u503c\uff1a\nuserdata \u6210\u529f\u8fd4\u56de\u4e00\u4e2a\u6570\u636e\u7ed3\u6784,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nlocal sfud_device = sfud.getDeviceTable()\n", "prefix": "sfud.getDeviceTable"}, "sfud.chipErase": {"body": "sfud.chipErase(${1:flash})", "description": "sfud.chipErase(flash) - \u64e6\u9664 Flash \u5168\u90e8\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nuserdata flash Flash \u8bbe\u5907\u5bf9\u8c61 sfud.get_device_table()\u8fd4\u56de\u7684\u6570\u636e\u7ed3\u6784\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u8fd4\u56de0\n\u4f8b\u5b50\uff1a\nsfud.chipErase(flash)\n", "prefix": "sfud.chipErase"}, "sfud.erase": {"body": "sfud.erase(${1:flash},${2:add},${3:size})", "description": "sfud.erase(flash,add,size) - \u64e6\u9664 Flash \u6307\u5b9a\u5730\u5740\u6307\u5b9a\u5927\u5c0f\uff0c\u6309\u7167flash block\u5927\u5c0f\u8fdb\u884c\u64e6\u9664\n\u4f20\u5165\u503c\uff1a\nuserdata flash Flash \u8bbe\u5907\u5bf9\u8c61 sfud.get_device_table()\u8fd4\u56de\u7684\u6570\u636e\u7ed3\u6784\nnumber add \u64e6\u9664\u5730\u5740\nnumber size \u64e6\u9664\u5927\u5c0f\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u8fd4\u56de0\n\u4f8b\u5b50\uff1a\nsfud.erase(flash,add,size)\n", "prefix": "sfud.erase"}, "sfud.read": {"body": "sfud.read(${1:flash},${2:addr},${3:size})", "description": "sfud.read(flash, addr, size) - \u8bfb\u53d6 Flash \u6570\u636e\n\u4f20\u5165\u503c\uff1a\nuserdata flash Flash \u8bbe\u5907\u5bf9\u8c61 sfud.get_device_table()\u8fd4\u56de\u7684\u6570\u636e\u7ed3\u6784\nint addr \u8d77\u59cb\u5730\u5740\nint size \u4ece\u8d77\u59cb\u5730\u5740\u5f00\u59cb\u8bfb\u53d6\u6570\u636e\u7684\u603b\u5927\u5c0f\n\u8fd4\u56de\u503c\uff1a\nstring data \u8bfb\u53d6\u5230\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\nlog.info(\"sfud.read\",sfud.read(sfud_device,1024,4))\n", "prefix": "sfud.read"}, "sfud.write": {"body": "sfud.write(${1:flash},${2:addr},${3:data})", "description": "sfud.write(flash, addr,data) - \u5411 Flash \u5199\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nuserdata flash Flash \u8bbe\u5907\u5bf9\u8c61 sfud.get_device_table()\u8fd4\u56de\u7684\u6570\u636e\u7ed3\u6784\nint addr \u8d77\u59cb\u5730\u5740\nstring data \u5f85\u5199\u5165\u7684\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u8fd4\u56de0\n\u4f8b\u5b50\uff1a\nlog.info(\"sfud.write\",sfud.write(sfud_device,1024,\"sfud\"))\n", "prefix": "sfud.write"}, "sfud.eraseWrite": {"body": "sfud.eraseWrite(${1:flash},${2:addr},${3:data})", "description": "sfud.eraseWrite(flash, addr,data) - \u5148\u64e6\u9664\u518d\u5f80 Flash \u5199\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nuserdata flash Flash \u8bbe\u5907\u5bf9\u8c61 sfud.get_device_table()\u8fd4\u56de\u7684\u6570\u636e\u7ed3\u6784\nint addr \u8d77\u59cb\u5730\u5740\nstring data \u5f85\u5199\u5165\u7684\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u8fd4\u56de0\n\u4f8b\u5b50\uff1a\nlog.info(\"sfud.eraseWrite\",sfud.eraseWrite(sfud_device,1024,\"sfud\"))\n", "prefix": "sfud.eraseWrite"}, "sfud.getInfo": {"body": "sfud.getInfo(${1:flash})", "description": "sfud.getInfo(flash) - \u83b7\u53d6 Flash \u5bb9\u91cf\u548cpage\u5927\u5c0f\n\u4f20\u5165\u503c\uff1a\nuserdata flash Flash \u8bbe\u5907\u5bf9\u8c61 sfud.get_device_table()\u8fd4\u56de\u7684\u6570\u636e\u7ed3\u6784\n\u8fd4\u56de\u503c\uff1a\nint Flash \u5bb9\u91cf\nint page \u9875\u5927\u5c0f\n\u4f8b\u5b50\uff1a\nlog.info(\"sfud.getInfo\",sfud.getInfo(sfud_device))\n", "prefix": "sfud.getInfo"}, "sfud.mount": {"body": "sfud.mount(${1:flash},${2:mount_point},${3:offset},${4:maxsize})", "description": "sfud.mount(flash, mount_point, offset, maxsize) - \u6302\u8f7dsfud lfs\u6587\u4ef6\u7cfb\u7edf\n\u4f20\u5165\u503c\uff1a\nuserdata flash Flash \u8bbe\u5907\u5bf9\u8c61 sfud.get_device_table()\u8fd4\u56de\u7684\u6570\u636e\u7ed3\u6784\nstring mount_point \u6302\u8f7d\u76ee\u5f55\u540d\nint \u8d77\u59cb\u504f\u79fb\u91cf,\u9ed8\u8ba40\nint \u603b\u5927\u5c0f, \u9ed8\u8ba4\u662f\u6574\u4e2aflash\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue\n\u4f8b\u5b50\uff1a\nlog.info(\"sfud.mount\",sfud.mount(sfud_device,\"/sfud\"))\nlog.info(\"fsstat\", fs.fsstat(\"/\"))\nlog.info(\"fsstat\", fs.fsstat(\"/sfud\"))\n", "prefix": "sfud.mount"}, "sms.send": {"body": "sms.send(${1:phone},${2:msg},${3:auto_phone_fix})", "description": "sms.send(phone, msg, auto_phone_fix) - \u53d1\u9001\u77ed\u4fe1\n\u4f20\u5165\u503c\uff1a\nstring \u7535\u8bdd\u53f7\u7801,\u5fc5\u586b\nstring \u77ed\u4fe1\u5185\u5bb9,\u5fc5\u586b\nbool \u662f\u5426\u81ea\u52a8\u5904\u7406\u7535\u8bdd\u53f7\u53f7\u7801\u7684\u683c\u5f0f,\u9ed8\u8ba4\u662f\u6309\u77ed\u4fe1\u5185\u5bb9\u548c\u53f7\u7801\u683c\u5f0f\u8fdb\u884c\u81ea\u52a8\u5224\u65ad, \u8bbe\u7f6e\u4e3afalse\u53ef\u7981\u7528\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\u6216nil\n", "prefix": "sms.send"}, "sms.setNewSmsCb": {"body": "sms.setNewSmsCb(${1:func})", "description": "sms.setNewSmsCb(func) - \u8bbe\u7f6e\u65b0SMS\u7684\u56de\u8c03\u51fd\u6570\n\u4f20\u5165\u503c\uff1a\nfunction \u56de\u8c03\u51fd\u6570, 3\u4e2a\u53c2\u6570, num, txt, metas\n\u8fd4\u56de\u503c\uff1a\nnil \u4f20\u5165\u662f\u51fd\u6570\u5c31\u80fd\u6210\u529f,\u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n\nsms.setNewSmsCb(function(num, txt, metas)\n -- num \u624b\u673a\u53f7\u7801\n -- txt \u6587\u672c\u5185\u5bb9\n -- metas \u77ed\u4fe1\u7684\u5143\u6570\u636e,\u4f8b\u5982\u53d1\u9001\u7684\u65f6\u95f4,\u957f\u77ed\u4fe1\u7f16\u53f7\n -- \u6ce8\u610f, \u957f\u77ed\u4fe1\u4f1a\u81ea\u52a8\u5408\u5e76\u6210\u4e00\u6761txt\n log.info(\"sms\", num, txt, metas and json.encode(metas) or \"\")\nend)\n", "prefix": "sms.setNewSmsCb"}, "sms.autoLong": {"body": "sms.autoLong(${1:mode})", "description": "sms.autoLong(mode) - \u8bbe\u7f6e\u957f\u77ed\u4fe1\u7684\u81ea\u52a8\u5408\u5e76\u529f\u80fd\n\u4f20\u5165\u503c\uff1a\nbool \u662f\u5426\u81ea\u52a8\u5408\u5e76,true\u4e3a\u81ea\u52a8\u5408\u5e76,\u4e3a\u9ed8\u8ba4\u503c\n\u8fd4\u56de\u503c\uff1a\nbool \u8bbe\u7f6e\u540e\u7684\u503c\n\u4f8b\u5b50\uff1a\n-- \u7981\u7528\u957f\u77ed\u4fe1\u7684\u81ea\u52a8\u5408\u5e76, \u4e00\u822c\u4e0d\u9700\u8981\u7981\u7528\nsms.autoLong(false)\n", "prefix": "sms.autoLong"}, "sms.clearLong": {"body": "sms.clearLong()", "description": "sms.clearLong() - \u6e05\u9664\u957f\u77ed\u4fe1\u7f13\u5b58\n\u8fd4\u56de\u503c\uff1a\nint \u6e05\u7406\u6389\u7684\u7247\u6bb5\u6570\u91cf\n\u4f8b\u5b50\uff1a\nsms.clearLong()\n", "prefix": "sms.clearLong"}, "socket.sntp": {"body": "socket.sntp(${1:sntp_server})", "description": "socket.sntp(sntp_server) - sntp\u65f6\u95f4\u540c\u6b65\n\u4f20\u5165\u503c\uff1a\nstring/table sntp\u670d\u52a1\u5668\u5730\u5740 \u9009\u586b\nint \u9002\u914d\u5668\u5e8f\u53f7\uff0c \u53ea\u80fd\u662fsocket.ETH0\uff08\u5916\u7f6e\u4ee5\u592a\u7f51\uff09\uff0csocket.LWIP_ETH\uff08\u5185\u7f6e\u4ee5\u592a\u7f51\uff09\uff0csocket.LWIP_STA\uff08\u5185\u7f6eWIFI\u7684STA\uff09\uff0csocket.LWIP_AP\uff08\u5185\u7f6eWIFI\u7684AP\uff09\uff0csocket.LWIP_GP\uff08\u5185\u7f6e\u8702\u7a9d\u7f51\u7edc\u7684GPRS\uff09\uff0csocket.USB\uff08\u5916\u7f6eUSB\u7f51\u5361\uff09\uff0c\u5982\u679c\u4e0d\u586b\uff0c\u4f18\u5148\u9009\u62e9soc\u5e73\u53f0\u81ea\u5e26\u80fd\u4e0a\u5916\u7f51\u7684\u9002\u914d\u5668\uff0c\u82e5\u4ecd\u7136\u6ca1\u6709\uff0c\u9009\u62e9\u6700\u540e\u4e00\u4e2a\u6ce8\u518c\u7684\u9002\u914d\u5668\n\u4f8b\u5b50\uff1a\nsocket.sntp()\n--socket.sntp(\"ntp.aliyun.com\") --\u81ea\u5b9a\u4e49sntp\u670d\u52a1\u5668\u5730\u5740\n--socket.sntp({\"ntp.aliyun.com\",\"ntp1.aliyun.com\",\"ntp2.aliyun.com\"}) --sntp\u81ea\u5b9a\u4e49\u670d\u52a1\u5668\u5730\u5740\n--socket.sntp(nil, socket.ETH0) --sntp\u81ea\u5b9a\u4e49\u9002\u914d\u5668\u5e8f\u53f7\nsys.subscribe(\"NTP_UPDATE\", function()\n log.info(\"sntp\", \"time\", os.date())\nend)\nsys.subscribe(\"NTP_ERROR\", function()\n log.info(\"socket\", \"sntp error\")\n socket.sntp()\nend)\n", "prefix": "socket.sntp"}, "socket.ntptm": {"body": "socket.ntptm()", "description": "socket.ntptm() - \u7f51\u7edc\u5bf9\u65f6\u540e\u7684\u65f6\u95f4\u6233(ms\u7ea7\u522b)\n\u8fd4\u56de\u503c\uff1a\ntable \u5305\u542b\u65f6\u95f4\u4fe1\u606f\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e 2023.11.15 \u65b0\u589e\n-- \u6ce8\u610f, \u672c\u51fd\u6570\u5728\u6267\u884csocket.sntp()\u4e14\u83b7\u53d6\u5230NTP\u65f6\u95f4\u540e\u624d\u6709\u6548\n-- \u800c\u4e14\u662f2\u6b21sntp\u4e4b\u540e\u624d\u662f\u6bd4\u8f83\u51c6\u786e\u7684\u503c\n-- \u7f51\u7edc\u6ce2\u52a8\u8d8a\u5c0f, \u8be5\u65f6\u95f4\u6233\u8d8a\u7a33\u5b9a\nlocal tm = socket.ntptm()\n\n-- \u5bf9\u5e94\u7684table\u5305\u542b\u591a\u4e2a\u6570\u636e, \u5747\u4e3a\u6574\u6570\u503c\n\n-- \u6807\u51c6\u6570\u636e\n-- tsec \u5f53\u524d\u79d2\u6570,\u4ece1900.1.1 0:0:0 \u5f00\u59cb\u7b97, UTC\u65f6\u95f4\n-- tms \u5f53\u524d\u6beb\u79d2\u6570\n-- vaild \u662f\u5426\u6709\u6548, true \u6216\u8005 nil\n\n-- \u8c03\u8bd5\u6570\u636e, \u8c03\u8bd5\u7528,\u4e00\u822c\u7528\u6237\u4e0d\u7528\u7ba1\n-- ndelay \u7f51\u7edc\u5ef6\u65f6\u5e73\u5747\u503c,\u5355\u4f4d\u6beb\u79d2\n-- ssec \u7cfb\u7edf\u542f\u52a8\u65f6\u523b\u4e0e1900.1.1 0:0:0\u7684\u79d2\u6570\u504f\u79fb\u91cf\n-- sms \u7cfb\u7edf\u542f\u52a8\u65f6\u523b\u4e0e1900.1.1 0:0:0\u7684\u6beb\u79d2\u504f\u79fb\u91cf\n-- lsec \u672c\u5730\u79d2\u6570\u8ba1\u6570\u5668,\u57fa\u4e8emcu.tick64()\n-- lms \u672c\u5730\u6beb\u79d2\u6570\u8ba1\u6570\u5668,\u57fa\u4e8emcu.tick64()\n\nlog.info(\"tm\u6570\u636e\", json.encode(tm))\nlog.info(\"\u65f6\u95f4\u6233\", string.format(\"%u.%03d\", tm.tsec, tm.tms))\n", "prefix": "socket.ntptm"}, "socket.sntp_port": {"body": "socket.sntp_port(${1:port})", "description": "socket.sntp_port(port) - \u8bbe\u7f6eSNTP\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\n\u4f20\u5165\u503c\uff1a\nint port \u7aef\u53e3\u53f7, \u9ed8\u8ba4123\n\u8fd4\u56de\u503c\uff1a\nint \u8fd4\u56de\u5f53\u524d\u7684\u7aef\u53e3\u53f7\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u4e8e2024.5.17\u65b0\u589e\n-- \u5927\u90e8\u5206\u60c5\u51b5\u4e0b\u4e0d\u9700\u8981\u8bbe\u7f6eNTP\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7,\u9ed8\u8ba4123\u5373\u53ef\n", "prefix": "socket.sntp_port"}, "socket.localIP": {"body": "socket.localIP(${1:adapter})", "description": "socket.localIP(adapter) - \u83b7\u53d6\u672c\u5730ip\n\u4f20\u5165\u503c\uff1a\nint \u9002\u914d\u5668\u5e8f\u53f7\uff0c \u53ea\u80fd\u662fsocket.ETH0\uff08\u5916\u7f6e\u4ee5\u592a\u7f51\uff09\uff0csocket.LWIP_ETH\uff08\u5185\u7f6e\u4ee5\u592a\u7f51\uff09\uff0csocket.LWIP_STA\uff08\u5185\u7f6eWIFI\u7684STA\uff09\uff0csocket.LWIP_AP\uff08\u5185\u7f6eWIFI\u7684AP\uff09\uff0csocket.LWIP_GP\uff08\u5185\u7f6e\u8702\u7a9d\u7f51\u7edc\u7684GPRS\uff09\uff0csocket.USB\uff08\u5916\u7f6eUSB\u7f51\u5361\uff09\uff0c\u5982\u679c\u4e0d\u586b\uff0c\u4f18\u5148\u9009\u62e9soc\u5e73\u53f0\u81ea\u5e26\u80fd\u4e0a\u5916\u7f51\u7684\u9002\u914d\u5668\uff0c\u82e5\u4ecd\u7136\u6ca1\u6709\uff0c\u9009\u62e9\u6700\u540e\u4e00\u4e2a\u6ce8\u518c\u7684\u9002\u914d\u5668\n\u8fd4\u56de\u503c\uff1a\nstring \u901a\u5e38\u662f\u5185\u7f51ip, \u4e5f\u53ef\u80fd\u662f\u5916\u7f51ip, \u53d6\u51b3\u4e8e\u8fd0\u8425\u5546\u7684\u5206\u914d\nstring \u7f51\u7edc\u63a9\u7801\nstring \u7f51\u5173IP\n\u4f8b\u5b50\uff1a\nsys.taskInit(function()\n while 1 do\n sys.wait(3000)\n log.info(\"socket\", \"ip\", socket.localIP())\n -- \u8f93\u51fa\u793a\u4f8b\n -- 62.39.244.10 255.255.255.255 0.0.0.0\n end\nend)\n", "prefix": "socket.localIP"}, "socket.create": {"body": "socket.create(${1:adapter},${2:cb})", "description": "socket.create(adapter, cb) - \u5728\u67d0\u4e2a\u9002\u914d\u7684\u7f51\u5361\u4e0a\u7533\u8bf7\u4e00\u4e2asocket_ctrl\n\u4f20\u5165\u503c\uff1a\nint \u9002\u914d\u5668\u5e8f\u53f7\uff0c \u53ea\u80fd\u662fsocket.ETH0\uff08\u5916\u7f6e\u4ee5\u592a\u7f51\uff09\uff0csocket.LWIP_ETH\uff08\u5185\u7f6e\u4ee5\u592a\u7f51\uff09\uff0csocket.LWIP_STA\uff08\u5185\u7f6eWIFI\u7684STA\uff09\uff0csocket.LWIP_AP\uff08\u5185\u7f6eWIFI\u7684AP\uff09\uff0csocket.LWIP_GP\uff08\u5185\u7f6e\u8702\u7a9d\u7f51\u7edc\u7684GPRS\uff09\uff0csocket.USB\uff08\u5916\u7f6eUSB\u7f51\u5361\uff09\uff0c\u5982\u679c\u4e0d\u586b\uff0c\u4f18\u5148\u9009\u62e9soc\u5e73\u53f0\u81ea\u5e26\u80fd\u4e0a\u5916\u7f51\u7684\u9002\u914d\u5668\uff0c\u82e5\u4ecd\u7136\u6ca1\u6709\uff0c\u9009\u62e9\u6700\u540e\u4e00\u4e2a\u6ce8\u518c\u7684\u9002\u914d\u5668\nstring or function string\u4e3a\u6d88\u606f\u901a\u77e5\u7684taskName\uff0cfunction\u5219\u4e3a\u56de\u8c03\u51fd\u6570\uff0c\u5982\u679c\u56fa\u4ef6\u6ca1\u6709\u5185\u7f6esys_wait\uff0c\u5219\u5fc5\u987b\u662ffunction\n", "prefix": "socket.create"}, "socket.debug": {"body": "socket.debug(${1:ctrl},${2:onoff})", "description": "socket.debug(ctrl, onoff) - \u914d\u7f6e\u662f\u5426\u6253\u5f00debug\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\nboolean true \u6253\u5f00debug\u5f00\u5173\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u6253\u5f00\u8c03\u8bd5\u4fe1\u606f,\u9ed8\u8ba4\u662f\u5173\u95ed\u72b6\u6001\nsocket.debug(ctrl, true)\n", "prefix": "socket.debug"}, "socket.config": {"body": "socket.config(${1:ctrl},${2:local_port},${3:is_udp},${4:is_tls},${5:keep_idle},${6:keep_interval},${7:keep_cnt},${8:server_cert},${9:client_cert},${10:client_key},${11:client_password})", "description": "socket.config(ctrl, local_port, is_udp, is_tls, keep_idle, keep_interval, keep_cnt, server_cert, client_cert, client_key, client_password) - \u914d\u7f6enetwork\u4e00\u4e9b\u4fe1\u606f\uff0c\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\nint \u672c\u5730\u7aef\u53e3\u53f7\uff0c\u5c0f\u7aef\u683c\u5f0f\uff0c\u5982\u679c\u4e0d\u5199\uff0c\u5219\u81ea\u52a8\u5206\u914d\u4e00\u4e2a\uff0c\u5982\u679c\u7528\u6237\u586b\u4e86\u7aef\u53e3\u53f7\u5219\u9700\u8981\u5c0f\u4e8e60000, \u9ed8\u8ba4\u4e0d\u5199\nboolean \u662f\u5426\u662fUDP\uff0c\u9ed8\u8ba4false\nboolean \u662f\u5426\u662f\u52a0\u5bc6\u4f20\u8f93\uff0c\u9ed8\u8ba4false\nint tcp keep live\u6a21\u5f0f\u4e0b\u7684idle\u65f6\u95f4\uff08\u79d2\uff09\uff0c\u5982\u679c\u7559\u7a7a\u5219\u8868\u793a\u4e0d\u542f\u7528\uff0c\u5982\u679c\u662f\u4e0d\u652f\u6301\u6807\u51c6posix\u63a5\u53e3\u7684\u7f51\u5361\uff08\u6bd4\u5982W5500\uff09\uff0c\u5219\u4e3a\u5fc3\u8df3\u95f4\u9694\nint tcp keep live\u6a21\u5f0f\u4e0b\u7684\u63a2\u6d4b\u95f4\u9694\u65f6\u95f4\uff08\u79d2\uff09\nint tcp keep live\u6a21\u5f0f\u4e0b\u7684\u63a2\u6d4b\u6b21\u6570\nstring TCP\u6a21\u5f0f\u4e0b\u7684\u670d\u52a1\u5668ca\u8bc1\u4e66\u6570\u636e\uff0cUDP\u6a21\u5f0f\u4e0b\u7684PSK\uff0c\u4e0d\u9700\u8981\u52a0\u5bc6\u4f20\u8f93\u5199nil\uff0c\u540e\u7eed\u53c2\u6570\u4e5f\u5168\u90e8nil\nstring TCP\u6a21\u5f0f\u4e0b\u7684\u5ba2\u6237\u7aefca\u8bc1\u4e66\u6570\u636e\uff0cUDP\u6a21\u5f0f\u4e0b\u7684PSK-ID\uff0cTCP\u6a21\u5f0f\u4e0b\u5982\u679c\u4e0d\u9700\u8981\u9a8c\u8bc1\u5ba2\u6237\u7aef\u8bc1\u4e66\u65f6\uff0c\u5ffd\u7565\uff0c\u4e00\u822c\u4e0d\u9700\u8981\u9a8c\u8bc1\u5ba2\u6237\u7aef\u8bc1\u4e66\nstring TCP\u6a21\u5f0f\u4e0b\u7684\u5ba2\u6237\u7aef\u79c1\u94a5\u52a0\u5bc6\u6570\u636e\nstring TCP\u6a21\u5f0f\u4e0b\u7684\u5ba2\u6237\u7aef\u79c1\u94a5\u53e3\u4ee4\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue\uff0c\u5931\u8d25\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n--\u6700\u666e\u901a\u7684TCP\u4f20\u8f93\nsocket.config(ctrl)\n--\u6700\u666e\u901a\u7684\u52a0\u5bc6TCP\u4f20\u8f93\uff0c\u8bc1\u4e66\u90fd\u4e0d\u7528\u9a8c\u8bc1\u7684\u90a3\u79cd\nsocket.config(ctrl, nil, nil ,true)\n", "prefix": "socket.config"}, "socket.linkup": {"body": "socket.linkup(${1:ctrl})", "description": "socket.linkup(ctrl) - \u7b49\u5f85\u7f51\u5361linkup\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\n\u8fd4\u56de\u503c\uff1a\nboolean true\u6ca1\u6709\u5f02\u5e38\u53d1\u751f\uff0cfalse\u5931\u8d25\u4e86\uff0c\u5982\u679cfalse\u5219\u4e0d\u9700\u8981\u770b\u4e0b\u4e00\u4e2a\u8fd4\u56de\u503c\u4e86\nboolean true\u5df2\u7ecflinkup\uff0cfalse\u6ca1\u6709linkup\uff0c\u4e4b\u540e\u9700\u8981\u63a5\u6536socket.LINK\u6d88\u606f\n\u4f8b\u5b50\uff1a\n-- \u5224\u65ad\u4e00\u4e0b\u662f\u5426\u5df2\u7ecf\u8054\u7f51\nlocal succ, result = socket.linkup(ctrl)\n", "prefix": "socket.linkup"}, "socket.connect": {"body": "socket.connect(${1:ctrl},${2:ip},${3:remote_port},${4:need_ipv6_dns})", "description": "socket.connect(ctrl, ip, remote_port, need_ipv6_dns) - \u4f5c\u4e3a\u5ba2\u6237\u7aef\u8fde\u63a5\u670d\u52a1\u5668\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\nstring or int ip\u6216\u8005\u57df\u540d\uff0c\u5982\u679c\u662fIPV4\uff0c\u53ef\u4ee5\u662f\u5927\u7aef\u683c\u5f0f\u7684int\u503c\nint \u670d\u52a1\u5668\u7aef\u53e3\u53f7\uff0c\u5c0f\u7aef\u683c\u5f0f\nboolean \u57df\u540d\u89e3\u6790\u662f\u5426\u8981IPV6\uff0ctrue\u8981\uff0cfalse\u4e0d\u8981\uff0c\u9ed8\u8ba4false\u4e0d\u8981\uff0c\u53ea\u6709\u652f\u6301IPV6\u7684\u534f\u8bae\u6808\u624d\u6709\u6548\u679c\n\u8fd4\u56de\u503c\uff1a\nboolean true\u6ca1\u6709\u5f02\u5e38\u53d1\u751f\uff0cfalse\u5931\u8d25\u4e86\uff0c\u5982\u679cfalse\u5219\u4e0d\u9700\u8981\u770b\u4e0b\u4e00\u4e2a\u8fd4\u56de\u503c\u4e86\uff0c\u5982\u679c\u6709\u5f02\u5e38\uff0c\u540e\u7eed\u8981close\nboolean true\u5df2\u7ecfconnect\uff0cfalse\u6ca1\u6709connect\uff0c\u4e4b\u540e\u9700\u8981\u63a5\u6536socket.ON_LINE\u6d88\u606f\n\u4f8b\u5b50\uff1a\n\nlocal succ, result = socket.connect(ctrl, \"netlab.luatos.com\", 40123)\n\n--[[\n\u5e38\u89c1\u7684\u8fde\u63a5\u5931\u8d25\u7684code\u503c, \u4f1a\u5728\u65e5\u5fd7\u4e2d\u663e\u793a\n-1 \u5e95\u5c42\u5185\u5b58\u4e0d\u8db3\n-3 \u8d85\u65f6\n-8 \u7aef\u53e3\u5df2\u7ecf\u88ab\u5360\u7528\n-11 \u94fe\u63a5\u672a\u5efa\u7acb\n-13 \u6a21\u5757\u4e3b\u52a8\u65ad\u5f00\u8fde\u63a5\n-14 \u670d\u52a1\u5668\u4e3b\u52a8\u65ad\u5f00\u8fde\u63a5\n]]\n", "prefix": "socket.connect"}, "socket.discon": {"body": "socket.discon(${1:ctrl})", "description": "socket.discon(ctrl) - \u4f5c\u4e3a\u5ba2\u6237\u7aef\u65ad\u5f00\u8fde\u63a5\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\n\u8fd4\u56de\u503c\uff1a\nboolean true\u6ca1\u6709\u5f02\u5e38\u53d1\u751f\uff0cfalse\u5931\u8d25\u4e86\uff0c\u5982\u679cfalse\u5219\u4e0d\u9700\u8981\u770b\u4e0b\u4e00\u4e2a\u8fd4\u56de\u503c\u4e86\nboolean true\u5df2\u7ecf\u65ad\u5f00\uff0cfalse\u6ca1\u6709\u65ad\u5f00\uff0c\u4e4b\u540e\u9700\u8981\u63a5\u6536socket.CLOSED\u6d88\u606f\n\u4f8b\u5b50\uff1a\nlocal succ, result = socket.discon(ctrl)\n", "prefix": "socket.discon"}, "socket.close": {"body": "socket.close(${1:ctrl})", "description": "socket.close(ctrl) - \u5f3a\u5236\u5173\u95edsocket\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "socket.close"}, "socket.tx": {"body": "socket.tx(${1:ctrl},${2:data},${3:ip},${4:port},${5:flag})", "description": "socket.tx(ctrl, data, ip, port, flag) - \u53d1\u9001\u6570\u636e\u7ed9\u5bf9\u7aef\uff0cUDP\u5355\u6b21\u53d1\u9001\u4e0d\u8981\u8d85\u8fc71460\u5b57\u8282\uff0c\u5426\u5219\u5f88\u5bb9\u6613\u5931\u8d25\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\nstring or user_data zbuff \u8981\u53d1\u9001\u7684\u6570\u636e\nstring or int \u5bf9\u7aefIP\uff0c\u5982\u679c\u662fTCP\u5e94\u7528\u5219\u5ffd\u7565\uff0c\u5982\u679c\u662fUDP\uff0c\u5982\u679c\u7559\u7a7a\u5219\u7528connect\u65f6\u5019\u7684\u53c2\u6570\uff0c\u5982\u679c\u662fIPV4\uff0c\u53ef\u4ee5\u662f\u5927\u7aef\u683c\u5f0f\u7684int\u503c\nint \u5bf9\u7aef\u7aef\u53e3\u53f7\uff0c\u5c0f\u7aef\u683c\u5f0f\uff0c\u5982\u679c\u662fTCP\u5e94\u7528\u5219\u5ffd\u7565\uff0c\u5982\u679c\u662fUDP\uff0c\u5982\u679c\u7559\u7a7a\u5219\u7528connect\u65f6\u5019\u7684\u53c2\u6570\nint \u53d1\u9001\u53c2\u6570\uff0c\u76ee\u524d\u9884\u7559\uff0c\u4e0d\u8d77\u4f5c\u7528\n\u8fd4\u56de\u503c\uff1a\nboolean true\u6ca1\u6709\u5f02\u5e38\u53d1\u751f\uff0cfalse\u5931\u8d25\u4e86\uff0c\u5982\u679cfalse\u5219\u4e0d\u9700\u8981\u770b\u4e0b\u4e00\u4e2a\u8fd4\u56de\u503c\u4e86\uff0c\u5982\u679cfalse\uff0c\u540e\u7eed\u8981close\nboolean true\u7f13\u51b2\u533a\u6ee1\u4e86\uff0cfalse\u6ca1\u6709\u6ee1\uff0c\u5982\u679ctrue\uff0c\u5219\u9700\u8981\u7b49\u5f85\u4e00\u6bb5\u65f6\u95f4\u6216\u8005\u7b49\u5230socket.TX_OK\u6d88\u606f\u540e\u518d\u5c1d\u8bd5\u53d1\u9001\uff0c\u540c\u65f6\u5ffd\u7565\u4e0b\u4e00\u4e2a\u8fd4\u56de\u503c\nboolean true\u5df2\u7ecf\u6536\u5230\u5e94\u7b54\uff0cfalse\u6ca1\u6709\u6536\u5230\u5e94\u7b54\uff0c\u4e4b\u540e\u9700\u8981\u63a5\u6536socket.TX_OK\u6d88\u606f\uff0c \u4e5f\u53ef\u4ee5\u5ffd\u7565\u7ee7\u7eed\u53d1\u9001\uff0c\u76f4\u5230full==true\n\u4f8b\u5b50\uff1a\n\nlocal succ, full, result = socket.tx(ctrl, \"123456\", \"xxx.xxx.xxx.xxx\", xxxx)\n", "prefix": "socket.tx"}, "socket.rx": {"body": "socket.rx(${1:ctrl},${2:buff},${3:flag},${4:limit})", "description": "socket.rx(ctrl, buff, flag, limit) - \u63a5\u6536\u5bf9\u7aef\u53d1\u51fa\u7684\u6570\u636e\uff0c\u6ce8\u610f\u6570\u636e\u5df2\u7ecf\u7f13\u5b58\u5728\u5e95\u5c42\uff0c\u4f7f\u7528\u672c\u51fd\u6570\u53ea\u662f\u63d0\u53d6\u51fa\u6765\uff0cUDP\u6a21\u5f0f\u4e0b\u4e00\u6b21\u53ea\u4f1a\u53d6\u51fa\u4e00\u4e2a\u6570\u636e\u5305\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\nuser_data zbuff \u5b58\u653e\u63a5\u6536\u7684\u6570\u636e\uff0c\u5982\u679c\u7f13\u51b2\u533a\u4e0d\u591f\u5927\u4f1a\u81ea\u52a8\u6269\u5bb9\nint \u63a5\u6536\u53c2\u6570\uff0c\u76ee\u524d\u9884\u7559\uff0c\u4e0d\u8d77\u4f5c\u7528\nint \u63a5\u6536\u6570\u636e\u957f\u5ea6\u9650\u5236\uff0c\u5982\u679c\u6307\u5b9a\u4e86\uff0c\u5219\u53ea\u53d6\u524dN\u4e2a\u5b57\u8282. 2024.1.5 \u65b0\u589e\n\u8fd4\u56de\u503c\uff1a\nboolean true\u6ca1\u6709\u5f02\u5e38\u53d1\u751f\uff0cfalse\u5931\u8d25\u4e86\uff0c\u5982\u679cfalse\u5219\u4e0d\u9700\u8981\u770b\u4e0b\u4e00\u4e2a\u8fd4\u56de\u503c\u4e86\uff0c\u5982\u679cfalse\uff0c\u540e\u7eed\u8981close\nint \u672c\u6b21\u63a5\u6536\u5230\u6570\u636e\u957f\u5ea6\nstring \u5bf9\u7aefIP\uff0c\u53ea\u6709UDP\u6a21\u5f0f\u4e0b\u624d\u6709\u610f\u4e49\uff0cTCP\u6a21\u5f0f\u8fd4\u56denil\uff0c\u6ce8\u610f\u8fd4\u56de\u7684\u683c\u5f0f\uff0c\u5982\u679c\u662fIPV4\uff0c1byte 0x00 + 4byte\u5730\u5740 \u5982\u679c\u662fIPV6\uff0c1byte 0x01 + 16byte\u5730\u5740\nint \u5bf9\u7aefport\uff0c\u53ea\u6709UDP\u6a21\u5f0f\u4e0b\u624d\u6709\u610f\u4e49\uff0cTCP\u6a21\u5f0f\u8fd4\u56de0\n\u4f8b\u5b50\uff1a\n-- \u4ecesocket\u4e2d\u8bfb\u53d6\u6570\u636e, ctrl\u662fsocket.create\u8fd4\u56de\u7684, \u8bf7\u67e5\u9605demo/socket\nlocal buff = zbuff.create(2048)\nlocal succ, data_len, remote_ip, remote_port = socket.rx(ctrl, buff)\n\n-- \u9650\u5236\u8bfb\u53d6\u957f\u5ea6, 2024.1.5 \u65b0\u589e\n-- \u6ce8\u610f\n-- \u5982\u679c\u662fUDP\u6570\u636e, \u5982\u679climit\u5c0f\u4e8eUDP\u6570\u636e\u5305\u957f\u5ea6, \u53ea\u4f1a\u53d6\u524dlimit\u4e2a\u5b57\u8282, \u5269\u4f59\u6570\u636e\u4f1a\u4e22\u5f03\n-- \u5982\u679c\u662fTCP\u6570\u636e, \u5982\u679c\u6709\u5269\u4f59\u6570\u636e, \u4e0d\u4f1a\u4e22\u5f03, \u53ef\u7ee7\u7eed\u8bfb\u53d6.\n-- \u6709\u65b0\u7684\u6570\u636e\u5230\u6765\u624d\u4f1a\u6709\u65b0\u7684EVENT\u6570\u636e, \u672a\u8bfb\u53d6\u5b8c\u6210\u7684\u6570\u636e\u4e0d\u4f1a\u89e6\u53d1\u65b0EVENT\u4e8b\u4ef6\nlocal succ, data_len, remote_ip, remote_port = socket.rx(ctrl, buff, 1500)\n\n-- \u8bfb\u53d6\u7f13\u51b2\u533a\u5927\u5c0f, 2024.1.5 \u65b0\u589e, \u6ce8\u610f,\u8001\u7248\u672c\u56fa\u4ef6\u4e0d\u4f20buff\u53c2\u6570\u4f1a\u62a5\u9519\u7684\n-- \u5bf9\u4e8eTCP\u6570\u636e, \u8fd9\u91cc\u8fd4\u56de\u7684\u662f\u5f85\u8bfb\u53d6\u7684\u6570\u636e\u7684\u603b\u957f\u5ea6\n-- \u5bf9\u4e8eUDP\u6570\u636e, \u8fd9\u91cc\u8fd4\u56de\u7684\u662f\u5355\u4e2aUDP\u6570\u636e\u5305\u7684\u957f\u5ea6\nlocal succ, data_len = socket.rx(ctrl)\nif succ then\n log.info(\"\u5f85\u6536\u53d6\u6570\u636e\u957f\u5ea6\", data_len)\nend\n", "prefix": "socket.rx"}, "socket.read": {"body": "socket.read(${1:netc},${2:len})", "description": "socket.read(netc, len) - \u8bfb\u53d6\u6570\u636e(\u975ezbuff\u7248\u672c)\n\u4f20\u5165\u503c\uff1a\nuserdata socket.create\u5f97\u5230\u7684ctrl\nint \u9650\u5236\u8bfb\u53d6\u6570\u636e\u957f\u5ea6,\u53ef\u9009,\u4e0d\u4f20\u5c31\u662f\u8bfb\u51fa\u5168\u90e8\n\u8fd4\u56de\u503c\uff1a\nboolean \u8bfb\u53d6\u6210\u529f\u4e0e\u5426\nstring \u8bfb\u53d6\u7684\u6570\u636e,\u4ec5\u5f53\u8bfb\u53d6\u6210\u529f\u65f6\u6709\u6548\nstring \u5bf9\u65b9IP\u5730\u5740,\u4ec5\u5f53\u8bfb\u53d6\u6210\u529f\u4e14UDP\u901a\u4fe1\u65f6\u6709\u6548\nint \u5bf9\u65b9\u7aef\u53e3,\u4ec5\u5f53\u8bfb\u53d6\u6210\u529f\u4e14UDP\u901a\u4fe1\u65f6\u6709\u6548\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u4e8e2024.4.8\u6dfb\u52a0, \u7528\u4e8e\u7b80\u6613\u8bfb\u53d6\u4e0d\u5927\u7684\u6570\u636e\n-- \u8bf7\u4f18\u5148\u4f7f\u7528socket.rx\u51fd\u6570, \u672c\u51fd\u6570\u4e3b\u8981\u7528\u4e8e\u56fa\u4ef6\u4e0d\u542bzbuff\u5e93\u65f6\u7684\u53d8\u901a\u8c03\u7528\nlocal ok, data = socket.read(netc, 1500)\nif ok and #data > 0 then\n log.info(\"\u8bfb\u53d6\u5230\u7684\u6570\u636e\", data)\nend\n", "prefix": "socket.read"}, "socket.wait": {"body": "socket.wait(${1:ctrl})", "description": "socket.wait(ctrl) - \u7b49\u5f85\u65b0\u7684socket\u6d88\u606f\uff0c\u5728\u8fde\u63a5\u6210\u529f\u548c\u53d1\u9001\u6570\u636e\u6210\u529f\u540e\uff0c\u4f7f\u7528\u4e00\u6b21\u5c06network\u72b6\u6001\u8f6c\u6362\u5230\u63a5\u6536\u65b0\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\n\u8fd4\u56de\u503c\uff1a\nboolean true\u6ca1\u6709\u5f02\u5e38\u53d1\u751f\uff0cfalse\u5931\u8d25\u4e86\uff0c\u5982\u679cfalse\u5219\u4e0d\u9700\u8981\u770b\u4e0b\u4e00\u4e2a\u8fd4\u56de\u503c\u4e86\uff0c\u5982\u679cfalse\uff0c\u540e\u7eed\u8981close\nboolean true\u6709\u65b0\u7684\u6570\u636e\u9700\u8981\u63a5\u6536\uff0cfalse\u6ca1\u6709\u6570\u636e\uff0c\u4e4b\u540e\u9700\u8981\u63a5\u6536socket.EVENT\u6d88\u606f\n\u4f8b\u5b50\uff1a\nlocal succ, result = socket.wait(ctrl)\n", "prefix": "socket.wait"}, "socket.listen": {"body": "socket.listen(${1:ctrl})", "description": "socket.listen(ctrl) - \u4f5c\u4e3a\u670d\u52a1\u7aef\u5f00\u59cb\u76d1\u542c\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\n\u8fd4\u56de\u503c\uff1a\nboolean true\u6ca1\u6709\u5f02\u5e38\u53d1\u751f\uff0cfalse\u5931\u8d25\u4e86\uff0c\u5982\u679cfalse\u5219\u4e0d\u9700\u8981\u770b\u4e0b\u4e00\u4e2a\u8fd4\u56de\u503c\u4e86\uff0c\u5982\u679cfalse\uff0c\u540e\u7eed\u8981close\nboolean true\u5df2\u7ecfconnect\uff0cfalse\u6ca1\u6709connect\uff0c\u4e4b\u540e\u9700\u8981\u63a5\u6536socket.ON_LINE\u6d88\u606f\n\u4f8b\u5b50\uff1a\nlocal succ, result = socket.listen(ctrl)\n", "prefix": "socket.listen"}, "socket.accept": {"body": "socket.accept(${1:ctrl})", "description": "socket.accept(ctrl) - \u4f5c\u4e3a\u670d\u52a1\u7aef\u63a5\u6536\u5230\u4e00\u4e2a\u65b0\u7684\u5ba2\u6237\u7aef\uff0c\u6ce8\u610f\uff0c\u5982\u679c\u662f\u7c7b\u4f3cW5500\u7684\u786c\u4ef6\u534f\u8bae\u6808\u4e0d\u652f\u63011\u5bf9\u591a\uff0c\u5219\u4e0d\u9700\u8981\u7b2c\u4e8c\u4e2a\u53c2\u6570\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\uff0c\u8fd9\u91cc\u662f\u670d\u52a1\u5668\u7aef\nstring or function or nil string\u4e3a\u6d88\u606f\u901a\u77e5\u7684taskName\uff0cfunction\u5219\u4e3a\u56de\u8c03\u51fd\u6570\uff0c\u548csocket.create\u53c2\u6570\u4e00\u81f4\n\u8fd4\u56de\u503c\uff1a\nboolean true\u6ca1\u6709\u5f02\u5e38\u53d1\u751f\uff0cfalse\u5931\u8d25\u4e86\uff0c\u5982\u679cfalse\u5219\u4e0d\u9700\u8981\u770b\u4e0b\u4e00\u4e2a\u8fd4\u56de\u503c\u4e86\uff0c\u5982\u679cfalse\uff0c\u540e\u7eed\u8981close\nuser_data or nil \u5982\u679c\u652f\u63011\u5bf9\u591a\uff0c\u5219\u4f1a\u8fd4\u56de\u65b0\u7684ctrl\uff0c\u81ea\u52a8create\uff0c\u5982\u679c\u4e0d\u652f\u6301\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nlocal succ, new_netc = socket.listen(ctrl, cb)\n", "prefix": "socket.accept"}, "socket.state": {"body": "socket.state(${1:ctrl})", "description": "socket.state(ctrl) - \u83b7\u53d6socket\u5f53\u524d\u72b6\u6001\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\n\u8fd4\u56de\u503c\uff1a\nint or nil,\u8f93\u5165\u53c2\u6570\u6b63\u786e\u7684\u60c5\u51b5\u4e0b\uff0c\u8fd4\u56de\u72b6\u6001\u7684\u6570\u503c\uff0c\u5426\u5219\u8fd4\u56denil\nstring or nil,\u8f93\u5165\u53c2\u6570\u6b63\u786e\u7684\u60c5\u51b5\u4e0b\uff0c\u8fd4\u56de\u72b6\u6001\u7684\u4e2d\u6587\u63cf\u8ff0\uff0c\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nlocal state, str = socket.state(ctrl)\nlog.info(\"state\", state, str)\nstate 0 \"\u786c\u4ef6\u79bb\u7ebf\",\n 1 \"\u79bb\u7ebf\",\n 2 \"\u7b49\u5f85DNS\",\n 3 \"\u6b63\u5728\u8fde\u63a5\",\n 4 \"\u6b63\u5728TLS\u63e1\u624b\",\n 5 \"\u5728\u7ebf\",\n 6 \"\u5728\u76d1\u542c\",\n 7 \"\u6b63\u5728\u79bb\u7ebf\",\n 8 \"\u672a\u77e5\"\n", "prefix": "socket.state"}, "socket.release": {"body": "socket.release(${1:ctrl})", "description": "socket.release(ctrl) - \u4e3b\u52a8\u91ca\u653e\u6389network_ctrl\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\n\u4f8b\u5b50\uff1a\n-- \u91ca\u653e\u540e\u5c31\u4e0d\u80fd\u518d\u4f7f\u7528\u4e86\nsocket.release(ctrl)\n", "prefix": "socket.release"}, "socket.setDNS": {"body": "socket.setDNS(${1:adapter_index},${2:dns_index},${3:ip})", "description": "socket.setDNS(adapter_index, dns_index, ip) - \u8bbe\u7f6eDNS\u670d\u52a1\u5668\n\u4f20\u5165\u503c\uff1a\nint \u9002\u914d\u5668\u5e8f\u53f7\uff0c \u53ea\u80fd\u662fsocket.ETH0\uff0csocket.STA\uff0csocket.AP\uff0c\u5982\u679c\u4e0d\u586b\uff0c\u4f1a\u9009\u62e9\u6700\u540e\u4e00\u4e2a\u6ce8\u518c\u7684\u9002\u914d\u5668\nint dns\u670d\u52a1\u5668\u5e8f\u53f7\uff0c\u4ece1\u5f00\u59cb\nstring or int dns\uff0c\u5982\u679c\u662fIPV4\uff0c\u53ef\u4ee5\u662f\u5927\u7aef\u683c\u5f0f\u7684int\u503c\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue\uff0c\u5931\u8d25\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u8bbe\u7f6e\u9ed8\u8ba4\u7f51\u7edc\u9002\u914d\u5668\u7684DNS\u914d\u7f6e\nsocket.setDNS(nil, 1, \"114.114.114.114\")\n-- \u8bbe\u7f6e\u5236\u5b9a\u7f51\u7edc\u9002\u914d\u5668\u7684DNS\u914d\u7f6e\nsocket.setDNS(socket.ETH0, 1, \"114.114.114.114\")\n", "prefix": "socket.setDNS"}, "socket.sslLog": {"body": "socket.sslLog(${1:log_level})", "description": "socket.sslLog(log_level) - \u8bbe\u7f6eSSL\u7684log\u767b\u8bb0\n\u4f20\u5165\u503c\uff1a\nint mbedtls log\u7b49\u7ea7\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n--[[\nSSL/TLS log\u7ea7\u522b\u8bf4\u660e\n0\u4e0d\u6253\u5370\n1\u53ea\u6253\u5370\u9519\u8bef\u548c\u8b66\n2\u5927\u90e8\u5206info\n3\u53ca3\u4ee5\u4e0a\u8be6\u7ec6\u7684debug\n\n\u8fc7\u591a\u7684\u4fe1\u606f\u53ef\u80fd\u4f1a\u9020\u6210\u5185\u5b58\u788e\u7247\u5316\n]]\n-- \u6253\u5370\u5927\u90e8\u5206info\u65e5\u5fd7\nsocket.sslLog(2)\n", "prefix": "socket.sslLog"}, "socket.adapter": {"body": "socket.adapter(${1:index})", "description": "socket.adapter(index) - \u67e5\u770b\u7f51\u5361\u9002\u914d\u5668\u7684\u8054\u7f51\u72b6\u6001\n\u4f20\u5165\u503c\uff1a\nint \u9700\u8981\u67e5\u770b\u7684\u9002\u914d\u5668\u5e8f\u53f7\uff0c\u53ef\u4ee5\u7559\u7a7a\u4f1a\u67e5\u770b\u5168\u90e8\u7f51\u5361\uff0c\u76f4\u5230\u9047\u5230IP READY\u7684\uff0c\u5982\u679c\u6307\u5b9a\u7f51\u5361\uff0c\u53ea\u80fd\u662fsocket.ETH0\uff08\u5916\u7f6e\u4ee5\u592a\u7f51\uff09\uff0csocket.LWIP_ETH\uff08\u5185\u7f6e\u4ee5\u592a\u7f51\uff09\uff0csocket.LWIP_STA\uff08\u5185\u7f6eWIFI\u7684STA\uff09\uff0csocket.LWIP_AP\uff08\u5185\u7f6eWIFI\u7684AP\uff09\uff0csocket.LWIP_GP\uff08\u5185\u7f6e\u8702\u7a9d\u7f51\u7edc\u7684GPRS\uff09\uff0csocket.USB\uff08\u5916\u7f6eUSB\u7f51\u5361\uff09\n\u8fd4\u56de\u503c\uff1a\nboolean \u88ab\u67e5\u770b\u7684\u9002\u914d\u5668\u662f\u5426IP READY,true\u8868\u793a\u5df2\u7ecf\u51c6\u5907\u597d\u53ef\u4ee5\u8054\u7f51\u4e86,false\u6682\u65f6\u4e0d\u53ef\u4ee5\u8054\u7f51\nint \u6700\u540e\u4e00\u4e2a\u88ab\u67e5\u770b\u7684\u9002\u914d\u5668\u5e8f\u53f7\n\u4f8b\u5b50\uff1a\n-- \u67e5\u770b\u5168\u90e8\u7f51\u5361\uff0c\u76f4\u5230\u627e\u5230\u4e00\u4e2a\u662fIP READY\u7684\nlocal isReady,index = socket.adapter() --\u5982\u679cisReady\u4e3atrue,\u5219index\u4e3aIP READY\u7684\u7f51\u5361\u9002\u914d\u5668\u5e8f\u53f7\n--\u67e5\u770b\u5916\u7f6e\u4ee5\u592a\u7f51\uff08\u6bd4\u5982W5500\uff09\u662f\u5426IP READY\nlocal isReady,default = socket.adapter(socket.ETH0)\n", "prefix": "socket.adapter"}, "socket.remoteIP": {"body": "socket.remoteIP(${1:ctrl})", "description": "socket.remoteIP(ctrl) - \u83b7\u53d6\u5bf9\u7aefip\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\n\u8fd4\u56de\u503c\uff1a\nstring IP1\uff0c\u5982\u679c\u4e3anil\uff0c\u5219\u8868\u793a\u6ca1\u6709\u83b7\u53d6\u5230IP\u5730\u5740\nstring IP2\uff0c\u5982\u679c\u4e3anil\uff0c\u5219\u8868\u793a\u6ca1\u6709IP2\nstring IP3\uff0c\u5982\u679c\u4e3anil\uff0c\u5219\u8868\u793a\u6ca1\u6709IP3\nstring IP4\uff0c\u5982\u679c\u4e3anil\uff0c\u5219\u8868\u793a\u6ca1\u6709IP4\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f: \uff0c\u5fc5\u987b\u5728\u63a5\u6536\u5230socket.ON_LINE\u6d88\u606f\u4e4b\u540e\u624d\u53ef\u80fd\u83b7\u53d6\u5230\uff0c\u6700\u591a\u8fd4\u56de4\u4e2aIP\u3002\n-- socket.connect\u91cc\u5982\u679cremote_port\u8bbe\u7f6e\u62100\uff0c\u5219\u5f53DNS\u5b8c\u6210\u65f6\u5c31\u8fd4\u56desocket.ON_LINE\u6d88\u606f\nlocal ip1,ip2,ip3,ip4 = socket.remoteIP(ctrl)\n", "prefix": "socket.remoteIP"}, "softkb.init": {"body": "softkb.init(${1:port},${2:key_in},${3:key_out})", "description": "softkb.init(port, key_in, key_out) - \u521d\u59cb\u5316\u8f6f\u4ef6\u952e\u76d8\u77e9\u9635\n\u4f20\u5165\u503c\uff1a\nint \u9884\u7559, \u5f53\u524d\u586b0\ntable \u77e9\u9635\u8f93\u5165\u6309\u952e\u8868\ntable \u77e9\u9635\u8f93\u51fa\u6309\u952e\u8868\n\u4f8b\u5b50\uff1a\n key_in = {pin.PD10,pin.PE00,pin.PE01,pin.PE02}\n key_out = {pin.PD12,pin.PD13,pin.PD14,pin.PD15}\n softkb.init(0,key_in,key_out)\n\nsys.subscribe(\"SOFT_KB_INC\", function(port, data, state)\n -- port \u5f53\u524d\u56fa\u5b9a\u4e3a0, \u53ef\u4ee5\u65e0\u89c6\n -- data, \u9700\u8981\u914d\u5408init\u7684map\u8fdb\u884c\u89e3\u6790\n -- state, 1 \u4e3a\u6309\u4e0b, 0 \u4e3a \u91ca\u653e\n -- TODO \u8be6\u7ec6\u4ecb\u7ecd\nend)\n", "prefix": "softkb.init"}, "softkb.deinit": {"body": "softkb.deinit(${1:port})", "description": "softkb.deinit(port) - \u5220\u9664\u8f6f\u4ef6\u952e\u76d8\u77e9\u9635\n\u4f20\u5165\u503c\uff1a\nint \u9884\u7559, \u5f53\u524d\u586b0\n\u4f8b\u5b50\uff1a\n softkb.deinit(0)\n", "prefix": "softkb.deinit"}, "spi.setup": {"body": "spi.setup(${1:id},${2:cs},${3:CPHA},${4:CPOL},${5:dataw},${6:bandrate},${7:bitdict},${8:ms},${9:mode})", "description": "spi.setup(id, cs, CPHA, CPOL, dataw, bandrate, bitdict, ms, mode) - \u8bbe\u7f6e\u5e76\u542f\u7528SPI\n\u4f20\u5165\u503c\uff1a\nint SPI\u53f7,\u4f8b\u59820\nint CS \u7247\u9009\u811a,\u5728w600\u4e0d\u53ef\u7528\u8bf7\u586bnil\nint CPHA \u9ed8\u8ba40,\u53ef\u90090/1\nint CPOL \u9ed8\u8ba40,\u53ef\u90090/1\nint \u6570\u636e\u5bbd\u5ea6,\u9ed8\u8ba48bit\nint \u6ce2\u7279\u7387,\u9ed8\u8ba42M=2000000\nint \u5927\u5c0f\u7aef, \u9ed8\u8ba4spi.MSB, \u53ef\u9009spi.LSB\nint \u4e3b\u4ece\u8bbe\u7f6e, \u9ed8\u8ba4\u4e3b1, \u53ef\u9009\u4ece\u673a0. \u901a\u5e38\u53ea\u652f\u6301\u4e3b\u673a\u6a21\u5f0f\nint \u5de5\u4f5c\u6a21\u5f0f, \u5168\u53cc\u5de51, \u534a\u53cc\u5de50, \u9ed8\u8ba4\u5168\u53cc\u5de5\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u8fd4\u56de0,\u5426\u5219\u8fd4\u56de\u5176\u4ed6\u503c\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316spi\nspi.setup(0,20,0,0,8,2000000,spi.MSB,1,1)\n", "prefix": "spi.setup"}, "spi.createSoft": {"body": "spi.createSoft(${1:cs},${2:mosi},${3:miso},${4:clk},${5:CPHA},${6:CPOL},${7:dataw},${8:bitdict},${9:ms},${10:mode})", "description": "spi.createSoft(cs, mosi, miso, clk, CPHA, CPOL, dataw, bitdict, ms, mode) - \u8bbe\u7f6e\u5e76\u542f\u7528\u8f6f\u4ef6SPI\n\u4f20\u5165\u503c\uff1a\nint cs\u5f15\u811a\u7f16\u53f7\uff0c\u4f20\u5165nil\u610f\u4e3aLua\u63a7\u5236cs\u811a\nint mosi\u5f15\u811a\u7f16\u53f7\nint miso\u5f15\u811a\u7f16\u53f7\nint clk\u5f15\u811a\u7f16\u53f7\nint \u9ed8\u8ba40\uff0c\u53ef\u90090/1\nint \u9ed8\u8ba40\uff0c\u53ef\u90090/1\nint \u6570\u636e\u5bbd\u5ea6\uff0c\u9ed8\u8ba48bit\nint \u5927\u5c0f\u7aef\uff0c\u9ed8\u8ba4spi.MSB, \u53ef\u9009spi.LSB\nint \u4e3b\u4ece\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u4e3b1, \u53ef\u9009\u4ece\u673a0. \u901a\u5e38\u53ea\u652f\u6301\u4e3b\u673a\u6a21\u5f0f\nint \u5de5\u4f5c\u6a21\u5f0f\uff0c\u5168\u53cc\u5de51\uff0c\u534a\u53cc\u5de50\uff0c\u9ed8\u8ba4\u534a\u53cc\u5de5\n\u8fd4\u56de\u503c\uff1a\n\u8f6f\u4ef6SPI\u5bf9\u8c61 \u53ef\u5f53\u4f5cSPI\u7684id\u4f7f\u7528\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316\u8f6f\u4ef6spi\nlocal softSpiDevice = spi.createSoft(0, 1, 2, 3, 0, 0, 8, spi.MSB, 1, 1)\nlocal result = spi.send(softSpiDevice, string.char(0x9f))\n", "prefix": "spi.createSoft"}, "spi.close": {"body": "spi.close(${1:id})", "description": "spi.close(id) - \u5173\u95ed\u6307\u5b9a\u7684SPI\n\u4f20\u5165\u503c\uff1a\nint SPI\u53f7,\u4f8b\u59820\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u8fd4\u56de0,\u5426\u5219\u8fd4\u56de\u5176\u4ed6\u503c\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316spi\nspi.close(0)\n", "prefix": "spi.close"}, "spi.transfer": {"body": "spi.transfer(${1:id},${2:send_data},${3:send_len},${4:recv_len})", "description": "spi.transfer(id, send_data, send_len, recv_len) - \u4f20\u8f93SPI\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint SPI\u53f7(\u4f8b\u59820)\u6216\u8f6f\u4ef6SPI\u5bf9\u8c61\nstring/zbuff \u5f85\u53d1\u9001\u7684\u6570\u636e\uff0c\u5982\u679c\u4e3azbuff\u6570\u636e\uff0c\u5219\u4f1a\u4ece\u5bf9\u8c61\u6240\u5904\u7684\u6307\u9488\u5904\u5f00\u59cb\u8bfb\nint \u53ef\u9009\u3002\u5f85\u53d1\u9001\u6570\u636e\u7684\u957f\u5ea6\uff0c\u9ed8\u8ba4\u4e3adata\u957f\u5ea6\nint \u53ef\u9009\u3002\u8bfb\u53d6\u6570\u636e\u7684\u957f\u5ea6\uff0c\u9ed8\u8ba4\u4e3a1\n\u8fd4\u56de\u503c\uff1a\nstring \u8bfb\u53d6\u6210\u529f\u8fd4\u56de\u5b57\u7b26\u4e32,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316spi\nspi.setup(0,nil,0,0,8,2000000,spi.MSB,1,1)\nlocal recv = spi.transfer(0, \"123\")--\u53d1\u9001123,\u5e76\u8bfb\u53d6\u6570\u636e\n\nlocal buff = zbuff.create(1024, 0x33) --\u521b\u5efa\u4e00\u4e2a\u521d\u503c\u5168\u4e3a0x33\u7684\u5185\u5b58\u533a\u57df\nlocal recv = spi.transfer(0, buff)--\u628azbuff\u6570\u636e\u4ece\u6307\u9488\u5f00\u59cb\uff0c\u5168\u53d1\u51fa\u53bb,\u5e76\u8bfb\u53d6\u6570\u636e\n", "prefix": "spi.transfer"}, "spi.recv": {"body": "spi.recv(${1:id},${2:size},${3:buff})", "description": "spi.recv(id, size, buff) - \u63a5\u6536\u6307\u5b9a\u957f\u5ea6\u7684SPI\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint SPI\u53f7,\u4f8b\u59820\nint \u6570\u636e\u957f\u5ea6\nuserdata zbuff\u5bf9\u8c61,\u53ef\u9009,2024.3.29\u65b0\u589e\n\u8fd4\u56de\u503c\uff1a\nstring/int \u8bfb\u53d6\u6210\u529f\u8fd4\u56de\u5b57\u7b26\u4e32,\u82e5\u4f20\u5165\u7684\u662fzbuff\u5c31\u8fd4\u56de\u8bfb\u53d6\u5927\u5c0f,\u51fa\u9519\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316spi\nspi.setup(0,nil,0,0,8,2000000,spi.MSB,1,1)\n-- \u63a5\u6536\u6570\u636e\nlocal recv = spi.recv(0, 4)--\u63a5\u65364\u5b57\u8282\u6570\u636e\n\n-- \u5f53\u4f20\u5165zbuff\u53c2\u6570\u65f6,\u8fd4\u56de\u503c\u6709\u6240\u4e0d\u540c. 2024.3.29\u65b0\u589e\n-- \u8bfb\u53d6\u6210\u529f\u540e, \u6307\u9488\u4f1a\u5f80\u540e\u79fb\u52a8len\u4e2a\u5b57\u8282\n-- \u5199\u5165\u4f4d\u7f6e\u4ee5\u5f53\u524dused()\u4f4d\u7f6e\u5f00\u59cb, \u8bf7\u52a1\u5fc5\u786e\u4fdd\u6709\u8db3\u591f\u7a7a\u95f4\u5199\u5165len\u957f\u5ea6\u7684\u6570\u636e\nlocal len = spi.recv(0, 4, buff)\n", "prefix": "spi.recv"}, "spi.send": {"body": "spi.send(${1:id},${2:data[},${3:len]})", "description": "spi.send(id, data[, len]) - \u53d1\u9001SPI\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint SPI\u53f7,\u4f8b\u59820\nstring/zbuff \u5f85\u53d1\u9001\u7684\u6570\u636e\uff0c\u5982\u679c\u4e3azbuff\u6570\u636e\uff0c\u5219\u4f1a\u4ece\u5bf9\u8c61\u6240\u5904\u7684\u6307\u9488\u5904\u5f00\u59cb\u8bfb\nint \u53ef\u9009\u3002\u5f85\u53d1\u9001\u6570\u636e\u7684\u957f\u5ea6\uff0c\u9ed8\u8ba4\u4e3adata\u957f\u5ea6\n\u8fd4\u56de\u503c\uff1a\nint \u53d1\u9001\u7ed3\u679c\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316spi\nspi.setup(0,nil,0,0,8,2000000,spi.MSB,1,1)\nlocal result = spi.send(0, \"123\")--\u53d1\u9001123\n\nlocal buff = zbuff.create(1024, 0x33) --\u521b\u5efa\u4e00\u4e2a\u521d\u503c\u5168\u4e3a0x33\u7684\u5185\u5b58\u533a\u57df\nlocal result = spi.send(0, buff)--\u628azbuff\u6570\u636e\u4ece\u6307\u9488\u5f00\u59cb\uff0c\u5168\u53d1\u51fa\u53bb\n", "prefix": "spi.send"}, "spi.deviceSetup": {"body": "spi.deviceSetup(${1:id},${2:cs},${3:CPHA},${4:CPOL},${5:dataw},${6:bandrate},${7:bitdict},${8:ms},${9:mode})", "description": "spi.deviceSetup(id, cs, CPHA, CPOL, dataw, bandrate, bitdict, ms, mode) - \u8bbe\u7f6e\u5e76\u542f\u7528SPI(\u5bf9\u8c61\u65b9\u5f0f)\n\u4f20\u5165\u503c\uff1a\nint SPI\u53f7,\u4f8b\u59820\nint CS \u7247\u9009\u811a,\u5728w600\u4e0d\u53ef\u7528\u8bf7\u586bnil\nint CPHA \u9ed8\u8ba40,\u53ef\u90090/1\nint CPOL \u9ed8\u8ba40,\u53ef\u90090/1\nint \u6570\u636e\u5bbd\u5ea6,\u9ed8\u8ba48bit\nint \u6ce2\u7279\u7387,\u9ed8\u8ba420M=20000000\nint \u5927\u5c0f\u7aef, \u9ed8\u8ba4spi.MSB, \u53ef\u9009spi.LSB\nint \u4e3b\u4ece\u8bbe\u7f6e, \u9ed8\u8ba4\u4e3b1, \u53ef\u9009\u4ece\u673a0. \u901a\u5e38\u53ea\u652f\u6301\u4e3b\u673a\u6a21\u5f0f\nint \u5de5\u4f5c\u6a21\u5f0f, \u5168\u53cc\u5de51, \u534a\u53cc\u5de50, \u9ed8\u8ba4\u5168\u53cc\u5de5\n\u8fd4\u56de\u503c\uff1a\nuserdata spi_device\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316spi\nlocal spi_device = spi.deviceSetup(0,17,0,0,8,2000000,spi.MSB,1,1)\n", "prefix": "spi.deviceSetup"}, "spi_device:close": {"body": "spi_device:close()", "description": "spi_device:close() - \u5173\u95ed\u6307\u5b9a\u7684SPI(\u5bf9\u8c61\u65b9\u5f0f)\n\u4f20\u5165\u503c\uff1a\nuserdata spi_device\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u8fd4\u56de0,\u5426\u5219\u8fd4\u56de\u5176\u4ed6\u503c\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316spi\nspi_device.close()\n", "prefix": "spi_device:close"}, "spi_device:transfer": {"body": "spi_device:transfer(${1:send_data[},${2:len]})", "description": "spi_device:transfer(send_data[, len]) - \u4f20\u8f93SPI\u6570\u636e(\u5bf9\u8c61\u65b9\u5f0f)\n\u4f20\u5165\u503c\uff1a\nuserdata spi_device\nstring/zbuff \u5f85\u53d1\u9001\u7684\u6570\u636e\uff0c\u5982\u679c\u4e3azbuff\u6570\u636e\uff0c\u5219\u4f1a\u4ece\u5bf9\u8c61\u6240\u5904\u7684\u6307\u9488\u5904\u5f00\u59cb\u8bfb\nint \u53ef\u9009\u3002\u5f85\u53d1\u9001\u6570\u636e\u7684\u957f\u5ea6\uff0c\u9ed8\u8ba4\u4e3adata\u957f\u5ea6\nint \u53ef\u9009\u3002\u8bfb\u53d6\u6570\u636e\u7684\u957f\u5ea6\uff0c\u9ed8\u8ba4\u4e3a1\n\u8fd4\u56de\u503c\uff1a\nstring \u8bfb\u53d6\u6210\u529f\u8fd4\u56de\u5b57\u7b26\u4e32,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316spi\nlocal spi_device = spi.device_setup(0,17,0,0,8,2000000,spi.MSB,1,1)\nlocal recv = spi_device:transfer(\"123\")--\u53d1\u9001123,\u5e76\u8bfb\u53d6\u6570\u636e\nlocal result = spi_device:transfer({0x00,0x01})--\u53d1\u90010x00,0x01,\u5e76\u8bfb\u53d6\u6570\u636e\n\nlocal buff = zbuff.create(1024, 0x33) --\u521b\u5efa\u4e00\u4e2a\u521d\u503c\u5168\u4e3a0x33\u7684\u5185\u5b58\u533a\u57df\nlocal recv = spi_device:transfer(buff)--\u628azbuff\u6570\u636e\u4ece\u6307\u9488\u5f00\u59cb\uff0c\u5168\u53d1\u51fa\u53bb,\u5e76\u8bfb\u53d6\u6570\u636e\n", "prefix": "spi_device:transfer"}, "spi_device:send": {"body": "spi_device:send(${1:data[},${2:len]})", "description": "spi_device:send(data[, len]) - \u53d1\u9001SPI\u6570\u636e(\u5bf9\u8c61\u65b9\u5f0f)\n\u4f20\u5165\u503c\uff1a\nuserdata spi_device\nstring/zbuff \u5f85\u53d1\u9001\u7684\u6570\u636e\uff0c\u5982\u679c\u4e3azbuff\u6570\u636e\uff0c\u5219\u4f1a\u4ece\u5bf9\u8c61\u6240\u5904\u7684\u6307\u9488\u5904\u5f00\u59cb\u8bfb\n\u8fd4\u56de\u503c\uff1a\nint \u53d1\u9001\u7ed3\u679c\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316spi\nlocal spi_device = spi.device_setup(0,17,0,0,8,2000000,spi.MSB,1,1)\nlocal result = spi_device:send(\"123\")--\u53d1\u9001123\nlocal result = spi_device:send({0x00,0x01})--\u53d1\u90010x00,0x01\n\nlocal buff = zbuff.create(1024, 0x33) --\u521b\u5efa\u4e00\u4e2a\u521d\u503c\u5168\u4e3a0x33\u7684\u5185\u5b58\u533a\u57df\nlocal result = spi_device:send(buff)--\u628azbuff\u6570\u636e\u4ece\u6307\u9488\u5f00\u59cb\uff0c\u5168\u53d1\u51fa\u53bb\n", "prefix": "spi_device:send"}, "spi_device:recv": {"body": "spi_device:recv(${1:size})", "description": "spi_device:recv(size) - \u63a5\u6536\u6307\u5b9a\u957f\u5ea6\u7684SPI\u6570\u636e(\u5bf9\u8c61\u65b9\u5f0f)\n\u4f20\u5165\u503c\uff1a\nuserdata spi_device\nint \u6570\u636e\u957f\u5ea6\n\u8fd4\u56de\u503c\uff1a\nstring \u8bfb\u53d6\u6210\u529f\u8fd4\u56de\u5b57\u7b26\u4e32,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316spi\nlocal spi_device = spi.device_setup(0,17,0,0,8,2000000,spi.MSB,1,1)\nlocal recv = spi_device:recv(4)--\u63a5\u65364\u5b57\u8282\u6570\u636e\n", "prefix": "spi_device:recv"}, "spi.xfer": {"body": "spi.xfer(${1:id},${2:txbuff},${3:rxbuff},${4:rx_len},${5:transfer_done_topic})", "description": "spi.xfer(id, txbuff, rxbuff, rx_len, transfer_done_topic) - \u975e\u963b\u585e\u65b9\u5f0f\u786c\u4ef6SPI\u4f20\u8f93SPI\u6570\u636e\uff0c\u76ee\u7684\u4e3a\u4e86\u63d0\u9ad8\u6838\u5fc3\u5229\u7528\u7387\u3002API\u76f4\u63a5\u8fd4\u56de\u662f\u5426\u542f\u52a8\u4f20\u8f93\uff0c\u4f20\u8f93\u5b8c\u6210\u540e\u901a\u8fc7topic\u56de\u8c03\uff0c\u672cAPI\u9002\u5408\u786c\u4ef6SPI\u4f20\u8f93\u5927\u91cf\u6570\u636e\u4f20\u8f93\uff0c\u5916\u8bbe\u529f\u80fd\uff08LCD SPI\uff0cW5500 SPI\u4e4b\u7c7b\u7684\uff09\u5360\u636e\u7684SPI\u548c\u8f6f\u4ef6SPI\u4e0d\u80fd\u7528\uff0c\u5c11\u91cf\u6570\u636e\u4f20\u8f93\u5efa\u8bae\u4f7f\u7528\u4f20\u7edf\u963b\u585e\u578bAPI\n\u4f20\u5165\u503c\uff1a\nuserdata or int spi_device\u6216\u8005spi_id\uff0c\u6ce8\u610f\uff0c\u5982\u679c\u662fspi_device\uff0c\u9700\u8981\u624b\u52a8\u5728\u4f20\u8f93\u5b8c\u6210\u540e\u62c9\u9ad8cs!!!!!!\nzbuff \u5f85\u53d1\u9001\u7684\u6570\u636e\uff0c\u5982\u679c\u4e3anil\uff0c\u5219\u53ea\u63a5\u6536\u6570\u636e\uff0c\u7531\u4e8e\u7528\u7684\u975e\u963b\u585e\u6a21\u578b\uff0c\u4e3a\u4fdd\u8bc1\u52a8\u6001\u6570\u636e\u7684\u6709\u6548\u6027\uff0c\u53ea\u80fd\u4f7f\u7528zbuff\uff0c\u53d1\u9001\u7684\u6570\u636e\u4ecezbuff.addr\nzbuff \u63a5\u6536\u6570\u636e\uff0c\u5982\u679c\u4e3anil\uff0c\u5219\u53ea\u53d1\u9001\u6570\u636e\uff0c\u7531\u4e8e\u7528\u7684\u975e\u963b\u585e\u6a21\u578b\uff0c\u4e3a\u4fdd\u8bc1\u52a8\u6001\u6570\u636e\u7684\u6709\u6548\u6027\uff0c\u53ea\u80fd\u4f7f\u7528zbuff\uff0c\u63a5\u6536\u7684\u6570\u636e\u4ecezbuff.addr\u5f00\u59cb\u5b58\u50a8\nint \u4f20\u8f93\u6570\u636e\u957f\u5ea6\uff0c\u7279\u522b\u8bf4\u660e \u5982\u679c\u4e3a\u534a\u53cc\u5de5\uff0c\u5148\u53d1\u540e\u6536\uff0c\u6bd4\u5982spi flash\u64cd\u4f5c\u8fd9\u79cd\uff0c\u5219\u957f\u5ea6=\u53d1\u9001\u5b57\u8282+\u63a5\u6536\u5b57\u8282\uff0c\u6ce8\u610f\u4e0a\u9762\u53d1\u9001\u548c\u63a5\u6536buff\u90fd\u8981\u7559\u8db3\u591f\u7684\u6570\u636e\uff0c\u540e\u7eed\u63a5\u6536\u6570\u636e\u5904\u7406\u9700\u8981\u8df3\u8fc7\u53d1\u9001\u6570\u636e\u957f\u5ea6\u5b57\u8282\nstring \u4f20\u8f93\u5b8c\u6210\u540e\u56de\u8c03\u7684topic\n\u8fd4\u56de\u503c\uff1a\nboolean true/false \u672c\u6b21\u4f20\u8f93\u662f\u5426\u6b63\u786e\u542f\u52a8\uff0ctrue\uff0c\u542f\u52a8\uff0cfalse\uff0c\u6709\u9519\u8bef\u65e0\u6cd5\u542f\u52a8\u3002\u4f20\u8f93\u5b8c\u6210\u4f1a\u53d1\u5e03\u6d88\u606ftransfer_done_topic\u548cboolean\u578b\u7ed3\u679c\n\u4f8b\u5b50\uff1a\nlocal result = spi.xfer(spi.SPI_0, txbuff, rxbuff, 1024, \"SPIDONE\") if result then result, spi_id, succ, error_code = sys.waitUntil(\"SPIDONE\") end if not result or not succ then log.info(\"spi fail, error code\", error_code) else log.info(\"spi ok\") end\n\n", "prefix": "spi.xfer"}, "spislave.setup": {"body": "spislave.setup(${1:id},${2:opts})", "description": "spislave.setup(id, opts) - \u521d\u59cb\u5316SPI\u4ece\u673a\n\u4f20\u5165\u503c\uff1a\nint \u4ece\u673aSPI\u7684\u7f16\u53f7,\u6ce8\u610f\u4e0eSPI\u4e3b\u673a\u7684\u7f16\u53f7\u7684\u5dee\u5f02,\u8fd9\u4e2a\u4e0e\u5177\u4f53\u8bbe\u5907\u76f8\u5173\ntable opts \u6269\u5c55\u914d\u7f6e\u53c2\u6570,\u5f53\u524d\u65e0\u53c2\u6570\n\u8fd4\u56de\u503c\uff1a\nboolean true\u8868\u793a\u6210\u529f,\u5176\u4ed6\u5931\u8d25\n\u4f8b\u5b50\uff1a\n-- \u5f53\u524d\u4ec5XT804\u7cfb\u5217\u652f\u6301, \u4f8b\u5982 Air101/Air103/Air601/Air690\n-- Air101\u4e3a\u4f8b, \u521d\u59cb\u5316SPI\u4ece\u673a, \u7f16\u53f7\u4e3a2, SPI\u6a21\u5f0f\nspislave.setup(2)\n-- Air101\u4e3a\u4f8b, \u521d\u59cb\u5316SPI\u4ece\u673a, \u7f16\u53f7\u4e3a3, SDIO\u6a21\u5f0f\nspislavve.setup(3)\n", "prefix": "spislave.setup"}, "spislave.ready": {"body": "spislave.ready(${1:id})", "description": "spislave.ready(id) - \u662f\u5426\u53ef\u5199\n\u4f20\u5165\u503c\uff1a\nint \u4ece\u673aSPI\u7684\u7f16\u53f7\n\u8fd4\u56de\u503c\uff1a\nboolean true\u8868\u793a\u53ef\u5199,\u5176\u4ed6\u4e0d\u53ef\u5199\n", "prefix": "spislave.ready"}, "spislave.on": {"body": "spislave.on(${1:id},${2:cb})", "description": "spislave.on(id, cb) - \u6ce8\u518c\u4e8b\u4ef6\u56de\u8c03\u51fd\u6570\n\u4f20\u5165\u503c\uff1a\nint \u4ece\u673aSPI\u7684\u7f16\u53f7\nfunction \u56de\u8c03\u51fd\u6570\n", "prefix": "spislave.on"}, "spislave.read": {"body": "spislave.read(${1:id},${2:ptr},${3:buff},${4:len})", "description": "spislave.read(id, ptr, buff, len) - \u8bfb\u53d6\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u4ece\u673aSPI\u7684\u7f16\u53f7\nuserdata \u7528\u6237\u6570\u636e\u6307\u9488, \u4ece\u56de\u8c03\u51fd\u6570\u5f97\u5230\nint zbuff\u7f13\u51b2\u5bf9\u8c61\nint \u8bfb\u53d6\u957f\u5ea6,\u4ece\u56de\u8c03\u51fd\u6570\u5f97\u5230\n\u8fd4\u56de\u503c\uff1a\nint \u8bfb\u53d6\u5230\u5b57\u8282\u6570,\u901a\u5e38\u4e0e\u671f\u671b\u8bfb\u53d6\u7684\u957f\u5ea6\u76f8\u540c\nint \u9519\u8bef\u7801, \u4ec5\u5f53\u51fa\u9519\u65f6\u8fd4\u56de\n", "prefix": "spislave.read"}, "spislave.write": {"body": "spislave.write(${1:id},${2:ptr},${3:buff},${4:len})", "description": "spislave.write(id, ptr, buff, len) - \u5199\u5165\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u4ece\u673aSPI\u7684\u7f16\u53f7\nuserdata \u7528\u6237\u6570\u636e\u6307\u9488, \u5f53\u524d\u4f20nil\nint zbuff\u7f13\u51b2\u5bf9\u8c61\nint \u5199\u5165\u957f\u5ea6,\u6ce8\u610f\u4e0d\u80fd\u8d85\u8fc7\u786c\u4ef6\u9650\u5236,\u901a\u5e38\u662f1500\u5b57\u8282\n\u8fd4\u56de\u503c\uff1a\nboolean true\u8868\u793a\u6210\u529f,\u5176\u4ed6\u5931\u8d25\nint \u9519\u8bef\u7801, \u4ec5\u5f53\u51fa\u9519\u65f6\u8fd4\u56de\n", "prefix": "spislave.write"}, "sqlite3.open": {"body": "sqlite3.open(${1:path})", "description": "sqlite3.open(path) - \u6253\u5f00\u6570\u636e\u5e93\n\u4f20\u5165\u503c\uff1a\nstring \u6570\u636e\u5e93\u6587\u4ef6\u8def\u5f84,\u5fc5\u987b\u586b\u5199,\u4e0d\u5b58\u5728\u5c31\u4f1a\u81ea\u52a8\u65b0\u5efa\n\u8fd4\u56de\u503c\uff1a\nuserdata \u6570\u636e\u5e93\u6307\u9488,\u662f\u5426\u5c31\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nlocal db = sqlite3.open(\"/test.db\")\nif db then\n -- \u6570\u636e\u5e93\u64cd\u4f5cxxxx\n\n -- \u7528\u5b8c\u5fc5\u987b\u5173\u6389\n sqlite3.close(db)\nend\n", "prefix": "sqlite3.open"}, "sqlite3.exec": {"body": "sqlite3.exec(${1:db},${2:sql})", "description": "sqlite3.exec(db, sql) - \u6267\u884cSQL\u8bed\u53e5\n\u4f20\u5165\u503c\uff1a\nuserdata \u901a\u8fc7sqlite3.open\u83b7\u53d6\u5230\u7684\u6570\u636e\u5e93\u6307\u9488\nstring SQL\u5b57\u7b26\u4e32,\u5fc5\u987b\u586b\u5199\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56denil\ntable \u6210\u529f\u8fd4\u56de\u67e5\u8be2\u7ed3\u679c(\u82e5\u6709),\u5426\u5219\u8fd4\u56de\u62a5\u9519\u7684\u5b57\u7b26\u4e32\n", "prefix": "sqlite3.exec"}, "sqlite3.close": {"body": "sqlite3.close(${1:db})", "description": "sqlite3.close(db) - \u5173\u95ed\u6570\u636e\u5e93\n\u4f20\u5165\u503c\uff1a\nuserdata \u901a\u8fc7sqlite3.open\u83b7\u53d6\u5230\u7684\u6570\u636e\u5e93\u6307\u9488\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56denil\n", "prefix": "sqlite3.close"}, "statem.create": {"body": "statem.create(${1:count},${2:repeat})", "description": "statem.create(count, repeat) - \u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u72b6\u6001\u673a.\n\u4f20\u5165\u503c\uff1a\nint \u6307\u4ee4\u6761\u6570,\u9ed8\u8ba432\u6761\nint \u91cd\u590d\u6267\u884c\u7684\u6b21\u6570, 0 \u4ee3\u8868\u4e0d\u91cd\u590d, \u6b63\u6574\u6570\u4ee3\u8868\u5177\u4f53\u91cd\u590d\u6267\u884c\u7684\u6b21\u6570. \u6682\u4e0d\u652f\u6301\u6c38\u7eed\u6267\u884c\n\u8fd4\u56de\u503c\uff1a\nsome \u82e5\u6210\u529f,\u8fd4\u56de\u72b6\u6001\u673a\u6307\u9488,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\ngpio.setup(7, 0, gpio.PULLUP)\ngpio.setup(12, 0, gpio.PULLUP)\ngpio.setup(13, 0, gpio.PULLUP)\ngpio.setup(14, 0, gpio.PULLUP)\nlocal sm = statem.create()\n :gpio_set(7, 0) -- gpio\u8bbe\u7f6e\u4e3a\u4f4e\u7535\u5e73\n :usleep(10) -- \u4f11\u772010us\n :gpio_set(7, 1) -- gpio\u8bbe\u7f6e\u4e3a\u9ad8\u7535\u5e73\n :usleep(40) -- \u4f11\u772040us\n :gpio_set(12, 1) -- gpio\u8bbe\u7f6e\u4e3a\u9ad8\u7535\u5e73\n :gpio_set(13, 1) -- gpio\u8bbe\u7f6e\u4e3a\u9ad8\u7535\u5e73\n :gpio_set(14, 1) -- gpio\u8bbe\u7f6e\u4e3a\u9ad8\u7535\u5e73\n :usleep(40) -- \u4f11\u772040us\n :gpio_set(7, 0) -- gpio\u8bbe\u7f6e\u4e3a\u4f4e\u7535\u5e73\n :finish()\n\n-- \u6267\u884c\u4e4b,\u540e\u7eed\u4f1a\u652f\u6301\u540e\u53f0\u6267\u884c\nsm:exec()\n", "prefix": "statem.create"}, "string.toHex": {"body": "string.toHex(${1:str},${2:separator})", "description": "string.toHex(str, separator) - \u5c06\u5b57\u7b26\u4e32\u8f6c\u6210HEX\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8f6c\u6362\u7684\u5b57\u7b26\u4e32\nstring \u5206\u9694\u7b26, \u9ed8\u8ba4\u4e3a\"\"\n\u8fd4\u56de\u503c\uff1a\nstring HEX\u5b57\u7b26\u4e32\nnumber HEX\u5b57\u7b26\u4e32\u7684\u957f\u5ea6\n\u4f8b\u5b50\uff1a\nstring.toHex(\"\\1\\2\\3\") --> \"010203\" 6\nstring.toHex(\"123abc\") --> \"313233616263\" 12\nstring.toHex(\"123abc\", \" \") --> \"31 32 33 61 62 63 \" 12\n", "prefix": "string.toHex"}, "string.fromHex": {"body": "string.fromHex(${1:hex})", "description": "string.fromHex(hex) - \u5c06HEX\u8f6c\u6210\u5b57\u7b26\u4e32\n\u4f20\u5165\u503c\uff1a\nstring hex,16\u8fdb\u5236\u7ec4\u6210\u7684\u4e32\n\u8fd4\u56de\u503c\uff1a\nstring \u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\nstring.fromHex(\"010203\") --> \"\\1\\2\\3\"\nstring.fromHex(\"313233616263\") --> \"123abc\"\n", "prefix": "string.fromHex"}, "string.split": {"body": "string.split(${1:str},${2:delimiter},${3:keepEmtry})", "description": "string.split(str, delimiter, keepEmtry) - \u6309\u7167\u6307\u5b9a\u5206\u9694\u7b26\u5206\u5272\u5b57\u7b26\u4e32\n\u4f20\u5165\u503c\uff1a\nstring \u8f93\u5165\u5b57\u7b26\u4e32\nstring \u5206\u9694\u7b26,\u53ef\u9009,\u9ed8\u8ba4 \",\"\nbool \u662f\u5426\u4fdd\u7559\u7a7a\u767d\u7247\u6bb5,\u9ed8\u8ba4\u4e3afalse,\u4e0d\u4fdd\u7559. 2023.4.11\u4e4b\u540e\u7684\u56fa\u4ef6\u53ef\u7528\n\u8fd4\u56de\u503c\uff1a\ntable \u5206\u5272\u540e\u7684\u5b57\u7b26\u4e32\u8868\n\u4f8b\u5b50\uff1a\nlocal tmp = string.split(\"123,233333,122\")\nlog.info(\"tmp\", json.encode(tmp))\nlocal tmp = (\"123,456,789\"):split(',') --> {'123','456','789'}\nlog.info(\"tmp\", json.encode(tmp))\n\n-- \u4fdd\u7559\u7a7a\u7247\u6bb5, 2023.4.11\u4e4b\u540e\u7684\u56fa\u4ef6\u53ef\u7528\nlocal str = \"/tmp//def/1234/\"\nlocal tmp = str:split(\"/\", true) \nlog.info(\"str.split\", #tmp, json.encode(tmp))\n", "prefix": "string.split"}, "string.toValue": {"body": "string.toValue(${1:str})", "description": "string.toValue(str) - \u8fd4\u56de\u5b57\u7b26\u4e32tonumber\u7684\u8f6c\u4e49\u5b57\u7b26\u4e32(\u7528\u6765\u652f\u6301\u8d85\u8fc731\u4f4d\u6574\u6570\u7684\u8f6c\u6362)\n\u4f20\u5165\u503c\uff1a\nstring \u8f93\u5165\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nstring \u8f6c\u6362\u540e\u7684\u4e8c\u8fdb\u5236\u5b57\u7b26\u4e32\nnumber \u8f6c\u6362\u4e86\u591a\u5c11\u4e2a\u5b57\u7b26\n\u4f8b\u5b50\uff1a\nstring.toValue(\"123456\") --> \"\\1\\2\\3\\4\\5\\6\" 6\nstring.toValue(\"123abc\") --> \"\\1\\2\\3\\a\\b\\c\" 6\n", "prefix": "string.toValue"}, "string.urlEncode": {"body": "string.urlEncode(${1:\"123abc\"})", "description": "string.urlEncode(\"123 abc\") - \u5c06\u5b57\u7b26\u4e32\u8fdb\u884curl\u7f16\u7801\u8f6c\u6362\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8f6c\u6362\u7684\u5b57\u7b26\u4e32\nint mode:url\u7f16\u7801\u7684\u8f6c\u6362\u6807\u51c6,\n", "prefix": "string.urlEncode"}, "string.toBase64": {"body": "string.toBase64(${1:str})", "description": "string.toBase64(str) - \u5c06\u5b57\u7b26\u4e32\u8fdb\u884cbase64\u7f16\u7801\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8f6c\u6362\u7684\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nstring \u89e3\u7801\u540e\u7684\u5b57\u7b26\u4e32,\u5982\u679c\u89e3\u7801\u5931\u8d25\u4f1a\u8fd4\u56de\u7a7a\u5b57\u7b26\u4e32\n", "prefix": "string.toBase64"}, "string.fromBase64": {"body": "string.fromBase64(${1:str})", "description": "string.fromBase64(str) - \u5c06\u5b57\u7b26\u4e32\u8fdb\u884cbase64\u89e3\u7801\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8f6c\u6362\u7684\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nstring \u89e3\u7801\u540e\u7684\u5b57\u7b26\u4e32,\u5982\u679c\u89e3\u7801\u5931\u8d25\u4f1a\u8fd4\u56de\u7a7a\u5b57\u7b26\u4e32\n", "prefix": "string.fromBase64"}, "string.toBase32": {"body": "string.toBase32(${1:str})", "description": "string.toBase32(str) - \u5c06\u5b57\u7b26\u4e32\u8fdb\u884cbase32\u7f16\u7801\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8f6c\u6362\u7684\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nstring \u89e3\u7801\u540e\u7684\u5b57\u7b26\u4e32,\u5982\u679c\u89e3\u7801\u5931\u8d25\u4f1a\u8fd4\u56de0\u957f\u5ea6\u5b57\u7b26\u4e32\n", "prefix": "string.toBase32"}, "string.fromBase32": {"body": "string.fromBase32(${1:str})", "description": "string.fromBase32(str) - \u5c06\u5b57\u7b26\u4e32\u8fdb\u884cbase32\u89e3\u7801\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8f6c\u6362\u7684\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nstring \u89e3\u7801\u540e\u7684\u5b57\u7b26\u4e32,\u5982\u679c\u89e3\u7801\u5931\u8d25\u4f1a\u8fd4\u56de0\u957f\u5ea6\u5b57\u7b26\u4e32\n", "prefix": "string.fromBase32"}, "string.startsWith": {"body": "string.startsWith(${1:str},${2:prefix})", "description": "string.startsWith(str, prefix) - \u5224\u65ad\u5b57\u7b26\u4e32\u524d\u7f00\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u68c0\u67e5\u7684\u5b57\u7b26\u4e32\nstring \u524d\u7f00\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nbool \u771f\u4e3atrue, \u5047\u4e3afalse\n\u4f8b\u5b50\uff1a\nlocal str = \"abc\"\nlog.info(\"str\", str:startsWith(\"a\"))\nlog.info(\"str\", str:startsWith(\"b\"))\n", "prefix": "string.startsWith"}, "string.endsWith": {"body": "string.endsWith(${1:str},${2:suffix})", "description": "string.endsWith(str, suffix) - \u5224\u65ad\u5b57\u7b26\u4e32\u540e\u7f00\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u68c0\u67e5\u7684\u5b57\u7b26\u4e32\nstring \u540e\u7f00\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nbool \u771f\u4e3atrue, \u5047\u4e3afalse\n\u4f8b\u5b50\uff1a\nlocal str = \"abc\"\nlog.info(\"str\", str:endsWith(\"c\"))\nlog.info(\"str\", str:endsWith(\"b\"))\n", "prefix": "string.endsWith"}, "string.trim": {"body": "string.trim(${1:str},${2:ltrim},${3:rtrim})", "description": "string.trim(str, ltrim, rtrim) - \u88c1\u526a\u5b57\u7b26\u4e32,\u53bb\u9664\u5934\u5c3e\u7684\u7a7a\u683c\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u5904\u7406\u7684\u5b57\u7b26\u4e32\nbool \u6e05\u7406\u524d\u7f00,\u9ed8\u8ba4\u4e3atrue\nbool \u6e05\u7406\u540e\u7f00,\u9ed8\u8ba4\u4e3atrue\n\u8fd4\u56de\u503c\uff1a\nstring \u6e05\u7406\u540e\u7684\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\nlocal str = \"\\r\\nabc\\r\\n\"\nlog.info(\"str\", string.trim(str)) -- \u6253\u5370 \"abc\"\nlog.info(\"str\", str:trim()) -- \u6253\u5370 \"abc\"\nlog.info(\"str\", #string.trim(str, false, true)) -- \u4ec5\u88c1\u526a\u540e\u7f00,\u6240\u4ee5\u957f\u5ea6\u662f5\n", "prefix": "string.trim"}, "sys.wait": {"body": "sys.wait(${1:timeout})", "description": "sys.wait(timeout) - Task\u534f\u7a0b\u7b49\u5f85\u6307\u5b9a\u65f6\u957f\n\u4f20\u5165\u503c\uff1a\nint \u7b49\u5f85\u65f6\u957f,\u5355\u4f4d\u6beb\u79d2,\u5fc5\u987b\u5927\u4e8e0,\u5426\u5219\u65e0\u6548\n\u8fd4\u56de\u503c\uff1a\nany \u901a\u5e38\u4e3anil,\u9664\u975e\u4e3b\u52a8\u88ab\u5524\u9192(\u901a\u5e38\u4e0d\u4f1a)\n\u4f8b\u5b50\uff1a\nsys.taskInit(function()\n while 1 do\n sys.wait(500)\n end\nend)\n", "prefix": "sys.wait"}, "sys.waitUntil": {"body": "sys.waitUntil(${1:topic},${2:timeout})", "description": "sys.waitUntil(topic, timeout) - Task\u534f\u7a0b\u7b49\u5f85\u6307\u5b9a\u65f6\u957f\u6216\u8005\u7279\u5b9a\u7684topic\n\u4f20\u5165\u503c\uff1a\nstring \u4e8b\u4ef6topic\nint \u7b49\u5f85\u65f6\u957f,\u5355\u4f4d\u6beb\u79d2,\u5fc5\u987b\u5927\u4e8e0,\u5426\u5219\u65e0\u6548\n\u8fd4\u56de\u503c\uff1a\nboolean \u5982\u679c\u662f\u8d85\u65f6,\u8fd4\u56defalse,\u5426\u5219\u8fd4\u56detrue\nany \u5bf9\u5e94topic\u7684\u5185\u5bb9\n\u4f8b\u5b50\uff1a\nsys.taskInit(function()\n // do something\n local result, data = sys.waitUntil(\"NET_READY\", 30000)\n // do something else\nend)\n", "prefix": "sys.waitUntil"}, "sys.taskInit": {"body": "sys.taskInit(${1:func},${2:arg1},${3:arg2},${4:argN})", "description": "sys.taskInit(func, arg1, arg2, argN) - \u521b\u5efa\u4e00\u4e2aTask\u534f\u7a0b\n\u4f20\u5165\u503c\uff1a\nfunction \u5f85\u6267\u884c\u7684\u51fd\u6570,\u53ef\u4ee5\u662f\u533f\u540d\u51fd\u6570, \u4e5f\u53ef\u4ee5\u662flocal\u6216\u5168\u5c40\u51fd\u6570\nany \u9700\u8981\u4f20\u9012\u7684\u53c2\u65701,\u53ef\u9009 \nany \u9700\u8981\u4f20\u9012\u7684\u53c2\u65702,\u53ef\u9009 \nany \u9700\u8981\u4f20\u9012\u7684\u53c2\u6570N,\u53ef\u9009 \n\u8fd4\u56de\u503c\uff1a\ntask \u534f\u7a0b\u5bf9\u8c61\n\u4f8b\u5b50\uff1a\nsys.taskInit(function(a, b, c)\n log.info(\"task\", a, b, c) -- \u6253\u5370 task A B C\nend, \"A\", \"B\", \"N\")\n", "prefix": "sys.taskInit"}, "sys.timerStart": {"body": "sys.timerStart(${1:func},${2:timeout},${3:arg1},${4:arg2},${5:argN})", "description": "sys.timerStart(func, timeout, arg1, arg2, argN) - \u521b\u5efa\u4e00\u4e2a\u5b9a\u65f6\u5668.\u975eTask,\u51fd\u6570\u91cc\u4e0d\u80fd\u76f4\u63a5sys.waitXXX\n\u4f20\u5165\u503c\uff1a\nfunction \u5f85\u6267\u884c\u7684\u51fd\u6570,\u53ef\u4ee5\u662f\u533f\u540d\u51fd\u6570, \u4e5f\u53ef\u4ee5\u662flocal\u6216\u5168\u5c40\u51fd\u6570\nint \u5ef6\u65f6\u65f6\u957f,\u5355\u4f4d\u6beb\u79d2\nany \u9700\u8981\u4f20\u9012\u7684\u53c2\u65701,\u53ef\u9009 \nany \u9700\u8981\u4f20\u9012\u7684\u53c2\u65702,\u53ef\u9009 \nany \u9700\u8981\u4f20\u9012\u7684\u53c2\u6570N,\u53ef\u9009 \n\u8fd4\u56de\u503c\uff1a\nint \u5b9a\u65f6\u5668id\n\u4f8b\u5b50\uff1a\nsys.timerStart(function(a, b, c)\n log.info(\"task\", a, b, c) -- 1000\u6beb\u79d2\u540e\u624d\u4f1a\u6267\u884c, \u6253\u5370 task A B C\nend, 1000, \"A\", \"B\", \"N\")\n", "prefix": "sys.timerStart"}, "sys.timerLoopStart": {"body": "sys.timerLoopStart(${1:func},${2:timeout},${3:arg1},${4:arg2},${5:argN})", "description": "sys.timerLoopStart(func, timeout, arg1, arg2, argN) - \u521b\u5efa\u4e00\u4e2a\u5faa\u73af\u5b9a\u65f6\u5668.\u975eTask,\u51fd\u6570\u91cc\u4e0d\u80fd\u76f4\u63a5sys.waitXXX\n\u4f20\u5165\u503c\uff1a\nfunction \u5f85\u6267\u884c\u7684\u51fd\u6570,\u53ef\u4ee5\u662f\u533f\u540d\u51fd\u6570, \u4e5f\u53ef\u4ee5\u662flocal\u6216\u5168\u5c40\u51fd\u6570\nint \u5ef6\u65f6\u65f6\u957f,\u5355\u4f4d\u6beb\u79d2\nany \u9700\u8981\u4f20\u9012\u7684\u53c2\u65701,\u53ef\u9009 \nany \u9700\u8981\u4f20\u9012\u7684\u53c2\u65702,\u53ef\u9009 \nany \u9700\u8981\u4f20\u9012\u7684\u53c2\u6570N,\u53ef\u9009 \n\u8fd4\u56de\u503c\uff1a\nint \u5b9a\u65f6\u5668id\n\u4f8b\u5b50\uff1a\nsys.timerLoopStart(function(a, b, c)\n log.info(\"task\", a, b, c) -- 1000\u6beb\u79d2\u540e\u624d\u4f1a\u6267\u884c, \u6253\u5370 task A B C\nend, 1000, \"A\", \"B\", \"N\")\n", "prefix": "sys.timerLoopStart"}, "sys.timerStop": {"body": "sys.timerStop(${1:id})", "description": "sys.timerStop(id) - \u5173\u95ed\u4e00\u4e2a\u5b9a\u65f6\u5668.\n\u4f20\u5165\u503c\uff1a\nint \u5b9a\u65f6\u5668id\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlocal tcount = 0\nlocal tid \ntid = sys.timerLoopStart(function(a, b, c)\n log.info(\"task\", a, b, c) -- 1000\u6beb\u79d2\u540e\u624d\u4f1a\u6267\u884c, \u6253\u5370 task A B C\n if tcount > 10 then\n sys.timerStop(tid)\n end\n tcount = tcount + 1\nend, 1000, \"A\", \"B\", \"N\")\n", "prefix": "sys.timerStop"}, "sys.timerStopAll": {"body": "sys.timerStopAll(${1:fnc})", "description": "sys.timerStopAll(fnc) - \u5173\u95ed\u540c\u4e00\u56de\u8c03\u51fd\u6570\u7684\u6240\u6709\u5b9a\u65f6\u5668.\n\u4f20\u5165\u503c\uff1a\nfunction fnc\u56de\u8c03\u7684\u51fd\u6570\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u5173\u95ed\u56de\u8c03\u51fd\u6570\u4e3apublicTimerCbFnc\u7684\u6240\u6709\u5b9a\u65f6\u5668\nlocal function publicTimerCbFnc(tag)\nlog.info(\"publicTimerCbFnc\",tag)\nend\nsys.timerStart(publicTimerCbFnc,8000,\"first\")\nsys.timerStart(publicTimerCbFnc,8000,\"second\")\nsys.timerStart(publicTimerCbFnc,8000,\"third\")\nsys.timerStopAll(publicTimerCbFnc)\n", "prefix": "sys.timerStopAll"}, "sys.publish": {"body": "sys.publish(${1:topic},${2:arg1},${3:agr2},${4:argN})", "description": "sys.publish(topic, arg1, agr2, argN) - \u5f80\u7279\u5b9atopic\u901a\u9053\u53d1\u5e03\u4e00\u4e2a\u6d88\u606f\n\u4f20\u5165\u503c\uff1a\nstring topic\u7684\u503c\nany \u9644\u5e26\u7684\u53c2\u65701\nany \u9644\u5e26\u7684\u53c2\u65702\nany \u9644\u5e26\u7684\u53c2\u6570N\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nsys.publish(\"BT_READY\", false)\n", "prefix": "sys.publish"}, "sys.subscribe": {"body": "sys.subscribe(${1:topic},${2:func})", "description": "sys.subscribe(topic, func) - \u8ba2\u9605\u4e00\u4e2atopic\u901a\u9053\n\u4f20\u5165\u503c\uff1a\nstring topic\u7684\u503c\nfunction \u56de\u8c03\u51fd\u6570, \u6ce8\u610f, \u4e0d\u80fd\u76f4\u63a5\u4f7f\u7528sys.waitXXX\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlocal function bt_cb(state)\n log.info(\"bt\", state)\nend\nsys.subscribe(\"BT_READY\", bt_cb)\nsys.subscribe(\"BT_READY\", function(state)\n log.info(\"sys\", \"Got BT_READY\", state)\nend)\n", "prefix": "sys.subscribe"}, "sys.unsubscribe": {"body": "sys.unsubscribe(${1:topic},${2:func})", "description": "sys.unsubscribe(topic, func) - \u53d6\u6d88\u8ba2\u9605topic\u901a\u9053\n\u4f20\u5165\u503c\uff1a\nstring topic\u7684\u503c\nfunction \u56de\u8c03\u51fd\u6570, \u6ce8\u610f, \u4e0d\u80fd\u76f4\u63a5\u4f7f\u7528sys.waitXXX\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlocal function bt_cb(state)\n log.info(\"bt\", state)\nend\nsys.unsubscribe(\"BT_READY\", bt_cb)\n", "prefix": "sys.unsubscribe"}, "sys.run": {"body": "sys.run()", "description": "sys.run() - sys\u5e93\u4e3b\u5faa\u73af\u65b9\u6cd5,\u4ec5\u5141\u8bb8\u5728main.lua\u7684\u672b\u5c3e\u8c03\u7528\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c. \u8fd9\u4e2a\u65b9\u6cd5\u51e0\u4e4e\u4e0d\u53ef\u80fd\u8fd4\u56de.\n\u4f8b\u5b50\uff1a\n-- \u603b\u662fmain.lua\u7684\u7ed3\u5c3e\u4e00\u53e5,\u5c06\u6765\u4e5f\u8bb8\u4f1a\u7b80\u5316\u6389\nsys.run()\n-- \u4e4b\u540e\u7684\u4ee3\u7801\u4e0d\u4f1a\u88ab\u6267\u884c\n", "prefix": "sys.run"}, "sysplus.waitMsg": {"body": "sysplus.waitMsg(${1:taskName},${2:target},${3:timeout})", "description": "sysplus.waitMsg(taskName, target, timeout) - \u7b49\u5f85\u63a5\u6536\u4e00\u4e2a\u76ee\u6807\u6d88\u606f\n\u4f20\u5165\u503c\uff1a\nstring \u4efb\u52a1\u540d\u79f0\uff0c\u7528\u4e8e\u5524\u9192\u4efb\u52a1\u7684id\nstring \u76ee\u6807\u6d88\u606f\uff0c\u5982\u679c\u4e3anil\uff0c\u5219\u8868\u793a\u63a5\u6536\u5230\u4efb\u610f\u6d88\u606f\u90fd\u4f1a\u9000\u51fa\nint \u8d85\u65f6\u65f6\u95f4\uff0c\u5982\u679c\u4e3anil\uff0c\u5219\u8868\u793a\u65e0\u8d85\u65f6\uff0c\u6c38\u8fdc\u7b49\u5f85\n\u8fd4\u56de\u503c\uff1a\ntable \u6210\u529f\u8fd4\u56detable\u578b\u7684msg\uff0c\u8d85\u65f6\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u7b49\u5f85\u4efb\u52a1\nsysplus.waitMsg('a', 'b', 1000)\n-- \u6ce8\u610f, \u672c\u51fd\u6570\u4f1a\u81ea\u52a8\u6ce8\u518c\u6210\u5168\u5c40\u51fd\u6570 sys_wait\n", "prefix": "sysplus.waitMsg"}, "sysplus.sendMsg": {"body": "sysplus.sendMsg(${1:taskName},${2:target},${3:arg2},${4:arg3},${5:arg4})", "description": "sysplus.sendMsg(taskName, target, arg2, arg3, arg4) - \u5411\u76ee\u6807\u4efb\u52a1\u53d1\u9001\u4e00\u4e2a\u6d88\u606f\n\u4f20\u5165\u503c\uff1a\nstring \u4efb\u52a1\u540d\u79f0\uff0c\u7528\u4e8e\u5524\u9192\u4efb\u52a1\u7684id\nany \u6d88\u606f\u4e2d\u7684\u53c2\u65701\uff0c\u540c\u65f6\u4e5f\u662fwaitMsg\u91cc\u7684target\nany \u6d88\u606f\u4e2d\u7684\u53c2\u65702\nany \u6d88\u606f\u4e2d\u7684\u53c2\u65703\nany \u6d88\u606f\u4e2d\u7684\u53c2\u65704\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue, \u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u5411\u4efb\u52a1a,\u76ee\u6807b\u53d1\u9001\u6d88\u606f\nsysplus.sendMsg('a', 'b')\n-- \u6ce8\u610f, \u672c\u51fd\u6570\u4f1a\u81ea\u52a8\u6ce8\u518c\u6210\u5168\u5c40\u51fd\u6570 sys_send\n", "prefix": "sysplus.sendMsg"}, "sysplus.taskInitEx": {"body": "sysplus.taskInitEx(${1:fun},${2:taskName},${3:cbFun},${4:...})", "description": "sysplus.taskInitEx(fun, taskName, cbFun, ...) - \u521b\u5efa\u4e00\u4e2a\u4efb\u52a1\u7ebf\u7a0b,\u5728\u6a21\u5757\u6700\u672b\u884c\u8c03\u7528\u8be5\u51fd\u6570\u5e76\u6ce8\u518c\u6a21\u5757\u4e2d\u7684\u4efb\u52a1\u51fd\u6570,main.lua\u5bfc\u5165\u8be5\u6a21\u5757\u5373\u53ef\n\u4f20\u5165\u503c\uff1a\nfunction \u4efb\u52a1\u51fd\u6570\u540d,\u7528\u4e8eresume\u5524\u9192\u65f6\u8c03\u7528\nstring \u4efb\u52a1\u540d\u79f0,\u7528\u4e8e\u5524\u9192\u4efb\u52a1\u7684id\nfunction \u63a5\u6536\u5230\u975e\u76ee\u6807\u6d88\u606f\u65f6\u7684\u56de\u8c03\u51fd\u6570\nany ... \u4efb\u52a1\u51fd\u6570fun\u7684\u53ef\u53d8\u53c2\u6570\n\u8fd4\u56de\u503c\uff1a\nnumber \u8fd4\u56de\u8be5\u4efb\u52a1\u7684\u7ebf\u7a0b\u53f7\n\u4f8b\u5b50\uff1a\nsysplus.taskInitEx(task1,'a',callback)\n", "prefix": "sysplus.taskInitEx"}, "sysplus.taskDel": {"body": "sysplus.taskDel(${1:taskName})", "description": "sysplus.taskDel(taskName) - \u5220\u9664\u7531taskInitEx\u521b\u5efa\u7684\u4efb\u52a1\u7ebf\u7a0b\n\u4f20\u5165\u503c\uff1a\nstring \u4efb\u52a1\u540d\u79f0,\u7528\u4e8e\u5524\u9192\u4efb\u52a1\u7684id\n\u4f8b\u5b50\uff1a\nsysplus.taskDel('a')\n", "prefix": "sysplus.taskDel"}, "sysplus.cleanMsg": {"body": "sysplus.cleanMsg(${1:taskName})", "description": "sysplus.cleanMsg(taskName) - \u6e05\u9664\u6307\u5b9atask\u7684\u6d88\u606f\u961f\u5217\n\u4f20\u5165\u503c\uff1a\nstring \u4efb\u52a1\u540d\u79f0\n\u4f8b\u5b50\uff1a\nsysplus.cleanMsg('a')\n", "prefix": "sysplus.cleanMsg"}, "timer.mdelay": {"body": "timer.mdelay(${1:timeout})", "description": "timer.mdelay(timeout) - \u786c\u963b\u585e\u6307\u5b9a\u65f6\u957f\n\u4f20\u5165\u503c\uff1a\nint \u963b\u585e\u65f6\u957f,\u5355\u4f4dms, \u6700\u9ad81024ms, \u5b9e\u9645\u4f7f\u7528\u5f3a\u70c8\u5efa\u8bae\u4e0d\u8981\u8d85\u8fc7200ms\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u671f\u95f4\u6ca1\u6709\u4efb\u4f55luat\u4ee3\u7801\u4f1a\u6267\u884c,\u5305\u62ec\u5e95\u5c42\u6d88\u606f\u5904\u7406\u673a\u5236\n-- \u672c\u65b9\u6cd5\u901a\u5e38\u4e0d\u4f1a\u4f7f\u7528,\u9664\u975e\u4f60\u5f88\u6e05\u695a\u4f1a\u53d1\u751f\u4ec0\u4e48\ntimer.mdelay(10)\n", "prefix": "timer.mdelay"}, "timer.udelay": {"body": "timer.udelay(${1:timeout})", "description": "timer.udelay(timeout) - \u786c\u963b\u585e\u6307\u5b9a\u65f6\u957f\u4f46us\u7ea7\u522b,\u4e0d\u4f1a\u5f88\u7cbe\u51c6\n\u4f20\u5165\u503c\uff1a\nint \u963b\u585e\u65f6\u957f,\u5355\u4f4dus, \u6700\u59273000us\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u672c\u65b9\u6cd5\u901a\u5e38\u4e0d\u4f1a\u4f7f\u7528,\u9664\u975e\u4f60\u5f88\u6e05\u695a\u4f1a\u53d1\u751f\u4ec0\u4e48\n-- \u672cAPI\u5728 2023.05.18 \u6dfb\u52a0\ntimer.udelay(10)\n-- \u5b9e\u9645\u963b\u585e\u65f6\u957f\u662f\u6709\u6ce2\u52a8\u7684\n", "prefix": "timer.udelay"}, "touchkey.setup": {"body": "touchkey.setup(${1:id},${2:scan_period},${3:window},${4:threshold})", "description": "touchkey.setup(id, scan_period, window, threshold) - \u914d\u7f6e\u89e6\u6478\u6309\u952e\n\u4f20\u5165\u503c\uff1a\nint \u4f20\u611f\u5668id,\u8bf7\u67e5\u9605\u786c\u4ef6\u6587\u6863, \u4f8b\u5982air101/air103\u652f\u6301 1~15, \u4f8b\u5982PA7\u5bf9\u5e94touch id=1\nint \u626b\u63cf\u95f4\u9694,\u8303\u56f41 ~ 0x3F, \u5355\u4f4d16ms,\u53ef\u9009\nint \u626b\u63cf\u7a97\u53e3,\u8303\u56f42-7, \u53ef\u9009\nint \u9600\u503c, \u8303\u56f40-127, \u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue, \u5931\u8d25\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\ntouchkey.setup(1)\nsys.subscribe(\"TOUCHKEY_INC\", function(id, count)\n -- \u4f20\u611f\u5668id\n -- \u8ba1\u6570\u5668,\u89e6\u6478\u6b21\u6570\u7edf\u8ba1\n log.info(\"touchkey\", id, count)\nend)\n", "prefix": "touchkey.setup"}, "touchkey.close": {"body": "touchkey.close(${1:id})", "description": "touchkey.close(id) - \u5173\u95ed\u521d\u59cb\u89e6\u6478\u6309\u952e\n\u4f20\u5165\u503c\uff1a\nint \u4f20\u611f\u5668id,\u8bf7\u67e5\u9605\u786c\u4ef6\u6587\u6863\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u4e0d\u592a\u53ef\u80fd\u9700\u8981\u5173\u6389\u7684\u6837\u5b50\ntouchkey.close(1)\n", "prefix": "touchkey.close"}, "u8g2.begin": {"body": "u8g2.begin(${1:conf})", "description": "u8g2.begin(conf) - u8g2\u663e\u793a\u5c4f\u521d\u59cb\u5316\n\u4f20\u5165\u503c\uff1a\ntable conf \u914d\u7f6e\u4fe1\u606f,\u8be6\u7ec6\u914d\u7f6e\u770b\u4e0b\u9762\u7684\u4f8b\u5b50\n\u8fd4\u56de\u503c\uff1a\nint \u6b63\u5e38\u521d\u59cb\u53161,\u5df2\u7ecf\u521d\u59cb\u5316\u8fc72,\u5185\u5b58\u4e0d\u591f3,\u521d\u59cb\u5316\u5931\u8d25\u8fd4\u56de4\n\u4f8b\u5b50\uff1a\n-- conf\u914d\u7f6e\u9879\u8bf4\u660e\n-- ic \u5b57\u7b26\u4e32,\u4e3b\u63a7\u82af\u7247\u7c7b\u578b, \u652f\u6301custom(\u81ea\u5b9a\u4e49\u547d\u4ee4) ssd1306(\u9ed8\u8ba4) ssd1309 ssd1322 sh1106 sh1107 sh1108 st7567 uc1701 ssd1306_128x32\n-- direction \u6570\u503c,\u65b9\u5411,\u53ef\u90090 90 180 270 \u9ed8\u8ba40\n-- mode \u5b57\u7b26\u4e32,\u6a21\u5f0f,\u53ef\u9009i2c_sw:\u8f6f\u4ef6i2c i2c_hw:\u786c\u4ef6i2c,spi_hw_4pin: \u786c\u4ef6spi\n-- i2c_id: \u6570\u503c,\u786c\u4ef6i2c\u65f6\u6709\u6548\n-- i2c_scl: \u6570\u503c,\u8f6f\u4ef6i2c\u65f6\u65f6\u949f\u7ebf\u7684GPIO\u7f16\u53f7\n-- i2c_sda: \u6570\u503c\u8f6f\u4ef6i2c\u65f6\u6570\u636e\u7ebf\u7684GPIO\u7f16\u53f7\n-- spi_id\u3001spi_res\u3001spi_dc\u3001spi_cs: \u6570\u503c,\u786c\u4ef6spi\u7684SPI\u7f16\u53f7,\u590d\u4f4dGPIO\u7f16\u53f7,DC\u7ebf\u7684GPIO\u7f16\u53f7, CS\u7ebf\u7684GPIO\u7f16\u53f7\n-- x_offset: \u6570\u503c,X\u8f74\u504f\u79fb\u91cf,\u9ed8\u8ba4\u6309\u9a71\u52a8\u8d70, 2023.11.10\u65b0\u589e\u7684\u914d\u7f6e\u9879\n\n-- \u521d\u59cb\u5316\u786c\u4ef6i2c\u7684ssd1306\nu8g2.begin({ic = \"ssd1306\",direction = 0,mode=\"i2c_hw\",i2c_id=0}) -- direction \u53ef\u90090 90 180 270\n-- \u521d\u59cb\u5316\u786c\u4ef6spi\u7684ssd1306\nu8g2.begin({ic = \"ssd1306\",direction = 0,mode=\"spi_hw_4pin\",spi_id=0,spi_res=pin.PB03,spi_dc=pin.PB01,spi_cs=pin.PB04}) -- direction \u53ef\u90090 90 180 270\n-- \u521d\u59cb\u5316\u8f6f\u4ef6i2c\u7684ssd1306\nu8g2.begin({ic = \"ssd1306\",direction = 0,mode=\"i2c_sw\", i2c_scl=1, i2c_sda=4}) -- \u901a\u8fc7PA1 SCL / PA4 SDA\u6a21\u62df\n", "prefix": "u8g2.begin"}, "u8g2.close": {"body": "u8g2.close()", "description": "u8g2.close() - \u5173\u95ed\u663e\u793a\u5c4f\n\u4f8b\u5b50\uff1a\n-- \u5173\u95eddisp,\u518d\u6b21\u4f7f\u7528disp\u76f8\u5173API\u7684\u8bdd,\u9700\u8981\u91cd\u65b0\u521d\u59cb\u5316\nu8g2.close()\n", "prefix": "u8g2.close"}, "u8g2.ClearBuffer": {"body": "u8g2.ClearBuffer()", "description": "u8g2.ClearBuffer() - \u6e05\u5c4f\uff0c\u6e05\u9664\u5185\u5b58\u5e27\u7f13\u51b2\u533a\u4e2d\u7684\u6240\u6709\u50cf\u7d20\n\u4f8b\u5b50\uff1a\n-- \u6e05\u5c4f\nu8g2.ClearBuffer()\n", "prefix": "u8g2.ClearBuffer"}, "u8g2.SendBuffer": {"body": "u8g2.SendBuffer()", "description": "u8g2.SendBuffer() - \u5c06\u6570\u636e\u66f4\u65b0\u5230\u5c4f\u5e55\uff0c\u5c06\u5b58\u50a8\u5668\u5e27\u7f13\u51b2\u533a\u7684\u5185\u5bb9\u53d1\u9001\u5230\u663e\u793a\u5668\n\u4f8b\u5b50\uff1a\n-- \u628a\u663e\u793a\u6570\u636e\u66f4\u65b0\u5230\u5c4f\u5e55\nu8g2.SendBuffer()\n", "prefix": "u8g2.SendBuffer"}, "u8g2.DrawUTF8": {"body": "u8g2.DrawUTF8(${1:str},${2:x},${3:y})", "description": "u8g2.DrawUTF8(str, x, y) - \u5728\u663e\u793a\u5c4f\u4e0a\u753b\u4e00\u6bb5\u6587\u5b57\uff0c\u5728\u663e\u793a\u5c4f\u4e0a\u753b\u4e00\u6bb5\u6587\u5b57,\u8981\u8c03\u7528u8g2.SendBuffer()\u624d\u4f1a\u66f4\u65b0\u5230\u5c4f \u6ce8\u610f:\u8bbe\u7f6e\u5750\u6807\u4e3a\u663e\u793a\u5b57\u7b26\u4e32\u5de6\u4e0b\u89d2\u5750\u6807\n\u4f20\u5165\u503c\uff1a\nstring \u6587\u4ef6\u5185\u5bb9\nint \u6a2a\u5750\u6807\nint \u7ad6\u5750\u6807\n\u4f8b\u5b50\uff1a\nu8g2.DrawUTF8(\"wifi is ready\", 10, 20)\n", "prefix": "u8g2.DrawUTF8"}, "u8g2.DrawButtonUTF8": {"body": "u8g2.DrawButtonUTF8(${1:str},${2:x},${3:y},${4:flags},${5:w},${6:h},${7:v},${8:str})", "description": "u8g2.DrawButtonUTF8(str, x, y, flags, w, h, v, str) - \u5728\u63d0\u4f9b\u7684\u6587\u672c\u5468\u56f4\u753b\u4e00\u4e2a\u6846\u3002\u8fd9\u4e0e DrawUTF8 \u7c7b\u4f3c\uff0c\u4f46\u4e3a\u6587\u672c\u6dfb\u52a0\u4e86\u4e00\u4e9b\u88c5\u9970\u3002\u8981\u8c03\u7528u8g2.SendBuffer()\u624d\u4f1a\u66f4\u65b0\u5230\u5c4f\u5e55 \u6ce8\u610f:\u8bbe\u7f6e\u5750\u6807\u4e3a\u663e\u793a\u5b57\u7b26\u4e32\u5de6\u4e0b\u89d2\u5750\u6807\n\u4f20\u5165\u503c\uff1a\nstring \u6587\u4ef6\u5185\u5bb9\nint \u6a2a\u5750\u6807\nint \u7ad6\u5750\u6807\nint \u6807\u5fd7 \u591a\u4e2a\u6807\u5fd7\u53ef\u4ee5\u4e0e\u201c\u6216\u201d\u8fd0\u7b97\u7b26\u4e00\u8d77\u4f7f\u7528\u3002\nint \u6587\u672c\u7684\u6700\u5c0f\u5bbd\u5ea6\u3002\u5982\u679c\u4e3a0\uff08\u6216\u4f4e\u4e8e\u6587\u672c\u5bbd\u5ea6\uff09\uff0c\u5219\u6587\u672c\u5bbd\u5ea6\u5c06\u7528\u4e8e\u6846\u67b6\u3002\nint \u6587\u672c\u524d\u540e\u7684\u989d\u5916\u7a7a\u95f4\u3002\nint \u6587\u672c\u4e0a\u4e0b\u7684\u989d\u5916\u7a7a\u95f4\u3002\n\u4f8b\u5b50\uff1a\nu8g2.DrawButtonUTF8(\"str\", 10, 20,u8g2.BTN_BW2,0,2,2)\n", "prefix": "u8g2.DrawButtonUTF8"}, "u8g2.SetFontMode": {"body": "u8g2.SetFontMode(${1:mode})", "description": "u8g2.SetFontMode(mode) - \u8bbe\u7f6e\u5b57\u4f53\u6a21\u5f0f\n\u4f20\u5165\u503c\uff1a\nint mode\u5b57\u4f53\u6a21\u5f0f\uff0c\u542f\u7528\uff081\uff09\u6216\u7981\u7528\uff080\uff09\u900f\u660e\u6a21\u5f0f\n\u4f8b\u5b50\uff1a\nu8g2.SetFontMode(1)\n", "prefix": "u8g2.SetFontMode"}, "u8g2.SetFont": {"body": "u8g2.SetFont(${1:font},${2:indentation})", "description": "u8g2.SetFont(font, indentation) - \u8bbe\u7f6e\u5b57\u4f53\n\u4f20\u5165\u503c\uff1a\nuserdata font, u8g2.font_opposansm8 \u4e3a\u7eaf\u82f1\u65878\u53f7\u5b57\u4f53,\u8fd8\u6709font_opposansm10 font_opposansm12 font_opposansm16 font_opposansm18 font_opposansm20 font_opposansm22 font_opposansm24 font_opposansm32 \u53ef\u9009 u8g2.font_opposansm12_chinese \u4e3a12x12\u5168\u4e2d\u6587,\u8fd8\u6709 font_opposansm16_chinese font_opposansm24_chinese font_opposansm32_chinese \u53ef\u9009, u8g2.font_unifont_t_symbols \u4e3a\u7b26\u53f7.\nint indentation, \u7b49\u5bbd\u5b57\u4f53ascii\u53f3\u4fa7\u7f29\u8fdb0~127\u4e2apixel\uff0c\u7b49\u5bbd\u5b57\u4f53\u7684ascii\u5b57\u7b26\u53ef\u80fd\u5728\u53f3\u4fa7\u6709\u5927\u7247\u7a7a\u767d\uff0c\u7528\u6237\u53ef\u4ee5\u9009\u62e9\u5220\u9664\u90e8\u5206\u3002\u7559\u7a7a\u6216\u8005\u8d85\u8fc7127\u5219\u76f4\u63a5\u5220\u9664\u53f3\u534a\u8fb9, \u975e\u7b49\u5bbd\u5b57\u4f53\u65e0\u6548\n\u4f8b\u5b50\uff1a\n-- \u8bbe\u7f6e\u4e3a\u4e2d\u6587\u5b57\u4f53,\u5bf9\u4e4b\u540e\u7684drawStr\u6709\u6548\nu8g2.SetFont(u8g2.font_opposansm12)\n", "prefix": "u8g2.SetFont"}, "u8g2.GetDisplayHeight": {"body": "u8g2.GetDisplayHeight()", "description": "u8g2.GetDisplayHeight() - \u83b7\u53d6\u663e\u793a\u5c4f\u9ad8\u5ea6\n\u8fd4\u56de\u503c\uff1a\nint \u663e\u793a\u5c4f\u9ad8\u5ea6\n\u4f8b\u5b50\uff1a\nu8g2.GetDisplayHeight()\n", "prefix": "u8g2.GetDisplayHeight"}, "u8g2.GetDisplayWidth": {"body": "u8g2.GetDisplayWidth()", "description": "u8g2.GetDisplayWidth() - \u83b7\u53d6\u663e\u793a\u5c4f\u5bbd\u5ea6\n\u8fd4\u56de\u503c\uff1a\nint \u663e\u793a\u5c4f\u5bbd\u5ea6\n\u4f8b\u5b50\uff1a\nu8g2.GetDisplayWidth()\n", "prefix": "u8g2.GetDisplayWidth"}, "u8g2.SetDrawColor": {"body": "u8g2.SetDrawColor(${1:c})", "description": "u8g2.SetDrawColor(c) - \u4e3a\u6240\u6709\u7ed8\u56fe\u529f\u80fd\u5206\u914d\u7ed8\u56fe\u989c\u8272\u3002\n\u4f20\u5165\u503c\uff1a\nint c\u4e3a\u989c\u8272\u503c 0\u6ca1\u6709\u8272 1\u6709\u8272 2\u4e0e\u5e95\u8272xor\n\u4f8b\u5b50\uff1a\nu8g2.SetDrawColor(0)\n", "prefix": "u8g2.SetDrawColor"}, "u8g2.DrawPixel": {"body": "u8g2.DrawPixel(${1:x},${2:y})", "description": "u8g2.DrawPixel(x,y) - \u753b\u4e00\u4e2a\u70b9.\n\u4f20\u5165\u503c\uff1a\nint X\u4f4d\u7f6e.\nint Y\u4f4d\u7f6e.\n\u4f8b\u5b50\uff1a\nu8g2.DrawPixel(20, 5)\n", "prefix": "u8g2.DrawPixel"}, "u8g2.DrawLine": {"body": "u8g2.DrawLine(${1:x0},${2:y0},${3:x1},${4:y1})", "description": "u8g2.DrawLine(x0,y0,x1,y1) - \u5728\u4e24\u70b9\u4e4b\u95f4\u753b\u4e00\u6761\u7ebf.\n\u4f20\u5165\u503c\uff1a\nint \u7b2c\u4e00\u4e2a\u70b9\u7684X\u4f4d\u7f6e.\nint \u7b2c\u4e00\u4e2a\u70b9\u7684Y\u4f4d\u7f6e.\nint \u7b2c\u4e8c\u4e2a\u70b9\u7684X\u4f4d\u7f6e.\nint \u7b2c\u4e8c\u4e2a\u70b9\u7684Y\u4f4d\u7f6e.\n\u4f8b\u5b50\uff1a\nu8g2.DrawLine(20, 5, 5, 32)\n", "prefix": "u8g2.DrawLine"}, "u8g2.DrawCircle": {"body": "u8g2.DrawCircle(${1:x0},${2:y0},${3:rad},${4:opt})", "description": "u8g2.DrawCircle(x0,y0,rad,opt) - \u5728x,y\u4f4d\u7f6e\u753b\u4e00\u4e2a\u534a\u5f84\u4e3arad\u7684\u7a7a\u5fc3\u5706.\n\u4f20\u5165\u503c\uff1a\nint \u5706\u5fc3\u4f4d\u7f6e\nint \u5706\u5fc3\u4f4d\u7f6e\nint \u5706\u534a\u5f84.\nint \u9009\u62e9\u5706\u7684\u90e8\u5206\u6216\u5168\u90e8. \u9ed8\u8ba4\u5168\u753b \u53ef\u9009 u8g2.DRAW_UPPER_RIGHT u8g2.DRAW_UPPER_LEFT u8g2.DRAW_LOWER_LEFT u8g2.DRAW_LOWER_RIGHT u8g2.DRAW_ALL\n\u4f8b\u5b50\uff1a\nu8g2.DrawCircle(60,30,8,u8g2.DRAW_ALL)\n", "prefix": "u8g2.DrawCircle"}, "u8g2.DrawDisc": {"body": "u8g2.DrawDisc(${1:x0},${2:y0},${3:rad},${4:opt})", "description": "u8g2.DrawDisc(x0,y0,rad,opt) - \u5728x,y\u4f4d\u7f6e\u753b\u4e00\u4e2a\u534a\u5f84\u4e3arad\u7684\u5b9e\u5fc3\u5706.\n\u4f20\u5165\u503c\uff1a\nint \u5706\u5fc3\u4f4d\u7f6e\nint \u5706\u5fc3\u4f4d\u7f6e\nint \u5706\u534a\u5f84.\nint \u9009\u62e9\u5706\u7684\u90e8\u5206\u6216\u5168\u90e8. \u9ed8\u8ba4\u5168\u753b \u53ef\u9009 u8g2.DRAW_UPPER_RIGHT u8g2.DRAW_UPPER_LEFT u8g2.DRAW_LOWER_LEFT u8g2.DRAW_LOWER_RIGHT u8g2.DRAW_ALL\n\u4f8b\u5b50\uff1a\nu8g2.DrawDisc(60,30,8,u8g2.DRAW_ALL)\n", "prefix": "u8g2.DrawDisc"}, "u8g2.DrawEllipse": {"body": "u8g2.DrawEllipse(${1:x0},${2:y0},${3:rx},${4:ry},${5:opt})", "description": "u8g2.DrawEllipse(x0,y0,rx,ry,opt) - \u5728x,y\u4f4d\u7f6e\u753b\u4e00\u4e2a\u534a\u5f84\u4e3arad\u7684\u7a7a\u5fc3\u692d\u5706.\n\u4f20\u5165\u503c\uff1a\nint \u5706\u5fc3\u4f4d\u7f6e\nint \u5706\u5fc3\u4f4d\u7f6e\nint \u692d\u5706\u5927\u5c0f\nint \u692d\u5706\u5927\u5c0f\nint \u9009\u62e9\u5706\u7684\u90e8\u5206\u6216\u5168\u90e8. \u9ed8\u8ba4\u5168\u753b \u53ef\u9009 u8g2.DRAW_UPPER_RIGHT u8g2.DRAW_UPPER_LEFT u8g2.DRAW_LOWER_LEFT u8g2.DRAW_LOWER_RIGHT u8g2.DRAW_ALL\n\u4f8b\u5b50\uff1a\nu8g2.DrawEllipse(60,30,8,u8g2.DRAW_ALL)\n", "prefix": "u8g2.DrawEllipse"}, "u8g2.DrawFilledEllipse": {"body": "u8g2.DrawFilledEllipse(${1:x0},${2:y0},${3:rx},${4:ry},${5:opt})", "description": "u8g2.DrawFilledEllipse(x0,y0,rx,ry,opt) - \u5728x,y\u4f4d\u7f6e\u753b\u4e00\u4e2a\u534a\u5f84\u4e3arad\u7684\u5b9e\u5fc3\u692d\u5706.\n\u4f20\u5165\u503c\uff1a\nint \u5706\u5fc3\u4f4d\u7f6e\nint \u5706\u5fc3\u4f4d\u7f6e\nint \u692d\u5706\u5927\u5c0f\nint \u692d\u5706\u5927\u5c0f\nint \u9009\u62e9\u5706\u7684\u90e8\u5206\u6216\u5168\u90e8. \u9ed8\u8ba4\u5168\u753b \u53ef\u9009 u8g2.DRAW_UPPER_RIGHT u8g2.DRAW_UPPER_LEFT u8g2.DRAW_LOWER_LEFT u8g2.DRAW_LOWER_RIGHT u8g2.DRAW_ALL\n\u4f8b\u5b50\uff1a\nu8g2.DrawFilledEllipse(60,30,8,15)\n", "prefix": "u8g2.DrawFilledEllipse"}, "u8g2.DrawBox": {"body": "u8g2.DrawBox(${1:x},${2:y},${3:w},${4:h})", "description": "u8g2.DrawBox(x,y,w,h) - \u4ecex / y\u4f4d\u7f6e\uff08\u5de6\u4e0a\u8fb9\u7f18\uff09\u5f00\u59cb\u7ed8\u5236\u4e00\u4e2a\u6846\uff08\u586b\u5145\u7684\u6846\uff09.\n\u4f20\u5165\u503c\uff1a\nint \u5de6\u4e0a\u8fb9\u7f18\u7684X\u4f4d\u7f6e\nint \u5de6\u4e0a\u8fb9\u7f18\u7684Y\u4f4d\u7f6e\nint \u76d2\u5b50\u7684\u5bbd\u5ea6\nint \u76d2\u5b50\u7684\u9ad8\u5ea6\n\u4f8b\u5b50\uff1a\nu8g2.DrawBox(3,7,25,15)\n", "prefix": "u8g2.DrawBox"}, "u8g2.DrawFrame": {"body": "u8g2.DrawFrame(${1:x},${2:y},${3:w},${4:h})", "description": "u8g2.DrawFrame(x,y,w,h) - \u4ecex / y\u4f4d\u7f6e\uff08\u5de6\u4e0a\u8fb9\u7f18\uff09\u5f00\u59cb\u7ed8\u5236\u4e00\u4e2a\u6846\uff08\u7a7a\u6846\uff09.\n\u4f20\u5165\u503c\uff1a\nint \u5de6\u4e0a\u8fb9\u7f18\u7684X\u4f4d\u7f6e\nint \u5de6\u4e0a\u8fb9\u7f18\u7684Y\u4f4d\u7f6e\nint \u76d2\u5b50\u7684\u5bbd\u5ea6\nint \u76d2\u5b50\u7684\u9ad8\u5ea6\n\u4f8b\u5b50\uff1a\nu8g2.DrawFrame(3,7,25,15)\n", "prefix": "u8g2.DrawFrame"}, "u8g2.DrawRBox": {"body": "u8g2.DrawRBox(${1:x},${2:y},${3:w},${4:h},${5:r})", "description": "u8g2.DrawRBox(x,y,w,h,r) - \u7ed8\u5236\u4e00\u4e2a\u4ecex / y\u4f4d\u7f6e\uff08\u5de6\u4e0a\u8fb9\u7f18\uff09\u5f00\u59cb\u5177\u6709\u5706\u5f62\u8fb9\u7f18\u7684\u586b\u5145\u6846/\u6846\u67b6.\n\u4f20\u5165\u503c\uff1a\nint \u5de6\u4e0a\u8fb9\u7f18\u7684X\u4f4d\u7f6e\nint \u5de6\u4e0a\u8fb9\u7f18\u7684Y\u4f4d\u7f6e\nint \u76d2\u5b50\u7684\u5bbd\u5ea6\nint \u76d2\u5b50\u7684\u9ad8\u5ea6\nint \u56db\u4e2a\u8fb9\u7f18\u7684\u534a\u5f84\n\u4f8b\u5b50\uff1a\nu8g2.DrawRBox(3,7,25,15)\n", "prefix": "u8g2.DrawRBox"}, "u8g2.DrawRFrame": {"body": "u8g2.DrawRFrame(${1:x},${2:y},${3:w},${4:h},${5:r})", "description": "u8g2.DrawRFrame(x,y,w,h,r) - \u7ed8\u5236\u4e00\u4e2a\u4ecex / y\u4f4d\u7f6e\uff08\u5de6\u4e0a\u8fb9\u7f18\uff09\u5f00\u59cb\u5177\u6709\u5706\u5f62\u8fb9\u7f18\u7684\u7a7a\u6846/\u6846\u67b6.\n\u4f20\u5165\u503c\uff1a\nint \u5de6\u4e0a\u8fb9\u7f18\u7684X\u4f4d\u7f6e\nint \u5de6\u4e0a\u8fb9\u7f18\u7684Y\u4f4d\u7f6e\nint \u76d2\u5b50\u7684\u5bbd\u5ea6\nint \u76d2\u5b50\u7684\u9ad8\u5ea6\nint \u56db\u4e2a\u8fb9\u7f18\u7684\u534a\u5f84\n\u4f8b\u5b50\uff1a\nu8g2.DrawRFrame(3,7,25,15)\n", "prefix": "u8g2.DrawRFrame"}, "u8g2.DrawGlyph": {"body": "u8g2.DrawGlyph(${1:x},${2:y},${3:encoding})", "description": "u8g2.DrawGlyph(x,y,encoding) - \u7ed8\u5236\u4e00\u4e2a\u56fe\u5f62\u5b57\u7b26\u3002\u5b57\u7b26\u653e\u7f6e\u5728\u6307\u5b9a\u7684\u50cf\u7d20\u4f4d\u7f6ex\u548cy.\n\u4f20\u5165\u503c\uff1a\nint \u5b57\u7b26\u5728\u663e\u793a\u5c4f\u4e0a\u7684\u4f4d\u7f6e\nint \u5b57\u7b26\u5728\u663e\u793a\u5c4f\u4e0a\u7684\u4f4d\u7f6e\nint \u5b57\u7b26\u7684Unicode\u503c\n\u4f8b\u5b50\uff1a\nu8g2.SetFont(u8g2_font_unifont_t_symbols)\nu8g2.DrawGlyph(5, 20, 0x2603) -- dec 9731/hex 2603 Snowman\n", "prefix": "u8g2.DrawGlyph"}, "u8g2.DrawTriangle": {"body": "u8g2.DrawTriangle(${1:x0},${2:y0},${3:x1},${4:y1},${5:x2},${6:y2})", "description": "u8g2.DrawTriangle(x0,y0,x1,y1,x2,y2) - \u7ed8\u5236\u4e00\u4e2a\u4e09\u89d2\u5f62\uff08\u5b9e\u5fc3\u591a\u8fb9\u5f62\uff09.\n\u4f20\u5165\u503c\uff1a\nint \u70b90X\u4f4d\u7f6e\nint \u70b90Y\u4f4d\u7f6e\nint \u70b91X\u4f4d\u7f6e\nint \u70b91Y\u4f4d\u7f6e\nint \u70b92X\u4f4d\u7f6e\nint \u70b92Y\u4f4d\u7f6e\n\u4f8b\u5b50\uff1a\nu8g2.DrawTriangle(20,5, 27,50, 5,32)\n", "prefix": "u8g2.DrawTriangle"}, "u8g2.SetBitmapMode": {"body": "u8g2.SetBitmapMode(${1:mode})", "description": "u8g2.SetBitmapMode(mode) - \u5b9a\u4e49\u4f4d\u56fe\u51fd\u6570\u662f\u5426\u5c06\u5199\u5165\u80cc\u666f\u8272\n\u4f20\u5165\u503c\uff1a\nint mode\u5b57\u4f53\u6a21\u5f0f\uff0c\u542f\u7528\uff081\uff09\u6216\u7981\u7528\uff080\uff09\u900f\u660e\u6a21\u5f0f\n\u4f8b\u5b50\uff1a\nu8g2.SetBitmapMode(1)\n", "prefix": "u8g2.SetBitmapMode"}, "u8g2.DrawXBM": {"body": "u8g2.DrawXBM(${1:x},${2:y},${3:w},${4:h},${5:data})", "description": "u8g2.DrawXBM(x, y, w, h, data) - \u7ed8\u5236\u4f4d\u56fe\n\u4f20\u5165\u503c\uff1a\nint X\u5750\u6807\nint y\u5750\u6807\nint \u4f4d\u56fe\u5bbd\nint \u4f4d\u56fe\u9ad8\nint \u4f4d\u56fe\u6570\u636e,\u6bcf\u4e00\u4f4d\u4ee3\u8868\u4e00\u4e2a\u50cf\u7d20\n\u4f8b\u5b50\uff1a\n-- \u53d6\u6a21\u4f7f\u7528PCtoLCD2002\u8f6f\u4ef6\u5373\u53ef\n-- \u5728(0,0)\u4e3a\u5de6\u4e0a\u89d2,\u7ed8\u5236 16x16 \"\u4eca\" \u7684\u4f4d\u56fe\nu8g2.DrawXBM(0, 0, 16,16, string.char(\n 0x80,0x00,0x80,0x00,0x40,0x01,0x20,0x02,0x10,0x04,0x48,0x08,0x84,0x10,0x83,0x60,\n 0x00,0x00,0xF8,0x0F,0x00,0x08,0x00,0x04,0x00,0x04,0x00,0x02,0x00,0x01,0x80,0x00\n))\n", "prefix": "u8g2.DrawXBM"}, "u8g2.DrawDrcode": {"body": "u8g2.DrawDrcode(${1:x},${2:y},${3:str},${4:size})", "description": "u8g2.DrawDrcode(x, y, str, size) - \u7f13\u51b2\u533a\u7ed8\u5236QRCode\n\u4f20\u5165\u503c\uff1a\nint x\u5750\u6807\nint y\u5750\u6807\nstring \u4e8c\u7ef4\u7801\u7684\u5185\u5bb9\nint \u663e\u793a\u5927\u5c0f (\u6ce8\u610f:\u4e8c\u7ef4\u7801\u751f\u6210\u5927\u5c0f\u4e0e\u8981\u663e\u793a\u5185\u5bb9\u548c\u7ea0\u9519\u7b49\u7ea7\u6709\u5173,\u751f\u6210\u7248\u672c\u4e3a1-40(\u5bf9\u5e94 21x21 - 177x177)\u7684\u4e0d\u5b9a\u5927\u5c0f,\u5982\u679c\u548c\u8bbe\u7f6e\u5927\u5c0f\u4e0d\u540c\u4f1a\u81ea\u52a8\u5728\u6307\u5b9a\u7684\u533a\u57df\u4e2d\u95f4\u663e\u793a\u4e8c\u7ef4\u7801,\u5982\u4e8c\u7ef4\u7801\u672a\u663e\u793a\u8bf7\u67e5\u770b\u65e5\u5fd7\u63d0\u793a)\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "u8g2.DrawDrcode"}, "u8g2.SetContrast": {"body": "u8g2.SetContrast(${1:contrast})", "description": "u8g2.SetContrast(contrast) - \u8c03\u6574\u5c4f\u5e55\u5bf9\u6bd4\u5ea6\n\u4f20\u5165\u503c\uff1a\nint \u5bf9\u6bd4\u5ea6\uff08\u53d6\u503c\u8303\u56f4\u4e0eIC\u6709\u5173\uff0c\u5982st7567\u4e3a0-63\uff09\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "u8g2.SetContrast"}, "u8g2.drawGtfontGb2312": {"body": "u8g2.drawGtfontGb2312(${1:str},${2:size},${3:x},${4:y})", "description": "u8g2.drawGtfontGb2312(str,size,x,y) - \u4f7f\u7528gtfont\u663e\u793agb2312\u5b57\u7b26\u4e32\n\u4f20\u5165\u503c\uff1a\nstring str \u663e\u793a\u5b57\u7b26\u4e32\nint size \u5b57\u4f53\u5927\u5c0f (\u652f\u630116-192\u53f7\u5927\u5c0f\u5b57\u4f53)\nint x \u6a2a\u5750\u6807\nint y \u7ad6\u5750\u6807\n\u4f8b\u5b50\uff1a\nu8g2.drawGtfontGb2312(\"\u554a\u554a\u554a\",32,0,0)\n", "prefix": "u8g2.drawGtfontGb2312"}, "u8g2.drawGtfontUtf8": {"body": "u8g2.drawGtfontUtf8(${1:str},${2:size},${3:x},${4:y})", "description": "u8g2.drawGtfontUtf8(str,size,x,y) - \u4f7f\u7528gtfont\u663e\u793aUTF8\u5b57\u7b26\u4e32\n\u4f20\u5165\u503c\uff1a\nstring str \u663e\u793a\u5b57\u7b26\u4e32\nint size \u5b57\u4f53\u5927\u5c0f (\u652f\u630116-192\u53f7\u5927\u5c0f\u5b57\u4f53)\nint x \u6a2a\u5750\u6807\nint y \u7ad6\u5750\u6807\n\u4f8b\u5b50\uff1a\nu8g2.drawGtfontUtf8(\"\u554a\u554a\u554a\",32,0,0)\n", "prefix": "u8g2.drawGtfontUtf8"}, "u8g2.CopyBuffer": {"body": "u8g2.CopyBuffer(${1:buff})", "description": "u8g2.CopyBuffer(buff) - \u83b7\u53d6\u5e95\u5c42\u56fe\u50cf\u7f13\u51b2\u533a\n\u4f20\u5165\u503c\uff1a\nuserdata zbuff\u5b9e\u4f8b,\u7a7a\u95f4\u8981\u5927\u4e8e\u7b49\u4e8e\u5e95\u5c42buff\u7684\u5927\u5c0f\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u8fd4\u56debuff\u5927\u5c0f,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5728u8g2\u521d\u59cb\u5316\u4e4b\u540e\u624d\u80fd\u8c03\u7528\n\n-- \u83b7\u53d6\u5927\u5c0f\nlocal sz = u8g2.CopyBuffer()\n\n-- \u62f7\u8d1d\u5e95\u5c42buff\nlocal buff = zbuff.create(sz)\nu8g2.CopyBuffer(buff)\n\n", "prefix": "u8g2.CopyBuffer"}, "u8g2.SetPowerSave": {"body": "u8g2.SetPowerSave(${1:is_enable})", "description": "u8g2.SetPowerSave(is_enable) - \u8bbe\u7f6e\u7701\u7535\u6a21\u5f0f\n\u4f20\u5165\u503c\uff1a\nboolean \u542f\u7528\u4e0e\u5426. true \u542f\u7528, false\u7981\u7528\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e2023.11.02\u65b0\u589e\n-- \u5f00\u542f\u7701\u7535\nu8g2.SetPowerSave(true)\n-- \u5173\u95ed\u7701\u7535\nu8g2.SetPowerSave(false)\n", "prefix": "u8g2.SetPowerSave"}, "uart.setup": {"body": "uart.setup(${1:id},${2:baud_rate},${3:data_bits},${4:stop_bits},${5:partiy},${6:bit_order},${7:buff_size},${8:rs485_gpio},${9:rs485_level},${10:rs485_delay},${11:debug_enable},${12:error_drop})", "description": "uart.setup(id, baud_rate, data_bits, stop_bits, partiy, bit_order, buff_size, rs485_gpio, rs485_level, rs485_delay, debug_enable, error_drop) - \u914d\u7f6e\u4e32\u53e3\u53c2\u6570\n\u4f20\u5165\u503c\uff1a\nint \u4e32\u53e3id, uart0\u51990, uart1\u51991, \u5982\u6b64\u7c7b\u63a8, \u6700\u5927\u503c\u53d6\u51b3\u4e8e\u8bbe\u5907\nint \u6ce2\u7279\u7387, \u9ed8\u8ba4115200\uff0c\u53ef\u9009\u62e9\u6ce2\u7279\u7387\u8868:{2000000,921600,460800,230400,115200,57600,38400,19200,9600,4800,2400}\nint \u6570\u636e\u4f4d\uff0c\u9ed8\u8ba4\u4e3a8, \u53ef\u9009 7/8\nint \u505c\u6b62\u4f4d\uff0c\u9ed8\u8ba4\u4e3a1, \u6839\u636e\u5b9e\u9645\u60c5\u51b5\uff0c\u53ef\u4ee5\u67090.5/1/1.5/2\u7b49\nint \u6821\u9a8c\u4f4d\uff0c\u53ef\u9009 uart.None/uart.Even/uart.Odd\nint \u5927\u5c0f\u7aef\uff0c\u9ed8\u8ba4\u5c0f\u7aef uart.LSB, \u53ef\u9009 uart.MSB\nint \u7f13\u51b2\u533a\u5927\u5c0f\uff0c\u9ed8\u8ba4\u503c1024\nint 485\u6a21\u5f0f\u4e0b\u7684\u8f6c\u6362GPIO, \u9ed8\u8ba4\u503c0xffffffff\nint 485\u6a21\u5f0f\u4e0b\u7684rx\u65b9\u5411GPIO\u7684\u7535\u5e73, \u9ed8\u8ba4\u503c0\nint 485\u6a21\u5f0f\u4e0btx\u5411rx\u8f6c\u6362\u7684\u5ef6\u8fdf\u65f6\u95f4\uff0c\u9ed8\u8ba4\u503c12bit\u7684\u65f6\u95f4\uff0c\u5355\u4f4dus, 9600\u6ce2\u7279\u7387\u586b20000\nint \u5f00\u542f\u8c03\u8bd5\u529f\u80fd\uff0c\u9ed8\u8ba4\u4f7f\u80fd\uff0c\u586b\u5199uart.DEBUG\u6216\u8005\u975e\u6570\u5b57\u4f7f\u80fd\uff0c\u5176\u4ed6\u503c\u90fd\u662f\u5173\u95ed\uff0c\u76ee\u524d\u53ea\u6709\u79fb\u82af\u5e73\u53f0\u652f\u6301\nint \u9047\u5230\u63a5\u6536\u9519\u8bef\u662f\u5426\u653e\u5f03\u7f13\u5b58\u6570\u636e\uff0c\u9ed8\u8ba4\u4f7f\u80fd\uff0c\u586b\u5199uart.ERROR_DROP\u6216\u8005\u975e\u6570\u5b57\u4f7f\u80fd\uff0c\u5176\u4ed6\u503c\u90fd\u662f\u5173\u95ed\uff0c\u76ee\u524d\u53ea\u6709\u79fb\u82af\u5e73\u53f0\u652f\u6301\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u8fd4\u56de0,\u5931\u8d25\u8fd4\u56de\u5176\u4ed6\u503c\n\u4f8b\u5b50\uff1a\n-- \u6700\u5e38\u7528115200 8N1\nuart.setup(1, 115200, 8, 1, uart.NONE)\n-- \u53ef\u4ee5\u7b80\u5199\u4e3a uart.setup(1)\n\n-- 485\u81ea\u52a8\u5207\u6362, \u9009\u53d6GPIO10\u4f5c\u4e3a\u6536\u53d1\u8f6c\u6362\u811a\nuart.setup(1, 115200, 8, 1, uart.NONE, uart.LSB, 1024, 10, 0, 2000)\n-- \u9047\u5230\u63a5\u6536\u9519\u8bef\u4e0d\u629b\u5f03\u7f13\u5b58\u6570\u636e\nuart.setup(1, 115200, 8, 1, uart.NONE, nil, 1024, nil, nil, nil, nil, 0)\n", "prefix": "uart.setup"}, "uart.write": {"body": "uart.write(${1:id},${2:data})", "description": "uart.write(id, data) - \u5199\u4e32\u53e3\n\u4f20\u5165\u503c\uff1a\nint \u4e32\u53e3id, uart0\u51990, uart1\u51991\nstring/zbuff \u5f85\u5199\u5165\u7684\u6570\u636e\uff0c\u5982\u679c\u662fzbuff\u4f1a\u4ece\u6307\u9488\u8d77\u59cb\u4f4d\u7f6e\u5f00\u59cb\u8bfb\nint \u53ef\u9009\uff0c\u8981\u53d1\u9001\u7684\u6570\u636e\u957f\u5ea6\uff0c\u9ed8\u8ba4\u5168\u53d1\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u7684\u6570\u636e\u957f\u5ea6\n\u4f8b\u5b50\uff1a\n-- \u5199\u5165\u53ef\u89c1\u5b57\u7b26\u4e32\nuart.write(1, \"rdy\\r\\n\")\n-- \u5199\u5165\u5341\u516d\u8fdb\u5236\u7684\u6570\u636e\u4e32\nuart.write(1, string.char(0x55,0xAA,0x4B,0x03,0x86))\n", "prefix": "uart.write"}, "uart.read": {"body": "uart.read(${1:id},${2:len})", "description": "uart.read(id, len) - \u8bfb\u4e32\u53e3\n\u4f20\u5165\u503c\uff1a\nint \u4e32\u53e3id, uart0\u51990, uart1\u51991\nint \u8bfb\u53d6\u957f\u5ea6\nfile/zbuff \u53ef\u9009\uff1a\u6587\u4ef6\u53e5\u67c4\u6216zbuff\u5bf9\u8c61\n\u8fd4\u56de\u503c\uff1a\nstring \u8bfb\u53d6\u5230\u7684\u6570\u636e / \u4f20\u5165zbuff\u65f6\uff0c\u8fd4\u56de\u8bfb\u5230\u7684\u957f\u5ea6\uff0c\u5e76\u628azbuff\u6307\u9488\u540e\u79fb\n\u4f8b\u5b50\uff1a\nuart.read(1, 16)\n", "prefix": "uart.read"}, "uart.close": {"body": "uart.close(${1:id})", "description": "uart.close(id) - \u5173\u95ed\u4e32\u53e3\n\u4f20\u5165\u503c\uff1a\nint \u4e32\u53e3id, uart0\u51990, uart1\u51991\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nuart.close(1)\n", "prefix": "uart.close"}, "uart.on": {"body": "uart.on(${1:id},${2:event},${3:func})", "description": "uart.on(id, event, func) - \u6ce8\u518c\u4e32\u53e3\u4e8b\u4ef6\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nint \u4e32\u53e3id, uart0\u51990, uart1\u51991\nstring \u4e8b\u4ef6\u540d\u79f0\nfunction \u56de\u8c03\u65b9\u6cd5\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nuart.on(1, \"receive\", function(id, len)\n local data = uart.read(id, len)\n log.info(\"uart\", id, len, data)\nend)\n", "prefix": "uart.on"}, "uart.wait485": {"body": "uart.wait485(${1:id})", "description": "uart.wait485(id) - \u7b49\u5f85485\u6a21\u5f0f\u4e0bTX\u5b8c\u6210\uff0cmcu\u4e0d\u652f\u6301\u4e32\u53e3\u53d1\u9001\u79fb\u4f4d\u5bc4\u5b58\u5668\u7a7a\u6216\u8005\u7c7b\u4f3c\u4e2d\u65ad\u65f6\u624d\u9700\u8981\uff0c\u5728sent\u4e8b\u4ef6\u56de\u8c03\u540e\u4f7f\u7528\n\u4f20\u5165\u503c\uff1a\nint \u4e32\u53e3id, uart0\u51990, uart1\u51991\n\u8fd4\u56de\u503c\uff1a\nint \u7b49\u5f85\u4e86\u591a\u5c11\u6b21\u5faa\u73af\u624d\u7b49\u5230tx\u5b8c\u6210\uff0c\u7528\u4e8e\u7c97\u52a3\u7684\u89c2\u5bdfdelay\u65f6\u95f4\u662f\u5426\u8db3\u591f\uff0c\u8fd4\u56de\u4e0d\u4e3a0\u8bf4\u660e\u8fd8\u9700\u8981\u653e\u5927delay\n", "prefix": "uart.wait485"}, "uart.exist": {"body": "uart.exist(${1:id})", "description": "uart.exist(id) - \u68c0\u67e5\u4e32\u53e3\u53f7\u662f\u5426\u5b58\u5728\n\u4f20\u5165\u503c\uff1a\nint \u4e32\u53e3id, uart0\u51990, uart1\u51991, \u5982\u6b64\u7c7b\u63a8\n\u8fd4\u56de\u503c\uff1a\nbool \u5b58\u5728\u8fd4\u56detrue\n", "prefix": "uart.exist"}, "uart.rx": {"body": "uart.rx(${1:id},${2:buff})", "description": "uart.rx(id, buff) - buff\u5f62\u5f0f\u8bfb\u4e32\u53e3\uff0c\u4e00\u6b21\u8bfb\u51fa\u5168\u90e8\u6570\u636e\u5b58\u5165buff\u4e2d\uff0c\u5982\u679cbuff\u7a7a\u95f4\u4e0d\u591f\u4f1a\u81ea\u52a8\u6269\u5c55\uff0c\u76ee\u524dair105,air780e\u652f\u6301\u8fd9\u4e2a\u64cd\u4f5c\n\u4f20\u5165\u503c\uff1a\nint \u4e32\u53e3id, uart0\u51990, uart1\u51991\nzbuff zbuff\u5bf9\u8c61\n\u8fd4\u56de\u503c\uff1a\nint \u8fd4\u56de\u8bfb\u5230\u7684\u957f\u5ea6\uff0c\u5e76\u628azbuff\u6307\u9488\u540e\u79fb\n\u4f8b\u5b50\uff1a\nuart.rx(1, buff)\n", "prefix": "uart.rx"}, "uart.rxSize": {"body": "uart.rxSize(${1:id})", "description": "uart.rxSize(id) - \u8bfb\u4e32\u53e3Rx\u7f13\u5b58\u4e2d\u5269\u4f59\u6570\u636e\u91cf\uff0c\u76ee\u524dair105,air780e\u652f\u6301\u8fd9\u4e2a\u64cd\u4f5c\n\u4f20\u5165\u503c\uff1a\nint \u4e32\u53e3id, uart0\u51990, uart1\u51991\n\u8fd4\u56de\u503c\uff1a\nint \u8fd4\u56de\u8bfb\u5230\u7684\u957f\u5ea6\n\u4f8b\u5b50\uff1a\nlocal size = uart.rxSize(1)\n", "prefix": "uart.rxSize"}, "uart.rxClear": {"body": "uart.rxClear(${1:id})", "description": "uart.rxClear(id) - \u6e05\u9664\u4e32\u53e3Rx\u7f13\u5b58\u4e2d\u5269\u4f59\u6570\u636e\u91cf\uff0c\u76ee\u524dair105,air780e\u652f\u6301\u8fd9\u4e2a\u64cd\u4f5c\n\u4f20\u5165\u503c\uff1a\nint \u4e32\u53e3id, uart0\u51990, uart1\u51991\n\u4f8b\u5b50\uff1a\nuart.rxClear(1)\n", "prefix": "uart.rxClear"}, "uart.tx": {"body": "uart.tx(${1:id},${2:buff},${3:start},${4:len})", "description": "uart.tx(id, buff, start, len) - buff\u5f62\u5f0f\u5199\u4e32\u53e3,\u7b49\u540c\u4e8ec\u8bed\u8a00uart_tx(uart_id, &buff[start], len);\n\u4f20\u5165\u503c\uff1a\nint \u4e32\u53e3id, uart0\u51990, uart1\u51991\nzbuff \u5f85\u5199\u5165\u7684\u6570\u636e\uff0c\u5982\u679c\u662fzbuff\u4f1a\u4ece\u6307\u9488\u8d77\u59cb\u4f4d\u7f6e\u5f00\u59cb\u8bfb\nint \u53ef\u9009\uff0c\u8981\u53d1\u9001\u7684\u6570\u636e\u8d77\u59cb\u4f4d\u7f6e\uff0c\u9ed8\u8ba4\u4e3a0\nint \u53ef\u9009\uff0c\u8981\u53d1\u9001\u7684\u6570\u636e\u957f\u5ea6\uff0c\u9ed8\u8ba4\u4e3azbuff\u5185\u6709\u6548\u6570\u636e\uff0c\u6700\u5927\u503c\u4e0d\u8d85\u8fc7zbuff\u7684\u6700\u5927\u7a7a\u95f4\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u7684\u6570\u636e\u957f\u5ea6\n\u4f8b\u5b50\uff1a\nuart.tx(1, buf)\n", "prefix": "uart.tx"}, "uart.createSoft": {"body": "uart.createSoft(${1:tx_pin},${2:tx_hwtimer_id},${3:rx_pin},${4:rx_hwtimer_id},${5:adjust_period})", "description": "uart.createSoft(tx_pin, tx_hwtimer_id, rx_pin, rx_hwtimer_id, adjust_period) - \u8bbe\u7f6e\u8f6f\u4ef6uart\u7684\u786c\u4ef6\u914d\u7f6e\uff0c\u53ea\u6709\u652f\u6301\u786c\u4ef6\u5b9a\u65f6\u5668\u7684SOC\u624d\u80fd\u4f7f\u7528\uff0c\u76ee\u524d\u53ea\u80fd\u8bbe\u7f6e\u4e00\u4e2a\uff0c\u6ce2\u7279\u7387\u6839\u636e\u5e73\u53f0\u7684\u8f6f\u786c\u4ef6\u914d\u7f6e\u6709\u4e0d\u540c\u7684\u6781\u9650\uff0c\u5efa\u8bae9600\uff0c\u63a5\u6536\u7f13\u5b58\u4e0d\u8d85\u8fc765535\uff0c\u4e0d\u652f\u6301MSB\uff0c\u652f\u6301485\u81ea\u52a8\u63a7\u5236\u3002\u540e\u7eed\u4ecd\u8981setup\u64cd\u4f5c\n\u4f20\u5165\u503c\uff1a\nint \u53d1\u9001\u5f15\u811a\u7f16\u53f7\nint \u53d1\u9001\u7528\u7684\u786c\u4ef6\u5b9a\u65f6\u5668ID\nint \u63a5\u6536\u5f15\u811a\u7f16\u53f7\nint \u63a5\u6536\u7528\u7684\u786c\u4ef6\u5b9a\u65f6\u5668ID\nint \u53d1\u9001\u65f6\u5e8f\u8c03\u6574\uff0c\u5355\u4f4d\u662f\u5b9a\u65f6\u5668\u65f6\u949f\u5468\u671f\uff0c\u9ed8\u8ba4\u662f0\uff0c\u9700\u8981\u6839\u636e\u793a\u6ce2\u5668\u6216\u8005\u903b\u8f91\u5206\u6790\u4eea\u8fdb\u884c\u5fae\u8c03\nint \u63a5\u6536\u65f6\u5e8f\u8c03\u6574\uff0c\u5355\u4f4d\u662f\u5b9a\u65f6\u5668\u65f6\u949f\u5468\u671f\uff0c\u9ed8\u8ba4\u662f0\uff0c\u9700\u8981\u6839\u636e\u793a\u6ce2\u5668\u6216\u8005\u903b\u8f91\u5206\u6790\u4eea\u8fdb\u884c\u5fae\u8c03\n\u8fd4\u56de\u503c\uff1a\nint \u8f6f\u4ef6uart\u7684id\uff0c\u5982\u679c\u5931\u8d25\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316\u8f6f\u4ef6uart\nlocal uart_id = uart.createSoft(21, 0, 1, 2) --air780e\u5efa\u8bae\u7528\u5b9a\u65f6\u56680\u548c2\uff0ctx_pin\u6700\u597d\u7528AGPIO\uff0c\u9632\u6b62\u4f11\u7720\u65f6\u8bef\u89e6\u53d1\u5bf9\u7aefRX\n", "prefix": "uart.createSoft"}, "uart.list": {"body": "uart.list(${1:max})", "description": "uart.list(max) - \u83b7\u53d6\u53ef\u7528\u4e32\u53e3\u53f7\u5217\u8868\uff0c\u5f53\u524d\u4ec5\u9650win32\n\u4f20\u5165\u503c\uff1a\nint \u53ef\u9009\uff0c\u9ed8\u8ba4256\uff0c\u6700\u591a\u83b7\u53d6\u591a\u5c11\u4e2a\u4e32\u53e3\n\u8fd4\u56de\u503c\uff1a\ntable \u83b7\u53d6\u5230\u7684\u53ef\u7528\u4e32\u53e3\u53f7\u5217\u8868\n", "prefix": "uart.list"}, "ulwip.setup": {"body": "ulwip.setup(${1:adapter_index},${2:mac},${3:output_lua_ref},${4:opts})", "description": "ulwip.setup(adapter_index, mac, output_lua_ref, opts) - \u521d\u59cb\u5316lwip netif\n\u4f20\u5165\u503c\uff1a\nint adapter_index \u9002\u914d\u5668\u7f16\u53f7\nstring mac \u7f51\u5361mac\u5730\u5740\nfunction output_lua_ref \u56de\u8c03\u51fd\u6570, \u53c2\u6570\u4e3a(adapter_index, data)\ntable \u989d\u5916\u53c2\u6570, \u4f8b\u5982 {mtu=1500, flags=(ulwip.FLAG_BROADCAST | ulwip.FLAG_ETHARP)}\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316\u4e00\u4e2a\u9002\u914d\u5668, \u5e76\u8bbe\u7f6e\u56de\u8c03\u51fd\u6570\nulwip.setup(socket.LWIP_STA, string.fromHex(\"18fe34a27b69\"), function(adapter_index, data)\n log.info(\"ulwip\", \"output_lua_ref\", adapter_index, data:toHex())\nend)\n-- \u6ce8\u610f, setup\u4e4b\u540e, netif\u7684\u72b6\u6001\u662fdown, \u8c03\u7528ulwip.updown(adapter_index, true)\u540e, \u624d\u80fd\u6b63\u5e38\u6536\u53d1\u6570\u636e\n\n-- \u989d\u5916\u53c2\u6570\u914d\u7f6etable\u53ef\u9009\u503c\n-- mtu, \u9ed8\u8ba41460\n-- flags, \u9ed8\u8ba4 ulwip.FLAG_BROADCAST | ulwip.FLAG_ETHARP | ulwip.FLAG_ETHERNET | ulwip.FLAG_IGMP | ulwip.FLAG_MLD6\n-- zbuff_out \u56de\u8c03\u51fd\u6570\u63a5\u53d7zbuff\u4f5c\u4e3a\u53c2\u6570, \u9ed8\u8ba4false\n-- reverse \u672c\u5730lwip\u8bbe\u5907,\u7ffb\u8f6c\u8c03\u7528\u903b\u8f91, \u9ed8\u8ba4false, \u8fd9\u4e2a\u53c2\u6570\u662f\u4e3a\u4e86\u62e6\u622a\u5f53\u524d\u8bbe\u5907\u7684\u786c\u4ef6\u8054\u7f51\u6570\u636e\u6240\u8bbe\u8ba1\u7684\n", "prefix": "ulwip.setup"}, "ulwip.updown": {"body": "ulwip.updown(${1:adapter_index},${2:up})", "description": "ulwip.updown(adapter_index, up) - \u8bbe\u7f6enetif\u7684\u72b6\u6001\n\u4f20\u5165\u503c\uff1a\nint adapter_index \u9002\u914d\u5668\u7f16\u53f7\nboolean up true\u4e3aup, false\u4e3adown\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003ulwip.setup\n", "prefix": "ulwip.updown"}, "ulwip.link": {"body": "ulwip.link(${1:adapter_index},${2:up})", "description": "ulwip.link(adapter_index, up) - \u8bbe\u7f6enetif\u7684\u7269\u7406\u94fe\u8def\u72b6\u6001\n\u4f20\u5165\u503c\uff1a\nint adapter_index \u9002\u914d\u5668\u7f16\u53f7\nboolean up true\u4e3aup, false\u4e3adown\n\u8fd4\u56de\u503c\uff1a\nboolean \u5f53\u524d\u72b6\u6001\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003ulwip.setup\n", "prefix": "ulwip.link"}, "ulwip.input": {"body": "ulwip.input(${1:adapter_index},${2:data},${3:len},${4:offset})", "description": "ulwip.input(adapter_index, data, len, offset) - \u5f80netif\u8f93\u5165\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint adapter_index \u9002\u914d\u5668\u7f16\u53f7\nstring/userdata data \u8f93\u5165\u7684\u6570\u636e\nint \u5982\u679cdata\u662fzbuff, len\u9ed8\u8ba4\u662fzbuff\u7684used, \u5bf9string\u65e0\u6548\nint \u5982\u679cdata\u662fzbuff, offset\u4e3a\u6570\u636e\u8d77\u59cb\u4f4d\u7f6e, \u9ed8\u8ba4\u662f0, \u5bf9string\u65e0\u6548\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003ulwip.setup\n", "prefix": "ulwip.input"}, "ulwip.dhcp": {"body": "ulwip.dhcp(${1:adapter_index},${2:up})", "description": "ulwip.dhcp(adapter_index, up) - \u542f\u52a8\u6216\u5173\u95eddhcp\n\u4f20\u5165\u503c\uff1a\nint adapter_index \u9002\u914d\u5668\u7f16\u53f7\nboolean up true\u4e3a\u542f\u52a8, false\u4e3a\u5173\u95ed\n\u8fd4\u56de\u503c\uff1a\nboolean \u5f53\u524d\u72b6\u6001\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003ulwip.setup\n", "prefix": "ulwip.dhcp"}, "ulwip.ip": {"body": "ulwip.ip(${1:adapter_index},${2:ip},${3:netmask},${4:gw})", "description": "ulwip.ip(adapter_index, ip, netmask, gw) - \u8bbe\u7f6e\u6216\u83b7\u53d6ip\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nint adapter_index \u9002\u914d\u5668\u7f16\u53f7\nstring ip IP\u5730\u5740, \u4ec5\u83b7\u53d6\u65f6\u53ef\u4ee5\u4e0d\u586b\nstring netmask \u5b50\u7f51\u63a9\u7801, \u4ec5\u83b7\u53d6\u65f6\u53ef\u4ee5\u4e0d\u586b\nstring gw \u7f51\u5173\u5730\u5740, \u4ec5\u83b7\u53d6\u65f6\u53ef\u4ee5\u4e0d\u586b\n\u8fd4\u56de\u503c\uff1a\nstring ip\u5730\u5740, \u5b50\u7f51\u63a9\u7801, \u7f51\u5173\u5730\u5740\n\u4f8b\u5b50\uff1a\n-- \u83b7\u53d6\u73b0\u6709\u503c\nlocal ip, netmask, gw = ulwip.ip(socket.LWIP_STA)\n-- \u8bbe\u7f6e\u65b0\u503c\nulwip.ip(socket.LWIP_STA, \"192.168.0.1\", \"255.255.255.0\", \"192.168.0.1\")\n", "prefix": "ulwip.ip"}, "ulwip.reg": {"body": "ulwip.reg(${1:adapter_index})", "description": "ulwip.reg(adapter_index) - \u5c06netif\u6ce8\u518c\u5230luatos socket\u4e2d\n\u4f20\u5165\u503c\uff1a\nint adapter_index \u9002\u914d\u5668\u7f16\u53f7\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003ulwip.setup\n", "prefix": "ulwip.reg"}, "ulwip.xt804_xfer": {"body": "ulwip.xt804_xfer(${1:spi_id},${2:cs_pin},${3:addr},${4:zbuff},${5:len},${6:offset},${7:auto_seek},${8:auto_len})", "description": "ulwip.xt804_xfer(spi_id, cs_pin, addr, zbuff, len, offset, auto_seek, auto_len) - \u64cd\u4f5cXT804\u8fdb\u884cSPI\u5feb\u901f\u6536\u53d1\n\u4f20\u5165\u503c\uff1a\nint spi_id SPI\u7684ID\u53f7\nint cs_pin CS\u811a\u7684GPIO\u53f7\nint addr \u5bc4\u5b58\u5668\u5730\u5740\nzbuff zbuff\u5bf9\u8c61\nint len \u957f\u5ea6\nint offset \u504f\u79fb\u91cf, \u9ed8\u8ba4buff:used()\nboolean auto_seek \u662f\u5426\u81ea\u52a8\u79fb\u52a8\u504f\u79fb\u91cf, \u9ed8\u8ba4false\nint auto_len \u81ea\u52a8\u5206\u7247\u957f\u5ea6, \u9ed8\u8ba4\u6309\u5bc4\u5b58\u5668\u81ea\u52a8\u9009\u62e9\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5c5e\u4e8e\u8f85\u52a9\u51fd\u6570\n", "prefix": "ulwip.xt804_xfer"}, "usbapp.set_id": {"body": "usbapp.set_id(${1:id},${2:vid},${3:pid})", "description": "usbapp.set_id(id, vid, pid) - USB \u8bbe\u7f6eVID\u548cPID\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id,\u9ed8\u8ba4\u4e3a0\nint vid \u5c0f\u7aef\u683c\u5f0f\nint pid \u5c0f\u7aef\u683c\u5f0f\n\u4f8b\u5b50\uff1a\nusbapp.set_id(0, 0x1234, 0x5678)\n", "prefix": "usbapp.set_id"}, "usbapp.hid_mode": {"body": "usbapp.hid_mode(${1:id},${2:mode},${3:buff_size})", "description": "usbapp.hid_mode(id, mode, buff_size) - USB HID\u8bbe\u5907\u6a21\u5f0f\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id,\u9ed8\u8ba4\u4e3a0\nint mode\uff0c\u76ee\u524d0\u662f\u952e\u76d8\uff0c1\u662f\u81ea\u5b9a\u4e49\nint buff_size\uff0c\u53ea\u80fd\u662f8,16,32,64\uff0c\u5982\u679c\u662f\u952e\u76d8\u6a21\u5f0f\u6216\u8005\u586b\u4e86\u5176\u4ed6\u503c\uff0c\u81ea\u52a8\u4e3a8\n\u4f8b\u5b50\uff1a\nusbapp.hid_mode(0, 0) -- usb hid\u952e\u76d8\u6a21\u5f0f\nusbapp.hid_mode(0, 1) -- usb hid\u81ea\u5b9a\u4e49\u6a21\u5f0f\uff0c\u7528\u4e8e\u514d\u9a71USB\u4ea4\u4e92\n", "prefix": "usbapp.hid_mode"}, "usbapp.start": {"body": "usbapp.start(${1:id})", "description": "usbapp.start(id) - \u542f\u52a8USB\u8bbe\u5907\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id,\u9ed8\u8ba4\u4e3a0\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u542f\u52a8USB\nusbapp.start(0)\n", "prefix": "usbapp.start"}, "usbapp.stop": {"body": "usbapp.stop(${1:id})", "description": "usbapp.stop(id) - \u5173\u95edUSB\u8bbe\u5907\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id,\u9ed8\u8ba4\u4e3a0\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u5173\u95edUSB\nusbapp.stop(0)\n", "prefix": "usbapp.stop"}, "usbapp.vhid_upload": {"body": "usbapp.vhid_upload(${1:id},${2:data})", "description": "usbapp.vhid_upload(id, data) - USB HID\u8bbe\u5907\u4e0a\u4f20\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id,\u9ed8\u8ba4\u4e3a0\nstring \u6570\u636e. \u6ce8\u610f, HID\u7684\u53ef\u7528\u5b57\u7b26\u662f\u6709\u9650\u5236\u7684, \u57fa\u672c\u4e0a\u53ea\u6709\u53ef\u89c1\u5b57\u7b26\u662f\u652f\u6301\u7684, \u4e0d\u652f\u6301\u7684\u5b57\u7b26\u4f1a\u66ff\u6362\u4e3a\u7a7a\u683c.\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- HID\u4e0a\u4f20\u6570\u636e\nusbapp.vhid_upload(0, \"1234\") -- usb hid\u4f1a\u6a21\u62df\u6572\u51fa1234\n", "prefix": "usbapp.vhid_upload"}, "usbapp.hid_tx": {"body": "usbapp.hid_tx(${1:id},${2:data},${3:start},${4:len})", "description": "usbapp.hid_tx(id, data, start, len) - USB HID\u8bbe\u5907\u4e0a\u4f20\u7528\u6237\u81ea\u5b9a\u4e49\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id,\u9ed8\u8ba4\u4e3a0\nstring or zbuff \u6ce8\u610f\u6570\u636e\u91cf\u4e0d\u8db3\u65f6\u4f1a\u81ea\u52a8\u586b\u51450\nint \u53ef\u9009\uff0cdata\u4e3azbuff\u624d\u6709\u6548\uff0c\u8981\u53d1\u9001\u7684\u6570\u636e\u8d77\u59cb\u4f4d\u7f6e\uff0c\u9ed8\u8ba4\u4e3a0\nint \u53ef\u9009\uff0cdata\u4e3azbuff\u624d\u6709\u6548\uff0c\u8981\u53d1\u9001\u7684\u6570\u636e\u957f\u5ea6\uff0c\u9ed8\u8ba4\u4e3azbuff\u5185\u6709\u6548\u6570\u636e\uff0c\u6700\u5927\u503c\u4e0d\u8d85\u8fc7zbuff\u7684\u6700\u5927\u7a7a\u95f4\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- HID\u4e0a\u4f20\u6570\u636e\nusbapp.hid_tx(0, \"1234\") -- usb hid\u4e0a\u4f200x31 0x32 0x33 0x34 + N\u4e2a0\n", "prefix": "usbapp.hid_tx"}, "usbapp.hid_rx": {"body": "usbapp.hid_rx(${1:id},${2:buff})", "description": "usbapp.hid_rx(id, buff) - buff\u5f62\u5f0f\u8bfb\u63a5\u6536\u5230\u7684\u6570\u636e\uff0c\u4e00\u6b21\u8bfb\u51fa\u5168\u90e8\u6570\u636e\u5b58\u5165buff\u4e2d\uff0c\u5982\u679cbuff\u7a7a\u95f4\u4e0d\u591f\u4f1a\u81ea\u52a8\u6269\u5c55\uff0c\u76ee\u524d\u53ea\u6709air105\u652f\u6301\u8fd9\u4e2a\u64cd\u4f5c\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id,\u9ed8\u8ba4\u4e3a0\nzbuff zbuff\u5bf9\u8c61\n\u8fd4\u56de\u503c\uff1a\nint \u8fd4\u56de\u8bfb\u5230\u7684\u957f\u5ea6\uff0c\u5e76\u628azbuff\u6307\u9488\u540e\u79fb\n\u4f8b\u5b50\uff1a\nusbapp.hid_rx(0, buff)\n", "prefix": "usbapp.hid_rx"}, "usbapp.vhid_cancel_upload": {"body": "usbapp.vhid_cancel_upload(${1:id})", "description": "usbapp.vhid_cancel_upload(id) - USB HID\u8bbe\u5907\u53d6\u6d88\u4e0a\u4f20\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id,\u9ed8\u8ba4\u4e3a0\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u53d6\u6d88\u4e0a\u4f20\u6570\u636e,\u901a\u5e38\u4e0d\u9700\u8981\nusbapp.vhid_cancel_upload(0)\n", "prefix": "usbapp.vhid_cancel_upload"}, "usbapp.udisk_attach_sdhc": {"body": "usbapp.udisk_attach_sdhc(${1:id})", "description": "usbapp.udisk_attach_sdhc(id) - USB U\u76d8\u8bbe\u5907\u6302\u8f7dSDHC\uff0cTF\u5361\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id,\u9ed8\u8ba4\u4e3a0\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nusbapp.udisk_attach_sdhc(0)\n", "prefix": "usbapp.udisk_attach_sdhc"}, "usbapp.udisk_detach_sdhc": {"body": "usbapp.udisk_detach_sdhc(${1:id})", "description": "usbapp.udisk_detach_sdhc(id) - USB U\u76d8\u8bbe\u5907\u53bb\u9664\u6302\u8f7dSDHC\uff0cTF\u5361\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id,\u9ed8\u8ba4\u4e3a0\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nusbapp.udisk_detach_sdhc(0)\n", "prefix": "usbapp.udisk_detach_sdhc"}, "w5500.init": {"body": "w5500.init(${1:spiid},${2:speed},${3:cs_pin},${4:irq_pin},${5:rst_pin},${6:link_pin})", "description": "w5500.init(spiid, speed, cs_pin, irq_pin, rst_pin, link_pin) - \u521d\u59cb\u5316w5500\n\u4f20\u5165\u503c\uff1a\nint spi\u901a\u9053\u53f7, \u4f8b\u5982 0, 1, 5, \u6309\u8bbe\u5907\u5b9e\u9645\u60c5\u51b5\u9009\nint spi\u901f\u5ea6, \u53ef\u4ee5\u8bbe\u7f6e\u5230\u5bf9\u5e94SPI\u7684\u6700\u9ad8\u901f\u5ea6\nint cs pin, \u7247\u9009\u811a, \u5bf9\u5e94W5500\u7684SCS\nint irq pin, \u4e2d\u65ad\u811a, \u5bf9\u5e94W5500\u7684INT\nint reset pin, \u590d\u4f4d\u811a, \u5bf9\u5e94W5500\u7684RST\nint link \u72b6\u6001 pin\uff0c\u53ef\u4ee5\u7559\u7a7a\u4e0d\u4f7f\u7528\uff0c\u9ed8\u8ba4\u4e0d\u4f7f\u7528\n\u4f8b\u5b50\uff1a\nw5500.init(spi.SPI_0, 24000000, pin.PB13, pin.PC08, pin.PC09)\n", "prefix": "w5500.init"}, "w5500.config": {"body": "w5500.config(${1:ip},${2:submask},${3:gateway},${4:mac},${5:RTR},${6:RCR},${7:speed})", "description": "w5500.config(ip, submask, gateway, mac, RTR, RCR, speed) - w5500\u914d\u7f6e\u7f51\u7edc\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nstring \u9759\u6001ip\u5730\u5740\uff0c\u5982\u679c\u9700\u8981\u7528DHCP\u83b7\u53d6\uff0c\u8bf7\u5199nil\nstring \u5b50\u7f51\u63a9\u7801\uff0c\u5982\u679c\u4f7f\u7528\u52a8\u6001ip\uff0c\u5219\u5ffd\u7565\nstring \u7f51\u5173\uff0c\u5982\u679c\u4f7f\u7528\u52a8\u6001ip\uff0c\u5219\u5ffd\u7565\nstring MAC\uff0c\u5199nil\u5219\u901a\u8fc7MCU\u552f\u4e00\u7801\u81ea\u52a8\u751f\u6210\uff0c\u5982\u679c\u8981\u5199\uff0c\u957f\u5ea6\u5fc5\u987b\u662f6byte\nint \u91cd\u8bd5\u95f4\u9694\u65f6\u95f4\uff0c\u9ed8\u8ba42000\uff0c\u5355\u4f4d100us\uff0c\u4e0d\u61c2\u7684\u4e0d\u8981\u6539\nint \u6700\u5927\u91cd\u8bd5\u6b21\u6570\uff0c\u9ed8\u8ba48\uff0c\u4e0d\u61c2\u7684\u4e0d\u8981\u6539\nint \u901f\u5ea6\u7c7b\u578b\uff0c\u76ee\u524d\u53ea\u67090\u786c\u4ef6\u914d\u7f6e\uff0c1\u81ea\u9002\u5e94\uff0c\u9ed8\u8ba4\u4e3a0\n\u4f8b\u5b50\uff1a\nw5500.config(\"192.168.1.2\", \"255.255.255.0\", \"192.168.1.1\", string.fromHex(\"102a3b4c5d6e\"))\n", "prefix": "w5500.config"}, "w5500.bind": {"body": "w5500.bind(${1:id})", "description": "w5500.bind(id) - \u5c06w5500\u6ce8\u518c\u8fdb\u901a\u7528\u7f51\u7edc\u63a5\u53e3\n\u4f20\u5165\u503c\uff1a\nint \u901a\u7528\u7f51\u7edc\u901a\u9053\u53f7\n\u4f8b\u5b50\uff1a\n-- \u82e5\u4f7f\u7528\u7684\u7248\u672c\u4e0d\u5e26socket\u5e93, \u6539\u6210 network.ETH0\nw5500.bind(socket.ETH0)\n", "prefix": "w5500.bind"}, "w5500.getMac": {"body": "w5500.getMac()", "description": "w5500.getMac() - \u83b7\u53d6w5500\u5f53\u524d\u7684MAC\uff0c\u5fc5\u987b\u5728init\u4e4b\u540e\u7528\uff0c\u5982\u679cconfig\u4e2d\u8bbe\u7f6e\u4e86\u81ea\u5df1\u7684MAC\uff0c\u9700\u8981\u5ef6\u8fdf\u4e00\u70b9\u65f6\u95f4\u518d\u8bfb\n\u8fd4\u56de\u503c\uff1a\nstring \u5f53\u524d\u7684MAC\n\u4f8b\u5b50\uff1a\nlocal mac = w5500.getMac()\nlog.info(\"w5500 mac\", mac:toHex())\n", "prefix": "w5500.getMac"}, "wdt.init": {"body": "wdt.init(${1:timeout})", "description": "wdt.init(timeout) - \u521d\u59cb\u5316watchdog\u5e76\u9a6c\u4e0a\u542f\u7528.\u5927\u90e8\u5206\u8bbe\u5907\u7684watchdog\u4e00\u65e6\u542f\u7528\u5c31\u65e0\u6cd5\u5173\u95ed.\n\u4f20\u5165\u503c\uff1a\nint \u8d85\u65f6\u65f6\u957f,\u5355\u4f4d\u4e3a\u6beb\u79d2\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse(\u4f8b\u5982\u5e95\u5c42\u4e0d\u652f\u6301)\n\u4f8b\u5b50\uff1a\nwdt.init(9000)\nsys.timerLoopStart(wdt.feed, 3000)\n", "prefix": "wdt.init"}, "wdt.setTimeout": {"body": "wdt.setTimeout(${1:timeout})", "description": "wdt.setTimeout(timeout) - \u90e8\u5206\u8bbe\u5907\u652f\u6301\u91cd\u65b0\u8bbe\u7f6ewatchdog\u8d85\u65f6\u65f6\u957f\n\u4f20\u5165\u503c\uff1a\nint \u8d85\u65f6\u65f6\u957f,\u5355\u4f4d\u4e3a\u6beb\u79d2\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse(\u4f8b\u5982\u5e95\u5c42\u4e0d\u652f\u6301)\n\u4f8b\u5b50\uff1a\nwdt.init(10000)\nsys.timerLoopStart(wdt.feed, 3000)\nsys.wait(5000)\nsys.setTimeout(5000)\n", "prefix": "wdt.setTimeout"}, "wdt.feed": {"body": "wdt.feed()", "description": "wdt.feed() - \u5582\u72d7,\u4f7f\u5f97\u8d85\u65f6\u8ba1\u65f6\u590d\u4f4d,\u91cd\u65b0\u8ba1\u65f6\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse(\u4f8b\u5982\u5e95\u5c42\u4e0d\u652f\u6301)\n\u4f8b\u5b50\uff1a\nwdt.init(10000)\n-- \u5b9a\u65f6\u5582\u72d7,\u6216\u8005\u6839\u636e\u4e1a\u52a1\u6309\u9700\u5582\u72d7\nsys.timerLoopStart(wdt.feed, 3000)\n", "prefix": "wdt.feed"}, "wdt.close": {"body": "wdt.close()", "description": "wdt.close() - \u5173\u95edwatchdog,\u901a\u5e38\u4e0d\u88ab\u652f\u6301\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse(\u4f8b\u5982\u5e95\u5c42\u4e0d\u652f\u6301)\n\u4f8b\u5b50\uff1a\nwdt.init(10000)\nsys.wait(9000)\nwdt.close()\n", "prefix": "wdt.close"}, "wsc:debug": {"body": "wsc:debug(${1:onoff})", "description": "wsc:debug(onoff) - \u914d\u7f6e\u662f\u5426\u6253\u5f00debug\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nboolean \u662f\u5426\u6253\u5f00debug\u5f00\u5173\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "wsc:debug"}, "websocket.create": {"body": "websocket.create(${1:adapter},${2:url},${3:keepalive},${4:use_ipv6})", "description": "websocket.create(adapter, url, keepalive, use_ipv6) - websocket\u5ba2\u6237\u7aef\u521b\u5efa\n\u4f20\u5165\u503c\uff1a\nint \u9002\u914d\u5668\u5e8f\u53f7, \u53c2\u8003socket\u5e93\u7684\u5e38\u91cf,\u9ed8\u8ba4\u4e3anil,\u4f1a\u9009\u62e9\u5e73\u53f0\u81ea\u5e26\u7684\u65b9\u5f0f\nstring \u8fde\u63a5\u5b57\u7b26\u4e32,\u53c2\u8003usage\nint \u5fc3\u8df3\u95f4\u9694,\u9ed8\u8ba460\u79d2. 2024.4.28\u65b0\u589e\nboolean \u662f\u5426\u4f7f\u7528ipv6,\u9ed8\u8ba4false. 2024.6.17\u65b0\u589e\n\u8fd4\u56de\u503c\uff1a\nuserdata \u82e5\u6210\u529f\u4f1a\u8fd4\u56dewebsocket\u5ba2\u6237\u7aef\u5b9e\u4f8b,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u666e\u901aTCP\u94fe\u63a5\nwsc = websocket.create(nil,\"ws://air32.cn/abc\")\n-- \u52a0\u5bc6TCP\u94fe\u63a5\nwsc = websocket.create(nil,\"wss://air32.cn/abc\")\n", "prefix": "websocket.create"}, "wsc:on": {"body": "wsc:on(${1:cb})", "description": "wsc:on(cb) - \u6ce8\u518cwebsocket\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nfunction cb websocket\u56de\u8c03,\u53c2\u6570\u5305\u62ecwebsocket_client, event, data, payload\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nwsc:on(function(websocket_client, event, data, payload)\n -- \u6253\u5370\u5404\u79cd\u4e8b\u4ef6\n log.info(\"websocket\", \"event\", event, data, payload)\nend)\n--[[\nevent\u7684\u503c\u6709:\n conack \u8fde\u63a5\u670d\u52a1\u5668\u6210\u529f,\u5df2\u7ecf\u6536\u5230websocket\u534f\u8bae\u5934\u90e8\u4fe1\u606f,\u901a\u4fe1\u5df2\u5efa\u7acb\n recv \u6536\u5230\u670d\u52a1\u5668\u4e0b\u53d1\u7684\u4fe1\u606f, data, payload \u4e0d\u4e3anil\n sent send\u51fd\u6570\u53d1\u9001\u7684\u6d88\u606f,\u670d\u52a1\u5668\u5728TCP\u534f\u8bae\u5c42\u5df2\u786e\u8ba4\u6536\u5230\n disconnect \u670d\u52a1\u5668\u8fde\u63a5\u5df2\u65ad\u5f00\n\n\u5176\u4e2d sent/disconnect \u4e8b\u4ef6\u5728 2023.04.01 \u65b0\u589e\n]]\n", "prefix": "wsc:on"}, "wsc:connect": {"body": "wsc:connect()", "description": "wsc:connect() - \u8fde\u63a5\u670d\u52a1\u5668\n\u8fd4\u56de\u503c\uff1a\nboolean \u53d1\u8d77\u6210\u529f\u8fd4\u56detrue, \u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u5f00\u59cb\u5efa\u7acb\u8fde\u63a5\nwsc:connect()\n-- \u672c\u51fd\u6570\u4ec5\u4ee3\u8868\u53d1\u8d77\u6210\u529f, \u540e\u7eed\u4ecd\u9700\u6839\u636eready\u51fd\u6570\u5224\u65adwebsocket\u662f\u5426\u8fde\u63a5\u6b63\u5e38\n", "prefix": "wsc:connect"}, "wsc:autoreconn": {"body": "wsc:autoreconn(${1:reconnect},${2:reconnect_time})", "description": "wsc:autoreconn(reconnect, reconnect_time) - \u81ea\u52a8\u91cd\u8fde\n\u4f20\u5165\u503c\uff1a\nbool \u662f\u5426\u81ea\u52a8\u91cd\u8fde\nint \u81ea\u52a8\u91cd\u8fde\u5468\u671f \u5355\u4f4dms \u9ed8\u8ba43000ms\n\u4f8b\u5b50\uff1a\nwsc:autoreconn(true)\n", "prefix": "wsc:autoreconn"}, "wsc:send": {"body": "wsc:send(${1:data},${2:fin},${3:opt})", "description": "wsc:send(data, fin, opt) - \u53d1\u5e03\u6d88\u606f\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u53d1\u9001\u7684\u6570\u636e,\u5fc5\u586b\nint \u662f\u5426\u4e3a\u6700\u540e\u4e00\u5e27,\u9ed8\u8ba41,\u5373\u9a6c\u4e0a\u8bbe\u7f6e\u4e3a\u6700\u540e\u4e00\u5e27, \u4e5f\u5c31\u662f\u5355\u5e27\u53d1\u9001\nint \u64cd\u4f5c\u7801, \u9ed8\u8ba4\u4e3a\u5b57\u7b26\u4e32\u5e270, \u53ef\u90091\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u4e3afalse\u6216\u8005nil\n\u4f8b\u5b50\uff1a\n-- \u7b80\u5355\u53d1\u9001\u6570\u636e\nwsc:send(\"123\")\n-- \u5206\u6bb5\u53d1\u9001\u6570\u636e, \u6700\u540e\u8981\u75281(\u5373FIN\u5e27\u7ed3\u675f)\nwsc:send(\"123\", 0)\nwsc:send(\"456\", 0)\nwsc:send(\"789\", 1)\n", "prefix": "wsc:send"}, "wsc:close": {"body": "wsc:close()", "description": "wsc:close() - websocket\u5ba2\u6237\u7aef\u5173\u95ed(\u5173\u95ed\u540e\u8d44\u6e90\u91ca\u653e\u65e0\u6cd5\u518d\u4f7f\u7528)\n\u4f8b\u5b50\uff1a\nwsc:close()\n", "prefix": "wsc:close"}, "wsc:ready": {"body": "wsc:ready()", "description": "wsc:ready() - websocket\u5ba2\u6237\u7aef\u662f\u5426\u5c31\u7eea\n\u8fd4\u56de\u503c\uff1a\nbool \u5ba2\u6237\u7aef\u662f\u5426\u5c31\u7eea\n\u4f8b\u5b50\uff1a\nlocal stat = wsc:ready()\n", "prefix": "wsc:ready"}, "wsc:headers": {"body": "wsc:headers(${1:headers})", "description": "wsc:headers(headers) - \u8bbe\u7f6e\u989d\u5916\u7684headers\n\u4f20\u5165\u503c\uff1a\ntable/string \u53ef\u4ee5\u662ftable,\u4e5f\u53ef\u4ee5\u662f\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nbool \u5ba2\u6237\u7aef\u662f\u5426\u5c31\u7eea\n\u4f8b\u5b50\uff1a\n-- table\u5f62\u5f0f\nwsc:headers({\n Auth=\"Basic ABCDEFGG\"\n})\n-- \u5b57\u7b26\u4e32\u5f62\u5f0f\nwsc:headers(\"Auth: Basic ABCDERG\\r\\n\")\n", "prefix": "wsc:headers"}, "wlan.init": {"body": "wlan.init()", "description": "wlan.init() - \u521d\u59cb\u5316\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n", "prefix": "wlan.init"}, "wlan.setMode": {"body": "wlan.setMode(${1:mode})", "description": "wlan.setMode(mode) - \u8bbe\u7f6ewifi\u6a21\u5f0f\n\u4f20\u5165\u503c\uff1a\nint wifi\u6a21\u5f0f\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u8bbe\u7f6e\u4e3aAP\u6a21\u5f0f, \u5e7f\u64adssid, \u63a5\u6536wifi\u5ba2\u6237\u7aef\u7684\u94fe\u63a5\nwlan.setMode(wlan.AP)\n\n-- \u8bbe\u7f6e\u4e3aSTATION\u6a21\u5f0f, \u4e5f\u662f\u521d\u59cb\u5316\u540e\u7684\u9ed8\u8ba4\u6a21\u5f0f\nwlan.setMode(wlan.STATION)\n\n-- \u6df7\u5408\u6a21\u5f0f, \u505aAP\u53c8\u505aSTATION\nwlan.setMode(wlan.APSTA)\n", "prefix": "wlan.setMode"}, "wlan.ready": {"body": "wlan.ready()", "description": "wlan.ready() - \u4f5c\u4e3aSTATION\u65f6,\u662f\u5426\u5df2\u7ecf\u8fde\u63a5\u4e0aAP,\u4e14\u83b7\u53d6IP\u6210\u529f\n\u8fd4\u56de\u503c\uff1a\nbool \u5df2\u7ecf\u8fde\u63a5\u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n", "prefix": "wlan.ready"}, "wlan.connect": {"body": "wlan.connect(${1:ssid},${2:password},${3:auto_reconnect},${4:bssid})", "description": "wlan.connect(ssid, password, auto_reconnect, bssid) - \u4f5c\u4e3aSTATION\u65f6,\u8fde\u63a5\u5230\u6307\u5b9aAP\n\u4f20\u5165\u503c\uff1a\nstring AP\u7684ssid\nstring AP\u7684password,\u53ef\u9009\nint 0\u5173\u95ed\u81ea\u52a8\u91cd\u8fde,1\u5f00\u542f\u81ea\u52a8\u91cd\u8fde.\u5f53\u524d\u5f3a\u5236\u5f00\u542f\u81ea\u52a8\u91cd\u8fde\nstring AP\u7684bssid,\u53ef\u9009,\u5fc5\u987b\u662f6\u5b57\u8282\n\u8fd4\u56de\u503c\uff1a\nbool \u53d1\u8d77\u8fde\u63a5\u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse.\u6ce8\u610f,\u4e0d\u4ee3\u8868\u8fde\u63a5AP\u6210\u529f!!\n\u4f8b\u5b50\uff1a\n\n-- \u666e\u901a\u6a21\u5f0f,\u5e26\u5bc6\u7801\nwlan.connect(\"myap\", \"12345678\")\n-- \u666e\u901a\u6a21\u5f0f,\u4e0d\u5e26\u5bc6\u7801\nwlan.connect(\"myap\")\n-- \u7279\u6b8a\u6a21\u5f0f, \u91cd\u7528\u4e4b\u524d\u7684ssid\u548c\u5bc6\u7801,\u672c\u6b21\u76f4\u63a5\u8fde\u63a5\n-- \u6ce8\u610f, \u524d\u63d0\u662f\u672c\u6b21\u4e0a\u7535\u540e\u5df2\u7ecf\u4f20\u8fc7ssid\u548c\u6216password,\u5426\u5219\u5fc5\u5931\u8d25\nwlan.connect()\n\n-- \u7279\u6b8a\u6a21\u5f0f, \u4f7f\u7528ssid\u548c\u5bc6\u7801,\u672c\u6b21\u8fde\u63a5\u6307\u5b9abssid, 2024.5.7\u65b0\u589e\nlocal bssid = string.fromHex(\"00182946365f\")\nwlan.connect(\"myap\", \"12345678\", 1, bssid)\n", "prefix": "wlan.connect"}, "wlan.disconnect": {"body": "wlan.disconnect()", "description": "wlan.disconnect() - \u4f5c\u4e3aSTATION\u65f6,\u65ad\u5f00AP\n", "prefix": "wlan.disconnect"}, "wlan.scan": {"body": "wlan.scan()", "description": "wlan.scan() - \u626b\u63cfwifi\u9891\u6bb5\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f, wlan.scan()\u662f\u5f02\u6b65API,\u542f\u52a8\u626b\u63cf\u540e\u4f1a\u9a6c\u4e0a\u8fd4\u56de\n\n-- wifi\u626b\u63cf\u6210\u529f\u540e, \u4f1a\u6709WLAN_SCAN_DONE\u6d88\u606f, \u8bfb\u53d6\u5373\u53ef\nsys.subscribe(\"WLAN_SCAN_DONE\", function ()\n local results = wlan.scanResult()\n log.info(\"scan\", \"results\", #results)\n for k,v in pairs(results) do\n log.info(\"scan\", v[\"ssid\"], v[\"rssi\"], (v[\"bssid\"]:toHex()))\n end\nend)\n\n-- \u4e0b\u9762\u6f14\u793a\u7684\u662f\u521d\u59cb\u5316wifi\u540e\u5b9a\u65f6\u626b\u63cf,\u8bf7\u6309\u5b9e\u9645\u4e1a\u52a1\u9700\u6c42\u4fee\u6539\nsys.taskInit(function()\n sys.wait(1000)\n wlan.init()\n while 1 do\n wlan.scan()\n sys.wait(15000)\n end\nend)\n", "prefix": "wlan.scan"}, "wlan.scanResult": {"body": "wlan.scanResult()", "description": "wlan.scanResult() - \u83b7\u53d6wifi\u626b\u63cf\u7ed3\u679c\n\u8fd4\u56de\u503c\uff1a\ntable \u626b\u63cf\u7ed3\u679c\n\u4f8b\u5b50\uff1a\n-- \u7528\u6cd5\u8bf7\u67e5\u9605 wlan.scan() \u51fd\u6570\n", "prefix": "wlan.scanResult"}, "wlan.smartconfig": {"body": "wlan.smartconfig(${1:mode})", "description": "wlan.smartconfig(mode) - \u914d\u7f51\n\u4f20\u5165\u503c\uff1a\nint \u914d\u7f51\u6a21\u5f0f, \u9ed8\u8ba4\u4e3aesptouch, \u82e5\u4f200\u5219\u4e3b\u52a8\u505c\u6b62\u914d\u7f51\n\u8fd4\u56de\u503c\uff1a\nbool \u542f\u52a8\u6210\u529f\u6216\u505c\u6b62\u6210\u529f, \u8fd4\u56detrue, \u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nwlan.smartconfig()\nlocal ret, ssid, passwd = sys.waitUntil(\"SC_RESULT\", 180*1000) -- \u6700\u591a\u7b493\u5206\u949f\nlog.info(\"sc\", ret, ssid, passwd)\n-- \u8be6\u7ec6\u7528\u6cd5\u8bf7\u67e5\u770bdemo\n", "prefix": "wlan.smartconfig"}, "wlan.getMac": {"body": "wlan.getMac(${1:tp},${2:hexstr})", "description": "wlan.getMac(tp, hexstr) - \u83b7\u53d6mac\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u7f6e\u4f55\u79cdmac\u5730\u5740,\u5bf9ESP32\u7cfb\u5217\u6765\u8bf4,\u53ea\u80fd\u8bbe\u7f6eSTA\u7684\u5730\u5740,\u53730,\u9ed8\u8ba4\u503c\u4e5f\u662f0\nbool \u662f\u5426\u8f6cHEX\u5b57\u7b26, \u9ed8\u8ba4\u662ftrue,\u5373\u8f93\u51fahex\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nstring MAC\u5730\u5740,\u5341\u516d\u8fdb\u5236\u5b57\u7b26\u4e32\u5f62\u5f0f \"AABBCCDDEEFF\" \u6216\u539f\u59cb\u6570\u636e\n", "prefix": "wlan.getMac"}, "wlan.setMac": {"body": "wlan.setMac(${1:tp},${2:mac})", "description": "wlan.setMac(tp, mac) - \u8bbe\u7f6emac\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u7f6e\u4f55\u79cdmac\u5730\u5740,\u5bf9ESP32\u7cfb\u5217\u6765\u8bf4,\u53ea\u80fd\u8bbe\u7f6eSTA\u7684\u5730\u5740,\u53730\nstring \u5f85\u8bbe\u7f6e\u7684MAC\u5730\u5740,\u957f\u5ea66\u5b57\u8282\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u8bbe\u7f6eMAC\u5730\u5740, 2023-03-01\u4e4b\u540e\u7f16\u8bd1\u7684\u56fa\u4ef6\u53ef\u7528\nlocal mac = string.fromHex(\"F01122334455\")\nwlan.setMac(0, mac)\n\n-- \u90e8\u5206\u6a21\u5757\u652f\u6301\u6062\u590d\u9ed8\u8ba4MAC, \u4f8b\u5982esp32\u7cfb\u5217\n-- \u57282023-11-01 \u4e4b\u540e\u7f16\u8bd1\u7684\u56fa\u4ef6\u53ef\u7528\nlocal mac = string.fromHex(\"000000000000\")\nwlan.setMac(0, mac)\n", "prefix": "wlan.setMac"}, "wlan.getIP": {"body": "wlan.getIP()", "description": "wlan.getIP() - \u83b7\u53d6ip,\u4ec5STATION\u6216APSTA\u6a21\u5f0f\u4e0b\u6709\u610f\u4e49\n\u8fd4\u56de\u503c\uff1a\nstring ip\u5730\u5740,\u5f53\u524d\u4ec5\u8fd4\u56deipv4\u5730\u5740,\u4f8b\u5982 \"192.168.1.25\"\n", "prefix": "wlan.getIP"}, "wlan.createAP": {"body": "wlan.createAP(${1:ssid},${2:passwd},${3:gateway},${4:netmask},${5:channel},${6:opts})", "description": "wlan.createAP(ssid, passwd, gateway, netmask, channel, opts) - \u542f\u52a8AP\n\u4f20\u5165\u503c\uff1a\nstring AP\u7684SSID,\u5fc5\u586b\nstring AP\u7684\u5bc6\u7801,\u53ef\u9009\nstring AP\u7684\u7f51\u5173\u5730\u5740, \u9ed8\u8ba4192.168.4.1\nstring AP\u7684\u7f51\u5173\u63a9\u7801, \u9ed8\u8ba4255.255.255.0\nint AP\u5efa\u7acb\u7684\u901a\u9053, \u9ed8\u8ba46\ntable AP\u7684\u914d\u7f6e\u9009\u9879, \u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u521b\u5efa\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f, \u8c03\u7528\u672cAP\u65f6,\u82e5wifi\u6a21\u5f0f\u4e3aSTATION,\u4f1a\u81ea\u52a8\u5207\u6362\u6210 APSTA\nwlan.createAP(\"luatos1234\", \"12341234\")\n-- \u8bbe\u7f6e\u7f51\u5173IP,\u63a9\u7801, \u901a\u9053, 2023.7.13 \u65b0\u589e, BSP\u672a\u5fc5\u652f\u6301\n-- wlan.createAP(\"luatos1234\", \"12341234\", \"192.168.4.1\", \"255.255.255.0\", 6)\n\n-- opts\u66f4\u591a\u914d\u7f6e\u9879, 2024.3.5\u65b0\u589e\n--[[\n{\n hidden = false, -- \u662f\u5426\u9690\u85cfSSID, \u9ed8\u8ba4false,\u4e0d\u9690\u85cf\n max_conn = 4 -- \u6700\u5927\u5ba2\u6237\u7aef\u6570\u91cf, \u9ed8\u8ba44\n}\n]]\n", "prefix": "wlan.createAP"}, "wlan.stopAP": {"body": "wlan.stopAP()", "description": "wlan.stopAP() - \u5173\u95edAP\u529f\u80fd\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u521b\u5efa\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nwlan.stopAP()\n", "prefix": "wlan.stopAP"}, "wlan.getInfo": {"body": "wlan.getInfo()", "description": "wlan.getInfo() - \u83b7\u53d6\u4fe1\u606f,\u5982AP\u7684bssid,\u4fe1\u53f7\u5f3a\u5ea6, STA\u8054\u7f51\u540e\u53ef\u83b7\u53d6\n\u8fd4\u56de\u503c\uff1a\ntable \u8be6\u60c5,\u952e\u503c\u5bf9\u5f62\u5f0f\n\u4f8b\u5b50\uff1a\n\nlog.info(\"wlan\", \"info\", json.encode(wlan.getInfo()))\n--[[\n\u5178\u578b\u8f93\u51fa\n{\n \"bssid\" : \"xxxxxx\",\n \"rssi\" : -89,\n \"gw\" : \"192.168.1.1\"\n}\n]]\n", "prefix": "wlan.getInfo"}, "wlan.powerSave": {"body": "wlan.powerSave(${1:mode})", "description": "wlan.powerSave(mode) - \u8bfb\u53d6\u6216\u8bbe\u7f6e\u7701\u7535\u6a21\u5f0f\n\u4f20\u5165\u503c\uff1a\nint \u7701\u7535\u6a21\u5f0f,\u53ef\u9009, \u4f20\u5165\u5c31\u662f\u8bbe\u7f6e, \u4f8b\u5982wlan.PS_NONE\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524d\u7701\u7535\u6a21\u5f0f/\u8bbe\u7f6e\u540e\u7684\u7701\u7535\u6a21\u5f0f\n\u4f8b\u5b50\uff1a\n-- \u8bf7\u67e5\u9605\u5e38\u91cf\u8868 PS_NONE/PS_MIN_MODEM/PS_MAX_MODEM\nlog.info(\"wlan\", \"PS\", wlan.powerSave(wlan.PS_NONE))\n-- \u672cAPI\u4e8e 2023.03.31 \u65b0\u589e\n", "prefix": "wlan.powerSave"}, "wlan.hostname": {"body": "wlan.hostname(${1:new_name})", "description": "wlan.hostname(new_name) - \u8bfb\u53d6\u6216\u8bbe\u7f6eHostname\n\u4f20\u5165\u503c\uff1a\nstring \u65b0\u7684hostname,\u53ef\u9009, \u4f20\u5165\u5c31\u662f\u8bbe\u7f6e\n\u8fd4\u56de\u503c\uff1a\nstring \u5f53\u524d\u7684hostname\u6216\u8005\u8bbe\u7f6e\u540e\u7684hostname\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e 2023.07.23 \u65b0\u589e\n-- \u672c\u51fd\u6570\u5e94\u8be5\u5728wlan.init\u4e4b\u524d\u8bbe\u7f6e\u597d, \u6700\u665a\u5e94\u65e9\u4e8ewlan.connect\n-- hostname\u7684\u9ed8\u8ba4\u503c\u662f \"LUATOS_\" + \u8bbe\u5907\u7684MAC\u503c\n-- \u4f8b\u5982: LUATOS_0022EECC2399\n\nwlan.hostname(\"\u6211\u7684wifi\u7269\u8054\u7f51\u8bbe\u5907\")\n", "prefix": "wlan.hostname"}, "wlan.staIp": {"body": "wlan.staIp(${1:dhcp_enable},${2:ip},${3:netmask},${4:gateway})", "description": "wlan.staIp(dhcp_enable, ip, netmask, gateway) - \u8bbe\u7f6eStation\u6a21\u5f0f\u4e0b\u7684IP\u83b7\u53d6\u6a21\u5f0f\n\u4f20\u5165\u503c\uff1a\nbool \u662f\u5426\u542f\u7528DHCP,\u9ed8\u8ba4\u662ftrue\nstring \u672c\u673aIP\u5730\u5740,\u4f8b\u5982192.168.2.200, \u7981\u7528DHCP\u65f6\u5fc5\u586b\nstring \u672c\u673aIP\u63a9\u7801,\u4f8b\u5982255.255.255.0, \u7981\u7528DHCP\u65f6\u5fc5\u586b\nstring \u672c\u673aIP\u7f51\u5173,\u4f8b\u5982192.168.2.1, \u7981\u7528DHCP\u65f6\u5fc5\u586b\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e 2023.10.06 \u65b0\u589e\n-- \u672c\u51fd\u6570\u9700\u8981\u5728wlan.init\u4e4b\u540e\u624d\u5141\u8bb8\u8c03\u7528\n\n-- \u542f\u7528DHCP, \u9ed8\u8ba4\u4e5f\u662f\u542f\u7528DHCP,\u8fd9\u91cc\u662f\u6f14\u793aAPI\u4f7f\u7528\nwlan.staIp(true)\n-- \u7981\u7528DHCP,\u81ea\u884c\u8bbe\u7f6eIP/\u63a9\u7801/\u7f51\u5173\nwlan.staIp(false, \"192.168.2.200\", \"255.255.255.0\", \"192.168.2.1\")\n", "prefix": "wlan.staIp"}, "wlanraw.setup": {"body": "wlanraw.setup(${1:opts},${2:cb})", "description": "wlanraw.setup(opts, cb) - \u521d\u59cb\u5316WLAN\u7684RAW\u5c42\n\u4f20\u5165\u503c\uff1a\ntable opts \u914d\u7f6e\u53c2\u6570\nfunction \u56de\u8c03\u51fd\u6570,\u5f62\u5f0ffunction(buff, size)\n\u8fd4\u56de\u503c\uff1a\nboolean true\u8868\u793a\u6210\u529f,\u5176\u4ed6\u5931\u8d25\n\u4f8b\u5b50\uff1a\n-- \u5f53\u524d\u4ec5XT804\u7cfb\u5217\u652f\u6301, \u4f8b\u5982 Air101/Air103/Air601/Air690\nwlanraw.setup({\n buffsize = 1600, -- \u7f13\u51b2\u533a\u5927\u5c0f, \u9ed8\u8ba41600\u5b57\u8282\n buffcount = 10, -- \u7f13\u51b2\u533a\u6570\u91cf, \u9ed8\u8ba48\n}, cb)\n", "prefix": "wlanraw.setup"}, "ws2812.create": {"body": "ws2812.create(${1:mode},${2:count},${3:id})", "description": "ws2812.create(mode, count, id) - \u521b\u5efa\u4e0a\u4e0b\u6587\n\u4f20\u5165\u503c\uff1a\nint \u4f20\u8f93\u6a21\u5f0f, \u4f8b\u5982 ws2812.GPIO, ws2812.PWM, ws2812.SPI\nint RGB\u706f\u603b\u4e2a\u6570\nint \u4e3b\u53c2\u6570id, \u5bf9\u4e8e\u4e0d\u540c\u7684\u6a21\u5f0f\u6709\u4e0d\u540c\u7684\u503c\n\u8fd4\u56de\u503c\uff1a\nuserdata \u521b\u5efa\u6210\u529f\u8fd4\u56de\u4e0a\u4e0b\u6587,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- GPIO\u6a21\u5f0f, 64\u4e2a\u706f, \u4f7f\u7528GPIO9\nlocal leds = ws2812.create(ws2812.GPIO, 64, 9)\n-- SPI\u6a21\u5f0f, 32\u4e2a\u706f, \u4f7f\u7528SPI1\nlocal leds = ws2812.create(ws2812.SPI, 32, 1)\n-- PWM\u6a21\u5f0f, 16\u4e2a\u706f, \u4f7f\u7528PWM4\nlocal leds = ws2812.create(ws2812.PWM, 16, 4)\n-- HW\u6a21\u5f0f, 64\u4e2a\u706f, \u4f7f\u7528\u786c\u4ef6\u4e13\u7528\u5b9e\u73b0,\u5177\u4f53id\u9700\u8981\u5bf9\u7167\u624b\u518c\nlocal leds = ws2812.create(ws2812.RMT, 64, 2)\n\n-- \u6ce8\u610f: \u5e76\u975e\u6240\u6709\u6a21\u5757\u90fd\u652f\u6301\u4ee5\u4e0a\u6240\u6709\u6a21\u5f0f\n-- \u800c\u4e14, \u56fa\u4ef6\u9700\u8981\u5f00\u542f\u5bf9\u5e94\u7684GPIO/SPI/PWM\u529f\u80fd\u624d\u80fd\u4f7f\u7528\u5bf9\u5e94\u7684\u6a21\u5f0f\n\n", "prefix": "ws2812.create"}, "ws2812.set": {"body": "ws2812.set(${1:leds},${2:index},${3:R},${4:G},${5:B})", "description": "ws2812.set(leds,index, R, G, B) - \u8bbe\u7f6e\u706f\u7684\u989c\u8272\n\u4f20\u5165\u503c\uff1a\nuserdata \u901a\u8fc7ws2812.create\u83b7\u53d6\u5230\u7684\u4e0a\u4e0b\u6587\nint \u706f\u7684\u7f16\u53f7,\u4ece0\u5f00\u59cb\nint RGB\u503c\u4e2d\u7684R\u503c\nint RGB\u503c\u4e2d\u7684G\u503c\nint RGB\u503c\u4e2d\u7684B\u503c\n\u8fd4\u56de\u503c\uff1a\nboolean \u8bbe\u7f6e\u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- RGB\u9010\u4e2a\u989c\u8272\u4f20\u9012\nws2812.set(leds, 5, 0xFF, 0xAA, 0x11)\n-- \u4e5f\u652f\u6301\u4e00\u4e2a\u53c2\u6570\u4f20\u5b8c, \u4e0e\u524d\u4e00\u6761\u7b49\u4ef7\nws2812.set(leds, 5, 0xFFAA11)\n", "prefix": "ws2812.set"}, "ws2812.send": {"body": "ws2812.send(${1:leds})", "description": "ws2812.send(leds) - \u53d1\u9001\u6570\u636e\u5230\u8bbe\u5907\n\u4f20\u5165\u503c\uff1a\nuserdata \u901a\u8fc7ws2812.create\u83b7\u53d6\u5230\u7684\u4e0a\u4e0b\u6587\n\u8fd4\u56de\u503c\uff1a\nboolean \u8bbe\u7f6e\u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u6ca1\u6709\u66f4\u591a\u53c2\u6570, \u53d1\u5c31\u5b8c\u4e8b\u4e86\nws2812.send(leds)\n", "prefix": "ws2812.send"}, "ws2812.args": {"body": "ws2812.args(${1:leds},${2:arg0},${3:arg1},${4:arg2},${5:arg3},${6:arg4})", "description": "ws2812.args(leds, arg0, arg1, arg2, arg3, arg4) - \u914d\u7f6e\u989d\u5916\u53c2\u6570\n\u4f20\u5165\u503c\uff1a\nuserdata \u901a\u8fc7ws2812.create\u83b7\u53d6\u5230\u7684\u4e0a\u4e0b\u6587\nint \u989d\u5916\u53c2\u65700\nint \u989d\u5916\u53c2\u65701\nint \u989d\u5916\u53c2\u65702\nint \u989d\u5916\u53c2\u65703\nint \u989d\u5916\u53c2\u65704\n\u8fd4\u56de\u503c\uff1a\nboolean \u8bbe\u7f6e\u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u4e0e\u5177\u4f53\u6a21\u5f0f\u6709\u5173\n\n--GPIO\u6a21\u5f0f\u53ef\u8c03\u6574T0H T0L, T1H T1L \u7684\u5177\u4f53\u5ef6\u65f6\nws2812.send(leds, t0h, t0l, t1h, t1l)\n", "prefix": "ws2812.args"}, "xxtea.encrypt": {"body": "xxtea.encrypt(${1:data},${2:key})", "description": "xxtea.encrypt(data, key) - \u52a0\u5bc6\n\u4f20\u5165\u503c\uff1a\nstring data \u5f85\u52a0\u5bc6\u7684\u6570\u636e\nstring key \u52a0\u5bc6\u7528\u7684\u5bc6\u94a5\n\u8fd4\u56de\u503c\uff1a\nstring \u52a0\u5bc6\u540e\u7684\u6570\u636e, \u5931\u8d25\u8fd4\u56denil\n", "prefix": "xxtea.encrypt"}, "xxtea.decrypt": {"body": "xxtea.decrypt(${1:data},${2:key})", "description": "xxtea.decrypt(data, key) - \u89e3\u5bc6\n\u4f20\u5165\u503c\uff1a\nstring data \u5f85\u89e3\u5bc6\u7684\u6570\u636e\nstring key \u89e3\u5bc6\u7528\u7684\u5bc6\u94a5\n\u8fd4\u56de\u503c\uff1a\nstring \u89e3\u5bc6\u540e\u7684\u6570\u636e, \u5931\u8d25\u8fd4\u56denil\n", "prefix": "xxtea.decrypt"}, "ymodem.create": {"body": "ymodem.create(${1:dir_path},${2:file_path})", "description": "ymodem.create(dir_path,file_path) - \u521b\u5efa\u4e00\u4e2aymodem\u5904\u7406\u53e5\u67c4\n\u4f20\u5165\u503c\uff1a\nstring \u4fdd\u5b58\u7684\u6587\u4ef6\u5939\u8def\u5f84\uff0c\u9ed8\u8ba4\u662f\"/\"\nstring \u5f3a\u5236\u4fdd\u5b58\u7684\u7edd\u5bf9\u6587\u4ef6\u8def\u5f84\uff0c\u9ed8\u8ba4\u662f\u7a7a\uff0c\u5982\u679c\u8bbe\u7f6e\u4e86\uff0c\u5c31\u4f1a\u76f4\u63a5\u4fdd\u5b58\u5728\u8be5\u6587\u4ef6\u4e2d\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529ftrue, \u5931\u8d25false\n\u4f8b\u5b50\uff1a\nlocal handler = ymodem.create(\"/\")\n", "prefix": "ymodem.create"}, "ymodem.receive": {"body": "ymodem.receive(${1:handler},${2:data})", "description": "ymodem.receive(handler, data) - ymodem\u63a5\u6536\u6587\u4ef6\u6570\u636e\u5e76\u4fdd\u5b58\n\u4f20\u5165\u503c\uff1a\nuserdata ymodem\u5904\u7406\u53e5\u67c4\nzbuff/string \u8f93\u5165\u7684\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529ftrue\uff0c\u5931\u8d25false\nint ack\u503c\uff0c\u9700\u8981\u901a\u8fc7\u4e32\u53e3/\u7f51\u7edc\u7b49\u9014\u5f84\u8fd4\u56de\u53d1\u9001\u65b9\nint flag\u503c\uff0c\u9700\u8981\u901a\u8fc7\u4e32\u53e3/\u7f51\u7edc\u7b49\u9014\u5f84\u8fd4\u56de\u53d1\u9001\u65b9\uff0c\u5982\u679c\u6709ack\u503c\u5219\u4e0d\u53d1\u9001flag\nboolean, \u4e00\u4e2a\u6587\u4ef6\u63a5\u6536\u5b8c\u6210true\uff0c\u4f20\u8f93\u4e2dfalse\nboolean, \u6574\u4e2a\u4f20\u8f93\u5b8c\u6210true \u5426\u5219false\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f, \u6570\u636e\u6765\u6e90\u4e0d\u9650, \u901a\u5e38\u662fuart.read\u5f97\u5230data\nno_error,ack,flag,file_done,all_done = ymodem.receive(handler, data)\n", "prefix": "ymodem.receive"}, "ymodem.reset": {"body": "ymodem.reset(${1:handler})", "description": "ymodem.reset(handler) - \u91cd\u7f6eymodem\u5904\u7406\u8fc7\u7a0b\n\u4f20\u5165\u503c\uff1a\nuserdata ymodem\u5904\u7406\u53e5\u67c4\n\u4f8b\u5b50\uff1a\n-- \u6062\u590d\u5230\u521d\u59cb\u72b6\u6001\uff0c\u4e00\u822c\u7528\u4e8e\u63a5\u6536\u51fa\u9519\u540e\u91cd\u7f6e\uff0c\u4ece\u800c\u8fdb\u884c\u4e0b\u4e00\u6b21\u63a5\u6536\nymodem.reset(handler)\n", "prefix": "ymodem.reset"}, "ymodem.release": {"body": "ymodem.release(${1:handler})", "description": "ymodem.release(handler) - \u91ca\u653eymodem\u5904\u7406\u53e5\u67c4\n\u4f20\u5165\u503c\uff1a\nuserdata handler\n\u4f8b\u5b50\uff1a\nymodem.release(handler)\n", "prefix": "ymodem.release"}, "zbuff.create": {"body": "zbuff.create(${1:length},${2:data},${3:type})", "description": "zbuff.create(length,data,type) - \u521b\u5efazbuff\n\u4f20\u5165\u503c\uff1a\nint \u5b57\u8282\u6570\nany \u53ef\u9009\u53c2\u6570\uff0cnumber\u65f6\u4e3a\u586b\u5145\u6570\u636e\uff0cstring\u65f6\u4e3a\u586b\u5145\u5b57\u7b26\u4e32\nnumber \u53ef\u9009\u53c2\u6570\uff0c\u5185\u5b58\u7c7b\u578b\uff0c\u53ef\u9009\uff1azbuff.HEAP_SRAM(\u5185\u90e8sram,\u9ed8\u8ba4) zbuff.HEAP_PSRAM(\u5916\u90e8psram) zbuff.HEAP_AUTO(\u81ea\u52a8\u7533\u8bf7,\u5982\u5b58\u5728psram\u5219\u5728psram\u8fdb\u884c\u7533\u8bf7,\u5982\u4e0d\u5b58\u5728\u6216\u5931\u8d25\u5219\u5728sram\u8fdb\u884c\u7533\u8bf7) \u6ce8\u610f:\u6b64\u9879\u4e0e\u786c\u4ef6\u652f\u6301\u6709\u5173\n\u8fd4\u56de\u503c\uff1a\nobject zbuff\u5bf9\u8c61\uff0c\u5982\u679c\u521b\u5efa\u5931\u8d25\u4f1a\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u521b\u5efazbuff\nlocal buff = zbuff.create(1024) -- \u7a7a\u767d\u7684\nlocal buff = zbuff.create(1024, 0x33) --\u521b\u5efa\u4e00\u4e2a\u521d\u503c\u5168\u4e3a0x33\u7684\u5185\u5b58\u533a\u57df\nlocal buff = zbuff.create(1024, \"123321456654\") -- \u521b\u5efa\uff0c\u5e76\u586b\u5145\u4e00\u4e2a\u5df2\u6709\u5b57\u7b26\u4e32\u7684\u5185\u5bb9\n\n-- \u521b\u5efaframebuff\u7528\u7684zbuff\n-- zbuff.create({width,height,bit},data,type)\n-- table \u5bbd\u5ea6\u3001\u9ad8\u5ea6\u3001\u8272\u4f4d\u6df1\u5ea6\n@int \u53ef\u9009\u53c2\u6570\uff0c\u586b\u5145\u6570\u636e\n@number \u53ef\u9009\u53c2\u6570\uff0c\u5185\u5b58\u7c7b\u578b\uff0c\u53ef\u9009\uff1azbuff.HEAP_SRAM(\u5185\u90e8sram,\u9ed8\u8ba4) zbuff.HEAP_PSRAM(\u5916\u90e8psram) zbuff.HEAP_AUTO(\u81ea\u52a8\u7533\u8bf7,\u5982\u5b58\u5728psram\u5219\u5728psram\u8fdb\u884c\u7533\u8bf7,\u5982\u4e0d\u5b58\u5728\u6216\u5931\u8d25\u5219\u5728sram\u8fdb\u884c\u7533\u8bf7) \u6ce8\u610f:\u6b64\u9879\u4e0e\u786c\u4ef6\u652f\u6301\u6709\u5173\n@return object zbuff\u5bf9\u8c61\uff0c\u5982\u679c\u521b\u5efa\u5931\u8d25\u4f1a\u8fd4\u56denil\n@usage\n-- \u521b\u5efazbuff\nlocal buff = zbuff.create({128,160,16})--\u521b\u5efa\u4e00\u4e2a128*160\u7684framebuff\nlocal buff = zbuff.create({128,160,16},0xf800)--\u521b\u5efa\u4e00\u4e2a128*160\u7684framebuff\uff0c\u521d\u59cb\u72b6\u6001\u7ea2\u8272\n", "prefix": "zbuff.create"}, "buff:write": {"body": "buff:write(${1:para},${2:...})", "description": "buff:write(para,...) - zbuff\u5199\u6570\u636e\uff08\u4ece\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u5f00\u59cb\uff1b\u6267\u884c\u540e\u6307\u9488\u4f1a\u5411\u540e\u79fb\u52a8\uff09\n\u4f20\u5165\u503c\uff1a\nany \u5199\u5165buff\u7684\u6570\u636e\uff0cstring\u65f6\u4e3a\u4e00\u4e2a\u53c2\u6570\uff0cnumber\u65f6\u53ef\u4e3a\u591a\u4e2a\u53c2\u6570\n\u8fd4\u56de\u503c\uff1a\nnumber \u6570\u636e\u6210\u529f\u5199\u5165\u7684\u957f\u5ea6\n\u4f8b\u5b50\uff1a\n-- \u7c7bfile\u7684\u8bfb\u5199\u64cd\u4f5c\nlocal len = buff:write(\"123\") -- \u5199\u5165\u6570\u636e, \u6307\u9488\u76f8\u5e94\u5730\u5f80\u540e\u79fb\u52a8\uff0c\u8fd4\u56de\u5199\u5165\u7684\u6570\u636e\u957f\u5ea6\nlocal len = buff:write(0x1a,0x30,0x31,0x32,0x00,0x01) -- \u6309\u6570\u503c\u5199\u5165\u591a\u4e2a\u5b57\u8282\u6570\u636e\n", "prefix": "buff:write"}, "buff:read": {"body": "buff:read(${1:length})", "description": "buff:read(length) - zbuff\u8bfb\u6570\u636e\uff08\u4ece\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u5f00\u59cb\uff1b\u6267\u884c\u540e\u6307\u9488\u4f1a\u5411\u540e\u79fb\u52a8\uff09\n\u4f20\u5165\u503c\uff1a\nint \u8bfb\u53d6buff\u4e2d\u7684\u5b57\u8282\u6570\n\u8fd4\u56de\u503c\uff1a\nstring \u8bfb\u53d6\u7ed3\u679c\n\u4f8b\u5b50\uff1a\n-- \u7c7bfile\u7684\u8bfb\u5199\u64cd\u4f5c\nlocal str = buff:read(3)\n", "prefix": "buff:read"}, "buff:clear": {"body": "buff:clear(${1:num})", "description": "buff:clear(num) - zbuff\u6e05\u7a7a\u6570\u636e\uff08\u4e0e\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u65e0\u5173\uff1b\u6267\u884c\u540e\u6307\u9488\u4f4d\u7f6e\u4e0d\u53d8\uff09\n\u4f20\u5165\u503c\uff1a\nint \u53ef\u9009\uff0c\u9ed8\u8ba4\u4e3a0\u3002\u8981\u8bbe\u7f6e\u4e3a\u7684\u503c\uff0c\u4e0d\u4f1a\u6539\u53d8buff\u6307\u9488\u4f4d\u7f6e\n\u4f8b\u5b50\uff1a\n-- \u5168\u90e8\u521d\u59cb\u5316\u4e3a0\nbuff:clear(0)\n", "prefix": "buff:clear"}, "buff:seek": {"body": "buff:seek(${1:base},${2:offset})", "description": "buff:seek(base,offset) - zbuff\u8bbe\u7f6e\u5149\u6807\u4f4d\u7f6e\uff08\u53ef\u80fd\u4e0e\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u6709\u5173\uff1b\u6267\u884c\u540e\u6307\u9488\u4f1a\u88ab\u8bbe\u7f6e\u5230\u6307\u5b9a\u4f4d\u7f6e\uff09\n\u4f20\u5165\u503c\uff1a\nint \u504f\u79fb\u957f\u5ea6\nint where, \u57fa\u70b9\uff0c\u9ed8\u8ba4zbuff.SEEK_SET\u3002zbuff.SEEK_SET: \u57fa\u70b9\u4e3a 0 \uff08\u6587\u4ef6\u5f00\u5934\uff09\uff0czbuff.SEEK_CUR: \u57fa\u70b9\u4e3a\u5f53\u524d\u4f4d\u7f6e\uff0czbuff.SEEK_END: \u57fa\u70b9\u4e3a\u6587\u4ef6\u5c3e\n\u8fd4\u56de\u503c\uff1a\nint \u8bbe\u7f6e\u5149\u6807\u540e\u4ecebuff\u5f00\u5934\u8ba1\u7b97\u8d77\u7684\u5149\u6807\u7684\u4f4d\u7f6e\n\u4f8b\u5b50\uff1a\nbuff:seek(0) -- \u628a\u5149\u6807\u8bbe\u7f6e\u5230\u6307\u5b9a\u4f4d\u7f6e\nbuff:seek(5,zbuff.SEEK_CUR)\nbuff:seek(-3,zbuff.SEEK_END)\n", "prefix": "buff:seek"}, "buff:pack": {"body": "buff:pack(${1:format},${2:val1},${3:val2},${4:...})", "description": "buff:pack(format,val1, val2,...) - \u5c06\u4e00\u7cfb\u5217\u6570\u636e\u6309\u7167\u683c\u5f0f\u5b57\u7b26\u8f6c\u5316\uff0c\u5e76\u5199\u5165\uff08\u4ece\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u5f00\u59cb\uff1b\u6267\u884c\u540e\u6307\u9488\u4f1a\u5411\u540e\u79fb\u52a8\uff09\n\u4f20\u5165\u503c\uff1a\nstring \u540e\u9762\u6570\u636e\u7684\u683c\u5f0f\uff08\u7b26\u53f7\u542b\u4e49\u89c1\u4e0b\u9762\u7684\u4f8b\u5b50\uff09\nval \u4f20\u5165\u7684\u6570\u636e\uff0c\u53ef\u4ee5\u4e3a\u591a\u4e2a\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u5199\u5165\u7684\u6570\u636e\u957f\u5ea6\n\u4f8b\u5b50\uff1a\nbuff:pack(\">IIHA\", 0x1234, 0x4567, 0x12,\"abcdefg\") -- \u6309\u683c\u5f0f\u5199\u5165\u51e0\u4e2a\u6570\u636e\n-- A string\n-- f float\n-- d double\n-- n Lua number\n-- c char\n-- b byte / unsignen char\n-- h short\n-- H unsigned short\n-- i int\n-- I unsigned int\n-- l long\n-- L unsigned long\n-- < \u5c0f\u7aef\n-- > \u5927\u7aef\n-- = \u9ed8\u8ba4\u5927\u5c0f\u7aef\n", "prefix": "buff:pack"}, "buff:unpack": {"body": "buff:unpack(${1:format})", "description": "buff:unpack(format) - \u5c06\u4e00\u7cfb\u5217\u6570\u636e\u6309\u7167\u683c\u5f0f\u5b57\u7b26\u8bfb\u53d6\u51fa\u6765\uff08\u4ece\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u5f00\u59cb\uff1b\u6267\u884c\u540e\u6307\u9488\u4f1a\u5411\u540e\u79fb\u52a8\uff09\n\u4f20\u5165\u503c\uff1a\nstring \u6570\u636e\u7684\u683c\u5f0f\uff08\u7b26\u53f7\u542b\u4e49\u89c1\u4e0a\u9762pack\u63a5\u53e3\u7684\u4f8b\u5b50\uff09\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u8bfb\u53d6\u7684\u6570\u636e\u5b57\u8282\u957f\u5ea6\nany \u6309\u683c\u5f0f\u8bfb\u51fa\u6765\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\nlocal cnt,a,b,c,s = buff:unpack(\">IIHA10\") -- \u6309\u683c\u5f0f\u8bfb\u53d6\u51e0\u4e2a\u6570\u636e\n--\u5982\u679c\u5168\u90e8\u6210\u529f\u8bfb\u53d6\uff0ccnt\u5c31\u662f4+4+2+10=20\n", "prefix": "buff:unpack"}, "buff:read\u7c7b\u578b": {"body": "buff:read\u7c7b\u578b()", "description": "buff:read\u7c7b\u578b() - \u8bfb\u53d6\u4e00\u4e2a\u6307\u5b9a\u7c7b\u578b\u7684\u6570\u636e\uff08\u4ece\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u5f00\u59cb\uff1b\u6267\u884c\u540e\u6307\u9488\u4f1a\u5411\u540e\u79fb\u52a8\uff09\n\u4f20\u5165\u503c\uff1a\n\u6ce8\u91ca \u8bfb\u53d6\u7c7b\u578b\u53ef\u4e3a\uff1aI8\u3001U8\u3001I16\u3001U16\u3001I32\u3001U32\u3001I64\u3001U64\u3001F32\u3001F64\n\u8fd4\u56de\u503c\uff1a\nnumber \u8bfb\u53d6\u7684\u6570\u636e\uff0c\u5982\u679c\u8d8a\u754c\u5219\u4e3anil\n\u4f8b\u5b50\uff1a\nlocal data = buff:readI8()\nlocal data = buff:readU32()\n", "prefix": "buff:read\u7c7b\u578b"}, "buff:write\u7c7b\u578b": {"body": "buff:write\u7c7b\u578b()", "description": "buff:write\u7c7b\u578b() - \u5199\u5165\u4e00\u4e2a\u6307\u5b9a\u7c7b\u578b\u7684\u6570\u636e\uff08\u4ece\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u5f00\u59cb\uff1b\u6267\u884c\u540e\u6307\u9488\u4f1a\u5411\u540e\u79fb\u52a8\uff09\n\u4f20\u5165\u503c\uff1a\nnumber \u5f85\u5199\u5165\u7684\u6570\u636e\n\u6ce8\u91ca \u5199\u5165\u7c7b\u578b\u53ef\u4e3a\uff1aI8\u3001U8\u3001I16\u3001U16\u3001I32\u3001U32\u3001I64\u3001U64\u3001F32\u3001F64\n\u8fd4\u56de\u503c\uff1a\nnumber \u6210\u529f\u5199\u5165\u7684\u957f\u5ea6\n\u4f8b\u5b50\uff1a\nlocal len = buff:writeI8(10)\nlocal len = buff:writeU32(1024)\n", "prefix": "buff:write\u7c7b\u578b"}, "buff:toStr": {"body": "buff:toStr(${1:offset},${2:length})", "description": "buff:toStr(offset,length) - \u6309\u8d77\u59cb\u4f4d\u7f6e\u548c\u957f\u5ea6\u53d6\u51fa\u6570\u636e\uff08\u4e0e\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u65e0\u5173\uff1b\u6267\u884c\u540e\u6307\u9488\u4f4d\u7f6e\u4e0d\u53d8\uff09\n\u4f20\u5165\u503c\uff1a\nint \u6570\u636e\u7684\u8d77\u59cb\u4f4d\u7f6e\uff08\u8d77\u59cb\u4f4d\u7f6e\u4e3a0\uff09,\u9ed8\u8ba4\u503c\u4e5f\u662f0\nint \u6570\u636e\u7684\u957f\u5ea6,\u9ed8\u8ba4\u662f\u5168\u90e8\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nstring \u8bfb\u51fa\u6765\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\nlocal s = buff:toStr(0,5)--\u8bfb\u53d6\u5f00\u5934\u7684\u4e94\u4e2a\u5b57\u8282\u6570\u636e\nlocal s = buff:toStr() -- \u53d6\u51fa\u6574\u4e2azbuff\u7684\u6570\u636e\nlocal s = buff:toStr(0, buff:used()) -- \u53d6\u51fa\u5df2\u4f7f\u7528\u7684\u90e8\u5206, \u4e0ebuff:query()\u4e00\u6837\n", "prefix": "buff:toStr"}, "buff:len": {"body": "buff:len()", "description": "buff:len() - \u83b7\u53d6zbuff\u5bf9\u8c61\u7684\u957f\u5ea6\uff08\u4e0e\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u65e0\u5173\uff1b\u6267\u884c\u540e\u6307\u9488\u4f4d\u7f6e\u4e0d\u53d8\uff09\n\u8fd4\u56de\u503c\uff1a\nint zbuff\u5bf9\u8c61\u7684\u957f\u5ea6\n\u4f8b\u5b50\uff1a\nlen = buff:len()\nlen = #buff\n", "prefix": "buff:len"}, "buff:setFrameBuffer": {"body": "buff:setFrameBuffer(${1:width},${2:height},${3:bit},${4:color})", "description": "buff:setFrameBuffer(width,height,bit,color) - \u8bbe\u7f6ebuff\u5bf9\u8c61\u7684FrameBuffer\u5c5e\u6027\uff08\u4e0e\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u65e0\u5173\uff1b\u6267\u884c\u540e\u6307\u9488\u4f4d\u7f6e\u4e0d\u53d8\uff09\n\u4f20\u5165\u503c\uff1a\nint FrameBuffer\u7684\u5bbd\u5ea6\nint FrameBuffer\u7684\u9ad8\u5ea6\nint FrameBuffer\u7684\u8272\u4f4d\u6df1\u5ea6\nint FrameBuffer\u7684\u521d\u59cb\u989c\u8272\n\u8fd4\u56de\u503c\uff1a\nbool \u8bbe\u7f6e\u6210\u529f\u4f1a\u8fd4\u56detrue\n\u4f8b\u5b50\uff1a\nresult = buff:setFrameBuffer(320,240,16,0xffff)\n", "prefix": "buff:setFrameBuffer"}, "buff:pixel": {"body": "buff:pixel(${1:x},${2:y},${3:color})", "description": "buff:pixel(x,y,color) - \u8bbe\u7f6e\u6216\u83b7\u53d6FrameBuffer\u67d0\u4e2a\u50cf\u7d20\u70b9\u7684\u989c\u8272\uff08\u4e0e\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u65e0\u5173\uff1b\u6267\u884c\u540e\u6307\u9488\u4f4d\u7f6e\u4e0d\u53d8\uff09\n\u4f20\u5165\u503c\uff1a\nint \u4e0e\u6700\u5de6\u8fb9\u7684\u8ddd\u79bb\uff0c\u8303\u56f4\u662f0~\u5bbd\u5ea6-1\nint \u4e0e\u6700\u4e0a\u8fb9\u7684\u8ddd\u79bb\uff0c\u8303\u56f4\u662f0~\u9ad8\u5ea6-1\nint \u989c\u8272\uff0c\u5982\u679c\u7559\u7a7a\u5219\u8868\u793a\u83b7\u53d6\u8be5\u4f4d\u7f6e\u7684\u989c\u8272\n\u8fd4\u56de\u503c\uff1a\nany \u8bbe\u7f6e\u989c\u8272\u65f6\uff0c\u8bbe\u7f6e\u6210\u529f\u4f1a\u8fd4\u56detrue\uff1b\u8bfb\u53d6\u989c\u8272\u65f6\uff0c\u8fd4\u56de\u989c\u8272\u7684\u503c\uff0c\u8bfb\u53d6\u5931\u8d25\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nrerult = buff:pixel(0,3,0)\ncolor = buff:pixel(0,3)\n", "prefix": "buff:pixel"}, "buff:drawLine": {"body": "buff:drawLine(${1:x1},${2:y1},${3:x2},${4:y2},${5:color})", "description": "buff:drawLine(x1,y1,x2,y2,color) - \u753b\u4e00\u6761\u7ebf\uff08\u4e0e\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u65e0\u5173\uff1b\u6267\u884c\u540e\u6307\u9488\u4f4d\u7f6e\u4e0d\u53d8\uff09\n\u4f20\u5165\u503c\uff1a\nint \u8d77\u59cb\u5750\u6807\u70b9\u4e0e\u6700\u5de6\u8fb9\u7684\u8ddd\u79bb\uff0c\u8303\u56f4\u662f0~\u5bbd\u5ea6-1\nint \u8d77\u59cb\u5750\u6807\u70b9\u4e0e\u6700\u4e0a\u8fb9\u7684\u8ddd\u79bb\uff0c\u8303\u56f4\u662f0~\u9ad8\u5ea6-1\nint \u7ed3\u675f\u5750\u6807\u70b9\u4e0e\u6700\u5de6\u8fb9\u7684\u8ddd\u79bb\uff0c\u8303\u56f4\u662f0~\u5bbd\u5ea6-1\nint \u7ed3\u675f\u5750\u6807\u70b9\u4e0e\u6700\u4e0a\u8fb9\u7684\u8ddd\u79bb\uff0c\u8303\u56f4\u662f0~\u9ad8\u5ea6-1\nint \u53ef\u9009\uff0c\u989c\u8272\uff0c\u9ed8\u8ba4\u4e3a0\n\u8fd4\u56de\u503c\uff1a\nbool \u753b\u6210\u529f\u4f1a\u8fd4\u56detrue\n\u4f8b\u5b50\uff1a\nrerult = buff:drawLine(0,0,2,3,0xffff)\n", "prefix": "buff:drawLine"}, "buff:drawRect": {"body": "buff:drawRect(${1:x1},${2:y1},${3:x2},${4:y2},${5:color},${6:fill})", "description": "buff:drawRect(x1,y1,x2,y2,color,fill) - \u753b\u4e00\u4e2a\u77e9\u5f62\uff08\u4e0e\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u65e0\u5173\uff1b\u6267\u884c\u540e\u6307\u9488\u4f4d\u7f6e\u4e0d\u53d8\uff09\n\u4f20\u5165\u503c\uff1a\nint \u8d77\u59cb\u5750\u6807\u70b9\u4e0e\u6700\u5de6\u8fb9\u7684\u8ddd\u79bb\uff0c\u8303\u56f4\u662f0~\u5bbd\u5ea6-1\nint \u8d77\u59cb\u5750\u6807\u70b9\u4e0e\u6700\u4e0a\u8fb9\u7684\u8ddd\u79bb\uff0c\u8303\u56f4\u662f0~\u9ad8\u5ea6-1\nint \u7ed3\u675f\u5750\u6807\u70b9\u4e0e\u6700\u5de6\u8fb9\u7684\u8ddd\u79bb\uff0c\u8303\u56f4\u662f0~\u5bbd\u5ea6-1\nint \u7ed3\u675f\u5750\u6807\u70b9\u4e0e\u6700\u4e0a\u8fb9\u7684\u8ddd\u79bb\uff0c\u8303\u56f4\u662f0~\u9ad8\u5ea6-1\nint \u53ef\u9009\uff0c\u989c\u8272\uff0c\u9ed8\u8ba4\u4e3a0\nbool \u53ef\u9009\uff0c\u662f\u5426\u5728\u5185\u90e8\u586b\u5145\uff0c\u9ed8\u8ba4nil\n\u8fd4\u56de\u503c\uff1a\nbool \u753b\u6210\u529f\u4f1a\u8fd4\u56detrue\n\u4f8b\u5b50\uff1a\nrerult = buff:drawRect(0,0,2,3,0xffff)\n", "prefix": "buff:drawRect"}, "buff:drawCircle": {"body": "buff:drawCircle(${1:x},${2:y},${3:r},${4:color},${5:fill})", "description": "buff:drawCircle(x,y,r,color,fill) - \u753b\u4e00\u4e2a\u5706\u5f62\uff08\u4e0e\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u65e0\u5173\uff1b\u6267\u884c\u540e\u6307\u9488\u4f4d\u7f6e\u4e0d\u53d8\uff09\n\u4f20\u5165\u503c\uff1a\nint **\u5706\u5fc3**\u4e0e\u6700\u5de6\u8fb9\u7684\u8ddd\u79bb\uff0c\u8303\u56f4\u662f0~\u5bbd\u5ea6-1\nint **\u5706\u5fc3**\u4e0e\u6700\u4e0a\u8fb9\u7684\u8ddd\u79bb\uff0c\u8303\u56f4\u662f0~\u9ad8\u5ea6-1\nint \u5706\u7684\u534a\u5f84\nint \u53ef\u9009\uff0c\u5706\u7684\u989c\u8272\uff0c\u9ed8\u8ba4\u4e3a0\nbool \u53ef\u9009\uff0c\u662f\u5426\u5728\u5185\u90e8\u586b\u5145\uff0c\u9ed8\u8ba4nil\n\u8fd4\u56de\u503c\uff1a\nbool \u753b\u6210\u529f\u4f1a\u8fd4\u56detrue\n\u4f8b\u5b50\uff1a\nrerult = buff:drawCircle(15,5,3,0xC)\nrerult = buff:drawCircle(15,5,3,0xC,true)\n", "prefix": "buff:drawCircle"}, "buff[n": {"body": "buff[n]", "description": "buff[n] - \u4ee5\u4e0b\u6807\u5f62\u5f0f\u8fdb\u884c\u6570\u636e\u8bfb\u5199\uff08\u4e0e\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u65e0\u5173\uff1b\u6267\u884c\u540e\u6307\u9488\u4f4d\u7f6e\u4e0d\u53d8\uff09\n\u4f20\u5165\u503c\uff1a\nint \u7b2c\u51e0\u4e2a\u6570\u636e\uff0c\u4ee50\u5f00\u59cb\u7684\u4e0b\u6807\uff08C\u6807\u51c6\uff09\n\u8fd4\u56de\u503c\uff1a\nnumber \u8be5\u4f4d\u7f6e\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\nbuff[0] = 0xc8\nlocal data = buff[0]\n", "prefix": "buff[n"}, "buff:free": {"body": "buff:free()", "description": "buff:free() - \u91ca\u653ezbuff\u6240\u7533\u8bf7\u5185\u5b58 \u6ce8\u610f\uff1agc\u65f6\u4f1a\u81ea\u52a8\u91ca\u653ezbuff\u4ee5\u53cazbuff\u6240\u7533\u8bf7\u5185\u5b58\uff0c\u6240\u4ee5\u901a\u5e38\u65e0\u9700\u8c03\u7528\u6b64\u51fd\u6570\uff0c\u8c03\u7528\u524d\u8bf7\u786e\u8ba4\u60a8\u5df2\u6e05\u695a\u6b64\u51fd\u6570\u7528\u5904\uff01\u8c03\u7528\u6b64\u51fd\u6570\u5e76\u4e0d\u4f1a\u91ca\u653e\u6389zbuff\uff0c\u4ec5\u4f1a\u91ca\u653e\u6389zbuff\u6240\u7533\u8bf7\u7684\u5185\u5b58\uff0czbuff\u9700\u7b49gc\u65f6\u81ea\u52a8\u91ca\u653e\uff01\uff01\uff01\n\u4f8b\u5b50\uff1a\nbuff:free()\n", "prefix": "buff:free"}, "buff:resize": {"body": "buff:resize(${1:n})", "description": "buff:resize(n) - \u8c03\u6574zbuff\u5b9e\u9645\u5206\u914d\u7a7a\u95f4\u7684\u5927\u5c0f\uff0c\u7c7b\u4f3c\u4e8erealloc\u7684\u6548\u679c\uff0cnew = realloc(old, n)\uff0c\u53ef\u4ee5\u6269\u5927\u6216\u8005\u7f29\u5c0f\uff08\u5982\u679c\u7f29\u5c0f\u540elen\u5c0f\u4e8e\u4e86used\uff0c\u90a3\u4e48used=\u65b0len\uff09\n\u4f20\u5165\u503c\uff1a\nint \u65b0\u7a7a\u95f4\u5927\u5c0f\n\u4f8b\u5b50\uff1a\nbuff:resize(20)\n", "prefix": "buff:resize"}, "buff:copy": {"body": "buff:copy(${1:start},${2:para},${3:...})", "description": "buff:copy(start, para,...) - zbuff\u52a8\u6001\u5199\u6570\u636e\uff0c\u7c7b\u4f3c\u4e8ememcpy\u6548\u679c\uff0c\u5f53\u539f\u6709\u7a7a\u95f4\u4e0d\u8db3\u65f6\u52a8\u6001\u6269\u5927\u7a7a\u95f4\n\u4f20\u5165\u503c\uff1a\nint \u5199\u5165buff\u7684\u8d77\u59cb\u4f4d\u7f6e\uff0c\u5982\u679c\u4e0d\u4e3a\u6570\u5b57\uff0c\u5219\u4e3abuff\u7684used\uff0c\u5982\u679c\u5c0f\u4e8e0\uff0c\u5219\u4eceused\u5f80\u524d\u6570\uff0c-1 = used - 1\nany \u5199\u5165buff\u7684\u6570\u636e\uff0cstring\u6216zbuff\u8005\u65f6\u4e3a\u4e00\u4e2a\u53c2\u6570\uff0cnumber\u65f6\u53ef\u4e3a\u591a\u4e2a\u53c2\u6570\n\u8fd4\u56de\u503c\uff1a\nnumber \u6570\u636e\u6210\u529f\u5199\u5165\u7684\u957f\u5ea6\n\u4f8b\u5b50\uff1a\nlocal len = buff:copy(nil, \"123\") -- \u7c7b\u4f3c\u4e8ememcpy(&buff[used], \"123\", 3) used+= 3 \u4ecebuff\u5f00\u59cb\u5199\u5165\u6570\u636e,\u6307\u9488\u76f8\u5e94\u5730\u5f80\u540e\u79fb\u52a8\nlocal len = buff:copy(0, \"123\") -- \u7c7b\u4f3c\u4e8ememcpy(&buff[0], \"123\", 3) if (used < 3) used = 3 \u4ece\u4f4d\u7f6e0\u5199\u5165\u6570\u636e,\u6307\u9488\u6709\u53ef\u80fd\u4f1a\u79fb\u52a8\nlocal len = buff:copy(2, 0x1a,0x30,0x31,0x32,0x00,0x01) -- \u7c7b\u4f3c\u4e8ememcpy(&buff[2], [0x1a,0x30,0x31,0x32,0x00,0x01], 6) if (used < (2+6)) used = (2+6)\u4ece\u4f4d\u7f6e2\u5f00\u59cb\uff0c\u6309\u6570\u503c\u5199\u5165\u591a\u4e2a\u5b57\u8282\u6570\u636e\nlocal len = buff:copy(9, buff2) -- \u7c7b\u4f3c\u4e8ememcpy(&buff[9], &buff2[0], buff2\u7684used) if (used < (9+buff2\u7684used)) used = (9+buff2\u7684used) \u4ece\u4f4d\u7f6e9\u5f00\u59cb\uff0c\u5408\u5e76\u5165buff2\u91cc0~used\u7684\u5185\u5bb9\nlocal len = buff:copy(5, buff2, 10, 1024) -- \u7c7b\u4f3c\u4e8ememcpy(&buff[5], &buff2[10], 1024) if (used < (5+1024)) used = (5+1024)\n", "prefix": "buff:copy"}, "buff:used": {"body": "buff:used()", "description": "buff:used() - \u83b7\u53d6zbuff\u91cc\u6700\u540e\u4e00\u4e2a\u6570\u636e\u4f4d\u7f6e\u6307\u9488\u5230\u9996\u5730\u5740\u7684\u504f\u79fb\u91cf\uff0c\u6765\u8868\u793azbuff\u5185\u5df2\u6709\u6709\u6548\u6570\u636e\u91cf\u5927\u5c0f\uff0c\u6ce8\u610f\u8fd9\u4e2a\u4e0d\u540c\u4e8e\u5206\u914d\u7684\u7a7a\u95f4\u5927\u5c0f\uff0c\u7531\u4e8eseek()\u4f1a\u6539\u53d8\u6700\u540e\u4e00\u4e2a\u6570\u636e\u4f4d\u7f6e\u6307\u9488\uff0c\u56e0\u6b64\u4e5f\u4f1a\u5f71\u54cd\u5230used()\u8fd4\u56de\u503c\u3002\n\u8fd4\u56de\u503c\uff1a\nint \u6709\u6548\u6570\u636e\u91cf\u5927\u5c0f\n\u4f8b\u5b50\uff1a\nbuff:used()\n", "prefix": "buff:used"}, "buff:del": {"body": "buff:del(${1:offset},${2:length})", "description": "buff:del(offset,length) - \u5220\u9664zbuff 0~used\u8303\u56f4\u5185\u7684\u4e00\u6bb5\u6570\u636e\uff0c\u6ce8\u610f\u53ea\u662f\u6539\u53d8\u4e86used\u7684\u503c\uff0c\u5e76\u4e0d\u662f\u771f\u7684\u5728ram\u91cc\u53bb\u6e05\u9664\u6389\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u8d77\u59cb\u4f4d\u7f6estart, \u9ed8\u8ba40\uff0c\u5982\u679c<0\u5219\u4eceused\u5f80\u524d\u6570\uff0c\u6bd4\u5982 -1 \u90a3\u4e48start= used - 1\nint \u957f\u5ea6del_len\uff0c\u9ed8\u8ba4\u4e3aused\uff0c\u5982\u679cstart + del_len\u6570\u503c\u5927\u4e8eused\uff0c\u4f1a\u5f3a\u5236\u8c03\u6574del_len = used - start\n\u4f8b\u5b50\uff1a\nbuff:del(1,4) --\u4ece\u4f4d\u7f6e1\u5f00\u59cb\u5220\u96644\u4e2a\u5b57\u8282\u6570\u636e\nbuff:del(-1,4) --\u4ece\u4f4d\u7f6eused-1\u5f00\u59cb\u5220\u96644\u4e2a\u5b57\u8282\u6570\u636e\uff0c\u4f46\u662f\u8fd9\u80af\u5b9a\u4f1a\u8d85\u8fc7used\uff0c\u6240\u4ee5del_len\u4f1a\u8c03\u6574\u4e3a1\uff0c\u5b9e\u9645\u4e0a\u5c31\u662f\u5220\u6389\u4e86\u6700\u540e\u4e00\u4e2a\u5b57\u8282\n", "prefix": "buff:del"}, "buff:query": {"body": "buff:query(${1:offset},${2:length},${3:isbigend},${4:issigned},${5:isfloat})", "description": "buff:query(offset,length,isbigend,issigned,isfloat) - \u6309\u8d77\u59cb\u4f4d\u7f6e\u548c\u957f\u5ea60~used\u8303\u56f4\u5185\u53d6\u51fa\u6570\u636e\uff0c\u5982\u679c\u662f1,2,4,8\u5b57\u8282\uff0c\u6839\u636e\u540e\u7eed\u53c2\u6570\u8f6c\u6362\u6210\u6d6e\u70b9\u6216\u8005\u6574\u5f62\n\u4f20\u5165\u503c\uff1a\nint \u6570\u636e\u7684\u8d77\u59cb\u4f4d\u7f6e\uff08\u8d77\u59cb\u4f4d\u7f6e\u4e3a0\uff09\nint \u6570\u636e\u7684\u957f\u5ea6\nboolean \u662f\u5426\u662f\u5927\u7aef\u683c\u5f0f\uff0c\u5982\u679c\u4e3anil\uff0c\u5219\u4e0d\u4f1a\u8f6c\u6362\uff0c\u76f4\u63a5\u5b57\u8282\u6d41\u8f93\u51fa\nboolean \u662f\u5426\u662f\u6709\u7b26\u53f7\u7684\uff0c\u9ed8\u8ba4\u4e3afalse\nboolean \u662f\u5426\u662f\u6d6e\u70b9\u578b\uff0c\u9ed8\u8ba4\u4e3afalse\n\u8fd4\u56de\u503c\uff1a\nstring \u8bfb\u51fa\u6765\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\nlocal s = buff:query(0,5)--\u8bfb\u53d6\u5f00\u5934\u7684\u4e94\u4e2a\u5b57\u8282\u6570\u636e\n", "prefix": "buff:query"}, "buff:set": {"body": "buff:set(${1:start},${2:num},${3:len})", "description": "buff:set(start, num, len) - zbuff\u7684\u7c7b\u4f3c\u4e8ememset\u64cd\u4f5c\uff0c\u7c7b\u4f3c\u4e8ememset(&buff[start], num, len)\uff0c\u5f53\u7136\u6709ram\u8d8a\u754c\u4fdd\u62a4\uff0c\u4f1a\u5bf9len\u6709\u4e00\u5b9a\u7684\u9650\u5236\n\u4f20\u5165\u503c\uff1a\nint \u53ef\u9009\uff0c\u5f00\u59cb\u4f4d\u7f6e\uff0c\u9ed8\u8ba4\u4e3a0,\nint \u53ef\u9009\uff0c\u9ed8\u8ba4\u4e3a0\u3002\u8981\u8bbe\u7f6e\u4e3a\u7684\u503c\nint \u53ef\u9009\uff0c\u957f\u5ea6\uff0c\u9ed8\u8ba4\u4e3a\u5168\u90e8\u7a7a\u95f4\uff0c\u5982\u679c\u8d85\u51fa\u8303\u56f4\u4e86\uff0c\u4f1a\u81ea\u52a8\u622a\u65ad\n\u4f8b\u5b50\uff1a\n-- \u5168\u90e8\u521d\u59cb\u5316\u4e3a0\nbuff:set() --\u7b49\u540c\u4e8e memset(buff, 0, sizeof(buff))\nbuff:set(8) --\u7b49\u540c\u4e8e memset(&buff[8], 0, sizeof(buff) - 8)\nbuff:set(0, 0x55) --\u7b49\u540c\u4e8e memset(buff, 0x55, sizeof(buff))\nbuff:set(4, 0xaa, 12) --\u7b49\u7528\u4e8e memset(&buff[4], 0xaa, 12)\n", "prefix": "buff:set"}, "buff:isEqual": {"body": "buff:isEqual(${1:start},${2:buff2},${3:start2},${4:len})", "description": "buff:isEqual(start, buff2, start2, len) - zbuff\u7684\u7c7b\u4f3c\u4e8ememcmp\u64cd\u4f5c\uff0c\u7c7b\u4f3c\u4e8ememcmp(&buff[start], &buff2[start2], len)\n\u4f20\u5165\u503c\uff1a\nint \u53ef\u9009\uff0c\u5f00\u59cb\u4f4d\u7f6e\uff0c\u9ed8\u8ba4\u4e3a0,\nzbuff \u6bd4\u8f83\u7684\u5bf9\u8c61\nint \u53ef\u9009\uff0c\u6bd4\u8f83\u7684\u5bf9\u8c61\u7684\u5f00\u59cb\u4f4d\u7f6e\uff0c\u9ed8\u8ba4\u4e3a0\nint \u6bd4\u8f83\u957f\u5ea6\n\u8fd4\u56de\u503c\uff1a\nboolean true\u76f8\u7b49\uff0cfalse\u4e0d\u76f8\u7b49\nint \u76f8\u7b49\u8fd4\u56de0\uff0c\u4e0d\u76f8\u7b49\u8fd4\u56de\u7b2c\u4e00\u4e2a\u4e0d\u76f8\u7b49\u4f4d\u7f6e\u7684\u5e8f\u53f7\n\u4f8b\u5b50\uff1a\nlocal result, offset = buff:isEqual(1, buff2, 2, 10) --\u7b49\u540c\u4e8ememcmp(&buff[1], &buff2[2], 10)\n", "prefix": "buff:isEqual"}, "zlib.c": {"body": "zlib.c(${1:input_file},${2:output_file})", "description": "zlib.c(input_file,output_file) - zlib\u538b\u7f29(\u9700\u8981\u5927\u7ea6270k\u5185\u5b58\uff0c\u5927\u90e8\u5206mcu\u4e0d\u652f\u6301)\n\u4f20\u5165\u503c\uff1a\nstring input_file \u8f93\u5165\u6587\u4ef6\nstring output_file \u8f93\u51fa\u6587\u4ef6\n\u8fd4\u56de\u503c\uff1a\nbool \u6b63\u5e38\u8fd4\u56de ture \u5931\u8d25\u8fd4\u56de false\n\u4f8b\u5b50\uff1a\nzlib.c(\"/sd/1.txt\",\"/sd/zlib\")\n", "prefix": "zlib.c"}, "zlib.d": {"body": "zlib.d(${1:input_file},${2:output_file})", "description": "zlib.d(input_file,output_file) - zlib\u89e3\u538b\u7f29(\u9700\u8981\u5927\u7ea618k\u5185\u5b58\uff0c\u5927\u90e8\u5206mcu\u90fd\u652f\u6301)\n\u4f20\u5165\u503c\uff1a\nstring input_file \u8f93\u5165\u6587\u4ef6\nstring output_file \u8f93\u51fa\u6587\u4ef6\n\u8fd4\u56de\u503c\uff1a\nbool \u6b63\u5e38\u8fd4\u56de ture \u5931\u8d25\u8fd4\u56de false\n\u4f8b\u5b50\uff1a\nzlib.d(\"/sd/zlib\",\"/sd/1.txt\")\n", "prefix": "zlib.d"}} \ No newline at end of file +{"_G": {"body": "_G(${0:...})", "description": "_G", "prefix": "_G"}, "_VERSION": {"body": "_VERSION(${0:...})", "description": "_VERSION", "prefix": "_VERSION"}, "assert": {"body": "assert(${1:v}${2:[, message]})", "description": "assert()", "prefix": "assert"}, "collectgarbage": {"body": "collectgarbage(${1:[opt]}${2:[, arg]})", "description": "collectgarbage()", "prefix": "collectgarbage"}, "coroutine.create": {"body": "coroutine.create( ${1:function} )", "description": "coroutine.create", "prefix": "coroutine.create"}, "coroutine.isyieldable": {"body": "coroutine.isyieldable( )", "description": "coroutine.isyieldable", "prefix": "coroutine.isyieldable"}, "coroutine.resume": {"body": "coroutine.resume( ${1:co}${2:[, val1, \u00b7\u00b7\u00b7]} )", "description": "coroutine.resume", "prefix": "coroutine.resume"}, "coroutine.running": {"body": "coroutine.running( )", "description": "coroutine.running", "prefix": "coroutine.running"}, "coroutine.status": {"body": "coroutine.status( ${1:co} )", "description": "coroutine.status", "prefix": "coroutine.status"}, "coroutine.wrap": {"body": "coroutine.wrap( ${1:function} )", "description": "coroutine.wrap", "prefix": "coroutine.wrap"}, "coroutine.yield": {"body": "coroutine.yield( ${1:...} )", "description": "coroutine.yield", "prefix": "coroutine.yield"}, "debug.debug": {"body": "debug.debug()", "description": "debug.debug ()", "prefix": "debug.debug"}, "debug.getfenv": {"body": "debug.getfenv(${0:...})", "description": "debug.getfenv (o)", "prefix": "debug.getfenv"}, "debug.gethook": {"body": "debug.gethook( ${1:[thread]} )", "description": "debug.gethook ([thread])", "prefix": "debug.gethook"}, "debug.getinfo": {"body": "debug.getinfo( ${1:[thread],}${2:f}${3:[, what]} )", "description": "debug.getinfo ([thread,] f [, what])", "prefix": "debug.getinfo"}, "debug.getlocal": {"body": "debug.getlocal( ${1:[thread],}${2:f}${3:[, local]} )", "description": "debug.getlocal ([thread,] f, local)", "prefix": "debug.getlocal"}, "debug.getmetatable": {"body": "debug.getmetatable( ${1:value} )", "description": "debug.getmetatable (value)", "prefix": "debug.getmetatable"}, "debug.getregistry": {"body": "debug.getregistry()", "description": "debug.getregistry ()", "prefix": "debug.getregistry"}, "debug.getupvalue": {"body": "debug.getupvalue( ${1:f}, ${2:up} )", "description": "debug.getupvalue (f, up)", "prefix": "debug.getupvalue"}, "debug.getuservalue": {"body": "debug.getuservalue(${0:...})", "description": "debug.getuservalue (u)", "prefix": "debug.getuservalue"}, "debug.getuservalue ": {"body": "debug.getuservalue ( ${1:u} )", "description": "debug.getuservalue (u)", "prefix": "debug.getuservalue "}, "debug.setfenv": {"body": "debug.setfenv(${0:...})", "description": "debug.setfenv (object, table)", "prefix": "debug.setfenv"}, "debug.sethook": {"body": "debug.sethook( ${1:[thead,]}${2:hook}, ${3:mask}${4:[, count]} )", "description": "debug.sethook ([thread,] hook, mask [, count])", "prefix": "debug.sethook"}, "debug.setlocal": {"body": "debug.setlocal( ${1:[thead,]}${2:level}, ${3:local}, ${4:value} )", "description": "debug.setlocal ([thread,] level, local, value)", "prefix": "debug.setlocal"}, "debug.setmetatable": {"body": "debug.setmetatable( ${1:value}, ${2:table} )", "description": "debug.setmetatable (value, table)", "prefix": "debug.setmetatable"}, "debug.setupvalue": {"body": "debug.setupvalue( ${1:f}, ${2:up}, ${3:value} )", "description": "debug.setupvalue (f, up, value)", "prefix": "debug.setupvalue"}, "debug.setuservalue": {"body": "debug.setuservalue( ${1:udata}, ${2:value} )", "description": "debug.setuservalue (udata, value)", "prefix": "debug.setuservalue"}, "debug.traceback": {"body": "debug.traceback( ${1:[thread,]}${2:[message]}${3:[, level]} )", "description": "debug.traceback ([thread,] [message [, level]])", "prefix": "debug.traceback"}, "debug.upvalueid": {"body": "debug.upvalueid( ${1:f}, ${2:n})", "description": "debug.upvalueid (f, n)", "prefix": "debug.upvalueid"}, "debug.upvaluejoin": {"body": "debug.upvaluejoin( ${1:f1}, ${2:n1}, ${3:f2}, ${4:n2} )", "description": "debug.upvaluejoin (f1, n1, f2, n2)", "prefix": "debug.upvaluejoin"}, "dofile": {"body": "dofile(${1:[filename]})", "description": "dofile ([filename])", "prefix": "dofile"}, "elif": {"body": "else if ${1:condition} then\n\t${0:-- body}\n", "description": "elif", "prefix": "elif"}, "error": {"body": "error(${0:...})", "description": "error (message [, level])", "prefix": "error"}, "file:close": {"body": "file:close(${0:...})", "description": "file:close ()", "prefix": "file:close"}, "file:flush": {"body": "file:flush(${0:...})", "description": "file:flush ()", "prefix": "file:flush"}, "file:lines": {"body": "file:lines(${0:...})", "description": "file:lines ()", "prefix": "file:lines"}, "file:read": {"body": "file:read(${0:...})", "description": "file:read (...)", "prefix": "file:read"}, "file:seek": {"body": "file:seek(${0:...})", "description": "file:seek ([whence] [, offset])", "prefix": "file:seek"}, "file:setvbuf": {"body": "file:setvbuf(${0:...})", "description": "file:setvbuf (mode [, size])", "prefix": "file:setvbuf"}, "file:write": {"body": "file:write(${0:...})", "description": "file:write (...)", "prefix": "file:write"}, "for": {"body": "for ${1:i}=${2:1},${3:10} do\n\t${0:print(i)}\nend", "description": "for i=1,10", "prefix": "for"}, "fori": {"body": "for ${1:i},${2:v} in ipairs(${3:table_name}) do\n\t${0:print(i,v)}\nend", "description": "for i,v in ipairs()", "prefix": "fori"}, "forp": {"body": "for ${1:k},${2:v} in pairs(${3:table_name}) do\n\t${0:print(k,v)}\nend", "description": "for k,v in pairs()", "prefix": "forp"}, "fun": {"body": "function ${1:function_name}( ${2:...} )\n\t${0:-- body}\nend", "description": "function", "prefix": "fun"}, "function": {"body": "function ${1:function_name}( ${2:...} )\n\t${0:-- body}\nend", "description": "function", "prefix": "function"}, "getfenv": {"body": "getfenv(${0:...})", "description": "getfenv ([f])", "prefix": "getfenv"}, "getmetatable": {"body": "getmetatable(${1:object})", "description": "getmetatable (object)", "prefix": "getmetatable"}, "if": {"body": "if ${1:condition} then\n\t${0:-- body}\nend", "description": "if", "prefix": "if"}, "ifel": {"body": "if ${1:condition} then\n\t${2:-- body}\nelse\n\t${0:-- body}\nend", "description": "ifel", "prefix": "ifel"}, "io.close": {"body": "io.close(${0:...})", "description": "io.close ([file])", "prefix": "io.close"}, "io.flush": {"body": "io.flush(${0:...})", "description": "io.flush ()", "prefix": "io.flush"}, "io.input": {"body": "io.input(${0:...})", "description": "io.input ([file])", "prefix": "io.input"}, "io.lines": {"body": "io.lines(${0:...})", "description": "io.lines ([filename])", "prefix": "io.lines"}, "io.open": {"body": "io.open(${0:...})", "description": "io.open (filename [, mode])", "prefix": "io.open"}, "io.output": {"body": "io.output(${0:...})", "description": "io.output ([file])", "prefix": "io.output"}, "io.popen": {"body": "io.popen(${0:...})", "description": "io.popen (prog [, mode])", "prefix": "io.popen"}, "io.read": {"body": "io.read(${0:...})", "description": "io.read (...)", "prefix": "io.read"}, "io.tmpfile": {"body": "io.tmpfile(${0:...})", "description": "io.tmpfile ()", "prefix": "io.tmpfile"}, "io.type": {"body": "io.type(${0:...})", "description": "io.type (obj)", "prefix": "io.type"}, "io.write": {"body": "io.write(${0:...})", "description": "io.write (...)", "prefix": "io.write"}, "ipairs": {"body": "ipairs(${0:...})", "description": "ipairs (t)", "prefix": "ipairs"}, "load": {"body": "load(${0:...})", "description": "load (func [, chunkname])", "prefix": "load"}, "loadfile": {"body": "loadfile(${0:...})", "description": "loadfile ([filename])", "prefix": "loadfile"}, "loadstring": {"body": "loadstring(${0:...})", "description": "loadstring (string [, chunkname])", "prefix": "loadstring"}, "local": {"body": "local ${1:x} = ${0:1}", "description": "local x = 1", "prefix": "local"}, "math.abs": {"body": "math.abs( ${1:x} )", "description": "math.abs", "prefix": "math.abs"}, "math.acos": {"body": "math.acos( ${1:x} )", "description": "math.acos", "prefix": "math.acos"}, "math.asin": {"body": "math.asin( ${1:x} )", "description": "math.asin", "prefix": "math.asin"}, "math.atan": {"body": "math.atan( ${1:y}${2:[, x]} )", "description": "math.atan", "prefix": "math.atan"}, "math.atan2": {"body": "math.atan2(${0:...})", "description": "math.atan2 (y, x)", "prefix": "math.atan2"}, "math.ceil": {"body": "math.ceil( ${1:x} )", "description": "math.ceil", "prefix": "math.ceil"}, "math.cos": {"body": "math.cos( ${1:x} )", "description": "math.cos", "prefix": "math.cos"}, "math.cosh": {"body": "math.cosh(${0:...})", "description": "math.cosh (x)", "prefix": "math.cosh"}, "math.deg": {"body": "math.deg( ${1:x} )", "description": "math.deg", "prefix": "math.deg"}, "math.exp": {"body": "math.exp( ${1:x} )", "description": "math.exp", "prefix": "math.exp"}, "math.floor": {"body": "math.floor( ${1:x} )", "description": "math.floor", "prefix": "math.floor"}, "math.fmod": {"body": "math.fmod( ${1:x},${2:y} )", "description": "math.fmod", "prefix": "math.fmod"}, "math.frexp": {"body": "math.frexp(${0:...})", "description": "math.frexp (x)", "prefix": "math.frexp"}, "math.huge": {"body": "math.huge(${0:...})", "description": "math.huge", "prefix": "math.huge"}, "math.ldexp": {"body": "math.ldexp(${0:...})", "description": "math.ldexp (m, e)", "prefix": "math.ldexp"}, "math.log": {"body": "math.log( ${1:x}${2:[, base]} )", "description": "math.log", "prefix": "math.log"}, "math.log10": {"body": "math.log10(${0:...})", "description": "math.log10 (x)", "prefix": "math.log10"}, "math.math.randomseed": {"body": "math.math.randomseed( ${1:x} )", "description": "math.math.randomseed", "prefix": "math.math.randomseed"}, "math.max": {"body": "math.max( ${1:x},${2:...} )", "description": "math.max", "prefix": "math.max"}, "math.maxinteger": {"body": "math.maxinteger(${0:...})", "description": "math.maxinteger", "prefix": "math.maxinteger"}, "math.min": {"body": "math.min( ${1:x},${2:...} )", "description": "math.min", "prefix": "math.min"}, "math.mininteger": {"body": "math.mininteger(${0:...})", "description": "math.mininteger", "prefix": "math.mininteger"}, "math.modf": {"body": "math.modf( ${1:x} )", "description": "math.modf", "prefix": "math.modf"}, "math.pi": {"body": "math.pi(${0:...})", "description": "math.pi", "prefix": "math.pi"}, "math.pow": {"body": "math.pow(${0:...})", "description": "math.pow (x, y)", "prefix": "math.pow"}, "math.rad": {"body": "math.rad(${0:...})", "description": "math.rad (x)", "prefix": "math.rad"}, "math.random": {"body": "math.random( ${1:[m]}${2:[, n]} )", "description": "math.random", "prefix": "math.random"}, "math.randomseed": {"body": "math.randomseed(${0:...})", "description": "math.randomseed (x)", "prefix": "math.randomseed"}, "math.sin": {"body": "math.sin( ${1:x} )", "description": "math.sin", "prefix": "math.sin"}, "math.sinh": {"body": "math.sinh(${0:...})", "description": "math.sinh (x)", "prefix": "math.sinh"}, "math.sqrt": {"body": "math.sqrt( ${1:x} )", "description": "math.sqrt", "prefix": "math.sqrt"}, "math.tan": {"body": "math.tan( ${1:x} )", "description": "math.tan", "prefix": "math.tan"}, "math.tanh": {"body": "math.tanh(${0:...})", "description": "math.tanh (x)", "prefix": "math.tanh"}, "math.tointeger": {"body": "math.tointeger( ${1:x} )", "description": "math.tointeger", "prefix": "math.tointeger"}, "math.type": {"body": "math.type( ${1:x} )", "description": "math.type", "prefix": "math.type"}, "math.ult": {"body": "math.ult(${0:...})", "description": "math.ult (m, n)", "prefix": "math.ult"}, "module": {"body": "module(${0:...})", "description": "module (name [, ...])", "prefix": "module"}, "next": {"body": "next(${1:table}${2:[, index]})", "description": "next (table [, index])", "prefix": "next"}, "os.clock": {"body": "os.clock()", "description": "os.clock() - \u8fd4\u56de\u7a0b\u5e8f\u4f7f\u7528\u7684\u6309\u79d2\u8ba1 CPU \u65f6\u95f4\u7684\u8fd1\u4f3c\u503c\n\u4f20\u5165\u503c\uff1a\nreturn \u65f6\u95f4\u6233\n\u4f8b\u5b50\uff1a\n-- \u4e0d\u63a8\u8350\u4f7f\u7528\u672cAPI\n-- \u5982\u9700\u8981\u83b7\u53d6 \u65f6\u95f4\u6233, \u8bf7\u4f7f\u7528 os.time()\n-- \u5982\u9700\u83b7\u53d6\u7cfb\u7edf\u8fd0\u884c\u65f6\u957f, \u8bf7\u4f7f\u7528 mcu.ticks()\n", "prefix": "os.clock"}, "os.date": {"body": "os.date(${1:fmt},${2:time})", "description": "os.date(fmt, time) - \u65e5\u671f\u51fd\u6570\n\u4f20\u5165\u503c\uff1a\nstring \u683c\u5f0f\u5316\u5b57\u7b26\u4e32,\u53ef\u4ee5\u662fnil\ntable \u65e5\u671f\u65f6\u95f4\u7684table\n\u8fd4\u56de\u503c\uff1a\ntable/string \u6839\u636efmt\u7684\u4e0d\u540c,\u8fd4\u56de\u503c\u4e0d\u540c\n\u4f8b\u5b50\uff1a\n\n-- \u503c\u5f97\u6ce8\u610f\u7684\u51e0\u70b9:\n-- 1. \u82e5\u9700\u8981UTC\u65f6\u95f4, fmt\u7684\u7b2c\u4e00\u4e2a\u5b57\u7b26\u5199\"!\"\n-- 2. fmt\u7684\u683c\u5f0f\u5316\u9075\u5faa C \u51fd\u6570 strftime, \u53ef\u4ee5\u67e5\u9605 https://developer.aliyun.com/article/320480\n\n-- \u83b7\u53d6\u672c\u5730\u65f6\u95f4\u5b57\u7b26\u4e32\nlog.info(\"\u672c\u5730\u65f6\u95f4\u5b57\u7b26\u4e32\", os.date())\n-- \u83b7\u53d6UTC\u65f6\u95f4\u5b57\u7b26\u4e32\nlog.info(\"UTC\u65f6\u95f4\u5b57\u7b26\u4e32\", os.date(\"!%c\"))\n-- \u683c\u5f0f\u5316\u672c\u5730\u65f6\u95f4\u5b57\u7b26\u4e32\nlog.info(\"\u672c\u5730\u65f6\u95f4\u5b57\u7b26\u4e32\", os.date(\"%Y-%m-%d %H:%M:%S\"))\n-- \u683c\u5f0f\u5316UTC\u65f6\u95f4\u5b57\u7b26\u4e32\nlog.info(\"UTC\u65f6\u95f4\u5b57\u7b26\u4e32\", os.date(\"!%Y-%m-%d %H:%M:%S\"))\n-- \u683c\u5f0f\u5316\u65f6\u95f4\u5b57\u7b26\u4e32\nlog.info(\"\u81ea\u5b9a\u4e49\u65f6\u95f4\u7684\u5b57\u7b26\u4e32\", os.date(\"!%Y-%m-%d %H:%M:%S\", os.time({year=2000, mon=1, day=1, hour=0, min=0, sec=0})))\n\n-- \u83b7\u53d6\u672c\u5730\u65f6\u95f4\u7684table\nlog.info(\"\u672c\u5730\u65f6\u95f4\u5b57\u7b26\u4e32\", json.encode(os.date(\"*t\")))\n-- \u83b7\u53d6UTC\u65f6\u95f4\u7684table\nlog.info(\"UTC\u65f6\u95f4\u5b57\u7b26\u4e32\", json.encode(os.date(\"!*t\")))\n", "prefix": "os.date"}, "os.difftime": {"body": "os.difftime(${1:timeA},${2:timeB})", "description": "os.difftime(timeA, timeB) - \u65f6\u95f4\u5dee\u503c\n\u4f20\u5165\u503c\uff1a\nint \u65f6\u95f4A,\u6570\u503c\u7c7b\u578b\nint \u65f6\u95f4B,\u6570\u503c\u7c7b\u578b\n\u8fd4\u56de\u503c\uff1a\nint \u65f6\u95f4\u5dee\u503c\n", "prefix": "os.difftime"}, "os.execute": {"body": "os.execute(${0:...})", "description": "os.execute ([command])", "prefix": "os.execute"}, "os.exit": {"body": "os.exit(${0:...})", "description": "os.exit ([code])", "prefix": "os.exit"}, "os.getenv": {"body": "os.getenv(${0:...})", "description": "os.getenv (varname)", "prefix": "os.getenv"}, "os.remove": {"body": "os.remove(${1:path})", "description": "os.remove(path) - \u79fb\u9664\u6587\u4ef6\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u79fb\u9664\u7684\u6587\u4ef6\u5b8c\u6574\u8def\u5f84\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5176\u4ed6\u60c5\u51b5\u8fd4\u56denil\nstring \u5931\u8d25\u65f6\u8fd4\u56de\u539f\u56e0\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u5220\u9664\u6839\u76ee\u5f55\u4e0b\u7684\u67d0\u4e2a\u6587\u4ef6\nos.remove(\"/1.txt\")\n-- \u6ce8\u610f, \u7ebf\u5237\u65f6\u7684\u6587\u4ef6, \u4e00\u822c\u5728 /luadb \u76ee\u5f55, \u8fd9\u4e2a\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\u662f\u53ea\u8bfb\u7684\n-- \u4e5f\u5c31\u662f\u65e0\u6cd5\u6267\u884c os.remove(\"/luadb/xxx.bin\")\n", "prefix": "os.remove"}, "os.rename": {"body": "os.rename(${1:old_path},${2:new_path})", "description": "os.rename(old_path, new_path) - \u6587\u4ef6\u91cd\u547d\u540d\n\u4f20\u5165\u503c\uff1a\nstring \u6e90\u6587\u4ef6\u5b8c\u6574\u8def\u5f84\nstring \u76ee\u6807\u6587\u4ef6\u5b8c\u6574\u8def\u5f84\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5176\u4ed6\u60c5\u51b5\u8fd4\u56denil\nstring \u5931\u8d25\u65f6\u8fd4\u56de\u539f\u56e0\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f, \u53ea\u6709\u5728\u76f8\u540c\u6587\u4ef6\u7cfb\u7edf\u4e0b\u7684\u6587\u4ef6\u53ef\u4ee5\u91cd\u547d\u540d\n-- \u4f8b\u5982:\nos.rename(\"/1.txt\", \"/2.txt\")\n-- \u4e0d\u540c\u6587\u4ef6\u7cfb\u7edf, \u6216\u8005\u6e90\u6587\u4ef6\u7cfb\u7edf\u662f\u53ea\u8bfb\u7684, \u5219\u65e0\u6cd5\u6267\u884c\n--os.rename(\"/luadb/1.txt\", \"/luadb/2.txt\")\n--os.rename(\"/luadb/1.txt\", \"/2.txt\")\n", "prefix": "os.rename"}, "os.setlocale": {"body": "os.setlocale(${0:...})", "description": "os.setlocale (locale [, category])", "prefix": "os.setlocale"}, "os.time": {"body": "os.time(${1:mytime})", "description": "os.time(mytime) - \u65f6\u95f4\u6233\u51fd\u6570\n\u4f20\u5165\u503c\uff1a\ntable \u65e5\u671f\u65f6\u95f4\u7684table\nreturn \u65f6\u95f4\u6233\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f\u6ce8\u610f, \u8fd9\u4e2a\u51fd\u6570\u8fd4\u56de\u7684\u662fUTC\u65f6\u95f4\u6233\n-- \u65f6\u95f4\u6233, \u4f46lua\u4e0b\u7684\u7cbe\u5ea6\u53ea\u80fd\u5230\u79d2\nlog.info(\"UTC\u65f6\u95f4\u6233\", os.time())\nlog.info(\"\u81ea\u5b9a\u4e49\u65f6\u95f4\u6233\", os.time({year=2000, mon=1, day=1, hour=0, min=0, sec=0}))\n", "prefix": "os.time"}, "os.tmpname": {"body": "os.tmpname(${0:...})", "description": "os.tmpname ()", "prefix": "os.tmpname"}, "package.config": {"body": "package.config(${0:...})", "description": "package.config", "prefix": "package.config"}, "package.cpath": {"body": "package.cpath(${0:...})", "description": "package.cpath", "prefix": "package.cpath"}, "package.loaded": {"body": "package.loaded(${0:...})", "description": "package.loaded", "prefix": "package.loaded"}, "package.loaders": {"body": "package.loaders(${0:...})", "description": "package.loaders", "prefix": "package.loaders"}, "package.loadlib": {"body": "package.loadlib(${0:...})", "description": "package.loadlib (libname, funcname)", "prefix": "package.loadlib"}, "package.path": {"body": "package.path(${0:...})", "description": "package.path", "prefix": "package.path"}, "package.preload": {"body": "package.preload(${0:...})", "description": "package.preload", "prefix": "package.preload"}, "package.searchers": {"body": "package.searchers(${0:...})", "description": "package.searchers", "prefix": "package.searchers"}, "package.searchpath": {"body": "package.searchpath(${0:...})", "description": "package.searchpath (name, path [, sep [, rep]])", "prefix": "package.searchpath"}, "package.seeall": {"body": "package.seeall(${0:...})", "description": "package.seeall (module)", "prefix": "package.seeall"}, "pairs": {"body": "pairs(${0:...})", "description": "pairs (t)", "prefix": "pairs"}, "pcall": {"body": "pcall(${0:...})", "description": "pcall (f, arg1, ...)", "prefix": "pcall"}, "print": {"body": "print(${1:...})", "description": "print(...)", "prefix": "print"}, "require": {"body": "require\"${1:module}\"", "description": "require()", "prefix": "require"}, "ret": {"body": "return ${1:...}", "description": "return ...", "prefix": "ret"}, "select": {"body": "select(${1:index}, ${2:...})", "description": "select (index, \u00b7\u00b7\u00b7)", "prefix": "select"}, "setfenv": {"body": "setfenv(${0:...})", "description": "setfenv (f, table)", "prefix": "setfenv"}, "setmetatable": {"body": "setmetatable(${1:table}, ${2:metatable})", "description": "setmetatable (table, metatable)", "prefix": "setmetatable"}, "tonumber": {"body": "tonumber(${1:e}${2:[, base]})", "description": "tonumber (e [, base])", "prefix": "tonumber"}, "tostring": {"body": "tostring(${1:v})", "description": "tostring (v)", "prefix": "tostring"}, "type": {"body": "type(${1:v})", "description": "type (v)", "prefix": "type"}, "unpack": {"body": "unpack(${0:...})", "description": "unpack (list [, i [, j]])", "prefix": "unpack"}, "xpcall": {"body": "xpcall(${0:...})", "description": "xpcall (f, err)", "prefix": "xpcall"}, "sys.publish(...)": {"body": "sys.publish(${1:...})", "description": "\u53d1\u5e03\u5185\u90e8\u6d88\u606f\uff0c\u5b58\u50a8\u5728\u5185\u90e8\u6d88\u606f\u961f\u5217\u4e2d\r\n\u8fd4\u56de\u503c\uff1a\r\n\u65e0\r\n\u4f8b\u5b50\uff1a\r\npublish(\"NET_STATUS_IND\")\r\n", "prefix": "sys.publish(...)"}, "sys.restart(r)": {"body": "sys.restart(${1:r})", "description": "\u8f6f\u4ef6\u91cd\u542f\r\n\u8fd4\u56de\u503c\uff1a\r\n\u65e0\r\n\u4f8b\u5b50\uff1a\r\nsys.restart('\u7a0b\u5e8f\u8d85\u65f6\u8f6f\u4ef6\u91cd\u542f')\r\n", "prefix": "sys.restart(r)"}, "sys.run()": {"body": "sys.run()", "description": "run()\u4ece\u5e95\u5c42\u83b7\u53d6core\u6d88\u606f\u5e76\u53ca\u65f6\u5904\u7406\u76f8\u5173\u6d88\u606f\uff0c\u67e5\u8be2\u5b9a\u65f6\u5668\u5e76\u8c03\u5ea6\u5404\u6ce8\u518c\u6210\u529f\u7684\u4efb\u52a1\u7ebf\u7a0b\u8fd0\u884c\u548c\u6302\u8d77\r\n\u8fd4\u56de\u503c\uff1a\r\n\u65e0\r\n\u4f8b\u5b50\uff1a\r\nsys.run()\r\n", "prefix": "sys.run()"}, "sys.setRollBack(flag, secs)": {"body": "sys.setRollBack(${1:flag},${2: secs})", "description": "\u8bbe\u7f6e\u201clua\u811a\u672c\u8fd0\u884c\u51fa\u9519\u65f6\uff0c\u662f\u5426\u56de\u9000\u539f\u59cb\u70e7\u5199\u7248\u672c\u201d\u7684\u529f\u80fd\u5f00\u5173\u3002\u5982\u679c\u6ca1\u6709\u8c03\u7528\u6b64\u63a5\u53e3\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u56de\u6eda\r\n\u8fd4\u56de\u503c\uff1a\r\nnil\r\n\u4f8b\u5b50\uff1a\r\nsys.setRollBack(true)\r\nsys.setRollBack(false)\r\n", "prefix": "sys.setRollBack(flag, secs)"}, "sys.subscribe(id, callback)": {"body": "sys.subscribe(${1:id},${2: callback})", "description": "\u8ba2\u9605\u6d88\u606f\r\n\u8fd4\u56de\u503c\uff1a\r\n\u65e0\r\n\u4f8b\u5b50\uff1a\r\nsubscribe(\"NET_STATUS_IND\", callback)\r\n", "prefix": "sys.subscribe(id, callback)"}, "sys.taskInit(fun, ...)": {"body": "sys.taskInit(${1:fun},${2: ...})", "description": "\u521b\u5efa\u4e00\u4e2a\u4efb\u52a1\u7ebf\u7a0b,\u5728\u6a21\u5757\u6700\u672b\u884c\u8c03\u7528\u8be5\u51fd\u6570\u5e76\u6ce8\u518c\u6a21\u5757\u4e2d\u7684\u4efb\u52a1\u51fd\u6570\uff0cmain.lua\u5bfc\u5165\u8be5\u6a21\u5757\u5373\u53ef\r\n\u8fd4\u56de\u503c\uff1a\r\nco \u8fd4\u56de\u8be5\u4efb\u52a1\u7684\u7ebf\u7a0b\u53f7\r\n\u4f8b\u5b50\uff1a\r\nsys.taskInit(task1,'a','b')\r\n", "prefix": "sys.taskInit(fun, ...)"}, "sys.timerIsActive(val, ...)": {"body": "sys.timerIsActive(${1:val},${2: ...})", "description": "\u5224\u65ad\u67d0\u4e2a\u5b9a\u65f6\u5668\u662f\u5426\u5904\u4e8e\u5f00\u542f\u72b6\u6001\r\n\u8fd4\u56de\u503c\uff1a\r\nnumber \u5f00\u542f\u72b6\u6001\u8fd4\u56detrue\uff0c\u5426\u5219nil", "prefix": "sys.timerIsActive(val, ...)"}, "sys.timerLoopStart(fnc, ms, ...)": {"body": "sys.timerLoopStart(${1:fnc},${2: ms},${3: ...})", "description": "\u5f00\u542f\u4e00\u4e2a\u5faa\u73af\u5b9a\u65f6\u5668\r\n\u8fd4\u56de\u503c\uff1a\r\nnumber \u5b9a\u65f6\u5668ID\uff0c\u5982\u679c\u5931\u8d25\uff0c\u8fd4\u56denil", "prefix": "sys.timerLoopStart(fnc, ms, ...)"}, "sys.timerStart(fnc, ms, ...)": {"body": "sys.timerStart(${1:fnc},${2: ms},${3: ...})", "description": "\u5f00\u542f\u4e00\u4e2a\u5b9a\u65f6\u5668\r\n\u8fd4\u56de\u503c\uff1a\r\nnumber \u5b9a\u65f6\u5668ID\uff0c\u5982\u679c\u5931\u8d25\uff0c\u8fd4\u56denil", "prefix": "sys.timerStart(fnc, ms, ...)"}, "sys.timerStop(val, ...)": {"body": "sys.timerStop(${1:val},${2: ...})", "description": "\u5173\u95ed\u5b9a\u65f6\u5668\r\n\u8fd4\u56de\u503c\uff1a\r\n\u65e0\r\n\u4f8b\u5b50\uff1a\r\ntimerStop(1)\r\n", "prefix": "sys.timerStop(val, ...)"}, "sys.timerStopAll(fnc)": {"body": "sys.timerStopAll(${1:fnc})", "description": "\u5173\u95ed\u540c\u4e00\u56de\u8c03\u51fd\u6570\u7684\u6240\u6709\u5b9a\u65f6\u5668\r\n\u8fd4\u56de\u503c\uff1a\r\n\u65e0\r\n\u4f8b\u5b50\uff1a\r\ntimerStopAll(cbFnc)\r\n", "prefix": "sys.timerStopAll(fnc)"}, "sys.unsubscribe(id, callback)": {"body": "sys.unsubscribe(${1:id},${2: callback})", "description": "\u53d6\u6d88\u8ba2\u9605\u6d88\u606f\r\n\u8fd4\u56de\u503c\uff1a\r\n\u65e0\r\n\u4f8b\u5b50\uff1a\r\nunsubscribe(\"NET_STATUS_IND\", callback)\r\n", "prefix": "sys.unsubscribe(id, callback)"}, "sys.wait(ms)": {"body": "sys.wait(${1:ms})", "description": "Task\u4efb\u52a1\u5ef6\u65f6\u51fd\u6570\uff0c\u53ea\u80fd\u7528\u4e8e\u4efb\u52a1\u51fd\u6570\u4e2d\r\n\u8fd4\u56de\u503c\uff1a\r\n\u5b9a\u65f6\u7ed3\u675f\u8fd4\u56denil,\u88ab\u5176\u4ed6\u7ebf\u7a0b\u5524\u8d77\u8fd4\u56de\u8c03\u7528\u7ebf\u7a0b\u4f20\u5165\u7684\u53c2\u6570\r\n\u4f8b\u5b50\uff1a\r\nsys.wait(30)\r\n", "prefix": "sys.wait(ms)"}, "sys.waitUntil(id, ms)": {"body": "sys.waitUntil(${1:id},${2: ms})", "description": "Task\u4efb\u52a1\u7684\u6761\u4ef6\u7b49\u5f85\u51fd\u6570\uff08\u5305\u62ec\u4e8b\u4ef6\u6d88\u606f\u548c\u5b9a\u65f6\u5668\u6d88\u606f\u7b49\u6761\u4ef6\uff09\uff0c\u53ea\u80fd\u7528\u4e8e\u4efb\u52a1\u51fd\u6570\u4e2d\u3002\r\n\u8fd4\u56de\u503c\uff1a\r\nresult \u63a5\u6536\u5230\u6d88\u606f\u8fd4\u56detrue\uff0c\u8d85\u65f6\u8fd4\u56defalse\r\n\u4f8b\u5b50\uff1a\r\nresult, data = sys.waitUntil(\"SIM_IND\", 120000)\r\n", "prefix": "sys.waitUntil(id, ms)"}, "sys.waitUntilExt(id, ms)": {"body": "sys.waitUntilExt(${1:id},${2: ms})", "description": "Task\u4efb\u52a1\u7684\u6761\u4ef6\u7b49\u5f85\u51fd\u6570\u6269\u5c55\uff08\u5305\u62ec\u4e8b\u4ef6\u6d88\u606f\u548c\u5b9a\u65f6\u5668\u6d88\u606f\u7b49\u6761\u4ef6\uff09\uff0c\u53ea\u80fd\u7528\u4e8e\u4efb\u52a1\u51fd\u6570\u4e2d\u3002\r\n\u8fd4\u56de\u503c\uff1a\r\nmessage \u63a5\u6536\u5230\u6d88\u606f\u8fd4\u56demessage\uff0c\u8d85\u65f6\u8fd4\u56defalse\r\n\u4f8b\u5b50\uff1a\r\nresult, data = sys.waitUntilExt(\"SIM_IND\", 120000)\r\n", "prefix": "sys.waitUntilExt(id, ms)"}, "table.concat(t,s)": {"body": "table.concat(${1:t},${2: s})", "description": "\u8868\u8fde\u63a5\r\n\u8fd4\u56de\u503c\uff1a\r\n \u5b57\u7b26\u4e32\r\n\u4f8b\u5b50\uff1a\r\nfruits = {\"banana\",\"orange\",\"apple\"}\r\n-- \u8fd4\u56de table \u8fde\u63a5\u540e\u7684\u5b57\u7b26\u4e32\r\nprint(\"\u8fde\u63a5\u540e\u7684\u5b57\u7b26\u4e32 \",table.concat(fruits))\r\n--\u8fde\u63a5\u540e\u7684\u5b57\u7b26\u4e32 bananaorangeapple\r\n\r\n-- \u6307\u5b9a\u8fde\u63a5\u5b57\u7b26\r\nprint(\"\u8fde\u63a5\u540e\u7684\u5b57\u7b26\u4e32 \",table.concat(fruits,\", \"))\r\n--\u8fde\u63a5\u540e\u7684\u5b57\u7b26\u4e32 banana, orange, apple\r\n\r\n-- \u6307\u5b9a\u7d22\u5f15\u6765\u8fde\u63a5 table\r\nprint(\"\u8fde\u63a5\u540e\u7684\u5b57\u7b26\u4e32 \",table.concat(fruits,\", \", 2,3))\r\n--\u8fde\u63a5\u540e\u7684\u5b57\u7b26\u4e32 orange, apple\r\n", "prefix": "table.concat()"}, "table.gsort(t, f)": {"body": "table.gsort(${1:t},${2: f})", "description": "\u8fd4\u56de\u4e00\u4e2a\u8fed\u4ee3\u5668\u51fd\u6570,\u6bcf\u6b21\u8c03\u7528\u51fd\u6570\u90fd\u4f1a\u8fd4\u56dehash\u8868\u7684\u6392\u5e8f\u540e\u7684\u952e\u503c\u5bf9\r\n\u8fd4\u56de\u503c\uff1a\r\nfunction.\r\n\u4f8b\u5b50\uff1a\r\ntest = {a=1,f=9,d=2,c=8,b=5}\r\nfor name,line in pairsByKeys(test) do print(name,line) end\r\n", "prefix": "table.gsort(t, f)"}, "table.insert(t,d)": {"body": "table.insert(${1:t},${2: d})", "description": "\u6dfb\u52a0table\u53c2\u6570\r\n\u8fd4\u56de\u503c\uff1a\r\n table\r\n\u4f8b\u5b50\uff1a\r\nfruits = {\"banana\",\"orange\",\"apple\"}\r\n\r\n-- \u5728\u672b\u5c3e\u63d2\u5165\r\ntable.insert(fruits,\"mango\")\r\nprint(\"\u7d22\u5f15\u4e3a 4 \u7684\u5143\u7d20\u4e3a \",fruits[4])\r\n--\u7d22\u5f15\u4e3a 4 \u7684\u5143\u7d20\u4e3a mango\r\n\r\n-- \u5728\u7d22\u5f15\u4e3a 2 \u7684\u952e\u5904\u63d2\u5165\r\ntable.insert(fruits,2,\"grapes\")\r\nprint(\"\u7d22\u5f15\u4e3a 2 \u7684\u5143\u7d20\u4e3a \",fruits[2])\r\n--\u7d22\u5f15\u4e3a 2 \u7684\u5143\u7d20\u4e3a grapes\r\n\r\nprint(\"\u6700\u540e\u4e00\u4e2a\u5143\u7d20\u4e3a \",fruits[5])\r\n--\u6700\u540e\u4e00\u4e2a\u5143\u7d20\u4e3a mango\r\n", "prefix": "table.insert()"}, "table.remove(t,i)": {"body": "table.remove(${1:t},${2: i})", "description": "\u79fb\u9664table\u53c2\u6570\r\n\u8fd4\u56de\u503c\uff1a\r\n table", "prefix": "table.remove()"}, "string.byte()": {"body": "string.byte()", "description": "\u63a5\u6536\u63a7\u5236\u5b57\u7b26\uff0c\u8fd4\u56deASCII\u7801\r\n\u8fd4\u56de\u503c\uff1a\r\n ASCII\u7801\r\n\u4f8b\u5b50\uff1a\r\nstring.byte(\"ABCD\") --65\r\nstring.byte(\"ABCD\",4) --68\r\n", "prefix": "string.byte()"}, "string.char()": {"body": "string.char()", "description": "\u63a5\u6536ASCII\u7801\uff0c\u8fd4\u56de\u5bf9\u5e94\u7684\u63a7\u5236\u5b57\u7b26\r\n\u8fd4\u56de\u503c\uff1a\r\n \u5b57\u7b26\r\n\u4f8b\u5b50\uff1a\r\nstring.char(97,98,99,100) --abcd\r\n", "prefix": "string.char()"}, "string.find()": {"body": "string.find()", "description": "\u67e5\u627e\u7b2c\u4e00\u4e2a\u5b57\u7b26\u4e32\u00a0s\u00a0\u4e2d\u5339\u914d\u5230\u7684\u00a0pattern\r\n\u8fd4\u56de\u503c\uff1a\r\n \u8fd4\u56de\u5339\u914d\u5b57\u7b26\u5177\u4f53\u4f4d\u7f6e\u3002\u4e0d\u5b58\u5728\u5219\u8fd4\u56de nil\r\n\u4f8b\u5b50\uff1a\r\nstring.find(\"Hello Lua user\", \"Lua\", 1) --7 9\r\n", "prefix": "string.find()"}, "string.format()": {"body": "string.format()", "description": "\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\r\n\u8fd4\u56de\u503c\uff1a\r\n \u5b57\u7b26\u4e32\r\n\u4f8b\u5b50\uff1a\r\nstring.format(\"the value is:%d\",4) --the value is:4\r\n", "prefix": "string.format()"}, "string.gsub()": {"body": "string.gsub()", "description": "\u5b57\u7b26\u4e32\u66ff\u6362", "prefix": "string.gsub()"}, "string.len()": {"body": "string.len()", "description": "\u8ba1\u7b97\u5b57\u7b26\u4e32\u957f\u5ea6\r\n\u8fd4\u56de\u503c\uff1a\r\n \u5b57\u7b26\u4e32\u957f\u5ea6\r\n\u4f8b\u5b50\uff1a\r\nstring.len(\"abc\") --3\r\n", "prefix": "string.len()"}, "string.lower()": {"body": "string.lower()", "description": "\u5b57\u7b26\u4e32\u5168\u90e8\u8f6c\u4e3a\u5c0f\u5199\u5b57\u6bcd\r\n\u8fd4\u56de\u503c\uff1a\r\n \u5c0f\u5199\u5b57\u6bcd\u5b57\u7b26\u4e32", "prefix": "string.lower()"}, "string.rep()": {"body": "string.rep()", "description": "\u5b57\u7b26\u4e32\u62f7\u8d1d\r\n\u8fd4\u56de\u503c\uff1a\r\n \u5b57\u7b26\u4e32\r\n\u4f8b\u5b50\uff1a\r\nstring.rep(\"abcd\",2) --abcdabcd\r\n", "prefix": "string.rep()"}, "string.reverse()": {"body": "string.reverse()", "description": "\u5b57\u7b26\u4e32\u53cd\u8f6c\r\n\u8fd4\u56de\u503c\uff1a\r\n \u53cd\u8f6c\u540e\u7684\u5b57\u7b26\u4e32\r\n\u4f8b\u5b50\uff1a\r\nstring.reverse(\"Luat\") --tauL\r\n", "prefix": "string.reverse()"}, "string.split(str, delimiter)": {"body": "string.split(${1:str},${2: delimiter})", "description": "\u6309\u7167\u6307\u5b9a\u5206\u9694\u7b26\u5206\u5272\u5b57\u7b26\u4e32\r\n\u8fd4\u56de\u503c\uff1a\r\n\u5206\u5272\u540e\u7684\u5b57\u7b26\u4e32\u5217\u8868\r\n\u4f8b\u5b50\uff1a\r\n\"123,456,789\":split(',') -> {'123','456','789'}\r\n", "prefix": "string.split(str, delimiter)"}, "string.upper()": {"body": "string.upper()", "description": "\u5b57\u7b26\u4e32\u5168\u90e8\u8f6c\u4e3a\u5927\u5199\u5b57\u6bcd\r\n\u8fd4\u56de\u503c\uff1a\r\n \u5927\u5199\u5b57\u6bcd\u5b57\u7b26\u4e32", "prefix": "string.upper()"}, "adc.open": {"body": "adc.open(${1:id})", "description": "adc.open(id) - \u6253\u5f00adc\u901a\u9053\n\u4f20\u5165\u503c\uff1a\nint \u901a\u9053id,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173,\u901a\u5e38\u4ece0\u5f00\u59cb\n\u8fd4\u56de\u503c\uff1a\nboolean \u6253\u5f00\u7ed3\u679c\n\u4f8b\u5b50\uff1a\n-- \u6253\u5f00adc\u901a\u90534,\u5e76\u8bfb\u53d6\nif adc.open(4) then\n log.info(\"adc\", adc.read(4)) -- \u8fd4\u56de\u503c\u67092\u4e2a, \u539f\u59cb\u503c\u548c\u8ba1\u7b97\u503c,\u901a\u5e38\u53ea\u9700\u8981\u540e\u8005\n log.info(\"adc\", adc.get(4)) -- \u8fd4\u56de\u503c\u67091\u4e2a, \u4ec5\u8ba1\u7b97\u503c\nend\nadc.close(4) -- \u82e5\u9700\u8981\u6301\u7eed\u8bfb\u53d6, \u5219\u4e0d\u9700\u8981close, \u529f\u8017\u4f1a\u9ad8\u4e00\u70b9.\n", "prefix": "adc.open"}, "adc.setRange": {"body": "adc.setRange(${1:range})", "description": "adc.setRange(range) - \u8bbe\u7f6eADC\u7684\u6d4b\u91cf\u8303\u56f4\uff0c\u6ce8\u610f\u8fd9\u4e2a\u548c\u5177\u4f53\u82af\u7247\u6709\u5173\uff0c\u76ee\u524d\u53ea\u652f\u6301air105/Air780E\u7cfb\u5217\n\u4f20\u5165\u503c\uff1a\nint range\u53c2\u6570,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173,\u6bd4\u5982air105\u586badc.ADC_RANGE_1_8\u548cadc.ADC_RANGE_3_6\nreturn nil\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u8981\u5728\u8c03\u7528adc.open\u4e4b\u524d\u5c31\u8c03\u7528, \u4e4b\u540e\u8c03\u7528\u65e0\u6548!!!\n\n-- \u5173\u95edair105\u5185\u90e8\u5206\u538b\nadc.setRange(adc.ADC_RANGE_1_8)\n-- \u6253\u5f00air105\u5185\u90e8\u5206\u538b\nadc.setRange(adc.ADC_RANGE_3_6)\n\n\n-- EC618\u7cfb\u5217(Air780E\u7b49)/EC718E\u7cfb\u5217(Air780EP/Air780EPV\u7b49)\u652f\u6301\u4ee5\u4e0b2\u79cd\nadc.setRange(adc.ADC_RANGE_1_2) -- \u5173\u95ed\u5206\u538b\nadc.setRange(adc.ADC_RANGE_3_8) -- \u542f\u7528\u5206\u538b\n", "prefix": "adc.setRange"}, "adc.read": {"body": "adc.read(${1:id})", "description": "adc.read(id) - \u8bfb\u53d6adc\u901a\u9053\n\u4f20\u5165\u503c\uff1a\nint \u901a\u9053id,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173,\u901a\u5e38\u4ece0\u5f00\u59cb\n\u8fd4\u56de\u503c\uff1a\nint \u539f\u59cb\u503c,\u4e00\u822c\u6ca1\u7528,\u53ef\u4ee5\u76f4\u63a5\u629b\u5f03\nint \u4ece\u539f\u59cb\u503c\u6362\u7b97\u5f97\u51fa\u7684\u5b9e\u9645\u503c\uff0c\u901a\u5e38\u5355\u4f4d\u662fmV\n\u4f8b\u5b50\uff1a\n-- \u6253\u5f00adc\u901a\u90532,\u5e76\u8bfb\u53d6\nif adc.open(2) then\n -- \u8fd9\u91cc\u4f7f\u7528\u7684\u662fadc.read\u4f1a\u8fd4\u56de2\u4e2a\u503c, \u63a8\u8350\u8d70adc.get\u51fd\u6570,\u76f4\u63a5\u53d6\u5b9e\u9645\u503c\n log.info(\"adc\", adc.read(2))\nend\nadc.close(2)\n", "prefix": "adc.read"}, "adc.get": {"body": "adc.get(${1:id})", "description": "adc.get(id) - \u83b7\u53d6adc\u8ba1\u7b97\u503c\n\u4f20\u5165\u503c\uff1a\nint \u901a\u9053id,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173,\u901a\u5e38\u4ece0\u5f00\u59cb\n\u8fd4\u56de\u503c\uff1a\nint \u5355\u4f4d\u901a\u5e38\u662fmV, \u90e8\u5206\u901a\u9053\u4f1a\u8fd4\u56de\u6e29\u5ea6\u503c,\u5355\u4f4d\u5343\u5206\u4e4b\u4e00\u6444\u6c0f\u5ea6. \u82e5\u8bfb\u53d6\u5931\u8d25,\u4f1a\u8fd4\u56de-1\n\u4f8b\u5b50\uff1a\n-- \u672cAPI \u5728 2022.10.01\u540e\u7f16\u8bd1\u7684\u56fa\u4ef6\u53ef\u7528\n-- \u6253\u5f00adc\u901a\u90532,\u5e76\u8bfb\u53d6\nif adc.open(2) then\n log.info(\"adc\", adc.get(2))\nend\nadc.close(2) -- \u6309\u9700\u5173\u95ed\n", "prefix": "adc.get"}, "adc.close": {"body": "adc.close(${1:id})", "description": "adc.close(id) - \u5173\u95edadc\u901a\u9053\n\u4f20\u5165\u503c\uff1a\nint \u901a\u9053id,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173,\u901a\u5e38\u4ece0\u5f00\u59cb\n\u4f8b\u5b50\uff1a\n-- \u6253\u5f00adc\u901a\u90532,\u5e76\u8bfb\u53d6\nif adc.open(2) then\n log.info(\"adc\", adc.read(2))\nend\nadc.close(2)\n", "prefix": "adc.close"}, "antbot.init": {"body": "antbot.init()", "description": "antbot.init() - \u521d\u59cb\u5316\n\u8fd4\u56de\u503c\uff1a\nint 0:\u6210\u529f \u5176\u4ed6\u503c\u4e3a\u5931\u8d25\n\u4f8b\u5b50\uff1a\n\n-- \u521d\u59cb\u5316\u8682\u8681\u94fe\u7684\u5e95\u5c42\u9002\u914d\nantbot.init()\n", "prefix": "antbot.init"}, "antbot.app_sta_get": {"body": "antbot.app_sta_get()", "description": "antbot.app_sta_get() - \u83b7\u53d6\u5ba2\u6237\u7aef\u72b6\u6001\n\u8fd4\u56de\u503c\uff1a\nint \u72b6\u6001\u7801\n", "prefix": "antbot.app_sta_get"}, "antbot.version_get": {"body": "antbot.version_get()", "description": "antbot.version_get() - \u83b7\u53d6SDK\u7248\u672c\u53f7\n\u8fd4\u56de\u503c\uff1a\nstring \u7248\u672c\u53f7,\u5982\u679c\u83b7\u53d6\u5931\u8d25\u8fd4\u56denil\n", "prefix": "antbot.version_get"}, "antbot.asset_register": {"body": "antbot.asset_register(${1:asset_id},${2:asset_type},${3:asset_dataver})", "description": "antbot.asset_register(asset_id, asset_type, asset_dataver) - asset\u8d44\u6e90\u6ce8\u518c\n\u4f20\u5165\u503c\uff1a\nstring asset_id \u8d44\u6e90ID\nstring asset_type \u8d44\u6e90\u7c7b\u578b\nstring asset_dataver \u8d44\u6e90\u6570\u636e\u7248\u672c\n\u8fd4\u56de\u503c\uff1a\nint 0:\u6210\u529f \u5176\u4ed6\u503c\u4e3a\u5931\u8d25\n", "prefix": "antbot.asset_register"}, "antbot.asset_data_publish": {"body": "antbot.asset_data_publish(${1:data})", "description": "antbot.asset_data_publish(data) - asset\u8d44\u6e90\u53d1\u5e03\n\u4f20\u5165\u503c\uff1a\nstring data \u8d44\u6e90\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nint 0:\u6210\u529f \u5176\u4ed6\u503c\u4e3a\u5931\u8d25\n", "prefix": "antbot.asset_data_publish"}, "antbot.device_status_get": {"body": "antbot.device_status_get()", "description": "antbot.device_status_get() - \u83b7\u53d6\u8bbe\u5907\u72b6\u6001\n\u8fd4\u56de\u503c\uff1a\nint \u8bbe\u5907\u72b6\u6001\n", "prefix": "antbot.device_status_get"}, "antbot.asset_status_get": {"body": "antbot.asset_status_get(${1:asset_id})", "description": "antbot.asset_status_get(asset_id) - \u83b7\u53d6assset\u72b6\u6001\n\u4f20\u5165\u503c\uff1a\nstring asset_id \u8d44\u6e90ID\n\u8fd4\u56de\u503c\uff1a\nint \u8d44\u6e90\u72b6\u6001\n", "prefix": "antbot.asset_status_get"}, "antbot.channel_switch": {"body": "antbot.channel_switch(${1:cmd})", "description": "antbot.channel_switch(cmd) - \u5207\u6362channel\n\u4f20\u5165\u503c\uff1a\nint 0 - \u5173\u95ed, 1 - \u5f00\u542f\n\u8fd4\u56de\u503c\uff1a\nint 0:\u6210\u529f \u5176\u4ed6\u503c\u4e3a\u5931\u8d25\n", "prefix": "antbot.channel_switch"}, "antbot.config_set": {"body": "antbot.config_set(${1:config})", "description": "antbot.config_set(config) - \u914d\u7f6e\u8bbe\u5907\n\u4f20\u5165\u503c\uff1a\nstring config \u914d\u7f6e\u5185\u5bb9\n\u8fd4\u56de\u503c\uff1a\nint 0:\u6210\u529f \u5176\u4ed6\u503c\u4e3a\u5931\u8d25\n", "prefix": "antbot.config_set"}, "antbot.config_get": {"body": "antbot.config_get()", "description": "antbot.config_get() - \u83b7\u53d6\u8bbe\u5907\u914d\u7f6e\n\u8fd4\u56de\u503c\uff1a\nstring \u914d\u7f6e\u5185\u5bb9\n", "prefix": "antbot.config_get"}, "audio.start": {"body": "audio.start(${1:id},${2:audio_format},${3:num_channels},${4:sample_rate},${5:bits_per_sample},${6:is_signed})", "description": "audio.start(id, audio_format, num_channels, sample_rate, bits_per_sample, is_signed) - \u542f\u52a8\u4e00\u4e2a\u591a\u5a92\u4f53\u901a\u9053\u51c6\u5907\u64ad\u653e\u97f3\u9891\n\u4f20\u5165\u503c\uff1a\nint \u591a\u5a92\u4f53\u64ad\u653e\u901a\u9053\u53f7\nint \u97f3\u9891\u683c\u5f0f\nint \u58f0\u97f3\u901a\u9053\u6570\nint \u91c7\u6837\u9891\u7387\nint \u91c7\u6837\u4f4d\u6570\nboolean \u662f\u5426\u6709\u7b26\u53f7\uff0c\u9ed8\u8ba4true\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529ftrue, \u5931\u8d25false\n\u4f8b\u5b50\uff1a\naudio.start(0, audio.PCM, 1, 16000, 16)\n", "prefix": "audio.start"}, "audio.record": {"body": "audio.record(${1:id},${2:record_type},${3:record_time},${4:amr_quailty},${5:path})", "description": "audio.record(id, record_type, record_time, amr_quailty, path) - \u5f55\u97f3\n\u4f20\u5165\u503c\uff1a\nint id \u591a\u5a92\u4f53\u64ad\u653e\u901a\u9053\u53f7\nint record_type \u5f55\u97f3\u97f3\u9891\u683c\u5f0f,\u652f\u6301 audio.AMR audio.PCM (\u90e8\u5206\u5e73\u53f0\u652f\u6301audio.AMR_WB)\nint record_time \u5f55\u5236\u65f6\u957f \u5355\u4f4d\u79d2,\u53ef\u9009\uff0c\u9ed8\u8ba40\u5373\u8868\u793a\u4e00\u76f4\u5f55\u5236\nint amr_quailty \u8d28\u91cf,audio.AMR\u4e0b\u6709\u6548\nstring path \u5f55\u97f3\u6587\u4ef6\u8def\u5f84,\u53ef\u9009,\u4e0d\u6307\u5b9a\u5219\u4e0d\u4fdd\u5b58,\u53ef\u5728audio.on\u56de\u8c03\u51fd\u6570\u4e2d\u5904\u7406\u539f\u59cbPCM\u6570\u636e\nint record_callback_time \u4e0d\u6307\u5b9a\u5f55\u97f3\u6587\u4ef6\u8def\u5f84\u65f6\uff0c\u5355\u6b21\u5f55\u97f3\u56de\u8c03\u65f6\u957f\uff0c\u5355\u4f4d\u662f100ms\u3002\u9ed8\u8ba41\uff0c\u65e2100ms\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nerr,info = audio.record(id, type, record_time, quailty, path)\n", "prefix": "audio.record"}, "audio.recordStop": {"body": "audio.recordStop(${1:id})", "description": "audio.recordStop(id) - \u5f55\u97f3\u505c\u6b62\n\u4f20\u5165\u503c\uff1a\nint id \u591a\u5a92\u4f53\u64ad\u653e\u901a\u9053\u53f7\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\naudio.recordStop(0)\n", "prefix": "audio.recordStop"}, "audio.write": {"body": "audio.write(${1:id},${2:data})", "description": "audio.write(id, data) - \u5f80\u4e00\u4e2a\u591a\u5a92\u4f53\u901a\u9053\u5199\u5165\u97f3\u9891\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring or zbuff \u97f3\u9891\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\naudio.write(0, \"xxxxxx\")\n", "prefix": "audio.write"}, "audio.stop": {"body": "audio.stop(${1:id})", "description": "audio.stop(id) - \u505c\u6b62\u6307\u5b9a\u7684\u591a\u5a92\u4f53\u901a\u9053\n\u4f20\u5165\u503c\uff1a\nint audio id,\u4f8b\u59820\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\naudio.stop(0)\n", "prefix": "audio.stop"}, "audio.pause": {"body": "audio.pause(${1:id},${2:pause})", "description": "audio.pause(id, pause) - \u6682\u505c/\u6062\u590d\u6307\u5b9a\u7684\u591a\u5a92\u4f53\u901a\u9053\n\u4f20\u5165\u503c\uff1a\nint audio id,\u4f8b\u59820\nboolean onoff true \u6682\u505c\uff0cfalse \u6062\u590d\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\naudio.pause(0, true) --\u6682\u505c\u901a\u90530\naudio.pause(0, false) --\u6062\u590d\u901a\u90530\n", "prefix": "audio.pause"}, "audio.on": {"body": "audio.on(${1:audio_id},${2:func})", "description": "audio.on(audio_id, func) - \u6ce8\u518caudio\u64ad\u653e\u4e8b\u4ef6\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nint audio id, audio 0\u51990, audio 1\u51991\nfunction \u56de\u8c03\u65b9\u6cd5\uff0c\u56de\u8c03\u65f6\u4f20\u5165\u53c2\u6570\u4e3a1\u3001int \u901a\u9053ID 2\u3001int \u6d88\u606f\u503c\uff0c\u53ea\u6709audio.MORE_DATA\u548caudio.DONE\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\naudio.on(0, function(audio_id, msg)\n log.info(\"msg\", audio_id, msg)\nend)\n", "prefix": "audio.on"}, "audio.play": {"body": "audio.play(${1:id},${2:path},${3:errStop})", "description": "audio.play(id, path, errStop) - \u64ad\u653e\u6216\u8005\u505c\u6b62\u64ad\u653e\u4e00\u4e2a\u6587\u4ef6\uff0c\u64ad\u653e\u5b8c\u6210\u540e\uff0c\u4f1a\u56de\u8c03\u4e00\u4e2aaudio.DONE\u6d88\u606f\uff0c\u53ef\u4ee5\u7528pause\u6765\u6682\u505c\u6216\u8005\u6062\u590d\uff0c\u5176\u4ed6API\u4e0d\u53ef\u7528\u3002\u8003\u8651\u5230\u8bfbSD\u5361\u901f\u5ea6\u6bd4\u8f83\u6162\u800c\u62d6\u7d2fluavm\u8fdb\u7a0b\u7684\u901f\u5ea6\uff0c\u6240\u4ee5\u5c3d\u91cf\u4f7f\u7528\u672cAPI\n\u4f20\u5165\u503c\uff1a\nint \u97f3\u9891\u901a\u9053\nstring/table \u6587\u4ef6\u540d\uff0c\u5982\u679c\u4e3a\u7a7a\uff0c\u5219\u8868\u793a\u505c\u6b62\u64ad\u653e\uff0c\u5982\u679c\u662ftable\uff0c\u5219\u8868\u793a\u8fde\u7eed\u64ad\u653e\u591a\u4e2a\u6587\u4ef6\uff0c\u4e3b\u8981\u5e94\u7528\u4e8e\u4e91\u5587\u53ed\uff0c\u76ee\u524d\u53ea\u6709EC618\u652f\u6301\uff0c\u5e76\u4e14\u4f1a\u7528\u5230errStop\u53c2\u6570\nboolean \u662f\u5426\u5728\u6587\u4ef6\u89e3\u7801\u5931\u8d25\u540e\u505c\u6b62\u89e3\u7801\uff0c\u53ea\u6709\u5728\u8fde\u7eed\u64ad\u653e\u591a\u4e2a\u6587\u4ef6\u65f6\u624d\u6709\u7528\uff0c\u9ed8\u8ba4true\uff0c\u9047\u5230\u89e3\u7801\u9519\u8bef\u81ea\u52a8\u505c\u6b62\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\naudio.play(0, \"xxxxxx\") --\u5f00\u59cb\u64ad\u653e\u67d0\u4e2a\u6587\u4ef6\naudio.play(0) --\u505c\u6b62\u64ad\u653e\u67d0\u4e2a\u6587\u4ef6\n", "prefix": "audio.play"}, "audio.tts": {"body": "audio.tts(${1:id},${2:data})", "description": "audio.tts(id, data) - TTS\u64ad\u653e\u6216\u8005\u505c\u6b62\n\u4f20\u5165\u503c\uff1a\nint \u97f3\u9891\u901a\u9053\nstring/zbuff \u9700\u8981\u64ad\u653e\u7684\u5185\u5bb9\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n", "prefix": "audio.tts"}, "audio.playStop": {"body": "audio.playStop(${1:id})", "description": "audio.playStop(id) - \u505c\u6b62\u64ad\u653e\u6587\u4ef6\uff0c\u548caudio.play(id)\u662f\u4e00\u6837\u7684\u4f5c\u7528\n\u4f20\u5165\u503c\uff1a\nint audio id,\u4f8b\u59820\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\naudio.playStop(0)\n", "prefix": "audio.playStop"}, "audio.isEnd": {"body": "audio.isEnd(${1:id})", "description": "audio.isEnd(id) - \u68c0\u67e5\u5f53\u524d\u6587\u4ef6\u662f\u5426\u5df2\u7ecf\u64ad\u653e\u7ed3\u675f\n\u4f20\u5165\u503c\uff1a\nint \u97f3\u9891\u901a\u9053\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\naudio.isEnd(0)\n\n", "prefix": "audio.isEnd"}, "audio.getError": {"body": "audio.getError(${1:id})", "description": "audio.getError(id) - \u83b7\u53d6\u6700\u8fd1\u4e00\u6b21\u64ad\u653e\u7ed3\u679c\uff0c\u4e0d\u662f\u6240\u6709\u5e73\u53f0\u90fd\u652f\u6301\u7684\uff0c\u76ee\u524d\u53ea\u6709EC618\u652f\u6301\n\u4f20\u5165\u503c\uff1a\nint \u97f3\u9891\u901a\u9053\n\u8fd4\u56de\u503c\uff1a\nboolean \u662f\u5426\u5168\u90e8\u64ad\u653e\u6210\u529f\uff0ctrue\u6210\u529f\uff0cfalse\u6709\u6587\u4ef6\u64ad\u653e\u5931\u8d25\nboolean \u5982\u679c\u64ad\u653e\u5931\u8d25\uff0c\u662f\u5426\u662f\u7528\u6237\u505c\u6b62\uff0ctrue\u662f\uff0cfalse\u4e0d\u662f\nint \u7b2c\u51e0\u4e2a\u6587\u4ef6\u5931\u8d25\u4e86\uff0c\u4ece1\u5f00\u59cb\n\u4f8b\u5b50\uff1a\nlocal result, user_stop, file_no = audio.getError(0)\n", "prefix": "audio.getError"}, "audio.config": {"body": "audio.config(${1:id},${2:paPin},${3:onLevel},${4:dacDelay},${5:paDelay},${6:dacPin},${7:dacLevel},${8:dacTimeDelay})", "description": "audio.config(id, paPin, onLevel, dacDelay, paDelay, dacPin, dacLevel, dacTimeDelay) - \u914d\u7f6e\u4e00\u4e2a\u97f3\u9891\u901a\u9053\u7684\u7279\u6027\uff0c\u6bd4\u5982\u5b9e\u73b0\u81ea\u52a8\u63a7\u5236PA\u5f00\u5173\u3002\u6ce8\u610f\u8fd9\u4e2a\u4e0d\u662f\u5fc5\u987b\u7684\uff0c\u4e00\u822c\u5728\u8c03\u7528play\u7684\u65f6\u5019\u624d\u9700\u8981\u81ea\u52a8\u63a7\u5236\uff0c\u5176\u4ed6\u60c5\u51b5\u6bd4\u5982\u4f60\u624b\u52a8\u63a7\u5236\u64ad\u653e\u65f6\uff0c\u5c31\u53ef\u4ee5\u81ea\u5df1\u63a7\u5236PA\u5f00\u5173\n\u4f20\u5165\u503c\uff1a\nint \u97f3\u9891\u901a\u9053\nint PA\u63a7\u5236IO\nint PA\u6253\u5f00\u65f6\u7684\u7535\u5e73\nint \u5728DAC\u542f\u52a8\u524d\u63d2\u5165\u7684\u5197\u4f59\u65f6\u95f4\uff0c\u5355\u4f4d100ms\uff0c\u4e00\u822c\u7528\u4e8e\u5916\u90e8DAC\nint \u5728DAC\u542f\u52a8\u540e\uff0c\u5ef6\u8fdf\u591a\u957f\u65f6\u95f4\u6253\u5f00PA\uff0c\u5355\u4f4d1ms\nint \u5916\u90e8dac\u7535\u6e90\u63a7\u5236IO\uff0c\u5982\u679c\u4e0d\u586b\uff0c\u5219\u8868\u793a\u4f7f\u7528\u5e73\u53f0\u9ed8\u8ba4IO\uff0c\u6bd4\u5982Air780E\u4f7f\u7528DACEN\u811a\uff0cair105\u5219\u4e0d\u542f\u7528\nint \u5916\u90e8dac\u6253\u5f00\u65f6\uff0c\u7535\u6e90\u63a7\u5236IO\u7684\u7535\u5e73\uff0c\u9ed8\u8ba4\u62c9\u9ad8\nint \u97f3\u9891\u64ad\u653e\u5b8c\u6bd5\u65f6\uff0cPA\u4e0eDAC\u5173\u95ed\u7684\u65f6\u95f4\u95f4\u9694\uff0c\u5355\u4f4d1ms\uff0c\u9ed8\u8ba40ms\n\u4f8b\u5b50\uff1a\naudio.config(0, pin.PC0, 1) --PA\u63a7\u5236\u811a\u662fPC0\uff0c\u9ad8\u7535\u5e73\u6253\u5f00\uff0cair105\u7528\u8fd9\u4e2a\u914d\u7f6e\u5c31\u53ef\u4ee5\u7528\u4e86\naudio.config(0, 25, 1, 6, 200) --PA\u63a7\u5236\u811a\u662fGPIO25\uff0c\u9ad8\u7535\u5e73\u6253\u5f00\uff0cAir780E\u4e91\u5587\u53ed\u677f\u7528\u8fd9\u4e2a\u914d\u7f6e\u5c31\u53ef\u4ee5\u7528\u4e86\n", "prefix": "audio.config"}, "audio.vol": {"body": "audio.vol(${1:id},${2:value})", "description": "audio.vol(id, value) - \u914d\u7f6e\u4e00\u4e2a\u97f3\u9891\u901a\u9053\u7684\u97f3\u91cf\u8c03\u8282\uff0c\u76f4\u63a5\u5c06\u539f\u59cb\u6570\u636e\u653e\u5927\u6216\u8005\u7f29\u5c0f\uff0c\u4e0d\u662f\u6240\u6709\u5e73\u53f0\u90fd\u652f\u6301\uff0c\u5efa\u8bae\u5c3d\u91cf\u7528\u786c\u4ef6\u65b9\u6cd5\u53bb\u7f29\u653e\n\u4f20\u5165\u503c\uff1a\nint \u97f3\u9891\u901a\u9053\nint \u97f3\u91cf\uff0c\u767e\u5206\u6bd4\uff0c1%~1000%\uff0c\u9ed8\u8ba4100%\uff0c\u5c31\u662f\u4e0d\u8c03\u8282\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524d\u97f3\u91cf\n\u4f8b\u5b50\uff1a\nlocal result = audio.vol(0, 90) --\u901a\u90530\u7684\u97f3\u91cf\u8c03\u8282\u523090%\uff0cresult\u5b58\u653e\u4e86\u8c03\u8282\u540e\u7684\u97f3\u91cf\u6c34\u5e73\uff0c\u6709\u53ef\u80fd\u4ecd\u7136\u662f100\n", "prefix": "audio.vol"}, "audio.micVol": {"body": "audio.micVol(${1:id},${2:value})", "description": "audio.micVol(id, value) - \u914d\u7f6e\u4e00\u4e2a\u97f3\u9891\u901a\u9053\u7684mic\u97f3\u91cf\u8c03\u8282\n\u4f20\u5165\u503c\uff1a\nint \u97f3\u9891\u901a\u9053\nint mic\u97f3\u91cf\uff0c\u767e\u5206\u6bd4\uff0c1%~100%\uff0c\u9ed8\u8ba4100%\uff0c\u5c31\u662f\u4e0d\u8c03\u8282\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524dmic\u97f3\u91cf\n\u4f8b\u5b50\uff1a\nlocal result = audio.vol(0, 90) --\u901a\u90530\u7684\u97f3\u91cf\u8c03\u8282\u523090%\uff0cresult\u5b58\u653e\u4e86\u8c03\u8282\u540e\u7684\u97f3\u91cf\u6c34\u5e73\uff0c\u6709\u53ef\u80fd\u4ecd\u7136\u662f100\n", "prefix": "audio.micVol"}, "audio.setBus": {"body": "audio.setBus(${1:id},${2:bus_type})", "description": "audio.setBus(id, bus_type) - \u914d\u7f6e\u4e00\u4e2a\u97f3\u9891\u901a\u9053\u7684\u786c\u4ef6\u8f93\u51fa\u603b\u7ebf\uff0c\u53ea\u6709\u5bf9\u5e94soc\u8f6f\u786c\u4ef6\u5e73\u53f0\u652f\u6301\u624d\u8bbe\u7f6e\u5bf9\u5e94\u7c7b\u578b\n\u4f20\u5165\u503c\uff1a\nint \u97f3\u9891\u901a\u9053,\u4f8b\u59820\nint \u603b\u7ebf\u7c7b\u578b, \u4f8b\u5982 audio.BUS_SOFT_DAC\nint \u786c\u4ef6id, \u4f8b\u5982 \u603b\u7ebf\u7c7b\u578b\u4e3aaudio.BUS_I2S\u65f6,\u786c\u4ef6id\u5373\u4e3ai2s codec\u7684i2c id\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\naudio.setBus(0, audio.BUS_SOFT_DAC) --\u901a\u90530\u7684\u786c\u4ef6\u8f93\u51fa\u901a\u9053\u8bbe\u7f6e\u4e3a\u8f6f\u4ef6DAC\naudio.setBus(0, audio.BUS_I2S) --\u901a\u90530\u7684\u786c\u4ef6\u8f93\u51fa\u901a\u9053\u8bbe\u7f6e\u4e3aI2S\n", "prefix": "audio.setBus"}, "audio.debug": {"body": "audio.debug(${1:on_off})", "description": "audio.debug(on_off) - \u914d\u7f6e\u8c03\u8bd5\u4fe1\u606f\u8f93\u51fa\n\u4f20\u5165\u503c\uff1a\nboolean true\u5f00 false\u5173\n", "prefix": "audio.debug"}, "audio.pm": {"body": "audio.pm(${1:id},${2:pm_mode})", "description": "audio.pm(id,pm_mode) - audio \u4f11\u7720\u63a7\u5236(\u4e00\u822c\u4f1a\u81ea\u52a8\u8c03\u7528\u4e0d\u9700\u8981\u624b\u52a8\u6267\u884c)\n\u4f20\u5165\u503c\uff1a\nint \u97f3\u9891\u901a\u9053\nint \u4f11\u7720\u6a21\u5f0f \n\u8fd4\u56de\u503c\uff1a\nboolean true\u6210\u529f\n\u4f8b\u5b50\uff1a\naudio.pm(multimedia_id,audio.RESUME)\n", "prefix": "audio.pm"}, "bit64.to32": {"body": "bit64.to32(${1:data64bit})", "description": "bit64.to32(data64bit) - 64bit\u6570\u636e\u8f6c\u621032bit\u8f93\u51fa\n\u4f20\u5165\u503c\uff1a\nstring 9\u5b57\u8282\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nany \u6839\u636e64bit\u6570\u636e\u8f93\u51faint\u6216\u8005number\n", "prefix": "bit64.to32"}, "bit64.to64": {"body": "bit64.to64(${1:data32bit})", "description": "bit64.to64(data32bit) - 32bit\u6570\u636e\u8f6c\u621064bit\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint/number 32bit\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nstring 9\u5b57\u8282\u6570\u636e\n", "prefix": "bit64.to64"}, "bit64.show": {"body": "bit64.show(${1:a},${2:type},${3:flag})", "description": "bit64.show(a,type,flag) - 64bit\u6570\u636e\u683c\u5f0f\u5316\u6253\u5370\u6210\u5b57\u7b26\u4e32\uff0c\u7528\u4e8e\u663e\u793a\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u6253\u5370\u768464bit\u6570\u636e\nint \u8fdb\u5236\uff0c10=10\u8fdb\u5236\uff0c16=16\u8fdb\u5236\uff0c\u9ed8\u8ba410\uff0c\u53ea\u652f\u630110\u6216\u800516\nboolean \u6574\u5f62\u662f\u5426\u6309\u7167\u65e0\u7b26\u53f7\u65b9\u5f0f\u6253\u5370\uff0ctrue\u662f\uff0cfalse\u4e0d\u662f\uff0c\u9ed8\u8ba4false\uff0c\u6d6e\u70b9\u5ffd\u7565\n\u8fd4\u56de\u503c\uff1a\nstring \u53ef\u4ee5\u6253\u5370\u7684\u503c\n", "prefix": "bit64.show"}, "bit64.plus": {"body": "bit64.plus(${1:a},${2:b},${3:flag1},${4:flag2})", "description": "bit64.plus(a,b,flag1,flag2) - 64bit\u6570\u636e\u52a0,a+b,a\u548cb\u4e2d\u6709\u4e00\u4e2a\u4e3a\u6d6e\u70b9\uff0c\u5219\u6309\u7167\u6d6e\u70b9\u8fd0\u7b97\n\u4f20\u5165\u503c\uff1a\nstring a\nstring/int/number b\nboolean \u6574\u5f62\u8fd0\u7b97\u65f6\u662f\u5426\u6309\u7167\u65e0\u7b26\u53f7\u65b9\u5f0f\uff0ctrue\u662f\uff0cfalse\u4e0d\u662f\uff0c\u9ed8\u8ba4false\uff0c\u6d6e\u70b9\u8fd0\u7b97\u5ffd\u7565\nboolean \u6d6e\u70b9\u8fd0\u7b97\u7ed3\u679c\u662f\u5426\u8981\u5f3a\u5236\u8f6c\u6210\u6574\u6570\uff0ctrue\u662f\uff0cfalse\u4e0d\u662f\uff0c\u9ed8\u8ba4false\uff0c\u6574\u5f62\u8fd0\u7b97\u5ffd\u7565\n\u8fd4\u56de\u503c\uff1a\nstring 9\u5b57\u8282\u6570\u636e\n", "prefix": "bit64.plus"}, "bit64.minus": {"body": "bit64.minus(${1:a},${2:b},${3:flag1},${4:flag2})", "description": "bit64.minus(a,b,flag1,flag2) - 64bit\u6570\u636e\u51cf,a-b,a\u548cb\u4e2d\u6709\u4e00\u4e2a\u4e3a\u6d6e\u70b9\uff0c\u5219\u6309\u7167\u6d6e\u70b9\u8fd0\u7b97\n\u4f20\u5165\u503c\uff1a\nstring a\nstring/int/number b\nboolean \u6574\u5f62\u8fd0\u7b97\u65f6\u662f\u5426\u6309\u7167\u65e0\u7b26\u53f7\u65b9\u5f0f\uff0ctrue\u662f\uff0cfalse\u4e0d\u662f\uff0c\u9ed8\u8ba4false\uff0c\u6d6e\u70b9\u8fd0\u7b97\u5ffd\u7565\nboolean \u6d6e\u70b9\u8fd0\u7b97\u7ed3\u679c\u662f\u5426\u8981\u5f3a\u5236\u8f6c\u6210\u6574\u6570\uff0ctrue\u662f\uff0cfalse\u4e0d\u662f\uff0c\u9ed8\u8ba4false\uff0c\u6574\u5f62\u8fd0\u7b97\u5ffd\u7565\n\u8fd4\u56de\u503c\uff1a\nstring 9\u5b57\u8282\u6570\u636e\n", "prefix": "bit64.minus"}, "bit64.multi": {"body": "bit64.multi(${1:a},${2:b},${3:flag1},${4:flag2})", "description": "bit64.multi(a,b,flag1,flag2) - 64bit\u6570\u636e\u4e58,a*b,a\u548cb\u4e2d\u6709\u4e00\u4e2a\u4e3a\u6d6e\u70b9\uff0c\u5219\u6309\u7167\u6d6e\u70b9\u8fd0\u7b97\n\u4f20\u5165\u503c\uff1a\nstring a\nstring/int/number b\nboolean \u6574\u5f62\u8fd0\u7b97\u65f6\u662f\u5426\u6309\u7167\u65e0\u7b26\u53f7\u65b9\u5f0f\uff0ctrue\u662f\uff0cfalse\u4e0d\u662f\uff0c\u9ed8\u8ba4false\uff0c\u6d6e\u70b9\u8fd0\u7b97\u5ffd\u7565\nboolean \u6d6e\u70b9\u8fd0\u7b97\u7ed3\u679c\u662f\u5426\u8981\u5f3a\u5236\u8f6c\u6210\u6574\u6570\uff0ctrue\u662f\uff0cfalse\u4e0d\u662f\uff0c\u9ed8\u8ba4false\uff0c\u6574\u5f62\u8fd0\u7b97\u5ffd\u7565\n\u8fd4\u56de\u503c\uff1a\nstring 9\u5b57\u8282\u6570\u636e\n", "prefix": "bit64.multi"}, "bit64.pide": {"body": "bit64.pide(${1:a},${2:b},${3:flag1},${4:flag2})", "description": "bit64.pide(a,b,flag1,flag2) - 64bit\u6570\u636e\u9664,a/b,a\u548cb\u4e2d\u6709\u4e00\u4e2a\u4e3a\u6d6e\u70b9\uff0c\u5219\u6309\u7167\u6d6e\u70b9\u8fd0\u7b97\n\u4f20\u5165\u503c\uff1a\nstring a\nstring/int/number b\nboolean \u6574\u5f62\u8fd0\u7b97\u65f6\u662f\u5426\u6309\u7167\u65e0\u7b26\u53f7\u65b9\u5f0f\uff0ctrue\u662f\uff0cfalse\u4e0d\u662f\uff0c\u9ed8\u8ba4false\uff0c\u6d6e\u70b9\u8fd0\u7b97\u5ffd\u7565\nboolean \u6d6e\u70b9\u8fd0\u7b97\u7ed3\u679c\u662f\u5426\u8981\u5f3a\u5236\u8f6c\u6210\u6574\u6570\uff0ctrue\u662f\uff0cfalse\u4e0d\u662f\uff0c\u9ed8\u8ba4false\uff0c\u6574\u5f62\u8fd0\u7b97\u5ffd\u7565\n\u8fd4\u56de\u503c\uff1a\nstring 9\u5b57\u8282\u6570\u636e\n", "prefix": "bit64.pide"}, "bit64.shift": {"body": "bit64.shift(${1:a},${2:b},${3:flag})", "description": "bit64.shift(a,b,flag) - 64bit\u6570\u636e\u4f4d\u79fb a>>b \u6216\u8005 a<>\uff0c\u9ed8\u8ba4false\n\u8fd4\u56de\u503c\uff1a\nstring 9\u5b57\u8282\u6570\u636e\n", "prefix": "bit64.shift"}, "bit64.strtoll": {"body": "bit64.strtoll(${1:data},${2:base})", "description": "bit64.strtoll(data, base) - \u5c06\u5b57\u7b26\u4e32\u8f6c\u4e3aLongLong\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u8f6c\u6362\u7684\u6570\u636e,\u5fc5\u987b\u5b58\u5728\nint \u8f6c\u6362\u8fdb\u5236, \u9ed8\u8ba410, \u53ef\u900916\u62168\n\u8fd4\u56de\u503c\uff1a\nstring 9\u5b57\u8282\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e 2023.10.27 \u6dfb\u52a0\n-- \u63d0\u9192, \u5982\u679c\u8f6c\u6362\u5931\u8d25, \u662f\u8fd4\u56de9\u4e2a\u5b57\u8282\u76840x00\nlocal data = bit64.strtoll(\"864040064024194\", 10)\nlog.info(\"data\", data:toHex())\nlog.info(\"data\", bit64.show(data))\n", "prefix": "bit64.strtoll"}, "camera.init": {"body": "camera.init(${1:InitReg_or_cspi_id},${2:cspi_speed},${3:mode},${4:is_msb},${5:rx_bit},${6:seq_type},${7:is_ddr},${8:only_y},${9:scan_mode},${10:w},${11:h})", "description": "camera.init(InitReg_or_cspi_id, cspi_speed, mode, is_msb, rx_bit, seq_type, is_ddr, only_y, scan_mode, w, h) - \u521d\u59cb\u5316\u6444\u50cf\u5934\n\u4f20\u5165\u503c\uff1a\ntable/integer \u5982\u679c\u662ftable,\u5219\u662fDVP\u6444\u50cf\u5934\u7684\u914d\u7f6e\u89c1demo/camera/AIR105,\u540c\u65f6\u5ffd\u7565\u540e\u7eed\u53c2\u6570;\u5982\u679c\u662f\u6570\u5b57,\u5219\u662fcamera spi\u603b\u7ebf\u5e8f\u53f7\nint camera spi\u603b\u7ebf\u901f\u5ea6\nint camera spi\u6a21\u5f0f,0~3\nint \u5b57\u8282\u7684bit\u987a\u5e8f\u662f\u5426\u662fmsb,0\u54261\u662f\nint \u540c\u65f6\u63a5\u6536bit\u6570,1,2,4\nint byte\u5e8f\u5217,0~1\nint \u53cc\u8fb9\u6cbf\u91c7\u6837\u914d\u7f6e,0\u4e0d\u542f\u7528,\u5176\u4ed6\u503c\u6839\u636e\u5b9e\u9645SOC\u51b3\u5b9a\nint \u53ea\u63a5\u6536Y\u5206\u91cf\uff0c0\u4e0d\u542f\u7528\uff0c1\u542f\u7528\uff0c\u626b\u7801\u5fc5\u987b\u542f\u7528\uff0c\u5426\u5219\u4f1a\u5931\u8d25\nint \u5de5\u4f5c\u6a21\u5f0f\uff0ccamera.AUTO\u81ea\u52a8,camera.SCAN\u626b\u7801\nint \u6444\u50cf\u5934\u5bbd\u5ea6\nint \u6444\u50cf\u5934\u9ad8\u5ea6\n\u8fd4\u56de\u503c\uff1a\nint/false \u6210\u529f\u8fd4\u56decamera_id\uff0c\u5931\u8d25\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\ncamera_id = camera.init(GC032A_InitReg)--\u5c4f\u5e55\u8f93\u51fargb\u56fe\u50cf\n--\u521d\u59cb\u5316\u540e\u9700\u8981start\u624d\u5f00\u59cb\u8f93\u51fa/\u626b\u7801\ncamera.start(camera_id)--\u5f00\u59cb\u6307\u5b9a\u7684camera\n", "prefix": "camera.init"}, "camera.on": {"body": "camera.on(${1:id},${2:event},${3:func})", "description": "camera.on(id, event, func) - \u6ce8\u518c\u6444\u50cf\u5934\u4e8b\u4ef6\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nint camera id, camera 0\u51990, camera 1\u51991\nstring \u4e8b\u4ef6\u540d\u79f0\nfunction \u56de\u8c03\u65b9\u6cd5\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\ncamera.on(0, \"scanned\", function(id, str)\n--id int camera id\n--str \u591a\u79cd\u7c7b\u578b false \u6444\u50cf\u5934\u6ca1\u6709\u6b63\u5e38\u5de5\u4f5c\uff0ctrue \u62cd\u7167\u6a21\u5f0f\u4e0b\u62cd\u7167\u6210\u529f\u5e76\u4fdd\u5b58\u5b8c\u6210\uff0c int \u539f\u59cb\u6570\u636e\u6a21\u5f0f\u4e0b\u672c\u6b21\u8fd4\u56de\u7684\u6570\u636e\u5927\u5c0f\uff0c string \u626b\u7801\u6a21\u5f0f\u4e0b\u626b\u7801\u6210\u529f\u540e\u7684\u89e3\u7801\u503c\n print(id, str)\nend)\n", "prefix": "camera.on"}, "camera.start": {"body": "camera.start(${1:id})", "description": "camera.start(id) - \u5f00\u59cb\u6307\u5b9a\u7684camera\n\u4f20\u5165\u503c\uff1a\nint camera id,\u4f8b\u59820\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\ncamera.start(0)\n", "prefix": "camera.start"}, "camera.stop": {"body": "camera.stop(${1:id})", "description": "camera.stop(id) - \u505c\u6b62\u6307\u5b9a\u7684camera\n\u4f20\u5165\u503c\uff1a\nint camera id,\u4f8b\u59820\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\ncamera.stop(0)\n", "prefix": "camera.stop"}, "camera.close": {"body": "camera.close(${1:id})", "description": "camera.close(id) - \u5173\u95ed\u6307\u5b9a\u7684camera\uff0c\u91ca\u653e\u76f8\u5e94\u7684IO\u8d44\u6e90\n\u4f20\u5165\u503c\uff1a\nint camera id,\u4f8b\u59820\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\ncamera.close(0)\n", "prefix": "camera.close"}, "camera.capture": {"body": "camera.capture(${1:id},${2:save_path},${3:quality})", "description": "camera.capture(id, save_path, quality) - camera\u62cd\u7167\n\u4f20\u5165\u503c\uff1a\nint camera id,\u4f8b\u59820\nstring/zbuff/nil save_path,\u6587\u4ef6\u4fdd\u5b58\u8def\u5f84\uff0c\u7a7a\u5219\u5199\u5728\u4e0a\u6b21\u8def\u5f84\u91cc\uff0c\u9ed8\u8ba4\u662f/capture.jpg\uff0c\u5982\u679c\u662fzbuff\uff0c\u5219\u5c06\u56fe\u7247\u4fdd\u5b58\u5728buff\u5185\u4e0d\u5199\u5165\u6587\u4ef6\u7cfb\u7edf\nint quality, jpeg\u538b\u7f29\u8d28\u91cf\uff0c1\u6700\u5dee\uff0c\u5360\u7528\u7a7a\u95f4\u5c0f\uff0c3\u6700\u9ad8\uff0c\u5360\u7528\u7a7a\u95f4\u6700\u5927\u800c\u4e14\u8d39\u65f6\u95f4\uff0c\u9ed8\u8ba41\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse,\u771f\u6b63\u5b8c\u6210\u540e\u901a\u8fc7camera.on\u8bbe\u7f6e\u7684\u56de\u8c03\u51fd\u6570\u56de\u8c03\u63a5\u6536\u5230\u7684\u957f\u5ea6\n\u4f8b\u5b50\uff1a\ncamera.capture(0)\n", "prefix": "camera.capture"}, "camera.video": {"body": "camera.video(${1:id},${2:w},${3:h},${4:out_path})", "description": "camera.video(id, w, h, out_path) - camera\u8f93\u51fa\u89c6\u9891\u6d41\u5230USB\n\u4f20\u5165\u503c\uff1a\nint camera id,\u4f8b\u59820\nint \u5bbd\u5ea6\nint \u9ad8\u5ea6\nint \u8f93\u51fa\u8def\u5f84\uff0c\u76ee\u524d\u53ea\u80fd\u7528\u865a\u62df\u4e32\u53e30\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\ncamera.video(0, 320, 240, uart.VUART_0)\n", "prefix": "camera.video"}, "camera.startRaw": {"body": "camera.startRaw(${1:id},${2:w},${3:h},${4:buff})", "description": "camera.startRaw(id, w, h, buff) - \u542f\u52a8camera\u8f93\u51fa\u539f\u59cb\u6570\u636e\u5230\u7528\u6237\u7684zbuff\u7f13\u5b58\u533a\uff0c\u8f93\u51fa1fps\u540e\u4f1a\u505c\u6b62\uff0c\u5e76\u901a\u8fc7camera.on\u8bbe\u7f6e\u7684\u56de\u8c03\u51fd\u6570\u56de\u8c03\u63a5\u6536\u5230\u7684\u957f\u5ea6\uff0c\u5982\u679c\u9700\u8981\u518d\u6b21\u8f93\u51fa\uff0c\u8bf7\u8c03\u7528camera.getRaw\n\u4f20\u5165\u503c\uff1a\nint camera id,\u4f8b\u59820\nint \u5bbd\u5ea6\nint \u9ad8\u5ea6\nzbuff \u7528\u4e8e\u5b58\u653e\u6570\u636e\u7684\u7f13\u5b58\u533a\uff0c\u5927\u5c0f\u5fc5\u987b\u4e0d\u5c0f\u4e8ew X h X 2 byte\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\ncamera.startRaw(0, 320, 240, buff)\n", "prefix": "camera.startRaw"}, "camera.getRaw": {"body": "camera.getRaw(${1:id})", "description": "camera.getRaw(id) - \u518d\u6b21\u542f\u52a8camera\u8f93\u51fa\u539f\u59cb\u6570\u636e\u5230\u7528\u6237\u7684zbuff\u7f13\u5b58\u533a\uff0c\u8f93\u51fa1fps\u540e\u4f1a\u505c\u6b62\uff0c\u5e76\u901a\u8fc7camera.on\u8bbe\u7f6e\u7684\u56de\u8c03\u51fd\u6570\u56de\u8c03\u63a5\u6536\u5230\u7684\u957f\u5ea6\uff0c\u5982\u679c\u9700\u8981\u518d\u6b21\u8f93\u51fa\uff0c\u8bf7\u7ee7\u7eed\u8c03\u7528\u672cAPI\n\u4f20\u5165\u503c\uff1a\nint camera id,\u4f8b\u59820\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\ncamera.getRaw(0)\n", "prefix": "camera.getRaw"}, "camera.preview": {"body": "camera.preview(${1:id},${2:onoff})", "description": "camera.preview(id, onoff) - \u542f\u505ccamera\u9884\u89c8\u529f\u80fd\uff0c\u76f4\u63a5\u8f93\u51fa\u5230LCD\u4e0a\uff0c\u53ea\u6709\u786c\u4ef6\u652f\u6301\u7684SOC\u53ef\u4ee5\u8fd0\u884c\n\u4f20\u5165\u503c\uff1a\nint camera id,\u4f8b\u59820\nboolean true\u5f00\u542f\uff0cfalse\u505c\u6b62\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\ncamera.preview(1, true)\n", "prefix": "camera.preview"}, "cc.lastNum": {"body": "cc.lastNum()", "description": "cc.lastNum() - \u83b7\u53d6\u6700\u540e\u4e00\u6b21\u901a\u8bdd\u7684\u53f7\u7801\n\u8fd4\u56de\u503c\uff1a\nstring \u83b7\u53d6\u6700\u540e\u4e00\u6b21\u901a\u8bdd\u7684\u53f7\u7801\n", "prefix": "cc.lastNum"}, "cc.dial": {"body": "cc.dial(${1:sim_id},${2:number})", "description": "cc.dial(sim_id, number) - \u62e8\u6253\u7535\u8bdd\n\u4f20\u5165\u503c\uff1a\nnumber sim_id\nstring \u7535\u8bdd\u53f7\u7801\n\u8fd4\u56de\u503c\uff1a\nbool \u62e8\u6253\u7535\u8bdd\u6210\u529f\u4e0e\u5426\n", "prefix": "cc.dial"}, "cc.hangUp": {"body": "cc.hangUp(${1:sim_id})", "description": "cc.hangUp(sim_id) - \u6302\u65ad\u7535\u8bdd\n\u4f20\u5165\u503c\uff1a\nnumber sim_id\n", "prefix": "cc.hangUp"}, "cc.accept": {"body": "cc.accept(${1:sim_id})", "description": "cc.accept(sim_id) - \u63a5\u542c\u7535\u8bdd\n\u4f20\u5165\u503c\uff1a\nnumber sim_id\n\u8fd4\u56de\u503c\uff1a\nbool \u63a5\u542c\u7535\u8bdd\u6210\u529f\u4e0e\u5426\n", "prefix": "cc.accept"}, "cc.init": {"body": "cc.init(${1:multimedia_id})", "description": "cc.init(multimedia_id) - \u521d\u59cb\u5316\u7535\u8bdd\u529f\u80fd\n\u4f20\u5165\u503c\uff1a\nnumber multimedia_id \u591a\u5a92\u4f53id\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\n", "prefix": "cc.init"}, "cc.record": {"body": "cc.record(${1:on_off},${2:upload_zbuff1},${3:upload_zbuff2},${4:download_zbuff1},${5:download_zbuff2})", "description": "cc.record(on_off,upload_zbuff1, upload_zbuff2, download_zbuff1, download_zbuff2) - \u5f55\u97f3\u901a\u8bdd\n\u4f20\u5165\u503c\uff1a\nboolean \u5f00\u542f\u5173\u95ed\u901a\u8bdd\u5f55\u97f3\u529f\u80fd\uff0cfalse\u6216\u8005nil\u5173\u95ed\uff0c\u5176\u4ed6\u5f00\u542f\nzbuff \u4e0a\u884c\u6570\u636e\u4fdd\u5b58\u533a1,zbuff\u521b\u5efa\u65f6\u7684\u7a7a\u95f4\u5bb9\u91cf\u5fc5\u987b\u662f640\u7684\u500d\u6570,\u4e0b\u540c\nzbuff \u4e0a\u884c\u6570\u636e\u4fdd\u5b58\u533a2,\u548c\u4e0a\u884c\u6570\u636e\u4fdd\u5b58\u533a1\u7ec4\u6210\u53cc\u7f13\u51b2\u533a\nzbuff \u4e0b\u884c\u6570\u636e\u4fdd\u5b58\u533a1\nzbuff \u4e0b\u884c\u6570\u636e\u4fdd\u5b58\u533a2,\u548c\u4e0b\u884c\u6570\u636e\u4fdd\u5b58\u533a1\u7ec4\u6210\u53cc\u7f13\u51b2\u533a\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\uff0c\u5982\u679c\u5904\u4e8e\u901a\u8bdd\u72b6\u6001\uff0c\u4f1a\u5931\u8d25\n\u4f8b\u5b50\uff1a\nbuff1 = zbuff.create(6400,0,zbuff.HEAP_AUTO)\nbuff2 = zbuff.create(6400,0,zbuff.HEAP_AUTO)\nbuff3 = zbuff.create(6400,0,zbuff.HEAP_AUTO)\nbuff4 = zbuff.create(6400,0,zbuff.HEAP_AUTO)\ncc.on(\"record\", function(type, buff_point)\n log.info(type, buff_point) -- type==true\u662f\u4e0b\u884c\u6570\u636e\uff0cfalse\u662f\u4e0a\u884c\u6570\u636e buff_point\u6307\u793a\u53cc\u7f13\u5b58\u4e2d\u8fd4\u56de\u4e86\u54ea\u4e00\u4e2a\nend)\ncc.record(true, buff1, buff2, buff3, buff4)\n", "prefix": "cc.record"}, "cc.quality": {"body": "cc.quality()", "description": "cc.quality() - \u83b7\u53d6\u5f53\u524d\u901a\u8bdd\u8d28\u91cf\n\u8fd4\u56de\u503c\uff1a\nint 1\u4e3a\u4f4e\u97f3\u8d28(8K)\uff0c2\u4e3a\u9ad8\u97f3\u8d28(16k)\uff0c0\u6ca1\u6709\u5728\u901a\u8bdd\n", "prefix": "cc.quality"}, "cc.on": {"body": "cc.on(${1:event},${2:func})", "description": "cc.on(event, func) - \u6ce8\u518c\u901a\u8bdd\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nstring \u4e8b\u4ef6\u540d\u79f0 \u97f3\u9891\u5f55\u97f3\u6570\u636e\u4e3a\"record\"\nfunction \u56de\u8c03\u65b9\u6cd5\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\ncc.on(\"record\", function(type, buff_point)\n log.info(type, buff_point) -- type==true\u662f\u4e0b\u884c\u6570\u636e\uff0cfalse\u662f\u4e0a\u884c\u6570\u636e buff_point\u6307\u793a\u53cc\u7f13\u5b58\u4e2d\u8fd4\u56de\u4e86\u54ea\u4e00\u4e2a\nend)\n", "prefix": "cc.on"}, "codec.create": {"body": "codec.create(${1:type},${2:isDecoder},${3:quality})", "description": "codec.create(type, isDecoder, quality) - \u521b\u5efa\u7f16\u89e3\u7801\u7528\u7684codec\n\u4f20\u5165\u503c\uff1a\nint \u591a\u5a92\u4f53\u7c7b\u578b\uff0c\u76ee\u524d\u652f\u6301codec.MP3 codec.AMR\nboolean \u662f\u5426\u662f\u89e3\u7801\u5668\uff0ctrue\u89e3\u7801\u5668\uff0cfalse\u7f16\u7801\u5668\uff0c\u9ed8\u8ba4true\uff0c\u662f\u89e3\u7801\u5668\nint \u7f16\u7801\u7b49\u7ea7\uff0c\u90e8\u5206bsp\u6709\u5185\u90e8\u7f16\u7801\u5668\uff0c\u53ef\u80fd\u9700\u8981\u63d0\u524d\u8f93\u5165\u7f16\u7801\u7b49\u7ea7\uff0c\u6bd4\u5982air780ep\u7684\u5185\u90e8amr\u7f16\u7801\u5668\n\u8fd4\u56de\u503c\uff1a\nuserdata \u6210\u529f\u8fd4\u56de\u4e00\u4e2a\u6570\u636e\u7ed3\u6784,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u521b\u5efa\u89e3\u7801\u5668\nlocal decoder = codec.create(codec.MP3)--\u521b\u5efa\u4e00\u4e2amp3\u7684decoder\n-- \u521b\u5efa\u7f16\u7801\u5668\nlocal encoder = codec.create(codec.AMR, false)--\u521b\u5efa\u4e00\u4e2aamr\u7684encoder\n-- \u521b\u5efa\u7f16\u7801\u5668\nlocal encoder = codec.create(codec.AMR_WB, false, 8)--\u521b\u5efa\u4e00\u4e2aamr-wb\u7684encoder\uff0c\u7f16\u7801\u7b49\u7ea7\u9ed8\u8ba48\n", "prefix": "codec.create"}, "codec.info": {"body": "codec.info(${1:decoder},${2:file_path})", "description": "codec.info(decoder, file_path) - decoder\u4ece\u6587\u4ef6\u4e2d\u89e3\u6790\u51fa\u97f3\u9891\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nuserdata \u89e3\u7801\u7528\u7684decoder\nstring \u6587\u4ef6\u8def\u5f84\n\u8fd4\u56de\u503c\uff1a\nboolean \u662f\u5426\u6210\u529f\u89e3\u6790\nint \u97f3\u9891\u683c\u5f0f\nint \u58f0\u97f3\u901a\u9053\u6570\nint \u91c7\u6837\u9891\u7387\nint \u91c7\u6837\u4f4d\u6570\nboolean \u662f\u5426\u6709\u7b26\u53f7\n\u4f8b\u5b50\uff1a\nlocal result, audio_format, num_channels, sample_rate, bits_per_sample, is_signed= codec.info(coder, \"xxx\")\n", "prefix": "codec.info"}, "codec.data": {"body": "codec.data(${1:decoder},${2:out_buff})", "description": "codec.data(decoder, out_buff) - decoder\u4ece\u6587\u4ef6\u4e2d\u89e3\u6790\u51fa\u539f\u59cb\u97f3\u9891\u6570\u636e\uff0c\u6bd4\u5982\u4eceMP3\u6587\u4ef6\u91cc\u89e3\u6790\u51faPCM\u6570\u636e\uff0c\u8fd9\u91cc\u7684\u6587\u4ef6\u8def\u5f84\u5df2\u7ecf\u5728codec.info\u4f20\u5165\uff0c\u4e0d\u9700\u8981\u518d\u6b21\u4f20\u5165\n\u4f20\u5165\u503c\uff1a\nuserdata \u89e3\u7801\u7528\u7684decoder\nzbuff \u5b58\u653e\u8f93\u51fa\u6570\u636e\u7684zbuff\uff0c\u7a7a\u95f4\u5fc5\u987b\u4e0d\u5c11\u4e8e16KB\nint \u6700\u5c11\u89e3\u7801\u51fa\u591a\u5c11\u5b57\u8282\u7684\u97f3\u9891\u6570\u636e,\u9ed8\u8ba416384\n\u8fd4\u56de\u503c\uff1a\nboolean \u662f\u5426\u6210\u529f\u89e3\u6790\n\u4f8b\u5b50\uff1a\n-- \u5927\u5185\u5b58\u8bbe\u5907\nlocal buff = zbuff.create(16*1024)\nlocal result = codec.data(coder, buff)\n-- \u5c0f\u5185\u5b58\u8bbe\u5907\nlocal buff = zbuff.create(8*1024)\nlocal result = codec.data(coder, buff, 4096)\n", "prefix": "codec.data"}, "codec.encode": {"body": "codec.encode(${1:coder},${2:in_buffer},${3:out_buffer},${4:mode})", "description": "codec.encode(coder, in_buffer, out_buffer, mode) - \u7f16\u7801\u97f3\u9891\u6570\u636e\uff0c\u7531\u4e8eflash\u548cram\u7a7a\u95f4\u4e00\u822c\u6bd4\u8f83\u6709\u9650\uff0c\u9664\u4e86\u90e8\u5206bsp\u6709\u5185\u90e8amr\u7f16\u7801\u529f\u80fd\uff0c\u76ee\u524d\u53ea\u652f\u6301amr-nb\u7f16\u7801\n\u4f20\u5165\u503c\uff1a\nuserdata codec.create\u521b\u5efa\u7684\u7f16\u89e3\u7801\u7528\u7684coder\nzbuff \u8f93\u5165\u7684\u6570\u636e,zbuff\u5f62\u5f0f,\u4ece0\u5230used\nzbuff \u8f93\u51fa\u7684\u6570\u636e,zbuff\u5f62\u5f0f,\u81ea\u52a8\u6dfb\u52a0\u5230buff\u7684\u5c3e\u90e8,\u5982\u679c\u7a7a\u95f4\u5927\u5c0f\u4e0d\u8db3,\u4f1a\u81ea\u52a8\u6269\u5c55,\u4f46\u662f\u4f1a\u989d\u5916\u6d88\u8017\u65f6\u95f4,\u751a\u81f3\u4f1a\u5931\u8d25,\u6240\u4ee5\u5c3d\u91cf\u4e00\u5f00\u59cb\u5c31\u7ed9\u8db3\u7a7a\u95f4\nint amr_nb\u7684\u7f16\u7801\u7b49\u7ea7 0~7(\u5373 MR475~MR122)\u503c\u8d8a\u5927\u6d88\u8017\u7684\u7a7a\u95f4\u8d8a\u591a,\u97f3\u8d28\u8d8a\u9ad8,\u9ed8\u8ba40 amr_wb\u7684\u7f16\u7801\u7b49\u7ea7 0~8,\u503c\u8d8a\u5927\u6d88\u8017\u7684\u7a7a\u95f4\u8d8a\u591a,\u97f3\u8d28\u8d8a\u9ad8,\u9ed8\u8ba40\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5931\u8d25\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\ncodec.encode(amr_coder, inbuf, outbuf, codec.AMR_)\n", "prefix": "codec.encode"}, "codec.release": {"body": "codec.release(${1:coder})", "description": "codec.release(coder) - \u91ca\u653e\u7f16\u89e3\u7801\u7528\u7684coder\n\u4f20\u5165\u503c\uff1a\ncoder codec.create\u521b\u5efa\u7684\u7f16\u89e3\u7801\u7528\u7684coder\n\u4f8b\u5b50\uff1a\ncodec.release(coder)\n", "prefix": "codec.release"}, "coremark.run": {"body": "coremark.run()", "description": "coremark.run() - \u5f00\u59cb\u8dd1\u5206\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c,\u7ed3\u679c\u76f4\u63a5\u6253\u5370\u5728\u65e5\u5fd7\u4e2d\n\u4f8b\u5b50\uff1a\n-- \u5927\u90e8\u5206\u60c5\u51b5\u4e0b, \u8fd9\u4e2a\u5e93\u90fd\u4e0d\u4f1a\u5305\u542b\u5728\u6b63\u5f0f\u7248\u56fa\u4ef6\u91cc\n-- \u82e5\u9700\u4f7f\u7528,\u53ef\u4ee5\u53c2\u8003wiki\u6587\u6863\u81ea\u884c\u7f16\u8bd1\u6216\u4f7f\u7528\u4e91\u7f16\u8bd1\n-- https://wiki.luatos.com/develop/compile.html\n\n-- \u8dd1\u5206\u7684main.lua \u5e94\u79fb\u9664\u786c\u72d7\u4ee3\u7801, \u9632\u6b62\u91cd\u542f\n-- \u82e5\u8bbe\u5907\u652f\u6301\u81ea\u52a8\u4f11\u7720, \u5e94\u5173\u95ed\u4f11\u7720\u529f\u80fd\n-- \u82e5\u8bbe\u5907\u652f\u6301\u66f4\u591a\u7684\u9891\u7387\u8fd0\u884c, \u5efa\u8bae\u8bbe\u7f6e\u5230\u6700\u9ad8\u9891\u7387\n-- \u4f7f\u7528 -O3 \u6bd4 -O2 -Os \u7684\u5206\u6570\u66f4\u9ad8, \u901a\u5e38\u60c5\u51b5\u4e0b\n\n-- \u4f1a\u4e00\u76f4\u72ec\u5360\u7ebf\u7a0b\u5230\u6267\u884c\u5b8c\u6bd5, \u7136\u540e\u5728\u63a7\u5236\u53f0\u8f93\u51fa\u7ed3\u679c\ncoremark.run()\n\n-- \u8dd1\u5206\u56fe\u4e00\u4e50^_^\n\n", "prefix": "coremark.run"}, "crypto.md5": {"body": "crypto.md5(${1:str})", "description": "crypto.md5(str) - \u8ba1\u7b97md5\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8ba1\u7b97\u7684\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nstring \u8ba1\u7b97\u5f97\u51fa\u7684md5\u503c\u7684hex\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97\u5b57\u7b26\u4e32\"abc\"\u7684md5\nlog.info(\"md5\", crypto.md5(\"abc\"))\n", "prefix": "crypto.md5"}, "crypto.hmac_md5": {"body": "crypto.hmac_md5(${1:str},${2:key})", "description": "crypto.hmac_md5(str, key) - \u8ba1\u7b97hmac_md5\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8ba1\u7b97\u7684\u5b57\u7b26\u4e32\nstring \u5bc6\u94a5\n\u8fd4\u56de\u503c\uff1a\nstring \u8ba1\u7b97\u5f97\u51fa\u7684hmac_md5\u503c\u7684hex\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97\u5b57\u7b26\u4e32\"abc\"\u7684hmac_md5\nlog.info(\"hmac_md5\", crypto.hmac_md5(\"abc\", \"1234567890\"))\n", "prefix": "crypto.hmac_md5"}, "crypto.sha1": {"body": "crypto.sha1(${1:str})", "description": "crypto.sha1(str) - \u8ba1\u7b97sha1\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8ba1\u7b97\u7684\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nstring \u8ba1\u7b97\u5f97\u51fa\u7684sha1\u503c\u7684hex\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97\u5b57\u7b26\u4e32\"abc\"\u7684sha1\nlog.info(\"sha1\", crypto.sha1(\"abc\"))\n", "prefix": "crypto.sha1"}, "crypto.hmac_sha1": {"body": "crypto.hmac_sha1(${1:str},${2:key})", "description": "crypto.hmac_sha1(str, key) - \u8ba1\u7b97hmac_sha1\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8ba1\u7b97\u7684\u5b57\u7b26\u4e32\nstring \u5bc6\u94a5\n\u8fd4\u56de\u503c\uff1a\nstring \u8ba1\u7b97\u5f97\u51fa\u7684hmac_sha1\u503c\u7684hex\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97\u5b57\u7b26\u4e32\"abc\"\u7684hmac_sha1\nlog.info(\"hmac_sha1\", crypto.hmac_sha1(\"abc\", \"1234567890\"))\n", "prefix": "crypto.hmac_sha1"}, "crypto.sha256": {"body": "crypto.sha256(${1:str})", "description": "crypto.sha256(str) - \u8ba1\u7b97sha256\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8ba1\u7b97\u7684\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nstring \u8ba1\u7b97\u5f97\u51fa\u7684sha256\u503c\u7684hex\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97\u5b57\u7b26\u4e32\"abc\"\u7684sha256\nlog.info(\"sha256\", crypto.sha256(\"abc\"))\n", "prefix": "crypto.sha256"}, "crypto.hmac_sha256": {"body": "crypto.hmac_sha256(${1:str},${2:key})", "description": "crypto.hmac_sha256(str, key) - \u8ba1\u7b97hmac_sha256\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8ba1\u7b97\u7684\u5b57\u7b26\u4e32\nstring \u5bc6\u94a5\n\u8fd4\u56de\u503c\uff1a\nstring \u8ba1\u7b97\u5f97\u51fa\u7684hmac_sha256\u503c\u7684hex\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97\u5b57\u7b26\u4e32\"abc\"\u7684hmac_sha256\nlog.info(\"hmac_sha256\", crypto.hmac_sha256(\"abc\", \"1234567890\"))\n", "prefix": "crypto.hmac_sha256"}, "crypto.sha512": {"body": "crypto.sha512(${1:str})", "description": "crypto.sha512(str) - \u8ba1\u7b97sha512\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8ba1\u7b97\u7684\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nstring \u8ba1\u7b97\u5f97\u51fa\u7684sha512\u503c\u7684hex\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97\u5b57\u7b26\u4e32\"abc\"\u7684sha512\nlog.info(\"sha512\", crypto.sha512(\"abc\"))\n", "prefix": "crypto.sha512"}, "crypto.hmac_sha512": {"body": "crypto.hmac_sha512(${1:str},${2:key})", "description": "crypto.hmac_sha512(str, key) - \u8ba1\u7b97hmac_sha512\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8ba1\u7b97\u7684\u5b57\u7b26\u4e32\nstring \u5bc6\u94a5\n\u8fd4\u56de\u503c\uff1a\nstring \u8ba1\u7b97\u5f97\u51fa\u7684hmac_sha512\u503c\u7684hex\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97\u5b57\u7b26\u4e32\"abc\"\u7684hmac_sha512\nlog.info(\"hmac_sha512\", crypto.hmac_sha512(\"abc\", \"1234567890\"))\n", "prefix": "crypto.hmac_sha512"}, "crypto.cipher_encrypt": {"body": "crypto.cipher_encrypt(${1:type},${2:padding},${3:str},${4:key},${5:iv})", "description": "crypto.cipher_encrypt(type, padding, str, key, iv) - \u5bf9\u79f0\u52a0\u5bc6\n\u4f20\u5165\u503c\uff1a\nstring \u7b97\u6cd5\u540d\u79f0, \u4f8b\u5982 AES-128-ECB/AES-128-CBC, \u53ef\u67e5\u9605crypto.cipher_list()\nstring \u5bf9\u9f50\u65b9\u5f0f, \u652f\u6301PKCS7/ZERO/ONE_AND_ZEROS/ZEROS_AND_LEN/NONE\nstring \u9700\u8981\u52a0\u5bc6\u7684\u6570\u636e\nstring \u5bc6\u94a5,\u9700\u8981\u5bf9\u5e94\u7b97\u6cd5\u7684\u5bc6\u94a5\u957f\u5ea6\nstring IV\u503c, \u975eECB\u7b97\u6cd5\u9700\u8981\n\u8fd4\u56de\u503c\uff1a\nstring \u52a0\u5bc6\u540e\u7684\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97AES\nlocal data = crypto.cipher_encrypt(\"AES-128-ECB\", \"PKCS7\", \"1234567890123456\", \"1234567890123456\")\nlocal data2 = crypto.cipher_encrypt(\"AES-128-CBC\", \"PKCS7\", \"1234567890123456\", \"1234567890123456\", \"1234567890666666\")\n", "prefix": "crypto.cipher_encrypt"}, "crypto.cipher_decrypt": {"body": "crypto.cipher_decrypt(${1:type},${2:padding},${3:str},${4:key},${5:iv})", "description": "crypto.cipher_decrypt(type, padding, str, key, iv) - \u5bf9\u79f0\u89e3\u5bc6\n\u4f20\u5165\u503c\uff1a\nstring \u7b97\u6cd5\u540d\u79f0, \u4f8b\u5982 AES-128-ECB/AES-128-CBC, \u53ef\u67e5\u9605crypto.cipher_list()\nstring \u5bf9\u9f50\u65b9\u5f0f, \u652f\u6301PKCS7/ZERO/ONE_AND_ZEROS/ZEROS_AND_LEN/NONE\nstring \u9700\u8981\u89e3\u5bc6\u7684\u6570\u636e\nstring \u5bc6\u94a5,\u9700\u8981\u5bf9\u5e94\u7b97\u6cd5\u7684\u5bc6\u94a5\u957f\u5ea6\nstring IV\u503c, \u975eECB\u7b97\u6cd5\u9700\u8981\n\u8fd4\u56de\u503c\uff1a\nstring \u89e3\u5bc6\u540e\u7684\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u7528AES\u52a0\u5bc6,\u7136\u540e\u7528AES\u89e3\u5bc6\nlocal data = crypto.cipher_encrypt(\"AES-128-ECB\", \"PKCS7\", \"1234567890123456\", \"1234567890123456\")\nlocal data2 = crypto.cipher_decrypt(\"AES-128-ECB\", \"PKCS7\", data, \"1234567890123456\")\n-- data\u7684hex\u4e3a 757CCD0CDC5C90EADBEEECF638DD0000\n-- data2\u7684\u503c\u4e3a 1234567890123456\n", "prefix": "crypto.cipher_decrypt"}, "crypto.crc16": {"body": "crypto.crc16(${1:method},${2:data},${3:poly},${4:initial},${5:finally},${6:inReversemoutReverse})", "description": "crypto.crc16(method, data, poly, initial, finally, inReversem outReverse) - \u8ba1\u7b97CRC16\n\u4f20\u5165\u503c\uff1a\nstring CRC16\u6a21\u5f0f\uff08\"IBM\",\"MAXIM\",\"USB\",\"MODBUS\",\"CCITT\",\"CCITT-FALSE\",\"X25\",\"XMODEM\",\"DNP\",\"USER-DEFINED\"\uff09\nstring \u5b57\u7b26\u4e32\nint poly\u503c\nint initial\u503c\nint finally\u503c\nint \u8f93\u5165\u53cd\u8f6c,1\u53cd\u8f6c,\u9ed8\u8ba40\u4e0d\u53cd\u8f6c\nint \u8f93\u5165\u53cd\u8f6c,1\u53cd\u8f6c,\u9ed8\u8ba40\u4e0d\u53cd\u8f6c\n\u8fd4\u56de\u503c\uff1a\nint \u5bf9\u5e94\u7684CRC16\u503c\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97CRC16\nlocal crc = crypto.crc16(\"\")\n", "prefix": "crypto.crc16"}, "crypto.crc16_modbus": {"body": "crypto.crc16_modbus(${1:data},${2:start})", "description": "crypto.crc16_modbus(data, start) - \u76f4\u63a5\u8ba1\u7b97modbus\u7684crc16\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u6570\u636e\nint \u521d\u59cb\u5316\u503c,\u9ed8\u8ba40xFFFF\n\u8fd4\u56de\u503c\uff1a\nint \u5bf9\u5e94\u7684CRC16\u503c\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97CRC16 modbus\nlocal crc = crypto.crc16_modbus(data)\n-- 2023.11.06 \u65b0\u589e\u521d\u59cb\u503c\u8bbe\u7f6e\ncrc = crypto.crc16_modbus(data, 0xFFFF)\n", "prefix": "crypto.crc16_modbus"}, "crypto.crc32": {"body": "crypto.crc32(${1:data})", "description": "crypto.crc32(data) - \u8ba1\u7b97crc32\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nint \u5bf9\u5e94\u7684CRC32\u503c\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97CRC32\nlocal crc = crypto.crc32(data)\n", "prefix": "crypto.crc32"}, "crypto.crc8": {"body": "crypto.crc8(${1:data},${2:poly},${3:start},${4:revert})", "description": "crypto.crc8(data, poly, start, revert) - \u8ba1\u7b97crc8\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u6570\u636e\nint crc\u591a\u9879\u5f0f\uff0c\u53ef\u9009\uff0c\u5982\u679c\u4e0d\u5199\uff0c\u5c06\u5ffd\u7565\u9664\u4e86\u6570\u636e\u5916\u6240\u6709\u53c2\u6570\nint crc\u521d\u59cb\u503c\uff0c\u53ef\u9009\uff0c\u9ed8\u8ba40\nboolean \u662f\u5426\u9700\u8981\u9006\u5e8f\u5904\u7406\uff0c\u9ed8\u8ba4\u5426\n\u8fd4\u56de\u503c\uff1a\nint \u5bf9\u5e94\u7684CRC8\u503c\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97CRC8\nlocal crc = crypto.crc8(data)\nlocal crc = crypto.crc8(data, 0x31, 0xff, false)\n", "prefix": "crypto.crc8"}, "crypto.crc7": {"body": "crypto.crc7(${1:data},${2:poly},${3:start})", "description": "crypto.crc7(data, poly, start) - \u8ba1\u7b97crc7\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u6570\u636e\nint crc\u591a\u9879\u5f0f\uff0c\u53ef\u9009\uff0c\u9ed8\u8ba40xE5\nint crc\u521d\u59cb\u503c\uff0c\u53ef\u9009\uff0c\u9ed8\u8ba40x00\n\u8fd4\u56de\u503c\uff1a\nint \u5bf9\u5e94\u7684CRC7\u503c\n\u4f8b\u5b50\uff1a\n-- \u8ba1\u7b97CRC7, \u672cAPI\u4e8e2023.10.07\u65b0\u589e\nlocal crc = crypto.crc7(data)\nlocal crc = crypto.crc7(data, 0x31, 0xff)\n", "prefix": "crypto.crc7"}, "crypto.trng": {"body": "crypto.trng(${1:len})", "description": "crypto.trng(len) - \u751f\u6210\u771f\u968f\u673a\u6570\n\u4f20\u5165\u503c\uff1a\nint \u6570\u636e\u957f\u5ea6\n\u8fd4\u56de\u503c\uff1a\nstring \u6307\u5b9a\u968f\u673a\u6570\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u751f\u621032\u4f4d\u968f\u673a\u6570ir\nlocal r = crypto.trng(4)\nlocal _, ir = pack.unpack(r, \"I\")\n", "prefix": "crypto.trng"}, "crypto.totp": {"body": "crypto.totp(${1:secret},${2:time})", "description": "crypto.totp(secret,time) - \u8ba1\u7b97TOTP\u52a8\u6001\u5bc6\u7801\u7684\u7ed3\u679c\n\u4f20\u5165\u503c\uff1a\nstring \u7f51\u7ad9\u63d0\u4f9b\u7684\u5bc6\u94a5\uff08\u5c31\u662fBASE32\u7f16\u7801\u540e\u7684\u7ed3\u679c\uff09\nint \u53ef\u9009\uff0c\u65f6\u95f4\u6233\uff0c\u9ed8\u8ba4\u5f53\u524d\u65f6\u95f4\n\u8fd4\u56de\u503c\uff1a\nint \u8ba1\u7b97\u5f97\u51fa\u7684\u516d\u4f4d\u6570\u7ed3\u679c \u8ba1\u7b97\u5931\u8d25\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n--\u4f7f\u7528\u5f53\u524d\u7cfb\u7edf\u65f6\u95f4\u8ba1\u7b97\nlocal otp = crypto.totp(\"asdfassdfasdfass\")\n", "prefix": "crypto.totp"}, "crypto.base64_encode": {"body": "crypto.base64_encode(${1:data})", "description": "crypto.base64_encode(data) - \u5c06\u6570\u636e\u8fdb\u884cbase64\u7f16\u7801\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u7f16\u7801\u7684\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nstring \u7f16\u7801\u540e\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u4e0e string.toBase64 \u662f\u540c\u4e00\u4e2a\nlocal data = \"123\"\nlocal bdata = crypto.base64_encode(data)\nlog.info(\"base64\", \"encode\", data, bdata)\ndata = crypto.base64_decode(data)\nlog.info(\"base64\", \"decode\", data, bdata)\n", "prefix": "crypto.base64_encode"}, "crypto.base64_decode": {"body": "crypto.base64_decode(${1:data})", "description": "crypto.base64_decode(data) - \u5c06\u6570\u636e\u8fdb\u884cbase64\u89e3\u7801\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u89e3\u7801\u7684\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nstring \u89e3\u7801\u540e\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u4e0e string.fromBase64 \u662f\u540c\u4e00\u4e2a\nlocal data = \"123\"\nlocal bdata = crypto.base64_encode(data)\nlog.info(\"base64\", \"encode\", data, bdata)\ndata = crypto.base64_decode(data)\nlog.info(\"base64\", \"decode\", data, bdata)\n", "prefix": "crypto.base64_decode"}, "crypto.cipher_list": {"body": "crypto.cipher_list()", "description": "crypto.cipher_list() - \u83b7\u53d6\u5f53\u524d\u56fa\u4ef6\u652f\u6301\u7684cipher\u5217\u8868\n\u8fd4\u56de\u503c\uff1a\ntable \u672c\u56fa\u4ef6\u652f\u6301\u7684cipher\u5217\u8868,\u5b57\u7b26\u4e32\u6570\u7ec4\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e2022.07.27\u6dfb\u52a0\nlocal ciphers = crypto.cipher_list()\nif ciphers then\n log.info(\"crypto\", \"ciphers list\", json.encode(ciphers))\nend\n", "prefix": "crypto.cipher_list"}, "crypto.cipher_suites": {"body": "crypto.cipher_suites()", "description": "crypto.cipher_suites() - \u83b7\u53d6\u5f53\u524d\u56fa\u4ef6\u652f\u6301\u7684cipher suites\u5217\u8868\n\u8fd4\u56de\u503c\uff1a\ntable \u672c\u56fa\u4ef6\u652f\u6301\u7684cipher suites\u5217\u8868,\u5b57\u7b26\u4e32\u6570\u7ec4\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e2022.11.16\u6dfb\u52a0\nlocal suites = crypto.cipher_suites()\nif suites then\n log.info(\"crypto\", \"ciphers suites\", json.encode(suites))\nend\n", "prefix": "crypto.cipher_suites"}, "crypto.md_file": {"body": "crypto.md_file(${1:tp},${2:path},${3:hmac})", "description": "crypto.md_file(tp, path, hmac) - \u8ba1\u7b97\u6587\u4ef6\u7684hash\u503c(md5/sha1/sha256\u53cahmac\u5f62\u5f0f)\n\u4f20\u5165\u503c\uff1a\nstring hash\u7c7b\u578b, \u5927\u5c0f\u5b57\u6bcd, \u4f8b\u5982 \"MD5\" \"SHA1\" \"SHA256\"\nstring \u6587\u4ef6\u8def\u5f84, \u4f8b\u5982 /luadb/logo.jpg\nstring hmac\u503c,\u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nstring HEX\u8fc7\u7684hash\u503c,\u82e5\u5931\u8d25\u4f1a\u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n\n-- \u65e0hmac\u7684hash\u503c\nlog.info(\"md5\", crypto.md_file(\"MD5\", \"/luadb/logo.jpg\"))\nlog.info(\"sha1\", crypto.md_file(\"SHA1\", \"/luadb/logo.jpg\"))\nlog.info(\"sha256\", crypto.md_file(\"SHA256\", \"/luadb/logo.jpg\"))\n\n-- \u5e26hmac\u7684hash\u503c\nlog.info(\"hmac_md5\", crypto.md_file(\"MD5\", \"/luadb/logo.jpg\", \"123456\"))\nlog.info(\"hmac_sha1\", crypto.md_file(\"SHA1\", \"/luadb/logo.jpg\", \"123456\"))\nlog.info(\"hmac_sha256\", crypto.md_file(\"SHA256\", \"/luadb/logo.jpg\", \"123456\"))\n", "prefix": "crypto.md_file"}, "crypto.md": {"body": "crypto.md(${1:tp},${2:data},${3:hmac})", "description": "crypto.md(tp, data, hmac) - \u8ba1\u7b97\u6570\u636e\u7684hash\u503c(md5/sha1/sha256\u53cahmac\u5f62\u5f0f)\n\u4f20\u5165\u503c\uff1a\nstring hash\u7c7b\u578b, \u5927\u5c0f\u5b57\u6bcd, \u4f8b\u5982 \"MD5\" \"SHA1\" \"SHA256\"\nstring \u5f85\u5904\u7406\u7684\u6570\u636e\nstring hmac\u503c,\u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nstring HEX\u8fc7\u7684hash\u503c,\u82e5\u5931\u8d25\u4f1a\u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n\n-- \u65e0hmac\u7684hash\u503c\nlog.info(\"md5\", crypto.md(\"MD5\", \"1234567890\"))\nlog.info(\"sha1\", crypto.md(\"SHA1\", \"1234567890\"))\nlog.info(\"sha256\", crypto.md(\"SHA256\", \"1234567890\"))\n\n-- \u5e26hmac\u7684hash\u503c\nlog.info(\"hmac_md5\", crypto.md(\"MD5\", \"1234567890\", \"123456\"))\nlog.info(\"hmac_sha1\", crypto.md(\"SHA1\", \"1234567890\", \"123456\"))\nlog.info(\"hmac_sha256\", crypto.md(\"SHA256\", \"1234567890\", \"123456\"))\n", "prefix": "crypto.md"}, "crypto.hash_init": {"body": "crypto.hash_init(${1:tp})", "description": "crypto.hash_init(tp) - \u521b\u5efa\u6d41\u5f0fhash\u7528\u7684stream\n\u4f20\u5165\u503c\uff1a\nstring hash\u7c7b\u578b, \u5927\u5199\u5b57\u6bcd, \u4f8b\u5982 \"MD5\" \"SHA1\" \"SHA256\"\nstring hmac\u503c\uff0c\u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nuserdata \u6210\u529f\u8fd4\u56de\u4e00\u4e2a\u6570\u636e\u7ed3\u6784,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u65e0hmac\u7684hash stream\nlocal md5_stream = crypto.hash_init(\"MD5\")\nlocal sha1_stream = crypto.hash_init(\"SHA1\")\nlocal sha256_stream = crypto.hash_init(\"SHA256\")\n\n-- \u5e26hmac\u7684hash stream\nlocal md5_stream = crypto.hash_init(\"MD5\", \"123456\")\nlocal sha1_stream = crypto.hash_init(\"SHA1\", \"123456\")\nlocal sha256_stream = crypto.hash_init(\"SHA256\", \"123456\")\n", "prefix": "crypto.hash_init"}, "crypto.hash_update": {"body": "crypto.hash_update(${1:stream},${2:data})", "description": "crypto.hash_update(stream, data) - \u6d41\u5f0fhash\u66f4\u65b0\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nuserdata crypto.hash_init()\u521b\u5efa\u7684stream, \u5fc5\u9009\nstring \u5f85\u8ba1\u7b97\u7684\u6570\u636e,\u5fc5\u9009\nreturn \u65e0\n\u4f8b\u5b50\uff1a\ncrypto.hash_update(stream, \"OK\")\n", "prefix": "crypto.hash_update"}, "crypto.hash_finish": {"body": "crypto.hash_finish(${1:stream})", "description": "crypto.hash_finish(stream) - \u83b7\u53d6\u6d41\u5f0fhash\u6821\u9a8c\u503c\u5e76\u91ca\u653e\u521b\u5efa\u7684stream\n\u4f20\u5165\u503c\uff1a\nuserdata crypto.hash_init()\u521b\u5efa\u7684stream,\u5fc5\u9009\n\u8fd4\u56de\u503c\uff1a\nstring \u6210\u529f\u8fd4\u56de\u8ba1\u7b97\u5f97\u51fa\u7684\u6d41\u5f0fhash\u503c\u7684hex\u5b57\u7b26\u4e32\uff0c\u5931\u8d25\u65e0\u8fd4\u56de\n\u4f8b\u5b50\uff1a\nlocal hashResult = crypto.hash_finish(stream)\n", "prefix": "crypto.hash_finish"}, "crypto.checksum": {"body": "crypto.checksum(${1:data},${2:mode})", "description": "crypto.checksum(data, mode) - \u8ba1\u7b97checksum\u6821\u9a8c\u548c\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u8ba1\u7b97\u7684\u6570\u636e,\u5fc5\u9009\nint \u6a21\u5f0f,\u7d2f\u52a0\u6a21\u5f0f, 0 - \u5f02\u6216, 1 - \u7d2f\u52a0, \u9ed8\u8ba4\u4e3a0\n\u8fd4\u56de\u503c\uff1a\nint checksum\u503c,\u6821\u9a8c\u548c\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5728 2022.12.28 \u6dfb\u52a0\n-- \u5355\u7eaf\u8ba1\u7b97checksum\u503c\nlocal ck = crypto.checksum(\"OK\")\nlog.info(\"checksum\", \"ok\", string.format(\"%02X\", ck))\n-- \u7b2c\u4e8c\u4e2a\u53c2\u6570mode\u57282023.5.23\u65e5\u6dfb\u52a0\n", "prefix": "crypto.checksum"}, "dac.open": {"body": "dac.open(${1:ch},${2:freq},${3:mode})", "description": "dac.open(ch, freq, mode) - \u6253\u5f00DAC\u901a\u9053,\u5e76\u914d\u7f6e\u53c2\u6570\n\u4f20\u5165\u503c\uff1a\nint \u901a\u9053\u7f16\u53f7,\u4f8b\u59820\nint \u8f93\u51fa\u9891\u7387,\u5355\u4f4dhz\nint \u6a21\u5f0f,\u9ed8\u8ba4\u4e3a0,\u9884\u7559\n\u8fd4\u56de\u503c\uff1a\ntrue \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\nint \u5e95\u5c42\u8fd4\u56de\u503c,\u8c03\u8bd5\u7528\n\u4f8b\u5b50\uff1a\nif dac.open(0, 44000) then\n log.info(\"dac\", \"dac ch0 is opened\")\nend\n\n", "prefix": "dac.open"}, "dac.write": {"body": "dac.write(${1:ch},${2:data})", "description": "dac.write(ch, data) - \u4ece\u6307\u5b9aDAC\u901a\u9053\u8f93\u51fa\u4e00\u6bb5\u6ce2\u5f62,\u6216\u8005\u5355\u4e2a\u503c\n\u4f20\u5165\u503c\uff1a\nint \u901a\u9053\u7f16\u53f7,\u4f8b\u59820\nstring \u82e5\u8f93\u51fa\u56fa\u5b9a\u503c,\u53ef\u4ee5\u586b\u6570\u503c, \u82e5\u8f93\u51fa\u6ce2\u5f62,\u586bstring\n\u8fd4\u56de\u503c\uff1a\ntrue \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\nint \u5e95\u5c42\u8fd4\u56de\u503c,\u8c03\u8bd5\u7528\n\u4f8b\u5b50\uff1a\nif dac.open(0, 44000) then\n log.info(\"dac\", \"dac ch0 is opened\")\n dac.write(0, string.fromHex(\"ABCDABCD\"))\nend\ndac.close(0)\n", "prefix": "dac.write"}, "dac.close": {"body": "dac.close(${1:ch})", "description": "dac.close(ch) - \u5173\u95edDAC\u901a\u9053\n\u4f20\u5165\u503c\uff1a\nint \u901a\u9053\u7f16\u53f7,\u4f8b\u59820\n\u8fd4\u56de\u503c\uff1a\ntrue \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\nint \u5e95\u5c42\u8fd4\u56de\u503c,\u8c03\u8bd5\u7528\n\u4f8b\u5b50\uff1a\nif dac.open(0, 44000) then\n log.info(\"dac\", \"dac ch0 is opened\")\n dac.write(0, string.fromHex(\"ABCDABCD\"))\nend\ndac.close(0)\n", "prefix": "dac.close"}, "disp.init": {"body": "disp.init(${1:conf})", "description": "disp.init(conf) - \u663e\u793a\u5c4f\u521d\u59cb\u5316,\u8bf7\u4f7f\u7528u8g2\u5e93\n\u4f20\u5165\u503c\uff1a\ntable conf \u914d\u7f6e\u4fe1\u606f\n\u8fd4\u56de\u503c\uff1a\nint \u6b63\u5e38\u521d\u59cb\u53161,\u5df2\u7ecf\u521d\u59cb\u5316\u8fc72,\u5185\u5b58\u4e0d\u591f3,\u521d\u59cb\u5316\u5931\u8d25\u8fd4\u56de4\n\u4f8b\u5b50\uff1a\n-- disp\u5e93\u7684\u6240\u6709API\u5747\u5df2\u5408\u5e76\u5230u8g2\u5e93\n-- disp\u5e93\u5df2\u7ecf\u6620\u5c04\u4e3au8g2\u5e93,\u6240\u6709API\u5747\u4ee3\u7406\u5230u8g2,\u8bf7\u67e5\u9605u8g2\u5e93\u7684API\n", "prefix": "disp.init"}, "eink.init": {"body": "eink.init(${1:tp},${2:args},${3:spi_device})", "description": "eink.init(tp, args,spi_device) - eink\u663e\u793a\u5c4f\u521d\u59cb\u5316\n\u4f20\u5165\u503c\uff1a\nnumber eink\u7c7b\u578b\uff0c\u5f53\u524d\u652f\u6301\uff1ahttps://wiki.luatos.com/api/eink.html#id1\ntable \u9644\u52a0\u53c2\u6570,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173\uff1a
pin_busy\uff08busy\uff09
port\uff1aspi\u7aef\u53e3,\u4f8b\u59820,1,2...\u5982\u679c\u4e3adevice\u65b9\u5f0f\u5219\u4e3a\"device\"
pin_dc\uff1aeink\u6570\u636e/\u547d\u4ee4\u9009\u62e9\u5f15\u811a
pin_rst\uff1aeink\u590d\u4f4d\u5f15\u811a\nuserdata spi\u8bbe\u5907,\u5f53port = \"device\"\u65f6\u6709\u6548\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316spi0\u7684eink.MODEL_4in2bc) \u6ce8\u610f:eink\u521d\u59cb\u5316\u4e4b\u524d\u9700\u8981\u5148\u521d\u59cb\u5316spi\nspi_eink = spi.deviceSetup(0,20,0,0,8,20000000,spi.MSB,1,1)\nlog.info(\"eink.init\",\neink.init(eink.MODEL_4in2bc,{port = \"device\",pin_dc = 17, pin_pwr = 7,pin_rst = 19,direction = 2,w = 160,h = 80,xoffset = 1,yoffset = 26},spi_eink))\n", "prefix": "eink.init"}, "eink.setup": {"body": "eink.setup(${1:full},${2:spiid},${3:pin_busy},${4:pin_reset},${5:pin_dc},${6:pin_cs})", "description": "eink.setup(full, spiid, pin_busy, pin_reset, pin_dc, pin_cs) - \u521d\u59cb\u5316eink\n\u4f20\u5165\u503c\uff1a\nint \u5168\u5c4f\u5237\u65b00,\u5c40\u90e8\u5237\u65b01,\u9ed8\u8ba4\u662f\u5168\u5c4f\u5237\u65b0\nint \u6240\u5728\u7684spi,\u9ed8\u8ba4\u662f0\nint Busy \u5fd9\u4fe1\u53f7\u7ba1\u811a\nint Reset \u590d\u4f4d\u7ba1\u811a\nint DC \u6570\u636e\u547d\u4ee4\u9009\u62e9\u7ba1\u811a\nint CS \u4f7f\u80fd\u7ba1\u811a\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n", "prefix": "eink.setup"}, "eink.sleep": {"body": "eink.sleep()", "description": "eink.sleep() - \u8fdb\u5165\u4f11\u7720\u6a21\u5f0f\uff0c\u518d\u6b21\u4f7f\u7528\u65f6\u9700\u8981\u91cd\u65b0\u521d\u59cb\u5316\n", "prefix": "eink.sleep"}, "eink.clear": {"body": "eink.clear(${1:color},${2:force})", "description": "eink.clear(color, force) - \u6e05\u9664\u7ed8\u56fe\u7f13\u51b2\u533a\uff0c\u9ed8\u8ba4\u4e0d\u4f1a\u9a6c\u4e0a\u5237\u65b0\u5230\u8bbe\u5907\n\u4f20\u5165\u503c\uff1a\nnumber color \u53ef\u9009\uff0c\u9ed8\u8ba41\u3002\u5237\u5c4f\u989c\u8272\nbool force \u53ef\u9009\uff0c\u9ed8\u8ba4false\u3002\u5982\u679c\u4e3atrue\u5219\u9a6c\u4e0a\u6e05\u5c4f\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "eink.clear"}, "eink.setWin": {"body": "eink.setWin(${1:width},${2:height},${3:rotate})", "description": "eink.setWin(width, height, rotate) - \u8bbe\u7f6e\u7a97\u53e3\n\u4f20\u5165\u503c\uff1a\nint width \u5bbd\u5ea6\nint height \u9ad8\u5ea6\nint rotate \u663e\u793a\u65b9\u5411,0/1/2/3, \u76f8\u5f53\u4e8e\u65cb\u8f6c0\u5ea6/90\u5ea6/180\u5ea6/270\u5ea6\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "eink.setWin"}, "eink.getWin": {"body": "eink.getWin()", "description": "eink.getWin() - \u83b7\u53d6\u7a97\u53e3\u4fe1\u606f\n\u8fd4\u56de\u503c\uff1a\nint width \u5bbd\nint height \u9ad8\nint rotate \u65cb\u8f6c\u65b9\u5411\n", "prefix": "eink.getWin"}, "eink.setFont": {"body": "eink.setFont(${1:font})", "description": "eink.setFont(font) - \u8bbe\u7f6e\u5b57\u4f53\n\u4f20\u5165\u503c\uff1a\nuserdata \u5b57\u4f53\n\u4f8b\u5b50\uff1a\n-- \u8bbe\u7f6e\u4e3a\u5b57\u4f53,\u5bf9\u4e4b\u540e\u7684print\u6709\u6548\neink.setFont(eink.font_opposansm12_chinese)\n", "prefix": "eink.setFont"}, "eink.print": {"body": "eink.print(${1:x},${2:y},${3:str},${4:colored})", "description": "eink.print(x, y, str, colored) - \u7ed8\u5236\u5b57\u7b26\u4e32\n\u4f20\u5165\u503c\uff1a\nint x\u5750\u6807\nint y\u5750\u6807\nstring \u5b57\u7b26\u4e32\nint \u989c\u8272, \u53ef\u4ee5\u662f0\u6216\u80051, \u9ed8\u8ba4\u662f0\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u5148\u8bbe\u7f6e\u5b57\u4f53, \u7136\u540e\u5199\u5b57\n-- \u53ef\u7528\u5b57\u4f53\u53d6\u51b3\u4e8e\u5177\u4f53\u7684\u56fa\u4ef6, \u5982\u679c\u6ca1\u6709\u4f60\u60f3\u8981\u7684\u5927\u5c0f,\u53ef\u4ee5\u4e91\u7f16\u8bd1\u4e00\u4efd\u81ea\u5b9a\u4e49\u56fa\u4ef6\n-- font_opposansm8_chinese\n-- font_opposansm10_chinese\n-- font_opposansm12_chinese\n-- font_opposansm14_chinese\n-- font_opposansm16_chinese\neink.setFont(eink.font_opposansm12_chinese)\neink.print(10, 20, \"LuatOS\")\n", "prefix": "eink.print"}, "eink.show": {"body": "eink.show(${1:x},${2:y},${3:noClear})", "description": "eink.show(x, y, noClear) - \u5c06\u7f13\u51b2\u533a\u56fe\u50cf\u8f93\u51fa\u5230\u5c4f\u5e55\n\u4f20\u5165\u503c\uff1a\nint x \u8f93\u51fa\u7684x\u5750\u6807,\u9ed8\u8ba40\nint y \u8f93\u51fa\u7684y\u5750\u6807,\u9ed8\u8ba40\nbool \u53ef\u9009\uff0c\u9ed8\u8ba4false\u3002\u5982\u679c\u4e3atrue\u5219\u4e0d\u8fdb\u884c\u6e05\u5c4f\uff0c\u76f4\u63a5\u5237\u4e0a\u65b0\u5185\u5bb9\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "eink.show"}, "eink.draw": {"body": "eink.draw(${1:buff},${2:buff2},${3:noclear})", "description": "eink.draw(buff, buff2, noclear) - \u76f4\u63a5\u8f93\u51fa\u6570\u636e\u5230\u5c4f\u5e55,\u652f\u6301\u53cc\u8272\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nuserdata zbuff\u6307\u9488\nuserdata zbuff\u6307\u9488\nbool \u53ef\u9009\uff0c\u9ed8\u8ba4false\u3002\u5982\u679c\u4e3atrue\u5219\u4e0d\u8fdb\u884c\u6e05\u5c4f\uff0c\u76f4\u63a5\u5237\u4e0a\u65b0\u5185\u5bb9\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "eink.draw"}, "eink.line": {"body": "eink.line(${1:x},${2:y},${3:x2},${4:y2},${5:colored})", "description": "eink.line(x, y, x2, y2, colored) - \u7f13\u51b2\u533a\u7ed8\u5236\u7ebf\n\u4f20\u5165\u503c\uff1a\nint \u8d77\u70b9x\u5750\u6807\nint \u8d77\u70b9y\u5750\u6807\nint \u7ec8\u70b9x\u5750\u6807\nint \u7ec8\u70b9y\u5750\u6807\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\neink.line(0, 0, 10, 20, 0)\n", "prefix": "eink.line"}, "eink.rect": {"body": "eink.rect(${1:x},${2:y},${3:x2},${4:y2},${5:colored},${6:fill})", "description": "eink.rect(x, y, x2, y2, colored, fill) - \u7f13\u51b2\u533a\u7ed8\u5236\u77e9\u5f62\n\u4f20\u5165\u503c\uff1a\nint \u5de6\u4e0a\u9876\u70b9x\u5750\u6807\nint \u5de6\u4e0a\u9876\u70b9y\u5750\u6807\nint \u53f3\u4e0b\u9876\u70b9x\u5750\u6807\nint \u53f3\u4e0b\u9876\u70b9y\u5750\u6807\nint \u9ed8\u8ba4\u662f0\nint \u662f\u5426\u586b\u5145,\u9ed8\u8ba4\u662f0,\u4e0d\u586b\u5145\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\neink.rect(0, 0, 10, 20)\neink.rect(0, 0, 10, 20,0, 1) -- Filled\n", "prefix": "eink.rect"}, "eink.circle": {"body": "eink.circle(${1:x},${2:y},${3:radius},${4:colored},${5:fill})", "description": "eink.circle(x, y, radius, colored, fill) - \u7f13\u51b2\u533a\u7ed8\u5236\u5706\u5f62\n\u4f20\u5165\u503c\uff1a\nint \u5706\u5fc3x\u5750\u6807\nint \u5706\u5fc3y\u5750\u6807\nint \u534a\u5f84\nint \u9ed8\u8ba4\u662f0\nint \u662f\u5426\u586b\u5145,\u9ed8\u8ba4\u662f0,\u4e0d\u586b\u5145\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\neink.circle(0, 0, 10)\neink.circle(0, 0, 10, 1, 1) -- Filled\n", "prefix": "eink.circle"}, "eink.qrcode": {"body": "eink.qrcode(${1:x},${2:y},${3:str},${4:size})", "description": "eink.qrcode(x, y, str, size) - \u7f13\u51b2\u533a\u7ed8\u5236QRCode\n\u4f20\u5165\u503c\uff1a\nint x\u5750\u6807\nint y\u5750\u6807\nstring \u4e8c\u7ef4\u7801\u7684\u5185\u5bb9\nint \u663e\u793a\u5927\u5c0f (\u6ce8\u610f:\u4e8c\u7ef4\u7801\u751f\u6210\u5927\u5c0f\u4e0e\u8981\u663e\u793a\u5185\u5bb9\u548c\u7ea0\u9519\u7b49\u7ea7\u6709\u5173,\u751f\u6210\u7248\u672c\u4e3a1-40(\u5bf9\u5e94 21x21 - 177x177)\u7684\u4e0d\u5b9a\u5927\u5c0f,\u5982\u679c\u548c\u8bbe\u7f6e\u5927\u5c0f\u4e0d\u540c\u4f1a\u81ea\u52a8\u5728\u6307\u5b9a\u7684\u533a\u57df\u4e2d\u95f4\u663e\u793a\u4e8c\u7ef4\u7801,\u5982\u4e8c\u7ef4\u7801\u672a\u663e\u793a\u8bf7\u67e5\u770b\u65e5\u5fd7\u63d0\u793a)\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "eink.qrcode"}, "eink.bat": {"body": "eink.bat(${1:x},${2:y},${3:bat})", "description": "eink.bat(x, y, bat) - \u7f13\u51b2\u533a\u7ed8\u5236\u7535\u6c60\n\u4f20\u5165\u503c\uff1a\nint x\u5750\u6807\nint y\u5750\u6807\nint \u7535\u6c60\u7535\u538b,\u5355\u4f4d\u6beb\u4f0f\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "eink.bat"}, "eink.weather_icon": {"body": "eink.weather_icon(${1:x},${2:y},${3:code})", "description": "eink.weather_icon(x, y, code) - \u7f13\u51b2\u533a\u7ed8\u5236\u5929\u6c14\u56fe\u6807\n\u4f20\u5165\u503c\uff1a\nint x\u5750\u6807\nint y\u5750\u6807\nint \u5929\u6c14\u4ee3\u53f7\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "eink.weather_icon"}, "eink.model": {"body": "eink.model(${1:m})", "description": "eink.model(m) - \u8bbe\u7f6e\u58a8\u6c34\u5c4f\u9a71\u52a8\u578b\u53f7\n\u4f20\u5165\u503c\uff1a\nint \u578b\u53f7\u540d\u79f0, \u4f8b\u5982 eink.model(eink.MODEL_1in54_V2)\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "eink.model"}, "eink.drawXbm": {"body": "eink.drawXbm(${1:x},${2:y},${3:w},${4:h},${5:data})", "description": "eink.drawXbm(x, y, w, h, data) - \u7ed8\u5236\u4f4d\u56fe\n\u4f20\u5165\u503c\uff1a\nint X\u5750\u6807\nint y\u5750\u6807\nint \u4f4d\u56fe\u5bbd\nint \u4f4d\u56fe\u9ad8\nint \u4f4d\u56fe\u6570\u636e,\u6bcf\u4e00\u4f4d\u4ee3\u8868\u4e00\u4e2a\u50cf\u7d20\n\u4f8b\u5b50\uff1a\n-- \u53d6\u6a21\u4f7f\u7528PCtoLCD2002\u8f6f\u4ef6\u5373\u53ef\n-- \u5728(0,0)\u4e3a\u5de6\u4e0a\u89d2,\u7ed8\u5236 16x16 \"\u4eca\" \u7684\u4f4d\u56fe\neink.drawXbm(0, 0, 16,16, string.char(\n 0x80,0x00,0x80,0x00,0x40,0x01,0x20,0x02,0x10,0x04,0x48,0x08,0x84,0x10,0x83,0x60,\n 0x00,0x00,0xF8,0x0F,0x00,0x08,0x00,0x04,0x00,0x04,0x00,0x02,0x00,0x01,0x80,0x00\n))\n", "prefix": "eink.drawXbm"}, "eink.setCtx": {"body": "eink.setCtx(${1:index})", "description": "eink.setCtx(index) - \u5207\u6362\u989c\u8272\u753b\u677f, \u9002\u5408\u591a\u8272\u58a8\u6c34\u5c4f\n\u4f20\u5165\u503c\uff1a\nint \u989c\u8272\u7d22\u5f15, \u9ed1\u8272\u4e3a0, \u7ea2\u8272\u4e3a1\n\u4f8b\u5b50\uff1a\n-- \u4ec5\u9002\u5408\u591a\u8272\u58a8\u6c34\u5c4f, \u5bf9\u5355\u8272\u58a8\u6c34\u5c4f(\u53ea\u6709\u9ed1\u767d)\u7684\u65e0\u6548\neink.setCtx(1)\n-- \u5207\u6362\u540e, \u6240\u6709drawXXX\u90fd\u4f1a\u64cd\u4f5c\u5728\u6307\u5b9a\u989c\u8272\u7684\u753b\u677f\n", "prefix": "eink.setCtx"}, "eink.async": {"body": "eink.async(${1:index})", "description": "eink.async(index) - \u5f02\u6b65\u65b9\u5f0f\uff0c\u4f7f\u7528\u6b64\u65b9\u5f0f\u9700\u8981\u5148 require(\"sysplus\") \u4e4b\u540e eink.clear().wait() eink.show().wait()\u8fdb\u884c\u5237\u5c4f\n\u4f20\u5165\u503c\uff1a\nint 1 \u4f7f\u7528\u5f02\u6b65\n\u4f8b\u5b50\uff1a\n eink.async(1)\n spi_eink = spi.deviceSetup(spi_id,pin_cs,0,0,8,20*1000*1000,spi.MSB,1,1)\n eink.init(eink.MODEL_1in54,\n {port = \"device\",pin_dc = pin_dc, pin_busy = pin_busy,pin_rst = pin_reset},\n spi_eink)\n eink.setWin(200, 200, 0)\n sys.wait(100)\n log.info(\"e-paper 1.54\", \"Testing Go\")\n eink.print(30, 20, \"LuatOS-AIR780E\",0x00)\n eink.show().wait()\n log.info(\"e-paper 1.54\", \"Testing End\")\n", "prefix": "eink.async"}, "ercoap.parse": {"body": "ercoap.parse(${1:data})", "description": "ercoap.parse(data) - \u89e3\u6790coap\u6570\u636e\u5305\n\u4f20\u5165\u503c\uff1a\nstring coap\u6570\u636e\u5305\n\u8fd4\u56de\u503c\uff1a\ntable \u6210\u529f\u8fd4\u56detable,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u662f\u89e3\u6790coap\u6570\u636e\u5305\nlocal rcoap = ercoap.parse(data)\nif rcoap then\n log.info(\"coap\", rcoap.type, rcoap.code, rcoap.payload)\n -- rcoap\u7684\u5c5e\u6027\n -- type \u6d88\u606f\u7c7b\u578b, 0 - CON \u9700\u8981\u7b54\u590d, 1 - NON \u65e0\u9700\u7b54\u590d, 2 - ACK \u5df2\u6536\u5230, 3 - RST \u51fa\u9519\u4e86\n -- msgid \u6d88\u606fid\n -- payload \u643a\u5e26\u7684\u6570\u636e\n -- code \u7c7b\u4f3c\u4e8ehttp\u7684statue code, \u901a\u8fc7\u6709 2xx \u6b63\u5e38, 4xx \u51fa\u9519\u4e86\nelse\n log.info(\"ercoap\", \"\u6570\u636e\u5305\u89e3\u6790\u5931\u8d25\")\nend\n", "prefix": "ercoap.parse"}, "ercoap.print": {"body": "ercoap.print(${1:data})", "description": "ercoap.print(data) - \u6253\u5370coap\u6570\u636e\u5305\n\u4f20\u5165\u503c\uff1a\nstring coap\u6570\u636e\u5305\n\u8fd4\u56de\u503c\uff1a\nboolean \u89e3\u6790\u6210\u529f\u8fd4\u56detrue\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5355\u7eaf\u5c31\u6253\u5370\u4e00\u4e0bcoap\u6570\u636e\u5305\n", "prefix": "ercoap.print"}, "ercoap.onenet": {"body": "ercoap.onenet(${1:tp},${2:product_id},${3:device_name},${4:token},${5:payload})", "description": "ercoap.onenet(tp, product_id, device_name, token, payload) - \u5feb\u901f\u751f\u6210onenet\u6570\u636e\u5305\n\u4f20\u5165\u503c\uff1a\nstring \u8bf7\u6c42\u7c7b\u578b,\u4f5c\u4e3areply\u65f6\u53ef\u9009,\u5176\u4ed6\u60c5\u51b5\u5fc5\u9009\nstring \u9879\u76eeid,\u5fc5\u987b\u586b\u5199\nstring \u8bbe\u5907\u540d\u79f0,\u5fc5\u987b\u586b\u5199\nstring token,\u5fc5\u987b\u586b\u5199\nstring \u7269\u6a21\u578bjson\u5b57\u7b26\u4e32,\u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nstring \u5408\u6210\u597d\u7684\u6570\u636e\u5305,\u53ef\u901a\u8fc7UDP\u4e0a\u884c\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003\u6587\u6863: coap\u63a5\u5165 https://open.iot.10086.cn/doc/v5/fuse/detail/924\n-- \u53c2\u8003\u6587\u6863: \u7269\u6a21\u578b https://open.iot.10086.cn/doc/v5/fuse/detail/902\n\n-- \u7c7b\u578b tp\u503c token\u6765\u6e90 payload\n-- \u767b\u9646 login iotauth.onenet\u51fd\u6570\u751f\u6210 \u65e0\n-- \u5fc3\u8df3 keep_live iotauth.onenet\u51fd\u6570\u751f\u6210 \u65e0\n-- \u767b\u51fa logout iotauth.onenet\u51fd\u6570\u751f\u6210 \u65e0\n-- \u5c5e\u6027\u4e0a\u62a5 thing/property/post login\u65f6\u83b7\u53d6 \u5fc5\u987b\u6709\n-- \u5c5e\u6027\u56de\u590d thing/property/reply login\u65f6\u83b7\u53d6 \u5fc5\u987b\u6709\n-- \u4e8b\u4ef6\u4e0a\u62a5 thing/event/post login\u65f6\u83b7\u53d6 \u5fc5\u987b\u6709\n-- \u8fdc\u7a0b\u8c03\u7528\u7b54\u590d \u65e0 login\u65f6\u83b7\u53d6 \u5fc5\u987b\u6709\n", "prefix": "ercoap.onenet"}, "errDump.dump": {"body": "errDump.dump(${1:zbuff},${2:type},${3:isDelete})", "description": "errDump.dump(zbuff, type, isDelete) - \u624b\u52a8\u8bfb\u53d6\u5f02\u5e38\u65e5\u5fd7\uff0c\u4e3b\u8981\u7528\u4e8e\u7528\u6237\u5c06\u65e5\u5fd7\u53d1\u9001\u7ed9\u81ea\u5df1\u7684\u670d\u52a1\u5668\u800c\u4e0d\u662fIOT\u5e73\u53f0\uff0c\u5982\u679c\u5728errDump.config\u914d\u7f6e\u4e86\u5468\u671f\u4e0a\u4f20\uff0c\u5219\u4e0d\u80fd\u4f7f\u7528\u672c\u51fd\u6570\n\u4f20\u5165\u503c\uff1a\nzbuff \u65e5\u5fd7\u4fe1\u606f\u7f13\u5b58\uff0c\u5982\u679c\u4e3anil\u5c31\u4e0d\u4f1a\u8bfb\u51fa\uff0c\u4e00\u822c\u5f53\nint \u65e5\u5fd7\u7c7b\u578b\uff0c\u76ee\u524d\u53ea\u6709errDump.TYPE_SYS\u548cerrDump.TYPE_USR\nboolean \u662f\u5426\u5220\u9664\u65e5\u5fd7\n\u8fd4\u56de\u503c\uff1a\nboolean true\u8868\u793a\u672c\u6b21\u8bfb\u53d6\u524d\u5e76\u6ca1\u6709\u5199\u5165\u6570\u636e\uff0cfalse\u53cd\u4e4b\uff0c\u5728\u5220\u9664\u65e5\u5fd7\u524d\uff0c\u6700\u597d\u518d\u8bfb\u4e00\u4e0b\u786e\u4fdd\u6ca1\u6709\u65b0\u7684\u6570\u636e\u5199\u5165\u4e86\n\u4f8b\u5b50\uff1a\nlocal result = errDump.dump(buff, errDump.TYPE_SYS, false) --\u8bfb\u51fa\u7cfb\u7edf\u8bb0\u5f55\u7684\u5f02\u5e38\u65e5\u5fd7\nlocal result = errDump.dump(nil, errDump.TYPE_SYS, true) --\u6e05\u9664\u7cfb\u7edf\u8bb0\u5f55\u7684\u5f02\u5e38\u65e5\u5fd7\n", "prefix": "errDump.dump"}, "errDump.record": {"body": "errDump.record(${1:string})", "description": "errDump.record(string) - \u5199\u5165\u7528\u6237\u7684\u5f02\u5e38\u65e5\u5fd7\uff0c\u6ce8\u610f\u6700\u5927\u53ea\u67094KB\uff0c\u8d85\u8fc7\u90e8\u5206\u65b0\u7684\u8986\u76d6\u65e7\u7684\uff0c\u5f00\u542f\u81ea\u52a8\u4e0a\u4f20\u540e\u4f1a\u4e0a\u4f20\u5230\u5408\u5b99IOT\u5e73\u53f0\n\u4f20\u5165\u503c\uff1a\nstring \u65e5\u5fd7\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nerrDump.record(\"socket long time no connect\") --\u8bb0\u5f55\u4e0b\"socket long time no connect\"\n", "prefix": "errDump.record"}, "errDump.config": {"body": "errDump.config(${1:enable},${2:period},${3:user_flag},${4:custom_id},${5:host},${6:port})", "description": "errDump.config(enable, period, user_flag, custom_id, host, port) - \u914d\u7f6e\u5173\u952e\u65e5\u5fd7\u4e0a\u4f20IOT\u5e73\u53f0\uff0c\u8fd9\u91cc\u7684\u65e5\u5fd7\u5305\u62ec\u5f15\u8d77luavm\u5f02\u5e38\u9000\u51fa\u7684\u65e5\u5fd7\u548c\u7528\u6237\u901a\u8fc7record\u5199\u5165\u7684\u65e5\u5fd7\uff0c\u7c7b\u4f3c\u4e8eair\u7684errDump\n\u4f20\u5165\u503c\uff1a\nboolean \u662f\u5426\u542f\u7528\u8bb0\u5f55\u529f\u80fd\uff0cfalse\u7684\u8bdd\u5c06\u4e0d\u4f1a\u8bb0\u5f55\u4efb\u4f55\u65e5\u5fd7\nint \u5b9a\u65f6\u4e0a\u4f20\u5468\u671f\uff0c\u5355\u4f4d\u79d2\uff0c\u9ed8\u8ba4600\u79d2\uff0c\u8fd9\u4e2a\u662f\u81ea\u52a8\u4e0a\u4f20\u65f6\u5019\u540e\u7684\u91cd\u8bd5\u65f6\u95f4\u65f6\u95f4\uff0c\u5728\u5f00\u673a\u540e\u6216\u8005\u6709record\u64cd\u4f5c\u540e\u4f1a\u5f88\u5feb\u5c1d\u8bd5\u4e0a\u4f20\u5230\u5408\u5b99IOT\u5e73\u53f0\u4e00\u6b21\uff0c\u5982\u679c\u4e3a0\uff0c\u5219\u4e0d\u4f1a\u4e0a\u4f20\uff0c\u7531\u7528\u6237dump\u540e\u81ea\u5df1\u4e0a\u4f20\u81ea\u5df1\u7684\u5e73\u53f0\nstring \u7528\u6237\u7684\u7279\u6b8a\u6807\u8bc6\uff0c\u53ef\u4ee5\u4e3a\u7a7a\nstring \u8bbe\u5907\u8bc6\u522b\u53f7, 4G\u8bbe\u5907\u9ed8\u8ba4\u662fimei,\u5176\u4ed6\u8bbe\u5907\u9ed8\u8ba4\u662fmcu.unique_id\nstring \u670d\u52a1\u5668\u57df\u540d,\u9ed8\u8ba4dev_msg1.openluat.com\nint \u670d\u52a1\u5668\u7aef\u53e3,\u9ed8\u8ba4\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nerrDump.config(true, 3600, \"12345678\") --\u4e00\u4e2a\u5c0f\u65f6\u5c1d\u8bd5\u4e0a\u6b21\u4e00\u6b21\uff0c\u4e0a\u4f20\u65f6\u4f1a\u5728imei\u540e\u9644\u52a0\u4e0a12345678\nerrDump.config(false) --\u5173\u95ed\u8bb0\u5f55\u529f\u80fd\uff0c\u4e0d\u518d\u4e0a\u4f20\nerrDump.config(true, 0) --\u8bb0\u5f55\uff0c\u4f46\u662f\u4e0d\u4f1a\u4e3b\u52a8\u4e0a\u4f20\uff0c\u7531\u7528\u6237\u5b9e\u73b0\u4e0a\u4f20\u529f\u80fd\n\n-- 2023.09.22\u65b0\u589ecustom_id\u53c2\u6570\nerrDump.config(true, 3600, nil, \"ABC\") --\u4e00\u4e2a\u5c0f\u65f6\u5c1d\u8bd5\u4e0a\u6b21\u4e00\u6b21\uff0c\u4e0a\u4f20\u65f6\u4f7f\u7528\u81ea\u5b9a\u4e49\u7684\u8bbe\u5907\u8bc6\u522b\u53f7ABC\n\n-- 2023.12.8 \u65b0\u589ehost\u548cport\u53c2\u6570\nerrDump.config(true, 3600, nil, nil, \"dev_msg1.openluat.com\", 12425)\n", "prefix": "errDump.config"}, "fastlz.compress": {"body": "fastlz.compress(${1:data},${2:level})", "description": "fastlz.compress(data, level) - \u5feb\u901f\u538b\u7f29\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u538b\u7f29\u7684\u6570\u636e, \u5c11\u4e8e400\u5b57\u8282\u7684\u6570\u636e\u4e0d\u5efa\u8bae\u538b\u7f29, \u4e14\u538b\u7f29\u540e\u7684\u6570\u636e\u4e0d\u80fd\u5927\u4e8e32k\nint \u538b\u7f29\u7ea7\u522b,\u9ed8\u8ba41, \u53ef\u90091\u6216\u80052, 2\u7684\u538b\u7f29\u6bd4\u66f4\u9ad8(\u6709\u65f6\u5019)\n\u8fd4\u56de\u503c\uff1a\nstring \u82e5\u538b\u7f29\u6210\u529f,\u8fd4\u56de\u6570\u636e\u5b57\u7b26\u4e32, \u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f, \u538b\u7f29\u8fc7\u7a0b\u7684\u5185\u5b58\u6d88\u8017\u5982\u4e0b\n-- \u7cfb\u7edf\u5185\u5b58, \u56fa\u5b9a32k\n-- lua\u5185\u5b58, \u539f\u59cb\u6570\u636e\u7684\u5927\u5c0f\u76841.05\u500d,\u6700\u5c0f\u5360\u75281024\u5b57\u8282.\n", "prefix": "fastlz.compress"}, "fastlz.uncompress": {"body": "fastlz.uncompress(${1:data},${2:maxout})", "description": "fastlz.uncompress(data, maxout) - \u5feb\u901f\u89e3\u538b\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u89e3\u538b\u7684\u6570\u636e\nint \u89e3\u538b\u540e\u7684\u6700\u5927\u5927\u5c0f, \u9ed8\u8ba4\u662f4k, \u53ef\u6309\u9700\u8c03\u6574\n\u8fd4\u56de\u503c\uff1a\nstring \u82e5\u89e3\u538b\u6210\u529f,\u8fd4\u56de\u6570\u636e\u5b57\u7b26\u4e32, \u5426\u5219\u8fd4\u56denil\n", "prefix": "fastlz.uncompress"}, "fatfs.mount": {"body": "fatfs.mount(${1:mode},${2:mount_point},${3:spiid_or_spidevice},${4:spi_cs},${5:spi_speed},${6:power_pin},${7:power_on_delay},${8:auto_format})", "description": "fatfs.mount(mode,mount_point, spiid_or_spidevice, spi_cs, spi_speed, power_pin, power_on_delay, auto_format) - \u6302\u8f7dfatfs\n\u4f20\u5165\u503c\uff1a\nint fatfs\u6a21\u5f0f,\u53ef\u9009fatfs.SPI,fatfs.SDIO,fatfs.RAM,fatfs.USB\nstring \u865a\u62df\u6587\u4ef6\u7cfb\u7edf\u7684\u6302\u8f7d\u70b9, \u9ed8\u8ba4\u662f /fatfs\nint \u4f20\u5165spi device\u6307\u9488,\u6216\u8005spi\u7684id,\u6216\u8005sdio\u7684id\nint \u7247\u9009\u811a\u7684GPIO \u53f7, spi\u6a21\u5f0f\u6709\u6548,\u82e5\u524d\u4e00\u4e2a\u53c2\u6570\u4f20\u7684\u662fspi device,\u8fd9\u4e2a\u53c2\u6570\u5c31\u4e0d\u9700\u8981\u4f20\nint SPI\u6700\u9ad8\u901f\u5ea6,\u9ed8\u8ba410M, \u82e5\u524d2\u4e2a\u53c2\u6570\u4f20\u7684\u662fspi device,\u8fd9\u4e2a\u53c2\u6570\u5c31\u4e0d\u9700\u8981\u4f20\nint TF\u5361\u7535\u6e90\u63a7\u5236\u811a,TF\u5361\u521d\u59cb\u524d\u5148\u62c9\u4f4e\u590d\u4f4d\u518d\u62c9\u9ad8,\u5982\u679c\u6ca1\u6709,\u6216\u8005\u662f\u5185\u7f6e\u7535\u6e90\u63a7\u5236\u65b9\u5f0f,\u8fd9\u4e2a\u53c2\u6570\u5c31\u4e0d\u9700\u8981\u4f20\nint TF\u5361\u7535\u6e90\u590d\u4f4d\u8fc7\u7a0b\u65f6\u95f4,\u5355\u4f4dms,\u9ed8\u8ba4\u503c\u662f1\nbool \u6302\u8f7d\u5931\u8d25\u662f\u5426\u5c1d\u8bd5\u683c\u5f0f\u5316,\u9ed8\u8ba4\u662ftrue,\u5373\u81ea\u52a8\u683c\u5f0f\u5316. \u672c\u53c2\u6570\u57282023.8.16\u6dfb\u52a0\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue, \u5426\u5219\u8fd4\u56denil\u6216\u8005false\nstring \u5931\u8d25\u7684\u539f\u56e0\n\u4f8b\u5b50\uff1a\n-- \u65b9\u6cd51, \u4f7f\u7528SPI\u6a21\u5f0f\n local spiId = 2\n local result = spi.setup(\n spiId,--\u4e32\u53e3id\n 255, -- \u4e0d\u4f7f\u7528\u9ed8\u8ba4CS\u811a\n 0,--CPHA\n 0,--CPOL\n 8,--\u6570\u636e\u5bbd\u5ea6\n 400*1000 -- \u521d\u59cb\u5316\u65f6\u4f7f\u7528\u8f83\u4f4e\u7684\u9891\u7387\n )\n local TF_CS = pin.PB3\n gpio.setup(TF_CS, 1)\n --fatfs.debug(1) -- \u82e5\u6302\u8f7d\u5931\u8d25,\u53ef\u4ee5\u5c1d\u8bd5\u6253\u5f00\u8c03\u8bd5\u4fe1\u606f,\u67e5\u627e\u539f\u56e0\n -- \u63d0\u9192, \u82e5TF/SD\u6a21\u5757\u5e26\u7535\u5e73\u8f6c\u6362, \u901a\u5e38\u4e0d\u652f\u630110M\u4ee5\u4e0a\u7684\u6ce2\u7279\u7387!!\n fatfs.mount(fatfs.SPI,\"SD\", spiId, TF_CS, 24000000)\n local data, err = fatfs.getfree(\"SD\")\n if data then\n log.info(\"fatfs\", \"getfree\", json.encode(data))\n else\n log.info(\"fatfs\", \"err\", err)\n end\n -- \u5f80\u4e0b\u7684\u64cd\u4f5c, \u4f7f\u7528 io.open(\"/sd/xxx\", \"w+\") \u7b49io\u5e93\u7684API\u5c31\u53ef\u4ee5\u4e86\n", "prefix": "fatfs.mount"}, "fatfs.unmount": {"body": "fatfs.unmount(${1:mount_point})", "description": "fatfs.unmount(mount_point) - \u53d6\u6d88\u6302\u8f7dfatfs\n\u4f20\u5165\u503c\uff1a\nstring \u865a\u62df\u6587\u4ef6\u7cfb\u7edf\u7684\u6302\u8f7d\u70b9, \u9ed8\u8ba4\u662f fatfs,\u5fc5\u987b\u4e0efatfs.mount\u4e00\u81f4\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u8fd4\u56de0, \u5426\u5219\u8fd4\u56de\u5931\u8d25\u7801\n\u4f8b\u5b50\uff1a\nfatfs.mount(\"SD\")\n", "prefix": "fatfs.unmount"}, "fatfs.getfree": {"body": "fatfs.getfree(${1:mount_point})", "description": "fatfs.getfree(mount_point) - \u83b7\u53d6\u53ef\u7528\u7a7a\u95f4\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nstring \u6302\u8f7d\u70b9, \u9700\u8981\u8ddffatfs.mount\u4f20\u5165\u7684\u503c\u4e00\u81f4\n\u8fd4\u56de\u503c\uff1a\ntable \u82e5\u6210\u529f\u4f1a\u8fd4\u56detable,\u5426\u5219\u8fd4\u56denil\nint \u5bfc\u81f4\u5931\u8d25\u7684\u5e95\u5c42\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- table\u5305\u542b\u7684\u5185\u5bb9\u6709\n-- total_sectors \u603b\u6247\u533a\u6570\u91cf\n-- free_sectors \u7a7a\u95f2\u6247\u533a\u6570\u91cf\n-- total_kb \u603b\u5b57\u8282\u6570,\u5355\u4f4dkb\n-- free_kb \u7a7a\u95f2\u5b57\u8282\u6570, \u5355\u4f4dkb\n-- \u6ce8\u610f,\u5f53\u524d\u6247\u533a\u5927\u5c0f\u56fa\u5b9a\u5728512\u5b57\u8282\n\n local data, err = fatfs.getfree(\"SD\")\n if data then\n log.info(\"fatfs\", \"getfree\", json.encode(data))\n else\n log.info(\"fatfs\", \"err\", err)\n end\n", "prefix": "fatfs.getfree"}, "fatfs.debug": {"body": "fatfs.debug(${1:value})", "description": "fatfs.debug(value) - \u8bbe\u7f6e\u8c03\u8bd5\u6a21\u5f0f\n\u4f20\u5165\u503c\uff1a\nbool \u662f\u5426\u8fdb\u5165\u8c03\u8bd5\u6a21\u5f0f,true\u4ee3\u8868\u8fdb\u5165\u8c03\u8bd5\u6a21\u5f0f,\u589e\u52a0\u8c03\u8bd5\u65e5\u5fd7\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "fatfs.debug"}, "fdb.kvdb_init": {"body": "fdb.kvdb_init(${1:name},${2:partition})", "description": "fdb.kvdb_init(name, partition) - \u521d\u59cb\u5316kv\u6570\u636e\u5e93\n\u4f20\u5165\u503c\uff1a\nstring \u6570\u636e\u5e93\u540d,\u5f53\u524d\u4ec5\u652f\u6301env\nstring FAL\u5206\u533a\u540d,\u5f53\u524d\u4ec5\u652f\u6301onchip_fdb\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- fdb\u5e93\u57fa\u4e8e flashdb , \u518d\u6b21\u8868\u793a\u611f\u8c22.\nif fdb.kvdb_init(\"env\", \"onchip_fdb\") then\n log.info(\"fdb\", \"kv\u6570\u636e\u5e93\u521d\u59cb\u5316\u6210\u529f\")\nend\n\n-- \u5173\u4e8e\u6e05\u7a7afdb\u5e93\n-- \u4e0b\u8f7d\u5de5\u5177\u662f\u6ca1\u6709\u63d0\u4f9b\u76f4\u63a5\u6e05\u9664fdb\u6570\u636e\u7684\u9014\u5f84\u7684, \u4f46\u6709\u6709\u529e\u6cd5\u89e3\u51b3\n-- \u5199\u4e00\u4e2amain.lua, \u6267\u884c fdb.kvdb_init \u540e \u6267\u884c fdb.clear() \u5373\u53ef\u5168\u6e05fdb\u6570\u636e.\n", "prefix": "fdb.kvdb_init"}, "fdb.kv_set": {"body": "fdb.kv_set(${1:key},${2:value})", "description": "fdb.kv_set(key, value) - \u8bbe\u7f6e\u4e00\u5bf9kv\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring key\u7684\u540d\u79f0,\u5fc5\u586b,\u4e0d\u80fd\u7a7a\u5b57\u7b26\u4e32\nstring \u7528\u6237\u6570\u636e,\u5fc5\u586b,\u4e0d\u80fdnil, \u652f\u6301\u5b57\u7b26\u4e32/\u6570\u503c/table/\u5e03\u5c14\u503c, \u6570\u636e\u957f\u5ea6\u6700\u5927255\u5b57\u8282\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\nnumber \u7b2c\u4e8c\u4e2a\u4e3a\u8fd4\u56de\u4e3aflashdb\u7684fdb_kv_set_blob\u8fd4\u56de\u8be6\u7ec6\u72b6\u6001,0\uff1a\u65e0\u9519\u8bef 1:\u64e6\u9664\u9519\u8bef 2:\u8bfb\u9519\u8bef 3:\u5199\u9519\u8bef 4:\u672a\u627e\u5230 5:kv\u540d\u5b57\u9519\u8bef 6:kv\u540d\u5b57\u5b58\u5728 7:\u5df2\u4fdd\u5b58 8:\u521d\u59cb\u5316\u9519\u8bef\n\u4f8b\u5b50\uff1a\nif fdb.kvdb_init(\"env\", \"onchip_fdb\") then\n log.info(\"fdb\", fdb.kv_set(\"wendal\", \"goodgoodstudy\"))\nend\n", "prefix": "fdb.kv_set"}, "fdb.kv_get": {"body": "fdb.kv_get(${1:key},${2:skey})", "description": "fdb.kv_get(key, skey) - \u6839\u636ekey\u83b7\u53d6\u5bf9\u5e94\u7684\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring key\u7684\u540d\u79f0,\u5fc5\u586b,\u4e0d\u80fd\u7a7a\u5b57\u7b26\u4e32\nstring \u53ef\u9009\u7684\u6b21\u7ea7key,\u4ec5\u5f53\u539f\u59cb\u503c\u4e3atable\u65f6\u6709\u6548,\u76f8\u5f53\u4e8e fdb.kv_get(key)[skey]\n\u8fd4\u56de\u503c\uff1a\nany \u5b58\u5728\u5219\u8fd4\u56de\u6570\u636e,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nif fdb.kvdb_init(\"env\", \"onchip_fdb\") then\n log.info(\"fdb\", fdb.kv_get(\"wendal\"))\nend\n", "prefix": "fdb.kv_get"}, "fdb.kv_del": {"body": "fdb.kv_del(${1:key})", "description": "fdb.kv_del(key) - \u6839\u636ekey\u5220\u9664\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring key\u7684\u540d\u79f0,\u5fc5\u586b,\u4e0d\u80fd\u7a7a\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nif fdb.kvdb_init(\"env\", \"onchip_fdb\") then\n log.info(\"fdb\", fdb.kv_del(\"wendal\"))\nend\n", "prefix": "fdb.kv_del"}, "fdb.kv_clr": {"body": "fdb.kv_clr()", "description": "fdb.kv_clr() - \u6e05\u7a7a\u6574\u4e2akv\u6570\u636e\u5e93\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u6e05\u7a7a\nfdb.kv_clr()\n", "prefix": "fdb.kv_clr"}, "fdb.kv_iter": {"body": "fdb.kv_iter()", "description": "fdb.kv_iter() - kv\u6570\u636e\u5e93\u8fed\u4ee3\u5668\n\u8fd4\u56de\u503c\uff1a\nuserdata \u6210\u529f\u8fd4\u56de\u8fed\u4ee3\u5668\u6307\u9488,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u6e05\u7a7a\nlocal iter = fdb.kv_iter()\nif iter then\n while 1 do\n local k = fdb.kv_next(iter)\n if not k then\n break\n end\n log.info(\"fdb\", k, \"value\", fdb.kv_get(k))\n end\nend\n", "prefix": "fdb.kv_iter"}, "fdb.kv_next": {"body": "fdb.kv_next(${1:iter})", "description": "fdb.kv_next(iter) - kv\u8fed\u4ee3\u5668\u83b7\u53d6\u4e0b\u4e00\u4e2akey\n\u4f20\u5165\u503c\uff1a\nuserdata fdb.kv_iter()\u8fd4\u56de\u7684\u6307\u9488\n\u8fd4\u56de\u503c\uff1a\nstring \u6210\u529f\u8fd4\u56de\u5b57\u7b26\u4e32key\u503c, \u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u6e05\u7a7a\nlocal iter = fdb.kv_iter()\nif iter then\n while 1 do\n local k = fdb.kv_next(iter)\n if not k then\n break\n end\n log.info(\"fdb\", k, \"value\", fdb.kv_get(k))\n end\nend\n", "prefix": "fdb.kv_next"}, "fdb.kv_stat": {"body": "fdb.kv_stat()", "description": "fdb.kv_stat() - \u83b7\u53d6kv\u6570\u636e\u5e93\u72b6\u6001\n\u8fd4\u56de\u503c\uff1a\nint \u5df2\u4f7f\u7528\u7684\u7a7a\u95f4,\u5355\u4f4d\u5b57\u8282\nint \u603b\u53ef\u7528\u7a7a\u95f4, \u5355\u4f4d\u5b57\u8282\nint \u603bkv\u952e\u503c\u5bf9\u6570\u91cf, \u5355\u4f4d\u4e2a\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e2022.07.23 \u6dfb\u52a0\nlocal used,maxs,kv_count = fdb.kv_stat()\nlog.info(\"fdb\", \"kv\", used,maxs,kv_count)\n", "prefix": "fdb.kv_stat"}, "fonts.list": {"body": "fonts.list(${1:tp})", "description": "fonts.list(tp) - \u8fd4\u56de\u56fa\u4ef6\u652f\u6301\u7684\u5b57\u4f53\u5217\u8868\n\u4f20\u5165\u503c\uff1a\nstring \u7c7b\u578b, \u9ed8\u8ba4 u8g2, \u8fd8\u53ef\u4ee5\u662flvgl\n\u8fd4\u56de\u503c\uff1a\ntable \u5b57\u4f53\u5217\u8868\n\u4f8b\u5b50\uff1a\n-- API\u65b0\u589e\u4e8e2022-07-12\nif fonts.list then\n log.info(\"fonts\", \"u8g2\", json.encode(fonts.list(\"u8g2\")))\nend\n", "prefix": "fonts.list"}, "fonts.u8g2_get": {"body": "fonts.u8g2_get(${1:name},${2:tp})", "description": "fonts.u8g2_get(name, tp) - \u83b7\u53d6\u5b57\u4f53\n\u4f20\u5165\u503c\uff1a\nstring \u5b57\u4f53\u540d\u79f0, \u4f8b\u5982opposansm8_chinese unifont_t_symbols\nstring \u7c7b\u578b, \u9ed8\u8ba4 u8g2, \u8fd8\u53ef\u4ee5\u662flvgl\n\u8fd4\u56de\u503c\uff1a\nuserdata \u82e5\u5b57\u4f53\u5b58\u653e,\u8fd4\u56de\u5b57\u4f53\u6307\u9488, \u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\noppo_8 = fonts.get(\"opposansm8_chinese\", \"u8g2\")\nif oppo_8 then\n u8g2.SetFont(oppo_8)\nelse\n log.warn(\"fonts\", \"no such font opposansm8_chinese\")\nend\n-- \u82e5\u4f7f\u7528\u4e91\u7f16\u8bd1\u7684\u81ea\u5b9a\u4e49\u5b57\u5e93, \u4f7f\u7528\u65b9\u5f0f\u5982\u4e0b\noppo_8 = fonts.get(\"oppo_bold_8\", \"u8g2\") -- oppo_bold_8 \u662f\u4e91\u7f16\u8bd1\u754c\u9762\u7684\u5b57\u5e93\u547d\u540d\nif oppo_8 then\n u8g2.SetFont(oppo_8)\nelse\n log.warn(\"fonts\", \"no such font opposansm8_chinese\")\nend\n", "prefix": "fonts.u8g2_get"}, "fonts.u8g2_load": {"body": "fonts.u8g2_load(${1:path},${2:path})", "description": "fonts.u8g2_load(path, path) - \u4ece\u6587\u4ef6\u52a0\u8f7d\u5b57\u4f53\n\u4f20\u5165\u503c\uff1a\nstring \u5b57\u4f53\u8def\u5f84, \u4f8b\u5982 /luadb/abc.bin\nstring \u7c7b\u578b, \u9ed8\u8ba4 u8g2. \u4e5f\u652f\u6301lvgl\n\u8fd4\u56de\u503c\uff1a\nuserdata \u82e5\u5b57\u4f53\u5b58\u653e,\u8fd4\u56de\u5b57\u4f53\u6307\u9488, \u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- API\u65b0\u589e\u4e8e2022-07-11\n-- \u63d0\u9192: \u82e5\u6587\u4ef6\u4f4d\u4e8e/luadb\u4e0b, \u4e0d\u9700\u8981\u5360\u7528\u5185\u5b58\n-- \u82e5\u6587\u4ef6\u5904\u4e8e\u5176\u4ed6\u8def\u5f84, \u4f8b\u5982tf/sd\u5361, spi flash, \u4f1a\u81ea\u52a8\u52a0\u8f7d\u5230\u5185\u5b58, \u6d88\u8017lua vm\u7684\u5185\u5b58\u7a7a\u95f4\n-- \u52a0\u8f7d\u540e\u8bf7\u9002\u5f53\u5f15\u7528, \u4e0d\u5fc5\u53cd\u590d\u52a0\u8f7d\u540c\u4e00\u4e2a\u5b57\u4f53\u6587\u4ef6\noppo12 = fonts.load(\"/luadb/oppo12.bin\")\nif oppo12 then\n u8g2.SetFont(oppo12)\nelse\n log.warn(\"fonts\", \"no such font file oppo12.bin\")\nend\n", "prefix": "fonts.u8g2_load"}, "fota.init": {"body": "fota.init(${1:storge_location},${2:len},${3:param1},${4:param2})", "description": "fota.init(storge_location, len, param1, param2) - \u521d\u59cb\u5316fota\u6d41\u7a0b\n\u4f20\u5165\u503c\uff1a\nint/string fota\u6570\u636e\u5b58\u50a8\u7684\u8d77\u59cb\u4f4d\u7f6e
\u5982\u679c\u662fint\uff0c\u5219\u662f\u7531\u82af\u7247\u5e73\u53f0\u5177\u4f53\u5224\u65ad
\u5982\u679c\u662fstring\uff0c\u5219\u5b58\u50a8\u5728\u6587\u4ef6\u7cfb\u7edf\u4e2d
\u5982\u679c\u4e3anil\uff0c\u5219\u7531\u5e95\u5c42\u51b3\u5b9a\u5b58\u50a8\u4f4d\u7f6e\nint \u6570\u636e\u5b58\u50a8\u7684\u6700\u5927\u7a7a\u95f4\nuserdata param1\uff0c\u5982\u679c\u6570\u636e\u5b58\u50a8\u5728spiflash\u65f6,\u4e3aspi_device\nint param2\uff0c\u76ee\u524d\u53ea\u7528\u4e8e\u5916\u90e8flash\u66f4\u65b0\u65f6, spiflash\u7535\u6e90\u63a7\u5236\u811a\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue, \u5931\u8d25\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316fota\u6d41\u7a0b\nlocal result = fota.init(0, 0x00300000, spi_device) --\u7531\u4e8e105\u7684flash\u4ece0x01000000\u5f00\u59cb\uff0c\u6240\u4ee50\u5c31\u662f\u5916\u90e8spiflash\nlocal result = fota.init() --ec618\u7cfb\u5217/EC7XX\u7cfb\u5217\u4f7f\u7528\u56fa\u5b9a\u5185\u90e8\u5730\u5740\uff0c\u6240\u4ee5\u4e0d\u9700\u8981\u53c2\u6570\u4e86\nlocal result = fota.init(0xe0000000, 0, spi_device, 27) --EC7XX\u7cfb\u5217\u5141\u8bb8\u4f7f\u7528\u5916\u90e8flash\u66f4\u65b0\uff0c\u4f46\u662f\u5730\u5740\u5fc5\u987b\u52a0\u4e0a0xe0000000\u7684\u504f\u79fb\n", "prefix": "fota.init"}, "fota.wait": {"body": "fota.wait()", "description": "fota.wait() - \u7b49\u5f85\u5e95\u5c42fota\u6d41\u7a0b\u51c6\u5907\u597d\n\u4f20\u5165\u503c\uff1a\nboolean \u662f\u5426\u5b8c\u6574\u8d70\u5b8c\u6d41\u7a0b\uff0ctrue \u8868\u793a\u6b63\u786e\u8d70\u5b8c\u6d41\u7a0b\u4e86\n\u8fd4\u56de\u503c\uff1a\nboolean \u51c6\u5907\u597d\u8fd4\u56detrue\n\u4f8b\u5b50\uff1a\nlocal isDone = fota.wait()\n", "prefix": "fota.wait"}, "fota.run": {"body": "fota.run(${1:buff},${2:offset},${3:len})", "description": "fota.run(buff, offset, len) - \u5199\u5165fota\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nzbuff/string fota\u6570\u636e\uff0c\u5c3d\u91cf\u7528zbuff\nint \u8d77\u59cb\u504f\u79fb\u91cf,\u4f20\u5165zbuff\u65f6\u6709\u6548,\u9ed8\u8ba4\u662f0\nint \u5199\u5165\u957f\u5ea6,\u4f20\u5165zbuff\u65f6\u6709\u6548,\u9ed8\u8ba4\u662fzbuff:used()\n\u8fd4\u56de\u503c\uff1a\nboolean \u6709\u5f02\u5e38\u8fd4\u56defalse\uff0c\u65e0\u5f02\u5e38\u8fd4\u56detrue\nboolean \u63a5\u6536\u5230\u6700\u540e\u4e00\u5757\u8fd4\u56detrue\nint \u8fd8\u672a\u5199\u5165\u7684\u6570\u636e\u91cf\uff0c\u8d85\u8fc764K\u5fc5\u987b\u505a\u7b49\u5f85\n\u4f8b\u5b50\uff1a\nlocal result, isDone, cache = fota.run(buf) -- \u5199\u5165fota\u6d41\u7a0b\n\n-- \u63d0\u793a: \uff0c\u5982\u679c\u4f20\u5165\u7684\u662fzbuff\uff0c\u5199\u5165\u6210\u529f\u540e\uff0c\u8bf7\u81ea\u884c\u6e05\u7a7azbuff\u5185\u7684\u6570\u636e\n\n-- 2024.4.3\u65b0\u589eoffset, len\u53c2\u6570, \u4ec5\u5bf9zbuff\u6709\u6548\nfota.run(buff, 0, 1024)\n", "prefix": "fota.run"}, "fota.file": {"body": "fota.file(${1:path})", "description": "fota.file(path) - \u4ece\u6307\u5b9a\u6587\u4ef6\u8bfb\u53d6fota\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring \u6587\u4ef6\u8def\u5f84\n\u8fd4\u56de\u503c\uff1a\nboolean \u6709\u5f02\u5e38\u8fd4\u56defalse\uff0c\u65e0\u5f02\u5e38\u8fd4\u56detrue\nboolean \u63a5\u6536\u5230\u6700\u540e\u4e00\u5757\u8fd4\u56detrue\nint \u8fd8\u672a\u5199\u5165\u7684\u6570\u636e\u91cf\uff0c\u8d85\u8fc764K\u5fc5\u987b\u505a\u7b49\u5f85\n\u4f8b\u5b50\uff1a\nlocal result, isDone, cache = fota.file(\"/xxx.bin\") -- \u5199\u5165fota\u6d41\u7a0b\n-- \u672cAPI\u4e8e2023.03.23 \u6dfb\u52a0\n", "prefix": "fota.file"}, "fota.isDone": {"body": "fota.isDone()", "description": "fota.isDone() - \u7b49\u5f85\u5e95\u5c42fota\u6d41\u7a0b\u5b8c\u6210\n\u8fd4\u56de\u503c\uff1a\nboolean \u6709\u5f02\u5e38\u8fd4\u56defalse\uff0c\u65e0\u5f02\u5e38\u8fd4\u56detrue\nboolean \u5199\u5165\u5230\u6700\u540e\u4e00\u5757\u8fd4\u56detrue\n\u4f8b\u5b50\uff1a\nlocal result, isDone = fota.isDone()\n", "prefix": "fota.isDone"}, "fota.finish": {"body": "fota.finish(${1:is_ok})", "description": "fota.finish(is_ok) - \u7ed3\u675ffota\u6d41\u7a0b\n\u4f20\u5165\u503c\uff1a\nboolean \u662f\u5426\u5b8c\u6574\u8d70\u5b8c\u6d41\u7a0b\uff0ctrue \u8868\u793a\u6b63\u786e\u8d70\u5b8c\u6d41\u7a0b\u4e86\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue, \u5931\u8d25\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u7ed3\u675ffota\u6d41\u7a0b\nlocal result = fota.finish(true)\n", "prefix": "fota.finish"}, "fs.fsstat": {"body": "fs.fsstat(${1:path})", "description": "fs.fsstat(path) - \u83b7\u53d6\u6587\u4ef6\u7cfb\u7edf\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nstring \u8def\u5f84,\u9ed8\u8ba4\"/\",\u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nboolean \u83b7\u53d6\u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\nint \u603b\u7684block\u6570\u91cf\nint \u5df2\u4f7f\u7528\u7684block\u6570\u91cf\nint block\u7684\u5927\u5c0f,\u5355\u4f4d\u5b57\u8282\nstring \u6587\u4ef6\u7cfb\u7edf\u7c7b\u578b,\u4f8b\u5982lfs\u4ee3\u8868littlefs\n\u4f8b\u5b50\uff1a\n-- \u6253\u5370\u6839\u5206\u533a\u7684\u4fe1\u606f\nlog.info(\"fsstat\", fs.fsstat(\"/\"))\n", "prefix": "fs.fsstat"}, "fs.fsize": {"body": "fs.fsize(${1:path})", "description": "fs.fsize(path) - \u83b7\u53d6\u6587\u4ef6\u5927\u5c0f\n\u4f20\u5165\u503c\uff1a\nstring \u6587\u4ef6\u8def\u5f84\n\u8fd4\u56de\u503c\uff1a\nint \u6587\u4ef6\u5927\u5c0f,\u82e5\u83b7\u53d6\u5931\u8d25\u4f1a\u8fd4\u56de0\n\u4f8b\u5b50\uff1a\n-- \u6253\u5370main.luac\u7684\u5927\u5c0f\nlog.info(\"fsize\", fs.fsize(\"/main.luac\"))\n", "prefix": "fs.fsize"}, "fskv.init": {"body": "fskv.init()", "description": "fskv.init() - \u521d\u59cb\u5316kv\u6570\u636e\u5e93\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nif fskv.init() then\n log.info(\"fdb\", \"kv\u6570\u636e\u5e93\u521d\u59cb\u5316\u6210\u529f\")\nend\n\n-- \u5173\u4e8e\u6e05\u7a7afdb\u5e93\n-- \u4e0b\u8f7d\u5de5\u5177\u662f\u6ca1\u6709\u63d0\u4f9b\u76f4\u63a5\u6e05\u9664fdb\u6570\u636e\u7684\u9014\u5f84\u7684, \u4f46\u6709\u529e\u6cd5\u89e3\u51b3\n-- \u5199\u4e00\u4e2amain.lua, \u6267\u884c fskv.kvdb_init \u540e \u6267\u884c fskv.clear() \u5373\u53ef\u5168\u6e05fdb\u6570\u636e.\n", "prefix": "fskv.init"}, "fskv.set": {"body": "fskv.set(${1:key},${2:value})", "description": "fskv.set(key, value) - \u8bbe\u7f6e\u4e00\u5bf9kv\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring key\u7684\u540d\u79f0,\u5fc5\u586b,\u4e0d\u80fd\u7a7a\u5b57\u7b26\u4e32\nstring \u7528\u6237\u6570\u636e,\u5fc5\u586b,\u4e0d\u80fdnil, \u652f\u6301\u5b57\u7b26\u4e32/\u6570\u503c/table/\u5e03\u5c14\u503c, \u6570\u636e\u957f\u5ea6\u6700\u59274095\u5b57\u8282\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u8bbe\u7f6e\u6570\u636e, \u5b57\u7b26\u4e32,\u6570\u503c,table,\u5e03\u5c14\u503c,\u5747\u53ef\n-- \u4f46\u4e0d\u53ef\u4ee5\u662fnil, function, userdata, task\nlog.info(\"fdb\", fskv.set(\"wendal\", \"goodgoodstudy\"))\nlog.info(\"fdb\", fskv.set(\"upgrade\", true))\nlog.info(\"fdb\", fskv.set(\"timer\", 1))\nlog.info(\"fdb\", fskv.set(\"bigd\", {name=\"wendal\",age=123}))\n", "prefix": "fskv.set"}, "fskv.sett": {"body": "fskv.sett(${1:key},${2:skey},${3:value})", "description": "fskv.sett(key, skey, value) - \u8bbe\u7f6etable\u5185\u7684\u952e\u503c\u5bf9\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring key\u7684\u540d\u79f0,\u5fc5\u586b,\u4e0d\u80fd\u7a7a\u5b57\u7b26\u4e32\nstring table\u7684key\u540d\u79f0, \u5fc5\u586b, \u4e0d\u80fd\u662f\u7a7a\u5b57\u7b26\u4e32\nstring \u7528\u6237\u6570\u636e,\u5fc5\u586b,\u652f\u6301\u5b57\u7b26\u4e32/\u6570\u503c/table/\u5e03\u5c14\u503c, \u6570\u636e\u957f\u5ea6\u6700\u59274095\u5b57\u8282\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse/nil\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u57282023.7.26\u65b0\u589e,\u6ce8\u610f\u4e0eset\u51fd\u6570\u533a\u522b\n-- \u8bbe\u7f6e\u6570\u636e, \u5b57\u7b26\u4e32,\u6570\u503c,table,\u5e03\u5c14\u503c,\u5747\u53ef\n-- \u4f46\u4e0d\u53ef\u4ee5\u662ffunction, userdata, task\nlog.info(\"fdb\", fskv.sett(\"mytable\", \"wendal\", \"goodgoodstudy\"))\nlog.info(\"fdb\", fskv.sett(\"mytable\", \"upgrade\", true))\nlog.info(\"fdb\", fskv.sett(\"mytable\", \"timer\", 1))\nlog.info(\"fdb\", fskv.sett(\"mytable\", \"bigd\", {name=\"wendal\",age=123}))\n\n-- \u4e0b\u5217\u8bed\u53e5\u5c06\u6253\u5370\u51fa4\u4e2a\u5143\u7d20\u7684table\nlog.info(\"fdb\", fskv.get(\"mytable\"), json.encode(fskv.get(\"mytable\")))\n-- \u6ce8\u610f: \u5982\u679ckey\u4e0d\u5b58\u5728, \u6216\u8005\u539f\u672c\u7684\u503c\u4e0d\u662ftable\u7c7b\u578b,\u5c06\u4f1a\u5b8c\u5168\u8986\u76d6\n-- \u4f8b\u5982\u4e0b\u5217\u5199\u6cd5,\u6700\u7ec8\u83b7\u53d6\u5230\u7684\u662ftable,\u800c\u975e\u7b2c\u4e00\u884c\u7684\u5b57\u7b26\u4e32\nlog.info(\"fdb\", fskv.set(\"mykv\", \"123\"))\nlog.info(\"fdb\", fskv.sett(\"mykv\", \"age\", \"123\")) -- \u4fdd\u5b58\u7684\u5c06\u662f {age:\"123\"}\n\n\n-- \u5982\u679c\u8bbe\u7f6e\u7684\u6570\u636e\u586bnil, \u4ee3\u8868\u5220\u9664\u5bf9\u5e94\u7684key\nlog.info(\"fdb\", fskv.sett(\"mykv\", \"name\", \"wendal\"))\nlog.info(\"fdb\", fskv.sett(\"mykv\", \"name\")) -- \u76f8\u5f53\u4e8e\u5220\u9664\n-- \n", "prefix": "fskv.sett"}, "fskv.get": {"body": "fskv.get(${1:key},${2:skey})", "description": "fskv.get(key, skey) - \u6839\u636ekey\u83b7\u53d6\u5bf9\u5e94\u7684\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring key\u7684\u540d\u79f0,\u5fc5\u586b,\u4e0d\u80fd\u7a7a\u5b57\u7b26\u4e32\nstring \u53ef\u9009\u7684\u6b21\u7ea7key,\u4ec5\u5f53\u539f\u59cb\u503c\u4e3atable\u65f6\u6709\u6548,\u76f8\u5f53\u4e8e fskv.get(key)[skey]\n\u8fd4\u56de\u503c\uff1a\nany \u5b58\u5728\u5219\u8fd4\u56de\u6570\u636e,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nif fskv.init() then\n log.info(\"fdb\", fskv.get(\"wendal\"))\nend\n\n-- \u82e5\u9700\u8981\"\u9ed8\u8ba4\u503c\", \u5bf9\u5e94\u975ebool\u5e03\u5c14\u503c, \u53ef\u4ee5\u8fd9\u6837\u5199\nlocal v = fskv.get(\"wendal\") or \"123\"\n", "prefix": "fskv.get"}, "fskv.del": {"body": "fskv.del(${1:key})", "description": "fskv.del(key) - \u6839\u636ekey\u5220\u9664\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring key\u7684\u540d\u79f0,\u5fc5\u586b,\u4e0d\u80fd\u7a7a\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nlog.info(\"fdb\", fskv.del(\"wendal\"))\n", "prefix": "fskv.del"}, "fskv.clear": {"body": "fskv.clear()", "description": "fskv.clear() - \u6e05\u7a7a\u6574\u4e2akv\u6570\u636e\u5e93\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u6e05\u7a7a\nfskv.clear()\n", "prefix": "fskv.clear"}, "fskv.iter": {"body": "fskv.iter()", "description": "fskv.iter() - kv\u6570\u636e\u5e93\u8fed\u4ee3\u5668\n\u8fd4\u56de\u503c\uff1a\nuserdata \u6210\u529f\u8fd4\u56de\u8fed\u4ee3\u5668\u6307\u9488,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u6e05\u7a7a\nlocal iter = fskv.iter()\nif iter then\n while 1 do\n local k = fskv.next(iter)\n if not k then\n break\n end\n log.info(\"fdb\", k, \"value\", fskv.kv_get(k))\n end\nend\n", "prefix": "fskv.iter"}, "fskv.next": {"body": "fskv.next(${1:iter})", "description": "fskv.next(iter) - kv\u8fed\u4ee3\u5668\u83b7\u53d6\u4e0b\u4e00\u4e2akey\n\u4f20\u5165\u503c\uff1a\nuserdata fskv.iter()\u8fd4\u56de\u7684\u6307\u9488\n\u8fd4\u56de\u503c\uff1a\nstring \u6210\u529f\u8fd4\u56de\u5b57\u7b26\u4e32key\u503c, \u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u6e05\u7a7a\nlocal iter = fskv.iter()\nif iter then\n while 1 do\n local k = fskv.next(iter)\n if not k then\n break\n end\n log.info(\"fskv\", k, \"value\", fskv.get(k))\n end\nend\n", "prefix": "fskv.next"}, "fskv.status": {"body": "fskv.status()", "description": "fskv.status() - \u83b7\u53d6kv\u6570\u636e\u5e93\u72b6\u6001\n\u8fd4\u56de\u503c\uff1a\nint \u5df2\u4f7f\u7528\u7684\u7a7a\u95f4,\u5355\u4f4d\u5b57\u8282\nint \u603b\u53ef\u7528\u7a7a\u95f4, \u5355\u4f4d\u5b57\u8282\nint \u603bkv\u952e\u503c\u5bf9\u6570\u91cf, \u5355\u4f4d\u4e2a\n\u4f8b\u5b50\uff1a\nlocal used, total,kv_count = fskv.status()\nlog.info(\"fdb\", \"kv\", used,total,kv_count)\n", "prefix": "fskv.status"}, "ftp.login": {"body": "ftp.login(${1:adapter},${2:ip_addr},${3:port},${4:username},${5:password})", "description": "ftp.login(adapter,ip_addr,port,username,password) - FTP\u5ba2\u6237\u7aef\n\u4f20\u5165\u503c\uff1a\nint \u9002\u914d\u5668\u5e8f\u53f7, \u53ea\u80fd\u662fsocket.ETH0, socket.STA, socket.AP,\u5982\u679c\u4e0d\u586b,\u4f1a\u9009\u62e9\u5e73\u53f0\u81ea\u5e26\u7684\u65b9\u5f0f,\u7136\u540e\u662f\u6700\u540e\u4e00\u4e2a\u6ce8\u518c\u7684\u9002\u914d\u5668\nstring ip_addr \u5730\u5740\nstring port \u7aef\u53e3,\u9ed8\u8ba421\nstring username \u7528\u6237\u540d\nstring password \u5bc6\u7801\nbool/table \u662f\u5426\u4e3assl\u52a0\u5bc6\u8fde\u63a5,\u9ed8\u8ba4\u4e0d\u52a0\u5bc6,true\u4e3a\u65e0\u8bc1\u4e66\u6700\u7b80\u5355\u7684\u52a0\u5bc6\uff0ctable\u4e3a\u6709\u8bc1\u4e66\u7684\u52a0\u5bc6
server_cert \u670d\u52a1\u5668ca\u8bc1\u4e66\u6570\u636e
client_cert \u5ba2\u6237\u7aefca\u8bc1\u4e66\u6570\u636e
client_key \u5ba2\u6237\u7aef\u79c1\u94a5\u52a0\u5bc6\u6570\u636e
client_password \u5ba2\u6237\u7aef\u79c1\u94a5\u53e3\u4ee4\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nbool/string \u6210\u529f\u8fd4\u56detrue \u5931\u8d25\u8fd4\u56destring\n\u4f8b\u5b50\uff1a\nftp_login = ftp.login(nil,\"xxx\")\n", "prefix": "ftp.login"}, "ftp.command": {"body": "ftp.command(${1:cmd})", "description": "ftp.command(cmd) - FTP\u547d\u4ee4\n\u4f20\u5165\u503c\uff1a\nstring cmd \u547d\u4ee4 \u76ee\u524d\u652f\u6301:NOOP SYST TYPE PWD MKD CWD CDUP RMD DELE LIST\n\u8fd4\u56de\u503c\uff1a\nstring \u6210\u529f\u8fd4\u56detrue \u5931\u8d25\u8fd4\u56destring\n\u4f8b\u5b50\uff1a\n // \u7a7a\u64cd\u4f5c\uff0c\u9632\u6b62\u8fde\u63a5\u65ad\u6389\n print(ftp.command(\"NOOP\").wait())\n // \u62a5\u544a\u8fdc\u7a0b\u7cfb\u7edf\u7684\u64cd\u4f5c\u7cfb\u7edf\u7c7b\u578b\n print(ftp.command(\"SYST\").wait())\n // \u6307\u5b9a\u6587\u4ef6\u7c7b\u578b\n print(ftp.command(\"TYPE I\").wait())\n // \u663e\u793a\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u540d\n print(ftp.command(\"PWD\").wait())\n // \u521b\u5efa\u76ee\u5f55\n print(ftp.command(\"MKD QWER\").wait())\n // \u6539\u53d8\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\n print(ftp.command(\"CWD /QWER\").wait())\n // \u8fd4\u56de\u4e0a\u4e00\u5c42\u76ee\u5f55\n print(ftp.command(\"CDUP\").wait())\n // \u5220\u9664\u76ee\u5f55\n print(ftp.command(\"RMD QWER\").wait())\n // \u83b7\u53d6\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\u540d\u5217\u8868\n print(ftp.command(\"LIST\").wait())\n // \u5220\u9664\u6587\u4ef6\n print(ftp.command(\"DELE /1/12222.txt\").wait())\n", "prefix": "ftp.command"}, "ftp.pull": {"body": "ftp.pull(${1:local_name},${2:remote_name})", "description": "ftp.pull(local_name,remote_name) - FTP\u6587\u4ef6\u4e0b\u8f7d\n\u4f20\u5165\u503c\uff1a\nstring local_name \u672c\u5730\u6587\u4ef6\nstring remote_name \u670d\u52a1\u5668\u6587\u4ef6\n\u8fd4\u56de\u503c\uff1a\nbool/string \u6210\u529f\u8fd4\u56detrue \u5931\u8d25\u8fd4\u56destring\n\u4f8b\u5b50\uff1a\nftp.pull(\"/1222.txt\",\"/1222.txt\").wait()\n", "prefix": "ftp.pull"}, "ftp.push": {"body": "ftp.push(${1:local_name},${2:remote_name})", "description": "ftp.push(local_name,remote_name) - FTP\u6587\u4ef6\u4e0a\u4f20\n\u4f20\u5165\u503c\uff1a\nstring local_name \u672c\u5730\u6587\u4ef6\nstring remote_name \u670d\u52a1\u5668\u6587\u4ef6\n\u8fd4\u56de\u503c\uff1a\nbool/string \u6210\u529f\u8fd4\u56detrue \u5931\u8d25\u8fd4\u56destring\n\u4f8b\u5b50\uff1a\nftp.push(\"/1222.txt\",\"/1222.txt\").wait()\n", "prefix": "ftp.push"}, "ftp.close": {"body": "ftp.close()", "description": "ftp.close() - FTP\u5ba2\u6237\u7aef\u5173\u95ed\n\u8fd4\u56de\u503c\uff1a\nbool/string \u6210\u529f\u8fd4\u56detrue \u5931\u8d25\u8fd4\u56destring\n\u4f8b\u5b50\uff1a\nftp.close().wait()\n", "prefix": "ftp.close"}, "ftp.debug": {"body": "ftp.debug(${1:onoff})", "description": "ftp.debug(onoff) - \u914d\u7f6e\u662f\u5426\u6253\u5f00debug\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nboolean \u662f\u5426\u6253\u5f00debug\u5f00\u5173\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "ftp.debug"}, "sm.sm2encrypt": {"body": "sm.sm2encrypt(${1:pkx},${2:pky},${3:data},${4:mode},${5:mode2})", "description": "sm.sm2encrypt(pkx,pky,data, mode, mode2) - sm2\u7b97\u6cd5\u52a0\u5bc6\n\u4f20\u5165\u503c\uff1a\nstring \u516c\u94a5x,\u5fc5\u9009. HEX\u5b57\u7b26\u4e32\nstring \u516c\u94a5y,\u5fc5\u9009. HEX\u5b57\u7b26\u4e32\nstring \u5f85\u8ba1\u7b97\u7684\u6570\u636e,\u5fc5\u9009,\u6700\u957f32\u5b57\u8282, \u975eHEX\u5b57\u7b26\u4e32\nboolean \u8f93\u51fa\u6a21\u5f0f,\u9ed8\u8ba4false. false-GMSSL\u9ed8\u8ba4\u683c\u5f0fDER, true-\u7f51\u7ad9\u517c\u5bb9\u6a21\u5f0f\nboolean \u6807\u51c6\u7248\u672c,\u9ed8\u8ba4false. false-C1C3C2\u65b0\u56fd\u9645, true-C1C2C3\u8001\u56fd\u9645\n\u8fd4\u56de\u503c\uff1a\nstring \u52a0\u5bc6\u540e\u7684\u5b57\u7b26\u4e32, \u539f\u6837\u8f93\u51fa,\u672a\u7ecfHEX\u8f6c\u6362. \u82e5\u52a0\u5bc6\u5931\u8d25\u4f1a\u8fd4\u56denil\u6216\u7a7a\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u63d0\u793a mode/mode2 \u53c2\u6570\u662f 2023.10.17 \u65b0\u589e\n-- \u7531\u4e8eSM2\u5728\u5404\u5e73\u53f0\u7684\u5b9e\u73b0\u90fd\u6709\u5dee\u5f02,\u7528\u6cd5\u52a1\u5fc5\u53c2\u8003demo\n", "prefix": "sm.sm2encrypt"}, "sm.sm2decrypt": {"body": "sm.sm2decrypt(${1:private},${2:data},${3:mode},${4:mode2})", "description": "sm.sm2decrypt(private,data,mode,mode2) - sm2\u7b97\u6cd5\u89e3\u5bc6\n\u4f20\u5165\u503c\uff1a\nstring \u79c1\u94a5,\u5fc5\u9009,HEX\u5b57\u7b26\u4e32\nstring \u5f85\u8ba1\u7b97\u7684\u6570\u636e,\u5fc5\u9009,\u539f\u59cb\u6570\u636e,\u975eHEX\u5b57\u7b26\u4e32\nboolean \u8f93\u51fa\u6a21\u5f0f,\u9ed8\u8ba4false. false-GMSSL\u9ed8\u8ba4\u683c\u5f0fDER, true-\u7f51\u7ad9\u517c\u5bb9\u6a21\u5f0f\nboolean \u6807\u51c6\u7248\u672c,\u9ed8\u8ba4false. false-C1C3C2\u65b0\u56fd\u9645, true-C1C2C3\u8001\u56fd\u9645\n\u8fd4\u56de\u503c\uff1a\nstring \u89e3\u5bc6\u540e\u7684\u5b57\u7b26\u4e32,\u672a\u7ecfHEX\u8f6c\u6362.\u82e5\u89e3\u5bc6\u5931\u8d25\u4f1a\u8fd4\u56denil\u6216\u7a7a\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u63d0\u793a mode/mode2 \u53c2\u6570\u662f 2023.10.17 \u65b0\u589e\n-- \u7531\u4e8eSM2\u5728\u5404\u5e73\u53f0\u7684\u5b9e\u73b0\u90fd\u6709\u5dee\u5f02,\u7528\u6cd5\u52a1\u5fc5\u53c2\u8003demo\n", "prefix": "sm.sm2decrypt"}, "sm.sm3": {"body": "sm.sm3(${1:data})", "description": "sm.sm3(data) - sm3\u7b97\u6cd5,\u7b97HASH\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u8ba1\u7b97\u7684\u6570\u636e,\u5fc5\u9009\n\u8fd4\u56de\u503c\uff1a\nstring \u5bf9\u5e94\u7684hash\u503c\n\u4f8b\u5b50\uff1a\nlocal encodeStr = gmssl.sm3(\"lqlq666lqlq946\")\nlog.info(\"testsm.sm3update\",string.toHex(encodeStr))\n", "prefix": "sm.sm3"}, "sm.sm3hmac": {"body": "sm.sm3hmac(${1:data},${2:key})", "description": "sm.sm3hmac(data, key) - sm3\u7b97\u6cd5,\u7b97HASH\u503c,\u4f46\u5e26HMAC\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u8ba1\u7b97\u7684\u6570\u636e,\u5fc5\u9009\nstring \u5bc6\u94a5\n\u8fd4\u56de\u503c\uff1a\nstring \u5bf9\u5e94\u7684hash\u503c\n\u4f8b\u5b50\uff1a\nlocal encodeStr = gmssl.sm3hmac(\"lqlq666lqlq946\", \"123\")\nlog.info(\"testsm.sm3update\",string.toHex(encodeStr))\n", "prefix": "sm.sm3hmac"}, "gmssl.sm4encrypt": {"body": "gmssl.sm4encrypt(${1:mode},${2:padding},${3:originStr},${4:password})", "description": "gmssl.sm4encrypt(mode,padding,originStr,password) - SM4\u52a0\u5bc6\u7b97\u6cd5\n\u4f20\u5165\u503c\uff1a\nstring \u52a0\u5bc6\u6a21\u5f0f, CBC\u6216ECB \nstring \u586b\u5145\u65b9\u5f0f, NONE/ZERO/PKCS5/PKCS7\nstring \u52a0\u5bc6\u7684\u5b57\u7b26\u4e32\nstring \u5bc6\u94a5\nstring \u504f\u79fb\u91cf\n\u8fd4\u56de\u503c\uff1a\nstring \u52a0\u5bc6\u540e\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\nlocal originStr = \"SM4 ECB ZeroPadding test\"\n--\u52a0\u5bc6\u6a21\u5f0f\uff1aECB\uff1b\u586b\u5145\u65b9\u5f0f\uff1aZeroPadding\uff1b\u5bc6\u94a5\uff1a1234567890123456\uff1b\u5bc6\u94a5\u957f\u5ea6\uff1a128 bit\nlocal encodeStr = gmssl.sm4encrypt(\"ECB\",\"ZERO\",originStr,\"1234567890123456\")\nprint(originStr,\"encrypt\",string.toHex(encodeStr))\nlog.info(\"testsm.decrypt\",gmssl.sm4decrypt(\"ECB\",\"ZERO\",encodeStr,\"1234567890123456\"))\n\noriginStr = \"SM4 ECB Pkcs5Padding test\"\n--\u52a0\u5bc6\u6a21\u5f0f\uff1aECB\uff1b\u586b\u5145\u65b9\u5f0f\uff1aPkcs5Padding\uff1b\u5bc6\u94a5\uff1a1234567890123456\uff1b\u5bc6\u94a5\u957f\u5ea6\uff1a128 bit\nencodeStr = gmssl.sm4encrypt(\"ECB\",\"PKCS5\",originStr,\"1234567890123456\")\nprint(originStr,\"encrypt\",string.toHex(encodeStr))\nlog.info(\"testsm.decrypt\",gmssl.sm4decrypt(\"ECB\",\"PKCS5\",encodeStr,\"1234567890123456\"))\n\noriginStr = \"SM4 CBC Pkcs5Padding test\"\n--\u52a0\u5bc6\u6a21\u5f0f\uff1aCBC\uff1b\u586b\u5145\u65b9\u5f0f\uff1aPkcs5Padding\uff1b\u5bc6\u94a5\uff1a1234567890123456\uff1b\u5bc6\u94a5\u957f\u5ea6\uff1a256 bit\uff1b\u504f\u79fb\u91cf\uff1a1234567890666666\nencodeStr = gmssl.sm4encrypt(\"CBC\",\"PKCS5\",originStr,\"1234567890123456\",\"1234567890666666\")\nprint(originStr,\"encrypt\",string.toHex(encodeStr))\nlog.info(\"testsm.decrypt\",gmssl.sm4decrypt(\"CBC\",\"PKCS5\",encodeStr,\"1234567890123456\",\"1234567890666666\"))\n", "prefix": "gmssl.sm4encrypt"}, "gmssl.sm4decrypt": {"body": "gmssl.sm4decrypt(${1:mode},${2:padding},${3:encodeStr},${4:password})", "description": "gmssl.sm4decrypt(mode,padding,encodeStr,password) - SM4\u89e3\u5bc6\u7b97\u6cd5\n\u4f20\u5165\u503c\uff1a\nstring \u52a0\u5bc6\u6a21\u5f0f, CBC\u6216ECB \nstring \u586b\u5145\u65b9\u5f0f, NONE/ZERO/PKCS5/PKCS7\nstring \u5df2\u52a0\u5bc6\u7684\u5b57\u7b26\u4e32\nstring \u5bc6\u94a5\nstring \u504f\u79fb\u91cf\n\u8fd4\u56de\u503c\uff1a\nstring \u89e3\u5bc6\u7684\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003gmssl.sm4encrypt\n", "prefix": "gmssl.sm4decrypt"}, "sm.sm2sign": {"body": "sm.sm2sign(${1:private},${2:data},${3:id})", "description": "sm.sm2sign(private,data,id) - sm2\u7b97\u6cd5\u7b7e\u540d\n\u4f20\u5165\u503c\uff1a\nstring \u79c1\u94a5,\u5fc5\u9009,HEX\u5b57\u7b26\u4e32\nstring \u5f85\u8ba1\u7b97\u7684\u6570\u636e,\u5fc5\u9009,\u539f\u59cb\u6570\u636e,\u975eHEX\u5b57\u7b26\u4e32\nstring id\u503c,\u975eHEX\u5b57\u7b26\u4e32,\u53ef\u9009,\u9ed8\u8ba4\u503c\"1234567812345678\"\n\u8fd4\u56de\u503c\uff1a\nstring \u524d\u9762\u5b57\u7b26\u4e32,\u672a\u7ecfHEX\u8f6c\u6362.\u82e5\u7b7e\u540d\u5931\u8d25\u4f1a\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e 2023.10.19 \u65b0\u589e\n-- \u5177\u4f53\u7528\u6cd5\u8bf7\u67e5\u9605demo\n", "prefix": "sm.sm2sign"}, "sm.sm2verify": {"body": "sm.sm2verify(${1:pkx},${2:pky},${3:data},${4:id},${5:sig})", "description": "sm.sm2verify(pkx, pky, data, id, sig) - sm2\u7b97\u6cd5\u9a8c\u7b7e\n\u4f20\u5165\u503c\uff1a\nstring \u516c\u94a5X,\u5fc5\u9009,HEX\u5b57\u7b26\u4e32\nstring \u516c\u94a5Y,\u5fc5\u9009,HEX\u5b57\u7b26\u4e32\nstring \u5f85\u8ba1\u7b97\u7684\u6570\u636e,\u5fc5\u9009,\u539f\u59cb\u6570\u636e,\u975eHEX\u5b57\u7b26\u4e32\nstring id\u503c,\u975eHEX\u5b57\u7b26\u4e32,\u53ef\u9009,\u9ed8\u8ba4\u503c\"1234567812345678\"\nstring \u7b7e\u540d\u6570\u636e,\u5fc5\u987b64\u5b57\u8282,\u975eHEX\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nboolean \u9a8c\u8bc1\u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e 2023.10.19 \u65b0\u589e\n-- \u5177\u4f53\u7528\u6cd5\u8bf7\u67e5\u9605demo\n", "prefix": "sm.sm2verify"}, "gpio.setup": {"body": "gpio.setup(${1:pin},${2:mode},${3:pull},${4:irq},${5:alt})", "description": "gpio.setup(pin, mode, pull, irq, alt) - \u8bbe\u7f6e\u7ba1\u811a\u529f\u80fd\n\u4f20\u5165\u503c\uff1a\nint pin gpio\u7f16\u53f7,\u5fc5\u987b\u662f\u6570\u503c\nany mode \u8f93\u5165\u8f93\u51fa\u6a21\u5f0f\uff1a
\u6570\u5b570/1\u4ee3\u8868\u8f93\u51fa\u6a21\u5f0f
nil\u4ee3\u8868\u8f93\u5165\u6a21\u5f0f
function\u4ee3\u8868\u4e2d\u65ad\u6a21\u5f0f\uff0c\u5982\u679c\u586bgpio.count\uff0c\u5219\u4e3a\u4e2d\u65ad\u8ba1\u6570\u529f\u80fd\uff0c\u4e2d\u65ad\u65f6\u4e0d\u56de\u8c03\nint pull \u4e0a\u62c9\u4e0b\u62c9\u6a21\u5f0f, \u53ef\u4ee5\u662f\u4e0a\u62c9\u6a21\u5f0f gpio.PULLUP \u6216\u4e0b\u62c9\u6a21\u5f0f gpio.PULLDOWN, \u6216\u8005\u5f00\u6f0f\u6a21\u5f0f 0. \u9700\u8981\u6839\u636e\u5b9e\u9645\u786c\u4ef6\u9009\u7528\nint irq \u4e2d\u65ad\u89e6\u53d1\u6a21\u5f0f,\u9ed8\u8ba4gpio.BOTH\u3002\u4e2d\u65ad\u89e6\u53d1\u6a21\u5f0f
\u4e0a\u5347\u6cbfgpio.RISING
\u4e0b\u964d\u6cbfgpio.FALLING
\u4e0a\u5347\u548c\u4e0b\u964d\u90fd\u89e6\u53d1gpio.BOTH \nint alt \u590d\u7528\u9009\u9879\uff0c\u76ee\u524d\u53ea\u6709EC618\u5e73\u53f0\u9700\u8981\u8fd9\u4e2a\u53c2\u6570\uff0c\u6709\u4e9bGPIO\u53ef\u4ee5\u590d\u7528\u5230\u4e0d\u540c\u5f15\u811a\u4e0a\uff0c\u53ef\u4ee5\u9009\u62e9\u590d\u7528\u9009\u9879\uff080\u6216\u80054\uff09\u4ece\u800c\u590d\u7528\u5230\u5bf9\u5e94\u7684\u5f15\u811a\u4e0a\n\u8fd4\u56de\u503c\uff1a\nany \u8f93\u51fa\u6a21\u5f0f\u8fd4\u56de\u8bbe\u7f6e\u7535\u5e73\u7684\u95ed\u5305, \u8f93\u5165\u6a21\u5f0f\u548c\u4e2d\u65ad\u6a21\u5f0f\u8fd4\u56de\u83b7\u53d6\u7535\u5e73\u7684\u95ed\u5305\n\u4f8b\u5b50\uff1a\n\n-- \u8bbe\u7f6egpio17\u4e3a\u8f93\u5165\ngpio.setup(17, nil)\n\n-- \u8bbe\u7f6egpio17\u4e3a\u8f93\u51fa,\u4e14\u521d\u59cb\u5316\u7535\u5e73\u4e3a\u4f4e,\u4f7f\u7528\u786c\u4ef6\u9ed8\u8ba4\u4e0a\u4e0b\u62c9\u914d\u7f6e\ngpio.setup(17, 0)\n\n-- \u8bbe\u7f6egpio17\u4e3a\u8f93\u51fa,\u4e14\u521d\u59cb\u5316\u7535\u5e73\u4e3a\u9ad8,\u4e14\u542f\u7528\u5185\u90e8\u4e0a\u62c9\ngpio.setup(17, 1, gpio.PULLUP)\n\n-- \u8bbe\u7f6egpio27\u4e3a\u4e2d\u65ad, \u9ed8\u8ba4\u53cc\u5411\u89e6\u53d1\ngpio.setup(27, function(val)\n print(\"IRQ_27\",val) -- \u63d0\u9192, val\u5e76\u4e0d\u4ee3\u8868\u89e6\u53d1\u65b9\u5411, \u4ec5\u4ee3\u8868\u4e2d\u65ad\u540e\u67d0\u4e2a\u65f6\u95f4\u70b9\u7684\u7535\u5e73\nend, gpio.PULLUP)\n\n-- \u8bbe\u7f6egpio27\u4e3a\u4e2d\u65ad, \u4ec5\u4e0a\u5347\u6cbf\u89e6\u53d1\ngpio.setup(27, function(val)\n print(\"IRQ_27\",val) -- \u63d0\u9192, val\u5e76\u4e0d\u4ee3\u8868\u89e6\u53d1\u65b9\u5411, \u4ec5\u4ee3\u8868\u4e2d\u65ad\u540e\u67d0\u4e2a\u65f6\u95f4\u70b9\u7684\u7535\u5e73\nend, gpio.PULLUP, gpio.RISING)\n\n-- \u4e2d\u65ad\u8ba1\u6570 \u4e8e2024.5.8\u65b0\u589e\n-- \u8bbe\u7f6egpio7\u4e3a\u4e2d\u65ad\u8ba1\u6570\uff0c\u8be6\u7ec6demo\u89c1gpio/gpio_irq_count\ngpio.setup(7, gpio.count)\n\n-- alt_func \u4e8e2023.7.2\u65b0\u589e\n-- \u672c\u529f\u80fd\u4ec5\u5bf9\u90e8\u5206\u5e73\u53f0\u6709\u6548, \u4e14\u4ec5\u7528\u4e8e\u8c03\u6574GPIO\u590d\u7528,\u5176\u4ed6\u590d\u7528\u65b9\u5f0f\u8bf7\u4f7f\u7528muc.iomux\u51fd\u6570\n-- \u4ee5\u4e0b\u793a\u4f8b\u4ee3\u7801, \u5c06I2S_DOUT\u590d\u7528\u6210gpio18\n-- AIR780E\u7684PIN33(\u6a21\u5757\u7ba1\u811a\u5e8f\u53f7), \u5bf9\u5e94paddr 38, \u9ed8\u8ba4\u529f\u80fd\u662fI2S_DOUT, \u590d\u7528\u6210gpio18\n-- \u65b9\u5411\u8f93\u51fa,\u4e14\u521d\u59cb\u5316\u7535\u5e73\u4e3a\u4f4e,\u4f7f\u7528\u786c\u4ef6\u9ed8\u8ba4\u4e0a\u4e0b\u62c9\u914d\u7f6e\n-- Air780E(EC618\u7cfb\u5217\u7684GPIO\u590d\u7528\u8bf7\u67e5\u9605 https://air780e.cn \u9996\u9875\u786c\u4ef6\u8d44\u6599\u8868\u683c\u4e2d\u7684Air780E&Air780EG&Air780EX&Air700E_GPIO_table_20231227.pdf)\n-- Air780EP(EC718P\u7cfb\u5217\u7684GPIO\u590d\u7528\u8bf7\u67e5\u9605 https://air780ep.cn \u9996\u9875\u786c\u4ef6\u8d44\u6599\u8868\u683c\u4e2d\u7684Air780E&Air780EG&Air780EX&Air700E_GPIO_table_20231227.pdf)\ngpio.setup(18, 0, nil, nil, 4)\n\n-- \u63d0\u9192: \n-- \u5f53\u7ba1\u811a\u4e3a\u8f93\u5165\u6a21\u5f0f\u6216\u4e2d\u65ad,\u624d\u80fd\u901a\u8fc7gpio.get()\u83b7\u53d6\u5230\u7535\u5e73\n-- \u5f53\u7ba1\u811a\u4e3a\u8f93\u51fa\u6a21\u5f0f,\u624d\u80fd\u901a\u8fc7gpio.set()\u8bbe\u7f6e\u7535\u5e73\n-- \u5f53\u7ba1\u811a\u4e3a\u8f93\u51fa\u6a21\u5f0f,\u901a\u8fc7gpio.get()\u603b\u4f1a\u5f97\u52300\n-- \u4e2d\u65ad\u56de\u8c03\u7684val\u53c2\u6570\u4e0d\u4ee3\u8868\u89e6\u53d1\u65b9\u5411, \u4ec5\u4ee3\u8868\u4e2d\u65ad\u540e\u67d0\u4e2a\u65f6\u95f4\u70b9\u7684\u7535\u5e73\n-- \u5bf9Cat.1\u6a21\u5757,EC618\u7cfb\u5217\u53ea\u6709AONGPIO\u624d\u80fd\u53cc\u5411\u89e6\u53d1\uff0c\u5176\u4ed6\u7cfb\u5217\u6240\u6709GPIO\u90fd\u80fd\u53cc\u5411\u89e6\u53d1\uff0c\u5177\u4f53\u770b\u786c\u4ef6\u624b\u518c\n-- \u9ed8\u8ba4\u8bbe\u7f6e\u4e0b,\u4e2d\u65ad\u662f\u6ca1\u6709\u9632\u6296\u65f6\u95f4\u7684,\u53ef\u4ee5\u901a\u8fc7gpio.set_debounce(pin, 50)\u6765\u8bbe\u7f6e\u9632\u6296\u65f6\u95f4\n\n-- pull\u53c2\u6570\u7684\u989d\u5916\u8bf4\u660e, \u4e0a\u62c9/\u4e0b\u62c9\u914d\u7f6e\n-- \u5bf9\u4e8e\u90e8\u5206\u7684BSP\u6765\u8bf4, \u53ea\u652f\u6301 gpio.PULLUP \u6216 gpio.PULLDOWN, \u4f46\u6709\u90e8\u5206BSP\u652f\u6301\u5f00\u6f0f\u6a21\u5f0f\n-- \u5bf9\u4e8e\u652f\u6301\u5f00\u6f0f\u7684bsp, pull\u53c2\u6570\u8981\u4f20 0 \u624d\u80fd\u5f00\u542f\u5f00\u6f0f\u6a21\u5f0f, \u4e0d\u662f\u4f20nil\n-- \u4f8b\u5982:\n-- EC618\u7cfb\u5217(Air780E/Air780EG/Air780EX/Air700E\u7b49)\n-- EC718\u7cfb\u5217(Air780EP/Air780EPV\u7b49)\n-- XT804\u7cfb\u5217(Air101/Air103/Air601)\n", "prefix": "gpio.setup"}, "gpio.caplevel": {"body": "gpio.caplevel(${1:pin},${2:level},${3:func})", "description": "gpio.caplevel(pin, level,func) - \u6355\u83b7\u7ba1\u811a\u7535\u5e73\u6301\u7eed\u65f6\u957f\uff0c\u5355\u4f4dus\n\u4f20\u5165\u503c\uff1a\nint pin GPIO\u7f16\u53f7,\u5fc5\u987b\u662f\u6570\u503c\nint level \u9700\u8981\u6355\u83b7\u7684\u7535\u5e73, \u53ef\u4ee5\u662f \u9ad8\u7535\u5e73gpio.HIGH, \u4f4e\u7535\u5e73gpio.LOW, \u6216\u8005\u76f4\u63a5\u5199\u6570\u503c1\u62160\uff0c\u5373\u7ba1\u811a\u4e0a\u6b63\u5e38\u65f6\u95f4\u5904\u4e8elevel\u7684\u53cd\uff0c\u6355\u83b7\u8bbe\u5b9a\u7684level\u6301\u7eed\u65f6\u95f4\nfunction func \u5b8c\u6210\u6355\u83b7\u540e\u7684\u56de\u8c03\u51fd\u6570\uff0c\u4ec5\u4e00\u4e2a\u53c2\u6570\uff0c\u53c2\u6570\u4e3a\u6355\u83b7\u5230\u7684\u65f6\u95f4\u957f\u5ea6number\u578b\u6570\u503c\uff0c\u5355\u4f4dus\n\u8fd4\u56de\u503c\uff1a\nany \u8fd4\u56de\u83b7\u53d6\u7535\u5e73\u7684\u95ed\u5305\n\u4f8b\u5b50\uff1a\n-- \u6355\u83b7pin.PA07\u4e3a\u9ad8\u7535\u5e73\u7684\u6301\u7eed\u65f6\u95f4\ngpio.caplevel(pin.PA07,1,function(val) print(val) end)\n", "prefix": "gpio.caplevel"}, "gpio.set": {"body": "gpio.set(${1:pin},${2:value})", "description": "gpio.set(pin, value) - \u8bbe\u7f6e\u7ba1\u811a\u7535\u5e73\n\u4f20\u5165\u503c\uff1a\nint pin GPIO\u7f16\u53f7,\u5fc5\u987b\u662f\u6570\u503c\nint value \u7535\u5e73, \u53ef\u4ee5\u662f \u9ad8\u7535\u5e73gpio.HIGH, \u4f4e\u7535\u5e73gpio.LOW, \u6216\u8005\u76f4\u63a5\u5199\u6570\u503c1\u62160\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u8bbe\u7f6egpio17\u4e3a\u4f4e\u7535\u5e73\ngpio.set(17, 0)\n", "prefix": "gpio.set"}, "gpio.get": {"body": "gpio.get(${1:pin})", "description": "gpio.get(pin) - \u83b7\u53d6\u7ba1\u811a\u7535\u5e73\n\u4f20\u5165\u503c\uff1a\nint pin GPIO\u7f16\u53f7,\u5fc5\u987b\u662f\u6570\u503c\n\u8fd4\u56de\u503c\uff1a\nvalue \u7535\u5e73, \u9ad8\u7535\u5e73gpio.HIGH, \u4f4e\u7535\u5e73gpio.LOW, \u5bf9\u5e94\u6570\u503c1\u548c0\n\u4f8b\u5b50\uff1a\n-- \u83b7\u53d6gpio17\u7684\u5f53\u524d\u7535\u5e73\ngpio.get(17)\n", "prefix": "gpio.get"}, "gpio.close": {"body": "gpio.close(${1:pin})", "description": "gpio.close(pin) - \u5173\u95ed\u7ba1\u811a\u529f\u80fd(\u9ad8\u963b\u8f93\u5165\u6001),\u5173\u6389\u4e2d\u65ad\n\u4f20\u5165\u503c\uff1a\nint pin GPIO\u7f16\u53f7,\u5fc5\u987b\u662f\u6570\u503c\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c,\u603b\u662f\u6267\u884c\u6210\u529f\n\u4f8b\u5b50\uff1a\n-- \u5173\u95edgpio17\ngpio.close(17)\n", "prefix": "gpio.close"}, "gpio.setDefaultPull": {"body": "gpio.setDefaultPull(${1:val})", "description": "gpio.setDefaultPull(val) - \u8bbe\u7f6eGPIO\u811a\u7684\u9ed8\u8ba4\u4e0a\u62c9/\u4e0b\u62c9\u8bbe\u7f6e, \u9ed8\u8ba4\u662f\u5e73\u53f0\u81ea\u5b9a\u4e49(\u4e00\u822c\u4e3a\u5f00\u6f0f).\n\u4f20\u5165\u503c\uff1a\nint val 0\u5e73\u53f0\u81ea\u5b9a\u4e49,1\u4e0a\u62c9, 2\u4e0b\u62c9\n\u8fd4\u56de\u503c\uff1a\nboolean \u4f20\u503c\u6b63\u786e\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u8bbe\u7f6egpio.setup\u7684pull\u9ed8\u8ba4\u503c\u4e3a\u4e0a\u62c9\ngpio.setDefaultPull(1)\n", "prefix": "gpio.setDefaultPull"}, "gpio.toggle": {"body": "gpio.toggle(${1:pin})", "description": "gpio.toggle(pin) - \u53d8\u6362GPIO\u811a\u8f93\u51fa\u7535\u5e73,\u4ec5\u8f93\u51fa\u6a21\u5f0f\u53ef\u7528\n\u4f20\u5165\u503c\uff1a\nint \u7ba1\u811a\u7684GPIO\u53f7\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e 2022.05.17 \u6dfb\u52a0\n-- \u5047\u8bbeGPIO16\u4e0a\u6709LED, \u6bcf500ms\u5207\u6362\u4e00\u6b21\u5f00\u5173\ngpio.setup(16, 0)\nsys.timerLoopStart(function()\n gpio.toggle(16)\nend, 500)\n", "prefix": "gpio.toggle"}, "gpio.pulse": {"body": "gpio.pulse(${1:pin},${2:level},${3:len},${4:delay})", "description": "gpio.pulse(pin,level,len,delay) - \u5728\u540c\u4e00\u4e2aGPIO\u8f93\u51fa\u4e00\u7ec4\u8109\u51b2, \u6ce8\u610f, len\u7684\u5355\u4f4d\u662fbit, \u9ad8\u4f4d\u5728\u524d.\n\u4f20\u5165\u503c\uff1a\nint gpio\u53f7\nint/string \u6570\u503c\u6216\u8005\u5b57\u7b26\u4e32.\nint len \u957f\u5ea6 \u5355\u4f4d\u662fbit, \u9ad8\u4f4d\u5728\u524d.\nint delay \u5ef6\u8fdf,\u5f53\u524d\u65e0\u56fa\u5b9a\u65f6\u95f4\u5355\u4f4d\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u901a\u8fc7PB06\u811a\u8f93\u51fa\u8f93\u51fa8\u4e2a\u7535\u5e73\u53d8\u5316.\ngpio.pulse(pin.PB06,0xA9, 8, 0)\n", "prefix": "gpio.pulse"}, "gpio.debounce": {"body": "gpio.debounce(${1:pin},${2:ms},${3:mode})", "description": "gpio.debounce(pin, ms, mode) - \u9632\u6296\u8bbe\u7f6e, \u6839\u636e\u786c\u4ef6ticks\u8fdb\u884c\u9632\u6296\n\u4f20\u5165\u503c\uff1a\nint gpio\u53f7, 0~127, \u4e0e\u786c\u4ef6\u76f8\u5173\nint \u9632\u6296\u65f6\u957f,\u5355\u4f4d\u6beb\u79d2, \u6700\u5927 65555 ms, \u8bbe\u7f6e\u4e3a0\u5219\u5173\u95ed\nint \u6a21\u5f0f, 0\u51b7\u5374\u6a21\u5f0f, 1\u5ef6\u65f6\u6a21\u5f0f. \u9ed8\u8ba4\u662f0\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u6d88\u6296\u6a21\u5f0f, \u5f53\u524d\u652f\u63012\u79cd, 2022.12.16\u5f00\u59cb\u652f\u6301mode=1\n-- 0 \u89e6\u53d1\u4e2d\u65ad\u540e,\u9a6c\u4e0a\u4e0a\u62a5\u4e00\u6b21, \u7136\u540e\u51b7\u5374N\u4e2a\u6beb\u79d2\u540e,\u91cd\u65b0\u63a5\u53d7\u4e2d\u65ad\n-- 1 \u89e6\u53d1\u4e2d\u65ad\u540e,\u5ef6\u8fdfN\u4e2a\u6beb\u79d2,\u671f\u95f4\u6ca1\u6709\u65b0\u4e2d\u65ad\u4e14\u7535\u5e73\u6ca1\u6709\u53d8\u5316,\u4e0a\u62a5\u4e00\u6b21\n\n-- \u5f00\u542f\u9632\u6296, \u6a21\u5f0f0-\u51b7\u5374, \u4e2d\u65ad\u540e\u9a6c\u4e0a\u4e0a\u62a5, \u4f46100ms\u5185\u53ea\u4e0a\u62a5\u4e00\u6b21\ngpio.debounce(7, 100) -- \u82e5\u82af\u7247\u652f\u6301pin\u5e93, \u53ef\u7528pin.PA7\u4ee3\u66ff\u6570\u5b577\n-- \u5f00\u542f\u9632\u6296, \u6a21\u5f0f1-\u5ef6\u65f6, \u4e2d\u65ad\u540e\u7b49\u5f85100ms,\u671f\u95f4\u82e5\u4fdd\u6301\u8be5\u7535\u5e73\u4e86,\u65f6\u95f4\u5230\u4e4b\u540e\u4e0a\u62a5\u4e00\u6b21\n-- \u5bf9\u5e94\u7684,\u5982\u679c\u8f93\u5165\u7684\u662f\u4e00\u4e2a 50hz\u7684\u65b9\u6ce2,\u90a3\u4e48\u4e0d\u4f1a\u89e6\u53d1\u4efb\u4f55\u4e0a\u62a5\ngpio.debounce(7, 100, 1)\n\n-- \u5173\u95ed\u9632\u6296,\u65f6\u95f4\u8bbe\u7f6e\u4e3a0\u5c31\u5173\u95ed\ngpio.debounce(7, 0)\n", "prefix": "gpio.debounce"}, "gpio.count": {"body": "gpio.count(${1:pin})", "description": "gpio.count(pin) - \u83b7\u53d6gpio\u4e2d\u65ad\u6570\u91cf\uff0c\u5e76\u6e05\u7a7a\u7d2f\u8ba1\u503c\uff0c\u7c7b\u4f3cair724\u7684\u8109\u51b2\u8ba1\u6570\n\u4f20\u5165\u503c\uff1a\nint gpio\u53f7, 0~127, \u4e0e\u786c\u4ef6\u76f8\u5173\n\u8fd4\u56de\u503c\uff1a\nint \u8fd4\u56de\u4ece\u4e0a\u6b21\u83b7\u53d6\u4e2d\u65ad\u6570\u91cf\u540e\u5230\u5f53\u524d\u7684\u4e2d\u65ad\u8ba1\u6570\n\u4f8b\u5b50\uff1a\nlog.info(\"irq cnt\", gpio.count(10))\n", "prefix": "gpio.count"}, "gtfont.init": {"body": "gtfont.init(${1:spi_device})", "description": "gtfont.init(spi_device) - \u521d\u59cb\u5316\u9ad8\u901a\u5b57\u4f53\u82af\u7247\n\u4f20\u5165\u503c\uff1a\nuserdata \u4ec5\u652f\u6301spi device \u751f\u6210\u7684\u6307\u9488\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u7279\u522b\u63d0\u9192: \u4f7f\u7528\u672c\u5e93\u7684\u4efb\u4f55\u4ee3\u7801, \u90fd\u9700\u8981 \u989d\u5916 \u7684 \u9ad8\u901a\u5b57\u4f53\u82af\u7247 !!\n-- \u6ca1\u6709\u989d\u5916\u82af\u7247\u662f\u8dd1\u4e0d\u4e86\u7684!!\ngtfont.init(spi_device)\n", "prefix": "gtfont.init"}, "hmeta.model": {"body": "hmeta.model()", "description": "hmeta.model() - \u83b7\u53d6\u6a21\u7ec4\u540d\u79f0\n\u8fd4\u56de\u503c\uff1a\nstring \u82e5\u80fd\u8bc6\u522b\u5230,\u8fd4\u56de\u6a21\u7ec4\u7c7b\u578b, \u5426\u5219\u4f1a\u662fnil\n\u4f8b\u5b50\uff1a\nsys.taskInit(function()\n while 1 do\n sys.wait(3000)\n -- hmeta\u8bc6\u522b\u5e95\u5c42\u6a21\u7ec4\u7c7b\u578b\u7684\n -- \u4e0d\u540c\u7684\u6a21\u7ec4\u53ef\u4ee5\u4f7f\u7528\u76f8\u540c\u7684bsp,\u4f46\u6839\u636e\u5c01\u88c5\u7684\u4e0d\u540c,\u6839\u636e\u5185\u90e8\u6570\u636e\u4ecd\u53ef\u8bc6\u522b\u51fa\u5177\u4f53\u6a21\u5757\n log.info(\"hmeta\", hmeta.model())\n log.info(\"bsp\", rtos.bsp())\n end\nend)\n", "prefix": "hmeta.model"}, "hmeta.hwver": {"body": "hmeta.hwver()", "description": "hmeta.hwver() - \u83b7\u53d6\u6a21\u7ec4\u7684\u786c\u4ef6\u7248\u672c\u53f7\n\u8fd4\u56de\u503c\uff1a\nstring \u82e5\u80fd\u8bc6\u522b\u5230,\u8fd4\u56de\u6a21\u7ec4\u7c7b\u578b, \u5426\u5219\u4f1a\u662fnil\n\u4f8b\u5b50\uff1a\nsys.taskInit(function()\n while 1 do\n sys.wait(3000)\n -- hmeta\u8bc6\u522b\u5e95\u5c42\u6a21\u7ec4\u7c7b\u578b\u7684\n -- \u4e0d\u540c\u7684\u6a21\u7ec4\u53ef\u4ee5\u4f7f\u7528\u76f8\u540c\u7684bsp,\u4f46\u6839\u636e\u5c01\u88c5\u7684\u4e0d\u540c,\u6839\u636e\u5185\u90e8\u6570\u636e\u4ecd\u53ef\u8bc6\u522b\u51fa\u5177\u4f53\u6a21\u5757\n log.info(\"hmeta\", hmeta.model(), hmeta.hwver())\n log.info(\"bsp\", rtos.bsp())\n end\nend)\n", "prefix": "hmeta.hwver"}, "hmeta.chip": {"body": "hmeta.chip()", "description": "hmeta.chip() - \u83b7\u53d6\u539f\u59cb\u82af\u7247\u578b\u53f7\n\u8fd4\u56de\u503c\uff1a\nstring \u82e5\u80fd\u8bc6\u522b\u5230,\u8fd4\u56de\u82af\u7247\u7c7b\u578b, \u5426\u5219\u4f1a\u662fnil\n\u4f8b\u5b50\uff1a\n-- \u82e5\u5e95\u5c42\u6b63\u786e\u5b9e\u73b0, \u8fd9\u4e2a\u51fd\u6570\u603b\u4f1a\u8fd4\u56de\u503c\n-- \u672c\u51fd\u6570\u4e8e 2024.12.5 \u65b0\u589e\n", "prefix": "hmeta.chip"}, "ht1621.setup": {"body": "ht1621.setup(${1:pin_cs},${2:pin_data},${3:pin_wr},${4:cmd_com_mode},${5:cmd_rc},${6:cmd_sysen})", "description": "ht1621.setup(pin_cs, pin_data, pin_wr, cmd_com_mode, cmd_rc, cmd_sysen) - \u521d\u59cb\u5316ht1621\n\u4f20\u5165\u503c\uff1a\nint \u7247\u9009\u5f15\u811a, \u586b\u6a21\u5757\u7684GPIO\u7f16\u7801\nint \u6570\u636e\u5f15\u811a, \u586b\u6a21\u5757\u7684GPIO\u7f16\u7801\nint WR\u5f15\u811a, \u586b\u6a21\u5757\u7684GPIO\u7f16\u7801\nint \u547d\u4ee4\u6a21\u5f0f, \u9ed8\u8ba4\u662f0x52\nint \u5185\u90e8RC\u632f\u8361\u5668,\u9ed8\u8ba40x30\nint \u7cfb\u7edf\u632f\u8361\u5668\u5f00,\u9ed8\u8ba40x02\n\u8fd4\u56de\u503c\uff1a\nuserdata \u8fd4\u56deht1621\u5bf9\u8c61\n\u4f8b\u5b50\uff1a\nlocal seg = ht1621.setup(4, 5, 3)\nht1621.data(seg, 0, 0xeb)\n", "prefix": "ht1621.setup"}, "ht1621.lcd": {"body": "ht1621.lcd(${1:seg},${2:onoff})", "description": "ht1621.lcd(seg, onoff) - LCD\u5f00\u5173\n\u4f20\u5165\u503c\uff1a\nuserdata ht1621.setup\u8fd4\u56de\u7684ht1621\u5bf9\u8c61\nboolean true\u5f00,false\u5173\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlocal seg = ht1621.setup(4, 5, 3)\nht1621.lcd(seg, true)\n", "prefix": "ht1621.lcd"}, "ht1621.data": {"body": "ht1621.data(${1:seg},${2:addr},${3:sdat})", "description": "ht1621.data(seg, addr, sdat) - \u5c55\u793a\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nuserdata ht1621.setup\u8fd4\u56de\u7684ht1621\u5bf9\u8c61\nint \u5730\u5740, 0-6, \u8d85\u8fc76\u65e0\u6548\nint \u6570\u636e, 0-255\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlocal seg = ht1621.setup(4, 5, 3)\nht1621.lcd(seg, true)\nht1621.data(seg, 0, 0xF1)\n-- \u9644\u6570\u5b570-9\u7684\u503c\u8868\n-- 0,1,2,3,4,5,6,7,8,9\n-- 0xeb,0x0a,0xad,0x8f,0x4e,0xc7,0xe7,0x8a,0xef,0xcf\n", "prefix": "ht1621.data"}, "ht1621.cmd": {"body": "ht1621.cmd(${1:seg},${2:cmd})", "description": "ht1621.cmd(seg, cmd) - \u53d1\u9001\u6307\u4ee4\n\u4f20\u5165\u503c\uff1a\nuserdata ht1621.setup\u8fd4\u56de\u7684ht1621\u5bf9\u8c61\nint \u6307\u4ee4, 0-255\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u5177\u4f53\u6307\u4ee4\u8bf7\u67e5\u9605\u786c\u4ef6\u624b\u518c\n", "prefix": "ht1621.cmd"}, "http.request": {"body": "http.request(${1:method},${2:url},${3:headers},${4:body},${5:opts},${6:ca_file},${7:client_ca},${8:client_key},${9:client_password})", "description": "http.request(method,url,headers,body,opts,ca_file,client_ca, client_key, client_password) - http\u5ba2\u6237\u7aef\n\u4f20\u5165\u503c\uff1a\nstring \u8bf7\u6c42\u65b9\u6cd5, \u652f\u6301 GET/POST \u7b49\u5408\u6cd5\u7684HTTP\u65b9\u6cd5\nstring url\u5730\u5740, \u652f\u6301 http\u548chttps, \u652f\u6301\u57df\u540d, \u652f\u6301\u81ea\u5b9a\u4e49\u7aef\u53e3\ntabal \u8bf7\u6c42\u5934 \u53ef\u9009 \u4f8b\u5982 {[\"Content-Type\"] = \"application/x-www-form-urlencoded\"}\nstring/zbuff body \u53ef\u9009\ntable \u989d\u5916\u914d\u7f6e \u53ef\u9009 \u5305\u542b timeout:\u8d85\u65f6\u65f6\u95f4\u5355\u4f4dms \u53ef\u9009,\u9ed8\u8ba410\u5206\u949f,\u51990\u5373\u6c38\u4e45\u7b49\u5f85 dst:\u4e0b\u8f7d\u8def\u5f84,\u53ef\u9009 adapter:\u9009\u62e9\u4f7f\u7528\u7f51\u5361,\u53ef\u9009 debug:\u662f\u5426\u6253\u5f00debug\u4fe1\u606f,\u53ef\u9009,ipv6:\u662f\u5426\u4e3aipv6 \u9ed8\u8ba4\u4e0d\u662f,\u53ef\u9009 callback:\u4e0b\u8f7d\u56de\u8c03\u51fd\u6570,\u53c2\u6570 content_len:\u603b\u957f\u5ea6 body_len:\u4ee5\u4e0b\u8f7d\u957f\u5ea6 userdata \u7528\u6237\u4f20\u53c2,\u53ef\u9009 userdata:\u56de\u8c03\u81ea\u5b9a\u4e49\u4f20\u53c2 \nstring \u670d\u52a1\u5668ca\u8bc1\u4e66\u6570\u636e, \u53ef\u9009, \u4e00\u822c\u4e0d\u9700\u8981\nstring \u5ba2\u6237\u7aefca\u8bc1\u4e66\u6570\u636e, \u53ef\u9009, \u4e00\u822c\u4e0d\u9700\u8981, \u53cc\u5411https\u8ba4\u8bc1\u624d\u9700\u8981\nstring \u5ba2\u6237\u7aef\u79c1\u94a5\u52a0\u5bc6\u6570\u636e, \u53ef\u9009, \u4e00\u822c\u4e0d\u9700\u8981, \u53cc\u5411https\u8ba4\u8bc1\u624d\u9700\u8981\nstring \u5ba2\u6237\u7aef\u79c1\u94a5\u53e3\u4ee4\u6570\u636e, \u53ef\u9009, \u4e00\u822c\u4e0d\u9700\u8981, \u53cc\u5411https\u8ba4\u8bc1\u624d\u9700\u8981\n\u8fd4\u56de\u503c\uff1a\nint code , \u670d\u52a1\u5668\u53cd\u9988\u7684\u503c>=100, \u6700\u5e38\u89c1\u7684\u662f200.\u5982\u679c\u662f\u5e95\u5c42\u9519\u8bef,\u4f8b\u5982\u8fde\u63a5\u5931\u8d25, \u8fd4\u56de\u503c\u5c0f\u4e8e0\ntabal headers \u5f53code>100\u65f6, \u4ee3\u8868\u670d\u52a1\u5668\u8fd4\u56de\u7684\u5934\u90e8\u6570\u636e \nstring/int body \u670d\u52a1\u5668\u54cd\u5e94\u7684\u5185\u5bb9\u5b57\u7b26\u4e32,\u5982\u679c\u662f\u4e0b\u8f7d\u6a21\u5f0f, \u5219\u8fd4\u56de\u6587\u4ef6\u5927\u5c0f\n\u4f8b\u5b50\uff1a\n\n--[[\ncode\u62a5\u9519\u4fe1\u606f\u5217\u8868:\n-1 HTTP_ERROR_STATE \u9519\u8bef\u7684\u72b6\u6001, \u4e00\u822c\u662f\u5e95\u5c42\u5f02\u5e38,\u8bf7\u62a5issue\n-2 HTTP_ERROR_HEADER \u9519\u8bef\u7684\u54cd\u5e94\u5934\u90e8, \u901a\u5e38\u662f\u670d\u52a1\u5668\u95ee\u9898\n-3 HTTP_ERROR_BODY \u9519\u8bef\u7684\u54cd\u5e94\u4f53,\u901a\u5e38\u662f\u670d\u52a1\u5668\u95ee\u9898\n-4 HTTP_ERROR_CONNECT \u8fde\u63a5\u670d\u52a1\u5668\u5931\u8d25, \u672a\u8054\u7f51,\u5730\u5740\u9519\u8bef,\u57df\u540d\u9519\u8bef\n-5 HTTP_ERROR_CLOSE \u63d0\u524d\u65ad\u5f00\u4e86\u8fde\u63a5, \u7f51\u7edc\u6216\u670d\u52a1\u5668\u95ee\u9898\n-6 HTTP_ERROR_RX \u63a5\u6536\u6570\u636e\u62a5\u9519, \u7f51\u7edc\u95ee\u9898\n-7 HTTP_ERROR_DOWNLOAD \u4e0b\u8f7d\u6587\u4ef6\u8fc7\u7a0b\u62a5\u9519, \u7f51\u7edc\u95ee\u9898\u6216\u4e0b\u8f7d\u8def\u5f84\u95ee\u9898\n-8 HTTP_ERROR_TIMEOUT \u8d85\u65f6, \u5305\u62ec\u8fde\u63a5\u8d85\u65f6,\u8bfb\u53d6\u6570\u636e\u8d85\u65f6\n-9 HTTP_ERROR_FOTA fota\u529f\u80fd\u62a5\u9519,\u901a\u5e38\u662f\u66f4\u65b0\u5305\u4e0d\u5408\u6cd5\n]]\n\n-- GET\u8bf7\u6c42\nlocal code, headers, body = http.request(\"GET\",\"http://site0.cn/api/httptest/simple/time\").wait()\nlog.info(\"http.get\", code, headers, body)\n-- POST\u8bf7\u6c42\nlocal code, headers, body = http.request(\"POST\",\"http://httpbin.com/post\", {}, \"abc=123\").wait()\nlog.info(\"http.post\", code, headers, body)\n\n-- GET\u8bf7\u6c42,\u4f46\u4e0b\u8f7d\u5230\u6587\u4ef6\nlocal code, headers, body = http.request(\"GET\",\"http://httpbin.com/\", {}, \"\", {dst=\"/data.bin\"}).wait()\nlog.info(\"http.get\", code, headers, body)\n\n-- \u81ea\u5b9a\u4e49\u8d85\u65f6\u65f6\u95f4, 5000ms\nhttp.request(\"GET\",\"http://httpbin.com/\", nil, nil, {timeout=5000}).wait()\n", "prefix": "http.request"}, "httpsrv.start": {"body": "httpsrv.start(${1:port},${2:func})", "description": "httpsrv.start(port, func) - \u542f\u52a8\u5e76\u76d1\u542c\u4e00\u4e2ahttp\u7aef\u53e3\n\u4f20\u5165\u503c\uff1a\nint \u7aef\u53e3\u53f7\nfunction \u56de\u8c03\u51fd\u6570\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue, \u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n\n-- \u76d1\u542c80\u7aef\u53e3\nhttpsrv.start(80, function(client, method, uri, headers, body)\n -- method \u662f\u5b57\u7b26\u4e32, \u4f8b\u5982 GET POST PUT DELETE\n -- uri \u4e5f\u662f\u5b57\u7b26\u4e32 \u4f8b\u5982 / /api/abc\n -- headers table\u7c7b\u578b\n -- body \u5b57\u7b26\u4e32\n log.info(\"httpsrv\", method, uri, json.encode(headers), body)\n if uri == \"/led/1\" then\n LEDA(1)\n return 200, {}, \"ok\"\n elseif uri == \"/led/0\" then\n LEDA(0)\n return 200, {}, \"ok\"\n end\n -- \u8fd4\u56de\u503c\u7684\u7ea6\u5b9a code, headers, body\n -- \u82e5\u6ca1\u6709\u8fd4\u56de\u503c, \u5219\u9ed8\u8ba4 404, {} ,\"\"\n return 404, {}, \"Not Found\" .. uri\nend)\n-- \u5173\u4e8e\u9759\u6001\u6587\u4ef6\n-- \u60c5\u51b51: / , \u6620\u5c04\u4e3a /index.html\n-- \u60c5\u51b52: /abc.html , \u5148\u67e5\u627e /abc.html, \u4e0d\u5b58\u5728\u7684\u8bdd\u67e5\u627e /abc.html.gz\n-- \u82e5gz\u5b58\u5728, \u4f1a\u81ea\u52a8\u4ee5\u538b\u7f29\u6587\u4ef6\u8fdb\u884c\u54cd\u5e94, \u7edd\u5927\u90e8\u5206\u6d4f\u89c8\u5668\u652f\u6301.\n-- \u5f53\u524d\u9ed8\u8ba4\u67e5\u627e /luadb/xxx \u4e0b\u7684\u6587\u4ef6,\u6682\u4e0d\u53ef\u914d\u7f6e\n", "prefix": "httpsrv.start"}, "httpsrv.stop": {"body": "httpsrv.stop(${1:port})", "description": "httpsrv.stop(port) - \u505c\u6b62http\u670d\u52a1\n\u4f20\u5165\u503c\uff1a\nint \u7aef\u53e3\u53f7\n\u8fd4\u56de\u503c\uff1a\nnil \u5f53\u524d\u65e0\u8fd4\u56de\u503c\n", "prefix": "httpsrv.stop"}, "i2c.exist": {"body": "i2c.exist(${1:id})", "description": "i2c.exist(id) - i2c\u7f16\u53f7\u662f\u5426\u5b58\u5728\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id, \u4f8b\u5982i2c1\u7684id\u4e3a1, i2c2\u7684id\u4e3a2\n\u8fd4\u56de\u503c\uff1a\nbool \u5b58\u5728\u5c31\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u68c0\u67e5i2c1\u662f\u5426\u5b58\u5728\nif i2c.exist(1) then\n log.info(\"\u5b58\u5728 i2c1\")\nend\n", "prefix": "i2c.exist"}, "i2c.setup": {"body": "i2c.setup(${1:id},${2:speed},${3:pullup})", "description": "i2c.setup(id, speed, pullup) - i2c\u521d\u59cb\u5316\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id, \u4f8b\u5982i2c1\u7684id\u4e3a1, i2c2\u7684id\u4e3a2\nint I2C\u901f\u5ea6, \u4f8b\u5982i2c.FAST\nbool \u662f\u5426\u8f6f\u4ef6\u4e0a\u62c9, \u9ed8\u8ba4\u4e0d\u5f00\u542f\uff0c\u9700\u8981\u786c\u4ef6\u652f\u6301\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u5c31\u8fd4\u56de1,\u5426\u5219\u8fd4\u56de0\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316i2c1\ni2c.setup(1, i2c.FAST) -- id\u6b63\u786e\u5c31\u4e00\u5b9a\u6210\u529f\n-- \u5982\u9700\u5224\u65adi2c id\u662f\u5426\u5408\u6cd5, \u8bf7\u4f7f\u7528 i2c.exist \u51fd\u6570\n", "prefix": "i2c.setup"}, "i2c.createSoft": {"body": "i2c.createSoft(${1:scl},${2:sda},${3:delay})", "description": "i2c.createSoft(scl,sda,delay) - \u65b0\u5efa\u4e00\u4e2a\u8f6f\u4ef6i2c\u5bf9\u8c61\n\u4f20\u5165\u503c\uff1a\nint i2c SCL\u5f15\u811a\u7f16\u53f7(GPIO\u7f16\u53f7)\nint i2c SDA\u5f15\u811a\u7f16\u53f7(GPIO\u7f16\u53f7)\nint \u6bcf\u4e2a\u64cd\u4f5c\u7684\u5ef6\u65f6, \u5355\u4f4dus, \u9ed8\u8ba45\n\u8fd4\u56de\u503c\uff1a\n\u8f6f\u4ef6I2C\u5bf9\u8c61 \u53ef\u5f53\u4f5ci2c\u7684id\u4f7f\u7528\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f\uff01\u8fd9\u4e2a\u63a5\u53e3\u662f\u8f6f\u4ef6\u6a21\u62dfi2c\uff0c\u901f\u5ea6\u53ef\u80fd\u4f1a\u6bd4\u786c\u4ef6\u7684\u6162\n-- \u4e0d\u9700\u8981\u8c03\u7528i2c.close\u63a5\u53e3\n-- \u521d\u59cb\u5316\u8f6f\u4ef6i2c\nlocal softI2C = i2c.createSoft(1, 2, 5)\ni2c.send(softI2C, 0x5C, string.char(0x0F, 0x2F))\n-- \u6ce8\u610f, \u7b2c3\u4e2a\u53c2\u6570\u662f 2023.06.19 \u6dfb\u52a0\u7684delay\n-- \u901a\u8fc7\u8c03\u6574delay\u53c2\u6570\u7684\u503c, \u53ef\u589e\u52a0\u6216\u964d\u4f4eI2C\u7684\u901f\u5ea6\n", "prefix": "i2c.createSoft"}, "i2c.send": {"body": "i2c.send(${1:id},${2:addr},${3:data},${4:stop})", "description": "i2c.send(id, addr, data,stop) - i2c\u53d1\u9001\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id, \u4f8b\u5982i2c1\u7684id\u4e3a1, i2c2\u7684id\u4e3a2\nint I2C\u5b50\u8bbe\u5907\u7684\u5730\u5740, 7\u4f4d\u5730\u5740\ninteger/string/table \u5f85\u53d1\u9001\u7684\u6570\u636e,\u81ea\u9002\u5e94\u53c2\u6570\u7c7b\u578b\ninteger \u53ef\u9009\u53c2\u6570 \u662f\u5426\u53d1\u9001\u505c\u6b62\u4f4d 1\u53d1\u9001 0\u4e0d\u53d1\u9001 \u9ed8\u8ba4\u53d1\u9001(105\u4e0d\u652f\u6301)\n\u8fd4\u56de\u503c\uff1a\ntrue/false \u53d1\u9001\u662f\u5426\u6210\u529f\n\u4f8b\u5b50\uff1a\n-- \u5f80i2c0\u53d1\u90011\u4e2a\u5b57\u8282\u7684\u6570\u636e\ni2c.send(0, 0x68, 0x75)\n-- \u5f80i2c1\u53d1\u90012\u4e2a\u5b57\u8282\u7684\u6570\u636e\ni2c.send(1, 0x5C, string.char(0x0F, 0x2F))\ni2c.send(1, 0x5C, {0x0F, 0x2F})\n", "prefix": "i2c.send"}, "i2c.recv": {"body": "i2c.recv(${1:id},${2:addr},${3:len})", "description": "i2c.recv(id, addr, len) - i2c\u63a5\u6536\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id, \u4f8b\u5982i2c1\u7684id\u4e3a1, i2c2\u7684id\u4e3a2\nint I2C\u5b50\u8bbe\u5907\u7684\u5730\u5740, 7\u4f4d\u5730\u5740\nint \u63a5\u6536\u6570\u636e\u7684\u957f\u5ea6\n\u8fd4\u56de\u503c\uff1a\nstring \u6536\u5230\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u4ecei2c1\u8bfb\u53d62\u4e2a\u5b57\u8282\u7684\u6570\u636e\nlocal data = i2c.recv(1, 0x5C, 2)\n", "prefix": "i2c.recv"}, "i2c.writeReg": {"body": "i2c.writeReg(${1:id},${2:addr},${3:reg},${4:data},${5:stop})", "description": "i2c.writeReg(id, addr, reg, data,stop) - i2c\u5199\u5bc4\u5b58\u5668\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id, \u4f8b\u5982i2c1\u7684id\u4e3a1, i2c2\u7684id\u4e3a2\nint I2C\u5b50\u8bbe\u5907\u7684\u5730\u5740, 7\u4f4d\u5730\u5740\nint \u5bc4\u5b58\u5668\u5730\u5740\nstring \u5f85\u53d1\u9001\u7684\u6570\u636e\ninteger \u53ef\u9009\u53c2\u6570 \u662f\u5426\u53d1\u9001\u505c\u6b62\u4f4d 1\u53d1\u9001 0\u4e0d\u53d1\u9001 \u9ed8\u8ba4\u53d1\u9001(105\u4e0d\u652f\u6301)\n\u8fd4\u56de\u503c\uff1a\ntrue/false \u53d1\u9001\u662f\u5426\u6210\u529f\n\u4f8b\u5b50\uff1a\n-- \u4ecei2c1\u7684\u5730\u5740\u4e3a0x5C\u7684\u8bbe\u5907\u7684\u5bc4\u5b58\u56680x01\u5199\u51652\u4e2a\u5b57\u8282\u7684\u6570\u636e\ni2c.writeReg(1, 0x5C, 0x01, string.char(0x00, 0xF2))\n", "prefix": "i2c.writeReg"}, "i2c.readReg": {"body": "i2c.readReg(${1:id},${2:addr},${3:reg},${4:len})", "description": "i2c.readReg(id, addr, reg, len) - i2c\u8bfb\u5bc4\u5b58\u5668\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id, \u4f8b\u5982i2c1\u7684id\u4e3a1, i2c2\u7684id\u4e3a2\nint I2C\u5b50\u8bbe\u5907\u7684\u5730\u5740, 7\u4f4d\u5730\u5740\nint \u5bc4\u5b58\u5668\u5730\u5740\nint \u5f85\u63a5\u6536\u7684\u6570\u636e\u957f\u5ea6\ninteger \u53ef\u9009\u53c2\u6570 \u662f\u5426\u53d1\u9001\u505c\u6b62\u4f4d 1\u53d1\u9001 0\u4e0d\u53d1\u9001 \u9ed8\u8ba4\u53d1\u9001(105\u4e0d\u652f\u6301)\n\u8fd4\u56de\u503c\uff1a\nstring \u6536\u5230\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u4ecei2c1\u7684\u5730\u5740\u4e3a0x5C\u7684\u8bbe\u5907\u7684\u5bc4\u5b58\u56680x01\u8bfb\u51fa2\u4e2a\u5b57\u8282\u7684\u6570\u636e\ni2c.readReg(1, 0x5C, 0x01, 2)\n", "prefix": "i2c.readReg"}, "i2c.close": {"body": "i2c.close(${1:id})", "description": "i2c.close(id) - \u5173\u95edi2c\u8bbe\u5907\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id, \u4f8b\u5982i2c1\u7684id\u4e3a1, i2c2\u7684id\u4e3a2\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u5173\u95edi2c1\ni2c.close(1)\n", "prefix": "i2c.close"}, "i2c.readDHT12": {"body": "i2c.readDHT12(${1:id})", "description": "i2c.readDHT12(id) - \u4ecei2c\u603b\u7ebf\u8bfb\u53d6DHT12\u7684\u6e29\u6e7f\u5ea6\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id, \u4f8b\u5982i2c1\u7684id\u4e3a1, i2c2\u7684id\u4e3a2\nint DHT12\u7684\u8bbe\u5907\u5730\u5740,\u9ed8\u8ba40x5C\n\u8fd4\u56de\u503c\uff1a\nboolean \u8bfb\u53d6\u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\nint \u6e7f\u5ea6\u503c,\u5355\u4f4d0.1%, \u4f8b\u5982 591 \u4ee3\u8868 59.1%\nint \u6e29\u5ea6\u503c,\u5355\u4f4d0.1\u6444\u6c0f\u5ea6, \u4f8b\u5982 292 \u4ee3\u8868 29.2\u6444\u6c0f\u5ea6\n\u4f8b\u5b50\uff1a\n-- \u4ecei2c0\u8bfb\u53d6DHT12\ni2c.setup(0)\nlocal re, H, T = i2c.readDHT12(0)\nif re then\n log.info(\"dht12\", H, T)\nend\n", "prefix": "i2c.readDHT12"}, "i2c.readSHT30": {"body": "i2c.readSHT30(${1:id},${2:addr})", "description": "i2c.readSHT30(id,addr) - \u4ecei2c\u603b\u7ebf\u8bfb\u53d6DHT30\u7684\u6e29\u6e7f\u5ea6\u6570\u636e(\u7531\"\u597d\u5947\u661f\"\u8d21\u732e)\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id, \u4f8b\u5982i2c1\u7684id\u4e3a1, i2c2\u7684id\u4e3a2\nint \u8bbe\u5907addr,SHT30\u7684\u8bbe\u5907\u5730\u5740,\u9ed8\u8ba40x44 bit7\n\u8fd4\u56de\u503c\uff1a\nboolean \u8bfb\u53d6\u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\nint \u6e7f\u5ea6\u503c,\u5355\u4f4d0.1%, \u4f8b\u5982 591 \u4ee3\u8868 59.1%\nint \u6e29\u5ea6\u503c,\u5355\u4f4d0.1\u6444\u6c0f\u5ea6, \u4f8b\u5982 292 \u4ee3\u8868 29.2\u6444\u6c0f\u5ea6\n\u4f8b\u5b50\uff1a\n-- \u4ecei2c0\u8bfb\u53d6SHT30\ni2c.setup(0)\nlocal re, H, T = i2c.readSHT30(0)\nif re then\n log.info(\"sht30\", H, T)\nend\n", "prefix": "i2c.readSHT30"}, "i2c.transfer": {"body": "i2c.transfer(${1:id},${2:addr},${3:txBuff},${4:rxBuff},${5:rxLen})", "description": "i2c.transfer(id, addr, txBuff, rxBuff, rxLen) - i2c\u901a\u7528\u4f20\u8f93\uff0c\u5305\u62ec\u53d1\u9001N\u5b57\u8282\uff0c\u53d1\u9001N\u5b57\u8282+\u63a5\u6536N\u5b57\u8282\uff0c\u63a5\u6536N\u5b57\u8282\u4e09\u79cd\u529f\u80fd\uff0c\u5728\u53d1\u9001\u8f6c\u63a5\u6536\u8fc7\u7a0b\u4e2d\u53d1\u9001reStart\u4fe1\u53f7,\u89e3\u51b3\u7c7b\u4f3cmlx90614\u5fc5\u987b\u5e26restart\u4fe1\u53f7\uff0c\u4f46\u662f\u53c8\u4e0d\u80fd\u7528i2c.send\u6765\u63a7\u5236\u7684\uff0c\u6bd4\u5982air105\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id, \u4f8b\u5982i2c1\u7684id\u4e3a1, i2c2\u7684id\u4e3a2\nint I2C\u5b50\u8bbe\u5907\u7684\u5730\u5740, 7\u4f4d\u5730\u5740\ninteger/string/zbuff \u5f85\u53d1\u9001\u7684\u6570\u636e,\u81ea\u9002\u5e94\u53c2\u6570\u7c7b\u578b\uff0c\u5982\u679c\u4e3anil\uff0c\u5219\u4e0d\u53d1\u9001\u6570\u636e\nzbuff \u5f85\u63a5\u6536\u6570\u636e\u7684zbuff \u5982\u679c\u4e0d\u7528zbuff\uff0c\u5219\u63a5\u6536\u6570\u636e\u5c06\u5728return\u8fd4\u56de\nint \u9700\u8981\u63a5\u6536\u7684\u6570\u636e\u957f\u5ea6\uff0c\u5982\u679c\u4e3a0\u6216nil\uff0c\u5219\u4e0d\u63a5\u6536\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nboolean true/false \u53d1\u9001\u662f\u5426\u6210\u529f\nstring or nil \u5982\u679c\u53c2\u65705\u662finterger\uff0c\u5219\u8fd4\u56de\u63a5\u6536\u5230\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\nlocal result, _ = i2c.transfer(0, 0x11, txbuff, rxbuff, 1)\nlocal result, _ = i2c.transfer(0, 0x11, txbuff, nil, 0) --\u53ea\u53d1\u9001txbuff\u91cc\u7684\u6570\u636e\uff0c\u4e0d\u63a5\u6536\u6570\u636e\uff0c\u5178\u578b\u5e94\u7528\u5c31\u662f\u5199\u5bc4\u5b58\u5668\u4e86\uff0c\u8fd9\u91cc\u5bc4\u5b58\u5668\u5730\u5740\u548c\u503c\u90fd\u653e\u5728\u4e86txbuff\u91cc\nlocal result, _ = i2c.transfer(0, 0x11, \"\\x01\\x02\\x03\", nil, 1) --\u53d1\u90010x01\uff0c 0x02\uff0c0x03\uff0c\u4e0d\u63a5\u6536\u6570\u636e\uff0c\u5982\u679c\u662feeprom\uff0c\u5c31\u662f\u5f800x01\u7684\u5730\u5740\u519902\u548c03\uff0c\u6216\u8005\u5f800x0102\u7684\u5730\u5740\u519903\uff0c\u770b\u5177\u4f53\u82af\u7247\u4e86\nlocal result, rxdata = i2c.transfer(0, 0x11, \"\\x01\\x02\", nil, 1) --\u53d1\u90010x01\uff0c 0x02\uff0c\u7136\u540e\u63a5\u65361\u4e2a\u5b57\u8282\uff0c\u5178\u578b\u5e94\u7528\u5c31\u662feeprom\nlocal result, rxdata = i2c.transfer(0, 0x11, 0x00, nil, 1) --\u53d1\u90010x00\uff0c\u7136\u540e\u63a5\u65361\u4e2a\u5b57\u8282\uff0c\u5178\u578b\u5e94\u7528\u5404\u79cd\u4f20\u611f\u5668\n", "prefix": "i2c.transfer"}, "i2c.xfer": {"body": "i2c.xfer(${1:id},${2:addr},${3:txBuff},${4:rxBuff},${5:rxLen},${6:transfer_done_topic},${7:timeout})", "description": "i2c.xfer(id, addr, txBuff, rxBuff, rxLen, transfer_done_topic, timeout) - i2c\u975e\u963b\u585e\u901a\u7528\u4f20\u8f93\uff0c\u7c7b\u4f3ctransfer\uff0c\u4f46\u662f\u4e0d\u4f1a\u7b49\u5230I2C\u4f20\u8f93\u5b8c\u6210\u624d\u8fd4\u56de\uff0c\u8c03\u7528\u672c\u51fd\u6570\u4f1a\u7acb\u523b\u8fd4\u56de\uff0cI2C\u4f20\u8f93\u5b8c\u6210\u540e\uff0c\u901a\u8fc7\u6d88\u606f\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id, \u4f8b\u5982i2c1\u7684id\u4e3a1, i2c2\u7684id\u4e3a2\nint I2C\u5b50\u8bbe\u5907\u7684\u5730\u5740, 7\u4f4d\u5730\u5740\nzbuff \u5f85\u53d1\u9001\u7684\u6570\u636e\uff0c\u7531\u4e8e\u7528\u7684\u975e\u963b\u585e\u6a21\u578b\uff0c\u4e3a\u4fdd\u8bc1\u52a8\u6001\u6570\u636e\u7684\u6709\u6548\u6027\uff0c\u53ea\u80fd\u4f7f\u7528zbuff\uff0c\u53d1\u9001\u7684\u6570\u636e\u4ecezbuff.addr\u5f00\u59cb\uff0c\u957f\u5ea6\u4e3azbuff.used\nzbuff \u5f85\u63a5\u6536\u6570\u636e\u7684zbuff\uff0c\u5982\u679c\u4e3anil\uff0c\u5219\u5ffd\u7565\u540e\u9762\u53c2\u6570\uff0c \u4e0d\u63a5\u6536\u6570\u636e\u3002\u63a5\u6536\u7684\u6570\u636e\u4f1a\u653e\u5728zbuff.addr\u5f00\u59cb\u7684\u4f4d\u7f6e\uff0c\u4f1a\u8986\u76d6\u6389\u4e4b\u524d\u7684\u6570\u636e\uff0c\u6ce8\u610fzhuff\u7684\u9884\u7559\u7a7a\u95f4\u8981\u8db3\u591f\nint \u9700\u8981\u63a5\u6536\u7684\u6570\u636e\u957f\u5ea6\uff0c\u5982\u679c\u4e3a0\u6216nil\uff0c\u5219\u4e0d\u63a5\u6536\u6570\u636e\nstring \u4f20\u8f93\u5b8c\u6210\u540e\u56de\u8c03\u7684\u6d88\u606f\nint \u8d85\u65f6\u65f6\u95f4\uff0c\u5982\u679c\u586bnil\uff0c\u5219\u4e3a100ms\n\u8fd4\u56de\u503c\uff1a\nboolean true/false \u672c\u6b21\u4f20\u8f93\u662f\u5426\u6b63\u786e\u542f\u52a8\uff0ctrue\uff0c\u542f\u52a8\uff0cfalse\uff0c\u6709\u9519\u8bef\u65e0\u6cd5\u542f\u52a8\u3002\u4f20\u8f93\u5b8c\u6210\u4f1a\u53d1\u5e03\u6d88\u606ftransfer_done_topic\u548cboolean\u578b\u7ed3\u679c\n\u4f8b\u5b50\uff1a\nlocal result = i2c.xfer(0, 0x11, txbuff, rxbuff, 1, \"I2CDONE\") if result then result, i2c_id, succ, error_code = sys.waitUntil(\"I2CDONE\") end if not result or not succ then log.info(\"i2c fail, error code\", error_code) else log.info(\"i2c ok\") end\n\n", "prefix": "i2c.xfer"}, "i2c.scan": {"body": "i2c.scan(${1:id},${2:speed})", "description": "i2c.scan(id,speed) - \u626b\u63cfi2c\u8bbe\u5907\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id, \u4f8b\u5982i2c1\u7684id\u4e3a1, i2c2\u7684id\u4e3a2\nint \u901f\u5ea6, \u53ef\u9009i2c.SLOW i2c.FAST i2c.PLUS i2c.HSMODE \u9ed8\u8ba4\u4e3ai2c.SLOW,\u5982\u63a2\u6d4b\u4e0d\u5230\u5219\u4fee\u6539\u6b64\u9879\n\u8fd4\u56de\u503c\uff1a\nnil \u5f53\u524d\u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u4e8e2023.07.04\u6dfb\u52a0\n-- \u8fd9\u4e2a\u51fd\u6570\u7684\u4e3b\u8981\u76ee\u6807\u662f\u4e3a\u4e86\u5728\u5f00\u53d1\u671f\u626b\u63cfi2c\u8bbe\u5907\n-- \u6709\u4e9bBSP\u5728\u6307\u5b9aaddr\u65e0\u54cd\u5e94\u65f6\u4f1a\u8f93\u51fa\u65e5\u5fd7,\u5bfc\u81f4\u8f93\u51fa\u4f1a\u88ab\u6253\u4e71\ni2c.scan()\n", "prefix": "i2c.scan"}, "i2s.setup": {"body": "i2s.setup(${1:id},${2:mode},${3:sample},${4:bitw},${5:channel},${6:format},${7:framebit})", "description": "i2s.setup(id, mode, sample, bitw, channel, format, framebit) - \u521d\u59cb\u5316i2s\n\u4f20\u5165\u503c\uff1a\nint i2s\u901a\u9053\u53f7,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173\nint \u6a21\u5f0f, 0 \u4e3b\u673a 1 \u4ece\u673a\nint \u91c7\u6837\u7387,\u9ed8\u8ba444100. \u53ef\u9009\nint \u6570\u636e\u4f4d\u6570,\u9ed8\u8ba416, \u53ef\u4ee5\u662f8\u7684\u500d\u6570\nint \u58f0\u9053, 0 \u5de6\u58f0\u9053, 1 \u53f3\u58f0\u9053, 2 \u7acb\u4f53\u58f0. \u53ef\u9009\nint \u683c\u5f0f, \u53ef\u9009MODE_I2S, MODE_LSB, MODE_MSB\nint 1\u4e2a\u58f0\u9053\u7684BCLK\u6570\u91cf, \u53ef\u900916\u548c32\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u4e0e\u5426\nint \u5e95\u5c42\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u4ee5\u9ed8\u8ba4\u53c2\u6570\u521d\u59cb\u5316i2s\ni2s.setup(0)\n-- \u4ee5\u8be6\u7ec6\u53c2\u6570\u521d\u59cb\u5316i2s, \u793a\u4f8b\u4e3a\u9ed8\u8ba4\u503c\ni2s.setup(0, 0, 44100, 16, 0, 0, 16)\n", "prefix": "i2s.setup"}, "i2s.send": {"body": "i2s.send(${1:id},${2:data},${3:len})", "description": "i2s.send(id, data, len) - \u53d1\u9001i2s\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u901a\u9053id\nstring \u6570\u636e, \u53ef\u4ee5\u662f\u5b57\u7b26\u4e32\u6216zbuff\nint \u6570\u636e\u957f\u5ea6,\u5355\u4f4d\u5b57\u8282, \u5b57\u7b26\u4e32\u9ed8\u8ba4\u4e3a\u5b57\u7b26\u4e32\u5168\u957f, zbuff\u9ed8\u8ba4\u4e3a\u6307\u9488\u4f4d\u7f6e\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u4e0e\u5426\nint \u5e95\u5c42\u8fd4\u56de\u503c,\u4f9b\u8c03\u8bd5\u7528\n\u4f8b\u5b50\uff1a\nlocal f = io.open(\"/luadb/abc.wav\")\nwhile 1 do\n local data = f:read(4096)\n if not data or #data == 0 then\n break\n end\n i2s.send(0, data)\n sys.wait(100)\nend\n", "prefix": "i2s.send"}, "i2s.recv": {"body": "i2s.recv(${1:id},${2:buffer},${3:len})", "description": "i2s.recv(id, buffer, len) - \u63a5\u6536i2s\u6570\u636e\uff0c\u6ce8\u610f\u5728\u6570\u636e\u5728\u56de\u8c03\u65f6\u5df2\u7ecf\u5b58\u653e\u5728zbuff\u91cc\uff0c\u76ee\u524d\u53ea\u6709air780e\u7cfb\u5217\u652f\u6301\n\u4f20\u5165\u503c\uff1a\nint \u901a\u9053id\nzbuff \u6570\u636e\u7f13\u5b58\u533a\nint \u5355\u6b21\u8fd4\u56de\u7684\u6570\u636e\u957f\u5ea6,\u5355\u4f4d\u5b57\u8282,\u5fc5\u987b\u4e0e\u4f20\u5165\u7684zbuff\u7684\u5927\u5c0f\u4e00\u81f4\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u4e0e\u5426\n\u4f8b\u5b50\uff1a\nlocal buffer = zbuff.create(3200)\nlocal succ = i2s.recv(0, buffer, 3200);\n", "prefix": "i2s.recv"}, "i2s.close": {"body": "i2s.close(${1:id})", "description": "i2s.close(id) - \u5173\u95edi2s\n\u4f20\u5165\u503c\uff1a\nint \u901a\u9053id\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\ni2s.close(0)\n", "prefix": "i2s.close"}, "i2s.on": {"body": "i2s.on(${1:id},${2:func})", "description": "i2s.on(id, func) - \u6ce8\u518cI2S\u4e8b\u4ef6\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nint i2s id, i2s0\u51990, i2s1\u51991\nfunction \u56de\u8c03\u65b9\u6cd5\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\ni2s.on(0, function(id, buff)\n if buff then\n log.info(\"i2s get data in zbuff\")\n else\n log.info(\"i2s tx one block done\")\n end\nend)\n", "prefix": "i2s.on"}, "i2s.txStat": {"body": "i2s.txStat(${1:id})", "description": "i2s.txStat(id) - \u83b7\u53d6i2s\u7684\u53d1\u9001\u7f13\u51b2\u533a\u72b6\u6001\n\u4f20\u5165\u503c\uff1a\nint i2s id, i2s0\u51990, i2s1\u51991\nreturn \u5e95\u5c42\u7f13\u51b2\u533a\u7684\u603b\u5927\u5c0f\nreturn \u5e95\u5c42\u7f13\u51b2\u533a\u7684\u5269\u4f59\u5f85\u53d1\u9001\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u8bfb\u53d6\u53d1\u9001\u7f13\u51b2\u533a\u7684\u72b6\u6001, \u4ece\u800c\u5224\u65ad\u662f\u5426\u9700\u8981\u7ee7\u7eed\u4f20\u5165\u97f3\u9891\u6570\u636e\nlocal max, remain = i2s.txStat(0)\nlog.info(\"i2s\u53d1\u9001\u7f13\u51b2\u533a\u72b6\u6001\", max, remain)\n", "prefix": "i2s.txStat"}, "i2s.getPara": {"body": "i2s.getPara(${1:id})", "description": "i2s.getPara(id) - \u83b7\u53d6I2S\u53c2\u6570\uff0c\u53c2\u6570\u5177\u4f53\u53c2\u8003setup\n\u4f20\u5165\u503c\uff1a\nint \u901a\u9053id\n\u8fd4\u56de\u503c\uff1a\nboolean \u662f\u5426\u5728\u5de5\u4f5c\u72b6\u6001 true\u662f\nint \u6a21\u5f0f, 0 \u4e3b\u673a 1 \u4ece\u673a\nint \u91c7\u6837\u7387\nint \u6570\u636e\u4f4d\u6570\nint \u58f0\u9053\nint \u683c\u5f0f\nint 1\u4e2a\u58f0\u9053\u7684BCLK\u6570\u91cf\n", "prefix": "i2s.getPara"}, "iconv.open": {"body": "iconv.open(${1:tocode},${2:fromcode})", "description": "iconv.open(tocode, fromcode) - \u6253\u5f00\u76f8\u5e94\u5b57\u7b26\u7f16\u7801\u8f6c\u6362\u51fd\u6570\n\u4f20\u5165\u503c\uff1a\nstring tocode$\u76ee\u6807\u7f16\u7801\u683c\u5f0f$gb2312/ucs2/ucs2be/utf8\nstring fromcode$\u6e90\u7f16\u7801\u683c\u5f0f$gb2312/ucs2/ucs2be/utf8\nreturn table$cd$\u7f16\u7801\u8f6c\u6362\u51fd\u6570\u7684\u8f6c\u6362\u53e5\u67c4$ \n\u4f8b\u5b50\uff1a\n--unicode\u5927\u7aef\u7f16\u7801 \u8f6c\u5316\u4e3a utf8\u7f16\u7801\nlocal cd = iconv.open(\"utf8\", \"ucs2be\")\n", "prefix": "iconv.open"}, "iconv:iconv": {"body": "iconv:iconv(${1:inbuf})", "description": "iconv:iconv(inbuf) - \u5b57\u7b26\u7f16\u7801\u8f6c\u6362\n\u4f20\u5165\u503c\uff1a\nstring \u91ca\u4e49\uff1a\u5f85\u8f6c\u6362\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nnumber \u91ca\u4e49\uff1a\u8fd4\u56de\u7f16\u7801\u8f6c\u6362\u540e\u7684\u7ed3\u679c
\u53d6\u503c\uff1a0\u6210\u529f,-1\u5931\u8d25\n\u4f8b\u5b50\uff1a\n--unicode\u5927\u7aef\u7f16\u7801 \u8f6c\u5316\u4e3a utf8\u7f16\u7801\nfunction ucs2beToUtf8(ucs2s)\n local iconv = iconv.open(\"utf8\", \"ucs2be\")\n return iconv:iconv(ucs2s)\nend\n", "prefix": "iconv:iconv"}, "cd:iconv": {"body": "cd:iconv(${1:inbuf})", "description": "cd:iconv(inbuf) - \u5b57\u7b26\u7f16\u7801\u8f6c\u6362\n\u4f20\u5165\u503c\uff1a\nstring inbuf$\u8f93\u5165\u5b57\u7b26\u4e32$\u4f8b\u5982:ucs2s \nreturn number$result$\u8fd4\u56de\u7f16\u7801\u8f6c\u6362\u540e\u7684\u7ed3\u679c$0\u6210\u529f,-1\u5931\u8d25\n\u4f8b\u5b50\uff1a\n--unicode\u5927\u7aef\u7f16\u7801 \u8f6c\u5316\u4e3a utf8\u7f16\u7801\nfunction ucs2beToUtf8(ucs2s)\n local cd = iconv.open(\"utf8\", \"ucs2be\")\n return cd:iconv(ucs2s)\nend\n", "prefix": "cd:iconv"}, "iconv.close": {"body": "iconv.close(${1:cd})", "description": "iconv.close(cd) - \u5173\u95ed\u5b57\u7b26\u7f16\u7801\u8f6c\u6362\n\u4f20\u5165\u503c\uff1a\nstring cd$iconv.open\u8fd4\u56de\u7684\u53e5\u67c4$ \nreturn \n\u4f8b\u5b50\uff1a\n--\u5173\u95ed\u5b57\u7b26\u7f16\u7801\u8f6c\u6362\nlocal cd = iconv.open(\"utf8\", \"ucs2be\")\niconv.close(cd)\n", "prefix": "iconv.close"}, "io.exists": {"body": "io.exists(${1:path})", "description": "io.exists(path) - \u5224\u65ad\u6587\u4ef6\u662f\u5426\u5b58\u5728\n\u4f20\u5165\u503c\uff1a\nstring \u6587\u4ef6\u8def\u5f84\n\u8fd4\u56de\u503c\uff1a\nbool \u5b58\u5728\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nlog.info(\"io\", \"file exists\", io.exists(\"/boottime\"))\n", "prefix": "io.exists"}, "io.fileSize": {"body": "io.fileSize(${1:path})", "description": "io.fileSize(path) - \u83b7\u53d6\u6587\u4ef6\u5927\u5c0f\n\u4f20\u5165\u503c\uff1a\nstring \u6587\u4ef6\u8def\u5f84\n\u8fd4\u56de\u503c\uff1a\nint \u6587\u4ef6\u6570\u636e,\u82e5\u6587\u4ef6\u4e0d\u5b58\u5728\u4f1a\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nlocal fsize = io.fileSize(\"/bootime\")\nif fsize and fsize > 1024 then\n log.info(\"io\", \"file size\", fsize)\nend\n", "prefix": "io.fileSize"}, "io.readFile": {"body": "io.readFile(${1:path},${2:mode},${3:offset},${4:len})", "description": "io.readFile(path, mode, offset, len) - \u8bfb\u53d6\u6574\u4e2a\u6587\u4ef6,\u8bf7\u6ce8\u610f\u5185\u5b58\u6d88\u8017\n\u4f20\u5165\u503c\uff1a\nstring \u6587\u4ef6\u8def\u5f84\nstring \u8bfb\u53d6\u6a21\u5f0f, \u9ed8\u8ba4 \"rb\"\nint \u8d77\u59cb\u4f4d\u7f6e,\u9ed8\u8ba40\nint \u8bfb\u53d6\u957f\u5ea6,\u9ed8\u8ba4\u6574\u4e2a\u6587\u4ef6\n\u8fd4\u56de\u503c\uff1a\nstring \u6587\u4ef6\u6570\u636e,\u82e5\u6587\u4ef6\u4e0d\u5b58\u5728\u4f1a\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nlocal data = io.readFile(\"/bootime\")\n-- \u6ce8\u610f: offset\u548clen\u53c2\u6570\u662f 2023.6.6\u6dfb\u52a0\u7684\n-- \u8bfb\u53d6abc.txt, \u5148\u8df3\u8fc7128\u5b57\u8282, \u7136\u540e\u8bfb\u53d6512\u5b57\u8282\u6570\u636e\nlocal data = io.readFile(\"/abc.txt\", \"rb\", 128, 512)\n", "prefix": "io.readFile"}, "io.writeFile": {"body": "io.writeFile(${1:path},${2:data})", "description": "io.writeFile(path, data) - \u5c06\u6570\u636e\u5199\u5165\u6587\u4ef6\n\u4f20\u5165\u503c\uff1a\nstring \u6587\u4ef6\u8def\u5f84\nstring \u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue, \u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nio.writeFile(\"/bootime\", \"1\")\n", "prefix": "io.writeFile"}, "io.fill": {"body": "io.fill(${1:buff},${2:offset},${3:len})", "description": "io.fill(buff, offset, len) - \u8bfb\u53d6\u6587\u4ef6\u5e76\u586b\u5145\u5230zbuff\u5185,\u4f46\u4e0d\u79fb\u52a8\u6307\u9488\u4f4d\u7f6e\n\u4f20\u5165\u503c\uff1a\nuserdata zbuff\u5b9e\u4f53\nint \u5199\u5165\u7684\u4f4d\u7f6e,\u9ed8\u8ba4\u662f0\nint \u5199\u5165\u7684\u957f\u5ea6,\u9ed8\u8ba4\u662fzbuff\u7684len\u51cf\u53bboffset\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\nint \u8fd4\u56de\u5b9e\u9645\u8bfb\u53d6\u5230\u7684\u957f\u5ea6\uff0c\u5982\u679c\u5c0f\u4e8e0\u4e5f\u8bf4\u660e\u662f\u8bfb\u53d6\u5931\u8d25\u4e86\n\u4f8b\u5b50\uff1a\nlocal buff = zbuff.create(1024)\nlocal f = io.open(\"/sd/test.txt\")\nif f then\n f:fill(buff)\nend\n", "prefix": "io.fill"}, "io.mkfs": {"body": "io.mkfs(${1:path})", "description": "io.mkfs(path) - \u683c\u5f0f\u5316\u6587\u4ef6\u7cfb\u7edf,\u9700\u6307\u5b9a\u6302\u8f7d\u70b9\n\u4f20\u5165\u503c\uff1a\nstring \u6302\u8f7d\u70b9\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\nint \u5e95\u5c42\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlocal ret, errio = io.mkfs(\"/sd\")\nlog.info(\"fs\", \"mkfs\", ret, errio)\n", "prefix": "io.mkfs"}, "io.mkdir": {"body": "io.mkdir(${1:path})", "description": "io.mkdir(path) - \u521b\u5efa\u6587\u4ef6\u5939\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u5efa\u7acb\u7684\u76ee\u5f55\u8def\u5f84\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\nint \u5e95\u5c42\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlocal ret, errio = io.mkdir(\"/data/\")\nlog.info(\"fs\", \"mkdir\", ret, errio)\n", "prefix": "io.mkdir"}, "io.rmdir": {"body": "io.rmdir(${1:path})", "description": "io.rmdir(path) - \u5220\u9664\u6587\u4ef6\u5939\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u79fb\u9664\u7684\u76ee\u5f55\u8def\u5f84\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\nint \u5e95\u5c42\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlocal ret, errio = io.rmdir(\"/data/\")\nlog.info(\"fs\", \"rmdir\", ret, errio)\n", "prefix": "io.rmdir"}, "io.lsdir": {"body": "io.lsdir(${1:path},${2:len},${3:offset})", "description": "io.lsdir(path, len, offset) - \u5217\u51fa\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u679a\u4e3e\u7684\u76ee\u5f55\u8def\u5f84\nint \u6700\u5927\u957f\u5ea6, \u9ed8\u8ba410, \u6700\u9ad850\nint \u504f\u79fb\u91cf, \u9ed8\u8ba40, \u5f53\u76ee\u5f55\u6587\u4ef6\u5f88\u591a\u65f6\u5206\u9875\u67e5\u8be2\u7528\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\nint \u5e95\u5c42\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlocal ret, data = io.lsdir(\"/data/\", 10, 0)\nif ret then\n log.info(\"fs\", \"lsdir\", json.encode(data))\nelse\n log.info(\"fs\", \"lsdir\", \"fail\", ret, data)\nend\n", "prefix": "io.lsdir"}, "io.lsmount": {"body": "io.lsmount()", "description": "io.lsmount() - \u5217\u51fa\u6240\u6709\u6302\u8f7d\u70b9\n\u8fd4\u56de\u503c\uff1a\ntable \u6302\u8f7d\u70b9\u5217\u8868\n\u4f8b\u5b50\uff1a\nlocal data = io.lsmount()\nlog.info(\"fs\", \"lsmount\", json.encode(data))\n", "prefix": "io.lsmount"}, "ioqueue.init": {"body": "ioqueue.init(${1:hwtimer_id},${2:cmd_cnt},${3:repeat_cnt})", "description": "ioqueue.init(hwtimer_id,cmd_cnt,repeat_cnt) - \u521d\u59cb\u5316\u4e00\u4e2aio\u64cd\u4f5c\u961f\u5217\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\uff0c\u9ed8\u8ba4\u75280\uff0c\u6839\u636e\u5b9e\u9645MCU\u786e\u5b9a\uff0cair105\u4e3a0~5\uff0c\u4e0epwm\u5171\u7528\uff0c\u540c\u4e00\u4e2a\u901a\u9053\u53f7\u4e0d\u80fd\u540c\u65f6\u4e3apwm\u548cioqueue\nint \u4e00\u4e2a\u5b8c\u6574\u5468\u671f\u9700\u8981\u7684\u547d\u4ee4\uff0c\u53ef\u4ee5\u6bd4\u5b9e\u9645\u7684\u591a\nint \u91cd\u590d\u6b21\u6570,\u9ed8\u8ba4\u662f1\uff0c\u5982\u679c\u51990\u5219\u8868\u793a\u65e0\u9650\u6b21\u6570\u5faa\u73af\nreturn \u65e0\n\u4f8b\u5b50\uff1a\nioqueue.init(0,10,5) --\u4ee5timer0\u4e3a\u65f6\u949f\u6e90\u521d\u59cb\u5316\u4e00\u4e2aio\u64cd\u4f5c\u961f\u5217\uff0c\u670910\u4e2a\u6709\u6548\u547d\u4ee4\uff0c\u5faa\u73af5\u6b21\n", "prefix": "ioqueue.init"}, "ioqueue.setdelay": {"body": "ioqueue.setdelay(${1:hwtimer_id},${2:time_us},${3:time_tick},${4:continue})", "description": "ioqueue.setdelay(hwtimer_id,time_us,time_tick,continue) - \u5bf9io\u64cd\u4f5c\u961f\u5217\u589e\u52a0\u5ef6\u65f6\u547d\u4ee4\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\nint \u5ef6\u65f6\u65f6\u95f4,0~65535us\nint \u5ef6\u65f6\u5fae\u8c03\u65f6\u95f4,0~255tick,\u603b\u7684\u5ef6\u65f6\u65f6\u95f4\u662ftime_us * 1us_tick + time_tick\nboolean \u662f\u5426\u8fde\u7eed\u662f\u8fde\u7eed\u5ef6\u65f6\uff0c\u9ed8\u8ba4\u5426\uff0c\u5982\u679c\u662f\uff0c\u5b9a\u65f6\u5668\u5728\u65f6\u95f4\u5230\u540e\u4e0d\u4f1a\u505c\u6b62\u800c\u662f\u91cd\u65b0\u8ba1\u65f6\uff0c\n", "prefix": "ioqueue.setdelay"}, "ioqueue.delay": {"body": "ioqueue.delay(${1:hwtimer_id})", "description": "ioqueue.delay(hwtimer_id) - \u5bf9io\u64cd\u4f5c\u961f\u5217\u589e\u52a0\u4e00\u6b21\u91cd\u590d\u5ef6\u65f6\uff0c\u5728\u524d\u9762\u5fc5\u987b\u6709setdelay\u4e14\u662f\u8fde\u7eed\u5ef6\u65f6\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\nreturn \u65e0\n\u4f8b\u5b50\uff1a\nioqueue.setdelay(0,9,15,true) --\u5ef6\u65f69us+15\u4e2atick,\u5728\u4e4b\u540e\u9047\u5230delay\u547d\u4ee4\u65f6\uff0c\u4f1a\u5ef6\u65f69us+15\u4e2atick\nioqueue.delay(0)\n", "prefix": "ioqueue.delay"}, "ioqueue.setgpio": {"body": "ioqueue.setgpio(${1:hwtimer_id},${2:pin},${3:is_input},${4:pull_mode},${5:init_level})", "description": "ioqueue.setgpio(hwtimer_id,pin,is_input,pull_mode,init_level) - \u5bf9io\u64cd\u4f5c\u961f\u5217\u589e\u52a0\u8bbe\u7f6egpio\u547d\u4ee4\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\nint pin\nboolean \u662f\u5426\u662f\u8f93\u5165\nint \u4e0a\u4e0b\u62c9\u6a21\u5f0f,\u53ea\u80fd\u662f0,gpio.PULLUP,gpio.PULLDOWN\nint \u521d\u59cb\u8f93\u51fa\u7535\u5e73\nreturn \u65e0\n\u4f8b\u5b50\uff1a\nioqueue.setgpio(0,pin.PB01,true,gpio.PULLUP,0) --PB01\u8bbe\u7f6e\u6210\u4e0a\u62c9\u8f93\u5165\nioqueue.setgpio(0,pin.PB01,false,0,1)--PB01\u8bbe\u7f6e\u6210\u9ed8\u8ba4\u4e0a\u4e0b\u62c9\u8f93\u51fa\u9ad8\u7535\u5e73\n", "prefix": "ioqueue.setgpio"}, "ioqueue.input": {"body": "ioqueue.input(${1:hwtimer_id},${2:pin})", "description": "ioqueue.input(hwtimer_id,pin) - \u5bf9io\u64cd\u4f5c\u961f\u5217\u589e\u52a0\u8bfb\u53d6gpio\u547d\u4ee4\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\nint pin\nreturn \u65e0\n\u4f8b\u5b50\uff1a\nioqueue.input(0,pin.PB01)\n\n", "prefix": "ioqueue.input"}, "ioqueue.output": {"body": "ioqueue.output(${1:hwtimer_id},${2:pin},${3:level})", "description": "ioqueue.output(hwtimer_id,pin,level) - \u5bf9io\u64cd\u4f5c\u961f\u5217\u589e\u52a0\u8f93\u51faGPIO\u547d\u4ee4\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\nint pin\nint \u8f93\u51fa\u7535\u5e73\nreturn \u65e0\n\u4f8b\u5b50\uff1a\nioqueue.output(0,pin.PB01,0)\n", "prefix": "ioqueue.output"}, "ioqueue.set_cap": {"body": "ioqueue.set_cap(${1:hwtimer_id},${2:pin},${3:pull_mode},${4:irq_mode},${5:max_tick})", "description": "ioqueue.set_cap(hwtimer_id,pin,pull_mode,irq_mode,max_tick) - \u5bf9io\u64cd\u4f5c\u961f\u5217\u589e\u52a0\u8bbe\u7f6e\u6355\u83b7\u67d0\u4e2aIO\u547d\u4ee4\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\nint pin\nint \u4e0a\u4e0b\u62c9\u6a21\u5f0f,\u53ea\u80fd\u662f0,gpio.PULLUP,gpio.PULLDOWN\nint \u4e2d\u65ad\u6a21\u5f0f,\u53ea\u80fd\u662fgpio.BOTH,gpio.RISING,gpio.FALLING\nint \u5b9a\u65f6\u5668\u6700\u5927\u8ba1\u65f6\u65f6\u95f4 \u8003\u8651\u5230lua\u662fint\u7c7b\u578b\uff0c\u6700\u5c0f0x10000, \u6700\u5927\u503c\u4e3a0x7fffffff\uff0c\u9ed8\u8ba4\u4e3a\u6700\u5927\u503c\nreturn \u65e0\n\u4f8b\u5b50\uff1a\nioqueue.setcap(0,pin.PB01,gpio.PULLUP,gpio.FALLING,48000000)\n", "prefix": "ioqueue.set_cap"}, "ioqueue.capture": {"body": "ioqueue.capture(${1:hwtimer_id})", "description": "ioqueue.capture(hwtimer_id) - \u5bf9io\u64cd\u4f5c\u961f\u5217\u589e\u52a0\u6355\u83b7\u4e00\u6b21IO\u72b6\u6001\u547d\u4ee4\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\nreturn \u65e0\n\u4f8b\u5b50\uff1a\nioqueue.capture(0)\n", "prefix": "ioqueue.capture"}, "ioqueue.capend": {"body": "ioqueue.capend(${1:hwtimer_id},${2:pin})", "description": "ioqueue.capend(hwtimer_id,pin) - \u5bf9io\u64cd\u4f5c\u961f\u5217\u589e\u52a0\u7ed3\u675f\u6355\u83b7\u67d0\u4e2aIO\u547d\u4ee4\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\nint pin\nreturn \u65e0\n\u4f8b\u5b50\uff1a\nioqueue.capend(0,pin.PB01)\n", "prefix": "ioqueue.capend"}, "ioqueue.get": {"body": "ioqueue.get(${1:hwtimer_id},${2:input_buff},${3:capture_buff})", "description": "ioqueue.get(hwtimer_id, input_buff, capture_buff) - * \u83b7\u53d6io\u64cd\u4f5c\u961f\u5217\u4e2d\u8f93\u5165\u548c\u6355\u83b7\u7684\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\nzbuff \u5b58\u653eIO\u8f93\u5165\u6570\u636e\u7684buff\uff0c\u6309\u71671byte pin + 1byte level \u5f62\u5f0f\u5b58\u653e\u6570\u636e\nzbuff \u5b58\u653eIO\u6355\u83b7\u6570\u636e\u7684buff\uff0c\u6309\u71671byte pin + 1byte level + 4byte tick\u5f62\u5f0f\u5b58\u653e\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nint \u8fd4\u56de\u591a\u5c11\u7ec4IO\u8f93\u5165\u6570\u636e\nint \u8fd4\u56de\u591a\u5c11\u7ec4IO\u6355\u83b7\u6570\u636e\n\u4f8b\u5b50\uff1a\nlocal input_cnt, capture_cnt = ioqueue.get(0, input_buff, capture_buff)\n", "prefix": "ioqueue.get"}, "ioqueue.start": {"body": "ioqueue.start(${1:hwtimer_id})", "description": "ioqueue.start(hwtimer_id) - \u542f\u52a8io\u64cd\u4f5c\u961f\u5217\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\nreturn \u65e0\n\u4f8b\u5b50\uff1a\nioqueue.start(0)\n", "prefix": "ioqueue.start"}, "ioqueue.stop": {"body": "ioqueue.stop(${1:hwtimer_id})", "description": "ioqueue.stop(hwtimer_id) - \u505c\u6b62io\u64cd\u4f5c\u961f\u5217\uff0c\u53ef\u4ee5\u901a\u8fc7start\u4ece\u5934\u5f00\u59cb\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\n\u8fd4\u56de\u503c\uff1a\nint \u8fd4\u56de\u5df2\u7ecf\u5faa\u73af\u7684\u6b21\u6570\uff0c\u5982\u679c\u662f0\uff0c\u8868\u793a\u4e00\u6b21\u5faa\u73af\u90fd\u6ca1\u6709\u5b8c\u6210\nint \u8fd4\u56de\u5355\u6b21\u5faa\u73af\u4e2d\u5df2\u7ecf\u6267\u884c\u7684cmd\u6b21\u6570\uff0c\u5982\u679c\u662f0\uff0c\u53ef\u80fd\u662f\u4e00\u6b21\u5faa\u73af\u521a\u521a\u7ed3\u675f\n\u4f8b\u5b50\uff1a\nioqueue.stop(0)\n", "prefix": "ioqueue.stop"}, "ioqueue.release": {"body": "ioqueue.release(${1:hwtimer_id})", "description": "ioqueue.release(hwtimer_id) - \u91ca\u653eio\u64cd\u4f5c\u961f\u5217\u7684\u8d44\u6e90\uff0c\u4e0b\u6b21\u4f7f\u7528\u5fc5\u987b\u91cd\u65b0init\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\nreturn \u65e0\n\u4f8b\u5b50\uff1a\nioqueue.clear(0)\n", "prefix": "ioqueue.release"}, "ioqueue.clear": {"body": "ioqueue.clear(${1:hwtimer_id})", "description": "ioqueue.clear(hwtimer_id) - \u6e05\u7a7aio\u64cd\u4f5c\u961f\u5217\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\nreturn \u65e0\n\u4f8b\u5b50\uff1a\nioqueue.clear(0)\n", "prefix": "ioqueue.clear"}, "ioqueue.done": {"body": "ioqueue.done(${1:hwtimer_id})", "description": "ioqueue.done(hwtimer_id) - \u68c0\u6d4bio\u64cd\u4f5c\u961f\u5217\u662f\u5426\u5df2\u7ecf\u6267\u884c\u5b8c\u6210\n\u4f20\u5165\u503c\uff1a\nint \u786c\u4ef6\u5b9a\u65f6\u5668id\n\u8fd4\u56de\u503c\uff1a\nboolean \u961f\u5217\u662f\u5426\u6267\u884c\u5b8c\u6210\uff0c\n\u4f8b\u5b50\uff1a\nlocal result = ioqueue.done(0)\n", "prefix": "ioqueue.done"}, "ioqueue.exti": {"body": "ioqueue.exti(${1:pin},${2:pull_mode},${3:irq_mode},${4:onoff})", "description": "ioqueue.exti(pin,pull_mode,irq_mode,onoff) - \u542f\u52a8/\u505c\u6b62\u4e00\u4e2a\u5e26\u7cfb\u7edftick\u8fd4\u56de\u7684\u5916\u90e8\u4e2d\u65ad\n\u4f20\u5165\u503c\uff1a\nint pin\nint \u4e0a\u4e0b\u62c9\u6a21\u5f0f,\u53ea\u80fd\u662f0,gpio.PULLUP,gpio.PULLDOWN\nint \u4e2d\u65ad\u6a21\u5f0f,\u53ea\u80fd\u662fgpio.BOTH,gpio.RISING,gpio.FALLING\nboolean \u5f00\u5173\uff0c\u9ed8\u8ba4\u662ffalse\u5173\nreturn \u65e0\n\u4f8b\u5b50\uff1a\nioqueue.exti(pin.PB01, gpio.PULLUP, gpio.BOTH, true)\nioqueue.exti(pin.PB01)\n", "prefix": "ioqueue.exti"}, "iotauth.aliyun": {"body": "iotauth.aliyun(${1:product_key},${2:device_name},${3:device_secret},${4:method},${5:cur_timestamp})", "description": "iotauth.aliyun(product_key, device_name,device_secret,method,cur_timestamp) - \u963f\u91cc\u4e91\u7269\u8054\u7f51\u5e73\u53f0\u4e09\u5143\u7ec4\u751f\u6210\n\u4f20\u5165\u503c\uff1a\nstring product_key\nstring device_name\nstring device_secret\nstring method \u52a0\u5bc6\u65b9\u5f0f,\"hmacmd5\" \"hmacsha1\" \"hmacsha256\" \u53ef\u9009,\u9ed8\u8ba4\"hmacmd5\"\nnumber cur_timestamp \u53ef\u9009 \u9ed8\u8ba4\u4e3a 32472115200(2999-01-01 0:0:0)\nbool istls \u662f\u5426TLS\u76f4\u8fde true:TLS\u76f4\u8fde false:TCP\u76f4\u8fde\u6a21\u5f0f \u9ed8\u8ba4TCP\u76f4\u8fde\u6a21\u5f0f\n\u8fd4\u56de\u503c\uff1a\nstring mqtt\u4e09\u5143\u7ec4 client_id\nstring mqtt\u4e09\u5143\u7ec4 user_name\nstring mqtt\u4e09\u5143\u7ec4 password\n\u4f8b\u5b50\uff1a\nlocal client_id,user_name,password = iotauth.aliyun(\"123456789\",\"abcdefg\",\"Y877Bgo8X5owd3lcB5wWDjryNPoB\")\nprint(client_id,user_name,password)\n", "prefix": "iotauth.aliyun"}, "iotauth.onenet": {"body": "iotauth.onenet(${1:produt_id},${2:device_name},${3:key},${4:method},${5:cur_timestamp},${6:version})", "description": "iotauth.onenet(produt_id, device_name,key,method,cur_timestamp,version) - \u4e2d\u56fd\u79fb\u52a8\u7269\u8054\u7f51\u5e73\u53f0\u4e09\u5143\u7ec4\u751f\u6210\n\u4f20\u5165\u503c\uff1a\nstring produt_id \u4ea7\u54c1id\nstring device_name \u8bbe\u5907\u540d\u79f0\nstring key \u8bbe\u5907\u5bc6\u94a5\u6216\u8005\u9879\u76ee\u7684acess_key\nstring method \u52a0\u5bc6\u65b9\u5f0f,\"md5\" \"sha1\" \"sha256\" \u53ef\u9009,\u9ed8\u8ba4\"md5\"\nnumber \u65f6\u95f4\u6233, \u4e0d\u7528\u586b\nstring version \u53ef\u9009 \u9ed8\u8ba4\"2018-10-31\"\nstring \u5f53key\u662faccess_key\u65f6, \u586b \"products/\" .. product_id . \u672c\u53c2\u6570\u4e8e2024.1.29\u65b0\u589e\n\u8fd4\u56de\u503c\uff1a\nstring mqtt\u4e09\u5143\u7ec4 client_id\nstring mqtt\u4e09\u5143\u7ec4 user_name\nstring mqtt\u4e09\u5143\u7ec4 password\n\u4f8b\u5b50\uff1a\n-- OneNet\u5e73\u53f0\u5b98\u7f51: https://open.iot.10086.cn/\n-- OneNet\u6709\u591a\u79cd\u7248\u672c, \u6ce8\u610f\u533a\u5206, \u4e00\u822c\u6765\u8bf4produt_id\u7eaf\u6570\u5b57\u5c31\u662f\u8001\u7248\u672c, \u5426\u5219\u5c31\u662f\u65b0\u7248\u672c\n\n-- \u65b0\u7248OneNET\u5e73\u53f0, \u4ea7\u54c1id\u662f\u82f1\u6587\u5b57\u6bcd\u5b57\u7b26\u4e32\n-- \u5bf9\u5e94demo/onenet/studio\nlocal produt_id = \"Ck2AF9QD2K\"\nlocal device_name = \"test\"\nlocal device_key = \"KuF3NT/jUBJ62LNBB/A8XZA9CqS3Cu79B/ABmfA1UCw=\"\nlocal client_id,user_name,password = iotauth.onenet(produt_id, device_name, device_key)\nlog.info(\"onenet.new\", client_id,user_name,password)\n\n-- \u65e7\u7248OneNET\u5e73\u53f0, \u4ea7\u54c1id\u662f\u6570\u5b57\u5b57\u7b26\u4e32. 2024.1.29\u65b0\u589e\n-- \u5bf9\u5e94demo/onenet/old_mqtt\nlocal produt_id = \"12342334\"\nlocal device_name = \"test\"\nlocal access_key = \"adfasdfadsfadsf=\"\nlocal client_id,user_name,password = iotauth.onenet(produt_id, device_name, access_key, nil, nil, nil, \"products/\" .. produt_id)\nlog.info(\"onenet.old\", client_id,user_name,password)\n\n", "prefix": "iotauth.onenet"}, "iotauth.iotda": {"body": "iotauth.iotda(${1:device_id},${2:device_secret},${3:cur_timestamp})", "description": "iotauth.iotda(device_id,device_secret,cur_timestamp) - \u534e\u4e3a\u7269\u8054\u7f51\u5e73\u53f0\u4e09\u5143\u7ec4\u751f\u6210\n\u4f20\u5165\u503c\uff1a\nstring device_id\nstring device_secret\nnumber cur_timestamp \u53ef\u9009 \u5982\u4e0d\u586b\u5219\u4e0d\u6821\u9a8c\u65f6\u95f4\u6233\n\u8fd4\u56de\u503c\uff1a\nstring mqtt\u4e09\u5143\u7ec4 client_id\nstring mqtt\u4e09\u5143\u7ec4 user_name\nstring mqtt\u4e09\u5143\u7ec4 password\n\u4f8b\u5b50\uff1a\nlocal client_id,user_name,password = iotauth.iotda(\"6203cc94c7fb24029b110408_88888888\",\"123456789\")\nprint(client_id,user_name,password)\n", "prefix": "iotauth.iotda"}, "iotauth.qcloud": {"body": "iotauth.qcloud(${1:product_id},${2:device_name},${3:device_secret},${4:method},${5:cur_timestamp},${6:sdk_appid})", "description": "iotauth.qcloud(product_id, device_name,device_secret,method,cur_timestamp,sdk_appid) - \u817e\u8baf\u8054\u7f51\u5e73\u53f0\u4e09\u5143\u7ec4\u751f\u6210\n\u4f20\u5165\u503c\uff1a\nstring \u4ea7\u54c1id,\u521b\u5efa\u9879\u76ee\u540e\u53ef\u4ee5\u67e5\u770b\u5230,\u7c7b\u4f3c\u4e8eLD8S5J1L07\nstring \u8bbe\u5907\u540d\u79f0,\u4f8b\u5982\u8bbe\u5907\u7684imei\u53f7\nstring \u8bbe\u5907\u5bc6\u94a5,\u521b\u5efa\u8bbe\u5907\u540e,\u67e5\u770b\u8bbe\u5907\u8be6\u60c5\u53ef\u5f97\u5230\nstring method \u52a0\u5bc6\u65b9\u5f0f,\"sha1\" \"sha256\" \u53ef\u9009,\u9ed8\u8ba4\"sha256\"\nnumber cur_timestamp \u53ef\u9009 \u9ed8\u8ba4\u4e3a 32472115200(2999-01-01 0:0:0)\nstring sdk_appid \u53ef\u9009 \u9ed8\u8ba4\u4e3a\"12010126\"\n\u8fd4\u56de\u503c\uff1a\nstring mqtt\u4e09\u5143\u7ec4 client_id\nstring mqtt\u4e09\u5143\u7ec4 user_name\nstring mqtt\u4e09\u5143\u7ec4 password\n\u4f8b\u5b50\uff1a\nlocal client_id,user_name,password = iotauth.qcloud(\"LD8S5J1L07\",\"test\",\"acyv3QDJrRa0fW5UE58KnQ==\")\nprint(client_id,user_name,password)\n", "prefix": "iotauth.qcloud"}, "iotauth.tuya": {"body": "iotauth.tuya(${1:device_id},${2:device_secret},${3:cur_timestamp})", "description": "iotauth.tuya(device_id,device_secret,cur_timestamp) - \u6d82\u9e26\u8054\u7f51\u5e73\u53f0\u4e09\u5143\u7ec4\u751f\u6210\n\u4f20\u5165\u503c\uff1a\nstring device_id\nstring device_secret\nnumber cur_timestamp \u53ef\u9009 \u9ed8\u8ba47258089600(2200-01-01 0:0:0)\n\u8fd4\u56de\u503c\uff1a\nstring mqtt\u4e09\u5143\u7ec4 client_id\nstring mqtt\u4e09\u5143\u7ec4 user_name\nstring mqtt\u4e09\u5143\u7ec4 password\n\u4f8b\u5b50\uff1a\nlocal client_id,user_name,password = iotauth.tuya(\"6c95875d0f5ba69607nzfl\",\"fb803786602df760\")\nprint(client_id,user_name,password)\n", "prefix": "iotauth.tuya"}, "iotauth.baidu": {"body": "iotauth.baidu(${1:iot_core_id},${2:device_key},${3:device_secret},${4:method},${5:cur_timestamp})", "description": "iotauth.baidu(iot_core_id, device_key,device_secret,method,cur_timestamp) - \u767e\u5ea6\u7269\u8054\u7f51\u5e73\u53f0\u4e09\u5143\u7ec4\u751f\u6210\n\u4f20\u5165\u503c\uff1a\nstring iot_core_id\nstring device_key\nstring device_secret\nstring method \u52a0\u5bc6\u65b9\u5f0f,\"MD5\" \"SHA256\" \u53ef\u9009,\u9ed8\u8ba4\"MD5\"\nnumber cur_timestamp \u53ef\u9009 \u5982\u4e0d\u586b\u5219\u4e0d\u6821\u9a8c\u65f6\u95f4\u6233\n\u8fd4\u56de\u503c\uff1a\nstring mqtt\u4e09\u5143\u7ec4 client_id\nstring mqtt\u4e09\u5143\u7ec4 user_name\nstring mqtt\u4e09\u5143\u7ec4 password\n\u4f8b\u5b50\uff1a\nlocal client_id,user_name,password = iotauth.baidu(\"abcd123\",\"mydevice\",\"ImSeCrEt0I1M2jkl\")\nprint(client_id,user_name,password)\n", "prefix": "iotauth.baidu"}, "ir.sendNEC": {"body": "ir.sendNEC(${1:pin},${2:addr},${3:cmd},${4:repeat},${5:disablePWM})", "description": "ir.sendNEC(pin, addr, cmd, repeat, disablePWM) - \u53d1\u9001NEC\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u4f7f\u7528\u7684GPIO\u5f15\u811a\u7f16\u53f7\nint \u7528\u6237\u7801\uff08\u5927\u4e8e0xff\u5219\u91c7\u7528Extended NEC\u6a21\u5f0f\uff09\nint \u6570\u636e\u7801\nint \u53ef\u9009\uff0c\u5f15\u5bfc\u7801\u53d1\u9001\u6b21\u6570\uff08110ms\u4e00\u6b21\uff09\uff0c\u9ed8\u8ba40\u6b21\nbool \u53ef\u9009\uff0c\u662f\u5426\u7981\u6b62\u76f4\u63a5\u53d1\u9001pwm\u6ce2\uff0c\u9ed8\u8ba4false\n\u4f8b\u5b50\uff1a\n--\u76f4\u63a5\u53d1\nir.sendNEC(0, 0x11, 0x22)\n--\u5916\u63a5\u4e8638K\u7684PWM\u8f7d\u6ce2\uff0c\u53ea\u63a7\u5236\u7535\u5e73\nir.sendNEC(0, 0x11, 0x22,0,true)\n", "prefix": "ir.sendNEC"}, "json.encode": {"body": "json.encode(${1:obj},${2:t})", "description": "json.encode(obj,t) - \u5c06\u5bf9\u8c61\u5e8f\u5217\u5316\u4e3ajson\u5b57\u7b26\u4e32\n\u4f20\u5165\u503c\uff1a\nobj \u9700\u8981\u5e8f\u5217\u5316\u7684\u5bf9\u8c61\nstring \u6d6e\u70b9\u6570\u7cbe\u5ea6\u548c\u6a21\u5f0f,\u8fd9\u9879\u4e0d\u5b58\u5728\u7684\u65f6\u5019,\u4e3a\u9ed8\u8ba4\u503c\"7f\",\u6570\u5b57\u53ea\u652f\u6301\"0~14\",\u6a21\u5f0f\u53ea\u652f\u6301\"f/g\"\n\u8fd4\u56de\u503c\uff1a\nstring \u5e8f\u5217\u5316\u540e\u7684json\u5b57\u7b26\u4e32, \u5931\u8d25\u7684\u8bdd\u8fd4\u56denil\nstring \u5e8f\u5217\u5316\u5931\u8d25\u7684\u62a5\u9519\u4fe1\u606f\n\u4f8b\u5b50\uff1a\njson.encode(obj)-->\u6d6e\u70b9\u6570\u7528%.7g\u7684\u65b9\u5f0f\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\njson.encode(obj,\"12f\")-->\u6d6e\u70b9\u6570\u7528%.12f\u7684\u65b9\u5f0f\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\n\n-- 2024.1.9 \u8d77, \u9ed8\u8ba4\u4f7f\u75287f\u683c\u5f0f\u5316\u6d6e\u70b9\u6570\n-- \u4e4b\u524d\u7684\u7248\u672c\u4f7f\u7528 7g\u683c\u5f0f\u5316\u6d6e\u52a8\u6570\n", "prefix": "json.encode"}, "json.decode": {"body": "json.decode(${1:str})", "description": "json.decode(str) - \u5c06\u5b57\u7b26\u4e32\u53cd\u5e8f\u5217\u5316\u4e3a\u5bf9\u8c61\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u53cd\u5e8f\u5217\u5316\u7684json\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nobj \u53cd\u5e8f\u5217\u5316\u540e\u7684\u5bf9\u8c61(\u901a\u5e38\u662ftable), \u5931\u8d25\u7684\u8bdd\u8fd4\u56denil\nresult \u6210\u529f\u8fd4\u56de1,\u5426\u5219\u8fd4\u56de0\nerr \u53cd\u5e8f\u5217\u5316\u5931\u8d25\u7684\u62a5\u9519\u4fe1\u606f\n\u4f8b\u5b50\uff1a\njson.decode(\"[1,2,3,4,5,6]\")\n", "prefix": "json.decode"}, "keyboard.init": {"body": "keyboard.init(${1:port},${2:conf},${3:map},${4:debounce})", "description": "keyboard.init(port, conf, map, debounce) - \u521d\u59cb\u5316\u952e\u76d8\u77e9\u9635\n\u4f20\u5165\u503c\uff1a\nint \u9884\u7559, \u5f53\u524d\u586b0\nint \u542f\u7528\u7684keyboard\u7ba1\u811a\u63a9\u7801, \u4f8b\u5982\u4f7f\u7528keyboard0~9, \u5219\u63a9\u7801\u4e3a 0x1FF, \u82e5\u4f7f\u7528 0~3 \u5219 0xF\nint keyboard\u7ba1\u811a\u65b9\u5411\u6620\u5c04, \u5176\u4e2d\u8f93\u5165\u4e3a0,\u8f93\u51fa\u4e3a1, \u6309\u4f4d\u8bbe\u7f6e. \u4f8b\u5982 keyboard0~3\u4f5c\u4e3a\u8f93\u5165, keyboard4~7\u4e3a\u8f93\u5165, \u5219 0xF0\nint \u6d88\u6296\u914d\u7f6e,\u9884\u7559,\u53ef\u4ee5\u4e0d\u586b\n\u4f8b\u5b50\uff1a\n-- \u505a\u4e00\u4e2a 4*4 \u952e\u76d8\u77e9\u9635, \u4f7f\u7528 keyboard0~7, \u5176\u4e2d0~3\u505a\u8f93\u5165, 4~7\u505a\u8f93\u51fa\n-- \u4f7f\u7528 keyboard0~7, \u5bf9\u5e94conf\u4e3a 0xFF\n-- \u5176\u4e2d0~3\u505a\u8f93\u5165, 4~7\u505a\u8f93\u51fa, \u5bf9\u5e94map \u4e3a 0xF0\nkeyboard.init(0, 0xFF, 0xF0)\n\n-- \u505a\u4e00\u4e2a 2*3 \u952e\u76d8\u77e9\u9635, \u4f7f\u7528 keyboard0~4, \u5176\u4e2d0~1\u505a\u8f93\u5165, 2~4\u505a\u8f93\u51fa\n-- \u4f7f\u7528 keyboard0~4, \u4e8c\u8fdb\u5236\u4e3a 11111, \u5bf9\u5e94conf\u7684\u5341\u516d\u8fdb\u5236\u8868\u8fbe\u4e3a 0x1F\n-- \u5176\u4e2d0~1\u505a\u8f93\u5165, 2~4\u505a\u8f93\u51fa, \u4e8c\u8fdb\u5236\u4e3a 11100 \u5bf9\u5e94map \u4e3a 0x14\n-- keyboard.init(0, 0xFF, 0x14)\n\nsys.subscribe(\"KB_INC\", function(port, data, state)\n -- port \u5f53\u524d\u56fa\u5b9a\u4e3a0, \u53ef\u4ee5\u65e0\u89c6\n -- data, \u9700\u8981\u914d\u5408init\u7684map\u8fdb\u884c\u89e3\u6790\n -- state, 1 \u4e3a\u6309\u4e0b, 0 \u4e3a \u91ca\u653e\n -- TODO \u8be6\u7ec6\u4ecb\u7ecd\nend)\n", "prefix": "keyboard.init"}, "lcd.init": {"body": "lcd.init(${1:tp},${2:args},${3:spi_dev},${4:init_in_service})", "description": "lcd.init(tp, args, spi_dev, init_in_service) - lcd\u663e\u793a\u5c4f\u521d\u59cb\u5316\n\u4f20\u5165\u503c\uff1a\nstring lcd\u7c7b\u578b\uff0c\u5f53\u524d\u652f\u6301\uff1a
st7796
st7789
st7735
st7735v
st7735s
gc9a01
gc9106l
gc9306x
ili9486
custom\ntable \u9644\u52a0\u53c2\u6570,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173\uff1a
pin_pwr\uff08\u80cc\u5149\uff09\u4e3a\u53ef\u9009\u9879,\u53ef\u4e0d\u8bbe\u7f6e
port\uff1aspi\u7aef\u53e3,\u4f8b\u59820,1,2...\u5982\u679c\u4e3adevice\u65b9\u5f0f\u5219\u4e3a\"device\"
pin_dc\uff1alcd\u6570\u636e/\u547d\u4ee4\u9009\u62e9\u5f15\u811a
pin_rst\uff1alcd\u590d\u4f4d\u5f15\u811a
pin_pwr\uff1alcd\u80cc\u5149\u5f15\u811a \u53ef\u9009\u9879,\u53ef\u4e0d\u8bbe\u7f6e
direction\uff1alcd\u5c4f\u5e55\u65b9\u5411 0:0\u00b0 1:180\u00b0 2:270\u00b0 3:90\u00b0
w\uff1alcd \u6c34\u5e73\u5206\u8fa8\u7387
h\uff1alcd \u7ad6\u76f4\u5206\u8fa8\u7387
xoffset\uff1ax\u504f\u79fb(\u4e0d\u540c\u5c4f\u5e55ic \u4e0d\u540c\u5c4f\u5e55\u65b9\u5411\u4f1a\u6709\u5dee\u5f02)
yoffset\uff1ay\u504f\u79fb(\u4e0d\u540c\u5c4f\u5e55ic \u4e0d\u540c\u5c4f\u5e55\u65b9\u5411\u4f1a\u6709\u5dee\u5f02)
direction0\uff1a0\u00b0\u65b9\u5411\u547d\u4ee4\uff0c(\u4e0d\u540c\u5c4f\u5e55ic\u4f1a\u6709\u5dee\u5f02)
direction90\uff1a90\u00b0\u65b9\u5411\u547d\u4ee4\uff0c(\u4e0d\u540c\u5c4f\u5e55ic\u4f1a\u6709\u5dee\u5f02)
direction180\uff1a180\u00b0\u65b9\u5411\u547d\u4ee4\uff0c(\u4e0d\u540c\u5c4f\u5e55ic\u4f1a\u6709\u5dee\u5f02)
direction270\uff1a270\u00b0\u65b9\u5411\u547d\u4ee4\uff0c(\u4e0d\u540c\u5c4f\u5e55ic\u4f1a\u6709\u5dee\u5f02)
sleepcmd\uff1a\u7761\u7720\u547d\u4ee4\uff0c\u9ed8\u8ba40X10
wakecmd\uff1a\u5524\u9192\u547d\u4ee4\uff0c\u9ed8\u8ba40X11
interface_mode lcd\u6a21\u5f0f\uff0c\u9ed8\u8ba4lcd.WIRE_4_BIT_8_INTERFACE_I\nuserdata spi\u8bbe\u5907,\u5f53port = \"device\"\u65f6\u6709\u6548\nboolean \u5141\u8bb8\u521d\u59cb\u5316\u5728lcd service\u91cc\u8fd0\u884c\uff0c\u9ed8\u8ba4\u662ffalse\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316spi0\u7684st7735s \u6ce8\u610f:lcd\u521d\u59cb\u5316\u4e4b\u524d\u9700\u8981\u5148\u521d\u59cb\u5316spi\nspi_lcd = spi.deviceSetup(0,20,0,0,8,2000000,spi.MSB,1,1)\nlog.info(\"lcd.init\",\nlcd.init(\"st7735s\",{port = \"device\",pin_dc = 17, pin_pwr = 7,pin_rst = 19,direction = 2,w = 160,h = 80,xoffset = 1,yoffset = 26},spi_lcd))\n", "prefix": "lcd.init"}, "lcd.close": {"body": "lcd.close()", "description": "lcd.close() - \u5173\u95edlcd\u663e\u793a\u5c4f\n\u4f8b\u5b50\uff1a\n-- \u5173\u95edlcd\nlcd.close()\n", "prefix": "lcd.close"}, "lcd.on": {"body": "lcd.on()", "description": "lcd.on() - \u5f00\u542flcd\u663e\u793a\u5c4f\u80cc\u5149\n\u4f8b\u5b50\uff1a\n-- \u5f00\u542flcd\u663e\u793a\u5c4f\u80cc\u5149\nlcd.on()\n", "prefix": "lcd.on"}, "lcd.off": {"body": "lcd.off()", "description": "lcd.off() - \u5173\u95edlcd\u663e\u793a\u5c4f\u80cc\u5149\n\u4f8b\u5b50\uff1a\n-- \u5173\u95edlcd\u663e\u793a\u5c4f\u80cc\u5149\nlcd.off()\n", "prefix": "lcd.off"}, "lcd.sleep": {"body": "lcd.sleep()", "description": "lcd.sleep() - lcd\u7761\u7720\n\u4f8b\u5b50\uff1a\n-- lcd\u7761\u7720\nlcd.sleep()\n", "prefix": "lcd.sleep"}, "lcd.wakeup": {"body": "lcd.wakeup()", "description": "lcd.wakeup() - lcd\u5524\u9192\n\u4f8b\u5b50\uff1a\n-- lcd\u5524\u9192\nlcd.wakeup()\n", "prefix": "lcd.wakeup"}, "lcd.invon": {"body": "lcd.invon()", "description": "lcd.invon() - lcd\u53cd\u663e\n\u4f8b\u5b50\uff1a\n-- lcd\u53cd\u663e\nlcd.invon()\n", "prefix": "lcd.invon"}, "lcd.invoff": {"body": "lcd.invoff()", "description": "lcd.invoff() - lcd\u53cd\u663e\u5173\u95ed\n\u4f8b\u5b50\uff1a\n-- lcd\u53cd\u663e\u5173\u95ed\nlcd.invoff()\n", "prefix": "lcd.invoff"}, "lcd.cmd": {"body": "lcd.cmd(${1:cmd})", "description": "lcd.cmd(cmd) - lcd\u547d\u4ee4\n\u4f20\u5165\u503c\uff1a\nint cmd\n\u4f8b\u5b50\uff1a\n-- lcd\u547d\u4ee4\nlcd.cmd(0x21)\n", "prefix": "lcd.cmd"}, "lcd.data": {"body": "lcd.data(${1:data})", "description": "lcd.data(data) - lcd\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint data\n\u4f8b\u5b50\uff1a\n-- lcd\u6570\u636e\nlcd.data(0x21)\n", "prefix": "lcd.data"}, "lcd.setColor": {"body": "lcd.setColor(${1:back},${2:fore})", "description": "lcd.setColor(back,fore) - lcd\u989c\u8272\u8bbe\u7f6e\n\u4f20\u5165\u503c\uff1a\nint \u80cc\u666f\u8272\nint \u524d\u666f\u8272\n\u4f8b\u5b50\uff1a\n-- lcd\u989c\u8272\u8bbe\u7f6e\nlcd.setColor(0xFFFF,0x0000)\n", "prefix": "lcd.setColor"}, "lcd.draw": {"body": "lcd.draw(${1:x1},${2:y1},${3:x2},${4:y2},${5:color})", "description": "lcd.draw(x1, y1, x2, y2,color) - lcd\u989c\u8272\u586b\u5145\n\u4f20\u5165\u503c\uff1a\nint \u5de6\u4e0a\u8fb9\u7f18\u7684X\u4f4d\u7f6e.\nint \u5de6\u4e0a\u8fb9\u7f18\u7684Y\u4f4d\u7f6e.\nint \u53f3\u4e0b\u8fb9\u7f18\u7684X\u4f4d\u7f6e.\nint \u53f3\u4e0b\u8fb9\u7f18\u7684Y\u4f4d\u7f6e.\nstring \u5b57\u7b26\u4e32\u6216zbuff\u5bf9\u8c61\n\u4f8b\u5b50\uff1a\n-- lcd\u989c\u8272\u586b\u5145\nlocal buff = zbuff.create({201,1,16},0x001F)\nlcd.draw(20,30,220,30,buff)\n", "prefix": "lcd.draw"}, "lcd.clear": {"body": "lcd.clear(${1:color})", "description": "lcd.clear(color) - lcd\u6e05\u5c4f\n\u4f20\u5165\u503c\uff1a\nint \u5c4f\u5e55\u989c\u8272 \u53ef\u9009\u53c2\u6570,\u9ed8\u8ba4\u80cc\u666f\u8272\n\u4f8b\u5b50\uff1a\n-- lcd\u6e05\u5c4f\nlcd.clear()\n", "prefix": "lcd.clear"}, "lcd.fill": {"body": "lcd.fill(${1:x1},${2:y1},${3:x2},${4:y2},${5:color})", "description": "lcd.fill(x1, y1, x2, y2,color) - lcd\u989c\u8272\u586b\u5145\n\u4f20\u5165\u503c\uff1a\nint \u5de6\u4e0a\u8fb9\u7f18\u7684X\u4f4d\u7f6e.\nint \u5de6\u4e0a\u8fb9\u7f18\u7684Y\u4f4d\u7f6e.\nint \u53f3\u4e0b\u8fb9\u7f18\u7684X\u4f4d\u7f6e,\u4e0d\u542b\nint \u53f3\u4e0b\u8fb9\u7f18\u7684Y\u4f4d\u7f6e,\u4e0d\u542b\nint \u7ed8\u753b\u989c\u8272 \u53ef\u9009\u53c2\u6570,\u9ed8\u8ba4\u80cc\u666f\u8272\n\u4f8b\u5b50\uff1a\n-- lcd\u989c\u8272\u586b\u5145\nlcd.fill(20,30,220,30,0x0000)\n", "prefix": "lcd.fill"}, "lcd.drawPoint": {"body": "lcd.drawPoint(${1:x0},${2:y0},${3:color})", "description": "lcd.drawPoint(x0,y0,color) - \u753b\u4e00\u4e2a\u70b9.\n\u4f20\u5165\u503c\uff1a\nint \u70b9\u7684X\u4f4d\u7f6e.\nint \u70b9\u7684Y\u4f4d\u7f6e.\nint \u7ed8\u753b\u989c\u8272 \u53ef\u9009\u53c2\u6570,\u9ed8\u8ba4\u524d\u666f\u8272\n\u4f8b\u5b50\uff1a\nlcd.drawPoint(20,30,0x001F)\n", "prefix": "lcd.drawPoint"}, "lcd.drawLine": {"body": "lcd.drawLine(${1:x0},${2:y0},${3:x1},${4:y1},${5:color})", "description": "lcd.drawLine(x0,y0,x1,y1,color) - \u5728\u4e24\u70b9\u4e4b\u95f4\u753b\u4e00\u6761\u7ebf.\n\u4f20\u5165\u503c\uff1a\nint \u7b2c\u4e00\u4e2a\u70b9\u7684X\u4f4d\u7f6e.\nint \u7b2c\u4e00\u4e2a\u70b9\u7684Y\u4f4d\u7f6e.\nint \u7b2c\u4e8c\u4e2a\u70b9\u7684X\u4f4d\u7f6e.\nint \u7b2c\u4e8c\u4e2a\u70b9\u7684Y\u4f4d\u7f6e.\nint \u7ed8\u753b\u989c\u8272 \u53ef\u9009\u53c2\u6570,\u9ed8\u8ba4\u524d\u666f\u8272\n\u4f8b\u5b50\uff1a\nlcd.drawLine(20,30,220,30,0x001F)\n", "prefix": "lcd.drawLine"}, "lcd.drawRectangle": {"body": "lcd.drawRectangle(${1:x0},${2:y0},${3:x1},${4:y1},${5:color})", "description": "lcd.drawRectangle(x0,y0,x1,y1,color) - \u4ecex / y\u4f4d\u7f6e\uff08\u5de6\u4e0a\u8fb9\u7f18\uff09\u5f00\u59cb\u7ed8\u5236\u4e00\u4e2a\u6846\n\u4f20\u5165\u503c\uff1a\nint \u5de6\u4e0a\u8fb9\u7f18\u7684X\u4f4d\u7f6e.\nint \u5de6\u4e0a\u8fb9\u7f18\u7684Y\u4f4d\u7f6e.\nint \u53f3\u4e0b\u8fb9\u7f18\u7684X\u4f4d\u7f6e.\nint \u53f3\u4e0b\u8fb9\u7f18\u7684Y\u4f4d\u7f6e.\nint \u7ed8\u753b\u989c\u8272 \u53ef\u9009\u53c2\u6570,\u9ed8\u8ba4\u524d\u666f\u8272\n\u4f8b\u5b50\uff1a\nlcd.drawRectangle(20,40,220,80,0x001F)\n", "prefix": "lcd.drawRectangle"}, "lcd.drawCircle": {"body": "lcd.drawCircle(${1:x0},${2:y0},${3:r},${4:color})", "description": "lcd.drawCircle(x0,y0,r,color) - \u4ecex / y\u4f4d\u7f6e\uff08\u5706\u5fc3\uff09\u5f00\u59cb\u7ed8\u5236\u4e00\u4e2a\u5706\n\u4f20\u5165\u503c\uff1a\nint \u5706\u5fc3\u7684X\u4f4d\u7f6e.\nint \u5706\u5fc3\u7684Y\u4f4d\u7f6e.\nint \u534a\u5f84.\nint \u7ed8\u753b\u989c\u8272 \u53ef\u9009\u53c2\u6570,\u9ed8\u8ba4\u524d\u666f\u8272\n\u4f8b\u5b50\uff1a\nlcd.drawCircle(120,120,20,0x001F)\n", "prefix": "lcd.drawCircle"}, "lcd.drawQrcode": {"body": "lcd.drawQrcode(${1:x},${2:y},${3:str},${4:size})", "description": "lcd.drawQrcode(x, y, str, size) - \u7f13\u51b2\u533a\u7ed8\u5236QRCode\n\u4f20\u5165\u503c\uff1a\nint x\u5750\u6807\nint y\u5750\u6807\nstring \u4e8c\u7ef4\u7801\u7684\u5185\u5bb9\nint \u663e\u793a\u5927\u5c0f (\u6ce8\u610f:\u4e8c\u7ef4\u7801\u751f\u6210\u5927\u5c0f\u4e0e\u8981\u663e\u793a\u5185\u5bb9\u548c\u7ea0\u9519\u7b49\u7ea7\u6709\u5173,\u751f\u6210\u7248\u672c\u4e3a1-40(\u5bf9\u5e94 21x21 - 177x177)\u7684\u4e0d\u5b9a\u5927\u5c0f,\u5982\u679c\u548c\u8bbe\u7f6e\u5927\u5c0f\u4e0d\u540c\u4f1a\u81ea\u52a8\u5728\u6307\u5b9a\u7684\u533a\u57df\u4e2d\u95f4\u663e\u793a\u4e8c\u7ef4\u7801,\u5982\u4e8c\u7ef4\u7801\u672a\u663e\u793a\u8bf7\u67e5\u770b\u65e5\u5fd7\u63d0\u793a)\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "lcd.drawQrcode"}, "lcd.setFont": {"body": "lcd.setFont(${1:font},${2:indentation})", "description": "lcd.setFont(font, indentation) - \u8bbe\u7f6e\u5b57\u4f53\n\u4f20\u5165\u503c\uff1a\nint font lcd.font_XXX \u8bf7\u67e5\u9605\u5e38\u91cf\u8868\nint indentation, \u7b49\u5bbd\u5b57\u4f53ascii\u53f3\u4fa7\u7f29\u8fdb0~127\u4e2apixel\uff0c\u7b49\u5bbd\u5b57\u4f53\u7684ascii\u5b57\u7b26\u53ef\u80fd\u5728\u53f3\u4fa7\u6709\u5927\u7247\u7a7a\u767d\uff0c\u7528\u6237\u53ef\u4ee5\u9009\u62e9\u5220\u9664\u90e8\u5206\u3002\u7559\u7a7a\u6216\u8005\u8d85\u8fc7127\u5219\u76f4\u63a5\u5220\u9664\u53f3\u534a\u8fb9, \u975e\u7b49\u5bbd\u5b57\u4f53\u65e0\u6548\n\u4f8b\u5b50\uff1a\n-- \u8bbe\u7f6e\u4e3a\u5b57\u4f53,\u5bf9\u4e4b\u540e\u7684drawStr\u6709\u6548,\u8c03\u7528lcd.drawStr\u524d\u4e00\u5b9a\u8981\u5148\u8bbe\u7f6e\n\n-- \u82e5\u63d0\u793a \"only font pointer is allow\" , \u5219\u4ee3\u8868\u5f53\u524d\u56fa\u4ef6\u4e0d\u542b\u5bf9\u5e94\u5b57\u4f53, \u53ef\u4f7f\u7528\u4e91\u7f16\u8bd1\u670d\u52a1\u514d\u8d39\u5b9a\u5236\n-- \u4e91\u7f16\u8bd1\u6587\u6863: https://wiki.luatos.com/develop/compile/Cloud_compilation.html\n\n-- lcd\u5e93\u7684\u9ed8\u8ba4\u5b57\u4f53\u5747\u4ee5 lcd.font_ \u5f00\u5934\nlcd.setFont(lcd.font_opposansm12)\nlcd.drawStr(40,10,\"drawStr\")\nsys.wait(2000)\nlcd.setFont(lcd.font_opposansm12_chinese) -- \u5177\u4f53\u53d6\u503c\u53ef\u53c2\u8003api\u6587\u6863\u7684\u5e38\u91cf\u8868\nlcd.drawStr(40,40,\"drawStr\u6d4b\u8bd5\")\n", "prefix": "lcd.setFont"}, "lcd.drawStr": {"body": "lcd.drawStr(${1:x},${2:y},${3:str},${4:fg_color})", "description": "lcd.drawStr(x,y,str,fg_color) - \u663e\u793a\u5b57\u7b26\u4e32\n\u4f20\u5165\u503c\uff1a\nint x \u6a2a\u5750\u6807\nint y \u7ad6\u5750\u6807 \u6ce8\u610f:\u6b64(x,y)\u4e3a\u5de6\u4e0b\u8d77\u59cb\u5750\u6807\nstring str \u6587\u4ef6\u5185\u5bb9\nint fg_color str\u989c\u8272 \u6ce8\u610f:\u6b64\u53c2\u6570\u53ef\u9009\uff0c\u5982\u4e0d\u586b\u5199\u5219\u4f7f\u7528\u4e4b\u524d\u8bbe\u7f6e\u7684\u989c\u8272\uff0c\u7ed8\u5236\u53ea\u4f1a\u7ed8\u5236\u5b57\u4f53\u90e8\u5206\uff0c\u80cc\u666f\u9700\u8981\u81ea\u5df1\u6e05\u9664\n\u4f8b\u5b50\uff1a\n-- \u663e\u793a\u4e4b\u524d\u5148\u8bbe\u7f6e\u4e3a\u4e2d\u6587\u5b57\u4f53,\u5bf9\u4e4b\u540e\u7684drawStr\u6709\u6548\nlcd.setFont(lcd.font_opposansm12)\nlcd.drawStr(40,10,\"drawStr\")\nsys.wait(2000)\nlcd.setFont(lcd.font_opposansm16_chinese)\nlcd.drawStr(40,40,\"drawStr\u6d4b\u8bd5\")\n", "prefix": "lcd.drawStr"}, "lcd.drawGtfontGb2312": {"body": "lcd.drawGtfontGb2312(${1:str},${2:size},${3:x},${4:y})", "description": "lcd.drawGtfontGb2312(str,size,x,y) - \u4f7f\u7528gtfont\u663e\u793agb2312\u5b57\u7b26\u4e32\n\u4f20\u5165\u503c\uff1a\nstring str \u663e\u793a\u5b57\u7b26\u4e32\nint size \u5b57\u4f53\u5927\u5c0f (\u652f\u630116-192\u53f7\u5927\u5c0f\u5b57\u4f53)\nint x \u6a2a\u5750\u6807\nint y \u7ad6\u5750\u6807\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f, gtfont\u662f\u989d\u5916\u7684\u5b57\u4f53\u82af\u7247\u786c\u4ef6, \u9700\u8981\u5916\u6302\u5728SPI\u603b\u7ebf\u624d\u80fd\u8c03\u7528\u672c\u51fd\u6570\u7684\nlcd.drawGtfontGb2312(\"\u554a\u554a\u554a\",32,0,0)\n", "prefix": "lcd.drawGtfontGb2312"}, "lcd.drawGtfontGb2312Gray": {"body": "lcd.drawGtfontGb2312Gray(${1:str},${2:size},${3:gray},${4:x},${5:y})", "description": "lcd.drawGtfontGb2312Gray(str,size,gray,x,y) - \u4f7f\u7528gtfont\u7070\u5ea6\u663e\u793agb2312\u5b57\u7b26\u4e32\n\u4f20\u5165\u503c\uff1a\nstring str \u663e\u793a\u5b57\u7b26\u4e32\nint size \u5b57\u4f53\u5927\u5c0f (\u652f\u630116-192\u53f7\u5927\u5c0f\u5b57\u4f53)\nint gray \u7070\u5ea6[1\u9636/2\u9636/3\u9636/4\u9636]\nint x \u6a2a\u5750\u6807\nint y \u7ad6\u5750\u6807\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f, gtfont\u662f\u989d\u5916\u7684\u5b57\u4f53\u82af\u7247\u786c\u4ef6, \u9700\u8981\u5916\u6302\u5728SPI\u603b\u7ebf\u624d\u80fd\u8c03\u7528\u672c\u51fd\u6570\u7684\nlcd.drawGtfontGb2312Gray(\"\u554a\u554a\u554a\",32,4,0,40)\n", "prefix": "lcd.drawGtfontGb2312Gray"}, "lcd.drawGtfontUtf8": {"body": "lcd.drawGtfontUtf8(${1:str},${2:size},${3:x},${4:y})", "description": "lcd.drawGtfontUtf8(str,size,x,y) - \u4f7f\u7528gtfont\u663e\u793aUTF8\u5b57\u7b26\u4e32\n\u4f20\u5165\u503c\uff1a\nstring str \u663e\u793a\u5b57\u7b26\u4e32\nint size \u5b57\u4f53\u5927\u5c0f (\u652f\u630116-192\u53f7\u5927\u5c0f\u5b57\u4f53)\nint x \u6a2a\u5750\u6807\nint y \u7ad6\u5750\u6807\n\u4f8b\u5b50\uff1a\nlcd.drawGtfontUtf8(\"\u554a\u554a\u554a\",32,0,0)\n", "prefix": "lcd.drawGtfontUtf8"}, "lcd.drawGtfontUtf8Gray": {"body": "lcd.drawGtfontUtf8Gray(${1:str},${2:size},${3:gray},${4:x},${5:y})", "description": "lcd.drawGtfontUtf8Gray(str,size,gray,x,y) - \u4f7f\u7528gtfont\u7070\u5ea6\u663e\u793aUTF8\u5b57\u7b26\u4e32\n\u4f20\u5165\u503c\uff1a\nstring str \u663e\u793a\u5b57\u7b26\u4e32\nint size \u5b57\u4f53\u5927\u5c0f (\u652f\u630116-192\u53f7\u5927\u5c0f\u5b57\u4f53)\nint gray \u7070\u5ea6[1\u9636/2\u9636/3\u9636/4\u9636]\nint x \u6a2a\u5750\u6807\nint y \u7ad6\u5750\u6807\n\u4f8b\u5b50\uff1a\nlcd.drawGtfontUtf8Gray(\"\u554a\u554a\u554a\",32,4,0,40)\n", "prefix": "lcd.drawGtfontUtf8Gray"}, "lcd.getSize": {"body": "lcd.getSize()", "description": "lcd.getSize() - \u83b7\u53d6\u5c4f\u5e55\u5c3a\u5bf8\n\u8fd4\u56de\u503c\uff1a\nint \u5bbd, \u5982\u679c\u672a\u521d\u59cb\u5316\u4f1a\u8fd4\u56de0\nint \u9ad8, \u5982\u679c\u672a\u521d\u59cb\u5316\u4f1a\u8fd4\u56de0\n\u4f8b\u5b50\uff1a\nlog.info(\"lcd\", \"size\", lcd.getSize())\n", "prefix": "lcd.getSize"}, "lcd.drawXbm": {"body": "lcd.drawXbm(${1:x},${2:y},${3:w},${4:h},${5:data})", "description": "lcd.drawXbm(x, y, w, h, data) - \u7ed8\u5236\u4f4d\u56fe\n\u4f20\u5165\u503c\uff1a\nint X\u5750\u6807\nint y\u5750\u6807\nint \u4f4d\u56fe\u5bbd\nint \u4f4d\u56fe\u9ad8\nint \u4f4d\u56fe\u6570\u636e,\u6bcf\u4e00\u4f4d\u4ee3\u8868\u4e00\u4e2a\u50cf\u7d20\n\u4f8b\u5b50\uff1a\n-- \u53d6\u6a21\u4f7f\u7528PCtoLCD2002\u8f6f\u4ef6\u5373\u53ef \u9634\u7801 \u9010\u884c \u9006\u5411\n-- \u5728(0,0)\u4e3a\u5de6\u4e0a\u89d2,\u7ed8\u5236 16x16 \"\u4eca\" \u7684\u4f4d\u56fe\nlcd.drawXbm(0, 0, 16,16, string.char(\n 0x80,0x00,0x80,0x00,0x40,0x01,0x20,0x02,0x10,0x04,0x48,0x08,0x84,0x10,0x83,0x60,\n 0x00,0x00,0xF8,0x0F,0x00,0x08,0x00,0x04,0x00,0x04,0x00,0x02,0x00,0x01,0x80,0x00\n))\n", "prefix": "lcd.drawXbm"}, "lcd.showImage": {"body": "lcd.showImage(${1:x},${2:y},${3:file})", "description": "lcd.showImage(x, y, file) - \u663e\u793a\u56fe\u7247,\u5f53\u524d\u53ea\u652f\u6301jpg,jpeg\n\u4f20\u5165\u503c\uff1a\nint X\u5750\u6807\nint y\u5750\u6807\nstring \u6587\u4ef6\u8def\u5f84\n\u4f8b\u5b50\uff1a\nlcd.showImage(0,0,\"/luadb/logo.jpg\")\n", "prefix": "lcd.showImage"}, "lcd.flush": {"body": "lcd.flush()", "description": "lcd.flush() - \u4e3b\u52a8\u5237\u65b0\u6570\u636e\u5230\u754c\u9762, \u4ec5\u8bbe\u7f6ebuff\u4e14\u7981\u7528\u81ea\u52a8\u5c5e\u6027\u540e\u4f7f\u7528\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue, \u5426\u5219\u8fd4\u56denil/false\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e0e lcd.setupBuff lcd.autoFlush \u914d\u5408\u4f7f\u7528\nlcd.flush()\n", "prefix": "lcd.flush"}, "lcd.setupBuff": {"body": "lcd.setupBuff(${1:conf},${2:onheap})", "description": "lcd.setupBuff(conf, onheap) - \u8bbe\u7f6e\u663e\u793a\u7f13\u51b2\u533a, \u6240\u9700\u5185\u5b58\u5927\u5c0f\u4e3a 2\u00d7\u5bbd\u00d7\u9ad8 \u5b57\u8282. \u8bf7\u8861\u91cf\u5185\u5b58\u9700\u6c42\u4e0e\u4e1a\u52a1\u6240\u9700\u7684\u5237\u65b0\u9891\u6b21.\n\u4f20\u5165\u503c\uff1a\nuserdata conf\u6307\u9488, \u4e0d\u9700\u8981\u4f20\nbool true\u4f7f\u7528heap\u5185\u5b58, false\u4f7f\u7528vm\u5185\u5b58, \u9ed8\u8ba4\u4f7f\u7528vm\u5185\u5b58, \u4e0d\u9700\u8981\u4e3b\u52a8\u4f20\n\u8fd4\u56de\u503c\uff1a\nbool \u662f\u5426\u6210\u529f\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316lcd\u7684buff\u7f13\u51b2\u533a, \u53ef\u7406\u89e3\u4e3aFrameBuffer\u533a\u57df.\nlcd.setupBuff()\n", "prefix": "lcd.setupBuff"}, "lcd.autoFlush": {"body": "lcd.autoFlush(${1:enable})", "description": "lcd.autoFlush(enable) - \u8bbe\u7f6e\u81ea\u52a8\u5237\u65b0, \u9700\u914d\u5408lcd.setupBuff\u4f7f\u7528\n\u4f20\u5165\u503c\uff1a\nbool \u662f\u5426\u81ea\u52a8\u5237\u65b0,\u9ed8\u8ba4\u4e3atrue\n\u4f8b\u5b50\uff1a\n-- \u8bbe\u7f6ebuff \u5e76\u7981\u7528\u81ea\u52a8\u66f4\u65b0\nlcd.setupBuff()\nlcd.autoFlush(false)\n-- \u7981\u6b62\u81ea\u52a8\u66f4\u65b0\u540e, \u9700\u8981\u4f7f\u7528 lcd.flush() \u4e3b\u52a8\u5237\u65b0\u6570\u636e\u5230\u5c4f\u5e55\n", "prefix": "lcd.autoFlush"}, "lcd.rgb565": {"body": "lcd.rgb565(${1:r},${2:g},${3:b},${4:swap})", "description": "lcd.rgb565(r, g, b, swap) - RGB565\u989c\u8272\u751f\u6210\n\u4f20\u5165\u503c\uff1a\nint \u7ea2\u8272, 0x00 ~ 0xFF\nint \u7eff\u8272, 0x00 ~ 0xFF\nint \u84dd\u8272, 0x00 ~ 0xFF\nbool \u662f\u5426\u7ffb\u8f6c, true \u7ffb\u8f6c, false \u4e0d\u7ffb\u8f6c. \u9ed8\u8ba4\u7ffb\u8f6c\n\u8fd4\u56de\u503c\uff1a\nint \u989c\u8272\u503c\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u652f\u6301\u591a\u79cd\u6a21\u5f0f, \u53c2\u6570\u6570\u91cf\u5206\u522b\u662f 1, 2, 3, 4\n-- 1. \u5355\u53c2\u6570\u5f62\u5f0f, 24bit RGB\u503c, swap = true, \u63a8\u8350\nlocal red = lcd.rgb565(0xFF0000)\nlocal green = lcd.rgb565(0x00FF00)\nlocal blue = lcd.rgb565(0x0000FF)\n\n-- 2. \u4e24\u53c2\u6570\u5f62\u5f0f, 24bit RGB\u503c, \u589e\u52a0swap\u7684\u8bbe\u7f6e\nlocal red = lcd.rgb565(0xFF0000, true)\nlocal green = lcd.rgb565(0x00FF00, true)\nlocal blue = lcd.rgb565(0x0000FF, true)\n\n-- 3. \u4e09\u53c2\u6570\u5f62\u5f0f, \u7ea2/\u7eff/\u84dd, \u54048bit\nlocal red = lcd.rgb565(0xFF, 0x00, 0x00)\nlocal green = lcd.rgb565(0x00, 0xFF, 0x00)\nlocal blue = lcd.rgb565(0x00, 0x00, 0xFF)\n\n-- 4. \u56db\u53c2\u6570\u5f62\u5f0f, \u7ea2/\u7eff/\u84dd, \u54048bit, \u589e\u52a0swap\u7684\u8bbe\u7f6e\nlocal red = lcd.rgb565(0xFF, 0x00, 0x00, true)\nlocal green = lcd.rgb565(0x00, 0xFF, 0x00, true)\nlocal blue = lcd.rgb565(0x00, 0x00, 0xFF, true)\n", "prefix": "lcd.rgb565"}, "lcdseg.setup": {"body": "lcdseg.setup(${1:bias},${2:duty},${3:vlcd},${4:com_number},${5:fresh_rate},${6:com_mark},${7:seg_mark})", "description": "lcdseg.setup(bias, duty, vlcd, com_number, fresh_rate, com_mark, seg_mark) - \u521d\u59cb\u5316lcdseg\u5e93\n\u4f20\u5165\u503c\uff1a\nint bias\u503c,\u901a\u5e38\u4e3a 1/3 bias, \u5bf9\u5e94 lcdseg.BIAS_ONETHIRD\nint duty\u503c,\u901a\u5e38\u4e3a 1/4 duty, \u5bf9\u5e94 lcdseg.DUTY_ONEFOURTH\nint \u7535\u538b, \u5355\u4f4d100mV, \u4f8b\u59822.7v\u519927. air103\u652f\u6301\u7684\u503c\u6709 27/29/31/33\nint COM\u811a\u7684\u6570\u91cf, \u53d6\u51b3\u4e8e\u5177\u4f53\u6a21\u5757, air103\u652f\u63011-4\nint \u5237\u65b0\u7387,\u901a\u5e38\u4e3a60, \u5bf9\u5e9460HZ\nint COM\u542f\u7528\u4e0e\u5426\u7684\u63a9\u7801, \u9ed8\u8ba4\u4e3a0xFF,\u5168\u90e8\u542f\u7528.\u82e5\u53ea\u542f\u7528COM0/COM1, \u52190x03\nint seg\u542f\u7528\u4e0e\u5426\u7684\u63a9\u7801, \u9ed8\u8ba4\u4e3a0xFFFFFFFF,\u5373\u5168\u90e8\u542f\u7528. \u82e5\u53ea\u542f\u7528\u524d16\u4e2a, 0xFFFF\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316lcdseg\nif lcdseg.setup(lcdseg.BIAS_ONETHIRD, lcdseg.DUTY_ONEFOURTH, 33, 4, 60) then\n lcdseg.enable(1)\n\n lcdseg.seg_set(0, 1, 1)\n lcdseg.seg_set(2, 0, 1)\n lcdseg.seg_set(3, 31, 1)\nend\n", "prefix": "lcdseg.setup"}, "lcdseg.enable": {"body": "lcdseg.enable(${1:en})", "description": "lcdseg.enable(en) - \u542f\u7528\u6216\u7981\u7528lcdseg\u5e93\n\u4f20\u5165\u503c\uff1a\nint 1\u542f\u7528,0\u7981\u7528\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\n", "prefix": "lcdseg.enable"}, "lcdseg.power": {"body": "lcdseg.power(${1:en})", "description": "lcdseg.power(en) - \u542f\u7528\u6216\u7981\u7528lcdseg\u7684\u8f93\u51fa\n\u4f20\u5165\u503c\uff1a\nint 1\u542f\u7528,0\u7981\u7528\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\n", "prefix": "lcdseg.power"}, "lcdseg.seg_set": {"body": "lcdseg.seg_set(${1:com},${2:seg},${3:en})", "description": "lcdseg.seg_set(com, seg, en) - \u8bbe\u7f6e\u5177\u4f53\u4e00\u4e2a\u6bb5\u7801\u7684\u72b6\u6001\n\u4f20\u5165\u503c\uff1a\nint COM\u53f7\nint seg\u53f7 \u8981\u66f4\u6539\u7684\u5b57\u6bb5\u7684\u4f4d\u7d22\u5f15\nint 1\u542f\u7528,0\u7981\u7528\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\n", "prefix": "lcdseg.seg_set"}, "libcoap.new": {"body": "libcoap.new(${1:code},${2:uri},${3:headers},${4:payload})", "description": "libcoap.new(code, uri, headers, payload) - \u521b\u5efa\u4e00\u4e2acoap\u6570\u636e\u5305\n\u4f20\u5165\u503c\uff1a\nint coap\u7684code, \u4f8b\u5982libcoap.GET/libcoap.POST/libcoap.PUT/libcoap.DELETE\nstring \u76ee\u6807URI,\u5fc5\u987b\u586b\u5199, \u4e0d\u9700\u8981\u52a0\u4e0a/\u5f00\u5934\ntable \u8bf7\u6c42\u5934,\u7c7b\u4f3c\u4e8ehttp\u7684headers,\u53ef\u9009\nstring \u8bf7\u6c42\u4f53,\u7c7b\u4f3c\u4e8ehttp\u7684body,\u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nuserdata coap\u6570\u636e\u5305\n\u4f8b\u5b50\uff1a\n-- \u521b\u5efa\u4e00\u4e2a\u8bf7\u6c42\u670d\u52a1\u5668time\u7684\u6570\u636e\u5305\nlocal coapdata = libcoap.new(libcoap.GET, \"time\")\nlocal data = coapdata:rawdata()\n", "prefix": "libcoap.new"}, "libcoap.parse": {"body": "libcoap.parse(${1:str})", "description": "libcoap.parse(str) - \u89e3\u6790coap\u6570\u636e\u5305\n\u4f20\u5165\u503c\uff1a\nstring coap\u6570\u636e\u5305\n\u8fd4\u56de\u503c\uff1a\nuserdata coap\u6570\u636e\u5305,\u5982\u679c\u89e3\u6790\u5931\u8d25\u4f1a\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u89e3\u6790\u670d\u52a1\u5668\u4f20\u5165\u7684\u6570\u636e\u5305\nlocal coapdata = libcoap.parse(indata)\nlog.info(\"coapdata\", coapdata:hcode(), coapdata:data())\n", "prefix": "libcoap.parse"}, "coapdata:msgid": {"body": "coapdata:msgid()", "description": "coapdata:msgid() - \u83b7\u53d6coap\u6570\u636e\u5305\u7684msgid\n\u8fd4\u56de\u503c\uff1a\nint coap\u6570\u636e\u5305\u7684msgid\n\u4f8b\u5b50\uff1a\n-- \u89e3\u6790\u670d\u52a1\u5668\u4f20\u5165\u7684\u6570\u636e\u5305\nlocal coapdata = libcoap.parse(indata)\nlog.info(\"coapdata\", coapdata:msgid())\n", "prefix": "coapdata:msgid"}, "coapdata:token": {"body": "coapdata:token()", "description": "coapdata:token() - \u83b7\u53d6coap\u6570\u636e\u5305\u7684token\n\u8fd4\u56de\u503c\uff1a\nstring coap\u6570\u636e\u5305\u7684token\n\u4f8b\u5b50\uff1a\n-- \u89e3\u6790\u670d\u52a1\u5668\u4f20\u5165\u7684\u6570\u636e\u5305\nlocal coapdata = libcoap.parse(indata)\nlog.info(\"coapdata\", coapdata:token())\n", "prefix": "coapdata:token"}, "coapdata:rawdata": {"body": "coapdata:rawdata()", "description": "coapdata:rawdata() - \u83b7\u53d6coap\u6570\u636e\u5305\u7684\u4e8c\u8fdb\u5236\u6570\u636e,\u7528\u4e8e\u53d1\u9001\u5230\u670d\u52a1\u5668\n\u8fd4\u56de\u503c\uff1a\nstring coap\u6570\u636e\u5305\u7684\u4e8c\u8fdb\u5236\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u89e3\u6790\u670d\u52a1\u5668\u4f20\u5165\u7684\u6570\u636e\u5305\nlocal coapdata = libcoap.new(libcoap.GET, \"time\")\nnetc:send(coapdata:rawdata())\n", "prefix": "coapdata:rawdata"}, "coapdata:code": {"body": "coapdata:code()", "description": "coapdata:code() - \u83b7\u53d6coap\u6570\u636e\u5305\u7684code\n\u8fd4\u56de\u503c\uff1a\nint coap\u6570\u636e\u5305\u7684code\n\u4f8b\u5b50\uff1a\n-- \u89e3\u6790\u670d\u52a1\u5668\u4f20\u5165\u7684\u6570\u636e\u5305\nlocal coapdata = libcoap.parse(indata)\nlog.info(\"coapdata\", coapdata:code())\n", "prefix": "coapdata:code"}, "coapdata:hcode": {"body": "coapdata:hcode()", "description": "coapdata:hcode() - \u83b7\u53d6coap\u6570\u636e\u5305\u7684http code, \u6bd4coap\u539f\u59cb\u7684code\u8981\u53cb\u597d\n\u8fd4\u56de\u503c\uff1a\nint coap\u6570\u636e\u5305\u7684http code,\u4f8b\u5982200,205,404\n\u4f8b\u5b50\uff1a\n-- \u89e3\u6790\u670d\u52a1\u5668\u4f20\u5165\u7684\u6570\u636e\u5305\nlocal coapdata = libcoap.parse(indata)\nlog.info(\"coapdata\", coapdata:hcode())\n", "prefix": "coapdata:hcode"}, "coapdata:type": {"body": "coapdata:type(${1:t})", "description": "coapdata:type(t) - \u83b7\u53d6coap\u6570\u636e\u5305\u7684type, \u4f8b\u5982libcoap.CON/NON/ACK/RST\n\u4f20\u5165\u503c\uff1a\nint \u65b0\u7684type\u503c,\u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nint coap\u6570\u636e\u5305\u7684type\n\u4f8b\u5b50\uff1a\n-- \u89e3\u6790\u670d\u52a1\u5668\u4f20\u5165\u7684\u6570\u636e\u5305\nlocal coapdata = libcoap.parse(indata)\nlog.info(\"coapdata\", coapdata:type())\n", "prefix": "coapdata:type"}, "coapdata:data": {"body": "coapdata:data()", "description": "coapdata:data() - \u83b7\u53d6coap\u6570\u636e\u5305\u7684data\n\u8fd4\u56de\u503c\uff1a\nstring coap\u6570\u636e\u5305\u7684data\n\u4f8b\u5b50\uff1a\n-- \u89e3\u6790\u670d\u52a1\u5668\u4f20\u5165\u7684\u6570\u636e\u5305\nlocal coapdata = libcoap.parse(indata)\nlog.info(\"coapdata\", coapdata:data())\n", "prefix": "coapdata:data"}, "libgnss.parse": {"body": "libgnss.parse(${1:str})", "description": "libgnss.parse(str) - \u5904\u7406nmea\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring \u539f\u59cbnmea\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u89e3\u6790nmea\u6570\u636e\nlibgnss.parse(indata)\nlog.info(\"nmea\", json.encode(libgnss.getRmc(), \"11g\"))\n", "prefix": "libgnss.parse"}, "libgnss.isFix": {"body": "libgnss.isFix()", "description": "libgnss.isFix() - \u5f53\u524d\u662f\u5426\u5df2\u7ecf\u5b9a\u4f4d\u6210\u529f\n\u8fd4\u56de\u503c\uff1a\nboolean \u5b9a\u4f4d\u6210\u529f\u4e0e\u5426\n\u4f8b\u5b50\uff1a\nlog.info(\"nmea\", \"isFix\", libgnss.isFix())\n", "prefix": "libgnss.isFix"}, "libgnss.getIntLocation": {"body": "libgnss.getIntLocation(${1:speed_type})", "description": "libgnss.getIntLocation(speed_type) - \u83b7\u53d6\u4f4d\u7f6e\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nint \u901f\u5ea6\u5355\u4f4d,\u9ed8\u8ba4\u662fm/h\n\u8fd4\u56de\u503c\uff1a\nint lat\u6570\u636e, \u683c\u5f0f\u4e3a ddddddddd\nint lng\u6570\u636e, \u683c\u5f0f\u4e3a ddddddddd\nint speed\u6570\u636e, \u5355\u4f4d\u7c73. \u4e8e2023.9.26\u4fee\u6b63\n\u4f8b\u5b50\uff1a\n-- \u5efa\u8bae\u7528libgnss.getRmc(1)\nlog.info(\"nmea\", \"loc\", libgnss.getIntLocation())\n\n-- 2023.12.11 \u65b0\u589espeed_type\u53c2\u6570\n--[[\n\u901f\u5ea6\u5355\u4f4d\u53ef\u9009\u503c\n0 - m/h \u7c73/\u5c0f\u65f6, \u9ed8\u8ba4\u503c, \u6574\u578b\n1 - m/s \u7c73/\u79d2, \u6d6e\u70b9\u6570\n2 - km/h \u5343\u7c73/\u5c0f\u65f6, \u6d6e\u70b9\u6570\n3 - kn/h \u82f1\u91cc/\u5c0f\u65f6, \u6d6e\u70b9\u6570\n]]\n-- \u9ed8\u8ba4 \u7c73/\u5c0f\u65f6\nlog.info(\"nmea\", \"loc\", libgnss.getIntLocation())\n-- \u7c73/\u79d2\nlog.info(\"nmea\", \"loc\", libgnss.getIntLocation(1))\n-- \u5343\u7c73/\u5c0f\u65f6\nlog.info(\"nmea\", \"loc\", libgnss.getIntLocation(2))\n-- \u82f1\u91cc/\u5c0f\u65f6\nlog.info(\"nmea\", \"loc\", libgnss.getIntLocation(3))\n", "prefix": "libgnss.getIntLocation"}, "libgnss.getRmc": {"body": "libgnss.getRmc(${1:data_mode})", "description": "libgnss.getRmc(data_mode) - \u83b7\u53d6\u539f\u59cbRMC\u4f4d\u7f6e\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nint \u5750\u6807\u7c7b\u6570\u636e\u7684\u683c\u5f0f, 0-DDMM.MMM\u683c\u5f0f, 1-DDDDDDD\u683c\u5f0f, 2-DD.DDDDD\u683c\u5f0f, 3-\u539f\u59cbRMC\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\ntable \u539f\u59cbrmc\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u89e3\u6790nmea\nlog.info(\"nmea\", \"rmc\", json.encode(libgnss.getRmc(2)))\n-- \u5b9e\u4f8b\u8f93\u51fa\n--[[\n{\n \"course\":0,\n \"valid\":true, // true\u5b9a\u4f4d\u6210\u529f,false\u5b9a\u4f4d\u4e22\u5931\n \"lat\":23.4067, // \u7eac\u5ea6, \u6b63\u6570\u4e3a\u5317\u7eac, \u8d1f\u6570\u4e3a\u5357\u7eac\n \"lng\":113.231, // \u7ecf\u5ea6, \u6b63\u6570\u4e3a\u4e1c\u7ecf, \u8d1f\u6570\u4e3a\u897f\u7ecf\n \"variation\":0, // \u5730\u9762\u822a\u5411\uff0c\u5355\u4f4d\u4e3a\u5ea6\uff0c\u4ece\u5317\u5411\u8d77\u987a\u65f6\u9488\u8ba1\u7b97\n \"speed\":0 // \u5730\u9762\u901f\u5ea6, \u5355\u4f4d\u4e3a\"\u8282\"\n \"year\":2023, // \u5e74\u4efd\n \"month\":1, // \u6708\u4efd, 1-12\n \"day\":5, // \u6708\u4efd\u5929, 1-31\n \"hour\":7, // \u5c0f\u65f6,0-23\n \"min\":23, // \u5206\u949f,0-59\n \"sec\":20, // \u79d2,0-59\n}\n]]\n", "prefix": "libgnss.getRmc"}, "libgnss.getGsv": {"body": "libgnss.getGsv()", "description": "libgnss.getGsv() - \u83b7\u53d6\u539f\u59cbGSV\u4fe1\u606f\n\u8fd4\u56de\u503c\uff1a\ntable \u539f\u59cbGSV\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u89e3\u6790nmea\nlog.info(\"nmea\", \"gsv\", json.encode(libgnss.getGsv()))\n--[[\u5b9e\u4f8b\u8f93\u51fa\n{\n \"total_sats\":24, // \u603b\u53ef\u89c1\u536b\u661f\u6570\u91cf\n \"sats\":[\n {\n \"snr\":27, // \u4fe1\u566a\u6bd4\n \"azimuth\":278, // \u65b9\u5411\u89d2\n \"elevation\":59, // \u4ef0\u89d2\n \"tp\":0, // 0 - GPS, 1 - BD\n \"nr\":4 // \u536b\u661f\u7f16\u53f7\n },\n // \u8fd9\u91cc\u5ffd\u7565\u4e8622\u4e2a\u536b\u661f\u7684\u4fe1\u606f\n {\n \"snr\":0,\n \"azimuth\":107,\n \"elevation\":19,\n \"tp\":1,\n \"nr\":31\n }\n ]\n}\n]]\n", "prefix": "libgnss.getGsv"}, "libgnss.getGsa": {"body": "libgnss.getGsa(${1:data_mode})", "description": "libgnss.getGsa(data_mode) - \u83b7\u53d6\u539f\u59cbGSA\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nint \u6a21\u5f0f\n\u8fd4\u56de\u503c\uff1a\ntable \u539f\u59cbGSA\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u83b7\u53d6\nlog.info(\"nmea\", \"gsa\", json.encode(libgnss.getGsa(), \"11g\"))\n-- \u793a\u4f8b\u6570\u636e(\u6a21\u5f0f0, \u4e5f\u5c31\u662f\u9ed8\u8ba4\u6a21\u5f0f)\n--[[\n{\n \"sats\":[ // \u6b63\u5728\u4f7f\u7528\u7684\u536b\u661f\u7f16\u53f7\n 9,\n 6,\n 16,\n 16,\n 26,\n 21,\n 27,\n 27,\n 4,\n 36,\n 3,\n 7,\n 8,\n 194\n ],\n \"vdop\":0.03083333, // \u5782\u76f4\u7cbe\u5ea6\u56e0\u5b50\uff0c0.00 - 99.99\uff0c\u4e0d\u5b9a\u4f4d\u65f6\u503c\u4e3a 99.99\n \"pdop\":0.0455, // \u6c34\u5e73\u7cbe\u5ea6\u56e0\u5b50\uff0c0.00 - 99.99\uff0c\u4e0d\u5b9a\u4f4d\u65f6\u503c\u4e3a 99.99\n \"fix_type\":3, // \u5b9a\u4f4d\u6a21\u5f0f, 1-\u672a\u5b9a\u4f4d, 2-2D\u5b9a\u4f4d, 3-3D\u5b9a\u4f4d\n \"hdop\":0.0335 // \u4f4d\u7f6e\u7cbe\u5ea6\u56e0\u5b50\uff0c0.00 - 99.99\uff0c\u4e0d\u5b9a\u4f4d\u65f6\u503c\u4e3a 99.99\n}\n]]\n\n-- \u793a\u4f8b\u6570\u636e(\u6a21\u5f0f1), 2024.5.26\u65b0\u589e\n[\n {\"pdop\":7.8299999,\"sats\":[13,15,18,23],\"vdop\":3.2400000,\"hdop\":7.1300001,\"fix_type\":3},\n {\"pdop\":7.8299999,\"sats\":[20,35,8,13],\"vdop\":3.2400000,\"hdop\":7.1300001,\"fix_type\":3}\n]\n", "prefix": "libgnss.getGsa"}, "libgnss.getVtg": {"body": "libgnss.getVtg(${1:data_mode})", "description": "libgnss.getVtg(data_mode) - \u83b7\u53d6VTA\u901f\u5ea6\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nint \u53ef\u9009, 3-\u539f\u59cb\u5b57\u7b26\u4e32, \u4e0d\u4f20\u6216\u8005\u4f20\u5176\u4ed6\u503c, \u5219\u8fd4\u56de\u6d6e\u70b9\u503c\n\u8fd4\u56de\u503c\uff1a\ntable \u539f\u59cbVTA\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u89e3\u6790nmea\nlog.info(\"nmea\", \"vtg\", json.encode(libgnss.getVtg()))\n-- \u793a\u4f8b\n--[[\n{\n \"speed_knots\":0, // \u901f\u5ea6, \u82f1\u91cc/\u5c0f\u65f6\n \"true_track_degrees\":0, // \u771f\u5317\u65b9\u5411\u89d2\n \"magnetic_track_degrees\":0, // \u78c1\u5317\u65b9\u5411\u89d2\n \"speed_kph\":0 // \u901f\u5ea6, \u5343\u7c73/\u5c0f\u65f6\n}\n-- \u63d0\u9192: Air780EG\u548cAir510U,\u5728\u901f\u5ea6<5km/h\u65f6, \u4e0d\u4f1a\u8fd4\u56de\u65b9\u5411\u89d2\n]]\n", "prefix": "libgnss.getVtg"}, "libgnss.getZda": {"body": "libgnss.getZda()", "description": "libgnss.getZda() - \u83b7\u53d6\u539f\u59cbZDA\u65f6\u95f4\u548c\u65e5\u671f\u4fe1\u606f\n\u8fd4\u56de\u503c\uff1a\ntable \u539f\u59cbzda\u6570\u636e\n\u4f8b\u5b50\uff1a\nlog.info(\"nmea\", \"zda\", json.encode(libgnss.getZda()))\n-- \u5b9e\u4f8b\u8f93\u51fa\n--[[\n{\n \"minute_offset\":0, // \u672c\u5730\u65f6\u533a\u7684\u5206\u949f, \u4e00\u822c\u56fa\u5b9a\u8f93\u51fa0\n \"hour_offset\":0, // \u672c\u5730\u65f6\u533a\u7684\u5c0f\u65f6, \u4e00\u822c\u56fa\u5b9a\u8f93\u51fa0\n \"year\":2023 // UTC \u5e74\uff0c\u56db\u4f4d\u6570\u5b57\n \"month\":1, // UTC \u6708\uff0c\u4e24\u4f4d\uff0c01 ~ 12\n \"day\":5, // UTC \u65e5\uff0c\u4e24\u4f4d\u6570\u5b57\uff0c01 ~ 31\n \"hour\":7, // \u5c0f\u65f6\n \"min\":50, // \u5206\n \"sec\":14, // \u79d2\n}\n]]\n", "prefix": "libgnss.getZda"}, "libgnss.debug": {"body": "libgnss.debug(${1:mode})", "description": "libgnss.debug(mode) - \u8bbe\u7f6e\u8c03\u8bd5\u6a21\u5f0f\n\u4f20\u5165\u503c\uff1a\nbool true\u5f00\u542f\u8c03\u8bd5,false\u5173\u95ed\u8c03\u8bd5,\u9ed8\u8ba4\u4e3afalse\n\u4f8b\u5b50\uff1a\n-- \u5f00\u542f\u8c03\u8bd5, \u4f1a\u8f93\u51faGNSS\u539f\u59cb\u6570\u636e\u5230\u65e5\u5fd7\u4e2d\nlibgnss.debug(true)\n-- \u5173\u95ed\u8c03\u8bd5\nlibgnss.debug(false)\n", "prefix": "libgnss.debug"}, "libgnss.getGga": {"body": "libgnss.getGga(${1:data_mode})", "description": "libgnss.getGga(data_mode) - \u83b7\u53d6GGA\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u5750\u6807\u7c7b\u6570\u636e\u7684\u683c\u5f0f, 0-DDMM.MMM\u683c\u5f0f, 1-DDDDDDD\u683c\u5f0f, 2-DD.DDDDD\u683c\u5f0f, 3-\u539f\u59cb\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\ntable GGA\u6570\u636e, \u82e5\u5982\u4e0d\u5b58\u5728\u4f1a\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nlocal gga = libgnss.getGga(2)\nif gga then\n log.info(\"GGA\", json.encode(gga, \"11g\"))\nend\n--\u5b9e\u4f8b\u8f93\u51fa\n--[[\n{\n \"dgps_age\":0, // \u5dee\u5206\u6821\u6b63\u65f6\u5ef6\uff0c\u5355\u4f4d\u4e3a\u79d2\n \"fix_quality\":1, // \u5b9a\u4f4d\u72b6\u6001\u6807\u8bc6 0 - \u65e0\u6548,1 - \u5355\u70b9\u5b9a\u4f4d,2 - \u5dee\u5206\u5b9a\u4f4d\n \"satellites_tracked\":14, // \u53c2\u4e0e\u5b9a\u4f4d\u7684\u536b\u661f\u6570\u91cf\n \"altitude\":0.255, // \u6d77\u5e73\u9762\u5206\u79bb\u5ea6, \u6216\u8005\u6210\u4e3a\u6d77\u62d4, \u5355\u4f4d\u662f\u7c73,\n \"hdop\":0.0335, // \u6c34\u5e73\u7cbe\u5ea6\u56e0\u5b50\uff0c0.00 - 99.99\uff0c\u4e0d\u5b9a\u4f4d\u65f6\u503c\u4e3a 99.99\n \"longitude\":113.231, // \u7ecf\u5ea6, \u6b63\u6570\u4e3a\u4e1c\u7ecf, \u8d1f\u6570\u4e3a\u897f\u7ecf\n \"latitude\":23.4067, // \u7eac\u5ea6, \u6b63\u6570\u4e3a\u5317\u7eac, \u8d1f\u6570\u4e3a\u5357\u7eac\n \"height\":0 // \u692d\u7403\u9ad8\uff0c\u56fa\u5b9a\u8f93\u51fa 1 \u4f4d\u5c0f\u6570\n}\n]]\n", "prefix": "libgnss.getGga"}, "libgnss.getGll": {"body": "libgnss.getGll(${1:data_mode})", "description": "libgnss.getGll(data_mode) - \u83b7\u53d6GLL\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u5750\u6807\u7c7b\u6570\u636e\u7684\u683c\u5f0f, 0-DDMM.MMM\u683c\u5f0f, 1-DDDDDDD\u683c\u5f0f, 2-DD.DDDDD\u683c\u5f0f\n\u8fd4\u56de\u503c\uff1a\ntable GLL\u6570\u636e, \u82e5\u5982\u4e0d\u5b58\u5728\u4f1a\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nlocal gll = libgnss.getGll(2)\nif gll then\n log.info(\"GLL\", json.encode(gll, \"11g\"))\nend\n-- \u5b9e\u4f8b\u6570\u636e\n--[[\n{\n \"status\":\"A\", // \u5b9a\u4f4d\u72b6\u6001, A\u6709\u6548, B\u65e0\u6548\n \"mode\":\"A\", // \u5b9a\u4f4d\u6a21\u5f0f, V\u65e0\u6548, A\u5355\u70b9\u89e3, D\u5dee\u5206\u89e3\n \"sec\":20, // \u79d2, UTC\u65f6\u95f4\u4e3a\u51c6\n \"min\":23, // \u5206\u949f, UTC\u65f6\u95f4\u4e3a\u51c6\n \"hour\":7, // \u5c0f\u65f6, UTC\u65f6\u95f4\u4e3a\u51c6\n \"longitude\":113.231, // \u7ecf\u5ea6, \u6b63\u6570\u4e3a\u4e1c\u7ecf, \u8d1f\u6570\u4e3a\u897f\u7ecf\n \"latitude\":23.4067, // \u7eac\u5ea6, \u6b63\u6570\u4e3a\u5317\u7eac, \u8d1f\u6570\u4e3a\u5357\u7eac\n \"us\":0 // \u5fae\u5999\u6570, \u901a\u5e38\u4e3a0\n}\n]]\n", "prefix": "libgnss.getGll"}, "libgnss.clear": {"body": "libgnss.clear()", "description": "libgnss.clear() - \u6e05\u9664\u5386\u53f2\u5b9a\u4f4d\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u8be5\u64cd\u4f5c\u4f1a\u6e05\u9664\u6240\u6709\u5b9a\u4f4d\u6570\u636e\n", "prefix": "libgnss.clear"}, "libgnss.bind": {"body": "libgnss.bind(${1:id},${2:next_id})", "description": "libgnss.bind(id, next_id) - \u7ed1\u5b9auart\u7aef\u53e3\u8fdb\u884cGNSS\u6570\u636e\u8bfb\u53d6\n\u4f20\u5165\u503c\uff1a\nint uart\u7aef\u53e3\u53f7\nint \u8f6c\u53d1\u5230uart\u7684id, \u4f8b\u5982\u865a\u62dfuart.VUART_0\n\u4f8b\u5b50\uff1a\n-- \u914d\u7f6e\u4e32\u53e3\u4fe1\u606f, \u901a\u5e38\u4e3a 115200 8N1\nuart.setup(2, 115200)\n-- \u7ed1\u5b9auart, \u9a6c\u4e0a\u5f00\u59cb\u89e3\u6790GNSS\u6570\u636e\nlibgnss.bind(2)\n-- \u65e0\u9700\u518d\u8c03\u7528uart.on\u7136\u540e\u8c03\u7528libgnss.parse\n-- \u5f00\u53d1\u671f\u53ef\u6253\u5f00\u8c03\u8bd5\u65e5\u5fd7\nlibgnss.debug(true)\n\n-- 2023-01-02\u4e4b\u540e\u7f16\u8bd1\u7684\u56fa\u4ef6\u6709\u6548\n-- \u4eceuart2\u8bfb\u53d6\u5e76\u89e3\u6790, \u540c\u65f6\u8f6c\u53d1\u5230\u865a\u62df\u4e32\u53e30\nlibgnss.bind(2, uart.VUART_0)\n", "prefix": "libgnss.bind"}, "libgnss.locStr": {"body": "libgnss.locStr(${1:mode})", "description": "libgnss.locStr(mode) - \u83b7\u53d6\u4f4d\u7f6e\u5b57\u7b26\u4e32\n\u4f20\u5165\u503c\uff1a\nint \u5b57\u7b26\u4e32\u6a21\u5f0f. 0- Air780EG\u6240\u9700\u7684\u683c\u5f0f\nreturn \u6307\u5b9a\u6a21\u5f0f\u7684\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u4ec5\u63a8\u8350\u5728\u5b9a\u4f4d\u6210\u529f\u540e\u8c03\u7528\n", "prefix": "libgnss.locStr"}, "libgnss.rtcAuto": {"body": "libgnss.rtcAuto(${1:enable})", "description": "libgnss.rtcAuto(enable) - \u5b9a\u4f4d\u6210\u529f\u540e\u81ea\u52a8\u8bbe\u7f6eRTC\n\u4f20\u5165\u503c\uff1a\nbool \u5f00\u542f\u4e0e\u5426, \u9ed8\u8ba4\u662ffalse\u5173\u95ed\n\u4f8b\u5b50\uff1a\n-- \u5f00\u542f\u81ea\u52a8\u8bbe\u7f6eRTC\nlibgnss.rtcAuto(true)\n", "prefix": "libgnss.rtcAuto"}, "libgnss.on": {"body": "libgnss.on(${1:tp},${2:fn})", "description": "libgnss.on(tp, fn) - \u5e95\u5c42\u4e8b\u4ef6\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nstring \u4e8b\u4ef6\u7c7b\u578b,\u5f53\u524d\u652f\u6301\"raw\"\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u4e00\u822c\u7528\u4e8e\u8c03\u8bd5, \u7528\u4e8e\u83b7\u53d6\u5e95\u5c42\u5b9e\u9645\u6536\u5230\u7684\u6570\u636e\nlibgnss.on(\"raw\", function(data)\n log.info(\"GNSS\", data)\nend)\n", "prefix": "libgnss.on"}, "libgnss.getTxt": {"body": "libgnss.getTxt()", "description": "libgnss.getTxt() - \u83b7\u53d6\u975e\u6807\u7684GPTXT\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nreturn GPTXT\u6240\u643a\u5e26\u7684\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u4e8e2023.6.6 \u6dfb\u52a0\nlog.info(\"gnss\", \"txt\", libgnss.getTxt())\n\n-- \u6d4b\u8bd5\u8bed\u53e5\nlibgnss.parse(\"$GPTXT,01,01,01,ANTENNA SHORT*63\\r\\n\")\nlog.info(\"GNSS\", libgnss.getTxt())\nlibgnss.parse(\"$GPTXT,01,01,01,ANTENNA OPEN*25\\r\\n\")\nlog.info(\"GNSS\", libgnss.getTxt())\nlibgnss.parse(\"$GPTXT,01,01,01,ANTENNA OK*35\\r\\n\")\nlog.info(\"GNSS\", libgnss.getTxt())\n", "prefix": "libgnss.getTxt"}, "libgnss.casic_aid": {"body": "libgnss.casic_aid(${1:dt},${2:loc})", "description": "libgnss.casic_aid(dt, loc) - \u5408\u6210Air530Z\u6240\u9700\u8981\u7684\u8f85\u52a9\u5b9a\u4f4d\u6570\u636e\n\u4f20\u5165\u503c\uff1a\ntable \u65f6\u95f4\u4fe1\u606f\ntable \u7ecf\u7eac\u5ea6\u53ca\u6d77\u62d4\n\u8fd4\u56de\u503c\uff1a\nstring \u8f85\u52a9\u5b9a\u4f4d\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u9002\u5408CASIC\u7cfb\u5217GNSS\u6a21\u5757\u7684\u8f85\u52a9\u5b9a\u4f4d\u4fe1\u606f\u7684\u5408\u6210\n-- \u672c\u51fd\u6570 2023.11.14 \u65b0\u589e\n\n-- \u9996\u5148\u662f\u65f6\u95f4\u4fe1\u606f,\u6ce8\u610f\u662fUTC\u65f6\u95f4\n-- \u65f6\u95f4\u6765\u6e90\u5f88\u591a, \u4e00\u822c\u5efa\u8baesocket.sntp()\u65f6\u95f4\u540c\u6b65\u540e\u7684\u7cfb\u7edf\u65f6\u95f4\nlocal dt = os.date(\"!*t\")\n\n-- \u7136\u540e\u662f\u8f85\u52a9\u5b9a\u4f4d\u5750\u6807\n-- \u6765\u6e90\u6709\u5f88\u591a\u65b9\u5f0f:\n-- 1. \u4ece\u5386\u53f2\u5b9a\u4f4d\u6570\u636e\u5f97\u5230, \u4f8b\u5982\u4e4b\u524d\u5b9a\u4f4d\u6210\u529f\u540e\u4fdd\u5b58\u5230\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e86\n-- 2. \u901a\u8fc7\u57fa\u7ad9\u5b9a\u4f4d\u6216\u8005wifi\u5b9a\u4f4d\u83b7\u53d6\u5230\n-- 3. \u901a\u8fc7IP\u5b9a\u4f4d\u83b7\u53d6\u5230\u5927\u6982\u5750\u6807\n-- \u5750\u6807\u7cfb\u662fWGS84, \u4f46\u9274\u4e8e\u662f\u8f85\u52a9\u5b9a\u4f4d,\u7cbe\u5ea6\u4e0d\u662f\u5173\u952e\u56e0\u7d20\nlocal lla = {\n lat = 23.12,\n lng = 114.12\n}\n\nlocal aid = libgnss.casic_aid(dt, lla)\n", "prefix": "libgnss.casic_aid"}, "lf.init": {"body": "lf.init(${1:spi_device})", "description": "lf.init(spi_device) - \u521d\u59cb\u5316 little_flash\n\u4f20\u5165\u503c\uff1a\nint userdata spi_device\n\u8fd4\u56de\u503c\uff1a\nuserdata \u6210\u529f\u8fd4\u56de\u4e00\u4e2a\u6570\u636e\u7ed3\u6784,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n--spi_device\nspi_device = spi.deviceSetup(0,17,0,0,8,2000000,spi.MSB,1,0)\nlog.info(\"lf.init\",lf.init(spi_device))\n", "prefix": "lf.init"}, "lf.mount": {"body": "lf.mount(${1:flash},${2:mount_point},${3:offset},${4:maxsize})", "description": "lf.mount(flash, mount_point, offset, maxsize) - \u6302\u8f7d little_flash lfs\u6587\u4ef6\u7cfb\u7edf\n\u4f20\u5165\u503c\uff1a\nuserdata flash Flash \u8bbe\u5907\u5bf9\u8c61 lf.init()\u8fd4\u56de\u7684\u6570\u636e\u7ed3\u6784\nstring mount_point \u6302\u8f7d\u76ee\u5f55\u540d\nint \u8d77\u59cb\u504f\u79fb\u91cf,\u9ed8\u8ba40\nint \u603b\u5927\u5c0f, \u9ed8\u8ba4\u662f\u6574\u4e2aflash\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue\n\u4f8b\u5b50\uff1a\nlog.info(\"lf.mount\",lf.mount(little_flash_device,\"/little_flash\"))\n", "prefix": "lf.mount"}, "log.setLevel": {"body": "log.setLevel(${1:level})", "description": "log.setLevel(level) - \u8bbe\u7f6e\u65e5\u5fd7\u7ea7\u522b\n\u4f20\u5165\u503c\uff1a\nstring level \u65e5\u5fd7\u7ea7\u522b,\u53ef\u7528\u5b57\u7b26\u4e32\u6216\u6570\u503c, \u5b57\u7b26\u4e32\u4e3a(SILENT,DEBUG,INFO,WARN,ERROR,FATAL), \u6570\u503c\u4e3a(0,1,2,3,4,5)\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u8bbe\u7f6e\u65e5\u5fd7\u7ea7\u522b\u4e3aINFO\nlog.setLevel(\"INFO\")\n", "prefix": "log.setLevel"}, "log.style": {"body": "log.style(${1:val})", "description": "log.style(val) - \u8bbe\u7f6e\u65e5\u5fd7\u98ce\u683c\n\u4f20\u5165\u503c\uff1a\nint \u65e5\u5fd7\u98ce\u683c,\u9ed8\u8ba4\u4e3a0, \u4e0d\u4f20\u5c31\u662f\u83b7\u53d6\u5f53\u524d\u503c\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524d\u7684\u65e5\u5fd7\u98ce\u683c\n\u4f8b\u5b50\uff1a\n-- \u4ee5 log.info(\"ABC\", \"DEF\", 123) \u4e3a\u4f8b, \u5047\u8bbe\u8be5\u4ee3\u7801\u4f4d\u4e8emain.lua\u768412\u884c\n-- \u9ed8\u8ba4\u65e5\u5fd70\n-- I/user.ABC DEF 123\n-- \u8c03\u8bd5\u98ce\u683c1, \u6dfb\u52a0\u989d\u5916\u7684\u8c03\u8bd5\u4fe1\u606f\n-- I/main.lua:12 ABC DEF 123\n-- \u8c03\u8bd5\u98ce\u683c2, \u6dfb\u52a0\u989d\u5916\u7684\u8c03\u8bd5\u4fe1\u606f, \u4f4d\u7f6e\u6709\u6240\u533a\u522b\n-- I/user.ABC main.lua:12 DEF 123\n\nlog.style(0) -- \u9ed8\u8ba4\u98ce\u683c0\nlog.style(1) -- \u8c03\u8bd5\u98ce\u683c1\nlog.style(2) -- \u8c03\u8bd5\u98ce\u683c2\n", "prefix": "log.style"}, "log.getLevel": {"body": "log.getLevel()", "description": "log.getLevel() - \u83b7\u53d6\u65e5\u5fd7\u7ea7\u522b\n\u8fd4\u56de\u503c\uff1a\nint \u65e5\u5fd7\u7ea7\u522b\u5bf9\u5e940,1,2,3,4,5\n\u4f8b\u5b50\uff1a\n-- \u5f97\u5230\u65e5\u5fd7\u7ea7\u522b\nlog.getLevel()\n", "prefix": "log.getLevel"}, "log.debug": {"body": "log.debug(${1:tag},${2:val},${3:val2},${4:val3},${5:...})", "description": "log.debug(tag, val, val2, val3, ...) - \u8f93\u51fa\u65e5\u5fd7,\u7ea7\u522bdebug\n\u4f20\u5165\u503c\uff1a\nstring tag \u65e5\u5fd7\u6807\u8bc6,\u5fc5\u987b\u662f\u5b57\u7b26\u4e32\n... \u9700\u6253\u5370\u7684\u53c2\u6570\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u65e5\u5fd7\u8f93\u51fa D/onenet connect ok\nlog.debug(\"onenet\", \"connect ok\")\n", "prefix": "log.debug"}, "log.info": {"body": "log.info(${1:tag},${2:val},${3:val2},${4:val3},${5:...})", "description": "log.info(tag, val, val2, val3, ...) - \u8f93\u51fa\u65e5\u5fd7,\u7ea7\u522binfo\n\u4f20\u5165\u503c\uff1a\nstring tag \u65e5\u5fd7\u6807\u8bc6,\u5fc5\u987b\u662f\u5b57\u7b26\u4e32\n... \u9700\u6253\u5370\u7684\u53c2\u6570\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u65e5\u5fd7\u8f93\u51fa I/onenet connect ok\nlog.info(\"onenet\", \"connect ok\")\n", "prefix": "log.info"}, "log.warn": {"body": "log.warn(${1:tag},${2:val},${3:val2},${4:val3},${5:...})", "description": "log.warn(tag, val, val2, val3, ...) - \u8f93\u51fa\u65e5\u5fd7,\u7ea7\u522bwarn\n\u4f20\u5165\u503c\uff1a\nstring tag \u65e5\u5fd7\u6807\u8bc6,\u5fc5\u987b\u662f\u5b57\u7b26\u4e32\n... \u9700\u6253\u5370\u7684\u53c2\u6570\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u65e5\u5fd7\u8f93\u51fa W/onenet connect ok\nlog.warn(\"onenet\", \"connect ok\")\n", "prefix": "log.warn"}, "log.error": {"body": "log.error(${1:tag},${2:val},${3:val2},${4:val3},${5:...})", "description": "log.error(tag, val, val2, val3, ...) - \u8f93\u51fa\u65e5\u5fd7,\u7ea7\u522berror\n\u4f20\u5165\u503c\uff1a\nstring tag \u65e5\u5fd7\u6807\u8bc6,\u5fc5\u987b\u662f\u5b57\u7b26\u4e32\n... \u9700\u6253\u5370\u7684\u53c2\u6570\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u65e5\u5fd7\u8f93\u51fa E/onenet connect ok\nlog.error(\"onenet\", \"connect ok\")\n", "prefix": "log.error"}, "lora.init": {"body": "lora.init(${1:ic},${2:loraconfig},${3:spiconfig})", "description": "lora.init(ic, loraconfig,spiconfig) - lora\u521d\u59cb\u5316\n\u4f20\u5165\u503c\uff1a\nstring lora \u578b\u53f7\uff0c\u5f53\u524d\u652f\u6301\uff1a
llcc68
sx1268\ntable lora\u914d\u7f6e\u53c2\u6570,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173\n\u4f8b\u5b50\uff1a\nlora.init(\"llcc68\",\n {\n id = 0, -- SPI id\n cs = pin.PB04, -- SPI \u7247\u9009\u7684GPIO\u53f7,\u5982\u679c\u6ca1\u6709pin\u5e93,\u586bGPIO\u6570\u5b57\u7f16\u53f7\u5c31\u884c\n res = pin.PB00, -- \u590d\u4f4d\u811a\u8fde\u63a5\u7684GPIO\u53f7,\u5982\u679c\u6ca1\u6709pin\u5e93,\u586bGPIO\u6570\u5b57\u7f16\u53f7\u5c31\u884c\n busy = pin.PB01, -- \u5fd9\u68c0\u6d4b\u811a\u7684GPIO\u53f7\n dio1 = pin.PB06, -- \u6570\u636e\u8f93\u5165\u4e2d\u65ad\u811a\n lora_init = true -- \u662f\u5426\u53d1\u9001\u521d\u59cb\u5316\u547d\u4ee4. \u5982\u679c\u662f\u5524\u9192\u540e\u76f4\u63a5\u8bfb\u53d6, \u5c31\u4f20false\n }\n)\n", "prefix": "lora.init"}, "lora.set_channel": {"body": "lora.set_channel(${1:freq})", "description": "lora.set_channel(freq) - \u8bbe\u7f6e\u9891\u9053\u9891\u7387\n\u4f20\u5165\u503c\uff1a\nnumber \u9891\u7387\n\u4f8b\u5b50\uff1a\nlora.set_channel(433000000)\n", "prefix": "lora.set_channel"}, "lora.set_txconfig": {"body": "lora.set_txconfig(${1:ic},${2:txconfig})", "description": "lora.set_txconfig(ic, txconfig) - lora\u914d\u7f6e\u53d1\u9001\u53c2\u6570\n\u4f20\u5165\u503c\uff1a\nstring lora \u578b\u53f7\uff0c\u5f53\u524d\u652f\u6301\uff1a
llcc68
sx1268\ntable lora\u53d1\u9001\u914d\u7f6e\u53c2\u6570,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173\n\u4f8b\u5b50\uff1a\nlora.set_txconfig(\"llcc68\",\n {\n mode=1,\n power=22,\n fdev=0,\n bandwidth=0,\n datarate=9,\n coderate=4,\n preambleLen=8,\n fixLen=false,\n crcOn=true,\n freqHopOn=0,\n hopPeriod=0,\n iqInverted=false,\n timeout=3000\n }\n)\n", "prefix": "lora.set_txconfig"}, "lora.set_rxconfig": {"body": "lora.set_rxconfig(${1:ic},${2:set_rxconfig})", "description": "lora.set_rxconfig(ic, set_rxconfig) - lora\u914d\u7f6e\u63a5\u6536\u53c2\u6570\n\u4f20\u5165\u503c\uff1a\nstring lora \u578b\u53f7\uff0c\u5f53\u524d\u652f\u6301\uff1a
llcc68
sx1268\ntable lora\u63a5\u6536\u914d\u7f6e\u53c2\u6570,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173\n\u4f8b\u5b50\uff1a\nlora.set_rxconfig(\"llcc68\",\n {\n mode=1,\n bandwidth=0,\n datarate=9,\n coderate=4,\n bandwidthAfc=0,\n preambleLen=8,\n symbTimeout=0,\n fixLen=false,\n payloadLen=0,\n crcOn=true,\n freqHopOn=0,\n hopPeriod=0,\n iqInverted=false,\n rxContinuous=false\n }\n)\n", "prefix": "lora.set_rxconfig"}, "lora.send": {"body": "lora.send(${1:data})", "description": "lora.send(data) - \u53d1\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring \u5199\u5165\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\nlora.send(\"PING\")\n", "prefix": "lora.send"}, "lora.recv": {"body": "lora.recv(${1:timeout})", "description": "lora.recv(timeout) - \u5f00\u542f\u6536\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nnumber \u8d85\u65f6\u65f6\u95f4\uff0c\u9ed8\u8ba41000 \u5355\u4f4dms\n\u4f8b\u5b50\uff1a\nsys.subscribe(\"LORA_RX_DONE\", function(data, size)\n log.info(\"LORA_RX_DONE: \", data, size)\n lora.send(\"PING\")\nend)\n-- \u8001\u7248\u672c\u6ca1\u6709recv, \u53ef\u4ee5\u6539\u6210 lora.recive\nlora.recv(1000)\n", "prefix": "lora.recv"}, "lora.mode": {"body": "lora.mode(${1:mode})", "description": "lora.mode(mode) - \u8bbe\u7f6e\u8fdb\u5165\u6a21\u5f0f(\u4f11\u7720\uff0c\u6b63\u5e38\u7b49)\n\u4f20\u5165\u503c\uff1a\nnumber \u6a21\u5f0f \u6b63\u5e38\u6a21\u5f0f:lora.STANDBY \u4f11\u7720\u6a21\u5f0f:lora.SLEEP \u9ed8\u8ba4\u4e3a\u6b63\u5e38\u6a21\u5f0f\n\u4f8b\u5b50\uff1a\nlora.mode(lora.STANDBY)\n", "prefix": "lora.mode"}, "lora2.init": {"body": "lora2.init(${1:ic},${2:loraconfig},${3:spiconfig})", "description": "lora2.init(ic, loraconfig,spiconfig) - lora\u521d\u59cb\u5316\n\u4f20\u5165\u503c\uff1a\nstring lora \u578b\u53f7\uff0c\u5f53\u524d\u652f\u6301\uff1a
llcc68
sx1268\ntable lora\u914d\u7f6e\u53c2\u6570,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173\n\u8fd4\u56de\u503c\uff1a\nuserdata \u82e5\u6210\u529f\u4f1a\u8fd4\u56delora\u5bf9\u8c61,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nspi_lora = spi.deviceSetup(spi_id,pin_cs,0,0,8,10*1000*1000,spi.MSB,1,0)\nlora_device = lora2.init(\"llcc68\",{res = pin_reset,busy = pin_busy,dio1 = pin_dio1},spi_lora)\n", "prefix": "lora2.init"}, "lora_device:set_channel": {"body": "lora_device:set_channel(${1:freq})", "description": "lora_device:set_channel(freq) - \u8bbe\u7f6e\u9891\u9053\u9891\u7387\n\u4f20\u5165\u503c\uff1a\nnumber \u9891\u7387\n\u4f8b\u5b50\uff1a\nlora_device:set_channel(433000000)\n", "prefix": "lora_device:set_channel"}, "lora_device:set_txconfig": {"body": "lora_device:set_txconfig(${1:txconfig})", "description": "lora_device:set_txconfig(txconfig) - lora\u914d\u7f6e\u53d1\u9001\u53c2\u6570\n\u4f20\u5165\u503c\uff1a\ntable lora\u53d1\u9001\u914d\u7f6e\u53c2\u6570,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173\n\u4f8b\u5b50\uff1a\nlora_device:set_txconfig(\n {\n mode=1,\n power=22,\n fdev=0,\n bandwidth=0,\n datarate=9,\n coderate=4,\n preambleLen=8,\n fixLen=false,\n crcOn=true,\n freqHopOn=0,\n hopPeriod=0,\n iqInverted=false,\n timeout=3000\n }\n)\n", "prefix": "lora_device:set_txconfig"}, "lora_device:set_rxconfig": {"body": "lora_device:set_rxconfig(${1:set_rxconfig})", "description": "lora_device:set_rxconfig(set_rxconfig) - lora\u914d\u7f6e\u63a5\u6536\u53c2\u6570\n\u4f20\u5165\u503c\uff1a\ntable lora\u63a5\u6536\u914d\u7f6e\u53c2\u6570,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173\n\u4f8b\u5b50\uff1a\nlora_device:set_rxconfig(\n {\n mode=1,\n bandwidth=0,\n datarate=9,\n coderate=4,\n bandwidthAfc=0,\n preambleLen=8,\n symbTimeout=0,\n fixLen=false,\n payloadLen=0,\n crcOn=true,\n freqHopOn=0,\n hopPeriod=0,\n iqInverted=false,\n rxContinuous=false\n }\n)\n", "prefix": "lora_device:set_rxconfig"}, "lora_device:send": {"body": "lora_device:send(${1:data})", "description": "lora_device:send(data) - \u53d1\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring \u5199\u5165\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\nlora_device:send(\"PING\")\n", "prefix": "lora_device:send"}, "lora_device:recv": {"body": "lora_device:recv(${1:timeout})", "description": "lora_device:recv(timeout) - \u5f00\u542f\u6536\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nnumber \u8d85\u65f6\u65f6\u95f4\uff0c\u9ed8\u8ba41000 \u5355\u4f4dms\n\u4f8b\u5b50\uff1a\nsys.subscribe(\"LORA_RX_DONE\", function(data, size)\n log.info(\"LORA_RX_DONE: \", data, size)\n lora_device:send(\"PING\")\nend)\nlora_device:recv(1000)\n", "prefix": "lora_device:recv"}, "lora_device:mode": {"body": "lora_device:mode(${1:mode})", "description": "lora_device:mode(mode) - \u8bbe\u7f6e\u8fdb\u5165\u6a21\u5f0f(\u4f11\u7720\uff0c\u6b63\u5e38\u7b49)\n\u4f20\u5165\u503c\uff1a\nnumber \u6a21\u5f0f \u6b63\u5e38\u6a21\u5f0f:lora.STANDBY \u4f11\u7720\u6a21\u5f0f:lora.SLEEP \u9ed8\u8ba4\u4e3a\u6b63\u5e38\u6a21\u5f0f\n\u4f8b\u5b50\uff1a\nlora_device:mode(lora.STANDBY)\n", "prefix": "lora_device:mode"}, "lora_device:on": {"body": "lora_device:on(${1:cb})", "description": "lora_device:on(cb) - \u6ce8\u518clora\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nfunction cb lora\u56de\u8c03,\u53c2\u6570\u5305\u62eclora_device, event, data, size\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlora_device:on(function(lora_device, event, data, size)\n log.info(\"lora\", \"event\", event, lora_device, data, size)\n if event == \"tx_done\" then\n lora_device:recv(1000)\n elseif event == \"rx_done\" then\n lora_device:send(\"PING\")\n elseif event == \"tx_timeout\" then\n\n elseif event == \"rx_timeout\" then\n lora_device:recv(1000)\n elseif event == \"rx_error\" then\n\n end\nend)\n--[[\nevent\u53ef\u80fd\u51fa\u73b0\u7684\u503c\u6709\n tx_done -- \u53d1\u9001\u5b8c\u6210\n rx_done -- \u63a5\u6536\u5b8c\u6210\n tx_timeout -- \u53d1\u9001\u8d85\u65f6\n rx_timeout -- \u63a5\u6536\u8d85\u65f6\n rx_error -- \u63a5\u6536\u9519\u8bef\n]]\n", "prefix": "lora_device:on"}, "lvgl.draw_mask_radius_param_t": {"body": "lvgl.draw_mask_radius_param_t()", "description": "lvgl.draw_mask_radius_param_t() - \u521b\u5efa\u4e00\u4e2alv_draw_mask_radius_param_t\n\u8fd4\u56de\u503c\uff1a\nuserdata lv_draw_mask_radius_param_t\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal radius = lvgl.draw_mask_radius_param_t()\n", "prefix": "lvgl.draw_mask_radius_param_t"}, "lvgl.draw_mask_radius_param_t_free": {"body": "lvgl.draw_mask_radius_param_t_free(${1:radius})", "description": "lvgl.draw_mask_radius_param_t_free(radius) - \u91ca\u653e\u4e00\u4e2alv_draw_mask_radius_param_t\n\u4f8b\u5b50\uff1a\nlocal lvgl.draw_mask_radius_param_t_free(radius)\n", "prefix": "lvgl.draw_mask_radius_param_t_free"}, "lvgl.draw_mask_line_param_t": {"body": "lvgl.draw_mask_line_param_t()", "description": "lvgl.draw_mask_line_param_t() - \u521b\u5efa\u4e00\u4e2alv_draw_mask_line_param_t\n\u8fd4\u56de\u503c\uff1a\nuserdata lv_draw_mask_line_param_t\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal line = lvgl.draw_mask_line_param_t()\n", "prefix": "lvgl.draw_mask_line_param_t"}, "lvgl.draw_mask_line_param_t_free": {"body": "lvgl.draw_mask_line_param_t_free(${1:line})", "description": "lvgl.draw_mask_line_param_t_free(line) - \u91ca\u653e\u4e00\u4e2alv_draw_mask_line_param_t\n\u4f8b\u5b50\uff1a\nlocal lvgl.draw_mask_line_param_t_free(line)\n", "prefix": "lvgl.draw_mask_line_param_t_free"}, "lvgl.draw_mask_fade_param_t": {"body": "lvgl.draw_mask_fade_param_t()", "description": "lvgl.draw_mask_fade_param_t() - \u521b\u5efa\u4e00\u4e2alv_draw_mask_fade_param_t\n\u8fd4\u56de\u503c\uff1a\nuserdata lv_draw_mask_fade_param_t\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal fade = lvgl.draw_mask_fade_param_t()\n", "prefix": "lvgl.draw_mask_fade_param_t"}, "lvgl.draw_mask_fade_param_t_free": {"body": "lvgl.draw_mask_fade_param_t_free(${1:fade})", "description": "lvgl.draw_mask_fade_param_t_free(fade) - \u91ca\u653e\u4e00\u4e2alv_draw_mask_fade_param_t\n\u4f8b\u5b50\uff1a\nlocal lvgl.draw_mask_fade_param_t_free(fade)\n", "prefix": "lvgl.draw_mask_fade_param_t_free"}, "lvgl.font_get": {"body": "lvgl.font_get(${1:name})", "description": "lvgl.font_get(name) - \u83b7\u53d6\u5185\u7f6e\u5b57\u4f53\n\u4f20\u5165\u503c\uff1a\nstring \u5b57\u4f53\u540d\u79f0+\u5b57\u53f7, \u4f8b\u5982 opposans_m_10\n\u8fd4\u56de\u503c\uff1a\nuserdata \u5b57\u4f53\u6307\u9488\n\u4f8b\u5b50\uff1a\n\nlocal font = lvgl.font_get(\"opposans_m_12\")\n", "prefix": "lvgl.font_get"}, "lvgl.font_load": {"body": "lvgl.font_load(${1:path/spi_device},${2:size},${3:bpp},${4:thickness},${5:cache_size},${6:sty_zh},${7:sty_en})", "description": "lvgl.font_load(path/spi_device,size,bpp,thickness,cache_size,sty_zh,sty_en) - \u4ece\u6587\u4ef6\u7cfb\u7edf\u52a0\u8f7d\u5b57\u4f53\n\u4f20\u5165\u503c\uff1a\nstring/userdata \u5b57\u4f53\u8def\u5f84/spi_device (spi_device\u4e3a\u4f7f\u7528\u5916\u7f6e\u9ad8\u901a\u77e2\u91cf\u5b57\u5e93\u82af\u7247)\nnumber size \u53ef\u9009,\u5b57\u53f7 16-192 \u9ed8\u8ba416(\u4f7f\u7528\u9ad8\u901a\u77e2\u91cf\u5b57\u5e93)\nnumber bpp \u53ef\u9009 \u6df1\u5ea6 \u9ed8\u8ba44(\u4f7f\u7528\u9ad8\u901a\u77e2\u91cf\u5b57\u5e93)\nnumber thickness \u53ef\u9009 \u7c97\u7ec6\u503c \u9ed8\u8ba4size * bpp(\u4f7f\u7528\u9ad8\u901a\u77e2\u91cf\u5b57\u5e93)\nnumber cache_size \u53ef\u9009 \u9ed8\u8ba40(\u4f7f\u7528\u9ad8\u901a\u77e2\u91cf\u5b57\u5e93)\nnumber sty_zh \u53ef\u9009 \u9009\u62e9\u5b57\u4f53 \u9ed8\u8ba41(\u4f7f\u7528\u9ad8\u901a\u77e2\u91cf\u5b57\u5e93)\nnumber sty_en \u53ef\u9009 \u9009\u62e9\u5b57\u4f53 \u9ed8\u8ba43(\u4f7f\u7528\u9ad8\u901a\u77e2\u91cf\u5b57\u5e93)\n\u8fd4\u56de\u503c\uff1a\nuserdata \u5b57\u4f53\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal font = lvgl.font_load(\"/font_32.bin\")\n--local font = lvgl.font_load(spi_device,16)(\u9ad8\u901a\u77e2\u91cf\u5b57\u5e93)\n", "prefix": "lvgl.font_load"}, "lvgl.font_free": {"body": "lvgl.font_free(${1:font})", "description": "lvgl.font_free(font) - \u91ca\u653e\u5b57\u4f53,\u614e\u7528!!!\u4ec5\u901a\u8fc7font_load\u52a0\u8f7d\u7684\u5b57\u4f53\u5141\u8bb8\u5378\u8f7d,\u901a\u8fc7font_get\u83b7\u53d6\u7684\u5b57\u4f53\u4e0d\u5141\u8bb8\u5378\u8f7d\n\u4f20\u5165\u503c\uff1a\nstring \u5b57\u4f53\u8def\u5f84\n\u8fd4\u56de\u503c\uff1a\nuserdata \u5b57\u4f53\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal font = lvgl.font_load(\"/font_32.bin\")\n-- N N N N \u64cd\u4f5c\n-- \u786e\u5b9a\u5b57\u4f53\u4e0d\u88ab\u4f7f\u7528,\u4e0d\u88ab\u5f15\u7528,\u4e14\u5185\u5b58\u7d27\u5f20\u9700\u8981\u91ca\u653e\nlvgl.font_free(font)\n", "prefix": "lvgl.font_free"}, "lvgl.obj_set_event_cb": {"body": "lvgl.obj_set_event_cb(${1:obj},${2:func})", "description": "lvgl.obj_set_event_cb(obj, func) - \u8bbe\u7f6e\u7ec4\u4ef6\u7684\u4e8b\u4ef6\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nuserdata lvgl\u7ec4\u4ef6\u6307\u9488\nfunc lua\u51fd\u6570, \u53c2\u6570\u67092\u4e2a (obj, event), \u5176\u4e2dobj\u662f\u5f53\u524d\u5bf9\u8c61, event\u662f\u4e8b\u4ef6\u7c7b\u578b, \u4e3a\u6574\u578b\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "lvgl.obj_set_event_cb"}, "lvgl.obj_set_signal_cb": {"body": "lvgl.obj_set_signal_cb(${1:obj},${2:func})", "description": "lvgl.obj_set_signal_cb(obj, func) - \u8bbe\u7f6e\u7ec4\u4ef6\u7684\u4fe1\u53f7\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nuserdata lvgl\u7ec4\u4ef6\u6307\u9488\nfunc lua\u51fd\u6570, \u53c2\u6570\u67092\u4e2a (obj, signal), \u5176\u4e2dobj\u662f\u5f53\u524d\u5bf9\u8c61, signal\u662f\u4fe1\u53f7\u7c7b\u578b, \u4e3a\u6574\u578b\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "lvgl.obj_set_signal_cb"}, "lvgl.anim_set_exec_cb": {"body": "lvgl.anim_set_exec_cb(${1:anim},${2:func})", "description": "lvgl.anim_set_exec_cb(anim, func) - \u8bbe\u7f6e\u52a8\u753b\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nuserdata \u52a8\u753b\u6307\u9488\nuserdata lvgl\u7ec4\u4ef6\u6307\u9488\nfunc lua\u51fd\u6570, \u53c2\u6570\u67092\u4e2a (obj, value), \u5176\u4e2dobj\u662f\u5f53\u524d\u5bf9\u8c61, signal\u662f\u4fe1\u53f7\u7c7b\u578b, \u4e3a\u6574\u578b\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "lvgl.anim_set_exec_cb"}, "lvgl.anim_set_ready_cb": {"body": "lvgl.anim_set_ready_cb(${1:anim},${2:func})", "description": "lvgl.anim_set_ready_cb(anim, func) - \u8bbe\u7f6e\u52a8\u753b\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nuserdata \u52a8\u753b\u6307\u9488\nuserdata lvgl\u7ec4\u4ef6\u6307\u9488\nfunc lua\u51fd\u6570, \u53c2\u6570\u67091\u4e2a (anim), \u5176\u4e2danim\u662f\u5f53\u524d\u5bf9\u8c61\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "lvgl.anim_set_ready_cb"}, "lvgl.anim_path_set_cb": {"body": "lvgl.anim_path_set_cb(${1:path},${2:func})", "description": "lvgl.anim_path_set_cb(path, func) - \u8bbe\u7f6e\u52a8\u753b\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nuserdata \u52a8\u753b\u6307\u9488\nuserdata lvgl\u7ec4\u4ef6\u6307\u9488\nfunc lua\u51fd\u6570, \u53c2\u6570\u67091\u4e2a (path), \u5176\u4e2dpath\u662f\u5f53\u524d\u5bf9\u8c61\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "lvgl.anim_path_set_cb"}, "lvgl.event_send": {"body": "lvgl.event_send(${1:obj},${2:ent})", "description": "lvgl.event_send(obj, ent) - \u53d1\u9001\u4e8b\u4ef6\u7ed9\u7ec4\u4ef6\n\u4f20\u5165\u503c\uff1a\nuserdata \u7ec4\u4ef6\u6307\u9488\nint \u4e8b\u4ef6id, \u4f8b\u5982 lvgl.EVENT_PRESSED\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue, \u5bf9\u8c61\u5df2\u88ab\u5220\u9664\u7684\u8bdd\u8fd4\u56defalse\u6216\u8005nil\nint \u5e95\u5c42\u8fd4\u56de\u503c,\u5982\u679cobj\u4e3anil\u5c31\u8fd4\u56denil\n", "prefix": "lvgl.event_send"}, "lvgl.scr_act": {"body": "lvgl.scr_act()", "description": "lvgl.scr_act() - \u83b7\u53d6\u5f53\u524d\u6d3b\u8dc3\u7684screen\u5bf9\u8c61\n\u8fd4\u56de\u503c\uff1a\n\u6307\u9488 screen\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal scr = lvgl.scr_act()\n\n", "prefix": "lvgl.scr_act"}, "lvgl.layer_top": {"body": "lvgl.layer_top()", "description": "lvgl.layer_top() - \u83b7\u53d6layer_top\n\u8fd4\u56de\u503c\uff1a\n\u6307\u9488 layer\u6307\u9488\n", "prefix": "lvgl.layer_top"}, "lvgl.layer_sys": {"body": "lvgl.layer_sys()", "description": "lvgl.layer_sys() - \u83b7\u53d6layer_sys\n\u8fd4\u56de\u503c\uff1a\n\u6307\u9488 layer\u6307\u9488\n", "prefix": "lvgl.layer_sys"}, "lvgl.scr_load": {"body": "lvgl.scr_load(${1:scr})", "description": "lvgl.scr_load(scr) - \u8f7d\u5165\u6307\u5b9a\u7684screen\n\u4f20\u5165\u503c\uff1a\nuserdata screen\u6307\u9488\n\u4f8b\u5b50\uff1a\n local scr = lvgl.obj_create(nil, nil)\n local btn = lvgl.btn_create(scr)\n lvgl.obj_align(btn, lvgl.scr_act(), lvgl.ALIGN_CENTER, 0, 0)\n local label = lvgl.label_create(btn)\n lvgl.label_set_text(label, \"LuatOS!\")\n lvgl.scr_load(scr)\n", "prefix": "lvgl.scr_load"}, "lvgl.scr_load_anim": {"body": "lvgl.scr_load_anim(${1:scr})", "description": "lvgl.scr_load_anim(scr) - \u8f7d\u5165\u6307\u5b9a\u7684screen\u5e76\u4f7f\u7528\u6307\u5b9a\u7684\u8f6c\u573a\u52a8\u753b\n\u4f20\u5165\u503c\uff1a\nuserdata screen\u6307\u9488\n\u4f8b\u5b50\uff1a\n local scr = lvgl.obj_create(nil, nil)\n local btn = lvgl.btn_create(scr)\n lvgl.obj_align(btn, lvgl.scr_act(), lvgl.ALIGN_CENTER, 0, 0)\n local label = lvgl.label_create(btn)\n lvgl.label_set_text(label, \"LuatOS!\")\n\n local scr2 = lvgl.obj_create(nil,nil)\n local btn2 = lvgl.btn_create(scr2)\n lvgl.obj_align(btn, scr2, lvgl.ALIGN_CENTER, 0, 20)\n local label2 = lvgl.label_create(btn2)\n lvgl.label_set_text(label2, \"Btn2\")\n lvgl.scr_load(scr)\n --sys.wait(1000);\n lvgl.scr_load_anim(scr2,lvgl.SCR_LOAD_ANIM_OVER_LEFT,100,100,false)\n\u539f\u51fd\u6570\uff1alv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t time, uint32_t delay, bool auto_del)\n", "prefix": "lvgl.scr_load_anim"}, "lvgl.theme_set_act": {"body": "lvgl.theme_set_act(${1:name})", "description": "lvgl.theme_set_act(name) - \u8bbe\u7f6e\u4e3b\u9898\n\u4f20\u5165\u503c\uff1a\nstring \u4e3b\u9898\u540d\u79f0,\u53ef\u9009\u503c\u6709 default/mono/empty/material_light/material_dark/material_no_transition/material_no_focus\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u9ed1\u767d\u4e3b\u9898\nlvgl.theme_set_act(\"mono\")\n-- \u7a7a\u767d\u4e3b\u9898\nlvgl.theme_set_act(\"empty\")\n", "prefix": "lvgl.theme_set_act"}, "lvgl.sleep": {"body": "lvgl.sleep(${1:enable})", "description": "lvgl.sleep(enable) - LVGL\u4f11\u7720\u63a7\u5236\uff0c\u6682\u505c/\u6062\u590d\u5237\u65b0\u5b9a\u65f6\u5668\uff0c\u76ee\u524d\u53ea\u6709105\u548cEC618\u53ef\u4ee5\u7528\n\u4f20\u5165\u503c\uff1a\nboolean true\u6682\u505c false\u6062\u590d\n\u4f8b\u5b50\uff1a\nlvgl.sleep(true) --\u6682\u505c\u5237\u65b0\uff0c\u7cfb\u7edf\u53ef\u4ee5\u4f11\u7720\nlvgl.sleep(false) --\u6062\u590d\u5237\u65b0\uff0c\u7cfb\u7edf\u4e0d\u4f11\u7720\n", "prefix": "lvgl.sleep"}, "lvgl.init": {"body": "lvgl.init(${1:w},${2:h},${3:lcd},${4:buff_size},${5:buff_mode})", "description": "lvgl.init(w, h, lcd, buff_size, buff_mode) - \u521d\u59cb\u5316LVGL\n\u4f20\u5165\u503c\uff1a\nint \u5c4f\u5e55\u5bbd,\u53ef\u9009,\u9ed8\u8ba4\u4ecelcd\u53d6\nint \u5c4f\u5e55\u9ad8,\u53ef\u9009,\u9ed8\u8ba4\u4ecelcd\u53d6\nuserdata lcd\u6307\u9488,\u53ef\u9009,lcd\u521d\u59cb\u5316\u540e\u6709\u9ed8\u8ba4\u503c,\u9884\u7559\u7684\u591a\u5c4f\u5165\u53e3\nint \u7f13\u51b2\u533a\u5927\u5c0f,\u9ed8\u8ba4\u5bbd*10, \u4e0d\u542b\u8272\u6df1.\nint \u7f13\u51b2\u6a21\u5f0f,\u9ed8\u8ba40, \u5355buff\u6a21\u5f0f, \u53ef\u90091,\u53ccbuff\u6a21\u5f0f\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n", "prefix": "lvgl.init"}, "lvgl.anim_create": {"body": "lvgl.anim_create()", "description": "lvgl.anim_create() - \u521b\u5efa\u5e76\u521d\u59cb\u5316\u4e00\u4e2aanim\n\u8fd4\u56de\u503c\uff1a\nuserdata anim\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal anim = lvgl.anim_create()\n", "prefix": "lvgl.anim_create"}, "lvgl.anim_free": {"body": "lvgl.anim_free(${1:anim})", "description": "lvgl.anim_free(anim) - \u91ca\u653e\u4e00\u4e2aanim\n\u4f8b\u5b50\uff1a\nlocal lvgl.anim_free(anim)\n", "prefix": "lvgl.anim_free"}, "lvgl.anim_path_t": {"body": "lvgl.anim_path_t()", "description": "lvgl.anim_path_t() - \u521b\u5efa\u4e00\u4e2alv_anim_path_t\n\u8fd4\u56de\u503c\uff1a\nuserdata lv_anim_path_t\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal anim_path_t = lvgl.anim_path_t()\n", "prefix": "lvgl.anim_path_t"}, "lvgl.anim_path_t_free": {"body": "lvgl.anim_path_t_free(${1:anim_path_t})", "description": "lvgl.anim_path_t_free(anim_path_t) - \u91ca\u653e\u4e00\u4e2alv_anim_path_t\n\u4f8b\u5b50\uff1a\nlocal lvgl.anim_path_t_free(anim_path_t)\n", "prefix": "lvgl.anim_path_t_free"}, "lvgl.anim_set_path_str": {"body": "lvgl.anim_set_path_str(${1:anim},${2:tp})", "description": "lvgl.anim_set_path_str(anim, tp) - \u8bbe\u7f6e\u52a8\u753b\u8def\u5f84\u65b9\u5f0f\n\u4f20\u5165\u503c\uff1a\nuserdata \u52a8\u753b\u6307\u9488\nstring \u7c7b\u578b, \u652f\u6301 linear/ease_in/ease_out/ease_in_out/overshoot/bounce/step\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "lvgl.anim_set_path_str"}, "lvgl.qrcode_create": {"body": "lvgl.qrcode_create(${1:parent},${2:size},${3:dark_color},${4:light_color})", "description": "lvgl.qrcode_create(parent, size, dark_color, light_color) - \u521b\u5efaqrcode\u7ec4\u4ef6\n\u4f20\u5165\u503c\uff1a\nuserdata \u7236\u7ec4\u4ef6\nint \u957f\u5ea6,\u56e0\u4e3aqrcode\u662f\u6b63\u65b9\u5f62\nint \u4e8c\u7ef4\u7801\u4e2d\u6570\u636e\u70b9\u7684\u989c\u8272, RGB\u989c\u8272, \u9ed8\u8ba4 0x3333ff\nint \u4e8c\u7ef4\u7801\u4e2d\u80cc\u666f\u70b9\u7684\u989c\u8272, RGB\u989c\u8272, \u9ed8\u8ba4 0xeeeeff\n\u8fd4\u56de\u503c\uff1a\nuserdata qrcode\u7ec4\u4ef6\n\u4f8b\u5b50\uff1a\n-- \u521b\u5efa\u5e76\u663e\u793aqrcode\nlocal qrcode = lvgl.qrcode_create(scr, 100)\nlvgl.qrcode_update(qrcode, \"https://luatos.com\")\nlvgl.obj_align(qrcode, lvgl.scr_act(), lvgl.ALIGN_CENTER, -100, -100)\n", "prefix": "lvgl.qrcode_create"}, "lvgl.qrcode_update": {"body": "lvgl.qrcode_update(${1:qrcode},${2:cnt})", "description": "lvgl.qrcode_update(qrcode, cnt) - \u8bbe\u7f6eqrcode\u7ec4\u4ef6\u7684\u4e8c\u7ef4\u7801\u5185\u5bb9,\u914d\u5408qrcode_create\u4f7f\u7528\n\u4f20\u5165\u503c\uff1a\nuserdata qrcode\u7ec4\u4ef6,\u7531qrcode_create\u521b\u5efa\nstring \u4e8c\u7ef4\u7801\u7684\u5185\u5bb9\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nbool \u66f4\u65b0\u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse. \u901a\u5e38\u53ea\u6709\u6570\u636e\u592a\u957f\u65e0\u6cd5\u5bb9\u7eb3\u624d\u4f1a\u8fd4\u56defalse\n", "prefix": "lvgl.qrcode_update"}, "lvgl.qrcode_delete": {"body": "lvgl.qrcode_delete(${1:qrcode})", "description": "lvgl.qrcode_delete(qrcode) - \u5220\u9664qrcode\u7ec4\u4ef6\n\u4f20\u5165\u503c\uff1a\nuserdata qrcode\u7ec4\u4ef6,\u7531qrcode_create\u521b\u5efa\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "lvgl.qrcode_delete"}, "lvgl.style_t": {"body": "lvgl.style_t()", "description": "lvgl.style_t() - \u521b\u5efa\u4e00\u4e2astyle\n\u8fd4\u56de\u503c\uff1a\nuserdata style\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal style = lvgl.style_t()\nlvgl.style_init(style)\n", "prefix": "lvgl.style_t"}, "lvgl.style_create": {"body": "lvgl.style_create()", "description": "lvgl.style_create() - \u521b\u5efa\u4e00\u4e2astyle\u5e76\u521d\u59cb\u5316\n\u8fd4\u56de\u503c\uff1a\nuserdata style\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal style = lvgl.style_create()\n", "prefix": "lvgl.style_create"}, "lvgl.style_list_create": {"body": "lvgl.style_list_create()", "description": "lvgl.style_list_create() - \u521b\u5efa\u4e00\u4e2astyle_list\n\u8fd4\u56de\u503c\uff1a\nuserdata style\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal style_list = lvgl.style_list_create()\n", "prefix": "lvgl.style_list_create"}, "lvgl.style_list_t": {"body": "lvgl.style_list_t()", "description": "lvgl.style_list_t() - \u521b\u5efa\u4e00\u4e2astyle_list\n\u8fd4\u56de\u503c\uff1a\nuserdata style\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal style = lvgl.style_list_t()\n", "prefix": "lvgl.style_list_t"}, "lvgl.style_delete": {"body": "lvgl.style_delete(${1:style})", "description": "lvgl.style_delete(style) - \u5220\u9664style,\u614e\u7528,\u901a\u5e38\u4e0d\u4f1a\u6267\u884c\u5220\u9664\u64cd\u4f5c\n\u4f20\u5165\u503c\uff1a\nuserdata style\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal style = lvgl.style_create()\n-- ...\n-- ...\n-- lvgl.style_delete(style)\n", "prefix": "lvgl.style_delete"}, "lvgl.style_list_delete": {"body": "lvgl.style_list_delete(${1:style})", "description": "lvgl.style_list_delete(style) - \u5220\u9664style_list,\u614e\u7528,\u901a\u5e38\u4e0d\u4f1a\u6267\u884c\u5220\u9664\u64cd\u4f5c\n\u4f20\u5165\u503c\uff1a\nuserdata style\u6307\u9488\n\u4f8b\u5b50\uff1a\nlocal style_list = lvgl.style_list_create()\n-- ...\n-- ...\n-- lvgl.style_list_delete(style_list)\n", "prefix": "lvgl.style_list_delete"}, "lvgl.demo_benchmark": {"body": "lvgl.demo_benchmark()", "description": "lvgl.demo_benchmark() - lvgl benchmark demo\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlvgl.init()\nlvgl.demo_benchmark()\n", "prefix": "lvgl.demo_benchmark"}, "lvgl.demo_keypad_encoder": {"body": "lvgl.demo_keypad_encoder()", "description": "lvgl.demo_keypad_encoder() - lvgl keypad_encoder demo\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlvgl.init()\nlvgl.demo_keypad_encoder()\n", "prefix": "lvgl.demo_keypad_encoder"}, "lvgl.demo_music": {"body": "lvgl.demo_music()", "description": "lvgl.demo_music() - lvgl music demo\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlvgl.init()\nlvgl.demo_music()\n", "prefix": "lvgl.demo_music"}, "lvgl.demo_printer": {"body": "lvgl.demo_printer()", "description": "lvgl.demo_printer() - lvgl printer demo\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlvgl.init()\nlvgl.demo_printer()\n", "prefix": "lvgl.demo_printer"}, "lvgl.demo_stress": {"body": "lvgl.demo_stress()", "description": "lvgl.demo_stress() - lvgl stress demo\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlvgl.init()\nlvgl.demo_stress()\n", "prefix": "lvgl.demo_stress"}, "lvgl.demo_widgets": {"body": "lvgl.demo_widgets()", "description": "lvgl.demo_widgets() - lvgl widgets demo\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlvgl.init()\nlvgl.demo_widgets()\n", "prefix": "lvgl.demo_widgets"}, "lvgl.indev_drv_register": {"body": "lvgl.indev_drv_register(${1:tp},${2:dtp})", "description": "lvgl.indev_drv_register(tp, dtp) - \u6ce8\u518c\u8f93\u5165\u8bbe\u5907\u9a71\u52a8\n\u4f20\u5165\u503c\uff1a\nstring \u8bbe\u5907\u7c7b\u578b\uff0c\u5f53\u524d\u652f\u6301\"pointer\",\u6307\u9488\u7c7b/\u89e6\u6478\u7c7b\u5747\u53ef\uff0c\"keyboard\",\u952e\u76d8\u7c7b\u578b\nstring \u8bbe\u5907\u578b\u53f7\uff0c\u5f53\u524d\u652f\u6301\"emulator\",\u6a21\u62df\u5668\u7c7b\u578b\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nlvgl.indev_drv_register(\"pointer\", \"emulator\")\n", "prefix": "lvgl.indev_drv_register"}, "lvgl.indev_point_emulator_update": {"body": "lvgl.indev_point_emulator_update(${1:x},${2:y},${3:state})", "description": "lvgl.indev_point_emulator_update(x, y, state) - \u66f4\u65b0\u6a21\u62df\u8f93\u5165\u8bbe\u5907\u7684\u5750\u6807\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint x\u5750\u6807,\u4ee5\u5de6\u4e0a\u89d2\u4e3a0,\u53f3\u4e0b\u89d2\u4e3a\u6700\u5927\u503c\nint y\u5750\u6807,\u4ee5\u5de6\u4e0a\u89d2\u4e3a0,\u53f3\u4e0b\u89d2\u4e3a\u6700\u5927\u503c\nint \u72b6\u6001, 0 \u4e3a \u91ca\u653e, 1 \u4e3a\u6309\u4e0b\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u6a21\u62df\u5728\u5c4f\u5e55\u4e0a\u7684\u70b9\u51fb,\u901a\u8fc7timeout\u6a21\u62df\u957f\u6309\u548c\u77ed\u6309\nsys.taskInit(function(x, y, timeout)\n lvgl.indev_point_emulator_update(x, y, 1)\n sys.wait(timeout)\n lvgl.indev_point_emulator_update(x, y, 0)\nend, 240, 120, 50)\n", "prefix": "lvgl.indev_point_emulator_update"}, "lvgl.indev_kb_update": {"body": "lvgl.indev_kb_update(${1:key})", "description": "lvgl.indev_kb_update(key) - \u66f4\u65b0\u952e\u76d8\u8f93\u5165\u8bbe\u5907\u7684\u6309\u952e\u503c\n\u4f20\u5165\u503c\uff1a\nint \u6309\u952e\u503c\uff0c\u9ed8\u8ba4\u4e3a0\uff0c\u6309\u952e\u62ac\u8d77\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "lvgl.indev_kb_update"}, "lvgl.gif_create": {"body": "lvgl.gif_create(${1:parent},${2:path})", "description": "lvgl.gif_create(parent, path) - \u521b\u5efagif\u7ec4\u4ef6\n\u4f20\u5165\u503c\uff1a\nuserdata \u7236\u7ec4\u4ef6,\u53ef\u4ee5\u662fnil,\u4f46\u901a\u5e38\u4e0d\u4f1a\u662fnil\nstring \u6587\u4ef6\u8def\u5f84\n\u8fd4\u56de\u503c\uff1a\nuserdata \u7ec4\u4ef6\u6307\u9488,\u82e5\u5931\u8d25\u4f1a\u8fd4\u56denil,\u5efa\u8bae\u68c0\u67e5\n\u4f8b\u5b50\uff1a\nlocal gif = lvgl.gif_create(scr, \"S/emtry.gif\")\nif gif then\n log.info(\"gif\", \"create ok\")\nend\n\n", "prefix": "lvgl.gif_create"}, "lvgl.gif_restart": {"body": "lvgl.gif_restart(${1:gif})", "description": "lvgl.gif_restart(gif) - \u91cd\u65b0\u64ad\u653egif\u7ec4\u4ef6\n\u4f20\u5165\u503c\uff1a\nuserdata gif\u7ec4\u4ef6\u652f\u6301, \u7531gif_create\u65b9\u6cd5\u8fd4\u56de\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlocal gif = lvgl.gif_create(scr, \"S/emtry.gif\")\nif gif then\n log.info(\"gif\", \"create ok\")\nend\n\n", "prefix": "lvgl.gif_restart"}, "max30102.init": {"body": "max30102.init(${1:i2c_id},${2:int})", "description": "max30102.init(i2c_id,int) - \u521d\u59cb\u5316MAX30102\u4f20\u611f\u5668\n\u4f20\u5165\u503c\uff1a\nint \u4f20\u611f\u5668\u6240\u5728\u7684i2c\u603b\u7ebfid,\u9ed8\u8ba4\u4e3a0\nint int\u5f15\u811a\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue, \u5426\u5219\u8fd4\u56denil\u6216\u8005false\n\u4f8b\u5b50\uff1a\nif max30102.init(0,pin.PC05) then\n log.info(\"max30102\", \"init ok\")\nelse\n log.info(\"max30102\", \"init fail\")\nend\n", "prefix": "max30102.init"}, "max30102.get": {"body": "max30102.get()", "description": "max30102.get() - \u83b7\u53d6\u5fc3\u7387\u8840\u6c27(\u5927\u6982\u9700\u898110s\u65f6\u95f4\u6d4b\u91cf)\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue, \u5426\u5219\u8fd4\u56denil\u6216\u8005false\nnumber \u5fc3\u7387\nnumber \u8840\u6c27\n", "prefix": "max30102.get"}, "max30102.shutdown": {"body": "max30102.shutdown()", "description": "max30102.shutdown() - \u5173\u95edmax30102\n", "prefix": "max30102.shutdown"}, "mcu.setClk": {"body": "mcu.setClk(${1:mhz})", "description": "mcu.setClk(mhz) - \u8bbe\u7f6e\u4e3b\u9891,\u5355\u4f4dMHZ\n\u4f20\u5165\u503c\uff1a\nint \u4e3b\u9891,\u6839\u636e\u8bbe\u5907\u7684\u4e0d\u540c\u6709\u4e0d\u540c\u7684\u6709\u6548\u503c,\u8bf7\u67e5\u9605\u624b\u518c\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n\n-- \u6ce8\u610f: \u5e76\u975e\u6240\u6709\u6a21\u5757\u90fd\u652f\u6301\u4e3b\u9891\u8c03\u6574,\u8bf7\u67e5\u9605\u624b\u518c\n-- Air101/Air103/Air601 \u652f\u6301\u8bbe\u7f6e\u6210 2/40/80/160/240. \u7279\u522b\u63d0\u9192, \u8bbe\u7f6e\u52302M\u540e, \u5982\u679c\u8981\u4f11\u7720, \u5fc5\u987b\u5148\u8bbe\u7f6e\u523080M\n-- ESP32\u7cfb\u5217\u652f\u6301\u8bbe\u7f6e\u6210 40/80/160/240 , \u9700\u89812024.1.1\u4e4b\u540e\u7684\u56fa\u4ef6\n-- Air780\u7cfb\u5217, Air105, \u4e0d\u652f\u6301\u8bbe\u7f6e\u4e3b\u9891\n-- Air780\u7cfb\u5217, \u8fdb\u5165\u4f11\u7720\u6a21\u5f0f\u65f6\u81ea\u52a8\u964d\u9891\u523024M\n\n-- \u8bbe\u7f6e\u523080MHZ\nmcu.setClk(80)\nsys.wait(1000)\n-- \u8bbe\u7f6e\u5230240MHZ\nmcu.setClk(240)\nsys.wait(1000)\n-- \u8bbe\u7f6e\u52302MHZ\nmcu.setClk(2)\nsys.wait(1000)\n", "prefix": "mcu.setClk"}, "mcu.getClk": {"body": "mcu.getClk()", "description": "mcu.getClk() - \u83b7\u53d6\u4e3b\u9891,\u5355\u4f4dMHZ\n\u8fd4\u56de\u503c\uff1a\nint \u82e5\u5931\u8d25\u8fd4\u56de-1,\u5426\u5219\u8fd4\u56de\u4e3b\u9891\u6570\u503c,\u82e5\u7b49\u4e8e0,\u53ef\u80fd\u5904\u4e8e32k\u6676\u632f\u7684\u7701\u7535\u6a21\u5f0f\n\u4f8b\u5b50\uff1a\nlocal mhz = mcu.getClk()\nprint(\"Boom\", mhz)\n", "prefix": "mcu.getClk"}, "mcu.unique_id": {"body": "mcu.unique_id()", "description": "mcu.unique_id() - \u83b7\u53d6\u8bbe\u5907\u552f\u4e00id. \u6ce8\u610f,\u53ef\u80fd\u5305\u542b\u4e0d\u53ef\u89c1\u5b57\u7b26,\u5982\u9700\u67e5\u770b\u5efa\u8baetoHex()\u540e\u6253\u5370\n\u8fd4\u56de\u503c\uff1a\nstring \u8bbe\u5907\u552f\u4e00id.\u82e5\u4e0d\u652f\u6301, \u4f1a\u8fd4\u56de\u7a7a\u5b57\u7b26\u4e32.\n\u4f8b\u5b50\uff1a\nlocal unique_id = mcu.unique_id()\nprint(\"unique_id\", unique_id)\n", "prefix": "mcu.unique_id"}, "mcu.ticks": {"body": "mcu.ticks()", "description": "mcu.ticks() - \u83b7\u53d6\u542f\u52a8\u540e\u7684tick\u6570,\u672c\u8eab\u662f\u65e0\u7b26\u53f7\u503c,\u8303\u56f40~0xffffffff,lua\u662f\u6709\u7b26\u53f7\u8ba1\u7b97,\u8ba1\u7b97\u65f6\u8d85\u8fc70x7fffffff\u4f1a\u53d8\u8d1f\u6570\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524dtick\u503c\n\u4f8b\u5b50\uff1a\nlocal tick = mcu.ticks()\nprint(\"ticks\", tick)\n-- \u5982\u9700\u4e0d\u4f1a\u6ea2\u51fa\u7684\u503c, \u53ef\u7528mcu.ticks32(), \u4e8e2024.5.7\u65b0\u589e\n", "prefix": "mcu.ticks"}, "mcu.hz": {"body": "mcu.hz()", "description": "mcu.hz() - \u83b7\u53d6\u6bcf\u79d2\u7684tick\u6570\u91cf\n\u8fd4\u56de\u503c\uff1a\nint \u6bcf\u79d2\u7684tick\u6570\u91cf,\u901a\u5e38\u4e3a1000\n\u4f8b\u5b50\uff1a\nlocal hz = mcu.hz()\nprint(\"mcu.hz\", hz)\n", "prefix": "mcu.hz"}, "mcu.reg32": {"body": "mcu.reg32(${1:address},${2:value},${3:mask})", "description": "mcu.reg32(address, value, mask) - \u8bfb\u5199mcu\u768432bit\u5bc4\u5b58\u5668\u6216\u8005ram,\u8c28\u614e\u4f7f\u7528\u5199\u529f\u80fd,\u8bf7\u719f\u6089mcu\u7684\u5bc4\u5b58\u5668\u4f7f\u7528\u65b9\u6cd5\u540e\u518d\u4f7f\u7528\n\u4f20\u5165\u503c\uff1a\nint \u5bc4\u5b58\u5668\u6216\u8005ram\u5730\u5740\nint \u5199\u5165\u7684\u503c,\u5982\u679c\u6ca1\u6709,\u5219\u76f4\u63a5\u8fd4\u56de\u5f53\u524d\u503c\nint \u4f4d\u63a9\u7801,\u53ef\u4ee5\u5bf9\u7279\u5b9a\u51e0\u4e2a\u4f4d\u7f6e\u7684bit\u505a\u4fee\u6539, \u9ed8\u8ba40xffffffff,\u4fee\u6539\u5168\u90e832bit\n\u8fd4\u56de\u503c\uff1a\nint \u8fd4\u56de\u5f53\u524d\u5bc4\u5b58\u7684\u503c\n\u4f8b\u5b50\uff1a\nlocal value = mcu.reg32(0x2009FFFC, 0x01, 0x01) --\u5bf90x2009FFFC\u5730\u5740\u4e0a\u7684\u503c,\u4fee\u6539bit0\u4e3a1\n", "prefix": "mcu.reg32"}, "mcu.x32": {"body": "mcu.x32(${1:value})", "description": "mcu.x32(value) - \u8f6c\u636210\u8fdb\u5236\u6570\u4e3a16\u8fdb\u5236\u5b57\u7b26\u4e32\u8f93\u51fa\n\u4f20\u5165\u503c\uff1a\nint \u9700\u8981\u8f6c\u6362\u7684\u503c\n\u8fd4\u56de\u503c\uff1a\nstring 16\u8fdb\u5236\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\nlocal value = mcu.x32(0x2009FFFC) --\u8f93\u51fa\"0x2009fffc\"\n", "prefix": "mcu.x32"}, "mcu.tick64": {"body": "mcu.tick64()", "description": "mcu.tick64() - \u83b7\u53d6\u542f\u52a8\u540e\u7684\u9ad8\u7cbe\u5ea6tick\uff0c\u5982\u679c\u652f\u6301bit64\u5e93\uff0c\u53ef\u4ee5\u76f4\u63a5\u8f93\u51fa\u8f6c\u6362\u597d\u7684bit64\u7ed3\u6784\n\u4f20\u5165\u503c\uff1a\nboolean \u662f\u5426\u8f93\u51fabit64\u7ed3\u6784,true\u662f,\u5176\u4ed6\u90fd\u662ffalse,\u7559\u7a7a\u4e5f\u662ffalse,\u7528\u4e8e\u517c\u5bb9\u65e7\u7684demo\n\u8fd4\u56de\u503c\uff1a\nstring \u5f53\u524dtick\u503c,8\u4e2a\u5b57\u8282\u7684uint64,\u5982\u679c\u652f\u630164bit\u5e93,\u540c\u65f6\u8981\u6c42\u8f93\u51fa64bit\u7ed3\u6784\u7684\u8bdd,\u4f1a\u8f93\u51fa9\u5b57\u8282\u7684string\nint 1us\u6709\u51e0\u4e2atick,0\u8868\u793a\u672a\u77e5\n\u4f8b\u5b50\uff1a\nlocal tick_str, tick_per = mcu.tick64()\nprint(\"ticks\", tick_str, tick_per)\n", "prefix": "mcu.tick64"}, "mcu.dtick64": {"body": "mcu.dtick64(${1:tick1},${2:tick2},${3:check_value})", "description": "mcu.dtick64(tick1, tick2, check_value) - \u8ba1\u7b972\u4e2a64bit tick\u7684\u5dee\u503c\n\u4f20\u5165\u503c\uff1a\nstring 64bit\u7684string\nstring 64bit\u7684string\nint \u53c2\u8003\u503c,\u53ef\u9009\u9879,\u5982\u679c\u4e3a0,\u5219\u8fd4\u56de\u7ed3\u679c\u4e2d\u7b2c\u4e00\u4e2a\u9879\u76ee\u4e3atrue\n\u8fd4\u56de\u503c\uff1a\nboolean \u4e0e\u53c2\u8003\u503c\u6bd4\u8f83,\u5982\u679c\u5927\u4e8e\u7b49\u4e8e\u4e3atrue,\u53cd\u4e4b\u4e3afalse\nint \u5dee\u503ctick1 - tick2,\u5982\u679c\u8d85\u8fc7\u4e860x7fffffff,\u7ed3\u679c\u53ef\u80fd\u662f\u9519\u7684\n\u4f8b\u5b50\uff1a\nlocal result, diff_tick = mcu.dtick64(tick1, tick2)\nprint(\"ticks\", result, diff_tick)\n", "prefix": "mcu.dtick64"}, "mcu.setXTAL": {"body": "mcu.setXTAL(${1:source_main},${2:source_32k},${3:delay})", "description": "mcu.setXTAL(source_main, source_32k, delay) - \u9009\u62e9\u65f6\u949f\u6e90,\u5f53\u524d\u4ec5air105\u652f\u6301\n\u4f20\u5165\u503c\uff1a\nboolean \u9ad8\u901f\u65f6\u949f\u662f\u5426\u4f7f\u7528\u5916\u90e8\u65f6\u949f\u6e90,\u5982\u679c\u4e3a\u7a7a\u5219\u4e0d\u6539\u53d8\nboolean \u4f4e\u901f32K\u662f\u5426\u4f7f\u7528\u5916\u90e8\u65f6\u949f\u6e90,\u5982\u679c\u4e3a\u7a7a\u5219\u4e0d\u6539\u53d8\nint PLL\u7a33\u5b9a\u65f6\u95f4,\u5728\u5207\u6362\u9ad8\u901f\u65f6\u949f\u7684\u65f6\u5019,\u6839\u636e\u786c\u4ef6\u73af\u5883,\u9700\u8981delay\u4e00\u6bb5\u65f6\u95f4\u7b49\u5f85PLL\u7a33\u5b9a,\u9ed8\u8ba4\u662f1200,\u5efa\u8bae\u4e0d\u5c0f\u4e8e1024\n\u4f8b\u5b50\uff1a\nmcu.setXTAL(true, true, 1248) --\u9ad8\u901f\u65f6\u949f\u4f7f\u7528\u5916\u90e8\u65f6\u949f,\u4f4e\u901f32K\u4f7f\u7528\u5916\u90e8\u6676\u632f, delay1248\n", "prefix": "mcu.setXTAL"}, "mcu.hardfault": {"body": "mcu.hardfault(${1:mode})", "description": "mcu.hardfault(mode) - mcu\u6b7b\u673a\u65f6\u5904\u7406\u6a21\u5f0f\uff0c\u76ee\u524d\u53ea\u6709EC618\u5e73\u53f0\u9002\u7528\n\u4f20\u5165\u503c\uff1a\nint \u5904\u7406\u6a21\u5f0f\uff0c0\u6b7b\u673a\u505c\u673a\uff0c1\u6b7b\u673a\u540e\u91cd\u542f\uff0c2\u6b7b\u673a\u540e\u5c3d\u91cf\u5c06\u9519\u8bef\u4fe1\u606f\u63d0\u4ea4\u7ed9\u5916\u90e8\u5de5\u5177\u540e\u91cd\u542f 3.\u6b7b\u673a\u65f6\u5199\u5165\u5173\u952e\u4fe1\u606f\u5230flash\u540e\u7acb\u523b\u91cd\u542f\n\u4f8b\u5b50\uff1a\nmcu.hardfault(0) --\u6b7b\u673a\u540e\u505c\u673a\uff0c\u4e00\u822c\u7528\u4e8e\u8c03\u8bd5\u72b6\u6001\nmcu.hardfault(1) --\u6b7b\u673a\u540e\u91cd\u542f\uff0c\u4e00\u822c\u7528\u4e8e\u6b63\u5f0f\u4ea7\u54c1\nmcu.hardfault(2) --\u6b7b\u673a\u540e\u5c3d\u91cf\u5c06\u9519\u8bef\u4fe1\u606f\u63d0\u4ea4\u7ed9\u5916\u90e8\u5de5\u5177\u540e\u91cd\u542f\uff0c\u4e00\u822c\u7528\u4e8e\u538b\u529b\u6d4b\u8bd5\u6216\u8005\u6b63\u5f0f\u4ea7\u54c1\n", "prefix": "mcu.hardfault"}, "mcu.iomux": {"body": "mcu.iomux(${1:type},${2:channel},${3:value})", "description": "mcu.iomux(type, channel, value) - \u5728\u5916\u8bbe\u6253\u5f00\u524d\uff0c\u5c06\u5916\u8bbeIO\u590d\u7528\u5230\u975e\u9ed8\u8ba4\u914d\u7f6e\u4e0a\uff0c\u76ee\u524d\u53ea\u652f\u6301Air780E\u7684\u90e8\u5206\u5916\u8bbe\u590d\u7528\u5230\u5176\u4ed6\u914d\u7f6e\uff0c\u8fd9\u662f\u4e00\u4e2a\u4e34\u65f6\u63a5\u53e3\uff0c\u5982\u679c\u540e\u7eed\u6709\u66f4\u5408\u9002\u7684api\uff0c\u672c\u63a5\u53e3\u5c06\u4e0d\u518d\u66f4\u65b0\n\u4f20\u5165\u503c\uff1a\nint \u5916\u8bbe\u7c7b\u578b\uff0c\u76ee\u524d\u53ea\u6709mcu.UART,mcu.I2C\nint \u603b\u7ebf\u5e8f\u53f7\uff0c0~N\uff0c\nint \u65b0\u7684\u914d\u7f6e\uff0c\u8fd9\u4e2a\u9700\u8981\u6839\u636e\u5177\u4f53\u5e73\u53f0\u51b3\u5b9a\n\u4f8b\u5b50\uff1a\nmcu.iomux(mcu.UART, 2, 1) -- Air780E\u7684UART2\u590d\u7528\u5230gpio12\u548cgpio13(Air780EG\u9ed8\u8ba4\u662f\u8fd9\u4e2a\u590d\u7528\uff0c\u4e0d\u8981\u52a8)\nmcu.iomux(mcu.UART, 2, 2) -- Air780E\u7684UART2\u590d\u7528\u5230gpio6\u548cgpio7\nmcu.iomux(mcu.I2C, 0, 1) -- Air780E\u7684I2C0\u590d\u7528\u5230gpio12\u548cgpio13\nmcu.iomux(mcu.I2C, 0, 2) -- Air780E\u7684I2C0\u590d\u7528\u5230gpio16\u548cgpio17\nmcu.iomux(mcu.I2C, 1, 1) -- Air780E\u7684I2C1\u590d\u7528\u5230gpio4\u548cgpio5\n", "prefix": "mcu.iomux"}, "mcu.altfun": {"body": "mcu.altfun(${1:type},${2:sn},${3:pad_index},${4:alt_fun},${5:is_input})", "description": "mcu.altfun(type, sn, pad_index, alt_fun, is_input) - IO\u5916\u8bbe\u529f\u80fd\u590d\u7528\u9009\u62e9\uff0c\u6ce8\u610f\u666e\u901aMCU\u662f\u4ee5GPIO\u53f7\u4e3a\u5e8f\u53f7\uff0c\u4f46\u662f\u4e13\u7528SOC\uff0c\u6bd4\u5982CAT1\u7684\uff0c\u662f\u4ee5PAD\u53f7\u4e3a\u5e8f\u53f7\u3002\u672c\u51fd\u6570\u4e0d\u662f\u6240\u6709\u5e73\u53f0\u9002\u7528\n\u4f20\u5165\u503c\uff1a\nint \u5916\u8bbe\u7c7b\u578b\uff0c\u76ee\u524d\u6709mcu.UART,mcu.I2C,mcu.SPI,mcu.PWM,mcu.GPIO,mcu.I2S,mcu.LCD,mcu.CAM\uff0c\u5177\u4f53\u9700\u8981\u770b\u5e73\u53f0\nint \u603b\u7ebf\u5e8f\u53f7\uff0c0~N\uff0c\u5982\u679c\u662fmcu.GPIO\uff0c\u5219\u662fGPIO\u53f7\u3002\u5177\u4f53\u770b\u5e73\u53f0\u7684IOMUX\u590d\u7528\u8868\nint pad\u53f7\uff0c\u5982\u679c\u7559\u7a7a\u4e0d\u5199\uff0c\u5219\u8868\u793a\u6e05\u9664\u914d\u7f6e\uff0c\u4f7f\u7528\u5e73\u53f0\u7684\u9ed8\u8ba4\u914d\u7f6e\u3002\u5177\u4f53\u770b\u5e73\u53f0\u7684IOMUX\u590d\u7528\u8868\nint \u590d\u7528\u529f\u80fd\u5e8f\u53f7\uff0c0~N\u3002\u5177\u4f53\u770b\u5e73\u53f0\u7684IOMUX\u590d\u7528\u8868\nboolean \u662f\u5426\u662f\u8f93\u5165\u529f\u80fd\uff0ctrue\u662f\uff0c\u7559\u7a7a\u662ffalse\n\u4f8b\u5b50\uff1a\n-- \u4ee5 Air780EP \u4e3a\u4f8b\n-- \u5c06GPIO46\u6620\u5c04\u5230paddr 32 alt 1\nmcu.altfun(mcu.GPIO, 46, 32, 1, 0)\n-- mcu.altfun(mcu.GPIO, 46) -- \u8fd8\u539f\u6210\u9ed8\u8ba4\u914d\u7f6e\n\n-- UART2\u590d\u7528\u5230paddr 25/26 alt 3\nmcu.altfun(mcu.UART,2, 25, 3, 1)\nmcu.altfun(mcu.UART,2, 26, 3, 0)\n", "prefix": "mcu.altfun"}, "mcu.ticks2": {"body": "mcu.ticks2(${1:mode})", "description": "mcu.ticks2(mode) - \u83b7\u53d6\u9ad8\u7cbe\u5ea6\u7684\u8ba1\u6570\n\u4f20\u5165\u503c\uff1a\nint \u6a21\u5f0f, \u770b\u540e\u9762\u7684\u7528\u6cd5\u8bf4\u660e\n\u8fd4\u56de\u503c\uff1a\nint \u6839\u636emode\u7684\u4e0d\u540c,\u8fd4\u56de\u503c\u7684\u542b\u4e49\u4e0d\u540c\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u4e8e2024.5.7\u65b0\u589e\n-- \u4e0emcu.ticks()\u7684\u533a\u522b\u662f,\u5e95\u5c42\u8ba1\u6570\u5668\u662f64bit\u7684, \u5728\u53ef\u9884\u8ba1\u7684\u5c06\u6765\u4e0d\u4f1a\u6ea2\u51fa\n-- \u6240\u4ee5\u672c\u51fd\u6570\u8fd4\u56de\u7684\u503c\u603b\u662f\u9012\u589e\u7684, \u800c\u4e1432bit\u56fa\u4ef6\u4e5f\u80fd\u5904\u7406\n\n-- \u6a21\u5f0f\u53ef\u9009\u503c \u53ca \u5bf9\u5e94\u7684\u8fd4\u56de\u503c\n-- 0: \u8fd4\u56de\u5fae\u79d2\u6570, \u4ee5\u79d2\u4e3a\u5206\u5272, \u4f8b\u5982 1234567890us \u8fd4\u56de2\u4e2a\u503c: 1234, 567890\n-- 1: \u8fd4\u56de\u6beb\u79d2\u6570, \u4ee5\u5343\u79d2\u4e3a\u5206\u5272, \u4f8b\u5982 1234567890ms \u8fd4\u56de2\u4e2a\u503c: 1234, 567890\n-- 2: \u8fd4\u56de\u79d2\u6570, \u4ee5\u767e\u4e07\u79d2\u4e3a\u5206\u5272, \u4f8b\u5982 1234567890s \u8fd4\u56de2\u4e2a\u503c: 1234, 567890\n\nlocal us_h, us_l = mcu.ticks2(0)\nlocal ms_h, ms_l = mcu.ticks2(1)\nlocal sec_h, sec_l = mcu.ticks2(2)\nlog.info(\"us_h\", us_h, \"us_l\", us_l)\nlog.info(\"ms_h\", ms_h, \"ms_l\", ms_l)\nlog.info(\"sec_h\", sec_h, \"sec_l\", sec_l)\n", "prefix": "mcu.ticks2"}, "mcu.XTALRefOutput": {"body": "mcu.XTALRefOutput(${1:source_main},${2:source_32k})", "description": "mcu.XTALRefOutput(source_main, source_32k) - \u6676\u632f\u53c2\u8003\u65f6\u949f\u8f93\u51fa\n\u4f20\u5165\u503c\uff1a\nboolean \u9ad8\u901f\u6676\u632f\u53c2\u8003\u65f6\u949f\u662f\u5426\u8f93\u51fa\nboolean \u4f4e\u901f32K\u6676\u632f\u53c2\u8003\u65f6\u949f\u662f\u5426\u8f93\u51fa\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u4e8e2024.5.17\u65b0\u589e\n-- \u5f53\u524d\u4ec5Air780EP\u7cfb\u5217\u652f\u6301\nmcu.XTALRefOutput(true, false) --\u9ad8\u901f\u6676\u632f\u53c2\u8003\u65f6\u949f\u8f93\u51fa,\u4f4e\u901f32K\u4e0d\u8f93\u51fa\n", "prefix": "mcu.XTALRefOutput"}, "miniz.compress": {"body": "miniz.compress(${1:data},${2:flags})", "description": "miniz.compress(data, flags) - \u5feb\u901f\u538b\u7f29,\u9700\u8981165kb\u7684\u7cfb\u7edf\u5185\u5b58\u548c32kb\u7684LuaVM\u5185\u5b58\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u538b\u7f29\u7684\u6570\u636e, \u5c11\u4e8e400\u5b57\u8282\u7684\u6570\u636e\u4e0d\u5efa\u8bae\u538b\u7f29, \u4e14\u538b\u7f29\u540e\u7684\u6570\u636e\u4e0d\u80fd\u5927\u4e8e32k.\nflags \u538b\u7f29\u53c2\u6570,\u9ed8\u8ba4\u662f miniz.WRITE_ZLIB_HEADER , \u5373\u5199\u5165zlib\u5934\u90e8\n\u8fd4\u56de\u503c\uff1a\nstring \u82e5\u538b\u7f29\u6210\u529f,\u8fd4\u56de\u6570\u636e\u5b57\u7b26\u4e32, \u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n\nlocal bigdata = \"123jfoiq4hlkfjbnasdilfhuqwo;hfashfp9qw38hrfaios;hfiuoaghfluaeisw\"\nlocal cdata = miniz.compress(bigdata)\nif cdata then\n log.info(\"miniz\", \"before\", #bigdata, \"after\", #cdata)\n log.info(\"miniz\", \"cdata as hex\", cdata:toHex())\nend\n\n", "prefix": "miniz.compress"}, "miniz.uncompress": {"body": "miniz.uncompress(${1:data},${2:flags})", "description": "miniz.uncompress(data, flags) - \u5feb\u901f\u89e3\u538b,\u9700\u898132kb\u7684LuaVM\u5185\u5b58\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u89e3\u538b\u7684\u6570\u636e, \u89e3\u538b\u540e\u7684\u6570\u636e\u4e0d\u80fd\u5927\u4e8e32k\nflags \u89e3\u538b\u53c2\u6570,\u9ed8\u8ba4\u662f miniz.PARSE_ZLIB_HEADER , \u5373\u89e3\u6790zlib\u5934\u90e8\n\u8fd4\u56de\u503c\uff1a\nstring \u82e5\u89e3\u538b\u6210\u529f,\u8fd4\u56de\u6570\u636e\u5b57\u7b26\u4e32, \u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n\nlocal bigdata = \"123jfoiq4hlkfjbnasdilfhuqwo;hfashfp9qw38hrfaios;hfiuoaghfluaeisw\"\nlocal cdata = miniz.compress(bigdata)\nif cdata then\n log.info(\"miniz\", \"before\", #bigdata, \"after\", #cdata)\n log.info(\"miniz\", \"cdata as hex\", cdata:toHex())\n\n local udata = miniz.uncompress(cdata)\n log.info(\"miniz\", \"udata\", udata)\nend\n", "prefix": "miniz.uncompress"}, "mlx90640.init": {"body": "mlx90640.init(${1:i2c_id},${2:refresh_rate)(\u6ce8\u610f:2023.5.15\u4e4b\u540e\u4f7f\u7528\u6b64\u63a5\u53e3},${3:\u7528\u6237\u9700\u8981\u81ea\u884c\u521d\u59cb\u5316i2c\u63a5\u53e3})", "description": "mlx90640.init(i2c_id,refresh_rate) (\u6ce8\u610f:2023.5.15\u4e4b\u540e\u4f7f\u7528\u6b64\u63a5\u53e3,\u7528\u6237\u9700\u8981\u81ea\u884c\u521d\u59cb\u5316i2c\u63a5\u53e3) - \u521d\u59cb\u5316MLX90640\u4f20\u611f\u5668\n\u4f20\u5165\u503c\uff1a\nint \u4f20\u611f\u5668\u6240\u5728\u7684i2c\u603b\u7ebfid\u6216\u8005\u8f6fi2c\u5bf9\u8c61,\u9ed8\u8ba4\u4e3a0\nint \u4f20\u611f\u5668\u7684\u6d4b\u91cf\u901f\u7387,\u9ed8\u8ba4\u4e3a4Hz\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue, \u5426\u5219\u8fd4\u56denil\u6216\u8005false\n\u4f8b\u5b50\uff1a\ni2c.setup(i2cid,i2c_speed)\nif mlx90640.init(0,mlx90640.FPS4HZ) then\n log.info(\"mlx90640\", \"init ok\")\n sys.wait(500) -- \u7a0d\u7b49\u7247\u523b\n while 1 do\n mlx90640.feed() -- \u53d6\u4e00\u5e27\u6570\u636e\n mlx90640.draw2lcd(0, 0 ,1)-- \u9700\u63d0\u524d\u628alcd\u521d\u59cb\u5316\u597d\n sys.wait(250) -- \u9ed8\u8ba4\u662f4HZ\n end\nelse\n log.info(\"mlx90640\", \"init fail\")\nend\n\n", "prefix": "mlx90640.init"}, "mlx90640.feed": {"body": "mlx90640.feed()", "description": "mlx90640.feed() - \u53d6\u4e00\u5e27\u6570\u636e\n", "prefix": "mlx90640.feed"}, "mlx90640.raw_data": {"body": "mlx90640.raw_data()", "description": "mlx90640.raw_data() - \u83b7\u53d6\u5e95\u5c42\u88f8\u6570\u636e,\u6d6e\u70b9\u6570\u77e9\u9635\n\u8fd4\u56de\u503c\uff1a\ntable \u6d6e\u70b9\u6570\u6570\u636e,768\u4e2a\u50cf\u7d20\u5bf9\u5e94\u7684\u6e29\u5ea6\u503c\n", "prefix": "mlx90640.raw_data"}, "mlx90640.raw_point": {"body": "mlx90640.raw_point(${1:index})", "description": "mlx90640.raw_point(index) - \u83b7\u53d6\u5355\u4e00\u70b9\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u7d22\u5f15\u503c(0-767)\n\u8fd4\u56de\u503c\uff1a\nnumber \u5355\u70b9\u6e29\u5ea6\u503c\n", "prefix": "mlx90640.raw_point"}, "mlx90640.ta_temp": {"body": "mlx90640.ta_temp()", "description": "mlx90640.ta_temp() - \u83b7\u53d6\u5916\u58f3\u6e29\u5ea6\n\u8fd4\u56de\u503c\uff1a\nnumber \u5916\u58f3\u6e29\u5ea6\n", "prefix": "mlx90640.ta_temp"}, "mlx90640.max_temp": {"body": "mlx90640.max_temp()", "description": "mlx90640.max_temp() - \u83b7\u53d6\u6700\u9ad8\u6e29\u5ea6\n\u8fd4\u56de\u503c\uff1a\nnumber \u6700\u9ad8\u6e29\u5ea6\nnumber \u6700\u9ad8\u6e29\u5ea6\u4f4d\u7f6e\n", "prefix": "mlx90640.max_temp"}, "mlx90640.min_temp": {"body": "mlx90640.min_temp()", "description": "mlx90640.min_temp() - \u83b7\u53d6\u6700\u4f4e\u6e29\u5ea6\n\u8fd4\u56de\u503c\uff1a\nnumber \u6700\u4f4e\u6e29\u5ea6\nnumber \u6700\u4f4e\u6e29\u5ea6\u4f4d\u7f6e\n", "prefix": "mlx90640.min_temp"}, "mlx90640.average_temp": {"body": "mlx90640.average_temp()", "description": "mlx90640.average_temp() - \u83b7\u53d6\u5e73\u5747\u6e29\u5ea6\n\u8fd4\u56de\u503c\uff1a\nnumber \u5e73\u5747\u6e29\u5ea6\n", "prefix": "mlx90640.average_temp"}, "mlx90640.get_vdd": {"body": "mlx90640.get_vdd()", "description": "mlx90640.get_vdd() - \u83b7\u53d6vdd\n\u8fd4\u56de\u503c\uff1a\nnumber vdd\n", "prefix": "mlx90640.get_vdd"}, "mlx90640.draw2lcd": {"body": "mlx90640.draw2lcd(${1:x},${2:y},${3:fold})", "description": "mlx90640.draw2lcd(x, y, fold) - \u7ed8\u5236\u5230lcd\n\u4f20\u5165\u503c\uff1a\nint \u5de6\u4e0a\u89d2x\u5750\u6807\nint \u5de6\u4e0a\u89d2y\u5750\u6807\nint \u653e\u5927\u500d\u6570,\u5fc5\u987b\u4e3a2\u7684\u6307\u6570\u500d(1,2,4,8,16...)\u9ed8\u8ba4\u4e3a1\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n", "prefix": "mlx90640.draw2lcd"}, "mobile.imei": {"body": "mobile.imei(${1:index})", "description": "mobile.imei(index) - \u83b7\u53d6IMEI\n\u4f20\u5165\u503c\uff1a\nint \u7f16\u53f7,\u9ed8\u8ba40. \u5728\u652f\u6301\u53cc\u5361\u7684\u6a21\u5757\u4e0a\u624d\u4f1a\u51fa\u73b00\u62161\u7684\u60c5\u51b5\n\u8fd4\u56de\u503c\uff1a\nstring \u5f53\u524d\u7684IMEI\u503c,\u82e5\u5931\u8d25\u8fd4\u56denil\n", "prefix": "mobile.imei"}, "mobile.imsi": {"body": "mobile.imsi(${1:index})", "description": "mobile.imsi(index) - \u83b7\u53d6IMSI\n\u4f20\u5165\u503c\uff1a\nint \u7f16\u53f7,\u9ed8\u8ba40. \u5728\u652f\u6301\u53cc\u5361\u7684\u6a21\u5757\u4e0a\u624d\u4f1a\u51fa\u73b00\u62161\u7684\u60c5\u51b5\n\u8fd4\u56de\u503c\uff1a\nstring \u5f53\u524d\u7684IMSI\u503c,\u82e5\u5931\u8d25\u8fd4\u56denil\n", "prefix": "mobile.imsi"}, "mobile.sn": {"body": "mobile.sn()", "description": "mobile.sn() - \u83b7\u53d6SN\n\u8fd4\u56de\u503c\uff1a\nstring \u5f53\u524d\u7684SN\u503c,\u82e5\u5931\u8d25\u8fd4\u56denil. \u6ce8\u610f, SN\u53ef\u80fd\u5305\u542b\u4e0d\u53ef\u89c1\u5b57\u7b26\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f, \u51fa\u5382\u672a\u5fc5\u6709\u5199SN\n-- \u4e00\u822c\u7528\u9014\u7684\u552f\u4e00id, \u53ef\u4ee5\u7528mobile.imei()\u4ee3\u66ff\n-- \u5982\u9700\u8981\u771f\u6b63\u7684\u552f\u4e00ID, \u4f7f\u7528 mcu.unique_id()\n", "prefix": "mobile.sn"}, "mobile.muid": {"body": "mobile.muid()", "description": "mobile.muid() - \u83b7\u53d6MUID\n\u8fd4\u56de\u503c\uff1a\nstring \u5f53\u524d\u7684MUID\u503c,\u82e5\u5931\u8d25\u8fd4\u56denil\n", "prefix": "mobile.muid"}, "mobile.iccid": {"body": "mobile.iccid(${1:id})", "description": "mobile.iccid(id) - \u83b7\u53d6\u6216\u8bbe\u7f6eICCID\n\u4f20\u5165\u503c\uff1a\nint SIM\u5361\u7684\u7f16\u53f7, \u4f8b\u59820, 1, \u9ed8\u8ba40\n\u8fd4\u56de\u503c\uff1a\nstring ICCID\u503c,\u82e5\u5931\u8d25\u8fd4\u56denil\n", "prefix": "mobile.iccid"}, "mobile.number": {"body": "mobile.number(${1:id})", "description": "mobile.number(id) - \u83b7\u53d6\u624b\u673a\u5361\u53f7\uff0c\u6ce8\u610f\uff0c\u53ea\u6709\u5199\u5165\u4e86\u624b\u673a\u53f7\u624d\u80fd\u8bfb\u51fa\uff0c\u56e0\u6b64\u6709\u53ef\u80fd\u8bfb\u51fa\u6765\u662f\u7a7a\u7684\n\u4f20\u5165\u503c\uff1a\nint SIM\u5361\u7684\u7f16\u53f7, \u4f8b\u59820, 1, \u9ed8\u8ba40\n\u8fd4\u56de\u503c\uff1a\nstring number\u503c,\u82e5\u5931\u8d25\u8fd4\u56denil\n", "prefix": "mobile.number"}, "mobile.simid": {"body": "mobile.simid(${1:id})", "description": "mobile.simid(id) - \u83b7\u53d6\u5f53\u524dSIM\u5361\u69fd,\u6216\u8005\u5207\u6362\u5361\u69fd\n\u4f20\u5165\u503c\uff1a\nint SIM\u5361\u7684\u7f16\u53f7, \u4f8b\u59820, 1, \u5982\u679c\u652f\u6301\u53cc\u5361\uff0c\u6bd4\u5982EC618\uff0c\u53ef\u4ee5\u586b2\u6765\u81ea\u9002\u5e94\uff0c\u4f46\u662f\u4f1a\u5360\u7528\u63894\u4e2aIO(gpio4/5/6/23)\u3002\u5982\u679c\u4e0d\u586b\u5c31\u76f4\u63a5\u8bfb\u53d6\u5f53\u524d\u5361\u69fd\nboolean \u662f\u5426\u4f18\u5148\u7528SIM0\uff0c\u53ea\u6709SIM\u5361\u7f16\u53f7\u51992\u81ea\u9002\u5e94\u624d\u6709\u7528\uff01\uff01\uff01\u3002true\u4f18\u5148\u7528SIM0\uff0cfalse\u5219\u7531\u5177\u4f53\u5e73\u53f0\u51b3\u5b9a\uff0c\u652f\u6301\u53cc\u5361\u53cc\u5f85SIM0\u4f18\u5148\uff0c\u4e0d\u652f\u6301\u7684\u662f\u4e0a\u4e00\u6b21\u68c0\u6d4b\u5230\u7684\u4f18\u5148\uff0c\u9ed8\u8ba4\u662ffalse\uff0c\u5fc5\u987b\u5728\u5f00\u673a\u5c31\u914d\u7f6e\uff0c\u5426\u5219\u5c31\u65e0\u6548\u4e86\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524dsim\u5361\u69fd\u7f16\u53f7,\u82e5\u5931\u8d25\u8fd4\u56de-1\n\u4f8b\u5b50\uff1a\nmobile.simid(0) -- \u56fa\u5b9a\u4f7f\u7528SIM0\nmobile.simid(1) -- \u56fa\u4ef6\u4f7f\u7528SIM1\nmobile.simid(2) -- \u81ea\u52a8\u8bc6\u522bSIM0, SIM1, \u4f18\u5148\u7ea7\u770b\u5177\u4f53\u5e73\u53f0\nmobile.simid(2, true) -- -- \u81ea\u52a8\u8bc6\u522bSIM0, SIM1, \u4e14SIM0\u4f18\u5148\n-- \u63d0\u9192, \u81ea\u52a8\u8bc6\u522b\u662f\u4f1a\u589e\u52a0\u65f6\u95f4\u7684\n", "prefix": "mobile.simid"}, "mobile.simPin": {"body": "mobile.simPin(${1:id},${2:operation},${3:pin1},${4:pin2})", "description": "mobile.simPin(id,operation,pin1,pin2) - \u68c0\u6d4b\u5f53\u524dSIM\u5361\u662f\u5426\u51c6\u5907\u597d\uff0c\u5bf9SIM\u5361\u7684PIN\u7801\u505a\u76f8\u5173\u64cd\u4f5c\n\u4f20\u5165\u503c\uff1a\nint SIM\u5361\u7684\u7f16\u53f7, \u4f8b\u59820, 1, \u652f\u6301\u53cc\u5361\u53cc\u5f85\u7684\u624d\u9700\u8981\u9009\u62e9\nint PIN\u7801\u64cd\u4f5c\u7c7b\u578b\uff0c\u53ea\u80fd\u662fmobile.PIN_XXXX\uff0c\u4e0d\u64cd\u4f5c\u5c31\u7559\u7a7a\nstring \u66f4\u6362pin\u65f6\u64cd\u4f5c\u7684pin\u7801\uff0c\u6216\u8005\u9a8c\u8bc1\u64cd\u4f5c\u7684pin\u7801\uff0c\u6216\u8005\u89e3\u9501pin\u7801\u65f6\u7684PUK\uff0c4~8\u5b57\u8282\nstring \u66f4\u6362pin\u7801\u64cd\u4f5c\u65f6\u7684\u65b0\u7684pin\u7801\uff0c\u89e3\u9501pin\u7801\u65f6\u7684\u65b0PIN\uff0c4~8\u5b57\u8282\n\u8fd4\u56de\u503c\uff1a\nboolean \u5f53\u65e0PIN\u64cd\u4f5c\u65f6\uff0c\u8fd4\u56deSIM\u5361\u662f\u5426\u51c6\u5907\u597d\uff0c\u6709PIN\u64cd\u4f5c\u65f6\uff0c\u8fd4\u56de\u662f\u5426\u6210\u529f\n\u4f8b\u5b50\uff1a\nlocal cpin_is_ready = mobile.simPin() -- \u5f53\u524dsim\u5361\u662f\u5426\u51c6\u5907\u597d\uff0c\u4e00\u822c\u8fd4\u56defalse\u5c31\u662f\u6ca1\u5361\nlocal succ = mobile.simPin(0, mobile.PIN_VERIFY, \"1234\") -- \u8f93\u5165pin\u7801\u9a8c\u8bc1\n", "prefix": "mobile.simPin"}, "mobile.rtime": {"body": "mobile.rtime(${1:time},${2:auto_reset_stack},${3:data_first})", "description": "mobile.rtime(time, auto_reset_stack, data_first) - \u8bbe\u7f6eRRC\u81ea\u52a8\u91ca\u653e\u65f6\u95f4\u95f4\u9694\uff0c\u5f53\u5f00\u542f\u65f6\u540e\uff0c\u9047\u5230\u6781\u5f31\u4fe1\u53f7+\u9891\u7e41\u6570\u636e\u64cd\u4f5c\u53ef\u80fd\u4f1a\u5f15\u8d77\u7f51\u7edc\u4e25\u91cd\u6545\u969c\uff0c\u56e0\u6b64\u9700\u8981\u989d\u5916\u8bbe\u7f6e\u81ea\u52a8\u91cd\u542f\u534f\u8bae\u6808\n\u4f20\u5165\u503c\uff1a\nint RRC\u81ea\u52a8\u91ca\u653e\u65f6\u95f4\uff0c\u7b49\u540c\u4e8eAir724\u7684AT+RTIME\uff0c\u5355\u4f4d\u79d2\uff0c\u51990\u6216\u8005\u4e0d\u5199\u5219\u662f\u505c\u7528\uff0c\u4e0d\u8981\u8d85\u8fc720\u79d2\uff0c\u6ca1\u6709\u610f\u4e49\nboolean \u7f51\u7edc\u9047\u5230\u4e25\u91cd\u6545\u969c\u65f6\u5c1d\u8bd5\u81ea\u52a8\u6062\u590d\uff0c\u548c\u98de\u884c\u6a21\u5f0f/SIM\u5361\u5207\u6362\u51b2\u7a81\uff0ctrue\u5f00\u542f\uff0cfalse\u5173\u95ed\uff0c\u7559\u7a7a\u65f6\uff0c\u5982\u679c\u8bbe\u7f6e\u4e86\u65f6\u95f4\u5219\u81ea\u52a8\u5f00\u542f\u3002\u672c\u53c2\u6570\u4e8e2023\u5e749\u670814\u65e5\u5df2\u5e9f\u5f03\nboolean \u662f\u5426\u542f\u7528\u6570\u636e\u4f20\u8f93\u4f18\u5316\uff0ctrue\u542f\u7528\uff0cfalse\u5173\u95ed\uff0c\u7559\u7a7a\u4e3afalse\uff0c\u5f00\u542f\u540e\u5fc5\u987b\u7b49\u5230TCP\u6570\u636eACK\u6216\u8005\u8d85\u65f6\u5931\u8d25\uff0c\u6216\u8005socket CONNECT\u5b8c\u6210\uff08\u65e0\u8bba\u6210\u529f\u6216\u8005\u5931\u8d25\uff09\u624d\u5141\u8bb8RRC\u63d0\u524d\u91ca\u653e\uff0c\u53ef\u80fd\u4f1a\u589e\u52a0\u529f\u8017\u3002\u672c\u53c2\u6570\u4e8e2024\u5e748\u670812\u65e5\u542f\u7528\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nmobile.rtime(3) --\u4e0e\u57fa\u7ad9\u65e0\u6570\u636e\u4ea4\u4e923\u79d2\u540e\u63d0\u524d\u91ca\u653eRRC\nmobile.rtime(3,nil,true) --\u542f\u7528\u6570\u636e\u4f20\u8f93\u4f18\u5316\uff0c\u4e0e\u57fa\u7ad9\u65e0\u6570\u636e\u4ea4\u4e923\u79d2\u540e\uff0c\u63d0\u524d\u91ca\u653eRRC\n", "prefix": "mobile.rtime"}, "mobile.setAuto": {"body": "mobile.setAuto(${1:check_sim_period},${2:get_cell_period},${3:search_cell_time},${4:auto_reset_stack},${5:network_check_period})", "description": "mobile.setAuto(check_sim_period, get_cell_period, search_cell_time, auto_reset_stack, network_check_period) - \u8bbe\u7f6e\u4e00\u4e9b\u8f85\u52a9\u5468\u671f\u6027\u6216\u8005\u81ea\u52a8\u529f\u80fd\uff0c\u76ee\u524d\u652f\u6301SIM\u5361\u6682\u65f6\u8131\u79bb\u540e\u6062\u590d\uff0c\u5468\u671f\u6027\u83b7\u53d6\u5c0f\u533a\u4fe1\u606f\uff0c\u7f51\u7edc\u9047\u5230\u4e25\u91cd\u6545\u969c\u65f6\u5c1d\u8bd5\u81ea\u52a8\u6062\u590d\n\u4f20\u5165\u503c\uff1a\nint SIM\u5361\u81ea\u52a8\u6062\u590d\u65f6\u95f4\uff0c\u5355\u4f4d\u6beb\u79d2\uff0c\u5efa\u8bae5000~10000\uff0c\u548c\u98de\u884c\u6a21\u5f0f/SIM\u5361\u5207\u6362\u51b2\u7a81\uff0c\u4e0d\u80fd\u518d\u540c\u4e00\u65f6\u95f4\u4f7f\u7528\uff0c\u5fc5\u987b\u9519\u5f00\u6267\u884c\u3002\u51990\u6216\u8005\u4e0d\u5199\u5219\u662f\u5173\u95ed\u529f\u80fd\nint \u5468\u671f\u6027\u83b7\u53d6\u5c0f\u533a\u4fe1\u606f\u7684\u65f6\u95f4\u95f4\u9694\uff0c\u5355\u4f4d\u6beb\u79d2\u3002\u83b7\u53d6\u5c0f\u533a\u4fe1\u606f\u4f1a\u589e\u52a0\u90e8\u5206\u529f\u8017\u3002\u51990\u6216\u8005\u4e0d\u5199\u5219\u662f\u5173\u95ed\u529f\u80fd\nint \u6bcf\u6b21\u641c\u7d22\u5c0f\u533a\u65f6\u6700\u5927\u641c\u7d22\u65f6\u95f4\uff0c\u5355\u4f4d\u79d2\u3002\u4e0d\u8981\u8d85\u8fc78\u79d2\nboolean \u7f51\u7edc\u9047\u5230\u4e25\u91cd\u6545\u969c\u65f6\u5c1d\u8bd5\u81ea\u52a8\u6062\u590d\uff0c\u548c\u98de\u884c\u6a21\u5f0f/SIM\u5361\u5207\u6362\u51b2\u7a81\uff0ctrue\u5f00\u542f\uff0cfalse\u5173\u95ed\uff0c\u5f00\u59cb\u72b6\u6001\u662ffalse\uff0c\u7559\u7a7a\u5219\u4e0d\u505a\u6539\u53d8\nint \u8bbe\u7f6e\u5b9a\u65f6\u68c0\u6d4b\u7f51\u7edc\u662f\u5426\u6b63\u5e38\u5e76\u4e14\u5728\u68c0\u6d4b\u5230\u957f\u65f6\u95f4\u65e0\u7f51\u65f6\u901a\u8fc7\u91cd\u542f\u534f\u8bae\u6808\u6765\u6062\u590d\uff0c\u65e0\u7f51\u6062\u590d\u65f6\u957f\uff0c\u5355\u4f4dms\uff0c\u5efa\u8bae60000\u4ee5\u4e0a\uff0c\u4e3a\u7f51\u7edc\u641c\u7d22\u7f51\u7edc\u4fdd\u7559\u8db3\u591f\u7684\u65f6\u95f4\uff0c\u7559\u7a7a\u5219\u4e0d\u505a\u66f4\u6539\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "mobile.setAuto"}, "mobile.apn": {"body": "mobile.apn(${1:index},${2:cid},${3:new_apn_name},${4:user_name},${5:password},${6:ip_type},${7:protocol})", "description": "mobile.apn(index, cid, new_apn_name, user_name, password, ip_type, protocol) - \u83b7\u53d6\u6216\u8bbe\u7f6eAPN\uff0c\u8bbe\u7f6eAPN\u5fc5\u987b\u5728\u5165\u7f51\u524d\u5c31\u8bbe\u7f6e\u597d\uff0c\u6bd4\u5982\u5728SIM\u5361\u8bc6\u522b\u5b8c\u6210\u524d\u5c31\u8bbe\u7f6e\u597d\n\u4f20\u5165\u503c\uff1a\nint \u7f16\u53f7,\u9ed8\u8ba40. \u5728\u652f\u6301\u53cc\u5361\u7684\u6a21\u5757\u4e0a\u624d\u4f1a\u51fa\u73b00\u62161\u7684\u60c5\u51b5\nint cid, \u9ed8\u8ba40\uff0c\u5982\u679c\u8981\u7528\u975e\u9ed8\u8ba4APN\u6765\u6fc0\u6d3b\uff0c\u5fc5\u987b>0\nstring \u65b0\u7684APN,\u4e0d\u586b\u5c31\u662f\u83b7\u53d6APN, \u586b\u4e86\u5c31\u662f\u8bbe\u7f6eAPN, \u662f\u5426\u652f\u6301\u8bbe\u7f6e\u53d6\u51b3\u4e8e\u5e95\u5c42\u5b9e\u73b0\nstring \u65b0\u7684APN\u7684username,\u5982\u679cAPN\u4e0d\u662f\u7a7a,\u90a3\u5fc5\u987b\u586b\u5199,\u5982\u679c\u6ca1\u6709\u7559\u4e2a\u7a7a\u5b57\u7b26\u4e32\"\"\u3002\u5982\u679cAPN\u662f\u7a7a\u7684\uff0c\u90a3\u53ef\u4ee5nil\nstring \u65b0\u7684APN\u7684password,\u5982\u679cAPN\u4e0d\u662f\u7a7a,\u90a3\u5fc5\u987b\u586b\u5199,\u5982\u679c\u6ca1\u6709\u7559\u4e2a\u7a7a\u5b57\u7b26\u4e32\"\"\u3002\u5982\u679cAPN\u662f\u7a7a\u7684\uff0c\u90a3\u53ef\u4ee5nil\nint \u6fc0\u6d3bAPN\u65f6\u7684IP TYPE,1=IPV4 2=IPV6 3=IPV4V6,\u9ed8\u8ba4\u662f1\nint \u6fc0\u6d3bAPN\u65f6,\u5982\u679c\u9700\u8981username\u548cpassword,\u5c31\u8981\u5199\u9274\u6743\u534f\u8bae\u7c7b\u578b,1~3,\u9ed8\u8ba43,\u4ee3\u88681\u548c2\u90fd\u5c1d\u8bd5\u4e00\u4e0b\u3002\u4e0d\u9700\u8981\u9274\u6743\u7684\u51990\nboolean \u662f\u5426\u5220\u9664APN,true\u662f,\u5176\u4ed6\u90fd\u5426,\u53ea\u6709\u53c2\u65703\u65b0\u7684APN\u4e0d\u662fstring\u7684\u65f6\u5019\u624d\u6709\u6548\u679c\n\u8fd4\u56de\u503c\uff1a\nstring \u5982\u679c\u7f51\u7edc\u6ce8\u518c\u6210\u529f\uff0c\u8fd4\u56de\u6ce8\u518c\u7528\u7684APN\u503c\uff0c\u53cd\u4e4b\u662fnil\u3002\u8bbe\u7f6e\u597d\u4e0d\u4f1a\u7acb\u523b\u6709\u8fd4\u56de\u503c\uff0c\u9700\u8981\u7b49\u7f51\u7edc\u6ce8\u518c\u6210\u529f\n\u4f8b\u5b50\uff1a\nmobile.apn(0,1,\"cmiot\",\"\",\"\",nil,0) -- \u79fb\u52a8\u516c\u7f51\u5361\u8bbe\u7f6eAPN\u4e3acmiot,\u4e00\u822c\u4e0d\u7528\u8bbe\u7f6e\nmobile.apn(0,1,\"name\",\"user\",\"password\",nil,3) -- \u4e13\u7f51\u5361\u8bbe\u7f6e\u7684demo\uff0cname\uff0cuser\uff0cpassword\u8054\u7cfb\u5361\u5546\u83b7\u53d6\n", "prefix": "mobile.apn"}, "mobile.ipv6": {"body": "mobile.ipv6(${1:onff})", "description": "mobile.ipv6(onff) - \u662f\u5426\u9ed8\u8ba4\u5f00\u542fIPV6\u529f\u80fd\uff0c\u5fc5\u987b\u5728LTE\u7f51\u7edc\u8fde\u63a5\u524d\u5c31\u8bbe\u7f6e\u597d\n\u4f20\u5165\u503c\uff1a\nboolean \u5f00\u5173 true\u5f00\u542f false \u5173\u95ed\n\u8fd4\u56de\u503c\uff1a\nboolean true \u5f53\u524d\u662f\u5f00\u542f\u7684\uff0cfalse \u5f53\u524d\u662f\u5173\u95ed\u7684\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f, \u5f00\u542fipv6\u540e, \u5f00\u673a\u8054\u7f51\u4f1a\u61622~3\u79d2\n", "prefix": "mobile.ipv6"}, "mobile.csq": {"body": "mobile.csq()", "description": "mobile.csq() - \u83b7\u53d6csq\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524dCSQ\u503c, \u82e5\u5931\u8d25\u8fd4\u56de0. \u8303\u56f4 0 - 31, \u8d8a\u5927\u8d8a\u597d\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f, 4G\u6a21\u5757\u7684CSQ\u503c\u4ec5\u4f9b\u53c2\u8003, rsrp/rsrq\u624d\u662f\u771f\u6b63\u7684\u4fe1\u53f7\u5f3a\u5ea6\u6307\u6807\n", "prefix": "mobile.csq"}, "mobile.rssi": {"body": "mobile.rssi()", "description": "mobile.rssi() - \u83b7\u53d6rssi\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524drssi\u503c,\u82e5\u5931\u8d25\u8fd4\u56de0. \u8303\u56f4 0 \u5230 -114, \u8d8a\u5c0f\u8d8a\u597d\n", "prefix": "mobile.rssi"}, "mobile.rsrp": {"body": "mobile.rsrp()", "description": "mobile.rsrp() - \u83b7\u53d6rsrp,\u53c2\u8003\u4fe1\u53f7\u63a5\u6536\u529f\u7387\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524drsrp\u503c,\u82e5\u5931\u8d25\u8fd4\u56de0. \u53d6\u503c\u8303\u56f4: -44 ~ -140 \uff0c\u503c\u8d8a\u5927\u8d8a\u597d\n", "prefix": "mobile.rsrp"}, "mobile.rsrq": {"body": "mobile.rsrq()", "description": "mobile.rsrq() - \u83b7\u53d6rsrq,\u53c2\u8003\u4fe1\u53f7\u53d1\u9001\u529f\u7387\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524drsrq\u503c,\u82e5\u5931\u8d25\u8fd4\u56de0. \u53d6\u503c\u8303\u56f4: -3 ~ -19.5 \uff0c\u503c\u8d8a\u5927\u8d8a\u597d\n", "prefix": "mobile.rsrq"}, "mobile.snr": {"body": "mobile.snr()", "description": "mobile.snr() - \u83b7\u53d6snr,\u4fe1\u566a\u6bd4\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524dsnq\u503c,\u82e5\u5931\u8d25\u8fd4\u56de0.\u8303\u56f4 0 - 30, \u8d8a\u5927\u8d8a\u597d\n", "prefix": "mobile.snr"}, "mobile.eci": {"body": "mobile.eci()", "description": "mobile.eci() - \u83b7\u53d6\u5f53\u524d\u670d\u52a1\u5c0f\u533a\u7684ECI(E-UTRAN Cell Identifier)\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524deci\u503c,\u82e5\u5931\u8d25\u8fd4\u56de-1\n", "prefix": "mobile.eci"}, "mobile.tac": {"body": "mobile.tac()", "description": "mobile.tac() - \u83b7\u53d6\u5f53\u524d\u670d\u52a1\u5c0f\u533a\u7684TAC\u6216\u8005LAC\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524deci\u503c,\u82e5\u5931\u8d25\u8fd4\u56de-1. \u5982\u679c\u5c1a\u672a\u6ce8\u518c\u5230\u7f51\u7edc,\u4f1a\u8fd4\u56de0\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e 2023.7.9 \u65b0\u589e\n", "prefix": "mobile.tac"}, "mobile.enbid": {"body": "mobile.enbid()", "description": "mobile.enbid() - \u83b7\u53d6\u5f53\u524d\u670d\u52a1\u5c0f\u533a\u7684eNBID(eNodeB Identifier)\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524denbid\u503c,\u82e5\u5931\u8d25\u8fd4\u56de-1\n", "prefix": "mobile.enbid"}, "mobile.scell": {"body": "mobile.scell()", "description": "mobile.scell() - \u83b7\u53d6\u5f53\u524d\u670d\u52a1\u5c0f\u533a\u66f4\u8be6\u7ec6\u7684\u4fe1\u606f\n\u8fd4\u56de\u503c\uff1a\ntable \u670d\u52a1\u5c0f\u533a\u7684\u4fe1\u606f\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e 2024.9.12 \u65b0\u589e\nlog.info(\"cell\", json.encode(mobile.scell()))\n-- \u8fd4\u56de\u503c\u793a\u4f8b\n{\n \"mnc\": 11,\n \"mcc\": 460,\n \"rssi\": -78,\n \"pci\": 115,\n \"rsrp\": -107,\n \"tac\": 30005,\n \"eci\": 124045360,\n \"cid\": 124045360,\n \"rsrq\": -9,\n \"snr\": 15,\n \"earfcn\": 1850\n}\n", "prefix": "mobile.scell"}, "mobile.flymode": {"body": "mobile.flymode(${1:index},${2:enable})", "description": "mobile.flymode(index, enable) - \u8fdb\u51fa\u98de\u884c\u6a21\u5f0f\n\u4f20\u5165\u503c\uff1a\nint \u7f16\u53f7,\u9ed8\u8ba40. \u5728\u652f\u6301\u53cc\u5361\u7684\u6a21\u5757\u4e0a\u624d\u4f1a\u51fa\u73b00\u62161\u7684\u60c5\u51b5\nbool \u662f\u5426\u8bbe\u7f6e\u4e3a\u98de\u884c\u6a21\u5f0f,true\u4e3a\u8bbe\u7f6e, false\u4e3a\u9000\u51fa,\u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nbool \u539f\u98de\u884c\u6a21\u5f0f\u7684\u72b6\u6001\n", "prefix": "mobile.flymode"}, "mobile.syncTime": {"body": "mobile.syncTime(${1:enable})", "description": "mobile.syncTime(enable) - \u914d\u7f6e\u57fa\u7ad9\u540c\u6b65\u65f6\u95f4\u5f00\u5173\uff0c\u9ed8\u8ba4\u5f00\u542f\n\u4f20\u5165\u503c\uff1a\nbool \u5f00\u542f,true\u5f00\u542f, false\u5173\u95ed, nil\u4e0d\u8bbe\u7f6e\n\u8fd4\u56de\u503c\uff1a\nbool \u5f53\u524d\u5f00\u5173\u72b6\u6001\n\u4f8b\u5b50\uff1a\nmobile.syncTime() --\u83b7\u53d6\u5f53\u524d\u5f00\u5173\u72b6\u6001\nmobile.syncTime(false) --\u5173\u95ed\u57fa\u7ad9\u540c\u6b65\u65f6\u95f4\n", "prefix": "mobile.syncTime"}, "mobile.status": {"body": "mobile.status()", "description": "mobile.status() - \u83b7\u53d6\u7f51\u7edc\u72b6\u6001\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524d\u7f51\u7edc\u72b6\u6001\n\u4f8b\u5b50\uff1a\n-- \u72b6\u6001\u63cf\u8ff0\n-- 0:\u7f51\u7edc\u672a\u6ce8\u518c\n-- 1:\u7f51\u7edc\u5df2\u6ce8\u518c\n-- 2:\u6b63\u5728\u641c\u7f51\u4e2d\n-- 3:\u7f51\u7edc\u6ce8\u518c\u88ab\u62d2\u7edd\n-- 4:\u7f51\u7edc\u72b6\u6001\u672a\u77e5\n-- 5:\u6f2b\u6e38,\u4e14\u5df2\u6ce8\u518c\n-- 6:\u4ec5SMS\u53ef\u7528\n-- 7:\u4ec5SMS\u53ef\u7528,\u4e14\u6f2b\u6e38\u72b6\u6001\n-- 8:\u4ec5\u7d27\u6025\u547c\u53eb. \u6ce8\u610f, \u56fd\u5185\u4e0d\u652f\u6301\u6b64\u72b6\u6001,\u6a21\u5757\u4e5f\u4e0d\u652f\u6301\u7d27\u6025\u547c\u53eb\n\n-- \u4e0d\u63a8\u8350\u4f7f\u7528\u672cAPI\u5224\u65ad\u8054\u7f51\u72b6\u6001, \u5efa\u8bae\u4f7f\u7528socket.localIP()\u6765\u5224\u65ad\n", "prefix": "mobile.status"}, "mobile.getCellInfo": {"body": "mobile.getCellInfo()", "description": "mobile.getCellInfo() - \u83b7\u53d6\u57fa\u7ad9\u4fe1\u606f\n\u8fd4\u56de\u503c\uff1a\ntable \u5305\u542b\u57fa\u7ad9\u6570\u636e\u7684\u6570\u7ec4\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f: \u4ece2023.06.20\u5f00\u59cb, \u9700\u8981\u4e3b\u52a8\u8bf7\u6c42\u4e00\u6b21reqCellInfo\u624d\u4f1a\u6709\u57fa\u7ad9\u6570\u636e.\n\n--\u793a\u4f8b\u8f93\u51fa(\u539f\u59cb\u6570\u636e\u662ftable, \u4e0b\u9762\u662fjson\u683c\u5f0f\u5316\u540e\u7684\u5185\u5bb9)\n--[[\n[\n {\"rsrq\":-10,\"rssi\":-55,\"cid\":124045360,\"mnc\":17,\"pci\":115,\"earfcn\":1850,\"snr\":15,\"rsrp\":-85,\"mcc\":1120,\"tdd\":0},\n {\"pci\":388,\"rsrq\":-11,\"mnc\":17,\"earfcn\":2452,\"snr\":5,\"rsrp\":-67,\"mcc\":1120,\"cid\":124045331},\n {\"pci\":100,\"rsrq\":-9,\"mnc\":17,\"earfcn\":75,\"snr\":17,\"rsrp\":-109,\"mcc\":1120,\"cid\":227096712}\n]\n]]\n\nmobile.reqCellInfo(60)\n-- \u8ba2\u9605\nsys.subscribe(\"CELL_INFO_UPDATE\", function()\n log.info(\"cell\", json.encode(mobile.getCellInfo()))\nend)\n\n-- \u5b9a\u671f\u8f6e\u8bad\u5f0f\nsys.taskInit(function()\n sys.wait(3000)\n while 1 do\n mobile.reqCellInfo(15)\n sys.waitUntil(\"CELL_INFO_UPDATE\", 15000)\n log.info(\"cell\", json.encode(mobile.getCellInfo()))\n end\nend)\n", "prefix": "mobile.getCellInfo"}, "mobile.reqCellInfo": {"body": "mobile.reqCellInfo(${1:timeout})", "description": "mobile.reqCellInfo(timeout) - \u53d1\u8d77\u57fa\u7ad9\u4fe1\u606f\u67e5\u8be2,\u542b\u4e34\u8fd1\u5c0f\u533a\n\u4f20\u5165\u503c\uff1a\nint \u8d85\u65f6\u65f6\u957f,\u5355\u4f4d\u79d2,\u9ed8\u8ba415. \u6700\u5c115, \u6700\u9ad860\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003 mobile.getCellInfo \u51fd\u6570\n", "prefix": "mobile.reqCellInfo"}, "mobile.lockCell": {"body": "mobile.lockCell(${1:mode},${2:earfcn},${3:pci})", "description": "mobile.lockCell(mode, earfcn, pci) - \u9501\u5b9a/\u89e3\u9501\u5c0f\u533a\uff0c\u4ec5\u7528\u4e8e\u5916\u573a\u6d4b\u8bd5\uff0c\u6ca1\u63a5\u89e6\u8fc7\u7684\uff0c\u6216\u8005\u751f\u4ea7\u73af\u5883\u4e2d\u8bf7\u52ff\u4f7f\u7528\n\u4f20\u5165\u503c\uff1a\nint \u64cd\u4f5c\u7801 0\u5220\u9664\u4f18\u5148\u7684\u9891\u70b9\uff0c1\u8bbe\u7f6e\u4f18\u5148\u9891\u70b9\uff0c2\u9501\u5b9a\u5c0f\u533a\uff0c3\u89e3\u9501\u5c0f\u533a\nint \u4e0b\u884c\u9891\u70b9\nint phycellid\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529ftrue \u5931\u8d25false\n\u4f8b\u5b50\uff1a\nmobile.lockCell(2,1860,32) --\u9501\u5b9a\u5c0f\u533a\nmobile.lockCell(3) --\u89e3\u9501\u5c0f\u533a\n", "prefix": "mobile.lockCell"}, "mobile.reset": {"body": "mobile.reset()", "description": "mobile.reset() - \u91cd\u542f\u534f\u8bae\u6808\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u91cd\u542fLTE\u534f\u8bae\u6808\nmobile.reset()\n", "prefix": "mobile.reset"}, "mobile.dataTraffic": {"body": "mobile.dataTraffic(${1:clearUplink},${2:clearDownlink})", "description": "mobile.dataTraffic(clearUplink, clearDownlink) - \u6570\u636e\u91cf\u6d41\u91cf\u5904\u7406\n\u4f20\u5165\u503c\uff1a\nboolean \u6e05\u7a7a\u4e0a\u884c\u6d41\u91cf\u7d2f\u8ba1\u503c\uff0ctrue\u6e05\u7a7a\uff0c\u5176\u4ed6\u5ffd\u7565\nboolean \u6e05\u7a7a\u4e0b\u884c\u6d41\u91cf\u7d2f\u8ba1\u503c\uff0ctrue\u6e05\u7a7a\uff0c\u5176\u4ed6\u5ffd\u7565\n\u8fd4\u56de\u503c\uff1a\nint \u4e0a\u884c\u6d41\u91cfGB\nint \u4e0a\u884c\u6d41\u91cfB\nint \u4e0b\u884c\u6d41\u91cfGB\nint \u4e0b\u884c\u6d41\u91cfB\n\u4f8b\u5b50\uff1a\n-- \u83b7\u53d6\u4e0a\u4e0b\u884c\u6d41\u91cf\u7d2f\u8ba1\u503c\n-- \u4e0a\u884c\u6d41\u91cf\u503cByte = uplinkGB * 1024 * 1024 * 1024 + uplinkB\n-- \u4e0b\u884c\u6d41\u91cf\u503cByte = downlinkGB * 1024 * 1024 * 1024 + downlinkB\nlocal uplinkGB, uplinkB, downlinkGB, downlinkB = mobile.dataTraffic()\n\n-- \u6e05\u7a7a\u4e0a\u4e0b\u884c\u6d41\u91cf\u7d2f\u8ba1\u503c\nmobile.dataTraffic(true, true)\n\n-- \u4ec5\u8bb0\u5f55\u5f00\u673a\u540e\u7684\u6d41\u91cf,\u590d\u4f4d/\u91cd\u542f\u4f1a\u5f52\u96f6\n", "prefix": "mobile.dataTraffic"}, "mobile.config": {"body": "mobile.config(${1:item},${2:value})", "description": "mobile.config(item, value) - \u7f51\u7edc\u7279\u6b8a\u914d\u7f6e\n\u4f20\u5165\u503c\uff1a\nint \u914d\u7f6e\u9879\u76ee\uff0c\u770bmobile.CONF_XXX\nint \u914d\u7f6e\u503c,\u6839\u636e\u5177\u4f53\u914d\u7f6e\u7684item\u51b3\u5b9a\n\u8fd4\u56de\u503c\uff1a\nboolean \u662f\u5426\u6210\u529f\n\u4f8b\u5b50\uff1a\n--\u9488\u5bf9\u4e0d\u540c\u5e73\u53f0\u6709\u4e0d\u540c\u7684\u914d\u7f6e\uff0c\u8c28\u614e\u4f7f\u7528\uff0c\u76ee\u524d\u53ea\u6709EC618/EC718\u7cfb\u5217\n\n-- EC618\u914d\u7f6e\u5c0f\u533a\u91cd\u9009\u4fe1\u53f7\u5dee\u503c\u95e8\u9650\uff0c\u4e0d\u80fd\u5927\u4e8e15dbm\uff0c\u5fc5\u987b\u5728\u98de\u884c\u6a21\u5f0f\u4e0b\u624d\u80fd\u7528\nmobile.flymode(0,true)\nmobile.config(mobile.CONF_RESELTOWEAKNCELL, 15)\nmobile.config(mobile.CONF_STATICCONFIG, 1) --\u5f00\u542f\u7f51\u7edc\u9759\u6001\u4f18\u5316\nmobile.flymode(0,false)\n\n-- EC618\u8bbe\u7f6eSIM\u5199\u5165\u6b21\u6570\u7684\u7edf\u8ba1\n-- \u5173\u95ed\u7edf\u8ba1\nmobile.config(mobile.CONF_SIM_WC_MODE, 0)\n-- \u5f00\u542f\u7edf\u8ba1, \u9ed8\u8ba4\u4e5f\u662f\u5f00\u542f\u7684.\nmobile.config(mobile.CONF_SIM_WC_MODE, 1)\n-- \u8bfb\u53d6\u7edf\u8ba1\u503c,\u5f02\u6b65, \u9700\u8981\u901a\u8fc7\u7cfb\u7edf\u6d88\u606fSIM_IND\u83b7\u53d6\nsys.subscribe(\"SIM_IND\", function(stats, value)\n log.info(\"SIM_IND\", stats)\n if stats == \"SIM_WC\" then\n log.info(\"sim\", \"write counter\", value)\n end\nend)\nmobile.config(mobile.CONF_SIM_WC_MODE, 2)\n-- \u6e05\u7a7a\u7edf\u8ba1\u503c\nmobile.config(mobile.CONF_SIM_WC_MODE, 3)\n", "prefix": "mobile.config"}, "mobile.getBand": {"body": "mobile.getBand(${1:band},${2:is_default})", "description": "mobile.getBand(band, is_default) - \u83b7\u53d6\u5f53\u524d\u4f7f\u7528/\u652f\u6301\u7684band\n\u4f20\u5165\u503c\uff1a\nzbuff \u8f93\u51faband\nboolean true\u9ed8\u8ba4\u652f\u6301\uff0cfalse\u5f53\u524d\u652f\u6301\u7684\uff0c\u9ed8\u8ba4\u662ffalse\uff0c\u5f53\u524d\u662f\u9884\u7559\u529f\u80fd\uff0c\u4e0d\u8981\u5199true\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue\uff0c\u5931\u8d25\u653e\u56defalse\n\u4f8b\u5b50\uff1a\nlocal buff = zbuff.create(40)\nmobile.getBand(buff) --\u8f93\u51fa\u5f53\u524d\u4f7f\u7528\u7684band\uff0cband\u53f7\u653e\u5728buff\u5185\uff0cbuff[0]\uff0cbuff[1]\uff0cbuff[2] .. buff[buff:used() - 1]\n", "prefix": "mobile.getBand"}, "mobile.setBand": {"body": "mobile.setBand(${1:band},${2:num})", "description": "mobile.setBand(band, num) - \u8bbe\u7f6e\u4f7f\u7528\u7684band\n\u4f20\u5165\u503c\uff1a\nzbuff \u8f93\u5165\u4f7f\u7528\u7684band\nint band\u6570\u91cf\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue\uff0c\u5931\u8d25\u653e\u56defalse\n\u4f8b\u5b50\uff1a\nlocal buff = zbuff.create(40)\nbuff[0] = 3\nbuff[1] = 5\nbuff[2] = 8\nbuff[3] = 40\nmobile.setBand(buff, 4) --\u8bbe\u7f6e\u4f7f\u7528\u7684band\u4e00\u51714\u4e2a\uff0c\u4e3a3,5,8,40\n", "prefix": "mobile.setBand"}, "mobile.nstOnOff": {"body": "mobile.nstOnOff(${1:onoff},${2:uart_id})", "description": "mobile.nstOnOff(onoff, uart_id) - RF\u6d4b\u8bd5\u5f00\u5173\u548c\u914d\u7f6e\n\u4f20\u5165\u503c\uff1a\nboolean true\u5f00\u542f\u6d4b\u8bd5\u6a21\u5f0f\uff0cfalse\u5173\u95ed\nint \u4e32\u53e3\u53f7\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nmobile.nstOnOff(true, uart.VUART_0) --\u6253\u5f00\u6d4b\u8bd5\u6a21\u5f0f\uff0c\u5e76\u4e14\u7528\u865a\u62df\u4e32\u53e3\u53d1\u9001\u7ed3\u679c\nmobile.nstOnOff(false) --\u5173\u95ed\u6d4b\u8bd5\u6a21\u5f0f\n", "prefix": "mobile.nstOnOff"}, "mobile.nstInput": {"body": "mobile.nstInput(${1:data})", "description": "mobile.nstInput(data) - RF\u6d4b\u8bd5\u6570\u636e\u8f93\u5165\n\u4f20\u5165\u503c\uff1a\nstring or zbuff \u7528\u6237\u4ece\u4e32\u53e3\u83b7\u53d6\u7684\u6570\u636e\uff0c\u6ce8\u610f\uff0c\u5f53\u83b7\u53d6\u5b8c\u6240\u6709\u6570\u636e\u540e\uff0c\u9700\u8981\u518d\u4f20\u4e00\u4e2anil\u6765\u4f5c\u4e3a\u4f20\u8f93\u7ed3\u675f\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nmobile.nstInput(uart_data)\nmobile.nstInput(nil)\n", "prefix": "mobile.nstInput"}, "mobile.vsimInit": {"body": "mobile.vsimInit()", "description": "mobile.vsimInit() - \u521d\u59cb\u5316\u5185\u7f6e\u9ed8\u8ba4\u865a\u62df\u5361\u529f\u80fd(\u4e0d\u53ef\u7528)\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nmobile.vsimInit()\n", "prefix": "mobile.vsimInit"}, "mobile.vsimOnOff": {"body": "mobile.vsimOnOff(${1:enable})", "description": "mobile.vsimOnOff(enable) - \u5207\u6362\u5185\u7f6e\u865a\u62df\u5361\u548c\u5916\u7f6e\u5b9e\u4f53\u5361\uff0c2024\u5e748\u670813\u65e5\u542f\u7528\uff0c\u865a\u62df\u5361\u9700\u8981\u56fa\u4ef6\u652f\u6301\uff0c\u5426\u5219\u5207\u6362\u540e\u65e0\u7f51\u7edc\uff0c\u9700\u8981\u5728\u98de\u884c\u6a21\u5f0f\u4e0b\u5207\u6362\uff0c\u6216\u8005\u5207\u6362\u540e\u91cd\u542f\u534f\u8bae\u6808\n\u4f20\u5165\u503c\uff1a\nbool \u5f00\u542f,true\u5f00\u542f, false\u5173\u95ed\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nmobile.vsimOnOff(true) --\u4f7f\u7528\u5185\u7f6e\u865a\u62df\u5361\nmobile.vsimOnOff(false) --\u4f7f\u7528\u5916\u7f6e\u5b9e\u4f53\u5361\n", "prefix": "mobile.vsimOnOff"}, "mobile.apnTableInit": {"body": "mobile.apnTableInit()", "description": "mobile.apnTableInit() - \u521d\u59cb\u5316\u81ea\u5b9a\u4e49APN\u5217\u8868\uff0c\u4e3b\u8981\u7528\u4e8e\u6d77\u5916SIM\u5361\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nmobile.apnTableInit()\n", "prefix": "mobile.apnTableInit"}, "mobile.apnTableAdd": {"body": "mobile.apnTableAdd(${1:mcc},${2:mnc},${3:ip_type},${4:protocol},${5:apn_name},${6:user_name},${7:password})", "description": "mobile.apnTableAdd(mcc, mnc, ip_type, protocol, apn_name, user_name, password) - \u5f80\u81ea\u5b9a\u4e49APN\u5217\u8868\u6dfb\u52a0\u4e00\u6761APN\u4fe1\u606f\uff0c\u4e3b\u8981\u7528\u4e8e\u6d77\u5916SIM\u5361\n\u4f20\u5165\u503c\uff1a\nint MCC\u7801,16\u8fdb\u5236BCD\u7801\nint MNC\u7801,16\u8fdb\u5236BCD\u7801\nint \u6fc0\u6d3bAPN\u65f6\u7684IP TYPE,1=IPV4 2=IPV6 3=IPV4V6,\u9ed8\u8ba4\u662f1\nint \u6fc0\u6d3bAPN\u65f6,\u5982\u679c\u9700\u8981username\u548cpassword,\u5c31\u8981\u5199\u9274\u6743\u534f\u8bae\u7c7b\u578b,1~3,\u9ed8\u8ba43,\u4ee3\u88681\u548c2\u90fd\u5c1d\u8bd5\u4e00\u4e0b\u3002\u4e0d\u9700\u8981\u9274\u6743\u7684\u51990\nstring APN name,\u4e0d\u80fd\u4e3a\u7a7a\nstring APN\u7684username\nstring APN\u7684password\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nmobile.apnTableInit() -- \u5148\u521d\u59cb\u5316\uff0c\u5fc5\u987b\u653e\u5728SIM\u5361\u8bc6\u522b\u5b8c\u6210\u524d\u52a0\u5165\uff0c\u6700\u597d\u5c31\u662f\u5199\u5728\u5f00\u5934\nmobile.apnTableAdd(0x460,0x00,3,0,\"cmiot\",\"\",\"\") -- \u5355\u72ec\u6dfb\u52a0\u4e00\u6761APN\u4fe1\u606f\uff0c\u5fc5\u987b\u653e\u5728SIM\u5361\u8bc6\u522b\u5b8c\u6210\u524d\u52a0\u5165\uff0c\u6700\u597d\u5c31\u662f\u5199\u5728\u5f00\u5934\uff0c\u79fb\u52a8\u516c\u7f51\u5361\u8bbe\u7f6eAPN\u4e3acmiot\uff08\u4e00\u822c\u4e0d\u7528\u8bbe\u7f6e\uff0c\u8fd9\u91cc\u53ea\u662f\u4e3e\u4e2a\u4f8b\u5b50\uff09\n\n", "prefix": "mobile.apnTableAdd"}, "mobile.apnTablePrint": {"body": "mobile.apnTablePrint(${1:mcc},${2:mnc})", "description": "mobile.apnTablePrint(mcc, mnc) - \u6253\u5370\u81ea\u5b9a\u4e49APN\u5217\u8868\u91cc\u7684\u4e00\u6761\u4fe1\u606f\uff0c\u5728\u6ca1\u6709\u62ff\u5230\u5361\u7684\u60c5\u51b5\u4e0b\uff0c\u6d4b\u8bd5\u4e00\u4e0b\u5bf9\u5e94\u7684APN\u4fe1\u606f\u662f\u5426\u548c\u8fd0\u8425\u5546\u63d0\u4f9b\u7684\u5339\u914d\n\u4f20\u5165\u503c\uff1a\nint MCC\u7801,16\u8fdb\u5236BCD\u7801\nint MNC\u7801,16\u8fdb\u5236BCD\u7801\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nmobile.apnTableInit()\nmobile.apnTablePrint(0x202, 0x01)\n", "prefix": "mobile.apnTablePrint"}, "mqttc:subscribe": {"body": "mqttc:subscribe(${1:topic},${2:qos})", "description": "mqttc:subscribe(topic, qos) - \u8ba2\u9605\u4e3b\u9898\n\u4f20\u5165\u503c\uff1a\nstring/table \u4e3b\u9898\nint topic\u4e3astring\u65f6\u751f\u6548 0/1/2 \u9ed8\u8ba40\n\u8fd4\u56de\u503c\uff1a\nint \u6d88\u606fid,\u5f53qos\u4e3a1/2\u65f6\u6709\u6548, \u82e5\u5e95\u5c42\u8fd4\u56de\u5931\u8d25,\u4f1a\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u8ba2\u9605\u5355\u4e2atopic, \u4e14qos=0\nmqttc:subscribe(\"/luatos/123456\", 0)\n-- \u8ba2\u9605\u5355\u4e2atopic, \u4e14qos=1\nmqttc:subscribe(\"/luatos/12345678\", 1)\n-- \u8ba2\u9605\u591a\u4e2atopic, \u4e14\u4f7f\u7528\u4e0d\u540c\u7684qos\nmqttc:subscribe({[\"/luatos/1234567\"]=1,[\"/luatos/12345678\"]=2})\n", "prefix": "mqttc:subscribe"}, "mqttc:unsubscribe": {"body": "mqttc:unsubscribe(${1:topic})", "description": "mqttc:unsubscribe(topic) - \u53d6\u6d88\u8ba2\u9605\u4e3b\u9898\n\u4f20\u5165\u503c\uff1a\nstring/table \u4e3b\u9898\n\u4f8b\u5b50\uff1a\nmqttc:unsubscribe(\"/luatos/123456\")\nmqttc:unsubscribe({\"/luatos/1234567\",\"/luatos/12345678\"})\n", "prefix": "mqttc:unsubscribe"}, "mqttc:debug": {"body": "mqttc:debug(${1:onoff})", "description": "mqttc:debug(onoff) - \u914d\u7f6e\u662f\u5426\u6253\u5f00debug\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nboolean \u662f\u5426\u6253\u5f00debug\u5f00\u5173\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "mqttc:debug"}, "mqtt.create": {"body": "mqtt.create(${1:adapter},${2:host},${3:port},${4:ssl},${5:isipv6})", "description": "mqtt.create(adapter,host,port,ssl,isipv6) - mqtt\u5ba2\u6237\u7aef\u521b\u5efa\n\u4f20\u5165\u503c\uff1a\nint \u9002\u914d\u5668\u5e8f\u53f7, \u53ea\u80fd\u662fsocket.ETH0, socket.STA, socket.AP,\u5982\u679c\u4e0d\u586b,\u4f1a\u9009\u62e9\u5e73\u53f0\u81ea\u5e26\u7684\u65b9\u5f0f,\u7136\u540e\u662f\u6700\u540e\u4e00\u4e2a\u6ce8\u518c\u7684\u9002\u914d\u5668\nstring \u670d\u52a1\u5668\u5730\u5740,\u53ef\u4ee5\u662f\u57df\u540d, \u4e5f\u53ef\u4ee5\u662fip\nint \u7aef\u53e3\u53f7\nbool/table \u662f\u5426\u4e3assl\u52a0\u5bc6\u8fde\u63a5,\u9ed8\u8ba4\u4e0d\u52a0\u5bc6,true\u4e3a\u65e0\u8bc1\u4e66\u6700\u7b80\u5355\u7684\u52a0\u5bc6\uff0ctable\u4e3a\u6709\u8bc1\u4e66\u7684\u52a0\u5bc6
server_cert \u670d\u52a1\u5668ca\u8bc1\u4e66\u6570\u636e
client_cert \u5ba2\u6237\u7aef\u8bc1\u4e66\u6570\u636e
client_key \u5ba2\u6237\u7aef\u79c1\u94a5\u52a0\u5bc6\u6570\u636e
client_password \u5ba2\u6237\u7aef\u79c1\u94a5\u53e3\u4ee4\u6570\u636e
verify \u662f\u5426\u5f3a\u5236\u6821\u9a8c 0\u4e0d\u6821\u9a8c/1\u53ef\u9009\u6821\u9a8c/2\u5f3a\u5236\u6821\u9a8c \u9ed8\u8ba42\nbool/table bool \u662f\u5426\u4e3aipv6\uff0c\u9ed8\u8ba4\u4e0d\u662f table mqtt\u6269\u5c55\u53c2\u6570, ipv6 \u662f\u5426\u4e3aipv6, rxSize \u63a5\u6536\u7f13\u51b2\u533a\u5927\u5c0f\n\u8fd4\u56de\u503c\uff1a\nuserdata \u82e5\u6210\u529f\u4f1a\u8fd4\u56demqtt\u5ba2\u6237\u7aef\u5b9e\u4f8b,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u666e\u901aTCP\u94fe\u63a5\nmqttc = mqtt.create(nil,\"120.55.137.106\", 1884)\n-- \u666e\u901aTCP\u94fe\u63a5,mqtt\u63a5\u6536\u7f13\u51b2\u533a4096\nmqttc = mqtt.create(nil,\"120.55.137.106\", 1884, nil, {rxSize = 4096})\n-- \u52a0\u5bc6TCP\u94fe\u63a5,\u4e0d\u9a8c\u8bc1\u670d\u52a1\u5668\u8bc1\u4e66\nmqttc = mqtt.create(nil,\"120.55.137.106\", 8883, true)\n-- \u52a0\u5bc6TCPTCP\u94fe\u63a5,\u5355\u670d\u52a1\u5668\u8bc1\u4e66\u9a8c\u8bc1\nmqttc = mqtt.create(nil,\"120.55.137.106\", 8883, {server_cert=io.readFile(\"/luadb/ca.crt\")})\n-- \u52a0\u5bc6TCPTCP\u94fe\u63a5,\u5355\u670d\u52a1\u5668\u8bc1\u4e66\u9a8c\u8bc1, \u4f46\u53ef\u9009\u8ba4\u8bc1\nmqttc = mqtt.create(nil,\"120.55.137.106\", 8883, {server_cert=io.readFile(\"/luadb/ca.crt\"), verify=1})\n-- \u52a0\u5bc6TCPTCP\u94fe\u63a5,\u53cc\u5411\u8bc1\u4e66\u9a8c\u8bc1\nmqttc = mqtt.create(nil,\"120.55.137.106\", 8883, {\n server_cert=io.readFile(\"/luadb/ca.crt\"),\n client_cert=io.readFile(\"/luadb/client.pem\"),\n client_key=\"123456\",\n client_password=\"123456\",\n })\n", "prefix": "mqtt.create"}, "mqttc:auth": {"body": "mqttc:auth(${1:client_id},${2:username},${3:password},${4:cleanSession})", "description": "mqttc:auth(client_id,username,password,cleanSession) - mqtt\u4e09\u5143\u7ec4\u914d\u7f6e\u53cacleanSession\n\u4f20\u5165\u503c\uff1a\nstring \u8bbe\u5907\u8bc6\u522bid,\u5bf9\u4e8e\u540c\u4e00\u4e2amqtt\u670d\u52a1\u5668\u6765\u8bf4, \u901a\u5e38\u8981\u6c42\u552f\u4e00,\u76f8\u540cclient_id\u4f1a\u4e92\u76f8\u8e22\u4e0b\u7ebf\nstring \u8d26\u53f7 \u53ef\u9009\nstring \u5bc6\u7801 \u53ef\u9009\nbool \u6e05\u9664session,\u9ed8\u8ba4true,\u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u65e0\u8d26\u53f7\u5bc6\u7801\u767b\u5f55,\u4ec5clientId\nmqttc:auth(\"123456789\")\n-- \u5e26\u8d26\u53f7\u5bc6\u7801\u767b\u5f55\nmqttc:auth(\"123456789\",\"username\",\"password\")\n-- \u989d\u5916\u914d\u7f6ecleanSession,\u4e0d\u6e05\u9664\nmqttc:auth(\"123456789\",\"username\",\"password\", false)\n-- \u65e0clientId\u6a21\u5f0f, \u670d\u52a1\u5668\u968f\u673a\u751f\u6210id, cleanSession\u4e0d\u53ef\u914d\u7f6e\nmqttc:auth()\n", "prefix": "mqttc:auth"}, "mqttc:keepalive": {"body": "mqttc:keepalive(${1:time})", "description": "mqttc:keepalive(time) - mqtt\u5fc3\u8df3\u8bbe\u7f6e\n\u4f20\u5165\u503c\uff1a\nint \u53ef\u9009 \u5355\u4f4ds \u9ed8\u8ba4240s. \u6700\u514815,\u6700\u9ad8600\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nmqttc:keepalive(30)\n", "prefix": "mqttc:keepalive"}, "mqttc:on": {"body": "mqttc:on(${1:cb})", "description": "mqttc:on(cb) - \u6ce8\u518cmqtt\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nfunction cb mqtt\u56de\u8c03,\u53c2\u6570\u5305\u62ecmqtt_client, event, data, payload\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nmqttc:on(function(mqtt_client, event, data, payload, metas)\n -- \u7528\u6237\u81ea\u5b9a\u4e49\u4ee3\u7801\n log.info(\"mqtt\", \"event\", event, mqtt_client, data, payload)\nend)\n--[[\nevent\u53ef\u80fd\u51fa\u73b0\u7684\u503c\u6709\n conack -- \u670d\u52a1\u5668\u9274\u6743\u5b8c\u6210,mqtt\u8fde\u63a5\u5df2\u7ecf\u5efa\u7acb, \u53ef\u4ee5\u8ba2\u9605\u548c\u53d1\u5e03\u6570\u636e\u4e86,\u6ca1\u6709\u9644\u52a0\u6570\u636e\n recv -- \u63a5\u6536\u5230\u6570\u636e,\u7531\u670d\u52a1\u5668\u4e0b\u53d1, data\u4e3atopic\u503c(string), payload\u4e3a\u4e1a\u52a1\u6570\u636e(string).metas\u662f\u5143\u6570\u636e(table), \u4e00\u822c\u4e0d\u5904\u7406. \n -- metas\u5305\u542b\u4ee5\u4e0b\u5185\u5bb9\n -- qos \u53d6\u503c\u8303\u56f40,1,2\n -- retain \u53d6\u503c\u8303\u56f4 0,1\n -- dup \u53d6\u503c\u8303\u56f4 0,1\n sent -- \u53d1\u9001\u5b8c\u6210, qos0\u4f1a\u9a6c\u4e0a\u901a\u77e5, qos1/qos2\u4f1a\u5728\u670d\u52a1\u5668\u5e94\u7b54\u4f1a\u56de\u8c03, data\u4e3a\u6d88\u606fid\n disconnect -- \u670d\u52a1\u5668\u65ad\u5f00\u8fde\u63a5,\u7f51\u7edc\u95ee\u9898\u6216\u670d\u52a1\u5668\u8e22\u4e86\u5ba2\u6237\u7aef,\u4f8b\u5982clientId\u91cd\u590d,\u8d85\u65f6\u672a\u4e0a\u62a5\u4e1a\u52a1\u6570\u636e\n pong -- \u6536\u5230\u670d\u52a1\u5668\u5fc3\u8df3\u5e94\u7b54,\u6ca1\u6709\u9644\u52a0\u6570\u636e\n]]\n", "prefix": "mqttc:on"}, "mqttc:connect": {"body": "mqttc:connect()", "description": "mqttc:connect() - \u8fde\u63a5\u670d\u52a1\u5668\n\u8fd4\u56de\u503c\uff1a\nboolean \u53d1\u8d77\u6210\u529f\u8fd4\u56detrue, \u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u5f00\u59cb\u5efa\u7acb\u8fde\u63a5\nmqttc:connect()\n-- \u672c\u51fd\u6570\u4ec5\u4ee3\u8868\u53d1\u8d77\u6210\u529f, \u540e\u7eed\u4ecd\u9700\u6839\u636eready\u51fd\u6570\u5224\u65admqtt\u662f\u5426\u8fde\u63a5\u6b63\u5e38\n", "prefix": "mqttc:connect"}, "mqttc:disconnect": {"body": "mqttc:disconnect()", "description": "mqttc:disconnect() - \u65ad\u5f00\u670d\u52a1\u5668\u8fde\u63a5(\u4e0d\u4f1a\u91ca\u653e\u8d44\u6e90)\n\u8fd4\u56de\u503c\uff1a\nboolean \u53d1\u8d77\u6210\u529f\u8fd4\u56detrue, \u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u65ad\u5f00\u8fde\u63a5\nmqttc:disconnect()\n", "prefix": "mqttc:disconnect"}, "mqttc:autoreconn": {"body": "mqttc:autoreconn(${1:reconnect},${2:reconnect_time})", "description": "mqttc:autoreconn(reconnect, reconnect_time) - \u81ea\u52a8\u91cd\u8fde\n\u4f20\u5165\u503c\uff1a\nbool \u662f\u5426\u81ea\u52a8\u91cd\u8fde\nint \u81ea\u52a8\u91cd\u8fde\u5468\u671f \u5355\u4f4dms \u9ed8\u8ba43000ms\n\u4f8b\u5b50\uff1a\nmqttc:autoreconn(true)\n", "prefix": "mqttc:autoreconn"}, "mqttc:publish": {"body": "mqttc:publish(${1:topic},${2:data},${3:qos},${4:retain})", "description": "mqttc:publish(topic, data, qos, retain) - \u53d1\u5e03\u6d88\u606f\n\u4f20\u5165\u503c\uff1a\nstring \u4e3b\u9898,\u5fc5\u586b\nstring \u6d88\u606f,\u5fc5\u586b,\u4f46\u957f\u5ea6\u53ef\u4ee5\u662f0\nint \u6d88\u606f\u7ea7\u522b 0/1 \u9ed8\u8ba40\nint \u662f\u5426\u5b58\u6863, 0/1,\u9ed8\u8ba40\n\u8fd4\u56de\u503c\uff1a\nint \u6d88\u606fid, \u5f53qos\u4e3a1\u62162\u65f6\u4f1a\u6709\u6548\u503c. \u82e5\u5e95\u5c42\u8fd4\u56de\u662f\u5426, \u4f1a\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nmqttc:publish(\"/luatos/123456\", \"123\")\n", "prefix": "mqttc:publish"}, "mqttc:close": {"body": "mqttc:close()", "description": "mqttc:close() - mqtt\u5ba2\u6237\u7aef\u5173\u95ed(\u5173\u95ed\u540e\u8d44\u6e90\u91ca\u653e\u65e0\u6cd5\u518d\u4f7f\u7528)\n\u4f8b\u5b50\uff1a\nmqttc:close()\n", "prefix": "mqttc:close"}, "mqttc:ready": {"body": "mqttc:ready()", "description": "mqttc:ready() - mqtt\u5ba2\u6237\u7aef\u662f\u5426\u5c31\u7eea\n\u8fd4\u56de\u503c\uff1a\nbool \u5ba2\u6237\u7aef\u662f\u5426\u5c31\u7eea\n\u4f8b\u5b50\uff1a\nlocal error = mqttc:ready()\n", "prefix": "mqttc:ready"}, "mqttc:state": {"body": "mqttc:state()", "description": "mqttc:state() - mqtt\u5ba2\u6237\u7aef\u72b6\u6001\n\u8fd4\u56de\u503c\uff1a\nnumber \u5ba2\u6237\u7aef\u72b6\u6001\n\u4f8b\u5b50\uff1a\nlocal state = mqttc:state()\n-- \u5df2\u77e5\u72b6\u6001:\n-- 0: MQTT_STATE_DISCONNECT\n-- 1: MQTT_STATE_CONNECTING\n-- 2: MQTT_STATE_CONNECTED\n-- 3: MQTT_STATE_READY\n-- 4: MQTT_STATE_ERROR\n", "prefix": "mqttc:state"}, "mqttc:will": {"body": "mqttc:will(${1:topic},${2:payload},${3:qos},${4:retain})", "description": "mqttc:will(topic, payload, qos, retain) - \u8bbe\u7f6e\u9057\u5631\u6d88\u606f\n\u4f20\u5165\u503c\uff1a\nstring \u9057\u5631\u6d88\u606f\u7684topic\nstring \u9057\u5631\u6d88\u606f\u7684payload\nstring \u9057\u5631\u6d88\u606f\u7684qos, \u9ed8\u8ba40, \u53ef\u4ee5\u4e0d\u586b\nstring \u9057\u5631\u6d88\u606f\u7684retain, \u9ed8\u8ba40, \u53ef\u4ee5\u4e0d\u586b\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u8981\u5728connect\u4e4b\u524d\u8c03\u7528\nmqttc:will(\"/xxx/xxx\", \"xxxxxx\")\n", "prefix": "mqttc:will"}, "napt.init": {"body": "napt.init(${1:adapter})", "description": "napt.init(adapter) - \u521d\u59cb\u5316NAPT\n\u4f20\u5165\u503c\uff1a\nint adapter \u76ee\u6807\u7f51\u5361\u7d22\u5f15, \u9ed8\u8ba4\u662fsocket.LWIP_AP, \u8fd9\u91cc\u6307\u5185\u7f51\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "napt.init"}, "napt.rebuild": {"body": "napt.rebuild(${1:buff},${2:is_inet},${3:adapter})", "description": "napt.rebuild(buff, is_inet, adapter) - \u91cd\u5efaMAC\u5305\n\u4f20\u5165\u503c\uff1a\nuserdata \u5f85\u5904\u7406\u7684MAC\u5305,\u5fc5\u987b\u662fzbuff\u5bf9\u8c61\nbool \u6765\u6e90\u662f\u4e0d\u662f\u5185\u7f51\nint \u76ee\u6807\u7f51\u7edc\u9002\u914d\u5668\u7684\u7d22\u5f15, \u4f8b\u5982socket.LWIP_GP\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5931\u8d25\u8fd4\u56defalse\n", "prefix": "napt.rebuild"}, "napt.check": {"body": "napt.check()", "description": "napt.check() - \u68c0\u67e5\u548c\u6e05\u7406NAT\u8868\n\u4f20\u5165\u503c\uff1a\nreturn nil\n\u4f8b\u5b50\uff1a\n-- \u4e24\u6b21check\u4e4b\u95f4\u6ca1\u6709\u6570\u636e\u5305\u7684\u6620\u5c04\u8bb0\u5f55,\u4f1a\u88ab\u6e05\u7406\n", "prefix": "napt.check"}, "nes.init": {"body": "nes.init(${1:file_path})", "description": "nes.init(file_path) - nes\u6a21\u62df\u5668\u521d\u59cb\u5316\n\u4f20\u5165\u503c\uff1a\nstring file_path \u6587\u4ef6\u8def\u5f84\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nnes.init(\"/luadb/super_mario.nes\")\n", "prefix": "nes.init"}, "nes.key": {"body": "nes.key(${1:key},${2:val})", "description": "nes.key(key,val) - nes\u6a21\u62df\u5668\u521d\u59cb\u5316\n\u4f20\u5165\u503c\uff1a\nnumber key \u6309\u952e\nnumber val \u72b6\u6001 1\u6309\u4e0b 0\u62ac\u8d77\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nnes.init(\"/luadb/super_mario.nes\")\n", "prefix": "nes.key"}, "nimble.init": {"body": "nimble.init(${1:name})", "description": "nimble.init(name) - \u521d\u59cb\u5316BLE\u4e0a\u4e0b\u6587,\u5f00\u59cb\u5bf9\u5916\u5e7f\u64ad/\u626b\u63cf\n\u4f20\u5165\u503c\uff1a\nstring \u84dd\u7259\u8bbe\u5907\u540d\u79f0,\u53ef\u9009,\u5efa\u8bae\u586b\u5199\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003 demo/nimble\n-- \u672c\u51fd\u6570\u5bf9\u6240\u6709\u6a21\u5f0f\u90fd\u9002\u7528\n", "prefix": "nimble.init"}, "nimble.deinit": {"body": "nimble.deinit()", "description": "nimble.deinit() - \u5173\u95edBLE\u4e0a\u4e0b\u6587\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u4ec5\u90e8\u5206\u8bbe\u5907\u652f\u6301,\u5f53\u524d\u53ef\u80fd\u90fd\u4e0d\u652f\u6301\n-- \u672c\u51fd\u6570\u5bf9\u6240\u6709\u6a21\u5f0f\u90fd\u9002\u7528\n", "prefix": "nimble.deinit"}, "nimble.mode": {"body": "nimble.mode(${1:tp})", "description": "nimble.mode(tp) - \u8bbe\u7f6e\u6a21\u5f0f\n\u4f20\u5165\u503c\uff1a\nint \u6a21\u5f0f, \u9ed8\u8ba4server/peripheral, \u53ef\u9009 client/central\u6a21\u5f0f nimble.MODE_BLE_CLIENT\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003 demo/nimble\n-- \u5fc5\u987b\u5728nimble.init()\u4e4b\u524d\u8c03\u7528\n-- nimble.mode(nimble.MODE_BLE_CLIENT) -- \u7b80\u79f0\u4ece\u673a\u6a21\u5f0f,\u672a\u5b8c\u5584\n", "prefix": "nimble.mode"}, "nimble.connok": {"body": "nimble.connok()", "description": "nimble.connok() - \u662f\u5426\u5df2\u7ecf\u5efa\u7acb\u8fde\u63a5\n\u8fd4\u56de\u503c\uff1a\nbool \u5df2\u8fde\u63a5\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nlog.info(\"ble\", \"connected?\", nimble.connok())\n-- \u4ece\u673aperipheral\u6a21\u5f0f, \u8bbe\u5907\u662f\u5426\u5df2\u7ecf\u88ab\u8fde\u63a5\n-- \u4e3b\u673acentral\u6a21\u5f0f, \u662f\u5426\u5df2\u7ecf\u8fde\u63a5\u5230\u8bbe\u5907\n-- ibeacon\u6a21\u5f0f, \u65e0\u610f\u4e49\n", "prefix": "nimble.connok"}, "nimble.send_msg": {"body": "nimble.send_msg(${1:conn},${2:handle},${3:data})", "description": "nimble.send_msg(conn, handle, data) - \u53d1\u9001\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nint \u8fde\u63a5id, \u5f53\u524d\u56fa\u5b9a\u586b1\nint \u5904\u7406id, \u5f53\u524d\u56fa\u5b9a\u586b0\nstring \u6570\u636e\u5b57\u7b26\u4e32,\u53ef\u5305\u542b\u4e0d\u53ef\u89c1\u5b57\u7b26\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003 demo/nimble\n-- \u672c\u51fd\u6570\u5bf9peripheral/\u4ece\u673a\u6a21\u5f0f\u9002\u7528\n", "prefix": "nimble.send_msg"}, "nimble.setUUID": {"body": "nimble.setUUID(${1:tp},${2:addr})", "description": "nimble.setUUID(tp, addr) - \u8bbe\u7f6eserver/peripheral\u7684UUID\n\u4f20\u5165\u503c\uff1a\nstring \u914d\u7f6e\u5b57\u7b26\u4e32,\u540e\u9762\u7684\u793a\u4f8b\u6709\u8bf4\u660e\nstring \u5730\u5740\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003 demo/nimble, 2023-02-25\u4e4b\u540e\u7f16\u8bd1\u7684\u56fa\u4ef6\u652f\u6301\u672cAPI\n-- \u5fc5\u987b\u5728nimble.init()\u4e4b\u524d\u8c03\u7528\n-- \u672c\u51fd\u6570\u5bf9peripheral/\u4ece\u673a\u6a21\u5f0f\u9002\u7528\n\n-- \u8bbe\u7f6eSERVER/Peripheral\u6a21\u5f0f\u4e0b\u7684UUID, \u652f\u6301\u8bbe\u7f6e3\u4e2a\n-- \u5730\u5740\u652f\u6301 2/4/16\u5b57\u8282, \u9700\u8981\u4e8c\u8fdb\u5236\u6570\u636e\n-- 2\u5b57\u8282\u5730\u5740\u793a\u4f8b: AABB, \u5199 string.fromHex(\"AABB\") ,\u6216\u8005 string.char(0xAA, 0xBB)\n-- 4\u5b57\u8282\u5730\u5740\u793a\u4f8b: AABBCCDD , \u5199 string.fromHex(\"AABBCCDD\") ,\u6216\u8005 string.char(0xAA, 0xBB, 0xCC, 0xDD)\nnimble.setUUID(\"srv\", string.fromHex(\"380D\")) -- \u670d\u52a1\u4e3bUUID , \u9ed8\u8ba4\u503c 180D\nnimble.setUUID(\"write\", string.fromHex(\"FF31\")) -- \u5f80\u672c\u8bbe\u5907\u5199\u6570\u636e\u7684UUID, \u9ed8\u8ba4\u503c FFF1\nnimble.setUUID(\"indicate\", string.fromHex(\"FF32\")) -- \u8ba2\u9605\u672c\u8bbe\u5907\u7684\u6570\u636e\u7684UUID,\u9ed8\u8ba4\u503c FFF2\n", "prefix": "nimble.setUUID"}, "nimble.mac": {"body": "nimble.mac(${1:mac})", "description": "nimble.mac(mac) - \u83b7\u53d6\u84dd\u7259MAC\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u8bbe\u7f6e\u7684MAC\u5730\u5740, 6\u5b57\u8282, \u4e0d\u4f20\u5c31\u662f\u5355\u83b7\u53d6\n\u8fd4\u56de\u503c\uff1a\nstring \u84dd\u7259MAC\u5730\u5740,6\u5b57\u8282\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003 demo/nimble, 2023-02-25\u4e4b\u540e\u7f16\u8bd1\u7684\u56fa\u4ef6\u652f\u6301\u672cAPI\n-- \u672c\u51fd\u6570\u5bf9\u6240\u6709\u6a21\u5f0f\u90fd\u9002\u7528\nlocal mac = nimble.mac()\nlog.info(\"ble\", \"mac\", mac and mac:toHex() or \"Unknwn\")\n\n-- \u4fee\u6539MAC\u5730\u5740, 2024.06.05 \u65b0\u589e, \u5f53\u524d\u4ec5Air601\u652f\u6301, \u4fee\u6539\u540e\u91cd\u542f\u751f\u6548\nnimble.mac(string.fromHex(\"1234567890AB\"))\n", "prefix": "nimble.mac"}, "nimble.sendNotify": {"body": "nimble.sendNotify(${1:srv_uuid},${2:chr_uuid},${3:data})", "description": "nimble.sendNotify(srv_uuid, chr_uuid, data) - \u53d1\u9001notify\n\u4f20\u5165\u503c\uff1a\nstring \u670d\u52a1\u7684UUID,\u9884\u7559,\u5f53\u524d\u586bnil\u5c31\u884c\nstring \u7279\u5f81\u7684UUID,\u5fc5\u987b\u586b\u5199\nstring \u6570\u636e, \u5fc5\u586b, \u8ddfMTU\u5927\u5c0f\u76f8\u5173, \u4e00\u822c\u4e0d\u8981\u8d85\u8fc7256\u5b57\u8282\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e 2023.07.31 \u65b0\u589e\n-- \u672c\u51fd\u6570\u5bf9peripheral\u6a21\u5f0f\u9002\u7528\nnimble.sendNotify(nil, string.fromHex(\"FF01\"), string.char(0x31, 0x32, 0x33, 0x34, 0x35))\n", "prefix": "nimble.sendNotify"}, "nimble.sendIndicate": {"body": "nimble.sendIndicate(${1:srv_uuid},${2:chr_uuid},${3:data})", "description": "nimble.sendIndicate(srv_uuid, chr_uuid, data) - \u53d1\u9001indicate\n\u4f20\u5165\u503c\uff1a\nstring \u670d\u52a1\u7684UUID,\u9884\u7559,\u5f53\u524d\u586bnil\u5c31\u884c\nstring \u7279\u5f81\u7684UUID,\u5fc5\u987b\u586b\u5199\nstring \u6570\u636e, \u5fc5\u586b, \u8ddfMTU\u5927\u5c0f\u76f8\u5173, \u4e00\u822c\u4e0d\u8981\u8d85\u8fc7256\u5b57\u8282\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e 2023.07.31 \u65b0\u589e\n-- \u672c\u51fd\u6570\u5bf9peripheral\u6a21\u5f0f\u9002\u7528\nnimble.sendIndicate(nil, string.fromHex(\"FF01\"), string.char(0x31, 0x32, 0x33, 0x34, 0x35))\n", "prefix": "nimble.sendIndicate"}, "nimble.advParams": {"body": "nimble.advParams(${1:conn_mode},${2:disc_mode},${3:itvl_min},${4:itvl_max},${5:channel_map},${6:filter_policy},${7:high_duty_cycle})", "description": "nimble.advParams(conn_mode, disc_mode, itvl_min, itvl_max, channel_map, filter_policy, high_duty_cycle) - \u8bbe\u7f6e\u5e7f\u64ad\u53c2\u6570\n\u4f20\u5165\u503c\uff1a\nint \u5e7f\u64ad\u6a21\u5f0f, 0 - \u4e0d\u53ef\u8fde\u63a5, 1 - \u5b9a\u5411\u8fde\u63a5, 2 - \u672a\u5b9a\u5411\u8fde\u63a5, \u9ed8\u8ba40\nint \u53d1\u73b0\u6a21\u5f0f, 0 - \u4e0d\u53ef\u53d1\u73b0, 1 - \u9650\u5236\u53d1\u73b0, 3 - \u901a\u7528\u53d1\u73b0, \u9ed8\u8ba40\nint \u6700\u5c0f\u5e7f\u64ad\u95f4\u9694, 0 - \u4f7f\u7528\u9ed8\u8ba4\u503c, \u8303\u56f4 1 - 65535, \u5355\u4f4d0.625ms, \u9ed8\u8ba40\nint \u6700\u5927\u5e7f\u64ad\u95f4\u9694, 0 - \u4f7f\u7528\u9ed8\u8ba4\u503c, \u8303\u56f4 1 - 65535, \u5355\u4f4d0.625ms, \u9ed8\u8ba40\nint \u5e7f\u64ad\u901a\u9053, \u9ed8\u8ba40, \u4e00\u822c\u4e0d\u9700\u8981\u8bbe\u7f6e\nint \u8fc7\u6ee4\u89c4\u5219, \u9ed8\u8ba40, \u4e00\u822c\u4e0d\u9700\u8981\u8bbe\u7f6e\nint \u5f53\u5e7f\u64ad\u6a21\u5f0f\u4e3a\"\u5b9a\u5411\u8fde\u63a5\"\u65f6,\u662f\u5426\u4f7f\u7528\u9ad8\u5360\u7a7a\u6bd4\u6a21\u5f0f, \u9ed8\u8ba40, \u53ef\u90091\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u5f53\u524d\u4ec5ibeacon\u6a21\u5f0f/peripheral/\u4ece\u673a\u53ef\u4f7f\u7528\n-- \u4f8b\u5982\u8bbe\u7f6e \u4e0d\u53ef\u8fde\u63a5 + \u9650\u5236\u53d1\u73b0\n-- \u9700\u8981\u5728nimble.init\u4e4b\u524d\u8bbe\u7f6e\u597d\nnimble.advParams(0, 1)\n-- \u6ce8\u610fperipheral\u6a21\u5f0f\u4e0b\u81ea\u52a8\u914d\u7f6e conn_mode \u548c disc_mode\n", "prefix": "nimble.advParams"}, "nimble.setChr": {"body": "nimble.setChr(${1:index},${2:uuid},${3:flags})", "description": "nimble.setChr(index, uuid, flags) - \u8bbe\u7f6echr\u7684\u7279\u5f81\n\u4f20\u5165\u503c\uff1a\nint chr\u7684\u7d22\u5f15, \u9ed8\u8ba40-3\nint chr\u7684UUID, \u53ef\u4ee5\u662f2/4/16\u5b57\u8282\nint chr\u7684FLAGS, \u8bf7\u67e5\u9605\u5e38\u91cf\u8868\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u4ec5peripheral/\u4ece\u673a\u53ef\u4f7f\u7528\nnimble.setChr(0, string.fromHex(\"FF01\"), nimble.CHR_F_WRITE_NO_RSP | nimble.CHR_F_NOTIFY)\nnimble.setChr(1, string.fromHex(\"FF02\"), nimble.CHR_F_READ | nimble.CHR_F_NOTIFY)\nnimble.setChr(2, string.fromHex(\"FF03\"), nimble.CHR_F_WRITE_NO_RSP)\n-- \u53ef\u67e5\u9605 demo/nimble/kt6368a\n", "prefix": "nimble.setChr"}, "nimble.config": {"body": "nimble.config(${1:id},${2:value})", "description": "nimble.config(id, value) - \u8bbe\u7f6echr\u7684\u7279\u5f81\n\u4f20\u5165\u503c\uff1a\nint \u914d\u7f6e\u7684id,\u8bf7\u67e5\u9605\u5e38\u91cf\u8868\nany \u6839\u636e\u914d\u7f6e\u7684\u4e0d\u540c, \u6709\u4e0d\u540c\u7684\u53ef\u9009\u503c\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5728\u4efb\u610f\u6a21\u5f0f\u53ef\u7528\n-- \u672cAPI\u4e8e 2023.07.31 \u65b0\u589e\n-- \u4f8b\u5982\u8bbe\u7f6e\u5730\u5740\u8f6c\u6362\u7684\u5927\u5c0f\u7aef, \u9ed8\u8ba4\u662f0, \u517c\u5bb9\u8001\u7684\u4ee3\u7801\n-- \u8bbe\u7f6e\u62101, \u670d\u52a1UUID\u548cchr\u7684UUID\u66f4\u76f4\u89c2\nnimble.config(nimble.CFG_ADDR_ORDER, 1)\n", "prefix": "nimble.config"}, "nimble.ibeacon": {"body": "nimble.ibeacon(${1:data},${2:major},${3:minor},${4:measured_power})", "description": "nimble.ibeacon(data, major, minor, measured_power) - \u914d\u7f6eiBeacon\u7684\u53c2\u6570,\u4ec5iBeacon\u6a21\u5f0f\u53ef\u7528\n\u4f20\u5165\u503c\uff1a\nstring \u6570\u636e, \u5fc5\u987b\u662f16\u5b57\u8282\nint \u4e3b\u7248\u672c\u53f7,\u9ed8\u8ba42, \u53ef\u9009, \u8303\u56f4 0 ~ 65536\nint \u6b21\u7248\u672c\u53f7,\u9ed8\u8ba410,\u53ef\u9009, \u8303\u56f4 0 ~ 65536\nint \u540d\u4e49\u529f\u7387, \u9ed8\u8ba40, \u8303\u56f4 -126 \u5230 20 \n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003 demo/nimble, 2023-02-25\u4e4b\u540e\u7f16\u8bd1\u7684\u56fa\u4ef6\u652f\u6301\u672cAPI\n-- \u672c\u51fd\u6570\u5bf9ibeacon\u6a21\u5f0f\u9002\u7528\nnimble.ibeacon(data, 2, 10, 0)\nnimble.init()\n", "prefix": "nimble.ibeacon"}, "nimble.advData": {"body": "nimble.advData(${1:data},${2:flags})", "description": "nimble.advData(data, flags) - \u914d\u7f6e\u5e7f\u64ad\u6570\u636e,\u4ec5iBeacon\u6a21\u5f0f\u53ef\u7528\n\u4f20\u5165\u503c\uff1a\nstring \u5e7f\u64ad\u6570\u636e, \u5f53\u524d\u6700\u9ad8128\u5b57\u8282\nint \u5e7f\u64ad\u6807\u8bc6, \u53ef\u9009, \u9ed8\u8ba4\u503c\u662f 0x06,\u5373 \u4e0d\u652f\u6301\u4f20\u7edf\u84dd\u7259(0x04) + \u666e\u901a\u53d1\u73b0\u6a21\u5f0f(0x02)\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003 demo/nimble/adv_free, 2023-03-18\u4e4b\u540e\u7f16\u8bd1\u7684\u56fa\u4ef6\u652f\u6301\u672cAPI\n-- \u672c\u51fd\u6570\u5bf9ibeacon\u6a21\u5f0f\u9002\u7528\n-- \u6570\u636e\u6765\u6e90\u53ef\u4ee5\u591a\u79cd\u591a\u6837\nlocal data = string.fromHex(\"123487651234876512348765123487651234876512348765\")\n-- local data = crypto.trng(25)\n-- local data = string.char(0x11, 0x13, 0xA3, 0x5A, 0x11, 0x13, 0xA3, 0x5A, 0x11, 0x13, 0xA3, 0x5A, 0x11, 0x13, 0xA3, 0x5A)\nnimble.advData(data)\nnimble.init()\n\n-- nimble\u652f\u6301\u5728init\u4e4b\u540e\u7684\u4efb\u610f\u65f6\u523b\u518d\u6b21\u8c03\u7528, \u4ee5\u5b9e\u73b0\u6570\u636e\u66f4\u65b0\n-- \u4f8b\u5982 1\u5206\u949f\u53d8\u4e00\u6b21\nwhile 1 do\n sys.wait(60000)\n local data = crypto.trng(25)\n nimble.advData(data)\nend\n", "prefix": "nimble.advData"}, "nimble.scan": {"body": "nimble.scan(${1:timeout})", "description": "nimble.scan(timeout) - \u626b\u63cf\u4ece\u673a\n\u4f20\u5165\u503c\uff1a\nint \u8d85\u65f6\u65f6\u95f4,\u5355\u4f4d\u79d2,\u9ed8\u8ba428\u79d2\n\u8fd4\u56de\u503c\uff1a\nbool \u542f\u52a8\u626b\u63cf\u6210\u529f\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003 demo/nimble/scan\n-- \u672c\u51fd\u6570\u5bf9central/\u4e3b\u673a\u6a21\u5f0f\u9002\u7528\n-- \u672c\u51fd\u6570\u4f1a\u76f4\u63a5\u8fd4\u56de, \u7136\u540e\u901a\u8fc7\u5f02\u6b65\u56de\u8c03\u8fd4\u56de\u7ed3\u679c\n\n-- \u8c03\u7528\u672c\u51fd\u6570\u524d, \u9700\u8981\u5148\u786e\u4fdd\u5df2\u7ecfnimble.init()\nnimble.scan()\n-- timeout\u53c2\u6570\u4e8e 2023.7.11 \u6dfb\u52a0\n", "prefix": "nimble.scan"}, "nimble.connect": {"body": "nimble.connect(${1:mac})", "description": "nimble.connect(mac) - \u8fde\u63a5\u5230\u4ece\u673a\n\u4f20\u5165\u503c\uff1a\nstring \u8bbe\u5907\u7684MAC\u5730\u5740\n\u8fd4\u56de\u503c\uff1a\nbool \u542f\u52a8\u8fde\u63a5\u6210\u529f\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5bf9central/\u4e3b\u673a\u6a21\u5f0f\u9002\u7528\n-- \u672c\u51fd\u6570\u4f1a\u76f4\u63a5\u8fd4\u56de, \u7136\u540e\u901a\u8fc7\u5f02\u6b65\u56de\u8c03\u8fd4\u56de\u7ed3\u679c\n", "prefix": "nimble.connect"}, "nimble.disconnect": {"body": "nimble.disconnect()", "description": "nimble.disconnect() - \u65ad\u5f00\u4e0e\u4ece\u673a\u7684\u8fde\u63a5\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5bf9central/\u4e3b\u673a\u6a21\u5f0f\u9002\u7528\n-- \u672c\u51fd\u6570\u4f1a\u76f4\u63a5\u8fd4\u56de\n", "prefix": "nimble.disconnect"}, "nimble.discSvr": {"body": "nimble.discSvr()", "description": "nimble.discSvr() - \u626b\u63cf\u4ece\u673a\u7684\u670d\u52a1\u5217\u8868\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5bf9central/\u4e3b\u673a\u6a21\u5f0f\u9002\u7528\n-- \u672c\u51fd\u6570\u4f1a\u76f4\u63a5\u8fd4\u56de,\u7136\u540e\u5f02\u6b65\u8fd4\u56de\u7ed3\u679c\n-- \u8fd9\u4e2aAPI\u901a\u5e38\u4e0d\u9700\u8981\u8c03\u7528, \u5728\u8fde\u63a5\u4ece\u673a\u5b8c\u6210\u540e,\u4f1a\u4e3b\u52a8\u8c03\u7528\u4e00\u6b21\n", "prefix": "nimble.discSvr"}, "nimble.listSvr": {"body": "nimble.listSvr()", "description": "nimble.listSvr() - \u83b7\u53d6\u4ece\u673a\u7684\u670d\u52a1\u5217\u8868\n\u8fd4\u56de\u503c\uff1a\ntable \u670d\u52a1UUID\u7684\u6570\u7ec4\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5bf9central/\u4e3b\u673a\u6a21\u5f0f\u9002\u7528\n", "prefix": "nimble.listSvr"}, "nimble.discChr": {"body": "nimble.discChr(${1:svr_uuid})", "description": "nimble.discChr(svr_uuid) - \u626b\u63cf\u4ece\u673a\u7684\u6307\u5b9a\u670d\u52a1\u7684\u7279\u5f81\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u6307\u5b9a\u670d\u52a1\u7684UUID\u503c\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u542f\u52a8\u626b\u63cf\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5bf9central/\u4e3b\u673a\u6a21\u5f0f\u9002\u7528\n", "prefix": "nimble.discChr"}, "nimble.listChr": {"body": "nimble.listChr(${1:svr_uuid})", "description": "nimble.listChr(svr_uuid) - \u83b7\u53d6\u4ece\u673a\u7684\u6307\u5b9a\u670d\u52a1\u7684\u7279\u5f81\u503c\u5217\u8868\n\u4f20\u5165\u503c\uff1a\nstring \u6307\u5b9a\u670d\u52a1\u7684UUID\u503c\n\u8fd4\u56de\u503c\uff1a\ntable \u7279\u5f81\u503c\u5217\u8868,\u5305\u542bUUID\u548cflags\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5bf9central/\u4e3b\u673a\u6a21\u5f0f\u9002\u7528\n", "prefix": "nimble.listChr"}, "nimble.discDsc": {"body": "nimble.discDsc(${1:svr_uuid},${2:chr_uuid})", "description": "nimble.discDsc(svr_uuid, chr_uuid) - \u626b\u63cf\u4ece\u673a\u7684\u6307\u5b9a\u670d\u52a1\u7684\u7279\u5f81\u503c\u7684\u5176\u4ed6\u5c5e\u6027\n\u4f20\u5165\u503c\uff1a\nstring \u6307\u5b9a\u670d\u52a1\u7684UUID\u503c\nstring \u7279\u5f81\u503c\u7684UUID\u503c\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u542f\u52a8\u626b\u63cf\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5bf9central/\u4e3b\u673a\u6a21\u5f0f\u9002\u7528\n", "prefix": "nimble.discDsc"}, "nimble.writeChr": {"body": "nimble.writeChr(${1:svr_uuid},${2:chr_uuid},${3:data})", "description": "nimble.writeChr(svr_uuid, chr_uuid, data) - \u5f80\u6307\u5b9a\u7684\u670d\u52a1\u7684\u6307\u5b9a\u7279\u5f81\u503c\u5199\u5165\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring \u6307\u5b9a\u670d\u52a1\u7684UUID\u503c\nstring \u6307\u5b9a\u7279\u5f81\u503c\u7684UUID\u503c\nstring \u5f85\u5199\u5165\u7684\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u542f\u52a8\u5199\u5165\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5bf9central/\u4e3b\u673a\u6a21\u5f0f\u9002\u7528\n", "prefix": "nimble.writeChr"}, "nimble.readChr": {"body": "nimble.readChr(${1:svr_uuid},${2:chr_uuid})", "description": "nimble.readChr(svr_uuid, chr_uuid) - \u4ece\u6307\u5b9a\u7684\u670d\u52a1\u7684\u6307\u5b9a\u7279\u5f81\u503c\u8bfb\u53d6\u6570\u636e(\u5f02\u6b65)\n\u4f20\u5165\u503c\uff1a\nstring \u6307\u5b9a\u670d\u52a1\u7684UUID\u503c\nstring \u6307\u5b9a\u7279\u5f81\u503c\u7684UUID\u503c\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u542f\u52a8\u5199\u5165\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5bf9central/\u4e3b\u673a\u6a21\u5f0f\u9002\u7528\n-- \u8be6\u7ec6\u7528\u6cd5\u8bf7\u53c2\u6570 demo/nimble/central\n", "prefix": "nimble.readChr"}, "nimble.subChr": {"body": "nimble.subChr(${1:svr_uuid},${2:chr_uuid})", "description": "nimble.subChr(svr_uuid, chr_uuid) - \u8ba2\u9605\u6307\u5b9a\u7684\u670d\u52a1\u7684\u6307\u5b9a\u7279\u5f81\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u6307\u5b9a\u670d\u52a1\u7684UUID\u503c\nstring \u6307\u5b9a\u7279\u5f81\u503c\u7684UUID\u503c\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u542f\u52a8\u8ba2\u9605\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5bf9central/\u4e3b\u673a\u6a21\u5f0f\u9002\u7528\n-- \u8be6\u7ec6\u7528\u6cd5\u8bf7\u53c2\u6570 demo/nimble/central\n", "prefix": "nimble.subChr"}, "nimble.unsubChr": {"body": "nimble.unsubChr(${1:svr_uuid},${2:chr_uuid})", "description": "nimble.unsubChr(svr_uuid, chr_uuid) - \u53d6\u6d88\u8ba2\u9605\u6307\u5b9a\u7684\u670d\u52a1\u7684\u6307\u5b9a\u7279\u5f81\u503c\n\u4f20\u5165\u503c\uff1a\nstring \u6307\u5b9a\u670d\u52a1\u7684UUID\u503c\nstring \u6307\u5b9a\u7279\u5f81\u503c\u7684UUID\u503c\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u542f\u52a8\u53d6\u6d88\u8ba2\u9605\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5bf9central/\u4e3b\u673a\u6a21\u5f0f\u9002\u7528\n-- \u8be6\u7ec6\u7528\u6cd5\u8bf7\u53c2\u6570 demo/nimble/central\n", "prefix": "nimble.unsubChr"}, "onewire.ds18b20": {"body": "onewire.ds18b20(${1:mode},${2:pin},${3:check})", "description": "onewire.ds18b20(mode, pin, check) - \u8bfb\u53d6DS18B20\n\u4f20\u5165\u503c\uff1a\nint GPIO\u6a21\u5f0f\u5bf9\u5e94GPIO\u7f16\u53f7, HW\u6a21\u5f0f\u6839\u636e\u5b9e\u9645\u786c\u4ef6\u6765\u786e\u5b9a\nboolean \u662f\u5426\u68c0\u67e5\u6570\u636e\u7684CRC\u503c,\u53ef\u9009\nint \u6a21\u5f0f, \u53ea\u80fd\u662f onewire.GPIO \u6216\u8005 onewire.HW,\u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nnumber \u6210\u529f\u8fd4\u56de\u6e29\u5ea6\u503c,\u5426\u5219\u8fd4\u56denil.\u5355\u4f4d 0.1\u6444\u6c0f\u5ea6\n\u4f8b\u5b50\uff1a\n\n-- GPIO\u6a21\u5f0f,\u63a5 GPIO 9\nlocal temp = onewire.ds18b20(9, true, onewire.GPIO)\nif temp then\n log.info(\"\u8bfb\u53d6\u5230\u7684\u6e29\u5ea6\u503c\", temp)\nelse\n log.info(\"\u8bfb\u53d6\u5931\u8d25\")\nend\n\n", "prefix": "onewire.ds18b20"}, "onewire.dht1x": {"body": "onewire.dht1x(${1:mode},${2:pin},${3:check})", "description": "onewire.dht1x(mode, pin, check) - \u8bfb\u53d6DHT11\n\u4f20\u5165\u503c\uff1a\nint GPIO\u6a21\u5f0f\u5bf9\u5e94GPIO\u7f16\u53f7, HW\u6a21\u5f0f\u6839\u636e\u5b9e\u9645\u786c\u4ef6\u6765\u786e\u5b9a\nboolean \u662f\u5426\u68c0\u67e5\u6570\u636e\u7684CRC\u503c,\u53ef\u9009\nint \u6a21\u5f0f, \u53ea\u80fd\u662f onewire.GPIO \u6216\u8005 onewire.HW,\u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nnumber \u6210\u529f\u8fd4\u56de\u6e29\u5ea6\u503c,\u5426\u5219\u8fd4\u56denil.\u5355\u4f4d 0.01\u6444\u6c0f\u5ea6\nnumber \u6210\u529f\u8fd4\u56de\u76f8\u5bf9\u6e7f\u5ea6,\u5426\u5219\u8fd4\u56denil.\u5355\u4f4d 0.01%\n\u4f8b\u5b50\uff1a\n\n-- GPIO\u6a21\u5f0f,\u63a5 GPIO 9\nlocal temp = onewire.dht1x(onewire.GPIO, 9, true)\nif temp then\n log.info(\"\u8bfb\u53d6\u5230\u7684\u6e29\u5ea6\u503c\", temp)\nelse\n log.info(\"\u8bfb\u53d6\u5931\u8d25\")\nend\n\n", "prefix": "onewire.dht1x"}, "otp.read": {"body": "otp.read(${1:zone},${2:offset},${3:len})", "description": "otp.read(zone, offset, len) - \u8bfb\u53d6\u6307\u5b9aOTP\u533a\u57df\u8bfb\u53d6\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u533a\u57df, \u901a\u5e38\u4e3a0/1/2/3, \u4e0e\u5177\u4f53\u786c\u4ef6\u76f8\u5173\nint \u504f\u79fb\u91cf\nint \u8bfb\u53d6\u957f\u5ea6, \u5355\u4f4d\u5b57\u8282, \u5fc5\u987b\u662f4\u7684\u500d\u6570, \u4e0d\u80fd\u8d85\u8fc74096\u5b57\u8282\n\u8fd4\u56de\u503c\uff1a\nstring \u6210\u529f\u8fd4\u56de\u5b57\u7b26\u4e32, \u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n\nlocal otpdata = otp.read(0, 0, 64)\nif otpdata then\n log.info(\"otp\", otpdata:toHex())\nend\n", "prefix": "otp.read"}, "otp.write": {"body": "otp.write(${1:zone},${2:data},${3:offset})", "description": "otp.write(zone, data, offset) - \u5f80\u6307\u5b9aOTP\u533a\u57df\u5199\u5165\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u533a\u57df, \u901a\u5e38\u4e3a0/1/2/3, \u4e0e\u5177\u4f53\u786c\u4ef6\u76f8\u5173\nstring \u6570\u636e, \u957f\u5ea6\u5fc5\u987b\u662f4\u4e2a\u500d\u6570\nint \u504f\u79fb\u91cf\n\u8fd4\u56de\u503c\uff1a\nbooL \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n", "prefix": "otp.write"}, "otp.erase": {"body": "otp.erase(${1:zone})", "description": "otp.erase(zone) - \u64e6\u9664\u6307\u5b9aOTP\u533a\u57df\n\u4f20\u5165\u503c\uff1a\nint \u533a\u57df, \u901a\u5e38\u4e3a0/1/2/3, \u4e0e\u5177\u4f53\u786c\u4ef6\u76f8\u5173\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n", "prefix": "otp.erase"}, "otp.lock": {"body": "otp.lock(${1:zone})", "description": "otp.lock(zone) - \u9501\u5b9aOTP\u533a\u57df. \u7279\u522b\u6ce8\u610f!!\u4e00\u65e6\u52a0\u9501\u5373\u65e0\u6cd5\u89e3\u9501,OTP\u53d8\u6210\u53ea\u8bfb!!!\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n", "prefix": "otp.lock"}, "pack.unpack": {"body": "pack.unpack(${1:string},${2:format},${3:init})", "description": "pack.unpack( string, format, init) - \u89e3\u5305\u5b57\u7b26\u4e32\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u89e3\u5305\u7684\u5b57\u7b26\u4e32\nstring \u683c\u5f0f\u5316\u7b26\u53f7\nint \u9ed8\u8ba4\u503c\u4e3a1\uff0c\u6807\u8bb0\u89e3\u5305\u5f00\u59cb\u7684\u4f4d\u7f6e\n\u8fd4\u56de\u503c\uff1a\nint \u5b57\u7b26\u4e32\u6807\u8bb0\u7684\u4f4d\u7f6e\nany \u7b2c\u4e00\u4e2a\u89e3\u5305\u7684\u503c, \u6839\u636eformat\u503c,\u53ef\u80fd\u6709N\u4e2a\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlocal _,a = pack.unpack(x,\">h\") --\u89e3\u5305\u6210short (2\u5b57\u8282)\n", "prefix": "pack.unpack"}, "pack.pack": {"body": "pack.pack(${1:format},${2:val1},${3:val2},${4:val3},${5:valn})", "description": "pack.pack( format, val1, val2, val3, valn ) - \u6253\u5305\u5b57\u7b26\u4e32\u7684\u503c\n\u4f20\u5165\u503c\uff1a\nstring format \u683c\u5f0f\u5316\u7b26\u53f7\nany \u7b2c\u4e00\u4e2a\u9700\u6253\u5305\u7684\u503c\nany \u7b2c\u4e8c\u4e2a\u9700\u6253\u5305\u7684\u503c\nany \u7b2c\u4e8c\u4e2a\u9700\u6253\u5305\u7684\u503c\nany \u7b2cn\u4e2a\u9700\u6253\u5305\u7684\u503c\n\u8fd4\u56de\u503c\uff1a\nstring \u4e00\u4e2a\u5305\u542b\u6240\u6709\u683c\u5f0f\u5316\u53d8\u91cf\u7684\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\nlocal data = pack.pack('= 2\u662f, \u6700\u5927\u4f11\u7720\u65f6\u957f\u662f740\u5c0f\u65f6\n", "prefix": "pm.dtimerStart"}, "pm.dtimerStop": {"body": "pm.dtimerStop(${1:id})", "description": "pm.dtimerStop(id) - \u5173\u95ed\u5e95\u5c42\u5b9a\u65f6\u5668\n\u4f20\u5165\u503c\uff1a\nint \u5b9a\u65f6\u5668id\n\u4f8b\u5b50\uff1a\n-- \u5173\u95ed\u5e95\u5c42\u5b9a\u65f6\u5668\npm.dtimerStop(0) -- \u5173\u95edid=0\u7684\u5e95\u5c42\u5b9a\u65f6\u5668\n", "prefix": "pm.dtimerStop"}, "pm.dtimerCheck": {"body": "pm.dtimerCheck(${1:id})", "description": "pm.dtimerCheck(id) - \u68c0\u67e5\u5e95\u5c42\u5b9a\u65f6\u5668\u662f\u4e0d\u662f\u5728\u8fd0\u884c\n\u4f20\u5165\u503c\uff1a\nint \u5b9a\u65f6\u5668id\n\u8fd4\u56de\u503c\uff1a\nboolean \u5904\u7406\u7ed3\u679c,true\u8fd8\u5728\u8fd0\u884c\uff0cfalse\u4e0d\u5728\u8fd0\u884c\nnumber \u5982\u679c\u8fd0\u884c,\u8fd0\u884c\u5269\u4f59\u65f6\u95f4,\u5355\u4f4d\u6beb\u79d2(\u9700bsp\u652f\u6301)\n\u4f8b\u5b50\uff1a\n-- \u68c0\u67e5\u5e95\u5c42\u5b9a\u65f6\u5668\u662f\u4e0d\u662f\u5728\u8fd0\u884c\npm.dtimerCheck(0) -- \u68c0\u67e5id=0\u7684\u5e95\u5c42\u5b9a\u65f6\u5668\n", "prefix": "pm.dtimerCheck"}, "dtimerWkId": {"body": "dtimerWkId()", "description": "dtimerWkId() - \u68c0\u67e5\u5b9a\u65f6\u5524\u9192\u662f\u54ea\u4e00\u4e2a\u5b9a\u65f6\u5668\uff0c\u5982\u679c\u4e0d\u662f\u5b9a\u65f6\u5524\u9192\u7684\uff0c\u8fd4\u56de-1\n\u8fd4\u56de\u503c\uff1a\nint \u5904\u7406\u7ed3\u679c >=0 \u662f\u672c\u6b21\u5b9a\u65f6\u5524\u9192\u7684\u5b9a\u65f6\u5668ID\uff0c\u5176\u4ed6\u9519\u8bef\uff0c\u8bf4\u660e\u4e0d\u662f\u5b9a\u65f6\u5524\u9192\u7684\n\u4f8b\u5b50\uff1a\nlocal timer_id = pm.dtimerWkId()\n", "prefix": "dtimerWkId"}, "pm.lastReson": {"body": "pm.lastReson()", "description": "pm.lastReson() - \u5f00\u673a\u539f\u56e0,\u7528\u4e8e\u5224\u65ad\u662f\u4ece\u4f11\u7720\u6a21\u5757\u5f00\u673a,\u8fd8\u662f\u7535\u6e90/\u590d\u4f4d\u5f00\u673a\n\u8fd4\u56de\u503c\uff1a\nint 0-\u4e0a\u7535/\u590d\u4f4d\u5f00\u673a, 1-RTC\u5f00\u673a, 2-WakeupIn/Pad/IO\u5f00\u673a, 3-\u672a\u77e5\u539f\u56e0(Wakeup/RTC\u7686\u6709\u53ef\u80fd)\u5f00\u673a,\u76ee\u524d\u53ea\u6709air101,air103\u4f1a\u6709\u8fd9\u4e2a\u8fd4\u56de\u503c\nint 0-\u666e\u901a\u5f00\u673a(\u4e0a\u7535/\u590d\u4f4d),3-\u6df1\u7761\u7720\u5f00\u673a,4-\u4f11\u7720\u5f00\u673a\nint \u590d\u4f4d\u5f00\u673a\u8be6\u7ec6\u539f\u56e0\uff1a0-powerkey\u6216\u8005\u4e0a\u7535\u5f00\u673a 1-\u5145\u7535\u6216\u8005AT\u6307\u4ee4\u4e0b\u8f7d\u5b8c\u6210\u540e\u5f00\u673a 2-\u95f9\u949f\u5f00\u673a 3-\u8f6f\u4ef6\u91cd\u542f 4-\u672a\u77e5\u539f\u56e0 5-RESET\u952e 6-\u5f02\u5e38\u91cd\u542f 7-\u5de5\u5177\u63a7\u5236\u91cd\u542f 8-\u5185\u90e8\u770b\u95e8\u72d7\u91cd\u542f 9-\u5916\u90e8\u91cd\u542f 10-\u5145\u7535\u5f00\u673a\n\u4f8b\u5b50\uff1a\n-- \u662f\u54ea\u79cd\u65b9\u5f0f\u5f00\u673a\u5462\nlog.info(\"pm\", \"last power reson\", pm.lastReson())\n", "prefix": "pm.lastReson"}, "pm.force": {"body": "pm.force(${1:mode})", "description": "pm.force(mode) - \u5f3a\u5236\u8fdb\u5165\u6307\u5b9a\u7684\u4f11\u7720\u6a21\u5f0f\uff0c\u5ffd\u7565\u67d0\u4e9b\u5916\u8bbe\u7684\u5f71\u54cd\uff0c\u6bd4\u5982USB\n\u4f20\u5165\u503c\uff1a\nint \u4f11\u7720\u6a21\u5f0f\n\u8fd4\u56de\u503c\uff1a\nboolean \u5904\u7406\u7ed3\u679c,\u82e5\u8fd4\u56de\u6210\u529f,\u5927\u6982\u7387\u4f1a\u9a6c\u4e0a\u8fdb\u5165\u8be5\u4f11\u7720\u6a21\u5f0f\n\u4f8b\u5b50\uff1a\n-- \u8bf7\u6c42\u8fdb\u5165\u4f11\u7720\u6a21\u5f0f\npm.force(pm.HIB)\n-- \u79fb\u82afCAT1\u5e73\u53f0\u7cfb\u5217(Air780E/Air700E/Air780EP\u7b49\u7b49), \u8be5\u64cd\u4f5c\u4f1a\u5173\u95edUSB\u901a\u4fe1\n-- \u5524\u9192\u540e\u5982\u9700\u5f00\u542fUSB, \u8bf7\u6253\u5f00USB\u7535\u538b\n--pm.power(pm.USB, true)\n", "prefix": "pm.force"}, "pm.check": {"body": "pm.check()", "description": "pm.check() - \u68c0\u67e5\u4f11\u7720\u72b6\u6001\n\u8fd4\u56de\u503c\uff1a\nboolean \u5904\u7406\u7ed3\u679c,\u5982\u679c\u80fd\u987a\u5229\u8fdb\u5165\u4f11\u7720,\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\nint \u5e95\u5c42\u8fd4\u56de\u503c,0\u4ee3\u8868\u80fd\u8fdb\u5165\u6700\u5e95\u5c42\u4f11\u7720,\u5176\u4ed6\u503c\u4ee3\u8868\u6700\u4f4e\u53ef\u4f11\u7720\u7ea7\u522b\n\u4f8b\u5b50\uff1a\n-- \u8bf7\u6c42\u8fdb\u5165\u4f11\u7720\u6a21\u5f0f,\u7136\u540e\u68c0\u67e5\u662f\u5426\u80fd\u771f\u7684\u4f11\u7720\npm.request(pm.HIB)\nif pm.check() then\n log.info(\"pm\", \"it is ok to hib\")\nelse\n -- \u79fb\u82afCAT1\u5e73\u53f0\u7cfb\u5217(Air780E/Air700E/Air780EP\u7b49\u7b49), \u8be5\u64cd\u4f5c\u4f1a\u5173\u95edUSB\u901a\u4fe1\n pm.force(pm.HIB) -- \u5f3a\u5236\u4f11\u7720\n -- \u5524\u9192\u540e\u5982\u9700\u5f00\u542fUSB, \u8bf7\u6253\u5f00USB\u7535\u538b\n --sys.wait(100)\n --pm.power(pm.USB, true)\nend\n", "prefix": "pm.check"}, "pm.shutdown": {"body": "pm.shutdown()", "description": "pm.shutdown() - \u5173\u673a\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u5f53\u524d\u652f\u6301\u79fb\u82afCAT1\u5e73\u53f0\u7cfb\u5217(Air780E/Air700E/Air780EP\u7b49\u7b49)\n-- \u9700\u89812022-12-22\u4e4b\u540e\u7f16\u8bd1\u7684\u56fa\u4ef6\npm.shutdown()\n", "prefix": "pm.shutdown"}, "pm.reboot": {"body": "pm.reboot()", "description": "pm.reboot() - \u91cd\u542f\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "pm.reboot"}, "pm.power": {"body": "pm.power(${1:id},${2:onoff})", "description": "pm.power(id, onoff) - \u5f00\u542f\u5185\u90e8\u7684\u7535\u6e90\u63a7\u5236\uff0c\u6ce8\u610f\u4e0d\u662f\u6240\u6709\u7684\u5e73\u53f0\u90fd\u652f\u6301\uff0c\u53ef\u80fd\u90e8\u5206\u5e73\u53f0\u652f\u6301\u90e8\u5206\u9009\u9879\uff0c\u770b\u786c\u4ef6\n\u4f20\u5165\u503c\uff1a\nint \u7535\u6e90\u63a7\u5236id,pm.USB pm.GPS\u4e4b\u7c7b\nboolean or int \u5f00\u5173true/1\u5f00\uff0cfalse/0\u5173\uff0c\u9ed8\u8ba4\u5173\uff0c\u90e8\u5206\u9009\u9879\u652f\u6301\u6570\u503c\n\u8fd4\u56de\u503c\uff1a\nboolean \u5904\u7406\u7ed3\u679ctrue\u6210\u529f\uff0cfalse\u5931\u8d25\n\u4f8b\u5b50\uff1a\n-- \u5173\u95edUSB\u7535\u6e90, \u53cd\u4e4b\u5f00\u542f\u5c31\u662f\u4f20true\npm.power(pm.USB, false) \n\n-- Air780EG,\u4e3a\u5185\u7f6e\u7684GPS\u82af\u7247\u4e0a\u7535. \u6ce8\u610f, Air780EG\u7684GPS\u548cGPS_ANT\u662f\u4e00\u8d77\u63a7\u5236\u7684,\u6240\u4ee5\u5408\u5e76\u4e86.\npm.power(pm.GPS, true)\n\n-- \u79fb\u82afCAT1\u5e73\u53f0\u7cfb\u5217(Air780E/Air700E/Air780EP\u7b49\u7b49)\u5f00\u542fpwrkey\u5f00\u673a\u9632\u6296\n-- \u6ce8\u610f: \u5f00\u542f\u540e, \u590d\u4f4d\u952e\u5c31\u53d8\u6210\u5173\u673a\u4e86!!! pwrkey\u8981\u957f\u63092\u79d2\u624d\u80fd\u5f00\u673a\n-- pm.power(pm.PWK_MODE, true)\n\n-- \u79fb\u82afCAT1\u5e73\u53f0\u7cfb\u5217(Air780E/Air700E/Air780EP\u7b49\u7b49)PSM+\u4f4e\u529f\u8017\u8bbe\u7f6e\n-- \u79fb\u82afCAT1\u5e73\u53f0\u7cfb\u5217(Air780E/Air700E/Air780EP\u7b49\u7b49)\u8282\u80fd\u6a21\u5f0f\uff0c0~3\uff0c0\u5b8c\u5168\u5173\u95ed\uff0c1\u6027\u80fd\u4f18\u5148\uff0c2\u5e73\u8861\uff0c3\u6781\u81f4\u529f\u8017\n-- \u8be6\u60c5\u8bbf\u95ee: https://airpsm.cn\n-- pm.power(pm.WORK_MODE, 1)\n", "prefix": "pm.power"}, "pm.ioVol": {"body": "pm.ioVol(${1:id},${2:val})", "description": "pm.ioVol(id, val) - IO\u9ad8\u7535\u5e73\u7535\u538b\u63a7\u5236\n\u4f20\u5165\u503c\uff1a\nint \u7535\u5e73id,\u76ee\u524d\u53ea\u6709pm.IOVOL_ALL_GPIO\nint \u7535\u5e73\u503c,\u5355\u4f4d\u6beb\u4f0f\n\u8fd4\u56de\u503c\uff1a\nboolean \u5904\u7406\u7ed3\u679ctrue\u6210\u529f\uff0cfalse\u5931\u8d25\n\u4f8b\u5b50\uff1a\n-- \u79fb\u82afCAT1\u5e73\u53f0\u7cfb\u5217(Air780E/Air700E/Air780EP\u7b49\u7b49)\u8bbe\u7f6eIO\u7535\u5e73, \u8303\u56f4 1650 ~ 2000\uff0c2650~3400 , \u5355\u4f4d\u6beb\u4f0f, \u6b65\u8fdb50mv\n-- \u6ce8\u610f, \u8fd9\u91cc\u7684\u8bbe\u7f6e\u4f18\u5148\u7ea7\u4f1a\u9ad8\u4e8e\u786c\u4ef6IOSEL\u811a\u7684\u914d\u7f6e\n-- \u4f46\u5f00\u673a\u65f6\u4f9d\u7136\u5148\u4f7f\u7528\u786c\u4ef6\u914d\u7f6e,\u76f4\u81f3\u8c03\u7528\u672cAPI\u8fdb\u884c\u914d\u7f6e, \u6240\u4ee5io\u7535\u5e73\u4f1a\u53d8\u5316\n-- pm.ioVol(pm.IOVOL_ALL_GPIO, 3300) -- \u6240\u6709GPIO\u9ad8\u7535\u5e73\u8f93\u51fa3.3V\n-- pm.ioVol(pm.IOVOL_ALL_GPIO, 1800) -- \u6240\u6709GPIO\u9ad8\u7535\u5e73\u8f93\u51fa1.8V\n", "prefix": "pm.ioVol"}, "pm.wakeupPin": {"body": "pm.wakeupPin(${1:pin},${2:level})", "description": "pm.wakeupPin(pin,level) - \u914d\u7f6e\u5524\u9192\u5f15\u811a (\u5f53\u524d\u4ec5\u4ec5esp\u7cfb\u5217\u53ef\u7528)\n\u4f20\u5165\u503c\uff1a\nint/table gpio\u5f15\u811a\nint \u5524\u9192\u7535\u538b \u53ef\u9009,\u9ed8\u8ba4\u4f4e\u7535\u5e73\u5524\u9192\n\u8fd4\u56de\u503c\uff1a\nboolean \u5904\u7406\u7ed3\u679c\n\u4f8b\u5b50\uff1a\npm.wakeupPin(8,0)\n", "prefix": "pm.wakeupPin"}, "protobuf.load": {"body": "protobuf.load(${1:pbdata})", "description": "protobuf.load(pbdata) - \u52a0\u8f7dpb\u4e8c\u8fdb\u5236\u5b9a\u4e49\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nstring \u901a\u8fc7protoc.exe\u7a0b\u5e8f\u8f6c\u6362\u5f97\u5230\u7684\u6570\u636e,\u901a\u5e38\u4ece\u6587\u4ef6\u8bfb\u53d6\u5f97\u5230\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u4e0e\u5426\nint \u8bfb\u53d6\u4e86\u591a\u957f, \u8c03\u8bd5\u7528\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f, \u540c\u4e00\u4e2a\u6587\u4ef6\u53ea\u9700\u8981\u52a0\u8f7d\u4e00\u6b21, \u9664\u975e\u8c03\u7528\u8fc7protobuf.clear()\nprotobuf.load(io.readFile(\"/luadb/person.pb\"))\n", "prefix": "protobuf.load"}, "protobuf.clear": {"body": "protobuf.clear()", "description": "protobuf.clear() - \u6e05\u9664\u5df2\u52a0\u8f7d\u7684\u4e8c\u8fdb\u5236\u5b9a\u4e49\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c, \u603b\u662f\u6210\u529f\n\u4f8b\u5b50\uff1a\n-- \u6e05\u9664\u6240\u6709\u5df2\u52a0\u8f7d\u7684\u5b9a\u4e49\u6570\u636e\nprotobuf.clear()\n", "prefix": "protobuf.clear"}, "protobuf.encode": {"body": "protobuf.encode(${1:tpname},${2:data})", "description": "protobuf.encode(tpname, data) - \u7f16\u7801protobuffs\u6570\u636e\u5305\n\u4f20\u5165\u503c\uff1a\nstring \u6570\u636e\u7c7b\u578b\u540d\u79f0, \u5b9a\u4e49\u5728pb\u6587\u4ef6\u4e2d, \u7531protobuf.load\u52a0\u8f7d\ntable \u5f85\u7f16\u7801\u6570\u636e, \u5fc5\u987b\u662ftable, \u5185\u5bb9\u7b26\u5408pb\u6587\u4ef6\u91cc\u7684\u5b9a\u4e49\n\u8fd4\u56de\u503c\uff1a\nstring \u7f16\u7801\u540e\u7684\u6570\u636e,\u82e5\u5931\u8d25\u4f1a\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u6570\u636e\u7f16\u7801\nlocal tb = {\n name = \"wendal\"\n}\nlocal pbdata = protobuf.encode(\"Person\", tb)\nif pbdata then\n -- \u6ce8\u610f, \u7f16\u7801\u540e\u7684\u6570\u636e\u901a\u5e38\u5e26\u4e0d\u53ef\u89c1\u5b57\u7b26\n log.info(\"protobuf\", #pbdata, pbdata:toHex())\nend\n", "prefix": "protobuf.encode"}, "protobuf.decode": {"body": "protobuf.decode(${1:tpname},${2:data})", "description": "protobuf.decode(tpname, data) - \u89e3\u7801protobuffs\u6570\u636e\u5305\n\u4f20\u5165\u503c\uff1a\nstring \u6570\u636e\u7c7b\u578b\u540d\u79f0, \u5b9a\u4e49\u5728pb\u6587\u4ef6\u4e2d, \u7531protobuf.load\u52a0\u8f7d\nstring \u5f85\u7f16\u7801\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\ntable \u89e3\u7801\u540e\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u6570\u636e\u7f16\u7801\nlocal tb = {\n name = \"wendal\"\n}\nlocal pbdata = protobuf.encode(\"Person\", tb)\nif pbdata then\n -- \u6ce8\u610f, \u7f16\u7801\u540e\u7684\u6570\u636e\u901a\u5e38\u5e26\u4e0d\u53ef\u89c1\u5b57\u7b26\n log.info(\"protobuf\", #pbdata, pbdata:toHex())\nend\n", "prefix": "protobuf.decode"}, "pwm.open": {"body": "pwm.open(${1:channel},${2:period},${3:pulse},${4:pnum},${5:precision})", "description": "pwm.open(channel, period, pulse, pnum, precision) - \u5f00\u542f\u6307\u5b9a\u7684PWM\u901a\u9053\n\u4f20\u5165\u503c\uff1a\nint PWM\u901a\u9053\nint \u9891\u7387, 1-1000000hz\nint \u5360\u7a7a\u6bd4 0-\u5206\u9891\u7cbe\u5ea6\nint \u8f93\u51fa\u5468\u671f 0\u4e3a\u6301\u7eed\u8f93\u51fa, 1\u4e3a\u5355\u6b21\u8f93\u51fa, \u5176\u4ed6\u4e3a\u6307\u5b9a\u8109\u51b2\u6570\u8f93\u51fa\nint \u5206\u9891\u7cbe\u5ea6, 100/256/1000, \u9ed8\u8ba4\u4e3a100, \u82e5\u8bbe\u5907\u4e0d\u652f\u6301\u4f1a\u6709\u65e5\u5fd7\u63d0\u793a\n\u8fd4\u56de\u503c\uff1a\nboolean \u5904\u7406\u7ed3\u679c,\u6210\u529f\u8fd4\u56detrue,\u5931\u8d25\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u6253\u5f00PWM5, \u9891\u73871kHz, \u5360\u7a7a\u6bd450%\npwm.open(5, 1000, 50)\n-- \u6253\u5f00PWM5, \u9891\u738710kHz, \u5206\u9891\u4e3a 31/256\npwm.open(5, 10000, 31, 0, 256)\n", "prefix": "pwm.open"}, "pwm.close": {"body": "pwm.close(${1:channel})", "description": "pwm.close(channel) - \u5173\u95ed\u6307\u5b9a\u7684PWM\u901a\u9053\n\u4f20\u5165\u503c\uff1a\nint PWM\u901a\u9053\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u5904\u7406\u7ed3\u679c\n\u4f8b\u5b50\uff1a\n-- \u5173\u95edPWM5\npwm.close(5)\n", "prefix": "pwm.close"}, "pwm.capture": {"body": "pwm.capture(${1:channel})", "description": "pwm.capture(channel) - PWM\u6355\u83b7\n\u4f20\u5165\u503c\uff1a\nint PWM\u901a\u9053\nint \u6355\u83b7\u9891\u7387\n\u8fd4\u56de\u503c\uff1a\nboolean \u5904\u7406\u7ed3\u679c,\u6210\u529f\u8fd4\u56detrue,\u5931\u8d25\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- PWM0\u6355\u83b7\nwhile 1 do\n pwm.capture(0,1000)\n local ret,channel,pulse,pwmH,pwmL = sys.waitUntil(\"PWM_CAPTURE\", 2000)\n if ret then\n log.info(\"PWM_CAPTURE\",\"channel\"..channel,\"pulse\"..pulse,\"pwmH\"..pwmH,\"pwmL\"..pwmL)\n end\nend\n", "prefix": "pwm.capture"}, "repl.enable": {"body": "repl.enable(${1:re})", "description": "repl.enable(re) - \u542f\u7528\u6216\u7981\u7528REPL\u529f\u80fd\n\u4f20\u5165\u503c\uff1a\nbool \u542f\u7528\u4e0e\u5426,\u9ed8\u8ba4\u662f\u542f\u7528\nreturn \u4e4b\u524d\u7684\u8bbe\u7f6e\u72b6\u6001\n\u4f8b\u5b50\uff1a\n-- \u82e5\u56fa\u4ef6\u652f\u6301REPL,\u5373\u7f16\u8bd1\u65f6\u542f\u7528\u4e86REPL,\u662f\u9ed8\u8ba4\u542f\u7528REPL\u529f\u80fd\u7684\n-- \u672c\u51fd\u6570\u662f\u63d0\u4f9b\u5173\u95edREPL\u7684\u9014\u5f84\nrepl.enable(false)\n", "prefix": "repl.enable"}, "repl.push": {"body": "repl.push(${1:data})", "description": "repl.push(data) - \u4e3b\u52a8\u63a8\u9001\u5f85\u5904\u7406\u7684\u6570\u636e\u5230\u5e95\u5c42\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u5904\u7406\u7684\u6570\u636e,\u901a\u5e38\u4ece\u4e32\u53e3\u6765\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u865a\u62df\u4e32\u53e3\u7684\u8bbe\u5907\u624d\u9700\u8981\u8fd9\u4e2a\u51fd\u6570\n", "prefix": "repl.push"}, "rsa.encrypt": {"body": "rsa.encrypt(${1:key},${2:data})", "description": "rsa.encrypt(key, data) - RSA\u52a0\u5bc6\n\u4f20\u5165\u503c\uff1a\nstring \u516c\u94a5\u6570\u636e,\u4ec5\u652f\u6301PEM\u683c\u5f0f\nstring \u5f85\u52a0\u5bc6\u6570\u636e, \u4e0d\u80fd\u8d85\u8fc7\u516c\u94a5\u4f4d\u6570\u7684\u4e00\u534a, \u4f8b\u5982 2048bit\u7684\u516c\u94a5, \u53ea\u80fd\u52a0\u5bc6128\u5b57\u8282\u7684\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nstring \u52a0\u5bc6\u6210\u529f\u540e\u7684\u6570\u636e,\u82e5\u5931\u8d25\u4f1a\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u4e0b\u9762\u4ee3\u7801\u4e2d\u7684 \"abc\" \u662f\u5f85\u52a0\u5bc6\u6570\u636e\nlocal res = rsa.encrypt((io.readFile(\"/luadb/public.pem\")), \"abc\")\n-- \u6253\u5370\u7ed3\u679c\nlog.info(\"rsa\", \"encrypt\", res and #res or 0, res and res:toHex() or \"\")\n", "prefix": "rsa.encrypt"}, "rsa.decrypt": {"body": "rsa.decrypt(${1:key},${2:data},${3:pwd})", "description": "rsa.decrypt(key, data, pwd) - RSA\u89e3\u5bc6\n\u4f20\u5165\u503c\uff1a\nstring \u79c1\u94a5\u6570\u636e,\u4ec5\u652f\u6301PEM\u683c\u5f0f\nstring \u5f85\u89e3\u5bc6\u6570\u636e\nstring \u79c1\u94a5\u7684\u5bc6\u7801,\u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nstring \u89e3\u5bc6\u6210\u529f\u540e\u7684\u6570\u636e,\u82e5\u5931\u8d25\u4f1a\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f, \u89e3\u5bc6\u901a\u5e38\u5f88\u6162, \u5efa\u8bae\u5728\u670d\u52a1\u5668\u7aef\u8fdb\u884c\n-- res \u662f\u5f85\u89e3\u5bc6\u7684\u6570\u636e\nlocal dst = rsa.decrypt((io.readFile(\"/luadb/privkey.pem\")), res, \"\")\nlog.info(\"rsa\", \"decrypt\", dst and #dst or 0, dst and dst:toHex() or \"\")\n", "prefix": "rsa.decrypt"}, "rsa.verify": {"body": "rsa.verify(${1:key},${2:md},${3:hash},${4:sig})", "description": "rsa.verify(key, md, hash, sig) - RSA\u9a8c\u7b7e\n\u4f20\u5165\u503c\uff1a\nstring \u516c\u94a5\u6570\u636e,\u4ec5\u652f\u6301PEM\u683c\u5f0f\nint \u7b7e\u540d\u6a21\u5f0f, \u4f8b\u5982 rsa.MD_SHA1 , rsa.MD_SHA256\nstring hash\u6570\u636e, \u5982\u679c\u662fHEX\u5b57\u7b26\u4e32,\u8bb0\u5f97fromHex\u8f6c\u4e8c\u8fdb\u5236\u6570\u636e\nstring sig\u6570\u636e, \u5982\u679c\u662fHEX\u5b57\u7b26\u4e32,\u8bb0\u5f97fromHex\u8f6c\u4e8c\u8fdb\u5236\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nbool \u6709\u6548\u8fd4\u56detrue,\u5426\u5219\u4e3afalse,\u51fa\u9519\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nlocal ret = rsa.verify((io.readFile(\"/luadb/public.pem\")), rsa.MD_SHA1, hash, sig)\nlog.info(\"rsa\", \"verify\", ret)\n", "prefix": "rsa.verify"}, "rsa.sign": {"body": "rsa.sign(${1:key},${2:md},${3:hash},${4:pwd})", "description": "rsa.sign(key, md, hash, pwd) - RSA\u7b7e\u540d\n\u4f20\u5165\u503c\uff1a\nstring \u79c1\u94a5\u6570\u636e,\u4ec5\u652f\u6301PEM\u683c\u5f0f\nint \u7b7e\u540d\u6a21\u5f0f, \u4f8b\u5982 rsa.MD_SHA1 , rsa.MD_SHA256\nstring hash\u6570\u636e, \u5982\u679c\u662fHEX\u5b57\u7b26\u4e32,\u8bb0\u5f97fromHex\u8f6c\u4e8c\u8fdb\u5236\u6570\u636e\nstring \u79c1\u94a5\u5bc6\u7801, \u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nstring \u6210\u529f\u8fd4\u56desig\u6570\u636e, \u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nlocal sig = rsa.sign((io.readFile(\"/luadb/privkey.pem\")), rsa.MD_SHA1, hash, \"\")\nlog.info(\"rsa\", \"sign\", sig and #sig or 0, sig and sig:toHex() or \"\")\n", "prefix": "rsa.sign"}, "rtc.set": {"body": "rtc.set(${1:tab})", "description": "rtc.set(tab) - \u8bbe\u7f6e\u65f6\u949f\n\u4f20\u5165\u503c\uff1a\ntable or int \u65f6\u949f\u53c2\u6570,\u89c1\u793a\u4f8b\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56denil\u6216false\n\u4f8b\u5b50\uff1a\nrtc.set({year=2021,mon=8,day=31,hour=17,min=8,sec=43})\nrtc.set(1652230554)\n", "prefix": "rtc.set"}, "rtc.get": {"body": "rtc.get()", "description": "rtc.get() - \u83b7\u53d6\u65f6\u949f\n\u8fd4\u56de\u503c\uff1a\ntable \u65f6\u949f\u53c2\u6570,\u89c1\u793a\u4f8b\n\u4f8b\u5b50\uff1a\nlocal t = rtc.get()\n-- {year=2021,mon=8,day=31,hour=17,min=8,sec=43}\nlog.info(\"rtc\", json.encode(t))\n", "prefix": "rtc.get"}, "rtc.timerStart": {"body": "rtc.timerStart(${1:id},${2:tab})", "description": "rtc.timerStart(id, tab) - \u8bbe\u7f6eRTC\u5524\u9192\u65f6\u95f4\n\u4f20\u5165\u503c\uff1a\nint \u65f6\u949fid,\u901a\u5e38\u53ea\u652f\u63010\ntable \u65f6\u949f\u53c2\u6570,\u89c1\u793a\u4f8b\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56denil\u6216false\n\u4f8b\u5b50\uff1a\n-- \u76ee\u524d\u8be5\u63a5\u53e3\u4e0d\u9002\u7528\u4e8e\u79fb\u82af\u6a21\u5757780E/700E/780EP\u7cfb\u5217\uff0c\u9700\u8981\u5b9a\u65f6\u5524\u9192\u53ef\u4f7f\u7528pm.dtimerStart()\n-- \u4f7f\u7528\u524d\u5efa\u8bae\u5148rtc.set\u8bbe\u7f6e\u4e3a\u6b63\u786e\u7684\u65f6\u95f4\nrtc.timerStart(0, {year=2021,mon=9,day=1,hour=17,min=8,sec=43})\n", "prefix": "rtc.timerStart"}, "rtc.timerStop": {"body": "rtc.timerStop(${1:id})", "description": "rtc.timerStop(id) - \u53d6\u6d88RTC\u5524\u9192\u65f6\u95f4\n\u4f20\u5165\u503c\uff1a\nint \u65f6\u949fid,\u901a\u5e38\u53ea\u652f\u63010\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56denil\u6216false\n\u4f8b\u5b50\uff1a\nrtc.timerStop(0)\n", "prefix": "rtc.timerStop"}, "rtc.setBaseYear": {"body": "rtc.setBaseYear(${1:Base_year})", "description": "rtc.setBaseYear(Base_year) - \u8bbe\u7f6eRTC\u57fa\u51c6\u5e74,\u4e0d\u63a8\u8350\n\u4f20\u5165\u503c\uff1a\nint \u57fa\u51c6\u5e74Base_year,\u901a\u5e381900\n\u4f8b\u5b50\uff1a\nrtc.setBaseYear(1900)\n", "prefix": "rtc.setBaseYear"}, "rtc.timezone": {"body": "rtc.timezone(${1:tz})", "description": "rtc.timezone(tz) - \u8bfb\u53d6\u6216\u8bbe\u7f6e\u65f6\u533a\n\u4f20\u5165\u503c\uff1a\nint \u65f6\u533a\u503c,\u6ce8\u610f\u5355\u4f4d\u662f1/4\u65f6\u533a.\u4f8b\u5982\u4e1c\u516b\u533a\u662f 32,\u800c\u975e8. \u53ef\u4ee5\u4e0d\u4f20\nreturn \u5f53\u524d/\u8bbe\u7f6e\u540e\u7684\u65f6\u533a\u503c\n\u4f8b\u5b50\uff1a\n-- \u8bbe\u7f6e\u4e3a\u4e1c8\u533a\nrtc.timezone(32)\n-- \u8bbe\u7f6e\u4e3a\u4e1c3\u533a\nrtc.timezone(12)\n-- \u8bbe\u7f6e\u4e3a\u897f4\u533a\nrtc.timezone(-16)\n-- \u6ce8\u610f: \u65e0\u8bba\u8bbe\u7f6e\u65f6\u533a\u662f\u591a\u5c11, rtc.get/set\u603b\u662fUTC\u65f6\u95f4\n-- \u65f6\u533a\u5f71\u54cd\u7684\u662f os.date/os.time \u51fd\u6570\n-- \u53ea\u6709\u90e8\u5206\u6a21\u5757\u652f\u6301\u8bbe\u7f6e\u65f6\u533a, \u4e14\u9ed8\u8ba4\u503c\u4e00\u822c\u4e3a32, \u5373\u4e1c\u516b\u533a\n", "prefix": "rtc.timezone"}, "rtos.receive": {"body": "rtos.receive(${1:timeout})", "description": "rtos.receive(timeout) - \u63a5\u53d7\u5e76\u5904\u7406\u5e95\u5c42\u6d88\u606f\u961f\u5217.\n\u4f20\u5165\u503c\uff1a\nint \u8d85\u65f6\u65f6\u957f,\u901a\u5e38\u662f-1,\u6c38\u4e45\u7b49\u5f85\n\u8fd4\u56de\u503c\uff1a\nmsgid \u5982\u679c\u662f\u5b9a\u65f6\u5668\u6d88\u606f,\u4f1a\u8fd4\u56de\u5b9a\u65f6\u5668\u6d88\u606fid\u53ca\u9644\u52a0\u4fe1\u606f, \u5176\u4ed6\u6d88\u606f\u7531\u5e95\u5c42\u51b3\u5b9a,\u4e0d\u5411lua\u5c42\u8fdb\u884c\u4efb\u4f55\u4fdd\u8bc1.\n", "prefix": "rtos.receive"}, "rtos.timer_start": {"body": "rtos.timer_start(${1:id},${2:timeout},${3:_repeat})", "description": "rtos.timer_start(id,timeout,_repeat) - \u542f\u52a8\u4e00\u4e2a\u5b9a\u65f6\u5668\n\u4f20\u5165\u503c\uff1a\nint \u5b9a\u65f6\u5668id\nint \u8d85\u65f6\u65f6\u957f,\u5355\u4f4d\u6beb\u79d2\nint \u91cd\u590d\u6b21\u6570,\u9ed8\u8ba4\u662f0\n\u8fd4\u56de\u503c\uff1a\nid \u5982\u679c\u662f\u5b9a\u65f6\u5668\u6d88\u606f,\u4f1a\u8fd4\u56de\u5b9a\u65f6\u5668\u6d88\u606fid\u53ca\u9644\u52a0\u4fe1\u606f, \u5176\u4ed6\u6d88\u606f\u7531\u5e95\u5c42\u51b3\u5b9a,\u4e0d\u5411lua\u5c42\u8fdb\u884c\u4efb\u4f55\u4fdd\u8bc1.\n\u4f8b\u5b50\uff1a\n-- \u7528\u6237\u4ee3\u7801\u8bf7\u4f7f\u7528 sys.timerStart\n-- \u542f\u52a8\u4e00\u4e2a3\u79d2\u7684\u5faa\u73af\u5b9a\u65f6\u5668\nrtos.timer_start(10000, 3000, -1)\n", "prefix": "rtos.timer_start"}, "rtos.timer_stop": {"body": "rtos.timer_stop(${1:id})", "description": "rtos.timer_stop(id) - \u5173\u95ed\u5e76\u91ca\u653e\u4e00\u4e2a\u5b9a\u65f6\u5668\n\u4f20\u5165\u503c\uff1a\nint \u5b9a\u65f6\u5668id\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u7528\u6237\u4ee3\u7801\u8bf7\u4f7f\u7528sys.timerStop\nrtos.timer_stop(id)\n", "prefix": "rtos.timer_stop"}, "rtos.reboot": {"body": "rtos.reboot()", "description": "rtos.reboot() - \u8bbe\u5907\u91cd\u542f\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "rtos.reboot"}, "rtos.buildDate": {"body": "rtos.buildDate()", "description": "rtos.buildDate() - \u83b7\u53d6\u56fa\u4ef6\u7f16\u8bd1\u65e5\u671f\n\u8fd4\u56de\u503c\uff1a\nstring \u56fa\u4ef6\u7f16\u8bd1\u65e5\u671f\n\u4f8b\u5b50\uff1a\n-- \u83b7\u53d6\u7f16\u8bd1\u65e5\u671f\nlocal d = rtos.buildDate()\n", "prefix": "rtos.buildDate"}, "rtos.bsp": {"body": "rtos.bsp()", "description": "rtos.bsp() - \u83b7\u53d6\u786c\u4ef6bsp\u578b\u53f7\n\u8fd4\u56de\u503c\uff1a\nstring \u786c\u4ef6bsp\u578b\u53f7\n\u4f8b\u5b50\uff1a\n-- \u83b7\u53d6\u786c\u4ef6bsp\u578b\u53f7\nlocal bsp = rtos.bsp()\n", "prefix": "rtos.bsp"}, "rtos.version": {"body": "rtos.version()", "description": "rtos.version() - \u83b7\u53d6\u56fa\u4ef6\u7248\u672c\u53f7\n\u8fd4\u56de\u503c\uff1a\nstring \u56fa\u4ef6\u7248\u672c\u53f7,\u4f8b\u5982\"V0001\"\n\u4f8b\u5b50\uff1a\n-- \u8bfb\u53d6\u7248\u672c\u53f7\nlocal luatos_version = rtos.version()\n", "prefix": "rtos.version"}, "rtos.standy": {"body": "rtos.standy(${1:timeout})", "description": "rtos.standy(timeout) - \u8fdb\u5165\u5f85\u673a\u6a21\u5f0f, \u4ec5\u90e8\u5206\u8bbe\u5907\u53ef\u7528, \u672cAPI\u5df2\u5e9f\u5f03, \u63a8\u8350\u4f7f\u7528pm\u5e93\n\u4f20\u5165\u503c\uff1a\nint \u4f11\u7720\u65f6\u957f,\u5355\u4f4d\u6beb\u79d2\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u8fdb\u5165\u5f85\u673a\u6a21\u5f0f\nrtos.standby(5000)\n", "prefix": "rtos.standy"}, "rtos.meminfo": {"body": "rtos.meminfo(${1:type})", "description": "rtos.meminfo(type) - \u83b7\u53d6\u5185\u5b58\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\ntype \"sys\"\u7cfb\u7edf\u5185\u5b58, \"lua\"\u865a\u62df\u673a\u5185\u5b58,\"psram\"psram\u5185\u5b58, \u9ed8\u8ba4\u4e3alua\u865a\u62df\u673a\u5185\u5b58\n\u8fd4\u56de\u503c\uff1a\nint \u603b\u5185\u5b58\u5927\u5c0f,\u5355\u4f4d\u5b57\u8282\nint \u5f53\u524d\u5df2\u4f7f\u7528\u7684\u5185\u5b58\u5927\u5c0f,\u5355\u4f4d\u5b57\u8282\nint \u5386\u53f2\u6700\u9ad8\u5df2\u4f7f\u7528\u7684\u5185\u5b58\u5927\u5c0f,\u5355\u4f4d\u5b57\u8282\n\u4f8b\u5b50\uff1a\n-- \u6253\u5370\u5185\u5b58\u5360\u7528\nlog.info(\"mem.lua\", rtos.meminfo())\nlog.info(\"mem.sys\", rtos.meminfo(\"sys\"))\n", "prefix": "rtos.meminfo"}, "rtos.firmware": {"body": "rtos.firmware()", "description": "rtos.firmware() - \u8fd4\u56de\u5e95\u5c42\u63cf\u8ff0\u4fe1\u606f,\u683c\u5f0f\u4e3a LuatOS_$VERSION_$BSP,\u53ef\u7528\u4e8eOTA\u5347\u7ea7\u5224\u65ad\u5e95\u5c42\u4fe1\u606f\n\u8fd4\u56de\u503c\uff1a\nstring \u5e95\u5c42\u63cf\u8ff0\u4fe1\u606f\n\u4f8b\u5b50\uff1a\n-- \u6253\u5370\u5e95\u5c42\u63cf\u8ff0\u4fe1\u606f\nlog.info(\"firmware\", rtos.firmware())\n", "prefix": "rtos.firmware"}, "rtos.setPaths": {"body": "rtos.setPaths(${1:pathA},${2:pathB},${3:pathC},${4:pathD})", "description": "rtos.setPaths(pathA, pathB, pathC, pathD) - \u8bbe\u7f6e\u81ea\u5b9a\u4e49lua\u811a\u672c\u641c\u7d22\u8def\u5f84,\u4f18\u5148\u7ea7\u9ad8\u4e8e\u5185\u7f6e\u8def\u5f84\n\u4f20\u5165\u503c\uff1a\nstring \u8def\u5f84A, \u4f8b\u5982 \"/sdcard/%s.luac\",\u82e5\u4e0d\u4f20\u503c,\u5c06\u9ed8\u8ba4\u4e3a\"\",\u53e6\u5916,\u6700\u5927\u957f\u5ea6\u4e0d\u80fd\u8d85\u8fc723\u5b57\u8282\nstring \u8def\u5f84B, \u4f8b\u5982 \"/sdcard/%s.lua\"\nstring \u8def\u5f84C, \u4f8b\u5982 \"/lfs2/%s.luac\"\nstring \u8def\u5f84D, \u4f8b\u5982 \"/lfs2/%s.lua\"\n\u4f8b\u5b50\uff1a\n-- \u6302\u8f7dsd\u5361\u6216\u8005spiflash\u540e\nrtos.setPaths(\"/sdcard/user/%s.luac\", \"/sdcard/user/%s.lua\")\nrequire(\"sd_user_main\") -- \u5c06\u641c\u7d22\u5e76\u52a0\u8f7d /sdcard/user/sd_user_main.luac \u548c /sdcard/user/sd_user_main.lua\n", "prefix": "rtos.setPaths"}, "rtos.nop": {"body": "rtos.nop()", "description": "rtos.nop() - \u7a7a\u51fd\u6570,\u4ec0\u4e48\u90fd\u4e0d\u505a\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u8fd9\u4e2a\u51fd\u6570\u5355\u7eaf\u5c31\u662f lua -> c -> lua \u8d70\u4e00\u904d\n-- \u6ca1\u6709\u53c2\u6570,\u6ca1\u6709\u8fd4\u56de\u503c,\u6ca1\u6709\u903b\u8f91\u5904\u7406\n-- \u5728\u7edd\u5927\u591a\u6570\u60c5\u51b5\u4e0b,\u4e0d\u4f1a\u9047\u5230\u8fd9\u4e2a\u51fd\u6570\u7684\u8c03\u7528\n-- \u5b83\u901a\u5e38\u53ea\u4f1a\u51fa\u73b0\u5728\u6027\u80fd\u6d4b\u8bd5\u7684\u4ee3\u7801\u91cc, \u56e0\u4e3a\u5b83\u4ec0\u4e48\u90fd\u4e0d\u5e72.\nrtos.nop()\n", "prefix": "rtos.nop"}, "rtos.autoCollectMem": {"body": "rtos.autoCollectMem(${1:period},${2:warning_level},${3:force_level})", "description": "rtos.autoCollectMem(period, warning_level, force_level) - \u5185\u5b58\u81ea\u52a8\u6536\u96c6\u914d\u7f6e\uff0c\u662flua\u672c\u8eab\u6536\u96c6\u673a\u5236\u7684\u4e00\u79cd\u8865\u5145\uff0c\u4e0d\u662f\u5fc5\u8981\u7684\uff0c\u800c\u4e14\u53ea\u5728luavm\u7a7a\u95f2\u65f6\u89e6\u53d1\n\u4f20\u5165\u503c\uff1a\nint \u81ea\u52a8\u6536\u96c6\u7684\u5468\u671f\uff0c\u7b49\u540c\u4e8ereceive\u8c03\u7528\u6b21\u6570\uff0c0~60000\u3002\u5982\u679c\u662f0\uff0c\u5219\u5173\u95ed\u81ea\u52a8\u6536\u96c6\u529f\u80fd\uff0c\u9ed8\u8ba4\u662f100\nint \u5185\u5b58\u4f7f\u7528\u8b66\u6212\u6c34\u4f4d\u7ebf\uff0c\u662f\u603bluavm\u5185\u5b58\u91cf\u7684\u767e\u5206\u6bd4\uff0c50~95\uff0c\u5185\u5b58\u8fbe\u5230(>=)\u8b66\u6212\u7ebf\u65f6\u624d\u4f1a\u5f00\u59cb\u5224\u65ad\u662f\u5426\u8981\u6536\u96c6\u3002\u9ed8\u8ba4\u662f80\nint \u5185\u5b58\u4f7f\u7528\u5f3a\u5236\u6536\u96c6\u6c34\u4f4d\u7ebf\uff0c\u662f\u603bluavm\u5185\u5b58\u91cf\u7684\u767e\u5206\u6bd4\uff0c50~95\uff0c\u5185\u5b58\u8fbe\u5230(>=)\u5f3a\u5236\u6536\u96c6\u7ebf\u65f6\u4f1a\u5f3a\u5236\u6536\u96c6\u3002\u9ed8\u8ba4\u662f90\uff0c\u5fc5\u987b\u6bd4\u8b66\u6212\u6c34\u4f4d\u7ebf\u5927\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nrtos.autoCollectMem(100, 80, 90)\n", "prefix": "rtos.autoCollectMem"}, "sdio.init": {"body": "sdio.init(${1:id})", "description": "sdio.init(id) - \u521d\u59cb\u5316sdio\n\u4f20\u5165\u503c\uff1a\nint \u901a\u9053id,\u4e0e\u5177\u4f53\u8bbe\u5907\u6709\u5173,\u901a\u5e38\u4ece0\u5f00\u59cb,\u9ed8\u8ba40\n\u8fd4\u56de\u503c\uff1a\nboolean \u6253\u5f00\u7ed3\u679c\n", "prefix": "sdio.init"}, "sdio.sd_read": {"body": "sdio.sd_read(${1:id},${2:offset},${3:len})", "description": "sdio.sd_read(id, offset, len) - \u76f4\u63a5\u8bfb\u5199sd\u5361\u4e0a\u7684\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint sdio\u603b\u7ebfid\nint \u504f\u79fb\u91cf,\u5fc5\u987b\u662f512\u7684\u500d\u6570\nint \u957f\u5ea6,\u5fc5\u987b\u662f512\u7684\u500d\u6570\n\u8fd4\u56de\u503c\uff1a\nstring \u82e5\u8bfb\u53d6\u6210\u529f,\u8fd4\u56de\u5b57\u7b26\u4e32,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316sdio\u5e76\u76f4\u63a5\u8bfb\u53d6sd\u5361\u6570\u636e\nsdio.init(0)\nlocal t = sdio.sd_read(0, 0, 1024)\nif t then\n --- xxx\nend\n", "prefix": "sdio.sd_read"}, "sdio.sd_write": {"body": "sdio.sd_write(${1:id},${2:data},${3:offset})", "description": "sdio.sd_write(id, data, offset) - \u76f4\u63a5\u5199sd\u5361\n\u4f20\u5165\u503c\uff1a\nint sdio\u603b\u7ebfid\nstring \u5f85\u5199\u5165\u7684\u6570\u636e,\u957f\u5ea6\u5fc5\u987b\u662f512\u7684\u500d\u6570\nint \u504f\u79fb\u91cf,\u5fc5\u987b\u662f512\u7684\u500d\u6570\n\u8fd4\u56de\u503c\uff1a\nbool \u82e5\u8bfb\u53d6\u6210\u529f,\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316sdio\u5e76\u76f4\u63a5\u8bfb\u53d6sd\u5361\u6570\u636e\nsdio.init(0)\nlocal t = sdio.sd_write(0, data, 0)\nif t then\n --- xxx\nend\n", "prefix": "sdio.sd_write"}, "sensor.ds18b20": {"body": "sensor.ds18b20(${1:pin},${2:check_crc})", "description": "sensor.ds18b20(pin, check_crc) - \u83b7\u53d6DS18B20\u7684\u6e29\u5ea6\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint gpio\u7aef\u53e3\u53f7\nboolean \u662f\u5426\u6821\u9a8ccrc\u503c,\u9ed8\u8ba4\u4e3atrue. \u4e0d\u6821\u9a8ccrc\u503c\u80fd\u63d0\u9ad8\u8bfb\u53d6\u6210\u529f\u7684\u6982\u7387,\u4f46\u53ef\u80fd\u4f1a\u8bfb\u53d6\u5230\u9519\u8bef\u7684\u503c\n\u8fd4\u56de\u503c\uff1a\nint \u6e29\u5ea6\u6570\u636e,\u5355\u4f4d0.1\u6444\u6c0f\u5ea6\uff0c\u8bfb\u53d6\u5931\u8d25\u65f6\u8fd4\u56de\u9519\u8bef\u7801\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nwhile 1 do\n sys.wait(5000)\n local val,result = sensor.ds18b20(17, true) -- GPIO17\u4e14\u6821\u9a8cCRC\u503c\n -- val 301 == 30.1\u6444\u6c0f\u5ea6\n -- result true \u8bfb\u53d6\u6210\u529f\n log.info(\"ds18b20\", val, result)\nend\n", "prefix": "sensor.ds18b20"}, "sensor.w1_reset": {"body": "sensor.w1_reset(${1:pin})", "description": "sensor.w1_reset(pin) - \u5355\u603b\u7ebf\u534f\u8bae,\u590d\u4f4d\u8bbe\u5907\n\u4f20\u5165\u503c\uff1a\nint gpio\u7aef\u53e3\u53f7\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\n", "prefix": "sensor.w1_reset"}, "sensor.w1_connect": {"body": "sensor.w1_connect(${1:pin})", "description": "sensor.w1_connect(pin) - \u5355\u603b\u7ebf\u534f\u8bae,\u8fde\u63a5\u8bbe\u5907\n\u4f20\u5165\u503c\uff1a\nint gpio\u7aef\u53e3\u53f7\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5931\u8d25\u8fd4\u56defalse\n", "prefix": "sensor.w1_connect"}, "sensor.w1_write": {"body": "sensor.w1_write(${1:pin},${2:data1},${3:data2})", "description": "sensor.w1_write(pin, data1,data2) - \u5355\u603b\u7ebf\u534f\u8bae,\u5f80\u603b\u7ebf\u5199\u5165\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint gpio\u7aef\u53e3\u53f7\nint \u7b2c\u4e00\u4e2a\u6570\u636e\nint \u7b2c\u4e8c\u4e2a\u6570\u636e, \u53ef\u4ee5\u5199N\u4e2a\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "sensor.w1_write"}, "sensor.w1_read": {"body": "sensor.w1_read(${1:pin},${2:len})", "description": "sensor.w1_read(pin, len) - \u5355\u603b\u7ebf\u534f\u8bae,\u4ece\u603b\u7ebf\u8bfb\u53d6\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint gpio\u7aef\u53e3\u53f7\nint \u8bfb\u53d6\u7684\u957f\u5ea6\n\u8fd4\u56de\u503c\uff1a\nint \u6309\u8bfb\u53d6\u7684\u957f\u5ea6\u8fd4\u56deN\u4e2a\u6574\u6570\n", "prefix": "sensor.w1_read"}, "sensor.hx711": {"body": "sensor.hx711(${1:pin_date},${2:pin_clk})", "description": "sensor.hx711(pin_date,pin_clk) - \u83b7\u53d6Hx711\u7684\u538b\u529b\u4f20\u611f\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u6570\u636e\u7684gpio\u7aef\u53e3\u53f7\nint \u65f6\u949f\u7684gpio\u7aef\u53e3\u53f7\n\u8fd4\u56de\u503c\uff1a\nint hx711\u8bfb\u5230\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u5982\u679c\u8bbe\u5907\u4e0d\u5b58\u5728\u4f1a\u5361\u5728\u8bfb\u53d6\u63a5\u53e3\nsys.taskInit(\n function()\n sys.wait(1000)\n local maopi = sensor.hx711(0,7)\n while true do\n sys.wait(2000)\n a = sensor.hx711(0,7) - maopi\n if a > 0 then\n log.info(\"tag\", a / 4.6)\n end\n end\n end\n)\n", "prefix": "sensor.hx711"}, "sensor.cs1237": {"body": "sensor.cs1237(${1:pin_date},${2:pin_clk})", "description": "sensor.cs1237(pin_date,pin_clk) - \u83b7\u53d6cs1237\u4f20\u611f\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u6570\u636e\u7684gpio\u7aef\u53e3\u53f7\nint \u65f6\u949f\u7684gpio\u7aef\u53e3\u53f7\n\u8fd4\u56de\u503c\uff1a\nint cs1237\u8bfb\u5230\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u5982\u679c\u8bbe\u5907\u4e0d\u5b58\u5728\u4f1a\u5361\u5728\u8bfb\u53d6\u63a5\u53e3\nsys.taskInit(\n function()\n sys.wait(1000)\n local cs1237_data = sensor.cs1237(0,7)\n while true do\n sys.wait(2000)\n cs1237_data = sensor.cs1237(0,7) - maopi\n log.info(\"cs1237_data:\", cs1237_data)--\u5f97\u5230\u539f\u59cb\u6570\u636e\n end\n end\n)\n", "prefix": "sensor.cs1237"}, "sensor.ws2812b": {"body": "sensor.ws2812b(${1:pin},${2:data},${3:T0H},${4:T0L},${5:T1H},${6:T1L})", "description": "sensor.ws2812b(pin,data,T0H,T0L,T1H,T1L) - \u8bbe\u7f6ews2812b\u8f93\u51fa(gpio\u9a71\u52a8\u65b9\u5f0f)\n\u4f20\u5165\u503c\uff1a\nint ws2812b\u7684gpio\u7aef\u53e3\u53f7\nstring/zbuff \u5f85\u53d1\u9001\u7684\u6570\u636e\uff08\u5982\u679c\u4e3azbuff\u6570\u636e\uff0c\u5219\u4f1a\u65e0\u89c6\u6307\u9488\u4f4d\u7f6e\u59cb\u7ec8\u4ece0\u504f\u79fb\u5f00\u59cb\uff09\nint T0H\u65f6\u95f4\uff0c\u8868\u793a\u5ef6\u65f6\u591a\u5c11\u4e2anop\uff0c\u6bcf\u4e2a\u578b\u53f7\u4e0d\u4e00\u6837\uff0c\u81ea\u5df1\u8c03\nint T0L\u65f6\u95f4\uff0c\u8868\u793a\u5ef6\u65f6\u591a\u5c11\u4e2anop\nint T1H\u65f6\u95f4\uff0c\u8868\u793a\u5ef6\u65f6\u591a\u5c11\u4e2anop\nint T1L\u65f6\u95f4\uff0c\u8868\u793a\u5ef6\u65f6\u591a\u5c11\u4e2anop\n\u4f8b\u5b50\uff1a\nlocal buff = zbuff.create({8,8,24})\nbuff:drawLine(1,2,5,6,0x00ffff)\nsensor.ws2812b(7,buff,300,700,700,700)\n", "prefix": "sensor.ws2812b"}, "sensor.ws2812b_pwm": {"body": "sensor.ws2812b_pwm(${1:pin},${2:data})", "description": "sensor.ws2812b_pwm(pin,data) - \u8bbe\u7f6ews2812b\u8f93\u51fa(pwm\u9a71\u52a8\u65b9\u5f0f,\u9700\u8981pwm\u80fd\u8f93\u51fa800k\u9891\u7387\uff0c\u5426\u5219\u65e0\u6cd5\u4f7f\u7528\u6b64\u65b9\u6cd5)\n\u4f20\u5165\u503c\uff1a\nint pwm\u7aef\u53e3\u53f7\nstring/zbuff \u5f85\u53d1\u9001\u7684\u6570\u636e\uff08\u5982\u679c\u4e3azbuff\u6570\u636e\uff0c\u5219\u4f1a\u65e0\u89c6\u6307\u9488\u4f4d\u7f6e\u59cb\u7ec8\u4ece0\u504f\u79fb\u5f00\u59cb\uff09\n\u4f8b\u5b50\uff1a\nlocal buff = zbuff.create({8,8,24})\nbuff:setFrameBuffer(8,8,24,0x0000ff)\nsensor.ws2812b_pwm(7,buff)\n", "prefix": "sensor.ws2812b_pwm"}, "sensor.ws2812b_spi": {"body": "sensor.ws2812b_spi(${1:pin},${2:data})", "description": "sensor.ws2812b_spi(pin,data) - \u8bbe\u7f6ews2812b\u8f93\u51fa(spi\u9a71\u52a8\u65b9\u5f0f,\u9700\u8981spi\u80fd\u8f93\u51fa5M\u9891\u7387\uff0c\u5426\u5219\u65e0\u6cd5\u4f7f\u7528\u6b64\u65b9\u6cd5)\n\u4f20\u5165\u503c\uff1a\nint spi\u7aef\u53e3\u53f7\nstring/zbuff \u5f85\u53d1\u9001\u7684\u6570\u636e\uff08\u5982\u679c\u4e3azbuff\u6570\u636e\uff0c\u5219\u4f1a\u65e0\u89c6\u6307\u9488\u4f4d\u7f6e\u59cb\u7ec8\u4ece0\u504f\u79fb\u5f00\u59cb\uff09\n\u4f8b\u5b50\uff1a\nlocal buff = zbuff.create({8,8,24})\nbuff:setFrameBuffer(8,8,24,0x0000ff)\nsensor.ws2812b_spi(2,buff)\n", "prefix": "sensor.ws2812b_spi"}, "sensor.dht1x": {"body": "sensor.dht1x(${1:pin})", "description": "sensor.dht1x(pin) - \u83b7\u53d6DHT11/DHT12\u7684\u6e29\u6e7f\u5ea6\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint gpio\u7aef\u53e3\u53f7\nboolean \u662f\u5426\u6821\u9a8ccrc\u503c,\u9ed8\u8ba4\u4e3atrue. \u4e0d\u6821\u9a8ccrc\u503c\u80fd\u63d0\u9ad8\u8bfb\u53d6\u6210\u529f\u7684\u6982\u7387,\u4f46\u53ef\u80fd\u4f1a\u8bfb\u53d6\u5230\u9519\u8bef\u7684\u503c\n\u8fd4\u56de\u503c\uff1a\nint \u6e7f\u5ea6\u6570\u636e,\u5355\u4f4d0.01%\uff0c\u8bfb\u53d6\u5931\u8d25\u65f6\u8fd4\u56de\u9519\u8bef\u503c\nint \u6e29\u5ea6\u6570\u636e,\u5355\u4f4d0.01\u6444\u6c0f\u5ea6\uff0c\u8bfb\u53d6\u5931\u8d25\u65f6\u8fd4\u56de\u9519\u8bef\u503c\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nwhile 1 do\n sys.wait(1000)\n local h,t,r = sensor.dht1x(17, true) -- GPIO17\u4e14\u6821\u9a8cCRC\u503c\n log.info(\"dht11\", h/100,t/100,r)--90.1 23.22\nend\n", "prefix": "sensor.dht1x"}, "sensor.sc12a": {"body": "sensor.sc12a(${1:sda},${2:scl})", "description": "sensor.sc12a(sda,scl) - \u83b7\u53d6sc12a\u88ab\u89e6\u6478\u7684\u901a\u9053\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u6570\u636e\u7684gpio\u7aef\u53e3\u53f7\nint \u65f6\u949f\u7684gpio\u7aef\u53e3\u53f7\n\u8fd4\u56de\u503c\uff1a\nint \u8bfb\u53d6\u6210\u529f\u8fd4\u56de\u6574\u5f62\u6570\u636e\uff0c\u8bfb\u53d6\u5931\u8d25\u65f6\u8fd4\u56de\u9519\u8bef\u503c\n\u4f8b\u5b50\uff1a\nwhile true do\n local temp1=sensor.sc12a(4,7)\n if bit.rshift(bit.band( temp1, 0x8000), 15 )==0x01 then\n log.info(\"\u88ab\u6309\u4e0b\u7684\u6709\u901a\u90530\")\n end\n if bit.rshift(bit.band( temp1, 0x4000), 14 )==0x01 then\n log.info(\"\u88ab\u6309\u4e0b\u7684\u6709\u901a\u90531\")\n end\n if bit.rshift(bit.band( temp1, 0x2000), 13 )==0x01 then\n log.info(\"\u88ab\u6309\u4e0b\u7684\u6709\u901a\u90532\")\n end\n if bit.rshift(bit.band( temp1, 0x1000), 12 )==0x01 then\n log.info(\"\u88ab\u6309\u4e0b\u7684\u6709\u901a\u90533\")\n end\n if bit.rshift(bit.band( temp1, 0x800), 11 )==0x01 then\n log.info(\"\u88ab\u6309\u4e0b\u7684\u6709\u901a\u90534\")\n end\n if bit.rshift(bit.band( temp1, 0x400), 10 )==0x01 then\n log.info(\"\u88ab\u6309\u4e0b\u7684\u6709\u901a\u90535\")\n end\n if bit.rshift(bit.band( temp1, 0x200), 9 )==0x01 then\n log.info(\"\u88ab\u6309\u4e0b\u7684\u6709\u901a\u90536\")\n end\n if bit.rshift(bit.band( temp1, 0x100), 8 )==0x01 then\n log.info(\"\u88ab\u6309\u4e0b\u7684\u6709\u901a\u90537\")\n end\n if bit.rshift(bit.band( temp1, 0x80), 7 )==0x01 then\n log.info(\"\u88ab\u6309\u4e0b\u7684\u6709\u901a\u90538\")\n end\n if bit.rshift(bit.band( temp1, 0x40), 6 )==0x01 then\n log.info(\"\u88ab\u6309\u4e0b\u7684\u6709\u901a\u90539\")\n end\n if bit.rshift(bit.band( temp1, 0x20), 5 )==0x01 then\n log.info(\"\u88ab\u6309\u4e0b\u7684\u6709\u901a\u905310\")\n end\n if bit.rshift(bit.band( temp1, 0x10), 4 )==0x01 then\n log.info(\"\u88ab\u6309\u4e0b\u7684\u6709\u901a\u905311\")\n end\n sys.wait(200)\nend\n", "prefix": "sensor.sc12a"}, "sensor.yhm27xxx": {"body": "sensor.yhm27xxx(${1:pin},${2:chip_id},${3:reg},${4:data})", "description": "sensor.yhm27xxx(pin, chip_id, reg, data) - \u5355\u603b\u7ebf\u547d\u4ee4\u8bfb\u5199YHM27XX\n\u4f20\u5165\u503c\uff1a\nint gpio\u7aef\u53e3\u53f7\nint \u82af\u7247ID\nint \u5bc4\u5b58\u5668\u5730\u5740\nint \u8981\u5199\u5165\u7684\u6570\u636e\uff0c\u5982\u679c\u6ca1\u586b\uff0c\u5219\u8868\u793a\u4ece\u5bc4\u5b58\u5668\u8bfb\u53d6\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5931\u8d25\u8fd4\u56defalse\nint \u8bfb\u53d6\u6210\u529f\u8fd4\u56de\u5bc4\u5b58\u5668\u503c\uff0c\u5199\u5165\u6210\u529f\u65e0\u8fd4\u56de\n\u4f8b\u5b50\uff1a\nwhile 1 do\n sys.wait(1000)\n local result, data = sensor.yhm27xxx(15, 0x04, 0x05)\n log.info(\"yhm27xxx\", result, data)\nend\n", "prefix": "sensor.yhm27xxx"}, "sfd.init": {"body": "sfd.init(${1:type},${2:spi_id},${3:spi_cs})", "description": "sfd.init(type, spi_id, spi_cs) - \u521d\u59cb\u5316spi flash\n\u4f20\u5165\u503c\uff1a\nstring \u7c7b\u578b, \u53ef\u4ee5\u662f\"spi\", \u4e5f\u53ef\u4ee5\u662f\"zbuff\", \u6216\u8005\"onchip\"\nint SPI\u603b\u7ebf\u7684id, \u6216\u8005 zbuff\u5b9e\u4f8b\nint SPI FLASH\u7684\u7247\u9009\u811a\u5bf9\u5e94\u7684GPIO, \u5f53\u7c7b\u578b\u662fspi\u65f6\u624d\u9700\u8981\u4f20\n\u8fd4\u56de\u503c\uff1a\nuserdata \u6210\u529f\u8fd4\u56de\u4e00\u4e2a\u6570\u636e\u7ed3\u6784,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nlocal drv = sfd.init(\"spi\", 0, 17)\nif drv then\n log.info(\"sfd\", \"chip id\", sfd.id(drv):toHex())\nend\n-- 2023.01.15\u4e4b\u540e\u7684\u56fa\u4ef6\u652f\u6301onchip\u7c7b\u578b, \u652f\u6301\u76f4\u63a5\u8bfb\u5199\u7247\u4e0aflash\u7684\u4e00\u5c0f\u5757\u533a\u57df,\u4e00\u822c\u662f64k\n-- \u8fd9\u5757\u533a\u57df\u901a\u5e38\u662ffdb/fskv\u5e93\u6240\u5728\u7684\u533a\u57df, \u6240\u4ee5\u4e0d\u8981\u6df7\u7740\u7528\nlocal onchip = sfd.init(\"onchip\")\nlocal data = sfd.read(onchip, 0x100, 256)\nsfd.erase(onchip, 0x100)\nsfd.write(onchip, 0x100, data or \"Hi\")\n\n", "prefix": "sfd.init"}, "sfd.status": {"body": "sfd.status(${1:drv})", "description": "sfd.status(drv) - \u68c0\u67e5spi flash\u72b6\u6001\n\u4f20\u5165\u503c\uff1a\nuserdata sfd.init\u8fd4\u56de\u7684\u6570\u636e\u7ed3\u6784\n\u8fd4\u56de\u503c\uff1a\nint \u72b6\u6001\u503c, 0 \u672a\u521d\u59cb\u5316\u6210\u529f,1\u521d\u59cb\u5316\u6210\u529f\u4e14\u7a7a\u95f2,2\u6b63\u5fd9\n\u4f8b\u5b50\uff1a\nlocal drv = sfd.init(\"spi\", 0, 17)\nif drv then\n log.info(\"sfd\", \"status\", sfd.status(drv))\nend\n", "prefix": "sfd.status"}, "sfd.read": {"body": "sfd.read(${1:drv},${2:offset},${3:len})", "description": "sfd.read(drv, offset, len) - \u8bfb\u53d6\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nuserdata sfd.init\u8fd4\u56de\u7684\u6570\u636e\u7ed3\u6784\nint \u8d77\u59cb\u504f\u79fb\u91cf\nint \u8bfb\u53d6\u957f\u5ea6,\u5f53\u524d\u9650\u5236\u5728256\u4ee5\u5185\n\u8fd4\u56de\u503c\uff1a\nstring \u6570\u636e\n\u4f8b\u5b50\uff1a\nlocal drv = sfd.init(\"spi\", 0, 17)\nif drv then\n log.info(\"sfd\", \"read\", sfd.read(drv, 0x100, 256))\nend\n", "prefix": "sfd.read"}, "sfd.write": {"body": "sfd.write(${1:drv},${2:offset},${3:data})", "description": "sfd.write(drv, offset, data) - \u5199\u5165\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nuserdata sfd.init\u8fd4\u56de\u7684\u6570\u636e\u7ed3\u6784\nint \u8d77\u59cb\u504f\u79fb\u91cf\nstring \u9700\u8981\u5199\u5165\u7684\u6570\u636e,\u5f53\u524d\u652f\u6301256\u5b57\u8282\u53ca\u4ee5\u4e0b\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5931\u8d25\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nlocal drv = sfd.init(\"spi\", 0, 17)\nif drv then\n log.info(\"sfd\", \"write\", sfd.write(drv, 0x100, \"hi,luatos\"))\nend\n", "prefix": "sfd.write"}, "sfd.erase": {"body": "sfd.erase(${1:drv},${2:offset})", "description": "sfd.erase(drv, offset) - \u64e6\u9664\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nuserdata sfd.init\u8fd4\u56de\u7684\u6570\u636e\u7ed3\u6784\nint \u8d77\u59cb\u504f\u79fb\u91cf\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5931\u8d25\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nlocal drv = sfd.init(\"spi\", 0, 17)\nif drv then\n log.info(\"sfd\", \"write\", sfd.erase(drv, 0x100))\nend\n", "prefix": "sfd.erase"}, "sfd.id": {"body": "sfd.id(${1:drv})", "description": "sfd.id(drv) - \u82af\u7247\u552f\u4e00id\n\u4f20\u5165\u503c\uff1a\nuserdata sfd.init\u8fd4\u56de\u7684\u6570\u636e\u7ed3\u6784\n\u8fd4\u56de\u503c\uff1a\nstring 8\u5b57\u8282(64bit)\u7684\u82af\u7247id\n\u4f8b\u5b50\uff1a\nlocal drv = sfd.init(\"spi\", 0, 17)\nif drv then\n log.info(\"sfd\", \"chip id\", sfd.id(drv))\nend\n", "prefix": "sfd.id"}, "sfud.init": {"body": "sfud.init(${1:spi_id},${2:spi_cs},${3:spi_bandrate)/sfud.init(spi_device})", "description": "sfud.init(spi_id, spi_cs, spi_bandrate)/sfud.init(spi_device) - \u521d\u59cb\u5316sfud\n\u4f20\u5165\u503c\uff1a\nint spi_id SPI\u7684ID/userdata spi_device\nint spi_cs SPI\u7684\u7247\u9009\nint spi_bandrate SPI\u7684\u9891\u7387\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n--spi\nlog.info(\"sfud.init\",sfud.init(0,20,20 * 1000 * 1000))\n--spi_device\nlocal spi_device = spi.deviceSetup(0,17,0,0,8,2000000,spi.MSB,1,0)\nlog.info(\"sfud.init\",sfud.init(spi_device))\n", "prefix": "sfud.init"}, "sfud.getDeviceNum": {"body": "sfud.getDeviceNum()", "description": "sfud.getDeviceNum() - \u83b7\u53d6flash\u8bbe\u5907\u4fe1\u606f\u8868\u4e2d\u7684\u8bbe\u5907\u603b\u6570\n\u8fd4\u56de\u503c\uff1a\nint \u8fd4\u56de\u8bbe\u5907\u603b\u6570\n\u4f8b\u5b50\uff1a\nlog.info(\"sfud.getDeviceNum\",sfud.getDeviceNum())\n", "prefix": "sfud.getDeviceNum"}, "sfud.getDevice": {"body": "sfud.getDevice(${1:index})", "description": "sfud.getDevice(index) - \u901a\u8fc7flash\u4fe1\u606f\u8868\u4e2d\u7684\u7d22\u5f15\u83b7\u53d6flash\u8bbe\u5907\n\u4f20\u5165\u503c\uff1a\nint index flash\u4fe1\u606f\u8868\u4e2d\u7684\u7d22\u5f15\n\u8fd4\u56de\u503c\uff1a\nuserdata \u6210\u529f\u8fd4\u56de\u4e00\u4e2a\u6570\u636e\u7ed3\u6784,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nlocal sfud_device = sfud.getDevice(1)\n", "prefix": "sfud.getDevice"}, "sfud.getDeviceTable": {"body": "sfud.getDeviceTable()", "description": "sfud.getDeviceTable() - \u83b7\u53d6flash\u8bbe\u5907\u4fe1\u606f\u8868\n\u8fd4\u56de\u503c\uff1a\nuserdata \u6210\u529f\u8fd4\u56de\u4e00\u4e2a\u6570\u636e\u7ed3\u6784,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nlocal sfud_device = sfud.getDeviceTable()\n", "prefix": "sfud.getDeviceTable"}, "sfud.chipErase": {"body": "sfud.chipErase(${1:flash})", "description": "sfud.chipErase(flash) - \u64e6\u9664 Flash \u5168\u90e8\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nuserdata flash Flash \u8bbe\u5907\u5bf9\u8c61 sfud.get_device_table()\u8fd4\u56de\u7684\u6570\u636e\u7ed3\u6784\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u8fd4\u56de0\n\u4f8b\u5b50\uff1a\nsfud.chipErase(flash)\n", "prefix": "sfud.chipErase"}, "sfud.erase": {"body": "sfud.erase(${1:flash},${2:add},${3:size})", "description": "sfud.erase(flash,add,size) - \u64e6\u9664 Flash \u6307\u5b9a\u5730\u5740\u6307\u5b9a\u5927\u5c0f\uff0c\u6309\u7167flash block\u5927\u5c0f\u8fdb\u884c\u64e6\u9664\n\u4f20\u5165\u503c\uff1a\nuserdata flash Flash \u8bbe\u5907\u5bf9\u8c61 sfud.get_device_table()\u8fd4\u56de\u7684\u6570\u636e\u7ed3\u6784\nnumber add \u64e6\u9664\u5730\u5740\nnumber size \u64e6\u9664\u5927\u5c0f\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u8fd4\u56de0\n\u4f8b\u5b50\uff1a\nsfud.erase(flash,add,size)\n", "prefix": "sfud.erase"}, "sfud.read": {"body": "sfud.read(${1:flash},${2:addr},${3:size})", "description": "sfud.read(flash, addr, size) - \u8bfb\u53d6 Flash \u6570\u636e\n\u4f20\u5165\u503c\uff1a\nuserdata flash Flash \u8bbe\u5907\u5bf9\u8c61 sfud.get_device_table()\u8fd4\u56de\u7684\u6570\u636e\u7ed3\u6784\nint addr \u8d77\u59cb\u5730\u5740\nint size \u4ece\u8d77\u59cb\u5730\u5740\u5f00\u59cb\u8bfb\u53d6\u6570\u636e\u7684\u603b\u5927\u5c0f\n\u8fd4\u56de\u503c\uff1a\nstring data \u8bfb\u53d6\u5230\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\nlog.info(\"sfud.read\",sfud.read(sfud_device,1024,4))\n", "prefix": "sfud.read"}, "sfud.write": {"body": "sfud.write(${1:flash},${2:addr},${3:data})", "description": "sfud.write(flash, addr,data) - \u5411 Flash \u5199\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nuserdata flash Flash \u8bbe\u5907\u5bf9\u8c61 sfud.get_device_table()\u8fd4\u56de\u7684\u6570\u636e\u7ed3\u6784\nint addr \u8d77\u59cb\u5730\u5740\nstring data \u5f85\u5199\u5165\u7684\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u8fd4\u56de0\n\u4f8b\u5b50\uff1a\nlog.info(\"sfud.write\",sfud.write(sfud_device,1024,\"sfud\"))\n", "prefix": "sfud.write"}, "sfud.eraseWrite": {"body": "sfud.eraseWrite(${1:flash},${2:addr},${3:data})", "description": "sfud.eraseWrite(flash, addr,data) - \u5148\u64e6\u9664\u518d\u5f80 Flash \u5199\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nuserdata flash Flash \u8bbe\u5907\u5bf9\u8c61 sfud.get_device_table()\u8fd4\u56de\u7684\u6570\u636e\u7ed3\u6784\nint addr \u8d77\u59cb\u5730\u5740\nstring data \u5f85\u5199\u5165\u7684\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u8fd4\u56de0\n\u4f8b\u5b50\uff1a\nlog.info(\"sfud.eraseWrite\",sfud.eraseWrite(sfud_device,1024,\"sfud\"))\n", "prefix": "sfud.eraseWrite"}, "sfud.getInfo": {"body": "sfud.getInfo(${1:flash})", "description": "sfud.getInfo(flash) - \u83b7\u53d6 Flash \u5bb9\u91cf\u548cpage\u5927\u5c0f\n\u4f20\u5165\u503c\uff1a\nuserdata flash Flash \u8bbe\u5907\u5bf9\u8c61 sfud.get_device_table()\u8fd4\u56de\u7684\u6570\u636e\u7ed3\u6784\n\u8fd4\u56de\u503c\uff1a\nint Flash \u5bb9\u91cf\nint page \u9875\u5927\u5c0f\n\u4f8b\u5b50\uff1a\nlog.info(\"sfud.getInfo\",sfud.getInfo(sfud_device))\n", "prefix": "sfud.getInfo"}, "sfud.mount": {"body": "sfud.mount(${1:flash},${2:mount_point},${3:offset},${4:maxsize})", "description": "sfud.mount(flash, mount_point, offset, maxsize) - \u6302\u8f7dsfud lfs\u6587\u4ef6\u7cfb\u7edf\n\u4f20\u5165\u503c\uff1a\nuserdata flash Flash \u8bbe\u5907\u5bf9\u8c61 sfud.get_device_table()\u8fd4\u56de\u7684\u6570\u636e\u7ed3\u6784\nstring mount_point \u6302\u8f7d\u76ee\u5f55\u540d\nint \u8d77\u59cb\u504f\u79fb\u91cf,\u9ed8\u8ba40\nint \u603b\u5927\u5c0f, \u9ed8\u8ba4\u662f\u6574\u4e2aflash\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue\n\u4f8b\u5b50\uff1a\nlog.info(\"sfud.mount\",sfud.mount(sfud_device,\"/sfud\"))\nlog.info(\"fsstat\", fs.fsstat(\"/\"))\nlog.info(\"fsstat\", fs.fsstat(\"/sfud\"))\n", "prefix": "sfud.mount"}, "sms.send": {"body": "sms.send(${1:phone},${2:msg},${3:auto_phone_fix})", "description": "sms.send(phone, msg, auto_phone_fix) - \u53d1\u9001\u77ed\u4fe1\n\u4f20\u5165\u503c\uff1a\nstring \u7535\u8bdd\u53f7\u7801,\u5fc5\u586b\nstring \u77ed\u4fe1\u5185\u5bb9,\u5fc5\u586b\nbool \u662f\u5426\u81ea\u52a8\u5904\u7406\u7535\u8bdd\u53f7\u53f7\u7801\u7684\u683c\u5f0f,\u9ed8\u8ba4\u662f\u6309\u77ed\u4fe1\u5185\u5bb9\u548c\u53f7\u7801\u683c\u5f0f\u8fdb\u884c\u81ea\u52a8\u5224\u65ad, \u8bbe\u7f6e\u4e3afalse\u53ef\u7981\u7528\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\u6216nil\n", "prefix": "sms.send"}, "sms.setNewSmsCb": {"body": "sms.setNewSmsCb(${1:func})", "description": "sms.setNewSmsCb(func) - \u8bbe\u7f6e\u65b0SMS\u7684\u56de\u8c03\u51fd\u6570\n\u4f20\u5165\u503c\uff1a\nfunction \u56de\u8c03\u51fd\u6570, 3\u4e2a\u53c2\u6570, num, txt, metas\n\u8fd4\u56de\u503c\uff1a\nnil \u4f20\u5165\u662f\u51fd\u6570\u5c31\u80fd\u6210\u529f,\u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n\nsms.setNewSmsCb(function(num, txt, metas)\n -- num \u624b\u673a\u53f7\u7801\n -- txt \u6587\u672c\u5185\u5bb9\n -- metas \u77ed\u4fe1\u7684\u5143\u6570\u636e,\u4f8b\u5982\u53d1\u9001\u7684\u65f6\u95f4,\u957f\u77ed\u4fe1\u7f16\u53f7\n -- \u6ce8\u610f, \u957f\u77ed\u4fe1\u4f1a\u81ea\u52a8\u5408\u5e76\u6210\u4e00\u6761txt\n log.info(\"sms\", num, txt, metas and json.encode(metas) or \"\")\nend)\n", "prefix": "sms.setNewSmsCb"}, "sms.autoLong": {"body": "sms.autoLong(${1:mode})", "description": "sms.autoLong(mode) - \u8bbe\u7f6e\u957f\u77ed\u4fe1\u7684\u81ea\u52a8\u5408\u5e76\u529f\u80fd\n\u4f20\u5165\u503c\uff1a\nbool \u662f\u5426\u81ea\u52a8\u5408\u5e76,true\u4e3a\u81ea\u52a8\u5408\u5e76,\u4e3a\u9ed8\u8ba4\u503c\n\u8fd4\u56de\u503c\uff1a\nbool \u8bbe\u7f6e\u540e\u7684\u503c\n\u4f8b\u5b50\uff1a\n-- \u7981\u7528\u957f\u77ed\u4fe1\u7684\u81ea\u52a8\u5408\u5e76, \u4e00\u822c\u4e0d\u9700\u8981\u7981\u7528\nsms.autoLong(false)\n", "prefix": "sms.autoLong"}, "sms.clearLong": {"body": "sms.clearLong()", "description": "sms.clearLong() - \u6e05\u9664\u957f\u77ed\u4fe1\u7f13\u5b58\n\u8fd4\u56de\u503c\uff1a\nint \u6e05\u7406\u6389\u7684\u7247\u6bb5\u6570\u91cf\n\u4f8b\u5b50\uff1a\nsms.clearLong()\n", "prefix": "sms.clearLong"}, "socket.sntp": {"body": "socket.sntp(${1:sntp_server})", "description": "socket.sntp(sntp_server) - sntp\u65f6\u95f4\u540c\u6b65\n\u4f20\u5165\u503c\uff1a\nstring/table sntp\u670d\u52a1\u5668\u5730\u5740 \u9009\u586b\nint \u9002\u914d\u5668\u5e8f\u53f7\uff0c \u53ea\u80fd\u662fsocket.ETH0\uff08\u5916\u7f6e\u4ee5\u592a\u7f51\uff09\uff0csocket.LWIP_ETH\uff08\u5185\u7f6e\u4ee5\u592a\u7f51\uff09\uff0csocket.LWIP_STA\uff08\u5185\u7f6eWIFI\u7684STA\uff09\uff0csocket.LWIP_AP\uff08\u5185\u7f6eWIFI\u7684AP\uff09\uff0csocket.LWIP_GP\uff08\u5185\u7f6e\u8702\u7a9d\u7f51\u7edc\u7684GPRS\uff09\uff0csocket.USB\uff08\u5916\u7f6eUSB\u7f51\u5361\uff09\uff0c\u5982\u679c\u4e0d\u586b\uff0c\u4f18\u5148\u9009\u62e9soc\u5e73\u53f0\u81ea\u5e26\u80fd\u4e0a\u5916\u7f51\u7684\u9002\u914d\u5668\uff0c\u82e5\u4ecd\u7136\u6ca1\u6709\uff0c\u9009\u62e9\u6700\u540e\u4e00\u4e2a\u6ce8\u518c\u7684\u9002\u914d\u5668\n\u4f8b\u5b50\uff1a\nsocket.sntp()\n--socket.sntp(\"ntp.aliyun.com\") --\u81ea\u5b9a\u4e49sntp\u670d\u52a1\u5668\u5730\u5740\n--socket.sntp({\"ntp.aliyun.com\",\"ntp1.aliyun.com\",\"ntp2.aliyun.com\"}) --sntp\u81ea\u5b9a\u4e49\u670d\u52a1\u5668\u5730\u5740\n--socket.sntp(nil, socket.ETH0) --sntp\u81ea\u5b9a\u4e49\u9002\u914d\u5668\u5e8f\u53f7\nsys.subscribe(\"NTP_UPDATE\", function()\n log.info(\"sntp\", \"time\", os.date())\nend)\nsys.subscribe(\"NTP_ERROR\", function()\n log.info(\"socket\", \"sntp error\")\n socket.sntp()\nend)\n", "prefix": "socket.sntp"}, "socket.ntptm": {"body": "socket.ntptm()", "description": "socket.ntptm() - \u7f51\u7edc\u5bf9\u65f6\u540e\u7684\u65f6\u95f4\u6233(ms\u7ea7\u522b)\n\u8fd4\u56de\u503c\uff1a\ntable \u5305\u542b\u65f6\u95f4\u4fe1\u606f\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e 2023.11.15 \u65b0\u589e\n-- \u6ce8\u610f, \u672c\u51fd\u6570\u5728\u6267\u884csocket.sntp()\u4e14\u83b7\u53d6\u5230NTP\u65f6\u95f4\u540e\u624d\u6709\u6548\n-- \u800c\u4e14\u662f2\u6b21sntp\u4e4b\u540e\u624d\u662f\u6bd4\u8f83\u51c6\u786e\u7684\u503c\n-- \u7f51\u7edc\u6ce2\u52a8\u8d8a\u5c0f, \u8be5\u65f6\u95f4\u6233\u8d8a\u7a33\u5b9a\nlocal tm = socket.ntptm()\n\n-- \u5bf9\u5e94\u7684table\u5305\u542b\u591a\u4e2a\u6570\u636e, \u5747\u4e3a\u6574\u6570\u503c\n\n-- \u6807\u51c6\u6570\u636e\n-- tsec \u5f53\u524d\u79d2\u6570,\u4ece1900.1.1 0:0:0 \u5f00\u59cb\u7b97, UTC\u65f6\u95f4\n-- tms \u5f53\u524d\u6beb\u79d2\u6570\n-- vaild \u662f\u5426\u6709\u6548, true \u6216\u8005 nil\n\n-- \u8c03\u8bd5\u6570\u636e, \u8c03\u8bd5\u7528,\u4e00\u822c\u7528\u6237\u4e0d\u7528\u7ba1\n-- ndelay \u7f51\u7edc\u5ef6\u65f6\u5e73\u5747\u503c,\u5355\u4f4d\u6beb\u79d2\n-- ssec \u7cfb\u7edf\u542f\u52a8\u65f6\u523b\u4e0e1900.1.1 0:0:0\u7684\u79d2\u6570\u504f\u79fb\u91cf\n-- sms \u7cfb\u7edf\u542f\u52a8\u65f6\u523b\u4e0e1900.1.1 0:0:0\u7684\u6beb\u79d2\u504f\u79fb\u91cf\n-- lsec \u672c\u5730\u79d2\u6570\u8ba1\u6570\u5668,\u57fa\u4e8emcu.tick64()\n-- lms \u672c\u5730\u6beb\u79d2\u6570\u8ba1\u6570\u5668,\u57fa\u4e8emcu.tick64()\n\nlog.info(\"tm\u6570\u636e\", json.encode(tm))\nlog.info(\"\u65f6\u95f4\u6233\", string.format(\"%u.%03d\", tm.tsec, tm.tms))\n", "prefix": "socket.ntptm"}, "socket.sntp_port": {"body": "socket.sntp_port(${1:port})", "description": "socket.sntp_port(port) - \u8bbe\u7f6eSNTP\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\n\u4f20\u5165\u503c\uff1a\nint port \u7aef\u53e3\u53f7, \u9ed8\u8ba4123\n\u8fd4\u56de\u503c\uff1a\nint \u8fd4\u56de\u5f53\u524d\u7684\u7aef\u53e3\u53f7\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u4e8e2024.5.17\u65b0\u589e\n-- \u5927\u90e8\u5206\u60c5\u51b5\u4e0b\u4e0d\u9700\u8981\u8bbe\u7f6eNTP\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7,\u9ed8\u8ba4123\u5373\u53ef\n", "prefix": "socket.sntp_port"}, "socket.localIP": {"body": "socket.localIP(${1:adapter})", "description": "socket.localIP(adapter) - \u83b7\u53d6\u672c\u5730ip\n\u4f20\u5165\u503c\uff1a\nint \u9002\u914d\u5668\u5e8f\u53f7\uff0c \u53ea\u80fd\u662fsocket.ETH0\uff08\u5916\u7f6e\u4ee5\u592a\u7f51\uff09\uff0csocket.LWIP_ETH\uff08\u5185\u7f6e\u4ee5\u592a\u7f51\uff09\uff0csocket.LWIP_STA\uff08\u5185\u7f6eWIFI\u7684STA\uff09\uff0csocket.LWIP_AP\uff08\u5185\u7f6eWIFI\u7684AP\uff09\uff0csocket.LWIP_GP\uff08\u5185\u7f6e\u8702\u7a9d\u7f51\u7edc\u7684GPRS\uff09\uff0csocket.USB\uff08\u5916\u7f6eUSB\u7f51\u5361\uff09\uff0c\u5982\u679c\u4e0d\u586b\uff0c\u4f18\u5148\u9009\u62e9soc\u5e73\u53f0\u81ea\u5e26\u80fd\u4e0a\u5916\u7f51\u7684\u9002\u914d\u5668\uff0c\u82e5\u4ecd\u7136\u6ca1\u6709\uff0c\u9009\u62e9\u6700\u540e\u4e00\u4e2a\u6ce8\u518c\u7684\u9002\u914d\u5668\n\u8fd4\u56de\u503c\uff1a\nstring \u901a\u5e38\u662f\u5185\u7f51ip, \u4e5f\u53ef\u80fd\u662f\u5916\u7f51ip, \u53d6\u51b3\u4e8e\u8fd0\u8425\u5546\u7684\u5206\u914d\nstring \u7f51\u7edc\u63a9\u7801\nstring \u7f51\u5173IP\n\u4f8b\u5b50\uff1a\nsys.taskInit(function()\n while 1 do\n sys.wait(3000)\n log.info(\"socket\", \"ip\", socket.localIP())\n -- \u8f93\u51fa\u793a\u4f8b\n -- 62.39.244.10 255.255.255.255 0.0.0.0\n end\nend)\n", "prefix": "socket.localIP"}, "socket.create": {"body": "socket.create(${1:adapter},${2:cb})", "description": "socket.create(adapter, cb) - \u5728\u67d0\u4e2a\u9002\u914d\u7684\u7f51\u5361\u4e0a\u7533\u8bf7\u4e00\u4e2asocket_ctrl\n\u4f20\u5165\u503c\uff1a\nint \u9002\u914d\u5668\u5e8f\u53f7\uff0c \u53ea\u80fd\u662fsocket.ETH0\uff08\u5916\u7f6e\u4ee5\u592a\u7f51\uff09\uff0csocket.LWIP_ETH\uff08\u5185\u7f6e\u4ee5\u592a\u7f51\uff09\uff0csocket.LWIP_STA\uff08\u5185\u7f6eWIFI\u7684STA\uff09\uff0csocket.LWIP_AP\uff08\u5185\u7f6eWIFI\u7684AP\uff09\uff0csocket.LWIP_GP\uff08\u5185\u7f6e\u8702\u7a9d\u7f51\u7edc\u7684GPRS\uff09\uff0csocket.USB\uff08\u5916\u7f6eUSB\u7f51\u5361\uff09\uff0c\u5982\u679c\u4e0d\u586b\uff0c\u4f18\u5148\u9009\u62e9soc\u5e73\u53f0\u81ea\u5e26\u80fd\u4e0a\u5916\u7f51\u7684\u9002\u914d\u5668\uff0c\u82e5\u4ecd\u7136\u6ca1\u6709\uff0c\u9009\u62e9\u6700\u540e\u4e00\u4e2a\u6ce8\u518c\u7684\u9002\u914d\u5668\nstring or function string\u4e3a\u6d88\u606f\u901a\u77e5\u7684taskName\uff0cfunction\u5219\u4e3a\u56de\u8c03\u51fd\u6570\uff0c\u5982\u679c\u56fa\u4ef6\u6ca1\u6709\u5185\u7f6esys_wait\uff0c\u5219\u5fc5\u987b\u662ffunction\n", "prefix": "socket.create"}, "socket.debug": {"body": "socket.debug(${1:ctrl},${2:onoff})", "description": "socket.debug(ctrl, onoff) - \u914d\u7f6e\u662f\u5426\u6253\u5f00debug\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\nboolean true \u6253\u5f00debug\u5f00\u5173\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u6253\u5f00\u8c03\u8bd5\u4fe1\u606f,\u9ed8\u8ba4\u662f\u5173\u95ed\u72b6\u6001\nsocket.debug(ctrl, true)\n", "prefix": "socket.debug"}, "socket.config": {"body": "socket.config(${1:ctrl},${2:local_port},${3:is_udp},${4:is_tls},${5:keep_idle},${6:keep_interval},${7:keep_cnt},${8:server_cert},${9:client_cert},${10:client_key},${11:client_password})", "description": "socket.config(ctrl, local_port, is_udp, is_tls, keep_idle, keep_interval, keep_cnt, server_cert, client_cert, client_key, client_password) - \u914d\u7f6enetwork\u4e00\u4e9b\u4fe1\u606f\uff0c\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\nint \u672c\u5730\u7aef\u53e3\u53f7\uff0c\u5c0f\u7aef\u683c\u5f0f\uff0c\u5982\u679c\u4e0d\u5199\uff0c\u5219\u81ea\u52a8\u5206\u914d\u4e00\u4e2a\uff0c\u5982\u679c\u7528\u6237\u586b\u4e86\u7aef\u53e3\u53f7\u5219\u9700\u8981\u5c0f\u4e8e60000, \u9ed8\u8ba4\u4e0d\u5199\nboolean \u662f\u5426\u662fUDP\uff0c\u9ed8\u8ba4false\nboolean \u662f\u5426\u662f\u52a0\u5bc6\u4f20\u8f93\uff0c\u9ed8\u8ba4false\nint tcp keep live\u6a21\u5f0f\u4e0b\u7684idle\u65f6\u95f4\uff08\u79d2\uff09\uff0c\u5982\u679c\u7559\u7a7a\u5219\u8868\u793a\u4e0d\u542f\u7528\uff0c\u5982\u679c\u662f\u4e0d\u652f\u6301\u6807\u51c6posix\u63a5\u53e3\u7684\u7f51\u5361\uff08\u6bd4\u5982W5500\uff09\uff0c\u5219\u4e3a\u5fc3\u8df3\u95f4\u9694\nint tcp keep live\u6a21\u5f0f\u4e0b\u7684\u63a2\u6d4b\u95f4\u9694\u65f6\u95f4\uff08\u79d2\uff09\nint tcp keep live\u6a21\u5f0f\u4e0b\u7684\u63a2\u6d4b\u6b21\u6570\nstring TCP\u6a21\u5f0f\u4e0b\u7684\u670d\u52a1\u5668ca\u8bc1\u4e66\u6570\u636e\uff0cUDP\u6a21\u5f0f\u4e0b\u7684PSK\uff0c\u4e0d\u9700\u8981\u52a0\u5bc6\u4f20\u8f93\u5199nil\uff0c\u540e\u7eed\u53c2\u6570\u4e5f\u5168\u90e8nil\nstring TCP\u6a21\u5f0f\u4e0b\u7684\u5ba2\u6237\u7aefca\u8bc1\u4e66\u6570\u636e\uff0cUDP\u6a21\u5f0f\u4e0b\u7684PSK-ID\uff0cTCP\u6a21\u5f0f\u4e0b\u5982\u679c\u4e0d\u9700\u8981\u9a8c\u8bc1\u5ba2\u6237\u7aef\u8bc1\u4e66\u65f6\uff0c\u5ffd\u7565\uff0c\u4e00\u822c\u4e0d\u9700\u8981\u9a8c\u8bc1\u5ba2\u6237\u7aef\u8bc1\u4e66\nstring TCP\u6a21\u5f0f\u4e0b\u7684\u5ba2\u6237\u7aef\u79c1\u94a5\u52a0\u5bc6\u6570\u636e\nstring TCP\u6a21\u5f0f\u4e0b\u7684\u5ba2\u6237\u7aef\u79c1\u94a5\u53e3\u4ee4\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue\uff0c\u5931\u8d25\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n--\u6700\u666e\u901a\u7684TCP\u4f20\u8f93\nsocket.config(ctrl)\n--\u6700\u666e\u901a\u7684\u52a0\u5bc6TCP\u4f20\u8f93\uff0c\u8bc1\u4e66\u90fd\u4e0d\u7528\u9a8c\u8bc1\u7684\u90a3\u79cd\nsocket.config(ctrl, nil, nil ,true)\n", "prefix": "socket.config"}, "socket.linkup": {"body": "socket.linkup(${1:ctrl})", "description": "socket.linkup(ctrl) - \u7b49\u5f85\u7f51\u5361linkup\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\n\u8fd4\u56de\u503c\uff1a\nboolean true\u6ca1\u6709\u5f02\u5e38\u53d1\u751f\uff0cfalse\u5931\u8d25\u4e86\uff0c\u5982\u679cfalse\u5219\u4e0d\u9700\u8981\u770b\u4e0b\u4e00\u4e2a\u8fd4\u56de\u503c\u4e86\nboolean true\u5df2\u7ecflinkup\uff0cfalse\u6ca1\u6709linkup\uff0c\u4e4b\u540e\u9700\u8981\u63a5\u6536socket.LINK\u6d88\u606f\n\u4f8b\u5b50\uff1a\n-- \u5224\u65ad\u4e00\u4e0b\u662f\u5426\u5df2\u7ecf\u8054\u7f51\nlocal succ, result = socket.linkup(ctrl)\n", "prefix": "socket.linkup"}, "socket.connect": {"body": "socket.connect(${1:ctrl},${2:ip},${3:remote_port},${4:need_ipv6_dns})", "description": "socket.connect(ctrl, ip, remote_port, need_ipv6_dns) - \u4f5c\u4e3a\u5ba2\u6237\u7aef\u8fde\u63a5\u670d\u52a1\u5668\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\nstring or int ip\u6216\u8005\u57df\u540d\uff0c\u5982\u679c\u662fIPV4\uff0c\u53ef\u4ee5\u662f\u5927\u7aef\u683c\u5f0f\u7684int\u503c\nint \u670d\u52a1\u5668\u7aef\u53e3\u53f7\uff0c\u5c0f\u7aef\u683c\u5f0f\nboolean \u57df\u540d\u89e3\u6790\u662f\u5426\u8981IPV6\uff0ctrue\u8981\uff0cfalse\u4e0d\u8981\uff0c\u9ed8\u8ba4false\u4e0d\u8981\uff0c\u53ea\u6709\u652f\u6301IPV6\u7684\u534f\u8bae\u6808\u624d\u6709\u6548\u679c\n\u8fd4\u56de\u503c\uff1a\nboolean true\u6ca1\u6709\u5f02\u5e38\u53d1\u751f\uff0cfalse\u5931\u8d25\u4e86\uff0c\u5982\u679cfalse\u5219\u4e0d\u9700\u8981\u770b\u4e0b\u4e00\u4e2a\u8fd4\u56de\u503c\u4e86\uff0c\u5982\u679c\u6709\u5f02\u5e38\uff0c\u540e\u7eed\u8981close\nboolean true\u5df2\u7ecfconnect\uff0cfalse\u6ca1\u6709connect\uff0c\u4e4b\u540e\u9700\u8981\u63a5\u6536socket.ON_LINE\u6d88\u606f\n\u4f8b\u5b50\uff1a\n\nlocal succ, result = socket.connect(ctrl, \"netlab.luatos.com\", 40123)\n\n--[[\n\u5e38\u89c1\u7684\u8fde\u63a5\u5931\u8d25\u7684code\u503c, \u4f1a\u5728\u65e5\u5fd7\u4e2d\u663e\u793a\n-1 \u5e95\u5c42\u5185\u5b58\u4e0d\u8db3\n-3 \u8d85\u65f6\n-8 \u7aef\u53e3\u5df2\u7ecf\u88ab\u5360\u7528\n-11 \u94fe\u63a5\u672a\u5efa\u7acb\n-13 \u6a21\u5757\u4e3b\u52a8\u65ad\u5f00\u8fde\u63a5\n-14 \u670d\u52a1\u5668\u4e3b\u52a8\u65ad\u5f00\u8fde\u63a5\n]]\n", "prefix": "socket.connect"}, "socket.discon": {"body": "socket.discon(${1:ctrl})", "description": "socket.discon(ctrl) - \u4f5c\u4e3a\u5ba2\u6237\u7aef\u65ad\u5f00\u8fde\u63a5\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\n\u8fd4\u56de\u503c\uff1a\nboolean true\u6ca1\u6709\u5f02\u5e38\u53d1\u751f\uff0cfalse\u5931\u8d25\u4e86\uff0c\u5982\u679cfalse\u5219\u4e0d\u9700\u8981\u770b\u4e0b\u4e00\u4e2a\u8fd4\u56de\u503c\u4e86\nboolean true\u5df2\u7ecf\u65ad\u5f00\uff0cfalse\u6ca1\u6709\u65ad\u5f00\uff0c\u4e4b\u540e\u9700\u8981\u63a5\u6536socket.CLOSED\u6d88\u606f\n\u4f8b\u5b50\uff1a\nlocal succ, result = socket.discon(ctrl)\n", "prefix": "socket.discon"}, "socket.close": {"body": "socket.close(${1:ctrl})", "description": "socket.close(ctrl) - \u5f3a\u5236\u5173\u95edsocket\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "socket.close"}, "socket.tx": {"body": "socket.tx(${1:ctrl},${2:data},${3:ip},${4:port},${5:flag})", "description": "socket.tx(ctrl, data, ip, port, flag) - \u53d1\u9001\u6570\u636e\u7ed9\u5bf9\u7aef\uff0cUDP\u5355\u6b21\u53d1\u9001\u4e0d\u8981\u8d85\u8fc71460\u5b57\u8282\uff0c\u5426\u5219\u5f88\u5bb9\u6613\u5931\u8d25\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\nstring or user_data zbuff \u8981\u53d1\u9001\u7684\u6570\u636e\nstring or int \u5bf9\u7aefIP\uff0c\u5982\u679c\u662fTCP\u5e94\u7528\u5219\u5ffd\u7565\uff0c\u5982\u679c\u662fUDP\uff0c\u5982\u679c\u7559\u7a7a\u5219\u7528connect\u65f6\u5019\u7684\u53c2\u6570\uff0c\u5982\u679c\u662fIPV4\uff0c\u53ef\u4ee5\u662f\u5927\u7aef\u683c\u5f0f\u7684int\u503c\nint \u5bf9\u7aef\u7aef\u53e3\u53f7\uff0c\u5c0f\u7aef\u683c\u5f0f\uff0c\u5982\u679c\u662fTCP\u5e94\u7528\u5219\u5ffd\u7565\uff0c\u5982\u679c\u662fUDP\uff0c\u5982\u679c\u7559\u7a7a\u5219\u7528connect\u65f6\u5019\u7684\u53c2\u6570\nint \u53d1\u9001\u53c2\u6570\uff0c\u76ee\u524d\u9884\u7559\uff0c\u4e0d\u8d77\u4f5c\u7528\n\u8fd4\u56de\u503c\uff1a\nboolean true\u6ca1\u6709\u5f02\u5e38\u53d1\u751f\uff0cfalse\u5931\u8d25\u4e86\uff0c\u5982\u679cfalse\u5219\u4e0d\u9700\u8981\u770b\u4e0b\u4e00\u4e2a\u8fd4\u56de\u503c\u4e86\uff0c\u5982\u679cfalse\uff0c\u540e\u7eed\u8981close\nboolean true\u7f13\u51b2\u533a\u6ee1\u4e86\uff0cfalse\u6ca1\u6709\u6ee1\uff0c\u5982\u679ctrue\uff0c\u5219\u9700\u8981\u7b49\u5f85\u4e00\u6bb5\u65f6\u95f4\u6216\u8005\u7b49\u5230socket.TX_OK\u6d88\u606f\u540e\u518d\u5c1d\u8bd5\u53d1\u9001\uff0c\u540c\u65f6\u5ffd\u7565\u4e0b\u4e00\u4e2a\u8fd4\u56de\u503c\nboolean true\u5df2\u7ecf\u6536\u5230\u5e94\u7b54\uff0cfalse\u6ca1\u6709\u6536\u5230\u5e94\u7b54\uff0c\u4e4b\u540e\u9700\u8981\u63a5\u6536socket.TX_OK\u6d88\u606f\uff0c \u4e5f\u53ef\u4ee5\u5ffd\u7565\u7ee7\u7eed\u53d1\u9001\uff0c\u76f4\u5230full==true\n\u4f8b\u5b50\uff1a\n\nlocal succ, full, result = socket.tx(ctrl, \"123456\", \"xxx.xxx.xxx.xxx\", xxxx)\n", "prefix": "socket.tx"}, "socket.rx": {"body": "socket.rx(${1:ctrl},${2:buff},${3:flag},${4:limit})", "description": "socket.rx(ctrl, buff, flag, limit) - \u63a5\u6536\u5bf9\u7aef\u53d1\u51fa\u7684\u6570\u636e\uff0c\u6ce8\u610f\u6570\u636e\u5df2\u7ecf\u7f13\u5b58\u5728\u5e95\u5c42\uff0c\u4f7f\u7528\u672c\u51fd\u6570\u53ea\u662f\u63d0\u53d6\u51fa\u6765\uff0cUDP\u6a21\u5f0f\u4e0b\u4e00\u6b21\u53ea\u4f1a\u53d6\u51fa\u4e00\u4e2a\u6570\u636e\u5305\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\nuser_data zbuff \u5b58\u653e\u63a5\u6536\u7684\u6570\u636e\uff0c\u5982\u679c\u7f13\u51b2\u533a\u4e0d\u591f\u5927\u4f1a\u81ea\u52a8\u6269\u5bb9\nint \u63a5\u6536\u53c2\u6570\uff0c\u76ee\u524d\u9884\u7559\uff0c\u4e0d\u8d77\u4f5c\u7528\nint \u63a5\u6536\u6570\u636e\u957f\u5ea6\u9650\u5236\uff0c\u5982\u679c\u6307\u5b9a\u4e86\uff0c\u5219\u53ea\u53d6\u524dN\u4e2a\u5b57\u8282. 2024.1.5 \u65b0\u589e\n\u8fd4\u56de\u503c\uff1a\nboolean true\u6ca1\u6709\u5f02\u5e38\u53d1\u751f\uff0cfalse\u5931\u8d25\u4e86\uff0c\u5982\u679cfalse\u5219\u4e0d\u9700\u8981\u770b\u4e0b\u4e00\u4e2a\u8fd4\u56de\u503c\u4e86\uff0c\u5982\u679cfalse\uff0c\u540e\u7eed\u8981close\nint \u672c\u6b21\u63a5\u6536\u5230\u6570\u636e\u957f\u5ea6\nstring \u5bf9\u7aefIP\uff0c\u53ea\u6709UDP\u6a21\u5f0f\u4e0b\u624d\u6709\u610f\u4e49\uff0cTCP\u6a21\u5f0f\u8fd4\u56denil\uff0c\u6ce8\u610f\u8fd4\u56de\u7684\u683c\u5f0f\uff0c\u5982\u679c\u662fIPV4\uff0c1byte 0x00 + 4byte\u5730\u5740 \u5982\u679c\u662fIPV6\uff0c1byte 0x01 + 16byte\u5730\u5740\nint \u5bf9\u7aefport\uff0c\u53ea\u6709UDP\u6a21\u5f0f\u4e0b\u624d\u6709\u610f\u4e49\uff0cTCP\u6a21\u5f0f\u8fd4\u56de0\n\u4f8b\u5b50\uff1a\n-- \u4ecesocket\u4e2d\u8bfb\u53d6\u6570\u636e, ctrl\u662fsocket.create\u8fd4\u56de\u7684, \u8bf7\u67e5\u9605demo/socket\nlocal buff = zbuff.create(2048)\nlocal succ, data_len, remote_ip, remote_port = socket.rx(ctrl, buff)\n\n-- \u9650\u5236\u8bfb\u53d6\u957f\u5ea6, 2024.1.5 \u65b0\u589e\n-- \u6ce8\u610f\n-- \u5982\u679c\u662fUDP\u6570\u636e, \u5982\u679climit\u5c0f\u4e8eUDP\u6570\u636e\u5305\u957f\u5ea6, \u53ea\u4f1a\u53d6\u524dlimit\u4e2a\u5b57\u8282, \u5269\u4f59\u6570\u636e\u4f1a\u4e22\u5f03\n-- \u5982\u679c\u662fTCP\u6570\u636e, \u5982\u679c\u6709\u5269\u4f59\u6570\u636e, \u4e0d\u4f1a\u4e22\u5f03, \u53ef\u7ee7\u7eed\u8bfb\u53d6.\n-- \u6709\u65b0\u7684\u6570\u636e\u5230\u6765\u624d\u4f1a\u6709\u65b0\u7684EVENT\u6570\u636e, \u672a\u8bfb\u53d6\u5b8c\u6210\u7684\u6570\u636e\u4e0d\u4f1a\u89e6\u53d1\u65b0EVENT\u4e8b\u4ef6\nlocal succ, data_len, remote_ip, remote_port = socket.rx(ctrl, buff, 1500)\n\n-- \u8bfb\u53d6\u7f13\u51b2\u533a\u5927\u5c0f, 2024.1.5 \u65b0\u589e, \u6ce8\u610f,\u8001\u7248\u672c\u56fa\u4ef6\u4e0d\u4f20buff\u53c2\u6570\u4f1a\u62a5\u9519\u7684\n-- \u5bf9\u4e8eTCP\u6570\u636e, \u8fd9\u91cc\u8fd4\u56de\u7684\u662f\u5f85\u8bfb\u53d6\u7684\u6570\u636e\u7684\u603b\u957f\u5ea6\n-- \u5bf9\u4e8eUDP\u6570\u636e, \u8fd9\u91cc\u8fd4\u56de\u7684\u662f\u5355\u4e2aUDP\u6570\u636e\u5305\u7684\u957f\u5ea6\nlocal succ, data_len = socket.rx(ctrl)\nif succ then\n log.info(\"\u5f85\u6536\u53d6\u6570\u636e\u957f\u5ea6\", data_len)\nend\n", "prefix": "socket.rx"}, "socket.read": {"body": "socket.read(${1:netc},${2:len})", "description": "socket.read(netc, len) - \u8bfb\u53d6\u6570\u636e(\u975ezbuff\u7248\u672c)\n\u4f20\u5165\u503c\uff1a\nuserdata socket.create\u5f97\u5230\u7684ctrl\nint \u9650\u5236\u8bfb\u53d6\u6570\u636e\u957f\u5ea6,\u53ef\u9009,\u4e0d\u4f20\u5c31\u662f\u8bfb\u51fa\u5168\u90e8\n\u8fd4\u56de\u503c\uff1a\nboolean \u8bfb\u53d6\u6210\u529f\u4e0e\u5426\nstring \u8bfb\u53d6\u7684\u6570\u636e,\u4ec5\u5f53\u8bfb\u53d6\u6210\u529f\u65f6\u6709\u6548\nstring \u5bf9\u65b9IP\u5730\u5740,\u4ec5\u5f53\u8bfb\u53d6\u6210\u529f\u4e14UDP\u901a\u4fe1\u65f6\u6709\u6548\nint \u5bf9\u65b9\u7aef\u53e3,\u4ec5\u5f53\u8bfb\u53d6\u6210\u529f\u4e14UDP\u901a\u4fe1\u65f6\u6709\u6548\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u4e8e2024.4.8\u6dfb\u52a0, \u7528\u4e8e\u7b80\u6613\u8bfb\u53d6\u4e0d\u5927\u7684\u6570\u636e\n-- \u8bf7\u4f18\u5148\u4f7f\u7528socket.rx\u51fd\u6570, \u672c\u51fd\u6570\u4e3b\u8981\u7528\u4e8e\u56fa\u4ef6\u4e0d\u542bzbuff\u5e93\u65f6\u7684\u53d8\u901a\u8c03\u7528\nlocal ok, data = socket.read(netc, 1500)\nif ok and #data > 0 then\n log.info(\"\u8bfb\u53d6\u5230\u7684\u6570\u636e\", data)\nend\n", "prefix": "socket.read"}, "socket.wait": {"body": "socket.wait(${1:ctrl})", "description": "socket.wait(ctrl) - \u7b49\u5f85\u65b0\u7684socket\u6d88\u606f\uff0c\u5728\u8fde\u63a5\u6210\u529f\u548c\u53d1\u9001\u6570\u636e\u6210\u529f\u540e\uff0c\u4f7f\u7528\u4e00\u6b21\u5c06network\u72b6\u6001\u8f6c\u6362\u5230\u63a5\u6536\u65b0\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\n\u8fd4\u56de\u503c\uff1a\nboolean true\u6ca1\u6709\u5f02\u5e38\u53d1\u751f\uff0cfalse\u5931\u8d25\u4e86\uff0c\u5982\u679cfalse\u5219\u4e0d\u9700\u8981\u770b\u4e0b\u4e00\u4e2a\u8fd4\u56de\u503c\u4e86\uff0c\u5982\u679cfalse\uff0c\u540e\u7eed\u8981close\nboolean true\u6709\u65b0\u7684\u6570\u636e\u9700\u8981\u63a5\u6536\uff0cfalse\u6ca1\u6709\u6570\u636e\uff0c\u4e4b\u540e\u9700\u8981\u63a5\u6536socket.EVENT\u6d88\u606f\n\u4f8b\u5b50\uff1a\nlocal succ, result = socket.wait(ctrl)\n", "prefix": "socket.wait"}, "socket.listen": {"body": "socket.listen(${1:ctrl})", "description": "socket.listen(ctrl) - \u4f5c\u4e3a\u670d\u52a1\u7aef\u5f00\u59cb\u76d1\u542c\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\n\u8fd4\u56de\u503c\uff1a\nboolean true\u6ca1\u6709\u5f02\u5e38\u53d1\u751f\uff0cfalse\u5931\u8d25\u4e86\uff0c\u5982\u679cfalse\u5219\u4e0d\u9700\u8981\u770b\u4e0b\u4e00\u4e2a\u8fd4\u56de\u503c\u4e86\uff0c\u5982\u679cfalse\uff0c\u540e\u7eed\u8981close\nboolean true\u5df2\u7ecfconnect\uff0cfalse\u6ca1\u6709connect\uff0c\u4e4b\u540e\u9700\u8981\u63a5\u6536socket.ON_LINE\u6d88\u606f\n\u4f8b\u5b50\uff1a\nlocal succ, result = socket.listen(ctrl)\n", "prefix": "socket.listen"}, "socket.accept": {"body": "socket.accept(${1:ctrl})", "description": "socket.accept(ctrl) - \u4f5c\u4e3a\u670d\u52a1\u7aef\u63a5\u6536\u5230\u4e00\u4e2a\u65b0\u7684\u5ba2\u6237\u7aef\uff0c\u6ce8\u610f\uff0c\u5982\u679c\u662f\u7c7b\u4f3cW5500\u7684\u786c\u4ef6\u534f\u8bae\u6808\u4e0d\u652f\u63011\u5bf9\u591a\uff0c\u5219\u4e0d\u9700\u8981\u7b2c\u4e8c\u4e2a\u53c2\u6570\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\uff0c\u8fd9\u91cc\u662f\u670d\u52a1\u5668\u7aef\nstring or function or nil string\u4e3a\u6d88\u606f\u901a\u77e5\u7684taskName\uff0cfunction\u5219\u4e3a\u56de\u8c03\u51fd\u6570\uff0c\u548csocket.create\u53c2\u6570\u4e00\u81f4\n\u8fd4\u56de\u503c\uff1a\nboolean true\u6ca1\u6709\u5f02\u5e38\u53d1\u751f\uff0cfalse\u5931\u8d25\u4e86\uff0c\u5982\u679cfalse\u5219\u4e0d\u9700\u8981\u770b\u4e0b\u4e00\u4e2a\u8fd4\u56de\u503c\u4e86\uff0c\u5982\u679cfalse\uff0c\u540e\u7eed\u8981close\nuser_data or nil \u5982\u679c\u652f\u63011\u5bf9\u591a\uff0c\u5219\u4f1a\u8fd4\u56de\u65b0\u7684ctrl\uff0c\u81ea\u52a8create\uff0c\u5982\u679c\u4e0d\u652f\u6301\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nlocal succ, new_netc = socket.listen(ctrl, cb)\n", "prefix": "socket.accept"}, "socket.state": {"body": "socket.state(${1:ctrl})", "description": "socket.state(ctrl) - \u83b7\u53d6socket\u5f53\u524d\u72b6\u6001\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\n\u8fd4\u56de\u503c\uff1a\nint or nil,\u8f93\u5165\u53c2\u6570\u6b63\u786e\u7684\u60c5\u51b5\u4e0b\uff0c\u8fd4\u56de\u72b6\u6001\u7684\u6570\u503c\uff0c\u5426\u5219\u8fd4\u56denil\nstring or nil,\u8f93\u5165\u53c2\u6570\u6b63\u786e\u7684\u60c5\u51b5\u4e0b\uff0c\u8fd4\u56de\u72b6\u6001\u7684\u4e2d\u6587\u63cf\u8ff0\uff0c\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nlocal state, str = socket.state(ctrl)\nlog.info(\"state\", state, str)\nstate 0 \"\u786c\u4ef6\u79bb\u7ebf\",\n 1 \"\u79bb\u7ebf\",\n 2 \"\u7b49\u5f85DNS\",\n 3 \"\u6b63\u5728\u8fde\u63a5\",\n 4 \"\u6b63\u5728TLS\u63e1\u624b\",\n 5 \"\u5728\u7ebf\",\n 6 \"\u5728\u76d1\u542c\",\n 7 \"\u6b63\u5728\u79bb\u7ebf\",\n 8 \"\u672a\u77e5\"\n", "prefix": "socket.state"}, "socket.release": {"body": "socket.release(${1:ctrl})", "description": "socket.release(ctrl) - \u4e3b\u52a8\u91ca\u653e\u6389network_ctrl\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\n\u4f8b\u5b50\uff1a\n-- \u91ca\u653e\u540e\u5c31\u4e0d\u80fd\u518d\u4f7f\u7528\u4e86\nsocket.release(ctrl)\n", "prefix": "socket.release"}, "socket.setDNS": {"body": "socket.setDNS(${1:adapter_index},${2:dns_index},${3:ip})", "description": "socket.setDNS(adapter_index, dns_index, ip) - \u8bbe\u7f6eDNS\u670d\u52a1\u5668\n\u4f20\u5165\u503c\uff1a\nint \u9002\u914d\u5668\u5e8f\u53f7\uff0c \u53ea\u80fd\u662fsocket.ETH0\uff0csocket.STA\uff0csocket.AP\uff0c\u5982\u679c\u4e0d\u586b\uff0c\u4f1a\u9009\u62e9\u6700\u540e\u4e00\u4e2a\u6ce8\u518c\u7684\u9002\u914d\u5668\nint dns\u670d\u52a1\u5668\u5e8f\u53f7\uff0c\u4ece1\u5f00\u59cb\nstring or int dns\uff0c\u5982\u679c\u662fIPV4\uff0c\u53ef\u4ee5\u662f\u5927\u7aef\u683c\u5f0f\u7684int\u503c\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue\uff0c\u5931\u8d25\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u8bbe\u7f6e\u9ed8\u8ba4\u7f51\u7edc\u9002\u914d\u5668\u7684DNS\u914d\u7f6e\nsocket.setDNS(nil, 1, \"114.114.114.114\")\n-- \u8bbe\u7f6e\u5236\u5b9a\u7f51\u7edc\u9002\u914d\u5668\u7684DNS\u914d\u7f6e\nsocket.setDNS(socket.ETH0, 1, \"114.114.114.114\")\n", "prefix": "socket.setDNS"}, "socket.sslLog": {"body": "socket.sslLog(${1:log_level})", "description": "socket.sslLog(log_level) - \u8bbe\u7f6eSSL\u7684log\u767b\u8bb0\n\u4f20\u5165\u503c\uff1a\nint mbedtls log\u7b49\u7ea7\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n--[[\nSSL/TLS log\u7ea7\u522b\u8bf4\u660e\n0\u4e0d\u6253\u5370\n1\u53ea\u6253\u5370\u9519\u8bef\u548c\u8b66\n2\u5927\u90e8\u5206info\n3\u53ca3\u4ee5\u4e0a\u8be6\u7ec6\u7684debug\n\n\u8fc7\u591a\u7684\u4fe1\u606f\u53ef\u80fd\u4f1a\u9020\u6210\u5185\u5b58\u788e\u7247\u5316\n]]\n-- \u6253\u5370\u5927\u90e8\u5206info\u65e5\u5fd7\nsocket.sslLog(2)\n", "prefix": "socket.sslLog"}, "socket.adapter": {"body": "socket.adapter(${1:index})", "description": "socket.adapter(index) - \u67e5\u770b\u7f51\u5361\u9002\u914d\u5668\u7684\u8054\u7f51\u72b6\u6001\n\u4f20\u5165\u503c\uff1a\nint \u9700\u8981\u67e5\u770b\u7684\u9002\u914d\u5668\u5e8f\u53f7\uff0c\u53ef\u4ee5\u7559\u7a7a\u4f1a\u67e5\u770b\u5168\u90e8\u7f51\u5361\uff0c\u76f4\u5230\u9047\u5230IP READY\u7684\uff0c\u5982\u679c\u6307\u5b9a\u7f51\u5361\uff0c\u53ea\u80fd\u662fsocket.ETH0\uff08\u5916\u7f6e\u4ee5\u592a\u7f51\uff09\uff0csocket.LWIP_ETH\uff08\u5185\u7f6e\u4ee5\u592a\u7f51\uff09\uff0csocket.LWIP_STA\uff08\u5185\u7f6eWIFI\u7684STA\uff09\uff0csocket.LWIP_AP\uff08\u5185\u7f6eWIFI\u7684AP\uff09\uff0csocket.LWIP_GP\uff08\u5185\u7f6e\u8702\u7a9d\u7f51\u7edc\u7684GPRS\uff09\uff0csocket.USB\uff08\u5916\u7f6eUSB\u7f51\u5361\uff09\n\u8fd4\u56de\u503c\uff1a\nboolean \u88ab\u67e5\u770b\u7684\u9002\u914d\u5668\u662f\u5426IP READY,true\u8868\u793a\u5df2\u7ecf\u51c6\u5907\u597d\u53ef\u4ee5\u8054\u7f51\u4e86,false\u6682\u65f6\u4e0d\u53ef\u4ee5\u8054\u7f51\nint \u6700\u540e\u4e00\u4e2a\u88ab\u67e5\u770b\u7684\u9002\u914d\u5668\u5e8f\u53f7\n\u4f8b\u5b50\uff1a\n-- \u67e5\u770b\u5168\u90e8\u7f51\u5361\uff0c\u76f4\u5230\u627e\u5230\u4e00\u4e2a\u662fIP READY\u7684\nlocal isReady,index = socket.adapter() --\u5982\u679cisReady\u4e3atrue,\u5219index\u4e3aIP READY\u7684\u7f51\u5361\u9002\u914d\u5668\u5e8f\u53f7\n--\u67e5\u770b\u5916\u7f6e\u4ee5\u592a\u7f51\uff08\u6bd4\u5982W5500\uff09\u662f\u5426IP READY\nlocal isReady,default = socket.adapter(socket.ETH0)\n", "prefix": "socket.adapter"}, "socket.remoteIP": {"body": "socket.remoteIP(${1:ctrl})", "description": "socket.remoteIP(ctrl) - \u83b7\u53d6\u5bf9\u7aefip\n\u4f20\u5165\u503c\uff1a\nuser_data socket.create\u5f97\u5230\u7684ctrl\n\u8fd4\u56de\u503c\uff1a\nstring IP1\uff0c\u5982\u679c\u4e3anil\uff0c\u5219\u8868\u793a\u6ca1\u6709\u83b7\u53d6\u5230IP\u5730\u5740\nstring IP2\uff0c\u5982\u679c\u4e3anil\uff0c\u5219\u8868\u793a\u6ca1\u6709IP2\nstring IP3\uff0c\u5982\u679c\u4e3anil\uff0c\u5219\u8868\u793a\u6ca1\u6709IP3\nstring IP4\uff0c\u5982\u679c\u4e3anil\uff0c\u5219\u8868\u793a\u6ca1\u6709IP4\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f: \uff0c\u5fc5\u987b\u5728\u63a5\u6536\u5230socket.ON_LINE\u6d88\u606f\u4e4b\u540e\u624d\u53ef\u80fd\u83b7\u53d6\u5230\uff0c\u6700\u591a\u8fd4\u56de4\u4e2aIP\u3002\n-- socket.connect\u91cc\u5982\u679cremote_port\u8bbe\u7f6e\u62100\uff0c\u5219\u5f53DNS\u5b8c\u6210\u65f6\u5c31\u8fd4\u56desocket.ON_LINE\u6d88\u606f\nlocal ip1,ip2,ip3,ip4 = socket.remoteIP(ctrl)\n", "prefix": "socket.remoteIP"}, "softkb.init": {"body": "softkb.init(${1:port},${2:key_in},${3:key_out})", "description": "softkb.init(port, key_in, key_out) - \u521d\u59cb\u5316\u8f6f\u4ef6\u952e\u76d8\u77e9\u9635\n\u4f20\u5165\u503c\uff1a\nint \u9884\u7559, \u5f53\u524d\u586b0\ntable \u77e9\u9635\u8f93\u5165\u6309\u952e\u8868\ntable \u77e9\u9635\u8f93\u51fa\u6309\u952e\u8868\n\u4f8b\u5b50\uff1a\n key_in = {pin.PD10,pin.PE00,pin.PE01,pin.PE02}\n key_out = {pin.PD12,pin.PD13,pin.PD14,pin.PD15}\n softkb.init(0,key_in,key_out)\n\nsys.subscribe(\"SOFT_KB_INC\", function(port, data, state)\n -- port \u5f53\u524d\u56fa\u5b9a\u4e3a0, \u53ef\u4ee5\u65e0\u89c6\n -- data, \u9700\u8981\u914d\u5408init\u7684map\u8fdb\u884c\u89e3\u6790\n -- state, 1 \u4e3a\u6309\u4e0b, 0 \u4e3a \u91ca\u653e\n -- TODO \u8be6\u7ec6\u4ecb\u7ecd\nend)\n", "prefix": "softkb.init"}, "softkb.deinit": {"body": "softkb.deinit(${1:port})", "description": "softkb.deinit(port) - \u5220\u9664\u8f6f\u4ef6\u952e\u76d8\u77e9\u9635\n\u4f20\u5165\u503c\uff1a\nint \u9884\u7559, \u5f53\u524d\u586b0\n\u4f8b\u5b50\uff1a\n softkb.deinit(0)\n", "prefix": "softkb.deinit"}, "spi.setup": {"body": "spi.setup(${1:id},${2:cs},${3:CPHA},${4:CPOL},${5:dataw},${6:bandrate},${7:bitdict},${8:ms},${9:mode})", "description": "spi.setup(id, cs, CPHA, CPOL, dataw, bandrate, bitdict, ms, mode) - \u8bbe\u7f6e\u5e76\u542f\u7528SPI\n\u4f20\u5165\u503c\uff1a\nint SPI\u53f7,\u4f8b\u59820\nint CS \u7247\u9009\u811a,\u5728w600\u4e0d\u53ef\u7528\u8bf7\u586bnil\nint CPHA \u9ed8\u8ba40,\u53ef\u90090/1\nint CPOL \u9ed8\u8ba40,\u53ef\u90090/1\nint \u6570\u636e\u5bbd\u5ea6,\u9ed8\u8ba48bit\nint \u6ce2\u7279\u7387,\u9ed8\u8ba42M=2000000\nint \u5927\u5c0f\u7aef, \u9ed8\u8ba4spi.MSB, \u53ef\u9009spi.LSB\nint \u4e3b\u4ece\u8bbe\u7f6e, \u9ed8\u8ba4\u4e3b1, \u53ef\u9009\u4ece\u673a0. \u901a\u5e38\u53ea\u652f\u6301\u4e3b\u673a\u6a21\u5f0f\nint \u5de5\u4f5c\u6a21\u5f0f, \u5168\u53cc\u5de51, \u534a\u53cc\u5de50, \u9ed8\u8ba4\u5168\u53cc\u5de5\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u8fd4\u56de0,\u5426\u5219\u8fd4\u56de\u5176\u4ed6\u503c\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316spi\nspi.setup(0,20,0,0,8,2000000,spi.MSB,1,1)\n", "prefix": "spi.setup"}, "spi.createSoft": {"body": "spi.createSoft(${1:cs},${2:mosi},${3:miso},${4:clk},${5:CPHA},${6:CPOL},${7:dataw},${8:bitdict},${9:ms},${10:mode})", "description": "spi.createSoft(cs, mosi, miso, clk, CPHA, CPOL, dataw, bitdict, ms, mode) - \u8bbe\u7f6e\u5e76\u542f\u7528\u8f6f\u4ef6SPI\n\u4f20\u5165\u503c\uff1a\nint cs\u5f15\u811a\u7f16\u53f7\uff0c\u4f20\u5165nil\u610f\u4e3aLua\u63a7\u5236cs\u811a\nint mosi\u5f15\u811a\u7f16\u53f7\nint miso\u5f15\u811a\u7f16\u53f7\nint clk\u5f15\u811a\u7f16\u53f7\nint \u9ed8\u8ba40\uff0c\u53ef\u90090/1\nint \u9ed8\u8ba40\uff0c\u53ef\u90090/1\nint \u6570\u636e\u5bbd\u5ea6\uff0c\u9ed8\u8ba48bit\nint \u5927\u5c0f\u7aef\uff0c\u9ed8\u8ba4spi.MSB, \u53ef\u9009spi.LSB\nint \u4e3b\u4ece\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u4e3b1, \u53ef\u9009\u4ece\u673a0. \u901a\u5e38\u53ea\u652f\u6301\u4e3b\u673a\u6a21\u5f0f\nint \u5de5\u4f5c\u6a21\u5f0f\uff0c\u5168\u53cc\u5de51\uff0c\u534a\u53cc\u5de50\uff0c\u9ed8\u8ba4\u534a\u53cc\u5de5\n\u8fd4\u56de\u503c\uff1a\n\u8f6f\u4ef6SPI\u5bf9\u8c61 \u53ef\u5f53\u4f5cSPI\u7684id\u4f7f\u7528\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316\u8f6f\u4ef6spi\nlocal softSpiDevice = spi.createSoft(0, 1, 2, 3, 0, 0, 8, spi.MSB, 1, 1)\nlocal result = spi.send(softSpiDevice, string.char(0x9f))\n", "prefix": "spi.createSoft"}, "spi.close": {"body": "spi.close(${1:id})", "description": "spi.close(id) - \u5173\u95ed\u6307\u5b9a\u7684SPI\n\u4f20\u5165\u503c\uff1a\nint SPI\u53f7,\u4f8b\u59820\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u8fd4\u56de0,\u5426\u5219\u8fd4\u56de\u5176\u4ed6\u503c\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316spi\nspi.close(0)\n", "prefix": "spi.close"}, "spi.transfer": {"body": "spi.transfer(${1:id},${2:send_data},${3:send_len},${4:recv_len})", "description": "spi.transfer(id, send_data, send_len, recv_len) - \u4f20\u8f93SPI\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint SPI\u53f7(\u4f8b\u59820)\u6216\u8f6f\u4ef6SPI\u5bf9\u8c61\nstring/zbuff \u5f85\u53d1\u9001\u7684\u6570\u636e\uff0c\u5982\u679c\u4e3azbuff\u6570\u636e\uff0c\u5219\u4f1a\u4ece\u5bf9\u8c61\u6240\u5904\u7684\u6307\u9488\u5904\u5f00\u59cb\u8bfb\nint \u53ef\u9009\u3002\u5f85\u53d1\u9001\u6570\u636e\u7684\u957f\u5ea6\uff0c\u9ed8\u8ba4\u4e3adata\u957f\u5ea6\nint \u53ef\u9009\u3002\u8bfb\u53d6\u6570\u636e\u7684\u957f\u5ea6\uff0c\u9ed8\u8ba4\u4e3a1\n\u8fd4\u56de\u503c\uff1a\nstring \u8bfb\u53d6\u6210\u529f\u8fd4\u56de\u5b57\u7b26\u4e32,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316spi\nspi.setup(0,nil,0,0,8,2000000,spi.MSB,1,1)\nlocal recv = spi.transfer(0, \"123\")--\u53d1\u9001123,\u5e76\u8bfb\u53d6\u6570\u636e\n\nlocal buff = zbuff.create(1024, 0x33) --\u521b\u5efa\u4e00\u4e2a\u521d\u503c\u5168\u4e3a0x33\u7684\u5185\u5b58\u533a\u57df\nlocal recv = spi.transfer(0, buff)--\u628azbuff\u6570\u636e\u4ece\u6307\u9488\u5f00\u59cb\uff0c\u5168\u53d1\u51fa\u53bb,\u5e76\u8bfb\u53d6\u6570\u636e\n", "prefix": "spi.transfer"}, "spi.recv": {"body": "spi.recv(${1:id},${2:size},${3:buff})", "description": "spi.recv(id, size, buff) - \u63a5\u6536\u6307\u5b9a\u957f\u5ea6\u7684SPI\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint SPI\u53f7,\u4f8b\u59820\nint \u6570\u636e\u957f\u5ea6\nuserdata zbuff\u5bf9\u8c61,\u53ef\u9009,2024.3.29\u65b0\u589e\n\u8fd4\u56de\u503c\uff1a\nstring/int \u8bfb\u53d6\u6210\u529f\u8fd4\u56de\u5b57\u7b26\u4e32,\u82e5\u4f20\u5165\u7684\u662fzbuff\u5c31\u8fd4\u56de\u8bfb\u53d6\u5927\u5c0f,\u51fa\u9519\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316spi\nspi.setup(0,nil,0,0,8,2000000,spi.MSB,1,1)\n-- \u63a5\u6536\u6570\u636e\nlocal recv = spi.recv(0, 4)--\u63a5\u65364\u5b57\u8282\u6570\u636e\n\n-- \u5f53\u4f20\u5165zbuff\u53c2\u6570\u65f6,\u8fd4\u56de\u503c\u6709\u6240\u4e0d\u540c. 2024.3.29\u65b0\u589e\n-- \u8bfb\u53d6\u6210\u529f\u540e, \u6307\u9488\u4f1a\u5f80\u540e\u79fb\u52a8len\u4e2a\u5b57\u8282\n-- \u5199\u5165\u4f4d\u7f6e\u4ee5\u5f53\u524dused()\u4f4d\u7f6e\u5f00\u59cb, \u8bf7\u52a1\u5fc5\u786e\u4fdd\u6709\u8db3\u591f\u7a7a\u95f4\u5199\u5165len\u957f\u5ea6\u7684\u6570\u636e\nlocal len = spi.recv(0, 4, buff)\n", "prefix": "spi.recv"}, "spi.send": {"body": "spi.send(${1:id},${2:data[},${3:len]})", "description": "spi.send(id, data[, len]) - \u53d1\u9001SPI\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint SPI\u53f7,\u4f8b\u59820\nstring/zbuff \u5f85\u53d1\u9001\u7684\u6570\u636e\uff0c\u5982\u679c\u4e3azbuff\u6570\u636e\uff0c\u5219\u4f1a\u4ece\u5bf9\u8c61\u6240\u5904\u7684\u6307\u9488\u5904\u5f00\u59cb\u8bfb\nint \u53ef\u9009\u3002\u5f85\u53d1\u9001\u6570\u636e\u7684\u957f\u5ea6\uff0c\u9ed8\u8ba4\u4e3adata\u957f\u5ea6\n\u8fd4\u56de\u503c\uff1a\nint \u53d1\u9001\u7ed3\u679c\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316spi\nspi.setup(0,nil,0,0,8,2000000,spi.MSB,1,1)\nlocal result = spi.send(0, \"123\")--\u53d1\u9001123\n\nlocal buff = zbuff.create(1024, 0x33) --\u521b\u5efa\u4e00\u4e2a\u521d\u503c\u5168\u4e3a0x33\u7684\u5185\u5b58\u533a\u57df\nlocal result = spi.send(0, buff)--\u628azbuff\u6570\u636e\u4ece\u6307\u9488\u5f00\u59cb\uff0c\u5168\u53d1\u51fa\u53bb\n", "prefix": "spi.send"}, "spi.deviceSetup": {"body": "spi.deviceSetup(${1:id},${2:cs},${3:CPHA},${4:CPOL},${5:dataw},${6:bandrate},${7:bitdict},${8:ms},${9:mode})", "description": "spi.deviceSetup(id, cs, CPHA, CPOL, dataw, bandrate, bitdict, ms, mode) - \u8bbe\u7f6e\u5e76\u542f\u7528SPI(\u5bf9\u8c61\u65b9\u5f0f)\n\u4f20\u5165\u503c\uff1a\nint SPI\u53f7,\u4f8b\u59820\nint CS \u7247\u9009\u811a,\u5728w600\u4e0d\u53ef\u7528\u8bf7\u586bnil\nint CPHA \u9ed8\u8ba40,\u53ef\u90090/1\nint CPOL \u9ed8\u8ba40,\u53ef\u90090/1\nint \u6570\u636e\u5bbd\u5ea6,\u9ed8\u8ba48bit\nint \u6ce2\u7279\u7387,\u9ed8\u8ba420M=20000000\nint \u5927\u5c0f\u7aef, \u9ed8\u8ba4spi.MSB, \u53ef\u9009spi.LSB\nint \u4e3b\u4ece\u8bbe\u7f6e, \u9ed8\u8ba4\u4e3b1, \u53ef\u9009\u4ece\u673a0. \u901a\u5e38\u53ea\u652f\u6301\u4e3b\u673a\u6a21\u5f0f\nint \u5de5\u4f5c\u6a21\u5f0f, \u5168\u53cc\u5de51, \u534a\u53cc\u5de50, \u9ed8\u8ba4\u5168\u53cc\u5de5\n\u8fd4\u56de\u503c\uff1a\nuserdata spi_device\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316spi\nlocal spi_device = spi.deviceSetup(0,17,0,0,8,2000000,spi.MSB,1,1)\n", "prefix": "spi.deviceSetup"}, "spi_device:close": {"body": "spi_device:close()", "description": "spi_device:close() - \u5173\u95ed\u6307\u5b9a\u7684SPI(\u5bf9\u8c61\u65b9\u5f0f)\n\u4f20\u5165\u503c\uff1a\nuserdata spi_device\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u8fd4\u56de0,\u5426\u5219\u8fd4\u56de\u5176\u4ed6\u503c\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316spi\nspi_device.close()\n", "prefix": "spi_device:close"}, "spi_device:transfer": {"body": "spi_device:transfer(${1:send_data[},${2:len]})", "description": "spi_device:transfer(send_data[, len]) - \u4f20\u8f93SPI\u6570\u636e(\u5bf9\u8c61\u65b9\u5f0f)\n\u4f20\u5165\u503c\uff1a\nuserdata spi_device\nstring/zbuff \u5f85\u53d1\u9001\u7684\u6570\u636e\uff0c\u5982\u679c\u4e3azbuff\u6570\u636e\uff0c\u5219\u4f1a\u4ece\u5bf9\u8c61\u6240\u5904\u7684\u6307\u9488\u5904\u5f00\u59cb\u8bfb\nint \u53ef\u9009\u3002\u5f85\u53d1\u9001\u6570\u636e\u7684\u957f\u5ea6\uff0c\u9ed8\u8ba4\u4e3adata\u957f\u5ea6\nint \u53ef\u9009\u3002\u8bfb\u53d6\u6570\u636e\u7684\u957f\u5ea6\uff0c\u9ed8\u8ba4\u4e3a1\n\u8fd4\u56de\u503c\uff1a\nstring \u8bfb\u53d6\u6210\u529f\u8fd4\u56de\u5b57\u7b26\u4e32,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316spi\nlocal spi_device = spi.device_setup(0,17,0,0,8,2000000,spi.MSB,1,1)\nlocal recv = spi_device:transfer(\"123\")--\u53d1\u9001123,\u5e76\u8bfb\u53d6\u6570\u636e\nlocal result = spi_device:transfer({0x00,0x01})--\u53d1\u90010x00,0x01,\u5e76\u8bfb\u53d6\u6570\u636e\n\nlocal buff = zbuff.create(1024, 0x33) --\u521b\u5efa\u4e00\u4e2a\u521d\u503c\u5168\u4e3a0x33\u7684\u5185\u5b58\u533a\u57df\nlocal recv = spi_device:transfer(buff)--\u628azbuff\u6570\u636e\u4ece\u6307\u9488\u5f00\u59cb\uff0c\u5168\u53d1\u51fa\u53bb,\u5e76\u8bfb\u53d6\u6570\u636e\n", "prefix": "spi_device:transfer"}, "spi_device:send": {"body": "spi_device:send(${1:data[},${2:len]})", "description": "spi_device:send(data[, len]) - \u53d1\u9001SPI\u6570\u636e(\u5bf9\u8c61\u65b9\u5f0f)\n\u4f20\u5165\u503c\uff1a\nuserdata spi_device\nstring/zbuff \u5f85\u53d1\u9001\u7684\u6570\u636e\uff0c\u5982\u679c\u4e3azbuff\u6570\u636e\uff0c\u5219\u4f1a\u4ece\u5bf9\u8c61\u6240\u5904\u7684\u6307\u9488\u5904\u5f00\u59cb\u8bfb\n\u8fd4\u56de\u503c\uff1a\nint \u53d1\u9001\u7ed3\u679c\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316spi\nlocal spi_device = spi.device_setup(0,17,0,0,8,2000000,spi.MSB,1,1)\nlocal result = spi_device:send(\"123\")--\u53d1\u9001123\nlocal result = spi_device:send({0x00,0x01})--\u53d1\u90010x00,0x01\n\nlocal buff = zbuff.create(1024, 0x33) --\u521b\u5efa\u4e00\u4e2a\u521d\u503c\u5168\u4e3a0x33\u7684\u5185\u5b58\u533a\u57df\nlocal result = spi_device:send(buff)--\u628azbuff\u6570\u636e\u4ece\u6307\u9488\u5f00\u59cb\uff0c\u5168\u53d1\u51fa\u53bb\n", "prefix": "spi_device:send"}, "spi_device:recv": {"body": "spi_device:recv(${1:size})", "description": "spi_device:recv(size) - \u63a5\u6536\u6307\u5b9a\u957f\u5ea6\u7684SPI\u6570\u636e(\u5bf9\u8c61\u65b9\u5f0f)\n\u4f20\u5165\u503c\uff1a\nuserdata spi_device\nint \u6570\u636e\u957f\u5ea6\n\u8fd4\u56de\u503c\uff1a\nstring \u8bfb\u53d6\u6210\u529f\u8fd4\u56de\u5b57\u7b26\u4e32,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316spi\nlocal spi_device = spi.device_setup(0,17,0,0,8,2000000,spi.MSB,1,1)\nlocal recv = spi_device:recv(4)--\u63a5\u65364\u5b57\u8282\u6570\u636e\n", "prefix": "spi_device:recv"}, "spi.xfer": {"body": "spi.xfer(${1:id},${2:txbuff},${3:rxbuff},${4:rx_len},${5:transfer_done_topic})", "description": "spi.xfer(id, txbuff, rxbuff, rx_len, transfer_done_topic) - \u975e\u963b\u585e\u65b9\u5f0f\u786c\u4ef6SPI\u4f20\u8f93SPI\u6570\u636e\uff0c\u76ee\u7684\u4e3a\u4e86\u63d0\u9ad8\u6838\u5fc3\u5229\u7528\u7387\u3002API\u76f4\u63a5\u8fd4\u56de\u662f\u5426\u542f\u52a8\u4f20\u8f93\uff0c\u4f20\u8f93\u5b8c\u6210\u540e\u901a\u8fc7topic\u56de\u8c03\uff0c\u672cAPI\u9002\u5408\u786c\u4ef6SPI\u4f20\u8f93\u5927\u91cf\u6570\u636e\u4f20\u8f93\uff0c\u5916\u8bbe\u529f\u80fd\uff08LCD SPI\uff0cW5500 SPI\u4e4b\u7c7b\u7684\uff09\u5360\u636e\u7684SPI\u548c\u8f6f\u4ef6SPI\u4e0d\u80fd\u7528\uff0c\u5c11\u91cf\u6570\u636e\u4f20\u8f93\u5efa\u8bae\u4f7f\u7528\u4f20\u7edf\u963b\u585e\u578bAPI\n\u4f20\u5165\u503c\uff1a\nuserdata or int spi_device\u6216\u8005spi_id\uff0c\u6ce8\u610f\uff0c\u5982\u679c\u662fspi_device\uff0c\u9700\u8981\u624b\u52a8\u5728\u4f20\u8f93\u5b8c\u6210\u540e\u62c9\u9ad8cs!!!!!!\nzbuff \u5f85\u53d1\u9001\u7684\u6570\u636e\uff0c\u5982\u679c\u4e3anil\uff0c\u5219\u53ea\u63a5\u6536\u6570\u636e\uff0c\u7531\u4e8e\u7528\u7684\u975e\u963b\u585e\u6a21\u578b\uff0c\u4e3a\u4fdd\u8bc1\u52a8\u6001\u6570\u636e\u7684\u6709\u6548\u6027\uff0c\u53ea\u80fd\u4f7f\u7528zbuff\uff0c\u53d1\u9001\u7684\u6570\u636e\u4ecezbuff.addr\nzbuff \u63a5\u6536\u6570\u636e\uff0c\u5982\u679c\u4e3anil\uff0c\u5219\u53ea\u53d1\u9001\u6570\u636e\uff0c\u7531\u4e8e\u7528\u7684\u975e\u963b\u585e\u6a21\u578b\uff0c\u4e3a\u4fdd\u8bc1\u52a8\u6001\u6570\u636e\u7684\u6709\u6548\u6027\uff0c\u53ea\u80fd\u4f7f\u7528zbuff\uff0c\u63a5\u6536\u7684\u6570\u636e\u4ecezbuff.addr\u5f00\u59cb\u5b58\u50a8\nint \u4f20\u8f93\u6570\u636e\u957f\u5ea6\uff0c\u7279\u522b\u8bf4\u660e \u5982\u679c\u4e3a\u534a\u53cc\u5de5\uff0c\u5148\u53d1\u540e\u6536\uff0c\u6bd4\u5982spi flash\u64cd\u4f5c\u8fd9\u79cd\uff0c\u5219\u957f\u5ea6=\u53d1\u9001\u5b57\u8282+\u63a5\u6536\u5b57\u8282\uff0c\u6ce8\u610f\u4e0a\u9762\u53d1\u9001\u548c\u63a5\u6536buff\u90fd\u8981\u7559\u8db3\u591f\u7684\u6570\u636e\uff0c\u540e\u7eed\u63a5\u6536\u6570\u636e\u5904\u7406\u9700\u8981\u8df3\u8fc7\u53d1\u9001\u6570\u636e\u957f\u5ea6\u5b57\u8282\nstring \u4f20\u8f93\u5b8c\u6210\u540e\u56de\u8c03\u7684topic\n\u8fd4\u56de\u503c\uff1a\nboolean true/false \u672c\u6b21\u4f20\u8f93\u662f\u5426\u6b63\u786e\u542f\u52a8\uff0ctrue\uff0c\u542f\u52a8\uff0cfalse\uff0c\u6709\u9519\u8bef\u65e0\u6cd5\u542f\u52a8\u3002\u4f20\u8f93\u5b8c\u6210\u4f1a\u53d1\u5e03\u6d88\u606ftransfer_done_topic\u548cboolean\u578b\u7ed3\u679c\n\u4f8b\u5b50\uff1a\nlocal result = spi.xfer(spi.SPI_0, txbuff, rxbuff, 1024, \"SPIDONE\") if result then result, spi_id, succ, error_code = sys.waitUntil(\"SPIDONE\") end if not result or not succ then log.info(\"spi fail, error code\", error_code) else log.info(\"spi ok\") end\n\n", "prefix": "spi.xfer"}, "spislave.setup": {"body": "spislave.setup(${1:id},${2:opts})", "description": "spislave.setup(id, opts) - \u521d\u59cb\u5316SPI\u4ece\u673a\n\u4f20\u5165\u503c\uff1a\nint \u4ece\u673aSPI\u7684\u7f16\u53f7,\u6ce8\u610f\u4e0eSPI\u4e3b\u673a\u7684\u7f16\u53f7\u7684\u5dee\u5f02,\u8fd9\u4e2a\u4e0e\u5177\u4f53\u8bbe\u5907\u76f8\u5173\ntable opts \u6269\u5c55\u914d\u7f6e\u53c2\u6570,\u5f53\u524d\u65e0\u53c2\u6570\n\u8fd4\u56de\u503c\uff1a\nboolean true\u8868\u793a\u6210\u529f,\u5176\u4ed6\u5931\u8d25\n\u4f8b\u5b50\uff1a\n-- \u5f53\u524d\u4ec5XT804\u7cfb\u5217\u652f\u6301, \u4f8b\u5982 Air101/Air103/Air601/Air690\n-- Air101\u4e3a\u4f8b, \u521d\u59cb\u5316SPI\u4ece\u673a, \u7f16\u53f7\u4e3a2, SPI\u6a21\u5f0f\nspislave.setup(2)\n-- Air101\u4e3a\u4f8b, \u521d\u59cb\u5316SPI\u4ece\u673a, \u7f16\u53f7\u4e3a3, SDIO\u6a21\u5f0f\nspislavve.setup(3)\n", "prefix": "spislave.setup"}, "spislave.ready": {"body": "spislave.ready(${1:id})", "description": "spislave.ready(id) - \u662f\u5426\u53ef\u5199\n\u4f20\u5165\u503c\uff1a\nint \u4ece\u673aSPI\u7684\u7f16\u53f7\n\u8fd4\u56de\u503c\uff1a\nboolean true\u8868\u793a\u53ef\u5199,\u5176\u4ed6\u4e0d\u53ef\u5199\n", "prefix": "spislave.ready"}, "spislave.on": {"body": "spislave.on(${1:id},${2:cb})", "description": "spislave.on(id, cb) - \u6ce8\u518c\u4e8b\u4ef6\u56de\u8c03\u51fd\u6570\n\u4f20\u5165\u503c\uff1a\nint \u4ece\u673aSPI\u7684\u7f16\u53f7\nfunction \u56de\u8c03\u51fd\u6570\n", "prefix": "spislave.on"}, "spislave.read": {"body": "spislave.read(${1:id},${2:ptr},${3:buff},${4:len})", "description": "spislave.read(id, ptr, buff, len) - \u8bfb\u53d6\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u4ece\u673aSPI\u7684\u7f16\u53f7\nuserdata \u7528\u6237\u6570\u636e\u6307\u9488, \u4ece\u56de\u8c03\u51fd\u6570\u5f97\u5230\nint zbuff\u7f13\u51b2\u5bf9\u8c61\nint \u8bfb\u53d6\u957f\u5ea6,\u4ece\u56de\u8c03\u51fd\u6570\u5f97\u5230\n\u8fd4\u56de\u503c\uff1a\nint \u8bfb\u53d6\u5230\u5b57\u8282\u6570,\u901a\u5e38\u4e0e\u671f\u671b\u8bfb\u53d6\u7684\u957f\u5ea6\u76f8\u540c\nint \u9519\u8bef\u7801, \u4ec5\u5f53\u51fa\u9519\u65f6\u8fd4\u56de\n", "prefix": "spislave.read"}, "spislave.write": {"body": "spislave.write(${1:id},${2:ptr},${3:buff},${4:len})", "description": "spislave.write(id, ptr, buff, len) - \u5199\u5165\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u4ece\u673aSPI\u7684\u7f16\u53f7\nuserdata \u7528\u6237\u6570\u636e\u6307\u9488, \u5f53\u524d\u4f20nil\nint zbuff\u7f13\u51b2\u5bf9\u8c61\nint \u5199\u5165\u957f\u5ea6,\u6ce8\u610f\u4e0d\u80fd\u8d85\u8fc7\u786c\u4ef6\u9650\u5236,\u901a\u5e38\u662f1500\u5b57\u8282\n\u8fd4\u56de\u503c\uff1a\nboolean true\u8868\u793a\u6210\u529f,\u5176\u4ed6\u5931\u8d25\nint \u9519\u8bef\u7801, \u4ec5\u5f53\u51fa\u9519\u65f6\u8fd4\u56de\n", "prefix": "spislave.write"}, "sqlite3.open": {"body": "sqlite3.open(${1:path})", "description": "sqlite3.open(path) - \u6253\u5f00\u6570\u636e\u5e93\n\u4f20\u5165\u503c\uff1a\nstring \u6570\u636e\u5e93\u6587\u4ef6\u8def\u5f84,\u5fc5\u987b\u586b\u5199,\u4e0d\u5b58\u5728\u5c31\u4f1a\u81ea\u52a8\u65b0\u5efa\n\u8fd4\u56de\u503c\uff1a\nuserdata \u6570\u636e\u5e93\u6307\u9488,\u662f\u5426\u5c31\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nlocal db = sqlite3.open(\"/test.db\")\nif db then\n -- \u6570\u636e\u5e93\u64cd\u4f5cxxxx\n\n -- \u7528\u5b8c\u5fc5\u987b\u5173\u6389\n sqlite3.close(db)\nend\n", "prefix": "sqlite3.open"}, "sqlite3.exec": {"body": "sqlite3.exec(${1:db},${2:sql})", "description": "sqlite3.exec(db, sql) - \u6267\u884cSQL\u8bed\u53e5\n\u4f20\u5165\u503c\uff1a\nuserdata \u901a\u8fc7sqlite3.open\u83b7\u53d6\u5230\u7684\u6570\u636e\u5e93\u6307\u9488\nstring SQL\u5b57\u7b26\u4e32,\u5fc5\u987b\u586b\u5199\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56denil\ntable \u6210\u529f\u8fd4\u56de\u67e5\u8be2\u7ed3\u679c(\u82e5\u6709),\u5426\u5219\u8fd4\u56de\u62a5\u9519\u7684\u5b57\u7b26\u4e32\n", "prefix": "sqlite3.exec"}, "sqlite3.close": {"body": "sqlite3.close(${1:db})", "description": "sqlite3.close(db) - \u5173\u95ed\u6570\u636e\u5e93\n\u4f20\u5165\u503c\uff1a\nuserdata \u901a\u8fc7sqlite3.open\u83b7\u53d6\u5230\u7684\u6570\u636e\u5e93\u6307\u9488\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56denil\n", "prefix": "sqlite3.close"}, "statem.create": {"body": "statem.create(${1:count},${2:repeat})", "description": "statem.create(count, repeat) - \u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u72b6\u6001\u673a.\n\u4f20\u5165\u503c\uff1a\nint \u6307\u4ee4\u6761\u6570,\u9ed8\u8ba432\u6761\nint \u91cd\u590d\u6267\u884c\u7684\u6b21\u6570, 0 \u4ee3\u8868\u4e0d\u91cd\u590d, \u6b63\u6574\u6570\u4ee3\u8868\u5177\u4f53\u91cd\u590d\u6267\u884c\u7684\u6b21\u6570. \u6682\u4e0d\u652f\u6301\u6c38\u7eed\u6267\u884c\n\u8fd4\u56de\u503c\uff1a\nsome \u82e5\u6210\u529f,\u8fd4\u56de\u72b6\u6001\u673a\u6307\u9488,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\ngpio.setup(7, 0, gpio.PULLUP)\ngpio.setup(12, 0, gpio.PULLUP)\ngpio.setup(13, 0, gpio.PULLUP)\ngpio.setup(14, 0, gpio.PULLUP)\nlocal sm = statem.create()\n :gpio_set(7, 0) -- gpio\u8bbe\u7f6e\u4e3a\u4f4e\u7535\u5e73\n :usleep(10) -- \u4f11\u772010us\n :gpio_set(7, 1) -- gpio\u8bbe\u7f6e\u4e3a\u9ad8\u7535\u5e73\n :usleep(40) -- \u4f11\u772040us\n :gpio_set(12, 1) -- gpio\u8bbe\u7f6e\u4e3a\u9ad8\u7535\u5e73\n :gpio_set(13, 1) -- gpio\u8bbe\u7f6e\u4e3a\u9ad8\u7535\u5e73\n :gpio_set(14, 1) -- gpio\u8bbe\u7f6e\u4e3a\u9ad8\u7535\u5e73\n :usleep(40) -- \u4f11\u772040us\n :gpio_set(7, 0) -- gpio\u8bbe\u7f6e\u4e3a\u4f4e\u7535\u5e73\n :finish()\n\n-- \u6267\u884c\u4e4b,\u540e\u7eed\u4f1a\u652f\u6301\u540e\u53f0\u6267\u884c\nsm:exec()\n", "prefix": "statem.create"}, "string.toHex": {"body": "string.toHex(${1:str},${2:separator})", "description": "string.toHex(str, separator) - \u5c06\u5b57\u7b26\u4e32\u8f6c\u6210HEX\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8f6c\u6362\u7684\u5b57\u7b26\u4e32\nstring \u5206\u9694\u7b26, \u9ed8\u8ba4\u4e3a\"\"\n\u8fd4\u56de\u503c\uff1a\nstring HEX\u5b57\u7b26\u4e32\nnumber HEX\u5b57\u7b26\u4e32\u7684\u957f\u5ea6\n\u4f8b\u5b50\uff1a\nstring.toHex(\"\\1\\2\\3\") --> \"010203\" 6\nstring.toHex(\"123abc\") --> \"313233616263\" 12\nstring.toHex(\"123abc\", \" \") --> \"31 32 33 61 62 63 \" 12\n", "prefix": "string.toHex"}, "string.fromHex": {"body": "string.fromHex(${1:hex})", "description": "string.fromHex(hex) - \u5c06HEX\u8f6c\u6210\u5b57\u7b26\u4e32\n\u4f20\u5165\u503c\uff1a\nstring hex,16\u8fdb\u5236\u7ec4\u6210\u7684\u4e32\n\u8fd4\u56de\u503c\uff1a\nstring \u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\nstring.fromHex(\"010203\") --> \"\\1\\2\\3\"\nstring.fromHex(\"313233616263\") --> \"123abc\"\n", "prefix": "string.fromHex"}, "string.split": {"body": "string.split(${1:str},${2:delimiter},${3:keepEmtry})", "description": "string.split(str, delimiter, keepEmtry) - \u6309\u7167\u6307\u5b9a\u5206\u9694\u7b26\u5206\u5272\u5b57\u7b26\u4e32\n\u4f20\u5165\u503c\uff1a\nstring \u8f93\u5165\u5b57\u7b26\u4e32\nstring \u5206\u9694\u7b26,\u53ef\u9009,\u9ed8\u8ba4 \",\"\nbool \u662f\u5426\u4fdd\u7559\u7a7a\u767d\u7247\u6bb5,\u9ed8\u8ba4\u4e3afalse,\u4e0d\u4fdd\u7559. 2023.4.11\u4e4b\u540e\u7684\u56fa\u4ef6\u53ef\u7528\n\u8fd4\u56de\u503c\uff1a\ntable \u5206\u5272\u540e\u7684\u5b57\u7b26\u4e32\u8868\n\u4f8b\u5b50\uff1a\nlocal tmp = string.split(\"123,233333,122\")\nlog.info(\"tmp\", json.encode(tmp))\nlocal tmp = (\"123,456,789\"):split(',') --> {'123','456','789'}\nlog.info(\"tmp\", json.encode(tmp))\n\n-- \u4fdd\u7559\u7a7a\u7247\u6bb5, 2023.4.11\u4e4b\u540e\u7684\u56fa\u4ef6\u53ef\u7528\nlocal str = \"/tmp//def/1234/\"\nlocal tmp = str:split(\"/\", true) \nlog.info(\"str.split\", #tmp, json.encode(tmp))\n", "prefix": "string.split"}, "string.toValue": {"body": "string.toValue(${1:str})", "description": "string.toValue(str) - \u8fd4\u56de\u5b57\u7b26\u4e32tonumber\u7684\u8f6c\u4e49\u5b57\u7b26\u4e32(\u7528\u6765\u652f\u6301\u8d85\u8fc731\u4f4d\u6574\u6570\u7684\u8f6c\u6362)\n\u4f20\u5165\u503c\uff1a\nstring \u8f93\u5165\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nstring \u8f6c\u6362\u540e\u7684\u4e8c\u8fdb\u5236\u5b57\u7b26\u4e32\nnumber \u8f6c\u6362\u4e86\u591a\u5c11\u4e2a\u5b57\u7b26\n\u4f8b\u5b50\uff1a\nstring.toValue(\"123456\") --> \"\\1\\2\\3\\4\\5\\6\" 6\nstring.toValue(\"123abc\") --> \"\\1\\2\\3\\a\\b\\c\" 6\n", "prefix": "string.toValue"}, "string.urlEncode": {"body": "string.urlEncode(${1:\"123abc\"})", "description": "string.urlEncode(\"123 abc\") - \u5c06\u5b57\u7b26\u4e32\u8fdb\u884curl\u7f16\u7801\u8f6c\u6362\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8f6c\u6362\u7684\u5b57\u7b26\u4e32\nint mode:url\u7f16\u7801\u7684\u8f6c\u6362\u6807\u51c6,\n", "prefix": "string.urlEncode"}, "string.toBase64": {"body": "string.toBase64(${1:str})", "description": "string.toBase64(str) - \u5c06\u5b57\u7b26\u4e32\u8fdb\u884cbase64\u7f16\u7801\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8f6c\u6362\u7684\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nstring \u89e3\u7801\u540e\u7684\u5b57\u7b26\u4e32,\u5982\u679c\u89e3\u7801\u5931\u8d25\u4f1a\u8fd4\u56de\u7a7a\u5b57\u7b26\u4e32\n", "prefix": "string.toBase64"}, "string.fromBase64": {"body": "string.fromBase64(${1:str})", "description": "string.fromBase64(str) - \u5c06\u5b57\u7b26\u4e32\u8fdb\u884cbase64\u89e3\u7801\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8f6c\u6362\u7684\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nstring \u89e3\u7801\u540e\u7684\u5b57\u7b26\u4e32,\u5982\u679c\u89e3\u7801\u5931\u8d25\u4f1a\u8fd4\u56de\u7a7a\u5b57\u7b26\u4e32\n", "prefix": "string.fromBase64"}, "string.toBase32": {"body": "string.toBase32(${1:str})", "description": "string.toBase32(str) - \u5c06\u5b57\u7b26\u4e32\u8fdb\u884cbase32\u7f16\u7801\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8f6c\u6362\u7684\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nstring \u89e3\u7801\u540e\u7684\u5b57\u7b26\u4e32,\u5982\u679c\u89e3\u7801\u5931\u8d25\u4f1a\u8fd4\u56de0\u957f\u5ea6\u5b57\u7b26\u4e32\n", "prefix": "string.toBase32"}, "string.fromBase32": {"body": "string.fromBase32(${1:str})", "description": "string.fromBase32(str) - \u5c06\u5b57\u7b26\u4e32\u8fdb\u884cbase32\u89e3\u7801\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u8f6c\u6362\u7684\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nstring \u89e3\u7801\u540e\u7684\u5b57\u7b26\u4e32,\u5982\u679c\u89e3\u7801\u5931\u8d25\u4f1a\u8fd4\u56de0\u957f\u5ea6\u5b57\u7b26\u4e32\n", "prefix": "string.fromBase32"}, "string.startsWith": {"body": "string.startsWith(${1:str},${2:prefix})", "description": "string.startsWith(str, prefix) - \u5224\u65ad\u5b57\u7b26\u4e32\u524d\u7f00\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u68c0\u67e5\u7684\u5b57\u7b26\u4e32\nstring \u524d\u7f00\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nbool \u771f\u4e3atrue, \u5047\u4e3afalse\n\u4f8b\u5b50\uff1a\nlocal str = \"abc\"\nlog.info(\"str\", str:startsWith(\"a\"))\nlog.info(\"str\", str:startsWith(\"b\"))\n", "prefix": "string.startsWith"}, "string.endsWith": {"body": "string.endsWith(${1:str},${2:suffix})", "description": "string.endsWith(str, suffix) - \u5224\u65ad\u5b57\u7b26\u4e32\u540e\u7f00\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u68c0\u67e5\u7684\u5b57\u7b26\u4e32\nstring \u540e\u7f00\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nbool \u771f\u4e3atrue, \u5047\u4e3afalse\n\u4f8b\u5b50\uff1a\nlocal str = \"abc\"\nlog.info(\"str\", str:endsWith(\"c\"))\nlog.info(\"str\", str:endsWith(\"b\"))\n", "prefix": "string.endsWith"}, "string.trim": {"body": "string.trim(${1:str},${2:ltrim},${3:rtrim})", "description": "string.trim(str, ltrim, rtrim) - \u88c1\u526a\u5b57\u7b26\u4e32,\u53bb\u9664\u5934\u5c3e\u7684\u7a7a\u683c\n\u4f20\u5165\u503c\uff1a\nstring \u9700\u8981\u5904\u7406\u7684\u5b57\u7b26\u4e32\nbool \u6e05\u7406\u524d\u7f00,\u9ed8\u8ba4\u4e3atrue\nbool \u6e05\u7406\u540e\u7f00,\u9ed8\u8ba4\u4e3atrue\n\u8fd4\u56de\u503c\uff1a\nstring \u6e05\u7406\u540e\u7684\u5b57\u7b26\u4e32\n\u4f8b\u5b50\uff1a\nlocal str = \"\\r\\nabc\\r\\n\"\nlog.info(\"str\", string.trim(str)) -- \u6253\u5370 \"abc\"\nlog.info(\"str\", str:trim()) -- \u6253\u5370 \"abc\"\nlog.info(\"str\", #string.trim(str, false, true)) -- \u4ec5\u88c1\u526a\u540e\u7f00,\u6240\u4ee5\u957f\u5ea6\u662f5\n", "prefix": "string.trim"}, "sys.wait": {"body": "sys.wait(${1:timeout})", "description": "sys.wait(timeout) - Task\u534f\u7a0b\u7b49\u5f85\u6307\u5b9a\u65f6\u957f\n\u4f20\u5165\u503c\uff1a\nint \u7b49\u5f85\u65f6\u957f,\u5355\u4f4d\u6beb\u79d2,\u5fc5\u987b\u5927\u4e8e0,\u5426\u5219\u65e0\u6548\n\u8fd4\u56de\u503c\uff1a\nany \u901a\u5e38\u4e3anil,\u9664\u975e\u4e3b\u52a8\u88ab\u5524\u9192(\u901a\u5e38\u4e0d\u4f1a)\n\u4f8b\u5b50\uff1a\nsys.taskInit(function()\n while 1 do\n sys.wait(500)\n end\nend)\n", "prefix": "sys.wait"}, "sys.waitUntil": {"body": "sys.waitUntil(${1:topic},${2:timeout})", "description": "sys.waitUntil(topic, timeout) - Task\u534f\u7a0b\u7b49\u5f85\u6307\u5b9a\u65f6\u957f\u6216\u8005\u7279\u5b9a\u7684topic\n\u4f20\u5165\u503c\uff1a\nstring \u4e8b\u4ef6topic\nint \u7b49\u5f85\u65f6\u957f,\u5355\u4f4d\u6beb\u79d2,\u5fc5\u987b\u5927\u4e8e0,\u5426\u5219\u65e0\u6548\n\u8fd4\u56de\u503c\uff1a\nboolean \u5982\u679c\u662f\u8d85\u65f6,\u8fd4\u56defalse,\u5426\u5219\u8fd4\u56detrue\nany \u5bf9\u5e94topic\u7684\u5185\u5bb9\n\u4f8b\u5b50\uff1a\nsys.taskInit(function()\n // do something\n local result, data = sys.waitUntil(\"NET_READY\", 30000)\n // do something else\nend)\n", "prefix": "sys.waitUntil"}, "sys.taskInit": {"body": "sys.taskInit(${1:func},${2:arg1},${3:arg2},${4:argN})", "description": "sys.taskInit(func, arg1, arg2, argN) - \u521b\u5efa\u4e00\u4e2aTask\u534f\u7a0b\n\u4f20\u5165\u503c\uff1a\nfunction \u5f85\u6267\u884c\u7684\u51fd\u6570,\u53ef\u4ee5\u662f\u533f\u540d\u51fd\u6570, \u4e5f\u53ef\u4ee5\u662flocal\u6216\u5168\u5c40\u51fd\u6570\nany \u9700\u8981\u4f20\u9012\u7684\u53c2\u65701,\u53ef\u9009 \nany \u9700\u8981\u4f20\u9012\u7684\u53c2\u65702,\u53ef\u9009 \nany \u9700\u8981\u4f20\u9012\u7684\u53c2\u6570N,\u53ef\u9009 \n\u8fd4\u56de\u503c\uff1a\ntask \u534f\u7a0b\u5bf9\u8c61\n\u4f8b\u5b50\uff1a\nsys.taskInit(function(a, b, c)\n log.info(\"task\", a, b, c) -- \u6253\u5370 task A B C\nend, \"A\", \"B\", \"N\")\n", "prefix": "sys.taskInit"}, "sys.timerStart": {"body": "sys.timerStart(${1:func},${2:timeout},${3:arg1},${4:arg2},${5:argN})", "description": "sys.timerStart(func, timeout, arg1, arg2, argN) - \u521b\u5efa\u4e00\u4e2a\u5b9a\u65f6\u5668.\u975eTask,\u51fd\u6570\u91cc\u4e0d\u80fd\u76f4\u63a5sys.waitXXX\n\u4f20\u5165\u503c\uff1a\nfunction \u5f85\u6267\u884c\u7684\u51fd\u6570,\u53ef\u4ee5\u662f\u533f\u540d\u51fd\u6570, \u4e5f\u53ef\u4ee5\u662flocal\u6216\u5168\u5c40\u51fd\u6570\nint \u5ef6\u65f6\u65f6\u957f,\u5355\u4f4d\u6beb\u79d2\nany \u9700\u8981\u4f20\u9012\u7684\u53c2\u65701,\u53ef\u9009 \nany \u9700\u8981\u4f20\u9012\u7684\u53c2\u65702,\u53ef\u9009 \nany \u9700\u8981\u4f20\u9012\u7684\u53c2\u6570N,\u53ef\u9009 \n\u8fd4\u56de\u503c\uff1a\nint \u5b9a\u65f6\u5668id\n\u4f8b\u5b50\uff1a\nsys.timerStart(function(a, b, c)\n log.info(\"task\", a, b, c) -- 1000\u6beb\u79d2\u540e\u624d\u4f1a\u6267\u884c, \u6253\u5370 task A B C\nend, 1000, \"A\", \"B\", \"N\")\n", "prefix": "sys.timerStart"}, "sys.timerLoopStart": {"body": "sys.timerLoopStart(${1:func},${2:timeout},${3:arg1},${4:arg2},${5:argN})", "description": "sys.timerLoopStart(func, timeout, arg1, arg2, argN) - \u521b\u5efa\u4e00\u4e2a\u5faa\u73af\u5b9a\u65f6\u5668.\u975eTask,\u51fd\u6570\u91cc\u4e0d\u80fd\u76f4\u63a5sys.waitXXX\n\u4f20\u5165\u503c\uff1a\nfunction \u5f85\u6267\u884c\u7684\u51fd\u6570,\u53ef\u4ee5\u662f\u533f\u540d\u51fd\u6570, \u4e5f\u53ef\u4ee5\u662flocal\u6216\u5168\u5c40\u51fd\u6570\nint \u5ef6\u65f6\u65f6\u957f,\u5355\u4f4d\u6beb\u79d2\nany \u9700\u8981\u4f20\u9012\u7684\u53c2\u65701,\u53ef\u9009 \nany \u9700\u8981\u4f20\u9012\u7684\u53c2\u65702,\u53ef\u9009 \nany \u9700\u8981\u4f20\u9012\u7684\u53c2\u6570N,\u53ef\u9009 \n\u8fd4\u56de\u503c\uff1a\nint \u5b9a\u65f6\u5668id\n\u4f8b\u5b50\uff1a\nsys.timerLoopStart(function(a, b, c)\n log.info(\"task\", a, b, c) -- 1000\u6beb\u79d2\u540e\u624d\u4f1a\u6267\u884c, \u6253\u5370 task A B C\nend, 1000, \"A\", \"B\", \"N\")\n", "prefix": "sys.timerLoopStart"}, "sys.timerStop": {"body": "sys.timerStop(${1:id})", "description": "sys.timerStop(id) - \u5173\u95ed\u4e00\u4e2a\u5b9a\u65f6\u5668.\n\u4f20\u5165\u503c\uff1a\nint \u5b9a\u65f6\u5668id\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlocal tcount = 0\nlocal tid \ntid = sys.timerLoopStart(function(a, b, c)\n log.info(\"task\", a, b, c) -- 1000\u6beb\u79d2\u540e\u624d\u4f1a\u6267\u884c, \u6253\u5370 task A B C\n if tcount > 10 then\n sys.timerStop(tid)\n end\n tcount = tcount + 1\nend, 1000, \"A\", \"B\", \"N\")\n", "prefix": "sys.timerStop"}, "sys.timerStopAll": {"body": "sys.timerStopAll(${1:fnc})", "description": "sys.timerStopAll(fnc) - \u5173\u95ed\u540c\u4e00\u56de\u8c03\u51fd\u6570\u7684\u6240\u6709\u5b9a\u65f6\u5668.\n\u4f20\u5165\u503c\uff1a\nfunction fnc\u56de\u8c03\u7684\u51fd\u6570\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u5173\u95ed\u56de\u8c03\u51fd\u6570\u4e3apublicTimerCbFnc\u7684\u6240\u6709\u5b9a\u65f6\u5668\nlocal function publicTimerCbFnc(tag)\nlog.info(\"publicTimerCbFnc\",tag)\nend\nsys.timerStart(publicTimerCbFnc,8000,\"first\")\nsys.timerStart(publicTimerCbFnc,8000,\"second\")\nsys.timerStart(publicTimerCbFnc,8000,\"third\")\nsys.timerStopAll(publicTimerCbFnc)\n", "prefix": "sys.timerStopAll"}, "sys.publish": {"body": "sys.publish(${1:topic},${2:arg1},${3:agr2},${4:argN})", "description": "sys.publish(topic, arg1, agr2, argN) - \u5f80\u7279\u5b9atopic\u901a\u9053\u53d1\u5e03\u4e00\u4e2a\u6d88\u606f\n\u4f20\u5165\u503c\uff1a\nstring topic\u7684\u503c\nany \u9644\u5e26\u7684\u53c2\u65701\nany \u9644\u5e26\u7684\u53c2\u65702\nany \u9644\u5e26\u7684\u53c2\u6570N\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nsys.publish(\"BT_READY\", false)\n", "prefix": "sys.publish"}, "sys.subscribe": {"body": "sys.subscribe(${1:topic},${2:func})", "description": "sys.subscribe(topic, func) - \u8ba2\u9605\u4e00\u4e2atopic\u901a\u9053\n\u4f20\u5165\u503c\uff1a\nstring topic\u7684\u503c\nfunction \u56de\u8c03\u51fd\u6570, \u6ce8\u610f, \u4e0d\u80fd\u76f4\u63a5\u4f7f\u7528sys.waitXXX\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlocal function bt_cb(state)\n log.info(\"bt\", state)\nend\nsys.subscribe(\"BT_READY\", bt_cb)\nsys.subscribe(\"BT_READY\", function(state)\n log.info(\"sys\", \"Got BT_READY\", state)\nend)\n", "prefix": "sys.subscribe"}, "sys.unsubscribe": {"body": "sys.unsubscribe(${1:topic},${2:func})", "description": "sys.unsubscribe(topic, func) - \u53d6\u6d88\u8ba2\u9605topic\u901a\u9053\n\u4f20\u5165\u503c\uff1a\nstring topic\u7684\u503c\nfunction \u56de\u8c03\u51fd\u6570, \u6ce8\u610f, \u4e0d\u80fd\u76f4\u63a5\u4f7f\u7528sys.waitXXX\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nlocal function bt_cb(state)\n log.info(\"bt\", state)\nend\nsys.unsubscribe(\"BT_READY\", bt_cb)\n", "prefix": "sys.unsubscribe"}, "sys.run": {"body": "sys.run()", "description": "sys.run() - sys\u5e93\u4e3b\u5faa\u73af\u65b9\u6cd5,\u4ec5\u5141\u8bb8\u5728main.lua\u7684\u672b\u5c3e\u8c03\u7528\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c. \u8fd9\u4e2a\u65b9\u6cd5\u51e0\u4e4e\u4e0d\u53ef\u80fd\u8fd4\u56de.\n\u4f8b\u5b50\uff1a\n-- \u603b\u662fmain.lua\u7684\u7ed3\u5c3e\u4e00\u53e5,\u5c06\u6765\u4e5f\u8bb8\u4f1a\u7b80\u5316\u6389\nsys.run()\n-- \u4e4b\u540e\u7684\u4ee3\u7801\u4e0d\u4f1a\u88ab\u6267\u884c\n", "prefix": "sys.run"}, "sysplus.waitMsg": {"body": "sysplus.waitMsg(${1:taskName},${2:target},${3:timeout})", "description": "sysplus.waitMsg(taskName, target, timeout) - \u7b49\u5f85\u63a5\u6536\u4e00\u4e2a\u76ee\u6807\u6d88\u606f\n\u4f20\u5165\u503c\uff1a\nstring \u4efb\u52a1\u540d\u79f0\uff0c\u7528\u4e8e\u5524\u9192\u4efb\u52a1\u7684id\nstring \u76ee\u6807\u6d88\u606f\uff0c\u5982\u679c\u4e3anil\uff0c\u5219\u8868\u793a\u63a5\u6536\u5230\u4efb\u610f\u6d88\u606f\u90fd\u4f1a\u9000\u51fa\nint \u8d85\u65f6\u65f6\u95f4\uff0c\u5982\u679c\u4e3anil\uff0c\u5219\u8868\u793a\u65e0\u8d85\u65f6\uff0c\u6c38\u8fdc\u7b49\u5f85\n\u8fd4\u56de\u503c\uff1a\ntable \u6210\u529f\u8fd4\u56detable\u578b\u7684msg\uff0c\u8d85\u65f6\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u7b49\u5f85\u4efb\u52a1\nsysplus.waitMsg('a', 'b', 1000)\n-- \u6ce8\u610f, \u672c\u51fd\u6570\u4f1a\u81ea\u52a8\u6ce8\u518c\u6210\u5168\u5c40\u51fd\u6570 sys_wait\n", "prefix": "sysplus.waitMsg"}, "sysplus.sendMsg": {"body": "sysplus.sendMsg(${1:taskName},${2:target},${3:arg2},${4:arg3},${5:arg4})", "description": "sysplus.sendMsg(taskName, target, arg2, arg3, arg4) - \u5411\u76ee\u6807\u4efb\u52a1\u53d1\u9001\u4e00\u4e2a\u6d88\u606f\n\u4f20\u5165\u503c\uff1a\nstring \u4efb\u52a1\u540d\u79f0\uff0c\u7528\u4e8e\u5524\u9192\u4efb\u52a1\u7684id\nany \u6d88\u606f\u4e2d\u7684\u53c2\u65701\uff0c\u540c\u65f6\u4e5f\u662fwaitMsg\u91cc\u7684target\nany \u6d88\u606f\u4e2d\u7684\u53c2\u65702\nany \u6d88\u606f\u4e2d\u7684\u53c2\u65703\nany \u6d88\u606f\u4e2d\u7684\u53c2\u65704\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue, \u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u5411\u4efb\u52a1a,\u76ee\u6807b\u53d1\u9001\u6d88\u606f\nsysplus.sendMsg('a', 'b')\n-- \u6ce8\u610f, \u672c\u51fd\u6570\u4f1a\u81ea\u52a8\u6ce8\u518c\u6210\u5168\u5c40\u51fd\u6570 sys_send\n", "prefix": "sysplus.sendMsg"}, "sysplus.taskInitEx": {"body": "sysplus.taskInitEx(${1:fun},${2:taskName},${3:cbFun},${4:...})", "description": "sysplus.taskInitEx(fun, taskName, cbFun, ...) - \u521b\u5efa\u4e00\u4e2a\u4efb\u52a1\u7ebf\u7a0b,\u5728\u6a21\u5757\u6700\u672b\u884c\u8c03\u7528\u8be5\u51fd\u6570\u5e76\u6ce8\u518c\u6a21\u5757\u4e2d\u7684\u4efb\u52a1\u51fd\u6570,main.lua\u5bfc\u5165\u8be5\u6a21\u5757\u5373\u53ef\n\u4f20\u5165\u503c\uff1a\nfunction \u4efb\u52a1\u51fd\u6570\u540d,\u7528\u4e8eresume\u5524\u9192\u65f6\u8c03\u7528\nstring \u4efb\u52a1\u540d\u79f0,\u7528\u4e8e\u5524\u9192\u4efb\u52a1\u7684id\nfunction \u63a5\u6536\u5230\u975e\u76ee\u6807\u6d88\u606f\u65f6\u7684\u56de\u8c03\u51fd\u6570\nany ... \u4efb\u52a1\u51fd\u6570fun\u7684\u53ef\u53d8\u53c2\u6570\n\u8fd4\u56de\u503c\uff1a\nnumber \u8fd4\u56de\u8be5\u4efb\u52a1\u7684\u7ebf\u7a0b\u53f7\n\u4f8b\u5b50\uff1a\nsysplus.taskInitEx(task1,'a',callback)\n", "prefix": "sysplus.taskInitEx"}, "sysplus.taskDel": {"body": "sysplus.taskDel(${1:taskName})", "description": "sysplus.taskDel(taskName) - \u5220\u9664\u7531taskInitEx\u521b\u5efa\u7684\u4efb\u52a1\u7ebf\u7a0b\n\u4f20\u5165\u503c\uff1a\nstring \u4efb\u52a1\u540d\u79f0,\u7528\u4e8e\u5524\u9192\u4efb\u52a1\u7684id\n\u4f8b\u5b50\uff1a\nsysplus.taskDel('a')\n", "prefix": "sysplus.taskDel"}, "sysplus.cleanMsg": {"body": "sysplus.cleanMsg(${1:taskName})", "description": "sysplus.cleanMsg(taskName) - \u6e05\u9664\u6307\u5b9atask\u7684\u6d88\u606f\u961f\u5217\n\u4f20\u5165\u503c\uff1a\nstring \u4efb\u52a1\u540d\u79f0\n\u4f8b\u5b50\uff1a\nsysplus.cleanMsg('a')\n", "prefix": "sysplus.cleanMsg"}, "timer.mdelay": {"body": "timer.mdelay(${1:timeout})", "description": "timer.mdelay(timeout) - \u786c\u963b\u585e\u6307\u5b9a\u65f6\u957f\n\u4f20\u5165\u503c\uff1a\nint \u963b\u585e\u65f6\u957f,\u5355\u4f4dms, \u6700\u9ad81024ms, \u5b9e\u9645\u4f7f\u7528\u5f3a\u70c8\u5efa\u8bae\u4e0d\u8981\u8d85\u8fc7200ms\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u671f\u95f4\u6ca1\u6709\u4efb\u4f55luat\u4ee3\u7801\u4f1a\u6267\u884c,\u5305\u62ec\u5e95\u5c42\u6d88\u606f\u5904\u7406\u673a\u5236\n-- \u672c\u65b9\u6cd5\u901a\u5e38\u4e0d\u4f1a\u4f7f\u7528,\u9664\u975e\u4f60\u5f88\u6e05\u695a\u4f1a\u53d1\u751f\u4ec0\u4e48\ntimer.mdelay(10)\n", "prefix": "timer.mdelay"}, "timer.udelay": {"body": "timer.udelay(${1:timeout})", "description": "timer.udelay(timeout) - \u786c\u963b\u585e\u6307\u5b9a\u65f6\u957f\u4f46us\u7ea7\u522b,\u4e0d\u4f1a\u5f88\u7cbe\u51c6\n\u4f20\u5165\u503c\uff1a\nint \u963b\u585e\u65f6\u957f,\u5355\u4f4dus, \u6700\u59273000us\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u672c\u65b9\u6cd5\u901a\u5e38\u4e0d\u4f1a\u4f7f\u7528,\u9664\u975e\u4f60\u5f88\u6e05\u695a\u4f1a\u53d1\u751f\u4ec0\u4e48\n-- \u672cAPI\u5728 2023.05.18 \u6dfb\u52a0\ntimer.udelay(10)\n-- \u5b9e\u9645\u963b\u585e\u65f6\u957f\u662f\u6709\u6ce2\u52a8\u7684\n", "prefix": "timer.udelay"}, "touchkey.setup": {"body": "touchkey.setup(${1:id},${2:scan_period},${3:window},${4:threshold})", "description": "touchkey.setup(id, scan_period, window, threshold) - \u914d\u7f6e\u89e6\u6478\u6309\u952e\n\u4f20\u5165\u503c\uff1a\nint \u4f20\u611f\u5668id,\u8bf7\u67e5\u9605\u786c\u4ef6\u6587\u6863, \u4f8b\u5982air101/air103\u652f\u6301 1~15, \u4f8b\u5982PA7\u5bf9\u5e94touch id=1\nint \u626b\u63cf\u95f4\u9694,\u8303\u56f41 ~ 0x3F, \u5355\u4f4d16ms,\u53ef\u9009\nint \u626b\u63cf\u7a97\u53e3,\u8303\u56f42-7, \u53ef\u9009\nint \u9600\u503c, \u8303\u56f40-127, \u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue, \u5931\u8d25\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\ntouchkey.setup(1)\nsys.subscribe(\"TOUCHKEY_INC\", function(id, count)\n -- \u4f20\u611f\u5668id\n -- \u8ba1\u6570\u5668,\u89e6\u6478\u6b21\u6570\u7edf\u8ba1\n log.info(\"touchkey\", id, count)\nend)\n", "prefix": "touchkey.setup"}, "touchkey.close": {"body": "touchkey.close(${1:id})", "description": "touchkey.close(id) - \u5173\u95ed\u521d\u59cb\u89e6\u6478\u6309\u952e\n\u4f20\u5165\u503c\uff1a\nint \u4f20\u611f\u5668id,\u8bf7\u67e5\u9605\u786c\u4ef6\u6587\u6863\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u4e0d\u592a\u53ef\u80fd\u9700\u8981\u5173\u6389\u7684\u6837\u5b50\ntouchkey.close(1)\n", "prefix": "touchkey.close"}, "u8g2.begin": {"body": "u8g2.begin(${1:conf})", "description": "u8g2.begin(conf) - u8g2\u663e\u793a\u5c4f\u521d\u59cb\u5316\n\u4f20\u5165\u503c\uff1a\ntable conf \u914d\u7f6e\u4fe1\u606f,\u8be6\u7ec6\u914d\u7f6e\u770b\u4e0b\u9762\u7684\u4f8b\u5b50\n\u8fd4\u56de\u503c\uff1a\nint \u6b63\u5e38\u521d\u59cb\u53161,\u5df2\u7ecf\u521d\u59cb\u5316\u8fc72,\u5185\u5b58\u4e0d\u591f3,\u521d\u59cb\u5316\u5931\u8d25\u8fd4\u56de4\n\u4f8b\u5b50\uff1a\n-- conf\u914d\u7f6e\u9879\u8bf4\u660e\n-- ic \u5b57\u7b26\u4e32,\u4e3b\u63a7\u82af\u7247\u7c7b\u578b, \u652f\u6301custom(\u81ea\u5b9a\u4e49\u547d\u4ee4) ssd1306(\u9ed8\u8ba4) ssd1309 ssd1322 sh1106 sh1107 sh1108 st7567 uc1701 ssd1306_128x32\n-- direction \u6570\u503c,\u65b9\u5411,\u53ef\u90090 90 180 270 \u9ed8\u8ba40\n-- mode \u5b57\u7b26\u4e32,\u6a21\u5f0f,\u53ef\u9009i2c_sw:\u8f6f\u4ef6i2c i2c_hw:\u786c\u4ef6i2c,spi_hw_4pin: \u786c\u4ef6spi\n-- i2c_id: \u6570\u503c,\u786c\u4ef6i2c\u65f6\u6709\u6548\n-- i2c_scl: \u6570\u503c,\u8f6f\u4ef6i2c\u65f6\u65f6\u949f\u7ebf\u7684GPIO\u7f16\u53f7\n-- i2c_sda: \u6570\u503c\u8f6f\u4ef6i2c\u65f6\u6570\u636e\u7ebf\u7684GPIO\u7f16\u53f7\n-- spi_id\u3001spi_res\u3001spi_dc\u3001spi_cs: \u6570\u503c,\u786c\u4ef6spi\u7684SPI\u7f16\u53f7,\u590d\u4f4dGPIO\u7f16\u53f7,DC\u7ebf\u7684GPIO\u7f16\u53f7, CS\u7ebf\u7684GPIO\u7f16\u53f7\n-- x_offset: \u6570\u503c,X\u8f74\u504f\u79fb\u91cf,\u9ed8\u8ba4\u6309\u9a71\u52a8\u8d70, 2023.11.10\u65b0\u589e\u7684\u914d\u7f6e\u9879\n\n-- \u521d\u59cb\u5316\u786c\u4ef6i2c\u7684ssd1306\nu8g2.begin({ic = \"ssd1306\",direction = 0,mode=\"i2c_hw\",i2c_id=0}) -- direction \u53ef\u90090 90 180 270\n-- \u521d\u59cb\u5316\u786c\u4ef6spi\u7684ssd1306\nu8g2.begin({ic = \"ssd1306\",direction = 0,mode=\"spi_hw_4pin\",spi_id=0,spi_res=pin.PB03,spi_dc=pin.PB01,spi_cs=pin.PB04}) -- direction \u53ef\u90090 90 180 270\n-- \u521d\u59cb\u5316\u8f6f\u4ef6i2c\u7684ssd1306\nu8g2.begin({ic = \"ssd1306\",direction = 0,mode=\"i2c_sw\", i2c_scl=1, i2c_sda=4}) -- \u901a\u8fc7PA1 SCL / PA4 SDA\u6a21\u62df\n", "prefix": "u8g2.begin"}, "u8g2.close": {"body": "u8g2.close()", "description": "u8g2.close() - \u5173\u95ed\u663e\u793a\u5c4f\n\u4f8b\u5b50\uff1a\n-- \u5173\u95eddisp,\u518d\u6b21\u4f7f\u7528disp\u76f8\u5173API\u7684\u8bdd,\u9700\u8981\u91cd\u65b0\u521d\u59cb\u5316\nu8g2.close()\n", "prefix": "u8g2.close"}, "u8g2.ClearBuffer": {"body": "u8g2.ClearBuffer()", "description": "u8g2.ClearBuffer() - \u6e05\u5c4f\uff0c\u6e05\u9664\u5185\u5b58\u5e27\u7f13\u51b2\u533a\u4e2d\u7684\u6240\u6709\u50cf\u7d20\n\u4f8b\u5b50\uff1a\n-- \u6e05\u5c4f\nu8g2.ClearBuffer()\n", "prefix": "u8g2.ClearBuffer"}, "u8g2.SendBuffer": {"body": "u8g2.SendBuffer()", "description": "u8g2.SendBuffer() - \u5c06\u6570\u636e\u66f4\u65b0\u5230\u5c4f\u5e55\uff0c\u5c06\u5b58\u50a8\u5668\u5e27\u7f13\u51b2\u533a\u7684\u5185\u5bb9\u53d1\u9001\u5230\u663e\u793a\u5668\n\u4f8b\u5b50\uff1a\n-- \u628a\u663e\u793a\u6570\u636e\u66f4\u65b0\u5230\u5c4f\u5e55\nu8g2.SendBuffer()\n", "prefix": "u8g2.SendBuffer"}, "u8g2.DrawUTF8": {"body": "u8g2.DrawUTF8(${1:str},${2:x},${3:y})", "description": "u8g2.DrawUTF8(str, x, y) - \u5728\u663e\u793a\u5c4f\u4e0a\u753b\u4e00\u6bb5\u6587\u5b57\uff0c\u5728\u663e\u793a\u5c4f\u4e0a\u753b\u4e00\u6bb5\u6587\u5b57,\u8981\u8c03\u7528u8g2.SendBuffer()\u624d\u4f1a\u66f4\u65b0\u5230\u5c4f \u6ce8\u610f:\u8bbe\u7f6e\u5750\u6807\u4e3a\u663e\u793a\u5b57\u7b26\u4e32\u5de6\u4e0b\u89d2\u5750\u6807\n\u4f20\u5165\u503c\uff1a\nstring \u6587\u4ef6\u5185\u5bb9\nint \u6a2a\u5750\u6807\nint \u7ad6\u5750\u6807\n\u4f8b\u5b50\uff1a\nu8g2.DrawUTF8(\"wifi is ready\", 10, 20)\n", "prefix": "u8g2.DrawUTF8"}, "u8g2.DrawButtonUTF8": {"body": "u8g2.DrawButtonUTF8(${1:str},${2:x},${3:y},${4:flags},${5:w},${6:h},${7:v},${8:str})", "description": "u8g2.DrawButtonUTF8(str, x, y, flags, w, h, v, str) - \u5728\u63d0\u4f9b\u7684\u6587\u672c\u5468\u56f4\u753b\u4e00\u4e2a\u6846\u3002\u8fd9\u4e0e DrawUTF8 \u7c7b\u4f3c\uff0c\u4f46\u4e3a\u6587\u672c\u6dfb\u52a0\u4e86\u4e00\u4e9b\u88c5\u9970\u3002\u8981\u8c03\u7528u8g2.SendBuffer()\u624d\u4f1a\u66f4\u65b0\u5230\u5c4f\u5e55 \u6ce8\u610f:\u8bbe\u7f6e\u5750\u6807\u4e3a\u663e\u793a\u5b57\u7b26\u4e32\u5de6\u4e0b\u89d2\u5750\u6807\n\u4f20\u5165\u503c\uff1a\nstring \u6587\u4ef6\u5185\u5bb9\nint \u6a2a\u5750\u6807\nint \u7ad6\u5750\u6807\nint \u6807\u5fd7 \u591a\u4e2a\u6807\u5fd7\u53ef\u4ee5\u4e0e\u201c\u6216\u201d\u8fd0\u7b97\u7b26\u4e00\u8d77\u4f7f\u7528\u3002\nint \u6587\u672c\u7684\u6700\u5c0f\u5bbd\u5ea6\u3002\u5982\u679c\u4e3a0\uff08\u6216\u4f4e\u4e8e\u6587\u672c\u5bbd\u5ea6\uff09\uff0c\u5219\u6587\u672c\u5bbd\u5ea6\u5c06\u7528\u4e8e\u6846\u67b6\u3002\nint \u6587\u672c\u524d\u540e\u7684\u989d\u5916\u7a7a\u95f4\u3002\nint \u6587\u672c\u4e0a\u4e0b\u7684\u989d\u5916\u7a7a\u95f4\u3002\n\u4f8b\u5b50\uff1a\nu8g2.DrawButtonUTF8(\"str\", 10, 20,u8g2.BTN_BW2,0,2,2)\n", "prefix": "u8g2.DrawButtonUTF8"}, "u8g2.SetFontMode": {"body": "u8g2.SetFontMode(${1:mode})", "description": "u8g2.SetFontMode(mode) - \u8bbe\u7f6e\u5b57\u4f53\u6a21\u5f0f\n\u4f20\u5165\u503c\uff1a\nint mode\u5b57\u4f53\u6a21\u5f0f\uff0c\u542f\u7528\uff081\uff09\u6216\u7981\u7528\uff080\uff09\u900f\u660e\u6a21\u5f0f\n\u4f8b\u5b50\uff1a\nu8g2.SetFontMode(1)\n", "prefix": "u8g2.SetFontMode"}, "u8g2.SetFont": {"body": "u8g2.SetFont(${1:font},${2:indentation})", "description": "u8g2.SetFont(font, indentation) - \u8bbe\u7f6e\u5b57\u4f53\n\u4f20\u5165\u503c\uff1a\nuserdata font, u8g2.font_opposansm8 \u4e3a\u7eaf\u82f1\u65878\u53f7\u5b57\u4f53,\u8fd8\u6709font_opposansm10 font_opposansm12 font_opposansm16 font_opposansm18 font_opposansm20 font_opposansm22 font_opposansm24 font_opposansm32 \u53ef\u9009 u8g2.font_opposansm12_chinese \u4e3a12x12\u5168\u4e2d\u6587,\u8fd8\u6709 font_opposansm16_chinese font_opposansm24_chinese font_opposansm32_chinese \u53ef\u9009, u8g2.font_unifont_t_symbols \u4e3a\u7b26\u53f7.\nint indentation, \u7b49\u5bbd\u5b57\u4f53ascii\u53f3\u4fa7\u7f29\u8fdb0~127\u4e2apixel\uff0c\u7b49\u5bbd\u5b57\u4f53\u7684ascii\u5b57\u7b26\u53ef\u80fd\u5728\u53f3\u4fa7\u6709\u5927\u7247\u7a7a\u767d\uff0c\u7528\u6237\u53ef\u4ee5\u9009\u62e9\u5220\u9664\u90e8\u5206\u3002\u7559\u7a7a\u6216\u8005\u8d85\u8fc7127\u5219\u76f4\u63a5\u5220\u9664\u53f3\u534a\u8fb9, \u975e\u7b49\u5bbd\u5b57\u4f53\u65e0\u6548\n\u4f8b\u5b50\uff1a\n-- \u8bbe\u7f6e\u4e3a\u4e2d\u6587\u5b57\u4f53,\u5bf9\u4e4b\u540e\u7684drawStr\u6709\u6548\nu8g2.SetFont(u8g2.font_opposansm12)\n", "prefix": "u8g2.SetFont"}, "u8g2.GetDisplayHeight": {"body": "u8g2.GetDisplayHeight()", "description": "u8g2.GetDisplayHeight() - \u83b7\u53d6\u663e\u793a\u5c4f\u9ad8\u5ea6\n\u8fd4\u56de\u503c\uff1a\nint \u663e\u793a\u5c4f\u9ad8\u5ea6\n\u4f8b\u5b50\uff1a\nu8g2.GetDisplayHeight()\n", "prefix": "u8g2.GetDisplayHeight"}, "u8g2.GetDisplayWidth": {"body": "u8g2.GetDisplayWidth()", "description": "u8g2.GetDisplayWidth() - \u83b7\u53d6\u663e\u793a\u5c4f\u5bbd\u5ea6\n\u8fd4\u56de\u503c\uff1a\nint \u663e\u793a\u5c4f\u5bbd\u5ea6\n\u4f8b\u5b50\uff1a\nu8g2.GetDisplayWidth()\n", "prefix": "u8g2.GetDisplayWidth"}, "u8g2.SetDrawColor": {"body": "u8g2.SetDrawColor(${1:c})", "description": "u8g2.SetDrawColor(c) - \u4e3a\u6240\u6709\u7ed8\u56fe\u529f\u80fd\u5206\u914d\u7ed8\u56fe\u989c\u8272\u3002\n\u4f20\u5165\u503c\uff1a\nint c\u4e3a\u989c\u8272\u503c 0\u6ca1\u6709\u8272 1\u6709\u8272 2\u4e0e\u5e95\u8272xor\n\u4f8b\u5b50\uff1a\nu8g2.SetDrawColor(0)\n", "prefix": "u8g2.SetDrawColor"}, "u8g2.DrawPixel": {"body": "u8g2.DrawPixel(${1:x},${2:y})", "description": "u8g2.DrawPixel(x,y) - \u753b\u4e00\u4e2a\u70b9.\n\u4f20\u5165\u503c\uff1a\nint X\u4f4d\u7f6e.\nint Y\u4f4d\u7f6e.\n\u4f8b\u5b50\uff1a\nu8g2.DrawPixel(20, 5)\n", "prefix": "u8g2.DrawPixel"}, "u8g2.DrawLine": {"body": "u8g2.DrawLine(${1:x0},${2:y0},${3:x1},${4:y1})", "description": "u8g2.DrawLine(x0,y0,x1,y1) - \u5728\u4e24\u70b9\u4e4b\u95f4\u753b\u4e00\u6761\u7ebf.\n\u4f20\u5165\u503c\uff1a\nint \u7b2c\u4e00\u4e2a\u70b9\u7684X\u4f4d\u7f6e.\nint \u7b2c\u4e00\u4e2a\u70b9\u7684Y\u4f4d\u7f6e.\nint \u7b2c\u4e8c\u4e2a\u70b9\u7684X\u4f4d\u7f6e.\nint \u7b2c\u4e8c\u4e2a\u70b9\u7684Y\u4f4d\u7f6e.\n\u4f8b\u5b50\uff1a\nu8g2.DrawLine(20, 5, 5, 32)\n", "prefix": "u8g2.DrawLine"}, "u8g2.DrawCircle": {"body": "u8g2.DrawCircle(${1:x0},${2:y0},${3:rad},${4:opt})", "description": "u8g2.DrawCircle(x0,y0,rad,opt) - \u5728x,y\u4f4d\u7f6e\u753b\u4e00\u4e2a\u534a\u5f84\u4e3arad\u7684\u7a7a\u5fc3\u5706.\n\u4f20\u5165\u503c\uff1a\nint \u5706\u5fc3\u4f4d\u7f6e\nint \u5706\u5fc3\u4f4d\u7f6e\nint \u5706\u534a\u5f84.\nint \u9009\u62e9\u5706\u7684\u90e8\u5206\u6216\u5168\u90e8. \u9ed8\u8ba4\u5168\u753b \u53ef\u9009 u8g2.DRAW_UPPER_RIGHT u8g2.DRAW_UPPER_LEFT u8g2.DRAW_LOWER_LEFT u8g2.DRAW_LOWER_RIGHT u8g2.DRAW_ALL\n\u4f8b\u5b50\uff1a\nu8g2.DrawCircle(60,30,8,u8g2.DRAW_ALL)\n", "prefix": "u8g2.DrawCircle"}, "u8g2.DrawDisc": {"body": "u8g2.DrawDisc(${1:x0},${2:y0},${3:rad},${4:opt})", "description": "u8g2.DrawDisc(x0,y0,rad,opt) - \u5728x,y\u4f4d\u7f6e\u753b\u4e00\u4e2a\u534a\u5f84\u4e3arad\u7684\u5b9e\u5fc3\u5706.\n\u4f20\u5165\u503c\uff1a\nint \u5706\u5fc3\u4f4d\u7f6e\nint \u5706\u5fc3\u4f4d\u7f6e\nint \u5706\u534a\u5f84.\nint \u9009\u62e9\u5706\u7684\u90e8\u5206\u6216\u5168\u90e8. \u9ed8\u8ba4\u5168\u753b \u53ef\u9009 u8g2.DRAW_UPPER_RIGHT u8g2.DRAW_UPPER_LEFT u8g2.DRAW_LOWER_LEFT u8g2.DRAW_LOWER_RIGHT u8g2.DRAW_ALL\n\u4f8b\u5b50\uff1a\nu8g2.DrawDisc(60,30,8,u8g2.DRAW_ALL)\n", "prefix": "u8g2.DrawDisc"}, "u8g2.DrawEllipse": {"body": "u8g2.DrawEllipse(${1:x0},${2:y0},${3:rx},${4:ry},${5:opt})", "description": "u8g2.DrawEllipse(x0,y0,rx,ry,opt) - \u5728x,y\u4f4d\u7f6e\u753b\u4e00\u4e2a\u534a\u5f84\u4e3arad\u7684\u7a7a\u5fc3\u692d\u5706.\n\u4f20\u5165\u503c\uff1a\nint \u5706\u5fc3\u4f4d\u7f6e\nint \u5706\u5fc3\u4f4d\u7f6e\nint \u692d\u5706\u5927\u5c0f\nint \u692d\u5706\u5927\u5c0f\nint \u9009\u62e9\u5706\u7684\u90e8\u5206\u6216\u5168\u90e8. \u9ed8\u8ba4\u5168\u753b \u53ef\u9009 u8g2.DRAW_UPPER_RIGHT u8g2.DRAW_UPPER_LEFT u8g2.DRAW_LOWER_LEFT u8g2.DRAW_LOWER_RIGHT u8g2.DRAW_ALL\n\u4f8b\u5b50\uff1a\nu8g2.DrawEllipse(60,30,8,u8g2.DRAW_ALL)\n", "prefix": "u8g2.DrawEllipse"}, "u8g2.DrawFilledEllipse": {"body": "u8g2.DrawFilledEllipse(${1:x0},${2:y0},${3:rx},${4:ry},${5:opt})", "description": "u8g2.DrawFilledEllipse(x0,y0,rx,ry,opt) - \u5728x,y\u4f4d\u7f6e\u753b\u4e00\u4e2a\u534a\u5f84\u4e3arad\u7684\u5b9e\u5fc3\u692d\u5706.\n\u4f20\u5165\u503c\uff1a\nint \u5706\u5fc3\u4f4d\u7f6e\nint \u5706\u5fc3\u4f4d\u7f6e\nint \u692d\u5706\u5927\u5c0f\nint \u692d\u5706\u5927\u5c0f\nint \u9009\u62e9\u5706\u7684\u90e8\u5206\u6216\u5168\u90e8. \u9ed8\u8ba4\u5168\u753b \u53ef\u9009 u8g2.DRAW_UPPER_RIGHT u8g2.DRAW_UPPER_LEFT u8g2.DRAW_LOWER_LEFT u8g2.DRAW_LOWER_RIGHT u8g2.DRAW_ALL\n\u4f8b\u5b50\uff1a\nu8g2.DrawFilledEllipse(60,30,8,15)\n", "prefix": "u8g2.DrawFilledEllipse"}, "u8g2.DrawBox": {"body": "u8g2.DrawBox(${1:x},${2:y},${3:w},${4:h})", "description": "u8g2.DrawBox(x,y,w,h) - \u4ecex / y\u4f4d\u7f6e\uff08\u5de6\u4e0a\u8fb9\u7f18\uff09\u5f00\u59cb\u7ed8\u5236\u4e00\u4e2a\u6846\uff08\u586b\u5145\u7684\u6846\uff09.\n\u4f20\u5165\u503c\uff1a\nint \u5de6\u4e0a\u8fb9\u7f18\u7684X\u4f4d\u7f6e\nint \u5de6\u4e0a\u8fb9\u7f18\u7684Y\u4f4d\u7f6e\nint \u76d2\u5b50\u7684\u5bbd\u5ea6\nint \u76d2\u5b50\u7684\u9ad8\u5ea6\n\u4f8b\u5b50\uff1a\nu8g2.DrawBox(3,7,25,15)\n", "prefix": "u8g2.DrawBox"}, "u8g2.DrawFrame": {"body": "u8g2.DrawFrame(${1:x},${2:y},${3:w},${4:h})", "description": "u8g2.DrawFrame(x,y,w,h) - \u4ecex / y\u4f4d\u7f6e\uff08\u5de6\u4e0a\u8fb9\u7f18\uff09\u5f00\u59cb\u7ed8\u5236\u4e00\u4e2a\u6846\uff08\u7a7a\u6846\uff09.\n\u4f20\u5165\u503c\uff1a\nint \u5de6\u4e0a\u8fb9\u7f18\u7684X\u4f4d\u7f6e\nint \u5de6\u4e0a\u8fb9\u7f18\u7684Y\u4f4d\u7f6e\nint \u76d2\u5b50\u7684\u5bbd\u5ea6\nint \u76d2\u5b50\u7684\u9ad8\u5ea6\n\u4f8b\u5b50\uff1a\nu8g2.DrawFrame(3,7,25,15)\n", "prefix": "u8g2.DrawFrame"}, "u8g2.DrawRBox": {"body": "u8g2.DrawRBox(${1:x},${2:y},${3:w},${4:h},${5:r})", "description": "u8g2.DrawRBox(x,y,w,h,r) - \u7ed8\u5236\u4e00\u4e2a\u4ecex / y\u4f4d\u7f6e\uff08\u5de6\u4e0a\u8fb9\u7f18\uff09\u5f00\u59cb\u5177\u6709\u5706\u5f62\u8fb9\u7f18\u7684\u586b\u5145\u6846/\u6846\u67b6.\n\u4f20\u5165\u503c\uff1a\nint \u5de6\u4e0a\u8fb9\u7f18\u7684X\u4f4d\u7f6e\nint \u5de6\u4e0a\u8fb9\u7f18\u7684Y\u4f4d\u7f6e\nint \u76d2\u5b50\u7684\u5bbd\u5ea6\nint \u76d2\u5b50\u7684\u9ad8\u5ea6\nint \u56db\u4e2a\u8fb9\u7f18\u7684\u534a\u5f84\n\u4f8b\u5b50\uff1a\nu8g2.DrawRBox(3,7,25,15)\n", "prefix": "u8g2.DrawRBox"}, "u8g2.DrawRFrame": {"body": "u8g2.DrawRFrame(${1:x},${2:y},${3:w},${4:h},${5:r})", "description": "u8g2.DrawRFrame(x,y,w,h,r) - \u7ed8\u5236\u4e00\u4e2a\u4ecex / y\u4f4d\u7f6e\uff08\u5de6\u4e0a\u8fb9\u7f18\uff09\u5f00\u59cb\u5177\u6709\u5706\u5f62\u8fb9\u7f18\u7684\u7a7a\u6846/\u6846\u67b6.\n\u4f20\u5165\u503c\uff1a\nint \u5de6\u4e0a\u8fb9\u7f18\u7684X\u4f4d\u7f6e\nint \u5de6\u4e0a\u8fb9\u7f18\u7684Y\u4f4d\u7f6e\nint \u76d2\u5b50\u7684\u5bbd\u5ea6\nint \u76d2\u5b50\u7684\u9ad8\u5ea6\nint \u56db\u4e2a\u8fb9\u7f18\u7684\u534a\u5f84\n\u4f8b\u5b50\uff1a\nu8g2.DrawRFrame(3,7,25,15)\n", "prefix": "u8g2.DrawRFrame"}, "u8g2.DrawGlyph": {"body": "u8g2.DrawGlyph(${1:x},${2:y},${3:encoding})", "description": "u8g2.DrawGlyph(x,y,encoding) - \u7ed8\u5236\u4e00\u4e2a\u56fe\u5f62\u5b57\u7b26\u3002\u5b57\u7b26\u653e\u7f6e\u5728\u6307\u5b9a\u7684\u50cf\u7d20\u4f4d\u7f6ex\u548cy.\n\u4f20\u5165\u503c\uff1a\nint \u5b57\u7b26\u5728\u663e\u793a\u5c4f\u4e0a\u7684\u4f4d\u7f6e\nint \u5b57\u7b26\u5728\u663e\u793a\u5c4f\u4e0a\u7684\u4f4d\u7f6e\nint \u5b57\u7b26\u7684Unicode\u503c\n\u4f8b\u5b50\uff1a\nu8g2.SetFont(u8g2_font_unifont_t_symbols)\nu8g2.DrawGlyph(5, 20, 0x2603) -- dec 9731/hex 2603 Snowman\n", "prefix": "u8g2.DrawGlyph"}, "u8g2.DrawTriangle": {"body": "u8g2.DrawTriangle(${1:x0},${2:y0},${3:x1},${4:y1},${5:x2},${6:y2})", "description": "u8g2.DrawTriangle(x0,y0,x1,y1,x2,y2) - \u7ed8\u5236\u4e00\u4e2a\u4e09\u89d2\u5f62\uff08\u5b9e\u5fc3\u591a\u8fb9\u5f62\uff09.\n\u4f20\u5165\u503c\uff1a\nint \u70b90X\u4f4d\u7f6e\nint \u70b90Y\u4f4d\u7f6e\nint \u70b91X\u4f4d\u7f6e\nint \u70b91Y\u4f4d\u7f6e\nint \u70b92X\u4f4d\u7f6e\nint \u70b92Y\u4f4d\u7f6e\n\u4f8b\u5b50\uff1a\nu8g2.DrawTriangle(20,5, 27,50, 5,32)\n", "prefix": "u8g2.DrawTriangle"}, "u8g2.SetBitmapMode": {"body": "u8g2.SetBitmapMode(${1:mode})", "description": "u8g2.SetBitmapMode(mode) - \u5b9a\u4e49\u4f4d\u56fe\u51fd\u6570\u662f\u5426\u5c06\u5199\u5165\u80cc\u666f\u8272\n\u4f20\u5165\u503c\uff1a\nint mode\u5b57\u4f53\u6a21\u5f0f\uff0c\u542f\u7528\uff081\uff09\u6216\u7981\u7528\uff080\uff09\u900f\u660e\u6a21\u5f0f\n\u4f8b\u5b50\uff1a\nu8g2.SetBitmapMode(1)\n", "prefix": "u8g2.SetBitmapMode"}, "u8g2.DrawXBM": {"body": "u8g2.DrawXBM(${1:x},${2:y},${3:w},${4:h},${5:data})", "description": "u8g2.DrawXBM(x, y, w, h, data) - \u7ed8\u5236\u4f4d\u56fe\n\u4f20\u5165\u503c\uff1a\nint X\u5750\u6807\nint y\u5750\u6807\nint \u4f4d\u56fe\u5bbd\nint \u4f4d\u56fe\u9ad8\nint \u4f4d\u56fe\u6570\u636e,\u6bcf\u4e00\u4f4d\u4ee3\u8868\u4e00\u4e2a\u50cf\u7d20\n\u4f8b\u5b50\uff1a\n-- \u53d6\u6a21\u4f7f\u7528PCtoLCD2002\u8f6f\u4ef6\u5373\u53ef\n-- \u5728(0,0)\u4e3a\u5de6\u4e0a\u89d2,\u7ed8\u5236 16x16 \"\u4eca\" \u7684\u4f4d\u56fe\nu8g2.DrawXBM(0, 0, 16,16, string.char(\n 0x80,0x00,0x80,0x00,0x40,0x01,0x20,0x02,0x10,0x04,0x48,0x08,0x84,0x10,0x83,0x60,\n 0x00,0x00,0xF8,0x0F,0x00,0x08,0x00,0x04,0x00,0x04,0x00,0x02,0x00,0x01,0x80,0x00\n))\n", "prefix": "u8g2.DrawXBM"}, "u8g2.DrawDrcode": {"body": "u8g2.DrawDrcode(${1:x},${2:y},${3:str},${4:size})", "description": "u8g2.DrawDrcode(x, y, str, size) - \u7f13\u51b2\u533a\u7ed8\u5236QRCode\n\u4f20\u5165\u503c\uff1a\nint x\u5750\u6807\nint y\u5750\u6807\nstring \u4e8c\u7ef4\u7801\u7684\u5185\u5bb9\nint \u663e\u793a\u5927\u5c0f (\u6ce8\u610f:\u4e8c\u7ef4\u7801\u751f\u6210\u5927\u5c0f\u4e0e\u8981\u663e\u793a\u5185\u5bb9\u548c\u7ea0\u9519\u7b49\u7ea7\u6709\u5173,\u751f\u6210\u7248\u672c\u4e3a1-40(\u5bf9\u5e94 21x21 - 177x177)\u7684\u4e0d\u5b9a\u5927\u5c0f,\u5982\u679c\u548c\u8bbe\u7f6e\u5927\u5c0f\u4e0d\u540c\u4f1a\u81ea\u52a8\u5728\u6307\u5b9a\u7684\u533a\u57df\u4e2d\u95f4\u663e\u793a\u4e8c\u7ef4\u7801,\u5982\u4e8c\u7ef4\u7801\u672a\u663e\u793a\u8bf7\u67e5\u770b\u65e5\u5fd7\u63d0\u793a)\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "u8g2.DrawDrcode"}, "u8g2.SetContrast": {"body": "u8g2.SetContrast(${1:contrast})", "description": "u8g2.SetContrast(contrast) - \u8c03\u6574\u5c4f\u5e55\u5bf9\u6bd4\u5ea6\n\u4f20\u5165\u503c\uff1a\nint \u5bf9\u6bd4\u5ea6\uff08\u53d6\u503c\u8303\u56f4\u4e0eIC\u6709\u5173\uff0c\u5982st7567\u4e3a0-63\uff09\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "u8g2.SetContrast"}, "u8g2.drawGtfontGb2312": {"body": "u8g2.drawGtfontGb2312(${1:str},${2:size},${3:x},${4:y})", "description": "u8g2.drawGtfontGb2312(str,size,x,y) - \u4f7f\u7528gtfont\u663e\u793agb2312\u5b57\u7b26\u4e32\n\u4f20\u5165\u503c\uff1a\nstring str \u663e\u793a\u5b57\u7b26\u4e32\nint size \u5b57\u4f53\u5927\u5c0f (\u652f\u630116-192\u53f7\u5927\u5c0f\u5b57\u4f53)\nint x \u6a2a\u5750\u6807\nint y \u7ad6\u5750\u6807\n\u4f8b\u5b50\uff1a\nu8g2.drawGtfontGb2312(\"\u554a\u554a\u554a\",32,0,0)\n", "prefix": "u8g2.drawGtfontGb2312"}, "u8g2.drawGtfontUtf8": {"body": "u8g2.drawGtfontUtf8(${1:str},${2:size},${3:x},${4:y})", "description": "u8g2.drawGtfontUtf8(str,size,x,y) - \u4f7f\u7528gtfont\u663e\u793aUTF8\u5b57\u7b26\u4e32\n\u4f20\u5165\u503c\uff1a\nstring str \u663e\u793a\u5b57\u7b26\u4e32\nint size \u5b57\u4f53\u5927\u5c0f (\u652f\u630116-192\u53f7\u5927\u5c0f\u5b57\u4f53)\nint x \u6a2a\u5750\u6807\nint y \u7ad6\u5750\u6807\n\u4f8b\u5b50\uff1a\nu8g2.drawGtfontUtf8(\"\u554a\u554a\u554a\",32,0,0)\n", "prefix": "u8g2.drawGtfontUtf8"}, "u8g2.CopyBuffer": {"body": "u8g2.CopyBuffer(${1:buff})", "description": "u8g2.CopyBuffer(buff) - \u83b7\u53d6\u5e95\u5c42\u56fe\u50cf\u7f13\u51b2\u533a\n\u4f20\u5165\u503c\uff1a\nuserdata zbuff\u5b9e\u4f8b,\u7a7a\u95f4\u8981\u5927\u4e8e\u7b49\u4e8e\u5e95\u5c42buff\u7684\u5927\u5c0f\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u8fd4\u56debuff\u5927\u5c0f,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5728u8g2\u521d\u59cb\u5316\u4e4b\u540e\u624d\u80fd\u8c03\u7528\n\n-- \u83b7\u53d6\u5927\u5c0f\nlocal sz = u8g2.CopyBuffer()\n\n-- \u62f7\u8d1d\u5e95\u5c42buff\nlocal buff = zbuff.create(sz)\nu8g2.CopyBuffer(buff)\n\n", "prefix": "u8g2.CopyBuffer"}, "u8g2.SetPowerSave": {"body": "u8g2.SetPowerSave(${1:is_enable})", "description": "u8g2.SetPowerSave(is_enable) - \u8bbe\u7f6e\u7701\u7535\u6a21\u5f0f\n\u4f20\u5165\u503c\uff1a\nboolean \u542f\u7528\u4e0e\u5426. true \u542f\u7528, false\u7981\u7528\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e2023.11.02\u65b0\u589e\n-- \u5f00\u542f\u7701\u7535\nu8g2.SetPowerSave(true)\n-- \u5173\u95ed\u7701\u7535\nu8g2.SetPowerSave(false)\n", "prefix": "u8g2.SetPowerSave"}, "uart.setup": {"body": "uart.setup(${1:id},${2:baud_rate},${3:data_bits},${4:stop_bits},${5:partiy},${6:bit_order},${7:buff_size},${8:rs485_gpio},${9:rs485_level},${10:rs485_delay},${11:debug_enable},${12:error_drop})", "description": "uart.setup(id, baud_rate, data_bits, stop_bits, partiy, bit_order, buff_size, rs485_gpio, rs485_level, rs485_delay, debug_enable, error_drop) - \u914d\u7f6e\u4e32\u53e3\u53c2\u6570\n\u4f20\u5165\u503c\uff1a\nint \u4e32\u53e3id, uart0\u51990, uart1\u51991, \u5982\u6b64\u7c7b\u63a8, \u6700\u5927\u503c\u53d6\u51b3\u4e8e\u8bbe\u5907\nint \u6ce2\u7279\u7387, \u9ed8\u8ba4115200\uff0c\u53ef\u9009\u62e9\u6ce2\u7279\u7387\u8868:{2000000,921600,460800,230400,115200,57600,38400,19200,9600,4800,2400}\nint \u6570\u636e\u4f4d\uff0c\u9ed8\u8ba4\u4e3a8, \u53ef\u9009 7/8\nint \u505c\u6b62\u4f4d\uff0c\u9ed8\u8ba4\u4e3a1, \u6839\u636e\u5b9e\u9645\u60c5\u51b5\uff0c\u53ef\u4ee5\u67090.5/1/1.5/2\u7b49\nint \u6821\u9a8c\u4f4d\uff0c\u53ef\u9009 uart.None/uart.Even/uart.Odd\nint \u5927\u5c0f\u7aef\uff0c\u9ed8\u8ba4\u5c0f\u7aef uart.LSB, \u53ef\u9009 uart.MSB\nint \u7f13\u51b2\u533a\u5927\u5c0f\uff0c\u9ed8\u8ba4\u503c1024\nint 485\u6a21\u5f0f\u4e0b\u7684\u8f6c\u6362GPIO, \u9ed8\u8ba4\u503c0xffffffff\nint 485\u6a21\u5f0f\u4e0b\u7684rx\u65b9\u5411GPIO\u7684\u7535\u5e73, \u9ed8\u8ba4\u503c0\nint 485\u6a21\u5f0f\u4e0btx\u5411rx\u8f6c\u6362\u7684\u5ef6\u8fdf\u65f6\u95f4\uff0c\u9ed8\u8ba4\u503c12bit\u7684\u65f6\u95f4\uff0c\u5355\u4f4dus, 9600\u6ce2\u7279\u7387\u586b20000\nint \u5f00\u542f\u8c03\u8bd5\u529f\u80fd\uff0c\u9ed8\u8ba4\u4f7f\u80fd\uff0c\u586b\u5199uart.DEBUG\u6216\u8005\u975e\u6570\u5b57\u4f7f\u80fd\uff0c\u5176\u4ed6\u503c\u90fd\u662f\u5173\u95ed\uff0c\u76ee\u524d\u53ea\u6709\u79fb\u82af\u5e73\u53f0\u652f\u6301\nint \u9047\u5230\u63a5\u6536\u9519\u8bef\u662f\u5426\u653e\u5f03\u7f13\u5b58\u6570\u636e\uff0c\u9ed8\u8ba4\u4f7f\u80fd\uff0c\u586b\u5199uart.ERROR_DROP\u6216\u8005\u975e\u6570\u5b57\u4f7f\u80fd\uff0c\u5176\u4ed6\u503c\u90fd\u662f\u5173\u95ed\uff0c\u76ee\u524d\u53ea\u6709\u79fb\u82af\u5e73\u53f0\u652f\u6301\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u8fd4\u56de0,\u5931\u8d25\u8fd4\u56de\u5176\u4ed6\u503c\n\u4f8b\u5b50\uff1a\n-- \u6700\u5e38\u7528115200 8N1\nuart.setup(1, 115200, 8, 1, uart.NONE)\n-- \u53ef\u4ee5\u7b80\u5199\u4e3a uart.setup(1)\n\n-- 485\u81ea\u52a8\u5207\u6362, \u9009\u53d6GPIO10\u4f5c\u4e3a\u6536\u53d1\u8f6c\u6362\u811a\nuart.setup(1, 115200, 8, 1, uart.NONE, uart.LSB, 1024, 10, 0, 2000)\n-- \u9047\u5230\u63a5\u6536\u9519\u8bef\u4e0d\u629b\u5f03\u7f13\u5b58\u6570\u636e\nuart.setup(1, 115200, 8, 1, uart.NONE, nil, 1024, nil, nil, nil, nil, 0)\n", "prefix": "uart.setup"}, "uart.write": {"body": "uart.write(${1:id},${2:data})", "description": "uart.write(id, data) - \u5199\u4e32\u53e3\n\u4f20\u5165\u503c\uff1a\nint \u4e32\u53e3id, uart0\u51990, uart1\u51991\nstring/zbuff \u5f85\u5199\u5165\u7684\u6570\u636e\uff0c\u5982\u679c\u662fzbuff\u4f1a\u4ece\u6307\u9488\u8d77\u59cb\u4f4d\u7f6e\u5f00\u59cb\u8bfb\nint \u53ef\u9009\uff0c\u8981\u53d1\u9001\u7684\u6570\u636e\u957f\u5ea6\uff0c\u9ed8\u8ba4\u5168\u53d1\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u7684\u6570\u636e\u957f\u5ea6\n\u4f8b\u5b50\uff1a\n-- \u5199\u5165\u53ef\u89c1\u5b57\u7b26\u4e32\nuart.write(1, \"rdy\\r\\n\")\n-- \u5199\u5165\u5341\u516d\u8fdb\u5236\u7684\u6570\u636e\u4e32\nuart.write(1, string.char(0x55,0xAA,0x4B,0x03,0x86))\n", "prefix": "uart.write"}, "uart.read": {"body": "uart.read(${1:id},${2:len})", "description": "uart.read(id, len) - \u8bfb\u4e32\u53e3\n\u4f20\u5165\u503c\uff1a\nint \u4e32\u53e3id, uart0\u51990, uart1\u51991\nint \u8bfb\u53d6\u957f\u5ea6\nfile/zbuff \u53ef\u9009\uff1a\u6587\u4ef6\u53e5\u67c4\u6216zbuff\u5bf9\u8c61\n\u8fd4\u56de\u503c\uff1a\nstring \u8bfb\u53d6\u5230\u7684\u6570\u636e / \u4f20\u5165zbuff\u65f6\uff0c\u8fd4\u56de\u8bfb\u5230\u7684\u957f\u5ea6\uff0c\u5e76\u628azbuff\u6307\u9488\u540e\u79fb\n\u4f8b\u5b50\uff1a\nuart.read(1, 16)\n", "prefix": "uart.read"}, "uart.close": {"body": "uart.close(${1:id})", "description": "uart.close(id) - \u5173\u95ed\u4e32\u53e3\n\u4f20\u5165\u503c\uff1a\nint \u4e32\u53e3id, uart0\u51990, uart1\u51991\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nuart.close(1)\n", "prefix": "uart.close"}, "uart.on": {"body": "uart.on(${1:id},${2:event},${3:func})", "description": "uart.on(id, event, func) - \u6ce8\u518c\u4e32\u53e3\u4e8b\u4ef6\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nint \u4e32\u53e3id, uart0\u51990, uart1\u51991\nstring \u4e8b\u4ef6\u540d\u79f0\nfunction \u56de\u8c03\u65b9\u6cd5\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nuart.on(1, \"receive\", function(id, len)\n local data = uart.read(id, len)\n log.info(\"uart\", id, len, data)\nend)\n", "prefix": "uart.on"}, "uart.wait485": {"body": "uart.wait485(${1:id})", "description": "uart.wait485(id) - \u7b49\u5f85485\u6a21\u5f0f\u4e0bTX\u5b8c\u6210\uff0cmcu\u4e0d\u652f\u6301\u4e32\u53e3\u53d1\u9001\u79fb\u4f4d\u5bc4\u5b58\u5668\u7a7a\u6216\u8005\u7c7b\u4f3c\u4e2d\u65ad\u65f6\u624d\u9700\u8981\uff0c\u5728sent\u4e8b\u4ef6\u56de\u8c03\u540e\u4f7f\u7528\n\u4f20\u5165\u503c\uff1a\nint \u4e32\u53e3id, uart0\u51990, uart1\u51991\n\u8fd4\u56de\u503c\uff1a\nint \u7b49\u5f85\u4e86\u591a\u5c11\u6b21\u5faa\u73af\u624d\u7b49\u5230tx\u5b8c\u6210\uff0c\u7528\u4e8e\u7c97\u52a3\u7684\u89c2\u5bdfdelay\u65f6\u95f4\u662f\u5426\u8db3\u591f\uff0c\u8fd4\u56de\u4e0d\u4e3a0\u8bf4\u660e\u8fd8\u9700\u8981\u653e\u5927delay\n", "prefix": "uart.wait485"}, "uart.exist": {"body": "uart.exist(${1:id})", "description": "uart.exist(id) - \u68c0\u67e5\u4e32\u53e3\u53f7\u662f\u5426\u5b58\u5728\n\u4f20\u5165\u503c\uff1a\nint \u4e32\u53e3id, uart0\u51990, uart1\u51991, \u5982\u6b64\u7c7b\u63a8\n\u8fd4\u56de\u503c\uff1a\nbool \u5b58\u5728\u8fd4\u56detrue\n", "prefix": "uart.exist"}, "uart.rx": {"body": "uart.rx(${1:id},${2:buff})", "description": "uart.rx(id, buff) - buff\u5f62\u5f0f\u8bfb\u4e32\u53e3\uff0c\u4e00\u6b21\u8bfb\u51fa\u5168\u90e8\u6570\u636e\u5b58\u5165buff\u4e2d\uff0c\u5982\u679cbuff\u7a7a\u95f4\u4e0d\u591f\u4f1a\u81ea\u52a8\u6269\u5c55\uff0c\u76ee\u524dair105,air780e\u652f\u6301\u8fd9\u4e2a\u64cd\u4f5c\n\u4f20\u5165\u503c\uff1a\nint \u4e32\u53e3id, uart0\u51990, uart1\u51991\nzbuff zbuff\u5bf9\u8c61\n\u8fd4\u56de\u503c\uff1a\nint \u8fd4\u56de\u8bfb\u5230\u7684\u957f\u5ea6\uff0c\u5e76\u628azbuff\u6307\u9488\u540e\u79fb\n\u4f8b\u5b50\uff1a\nuart.rx(1, buff)\n", "prefix": "uart.rx"}, "uart.rxSize": {"body": "uart.rxSize(${1:id})", "description": "uart.rxSize(id) - \u8bfb\u4e32\u53e3Rx\u7f13\u5b58\u4e2d\u5269\u4f59\u6570\u636e\u91cf\uff0c\u76ee\u524dair105,air780e\u652f\u6301\u8fd9\u4e2a\u64cd\u4f5c\n\u4f20\u5165\u503c\uff1a\nint \u4e32\u53e3id, uart0\u51990, uart1\u51991\n\u8fd4\u56de\u503c\uff1a\nint \u8fd4\u56de\u8bfb\u5230\u7684\u957f\u5ea6\n\u4f8b\u5b50\uff1a\nlocal size = uart.rxSize(1)\n", "prefix": "uart.rxSize"}, "uart.rxClear": {"body": "uart.rxClear(${1:id})", "description": "uart.rxClear(id) - \u6e05\u9664\u4e32\u53e3Rx\u7f13\u5b58\u4e2d\u5269\u4f59\u6570\u636e\u91cf\uff0c\u76ee\u524dair105,air780e\u652f\u6301\u8fd9\u4e2a\u64cd\u4f5c\n\u4f20\u5165\u503c\uff1a\nint \u4e32\u53e3id, uart0\u51990, uart1\u51991\n\u4f8b\u5b50\uff1a\nuart.rxClear(1)\n", "prefix": "uart.rxClear"}, "uart.tx": {"body": "uart.tx(${1:id},${2:buff},${3:start},${4:len})", "description": "uart.tx(id, buff, start, len) - buff\u5f62\u5f0f\u5199\u4e32\u53e3,\u7b49\u540c\u4e8ec\u8bed\u8a00uart_tx(uart_id, &buff[start], len);\n\u4f20\u5165\u503c\uff1a\nint \u4e32\u53e3id, uart0\u51990, uart1\u51991\nzbuff \u5f85\u5199\u5165\u7684\u6570\u636e\uff0c\u5982\u679c\u662fzbuff\u4f1a\u4ece\u6307\u9488\u8d77\u59cb\u4f4d\u7f6e\u5f00\u59cb\u8bfb\nint \u53ef\u9009\uff0c\u8981\u53d1\u9001\u7684\u6570\u636e\u8d77\u59cb\u4f4d\u7f6e\uff0c\u9ed8\u8ba4\u4e3a0\nint \u53ef\u9009\uff0c\u8981\u53d1\u9001\u7684\u6570\u636e\u957f\u5ea6\uff0c\u9ed8\u8ba4\u4e3azbuff\u5185\u6709\u6548\u6570\u636e\uff0c\u6700\u5927\u503c\u4e0d\u8d85\u8fc7zbuff\u7684\u6700\u5927\u7a7a\u95f4\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u7684\u6570\u636e\u957f\u5ea6\n\u4f8b\u5b50\uff1a\nuart.tx(1, buf)\n", "prefix": "uart.tx"}, "uart.createSoft": {"body": "uart.createSoft(${1:tx_pin},${2:tx_hwtimer_id},${3:rx_pin},${4:rx_hwtimer_id},${5:adjust_period})", "description": "uart.createSoft(tx_pin, tx_hwtimer_id, rx_pin, rx_hwtimer_id, adjust_period) - \u8bbe\u7f6e\u8f6f\u4ef6uart\u7684\u786c\u4ef6\u914d\u7f6e\uff0c\u53ea\u6709\u652f\u6301\u786c\u4ef6\u5b9a\u65f6\u5668\u7684SOC\u624d\u80fd\u4f7f\u7528\uff0c\u76ee\u524d\u53ea\u80fd\u8bbe\u7f6e\u4e00\u4e2a\uff0c\u6ce2\u7279\u7387\u6839\u636e\u5e73\u53f0\u7684\u8f6f\u786c\u4ef6\u914d\u7f6e\u6709\u4e0d\u540c\u7684\u6781\u9650\uff0c\u5efa\u8bae9600\uff0c\u63a5\u6536\u7f13\u5b58\u4e0d\u8d85\u8fc765535\uff0c\u4e0d\u652f\u6301MSB\uff0c\u652f\u6301485\u81ea\u52a8\u63a7\u5236\u3002\u540e\u7eed\u4ecd\u8981setup\u64cd\u4f5c\n\u4f20\u5165\u503c\uff1a\nint \u53d1\u9001\u5f15\u811a\u7f16\u53f7\nint \u53d1\u9001\u7528\u7684\u786c\u4ef6\u5b9a\u65f6\u5668ID\nint \u63a5\u6536\u5f15\u811a\u7f16\u53f7\nint \u63a5\u6536\u7528\u7684\u786c\u4ef6\u5b9a\u65f6\u5668ID\nint \u53d1\u9001\u65f6\u5e8f\u8c03\u6574\uff0c\u5355\u4f4d\u662f\u5b9a\u65f6\u5668\u65f6\u949f\u5468\u671f\uff0c\u9ed8\u8ba4\u662f0\uff0c\u9700\u8981\u6839\u636e\u793a\u6ce2\u5668\u6216\u8005\u903b\u8f91\u5206\u6790\u4eea\u8fdb\u884c\u5fae\u8c03\nint \u63a5\u6536\u65f6\u5e8f\u8c03\u6574\uff0c\u5355\u4f4d\u662f\u5b9a\u65f6\u5668\u65f6\u949f\u5468\u671f\uff0c\u9ed8\u8ba4\u662f0\uff0c\u9700\u8981\u6839\u636e\u793a\u6ce2\u5668\u6216\u8005\u903b\u8f91\u5206\u6790\u4eea\u8fdb\u884c\u5fae\u8c03\n\u8fd4\u56de\u503c\uff1a\nint \u8f6f\u4ef6uart\u7684id\uff0c\u5982\u679c\u5931\u8d25\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316\u8f6f\u4ef6uart\nlocal uart_id = uart.createSoft(21, 0, 1, 2) --air780e\u5efa\u8bae\u7528\u5b9a\u65f6\u56680\u548c2\uff0ctx_pin\u6700\u597d\u7528AGPIO\uff0c\u9632\u6b62\u4f11\u7720\u65f6\u8bef\u89e6\u53d1\u5bf9\u7aefRX\n", "prefix": "uart.createSoft"}, "uart.list": {"body": "uart.list(${1:max})", "description": "uart.list(max) - \u83b7\u53d6\u53ef\u7528\u4e32\u53e3\u53f7\u5217\u8868\uff0c\u5f53\u524d\u4ec5\u9650win32\n\u4f20\u5165\u503c\uff1a\nint \u53ef\u9009\uff0c\u9ed8\u8ba4256\uff0c\u6700\u591a\u83b7\u53d6\u591a\u5c11\u4e2a\u4e32\u53e3\n\u8fd4\u56de\u503c\uff1a\ntable \u83b7\u53d6\u5230\u7684\u53ef\u7528\u4e32\u53e3\u53f7\u5217\u8868\n", "prefix": "uart.list"}, "ulwip.setup": {"body": "ulwip.setup(${1:adapter_index},${2:mac},${3:output_lua_ref},${4:opts})", "description": "ulwip.setup(adapter_index, mac, output_lua_ref, opts) - \u521d\u59cb\u5316lwip netif\n\u4f20\u5165\u503c\uff1a\nint adapter_index \u9002\u914d\u5668\u7f16\u53f7\nstring mac \u7f51\u5361mac\u5730\u5740\nfunction output_lua_ref \u56de\u8c03\u51fd\u6570, \u53c2\u6570\u4e3a(adapter_index, data)\ntable \u989d\u5916\u53c2\u6570, \u4f8b\u5982 {mtu=1500, flags=(ulwip.FLAG_BROADCAST | ulwip.FLAG_ETHARP)}\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u521d\u59cb\u5316\u4e00\u4e2a\u9002\u914d\u5668, \u5e76\u8bbe\u7f6e\u56de\u8c03\u51fd\u6570\nulwip.setup(socket.LWIP_STA, string.fromHex(\"18fe34a27b69\"), function(adapter_index, data)\n log.info(\"ulwip\", \"output_lua_ref\", adapter_index, data:toHex())\nend)\n-- \u6ce8\u610f, setup\u4e4b\u540e, netif\u7684\u72b6\u6001\u662fdown, \u8c03\u7528ulwip.updown(adapter_index, true)\u540e, \u624d\u80fd\u6b63\u5e38\u6536\u53d1\u6570\u636e\n\n-- \u989d\u5916\u53c2\u6570\u914d\u7f6etable\u53ef\u9009\u503c\n-- mtu, \u9ed8\u8ba41460\n-- flags, \u9ed8\u8ba4 ulwip.FLAG_BROADCAST | ulwip.FLAG_ETHARP | ulwip.FLAG_ETHERNET | ulwip.FLAG_IGMP | ulwip.FLAG_MLD6\n-- zbuff_out \u56de\u8c03\u51fd\u6570\u63a5\u53d7zbuff\u4f5c\u4e3a\u53c2\u6570, \u9ed8\u8ba4false\n-- reverse \u672c\u5730lwip\u8bbe\u5907,\u7ffb\u8f6c\u8c03\u7528\u903b\u8f91, \u9ed8\u8ba4false, \u8fd9\u4e2a\u53c2\u6570\u662f\u4e3a\u4e86\u62e6\u622a\u5f53\u524d\u8bbe\u5907\u7684\u786c\u4ef6\u8054\u7f51\u6570\u636e\u6240\u8bbe\u8ba1\u7684\n", "prefix": "ulwip.setup"}, "ulwip.updown": {"body": "ulwip.updown(${1:adapter_index},${2:up})", "description": "ulwip.updown(adapter_index, up) - \u8bbe\u7f6enetif\u7684\u72b6\u6001\n\u4f20\u5165\u503c\uff1a\nint adapter_index \u9002\u914d\u5668\u7f16\u53f7\nboolean up true\u4e3aup, false\u4e3adown\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003ulwip.setup\n", "prefix": "ulwip.updown"}, "ulwip.link": {"body": "ulwip.link(${1:adapter_index},${2:up})", "description": "ulwip.link(adapter_index, up) - \u8bbe\u7f6enetif\u7684\u7269\u7406\u94fe\u8def\u72b6\u6001\n\u4f20\u5165\u503c\uff1a\nint adapter_index \u9002\u914d\u5668\u7f16\u53f7\nboolean up true\u4e3aup, false\u4e3adown\n\u8fd4\u56de\u503c\uff1a\nboolean \u5f53\u524d\u72b6\u6001\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003ulwip.setup\n", "prefix": "ulwip.link"}, "ulwip.input": {"body": "ulwip.input(${1:adapter_index},${2:data},${3:len},${4:offset})", "description": "ulwip.input(adapter_index, data, len, offset) - \u5f80netif\u8f93\u5165\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint adapter_index \u9002\u914d\u5668\u7f16\u53f7\nstring/userdata data \u8f93\u5165\u7684\u6570\u636e\nint \u5982\u679cdata\u662fzbuff, len\u9ed8\u8ba4\u662fzbuff\u7684used, \u5bf9string\u65e0\u6548\nint \u5982\u679cdata\u662fzbuff, offset\u4e3a\u6570\u636e\u8d77\u59cb\u4f4d\u7f6e, \u9ed8\u8ba4\u662f0, \u5bf9string\u65e0\u6548\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003ulwip.setup\n", "prefix": "ulwip.input"}, "ulwip.dhcp": {"body": "ulwip.dhcp(${1:adapter_index},${2:up})", "description": "ulwip.dhcp(adapter_index, up) - \u542f\u52a8\u6216\u5173\u95eddhcp\n\u4f20\u5165\u503c\uff1a\nint adapter_index \u9002\u914d\u5668\u7f16\u53f7\nboolean up true\u4e3a\u542f\u52a8, false\u4e3a\u5173\u95ed\n\u8fd4\u56de\u503c\uff1a\nboolean \u5f53\u524d\u72b6\u6001\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003ulwip.setup\n", "prefix": "ulwip.dhcp"}, "ulwip.ip": {"body": "ulwip.ip(${1:adapter_index},${2:ip},${3:netmask},${4:gw})", "description": "ulwip.ip(adapter_index, ip, netmask, gw) - \u8bbe\u7f6e\u6216\u83b7\u53d6ip\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nint adapter_index \u9002\u914d\u5668\u7f16\u53f7\nstring ip IP\u5730\u5740, \u4ec5\u83b7\u53d6\u65f6\u53ef\u4ee5\u4e0d\u586b\nstring netmask \u5b50\u7f51\u63a9\u7801, \u4ec5\u83b7\u53d6\u65f6\u53ef\u4ee5\u4e0d\u586b\nstring gw \u7f51\u5173\u5730\u5740, \u4ec5\u83b7\u53d6\u65f6\u53ef\u4ee5\u4e0d\u586b\n\u8fd4\u56de\u503c\uff1a\nstring ip\u5730\u5740, \u5b50\u7f51\u63a9\u7801, \u7f51\u5173\u5730\u5740\n\u4f8b\u5b50\uff1a\n-- \u83b7\u53d6\u73b0\u6709\u503c\nlocal ip, netmask, gw = ulwip.ip(socket.LWIP_STA)\n-- \u8bbe\u7f6e\u65b0\u503c\nulwip.ip(socket.LWIP_STA, \"192.168.0.1\", \"255.255.255.0\", \"192.168.0.1\")\n", "prefix": "ulwip.ip"}, "ulwip.reg": {"body": "ulwip.reg(${1:adapter_index})", "description": "ulwip.reg(adapter_index) - \u5c06netif\u6ce8\u518c\u5230luatos socket\u4e2d\n\u4f20\u5165\u503c\uff1a\nint adapter_index \u9002\u914d\u5668\u7f16\u53f7\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529f\u4e0e\u5426\n\u4f8b\u5b50\uff1a\n-- \u53c2\u8003ulwip.setup\n", "prefix": "ulwip.reg"}, "ulwip.xt804_xfer": {"body": "ulwip.xt804_xfer(${1:spi_id},${2:cs_pin},${3:addr},${4:zbuff},${5:len},${6:offset},${7:auto_seek},${8:auto_len})", "description": "ulwip.xt804_xfer(spi_id, cs_pin, addr, zbuff, len, offset, auto_seek, auto_len) - \u64cd\u4f5cXT804\u8fdb\u884cSPI\u5feb\u901f\u6536\u53d1\n\u4f20\u5165\u503c\uff1a\nint spi_id SPI\u7684ID\u53f7\nint cs_pin CS\u811a\u7684GPIO\u53f7\nint addr \u5bc4\u5b58\u5668\u5730\u5740\nzbuff zbuff\u5bf9\u8c61\nint len \u957f\u5ea6\nint offset \u504f\u79fb\u91cf, \u9ed8\u8ba4buff:used()\nboolean auto_seek \u662f\u5426\u81ea\u52a8\u79fb\u52a8\u504f\u79fb\u91cf, \u9ed8\u8ba4false\nint auto_len \u81ea\u52a8\u5206\u7247\u957f\u5ea6, \u9ed8\u8ba4\u6309\u5bc4\u5b58\u5668\u81ea\u52a8\u9009\u62e9\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u5c5e\u4e8e\u8f85\u52a9\u51fd\u6570\n", "prefix": "ulwip.xt804_xfer"}, "usbapp.set_id": {"body": "usbapp.set_id(${1:id},${2:vid},${3:pid})", "description": "usbapp.set_id(id, vid, pid) - USB \u8bbe\u7f6eVID\u548cPID\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id,\u9ed8\u8ba4\u4e3a0\nint vid \u5c0f\u7aef\u683c\u5f0f\nint pid \u5c0f\u7aef\u683c\u5f0f\n\u4f8b\u5b50\uff1a\nusbapp.set_id(0, 0x1234, 0x5678)\n", "prefix": "usbapp.set_id"}, "usbapp.hid_mode": {"body": "usbapp.hid_mode(${1:id},${2:mode},${3:buff_size})", "description": "usbapp.hid_mode(id, mode, buff_size) - USB HID\u8bbe\u5907\u6a21\u5f0f\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id,\u9ed8\u8ba4\u4e3a0\nint mode\uff0c\u76ee\u524d0\u662f\u952e\u76d8\uff0c1\u662f\u81ea\u5b9a\u4e49\nint buff_size\uff0c\u53ea\u80fd\u662f8,16,32,64\uff0c\u5982\u679c\u662f\u952e\u76d8\u6a21\u5f0f\u6216\u8005\u586b\u4e86\u5176\u4ed6\u503c\uff0c\u81ea\u52a8\u4e3a8\n\u4f8b\u5b50\uff1a\nusbapp.hid_mode(0, 0) -- usb hid\u952e\u76d8\u6a21\u5f0f\nusbapp.hid_mode(0, 1) -- usb hid\u81ea\u5b9a\u4e49\u6a21\u5f0f\uff0c\u7528\u4e8e\u514d\u9a71USB\u4ea4\u4e92\n", "prefix": "usbapp.hid_mode"}, "usbapp.start": {"body": "usbapp.start(${1:id})", "description": "usbapp.start(id) - \u542f\u52a8USB\u8bbe\u5907\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id,\u9ed8\u8ba4\u4e3a0\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u542f\u52a8USB\nusbapp.start(0)\n", "prefix": "usbapp.start"}, "usbapp.stop": {"body": "usbapp.stop(${1:id})", "description": "usbapp.stop(id) - \u5173\u95edUSB\u8bbe\u5907\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id,\u9ed8\u8ba4\u4e3a0\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u5173\u95edUSB\nusbapp.stop(0)\n", "prefix": "usbapp.stop"}, "usbapp.vhid_upload": {"body": "usbapp.vhid_upload(${1:id},${2:data})", "description": "usbapp.vhid_upload(id, data) - USB HID\u8bbe\u5907\u4e0a\u4f20\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id,\u9ed8\u8ba4\u4e3a0\nstring \u6570\u636e. \u6ce8\u610f, HID\u7684\u53ef\u7528\u5b57\u7b26\u662f\u6709\u9650\u5236\u7684, \u57fa\u672c\u4e0a\u53ea\u6709\u53ef\u89c1\u5b57\u7b26\u662f\u652f\u6301\u7684, \u4e0d\u652f\u6301\u7684\u5b57\u7b26\u4f1a\u66ff\u6362\u4e3a\u7a7a\u683c.\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- HID\u4e0a\u4f20\u6570\u636e\nusbapp.vhid_upload(0, \"1234\") -- usb hid\u4f1a\u6a21\u62df\u6572\u51fa1234\n", "prefix": "usbapp.vhid_upload"}, "usbapp.hid_tx": {"body": "usbapp.hid_tx(${1:id},${2:data},${3:start},${4:len})", "description": "usbapp.hid_tx(id, data, start, len) - USB HID\u8bbe\u5907\u4e0a\u4f20\u7528\u6237\u81ea\u5b9a\u4e49\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id,\u9ed8\u8ba4\u4e3a0\nstring or zbuff \u6ce8\u610f\u6570\u636e\u91cf\u4e0d\u8db3\u65f6\u4f1a\u81ea\u52a8\u586b\u51450\nint \u53ef\u9009\uff0cdata\u4e3azbuff\u624d\u6709\u6548\uff0c\u8981\u53d1\u9001\u7684\u6570\u636e\u8d77\u59cb\u4f4d\u7f6e\uff0c\u9ed8\u8ba4\u4e3a0\nint \u53ef\u9009\uff0cdata\u4e3azbuff\u624d\u6709\u6548\uff0c\u8981\u53d1\u9001\u7684\u6570\u636e\u957f\u5ea6\uff0c\u9ed8\u8ba4\u4e3azbuff\u5185\u6709\u6548\u6570\u636e\uff0c\u6700\u5927\u503c\u4e0d\u8d85\u8fc7zbuff\u7684\u6700\u5927\u7a7a\u95f4\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- HID\u4e0a\u4f20\u6570\u636e\nusbapp.hid_tx(0, \"1234\") -- usb hid\u4e0a\u4f200x31 0x32 0x33 0x34 + N\u4e2a0\n", "prefix": "usbapp.hid_tx"}, "usbapp.hid_rx": {"body": "usbapp.hid_rx(${1:id},${2:buff})", "description": "usbapp.hid_rx(id, buff) - buff\u5f62\u5f0f\u8bfb\u63a5\u6536\u5230\u7684\u6570\u636e\uff0c\u4e00\u6b21\u8bfb\u51fa\u5168\u90e8\u6570\u636e\u5b58\u5165buff\u4e2d\uff0c\u5982\u679cbuff\u7a7a\u95f4\u4e0d\u591f\u4f1a\u81ea\u52a8\u6269\u5c55\uff0c\u76ee\u524d\u53ea\u6709air105\u652f\u6301\u8fd9\u4e2a\u64cd\u4f5c\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id,\u9ed8\u8ba4\u4e3a0\nzbuff zbuff\u5bf9\u8c61\n\u8fd4\u56de\u503c\uff1a\nint \u8fd4\u56de\u8bfb\u5230\u7684\u957f\u5ea6\uff0c\u5e76\u628azbuff\u6307\u9488\u540e\u79fb\n\u4f8b\u5b50\uff1a\nusbapp.hid_rx(0, buff)\n", "prefix": "usbapp.hid_rx"}, "usbapp.vhid_cancel_upload": {"body": "usbapp.vhid_cancel_upload(${1:id})", "description": "usbapp.vhid_cancel_upload(id) - USB HID\u8bbe\u5907\u53d6\u6d88\u4e0a\u4f20\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id,\u9ed8\u8ba4\u4e3a0\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\n-- \u53d6\u6d88\u4e0a\u4f20\u6570\u636e,\u901a\u5e38\u4e0d\u9700\u8981\nusbapp.vhid_cancel_upload(0)\n", "prefix": "usbapp.vhid_cancel_upload"}, "usbapp.udisk_attach_sdhc": {"body": "usbapp.udisk_attach_sdhc(${1:id})", "description": "usbapp.udisk_attach_sdhc(id) - USB U\u76d8\u8bbe\u5907\u6302\u8f7dSDHC\uff0cTF\u5361\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id,\u9ed8\u8ba4\u4e3a0\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nusbapp.udisk_attach_sdhc(0)\n", "prefix": "usbapp.udisk_attach_sdhc"}, "usbapp.udisk_detach_sdhc": {"body": "usbapp.udisk_detach_sdhc(${1:id})", "description": "usbapp.udisk_detach_sdhc(id) - USB U\u76d8\u8bbe\u5907\u53bb\u9664\u6302\u8f7dSDHC\uff0cTF\u5361\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u5907id,\u9ed8\u8ba4\u4e3a0\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nusbapp.udisk_detach_sdhc(0)\n", "prefix": "usbapp.udisk_detach_sdhc"}, "w5500.init": {"body": "w5500.init(${1:spiid},${2:speed},${3:cs_pin},${4:irq_pin},${5:rst_pin},${6:link_pin})", "description": "w5500.init(spiid, speed, cs_pin, irq_pin, rst_pin, link_pin) - \u521d\u59cb\u5316w5500\n\u4f20\u5165\u503c\uff1a\nint spi\u901a\u9053\u53f7, \u4f8b\u5982 0, 1, 5, \u6309\u8bbe\u5907\u5b9e\u9645\u60c5\u51b5\u9009\nint spi\u901f\u5ea6, \u53ef\u4ee5\u8bbe\u7f6e\u5230\u5bf9\u5e94SPI\u7684\u6700\u9ad8\u901f\u5ea6\nint cs pin, \u7247\u9009\u811a, \u5bf9\u5e94W5500\u7684SCS\nint irq pin, \u4e2d\u65ad\u811a, \u5bf9\u5e94W5500\u7684INT\nint reset pin, \u590d\u4f4d\u811a, \u5bf9\u5e94W5500\u7684RST\nint link \u72b6\u6001 pin\uff0c\u53ef\u4ee5\u7559\u7a7a\u4e0d\u4f7f\u7528\uff0c\u9ed8\u8ba4\u4e0d\u4f7f\u7528\n\u4f8b\u5b50\uff1a\nw5500.init(spi.SPI_0, 24000000, pin.PB13, pin.PC08, pin.PC09)\n", "prefix": "w5500.init"}, "w5500.config": {"body": "w5500.config(${1:ip},${2:submask},${3:gateway},${4:mac},${5:RTR},${6:RCR},${7:speed})", "description": "w5500.config(ip, submask, gateway, mac, RTR, RCR, speed) - w5500\u914d\u7f6e\u7f51\u7edc\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nstring \u9759\u6001ip\u5730\u5740\uff0c\u5982\u679c\u9700\u8981\u7528DHCP\u83b7\u53d6\uff0c\u8bf7\u5199nil\nstring \u5b50\u7f51\u63a9\u7801\uff0c\u5982\u679c\u4f7f\u7528\u52a8\u6001ip\uff0c\u5219\u5ffd\u7565\nstring \u7f51\u5173\uff0c\u5982\u679c\u4f7f\u7528\u52a8\u6001ip\uff0c\u5219\u5ffd\u7565\nstring MAC\uff0c\u5199nil\u5219\u901a\u8fc7MCU\u552f\u4e00\u7801\u81ea\u52a8\u751f\u6210\uff0c\u5982\u679c\u8981\u5199\uff0c\u957f\u5ea6\u5fc5\u987b\u662f6byte\nint \u91cd\u8bd5\u95f4\u9694\u65f6\u95f4\uff0c\u9ed8\u8ba42000\uff0c\u5355\u4f4d100us\uff0c\u4e0d\u61c2\u7684\u4e0d\u8981\u6539\nint \u6700\u5927\u91cd\u8bd5\u6b21\u6570\uff0c\u9ed8\u8ba48\uff0c\u4e0d\u61c2\u7684\u4e0d\u8981\u6539\nint \u901f\u5ea6\u7c7b\u578b\uff0c\u76ee\u524d\u53ea\u67090\u786c\u4ef6\u914d\u7f6e\uff0c1\u81ea\u9002\u5e94\uff0c\u9ed8\u8ba4\u4e3a0\n\u4f8b\u5b50\uff1a\nw5500.config(\"192.168.1.2\", \"255.255.255.0\", \"192.168.1.1\", string.fromHex(\"102a3b4c5d6e\"))\n", "prefix": "w5500.config"}, "w5500.bind": {"body": "w5500.bind(${1:id})", "description": "w5500.bind(id) - \u5c06w5500\u6ce8\u518c\u8fdb\u901a\u7528\u7f51\u7edc\u63a5\u53e3\n\u4f20\u5165\u503c\uff1a\nint \u901a\u7528\u7f51\u7edc\u901a\u9053\u53f7\n\u4f8b\u5b50\uff1a\n-- \u82e5\u4f7f\u7528\u7684\u7248\u672c\u4e0d\u5e26socket\u5e93, \u6539\u6210 network.ETH0\nw5500.bind(socket.ETH0)\n", "prefix": "w5500.bind"}, "w5500.getMac": {"body": "w5500.getMac()", "description": "w5500.getMac() - \u83b7\u53d6w5500\u5f53\u524d\u7684MAC\uff0c\u5fc5\u987b\u5728init\u4e4b\u540e\u7528\uff0c\u5982\u679cconfig\u4e2d\u8bbe\u7f6e\u4e86\u81ea\u5df1\u7684MAC\uff0c\u9700\u8981\u5ef6\u8fdf\u4e00\u70b9\u65f6\u95f4\u518d\u8bfb\n\u8fd4\u56de\u503c\uff1a\nstring \u5f53\u524d\u7684MAC\n\u4f8b\u5b50\uff1a\nlocal mac = w5500.getMac()\nlog.info(\"w5500 mac\", mac:toHex())\n", "prefix": "w5500.getMac"}, "wdt.init": {"body": "wdt.init(${1:timeout})", "description": "wdt.init(timeout) - \u521d\u59cb\u5316watchdog\u5e76\u9a6c\u4e0a\u542f\u7528.\u5927\u90e8\u5206\u8bbe\u5907\u7684watchdog\u4e00\u65e6\u542f\u7528\u5c31\u65e0\u6cd5\u5173\u95ed.\n\u4f20\u5165\u503c\uff1a\nint \u8d85\u65f6\u65f6\u957f,\u5355\u4f4d\u4e3a\u6beb\u79d2\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse(\u4f8b\u5982\u5e95\u5c42\u4e0d\u652f\u6301)\n\u4f8b\u5b50\uff1a\nwdt.init(9000)\nsys.timerLoopStart(wdt.feed, 3000)\n", "prefix": "wdt.init"}, "wdt.setTimeout": {"body": "wdt.setTimeout(${1:timeout})", "description": "wdt.setTimeout(timeout) - \u90e8\u5206\u8bbe\u5907\u652f\u6301\u91cd\u65b0\u8bbe\u7f6ewatchdog\u8d85\u65f6\u65f6\u957f\n\u4f20\u5165\u503c\uff1a\nint \u8d85\u65f6\u65f6\u957f,\u5355\u4f4d\u4e3a\u6beb\u79d2\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse(\u4f8b\u5982\u5e95\u5c42\u4e0d\u652f\u6301)\n\u4f8b\u5b50\uff1a\nwdt.init(10000)\nsys.timerLoopStart(wdt.feed, 3000)\nsys.wait(5000)\nsys.setTimeout(5000)\n", "prefix": "wdt.setTimeout"}, "wdt.feed": {"body": "wdt.feed()", "description": "wdt.feed() - \u5582\u72d7,\u4f7f\u5f97\u8d85\u65f6\u8ba1\u65f6\u590d\u4f4d,\u91cd\u65b0\u8ba1\u65f6\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse(\u4f8b\u5982\u5e95\u5c42\u4e0d\u652f\u6301)\n\u4f8b\u5b50\uff1a\nwdt.init(10000)\n-- \u5b9a\u65f6\u5582\u72d7,\u6216\u8005\u6839\u636e\u4e1a\u52a1\u6309\u9700\u5582\u72d7\nsys.timerLoopStart(wdt.feed, 3000)\n", "prefix": "wdt.feed"}, "wdt.close": {"body": "wdt.close()", "description": "wdt.close() - \u5173\u95edwatchdog,\u901a\u5e38\u4e0d\u88ab\u652f\u6301\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse(\u4f8b\u5982\u5e95\u5c42\u4e0d\u652f\u6301)\n\u4f8b\u5b50\uff1a\nwdt.init(10000)\nsys.wait(9000)\nwdt.close()\n", "prefix": "wdt.close"}, "wsc:debug": {"body": "wsc:debug(${1:onoff})", "description": "wsc:debug(onoff) - \u914d\u7f6e\u662f\u5426\u6253\u5f00debug\u4fe1\u606f\n\u4f20\u5165\u503c\uff1a\nboolean \u662f\u5426\u6253\u5f00debug\u5f00\u5173\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n", "prefix": "wsc:debug"}, "websocket.create": {"body": "websocket.create(${1:adapter},${2:url},${3:keepalive},${4:use_ipv6})", "description": "websocket.create(adapter, url, keepalive, use_ipv6) - websocket\u5ba2\u6237\u7aef\u521b\u5efa\n\u4f20\u5165\u503c\uff1a\nint \u9002\u914d\u5668\u5e8f\u53f7, \u53c2\u8003socket\u5e93\u7684\u5e38\u91cf,\u9ed8\u8ba4\u4e3anil,\u4f1a\u9009\u62e9\u5e73\u53f0\u81ea\u5e26\u7684\u65b9\u5f0f\nstring \u8fde\u63a5\u5b57\u7b26\u4e32,\u53c2\u8003usage\nint \u5fc3\u8df3\u95f4\u9694,\u9ed8\u8ba460\u79d2. 2024.4.28\u65b0\u589e\nboolean \u662f\u5426\u4f7f\u7528ipv6,\u9ed8\u8ba4false. 2024.6.17\u65b0\u589e\n\u8fd4\u56de\u503c\uff1a\nuserdata \u82e5\u6210\u529f\u4f1a\u8fd4\u56dewebsocket\u5ba2\u6237\u7aef\u5b9e\u4f8b,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u666e\u901aTCP\u94fe\u63a5\nwsc = websocket.create(nil,\"ws://air32.cn/abc\")\n-- \u52a0\u5bc6TCP\u94fe\u63a5\nwsc = websocket.create(nil,\"wss://air32.cn/abc\")\n", "prefix": "websocket.create"}, "wsc:on": {"body": "wsc:on(${1:cb})", "description": "wsc:on(cb) - \u6ce8\u518cwebsocket\u56de\u8c03\n\u4f20\u5165\u503c\uff1a\nfunction cb websocket\u56de\u8c03,\u53c2\u6570\u5305\u62ecwebsocket_client, event, data, payload\n\u8fd4\u56de\u503c\uff1a\nnil \u65e0\u8fd4\u56de\u503c\n\u4f8b\u5b50\uff1a\nwsc:on(function(websocket_client, event, data, payload)\n -- \u6253\u5370\u5404\u79cd\u4e8b\u4ef6\n log.info(\"websocket\", \"event\", event, data, payload)\nend)\n--[[\nevent\u7684\u503c\u6709:\n conack \u8fde\u63a5\u670d\u52a1\u5668\u6210\u529f,\u5df2\u7ecf\u6536\u5230websocket\u534f\u8bae\u5934\u90e8\u4fe1\u606f,\u901a\u4fe1\u5df2\u5efa\u7acb\n recv \u6536\u5230\u670d\u52a1\u5668\u4e0b\u53d1\u7684\u4fe1\u606f, data, payload \u4e0d\u4e3anil\n sent send\u51fd\u6570\u53d1\u9001\u7684\u6d88\u606f,\u670d\u52a1\u5668\u5728TCP\u534f\u8bae\u5c42\u5df2\u786e\u8ba4\u6536\u5230\n disconnect \u670d\u52a1\u5668\u8fde\u63a5\u5df2\u65ad\u5f00\n\n\u5176\u4e2d sent/disconnect \u4e8b\u4ef6\u5728 2023.04.01 \u65b0\u589e\n]]\n", "prefix": "wsc:on"}, "wsc:connect": {"body": "wsc:connect()", "description": "wsc:connect() - \u8fde\u63a5\u670d\u52a1\u5668\n\u8fd4\u56de\u503c\uff1a\nboolean \u53d1\u8d77\u6210\u529f\u8fd4\u56detrue, \u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u5f00\u59cb\u5efa\u7acb\u8fde\u63a5\nwsc:connect()\n-- \u672c\u51fd\u6570\u4ec5\u4ee3\u8868\u53d1\u8d77\u6210\u529f, \u540e\u7eed\u4ecd\u9700\u6839\u636eready\u51fd\u6570\u5224\u65adwebsocket\u662f\u5426\u8fde\u63a5\u6b63\u5e38\n", "prefix": "wsc:connect"}, "wsc:autoreconn": {"body": "wsc:autoreconn(${1:reconnect},${2:reconnect_time})", "description": "wsc:autoreconn(reconnect, reconnect_time) - \u81ea\u52a8\u91cd\u8fde\n\u4f20\u5165\u503c\uff1a\nbool \u662f\u5426\u81ea\u52a8\u91cd\u8fde\nint \u81ea\u52a8\u91cd\u8fde\u5468\u671f \u5355\u4f4dms \u9ed8\u8ba43000ms\n\u4f8b\u5b50\uff1a\nwsc:autoreconn(true)\n", "prefix": "wsc:autoreconn"}, "wsc:send": {"body": "wsc:send(${1:data},${2:fin},${3:opt})", "description": "wsc:send(data, fin, opt) - \u53d1\u5e03\u6d88\u606f\n\u4f20\u5165\u503c\uff1a\nstring \u5f85\u53d1\u9001\u7684\u6570\u636e,\u5fc5\u586b\nint \u662f\u5426\u4e3a\u6700\u540e\u4e00\u5e27,\u9ed8\u8ba41,\u5373\u9a6c\u4e0a\u8bbe\u7f6e\u4e3a\u6700\u540e\u4e00\u5e27, \u4e5f\u5c31\u662f\u5355\u5e27\u53d1\u9001\nint \u64cd\u4f5c\u7801, \u9ed8\u8ba4\u4e3a\u5b57\u7b26\u4e32\u5e270, \u53ef\u90091\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u4e3afalse\u6216\u8005nil\n\u4f8b\u5b50\uff1a\n-- \u7b80\u5355\u53d1\u9001\u6570\u636e\nwsc:send(\"123\")\n-- \u5206\u6bb5\u53d1\u9001\u6570\u636e, \u6700\u540e\u8981\u75281(\u5373FIN\u5e27\u7ed3\u675f)\nwsc:send(\"123\", 0)\nwsc:send(\"456\", 0)\nwsc:send(\"789\", 1)\n", "prefix": "wsc:send"}, "wsc:close": {"body": "wsc:close()", "description": "wsc:close() - websocket\u5ba2\u6237\u7aef\u5173\u95ed(\u5173\u95ed\u540e\u8d44\u6e90\u91ca\u653e\u65e0\u6cd5\u518d\u4f7f\u7528)\n\u4f8b\u5b50\uff1a\nwsc:close()\n", "prefix": "wsc:close"}, "wsc:ready": {"body": "wsc:ready()", "description": "wsc:ready() - websocket\u5ba2\u6237\u7aef\u662f\u5426\u5c31\u7eea\n\u8fd4\u56de\u503c\uff1a\nbool \u5ba2\u6237\u7aef\u662f\u5426\u5c31\u7eea\n\u4f8b\u5b50\uff1a\nlocal stat = wsc:ready()\n", "prefix": "wsc:ready"}, "wsc:headers": {"body": "wsc:headers(${1:headers})", "description": "wsc:headers(headers) - \u8bbe\u7f6e\u989d\u5916\u7684headers\n\u4f20\u5165\u503c\uff1a\ntable/string \u53ef\u4ee5\u662ftable,\u4e5f\u53ef\u4ee5\u662f\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nbool \u5ba2\u6237\u7aef\u662f\u5426\u5c31\u7eea\n\u4f8b\u5b50\uff1a\n-- table\u5f62\u5f0f\nwsc:headers({\n Auth=\"Basic ABCDEFGG\"\n})\n-- \u5b57\u7b26\u4e32\u5f62\u5f0f\nwsc:headers(\"Auth: Basic ABCDERG\\r\\n\")\n", "prefix": "wsc:headers"}, "wlan.init": {"body": "wlan.init()", "description": "wlan.init() - \u521d\u59cb\u5316\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n", "prefix": "wlan.init"}, "wlan.setMode": {"body": "wlan.setMode(${1:mode})", "description": "wlan.setMode(mode) - \u8bbe\u7f6ewifi\u6a21\u5f0f\n\u4f20\u5165\u503c\uff1a\nint wifi\u6a21\u5f0f\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u8bbe\u7f6e\u4e3aAP\u6a21\u5f0f, \u5e7f\u64adssid, \u63a5\u6536wifi\u5ba2\u6237\u7aef\u7684\u94fe\u63a5\nwlan.setMode(wlan.AP)\n\n-- \u8bbe\u7f6e\u4e3aSTATION\u6a21\u5f0f, \u4e5f\u662f\u521d\u59cb\u5316\u540e\u7684\u9ed8\u8ba4\u6a21\u5f0f\nwlan.setMode(wlan.STATION)\n\n-- \u6df7\u5408\u6a21\u5f0f, \u505aAP\u53c8\u505aSTATION\nwlan.setMode(wlan.APSTA)\n", "prefix": "wlan.setMode"}, "wlan.ready": {"body": "wlan.ready()", "description": "wlan.ready() - \u4f5c\u4e3aSTATION\u65f6,\u662f\u5426\u5df2\u7ecf\u8fde\u63a5\u4e0aAP,\u4e14\u83b7\u53d6IP\u6210\u529f\n\u8fd4\u56de\u503c\uff1a\nbool \u5df2\u7ecf\u8fde\u63a5\u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n", "prefix": "wlan.ready"}, "wlan.connect": {"body": "wlan.connect(${1:ssid},${2:password},${3:auto_reconnect},${4:bssid})", "description": "wlan.connect(ssid, password, auto_reconnect, bssid) - \u4f5c\u4e3aSTATION\u65f6,\u8fde\u63a5\u5230\u6307\u5b9aAP\n\u4f20\u5165\u503c\uff1a\nstring AP\u7684ssid\nstring AP\u7684password,\u53ef\u9009\nint 0\u5173\u95ed\u81ea\u52a8\u91cd\u8fde,1\u5f00\u542f\u81ea\u52a8\u91cd\u8fde.\u5f53\u524d\u5f3a\u5236\u5f00\u542f\u81ea\u52a8\u91cd\u8fde\nstring AP\u7684bssid,\u53ef\u9009,\u5fc5\u987b\u662f6\u5b57\u8282\n\u8fd4\u56de\u503c\uff1a\nbool \u53d1\u8d77\u8fde\u63a5\u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse.\u6ce8\u610f,\u4e0d\u4ee3\u8868\u8fde\u63a5AP\u6210\u529f!!\n\u4f8b\u5b50\uff1a\n\n-- \u666e\u901a\u6a21\u5f0f,\u5e26\u5bc6\u7801\nwlan.connect(\"myap\", \"12345678\")\n-- \u666e\u901a\u6a21\u5f0f,\u4e0d\u5e26\u5bc6\u7801\nwlan.connect(\"myap\")\n-- \u7279\u6b8a\u6a21\u5f0f, \u91cd\u7528\u4e4b\u524d\u7684ssid\u548c\u5bc6\u7801,\u672c\u6b21\u76f4\u63a5\u8fde\u63a5\n-- \u6ce8\u610f, \u524d\u63d0\u662f\u672c\u6b21\u4e0a\u7535\u540e\u5df2\u7ecf\u4f20\u8fc7ssid\u548c\u6216password,\u5426\u5219\u5fc5\u5931\u8d25\nwlan.connect()\n\n-- \u7279\u6b8a\u6a21\u5f0f, \u4f7f\u7528ssid\u548c\u5bc6\u7801,\u672c\u6b21\u8fde\u63a5\u6307\u5b9abssid, 2024.5.7\u65b0\u589e\nlocal bssid = string.fromHex(\"00182946365f\")\nwlan.connect(\"myap\", \"12345678\", 1, bssid)\n", "prefix": "wlan.connect"}, "wlan.disconnect": {"body": "wlan.disconnect()", "description": "wlan.disconnect() - \u4f5c\u4e3aSTATION\u65f6,\u65ad\u5f00AP\n", "prefix": "wlan.disconnect"}, "wlan.scan": {"body": "wlan.scan()", "description": "wlan.scan() - \u626b\u63cfwifi\u9891\u6bb5\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f, wlan.scan()\u662f\u5f02\u6b65API,\u542f\u52a8\u626b\u63cf\u540e\u4f1a\u9a6c\u4e0a\u8fd4\u56de\n\n-- wifi\u626b\u63cf\u6210\u529f\u540e, \u4f1a\u6709WLAN_SCAN_DONE\u6d88\u606f, \u8bfb\u53d6\u5373\u53ef\nsys.subscribe(\"WLAN_SCAN_DONE\", function ()\n local results = wlan.scanResult()\n log.info(\"scan\", \"results\", #results)\n for k,v in pairs(results) do\n log.info(\"scan\", v[\"ssid\"], v[\"rssi\"], (v[\"bssid\"]:toHex()))\n end\nend)\n\n-- \u4e0b\u9762\u6f14\u793a\u7684\u662f\u521d\u59cb\u5316wifi\u540e\u5b9a\u65f6\u626b\u63cf,\u8bf7\u6309\u5b9e\u9645\u4e1a\u52a1\u9700\u6c42\u4fee\u6539\nsys.taskInit(function()\n sys.wait(1000)\n wlan.init()\n while 1 do\n wlan.scan()\n sys.wait(15000)\n end\nend)\n", "prefix": "wlan.scan"}, "wlan.scanResult": {"body": "wlan.scanResult()", "description": "wlan.scanResult() - \u83b7\u53d6wifi\u626b\u63cf\u7ed3\u679c\n\u8fd4\u56de\u503c\uff1a\ntable \u626b\u63cf\u7ed3\u679c\n\u4f8b\u5b50\uff1a\n-- \u7528\u6cd5\u8bf7\u67e5\u9605 wlan.scan() \u51fd\u6570\n", "prefix": "wlan.scanResult"}, "wlan.smartconfig": {"body": "wlan.smartconfig(${1:mode})", "description": "wlan.smartconfig(mode) - \u914d\u7f51\n\u4f20\u5165\u503c\uff1a\nint \u914d\u7f51\u6a21\u5f0f, \u9ed8\u8ba4\u4e3aesptouch, \u82e5\u4f200\u5219\u4e3b\u52a8\u505c\u6b62\u914d\u7f51\n\u8fd4\u56de\u503c\uff1a\nbool \u542f\u52a8\u6210\u529f\u6216\u505c\u6b62\u6210\u529f, \u8fd4\u56detrue, \u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nwlan.smartconfig()\nlocal ret, ssid, passwd = sys.waitUntil(\"SC_RESULT\", 180*1000) -- \u6700\u591a\u7b493\u5206\u949f\nlog.info(\"sc\", ret, ssid, passwd)\n-- \u8be6\u7ec6\u7528\u6cd5\u8bf7\u67e5\u770bdemo\n", "prefix": "wlan.smartconfig"}, "wlan.getMac": {"body": "wlan.getMac(${1:tp},${2:hexstr})", "description": "wlan.getMac(tp, hexstr) - \u83b7\u53d6mac\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u7f6e\u4f55\u79cdmac\u5730\u5740,\u5bf9ESP32\u7cfb\u5217\u6765\u8bf4,\u53ea\u80fd\u8bbe\u7f6eSTA\u7684\u5730\u5740,\u53730,\u9ed8\u8ba4\u503c\u4e5f\u662f0\nbool \u662f\u5426\u8f6cHEX\u5b57\u7b26, \u9ed8\u8ba4\u662ftrue,\u5373\u8f93\u51fahex\u5b57\u7b26\u4e32\n\u8fd4\u56de\u503c\uff1a\nstring MAC\u5730\u5740,\u5341\u516d\u8fdb\u5236\u5b57\u7b26\u4e32\u5f62\u5f0f \"AABBCCDDEEFF\" \u6216\u539f\u59cb\u6570\u636e\n", "prefix": "wlan.getMac"}, "wlan.setMac": {"body": "wlan.setMac(${1:tp},${2:mac})", "description": "wlan.setMac(tp, mac) - \u8bbe\u7f6emac\n\u4f20\u5165\u503c\uff1a\nint \u8bbe\u7f6e\u4f55\u79cdmac\u5730\u5740,\u5bf9ESP32\u7cfb\u5217\u6765\u8bf4,\u53ea\u80fd\u8bbe\u7f6eSTA\u7684\u5730\u5740,\u53730\nstring \u5f85\u8bbe\u7f6e\u7684MAC\u5730\u5740,\u957f\u5ea66\u5b57\u8282\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u8bbe\u7f6eMAC\u5730\u5740, 2023-03-01\u4e4b\u540e\u7f16\u8bd1\u7684\u56fa\u4ef6\u53ef\u7528\nlocal mac = string.fromHex(\"F01122334455\")\nwlan.setMac(0, mac)\n\n-- \u90e8\u5206\u6a21\u5757\u652f\u6301\u6062\u590d\u9ed8\u8ba4MAC, \u4f8b\u5982esp32\u7cfb\u5217\n-- \u57282023-11-01 \u4e4b\u540e\u7f16\u8bd1\u7684\u56fa\u4ef6\u53ef\u7528\nlocal mac = string.fromHex(\"000000000000\")\nwlan.setMac(0, mac)\n", "prefix": "wlan.setMac"}, "wlan.getIP": {"body": "wlan.getIP()", "description": "wlan.getIP() - \u83b7\u53d6ip,\u4ec5STATION\u6216APSTA\u6a21\u5f0f\u4e0b\u6709\u610f\u4e49\n\u8fd4\u56de\u503c\uff1a\nstring ip\u5730\u5740,\u5f53\u524d\u4ec5\u8fd4\u56deipv4\u5730\u5740,\u4f8b\u5982 \"192.168.1.25\"\n", "prefix": "wlan.getIP"}, "wlan.createAP": {"body": "wlan.createAP(${1:ssid},${2:passwd},${3:gateway},${4:netmask},${5:channel},${6:opts})", "description": "wlan.createAP(ssid, passwd, gateway, netmask, channel, opts) - \u542f\u52a8AP\n\u4f20\u5165\u503c\uff1a\nstring AP\u7684SSID,\u5fc5\u586b\nstring AP\u7684\u5bc6\u7801,\u53ef\u9009\nstring AP\u7684\u7f51\u5173\u5730\u5740, \u9ed8\u8ba4192.168.4.1\nstring AP\u7684\u7f51\u5173\u63a9\u7801, \u9ed8\u8ba4255.255.255.0\nint AP\u5efa\u7acb\u7684\u901a\u9053, \u9ed8\u8ba46\ntable AP\u7684\u914d\u7f6e\u9009\u9879, \u53ef\u9009\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u521b\u5efa\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f, \u8c03\u7528\u672cAP\u65f6,\u82e5wifi\u6a21\u5f0f\u4e3aSTATION,\u4f1a\u81ea\u52a8\u5207\u6362\u6210 APSTA\nwlan.createAP(\"luatos1234\", \"12341234\")\n-- \u8bbe\u7f6e\u7f51\u5173IP,\u63a9\u7801, \u901a\u9053, 2023.7.13 \u65b0\u589e, BSP\u672a\u5fc5\u652f\u6301\n-- wlan.createAP(\"luatos1234\", \"12341234\", \"192.168.4.1\", \"255.255.255.0\", 6)\n\n-- opts\u66f4\u591a\u914d\u7f6e\u9879, 2024.3.5\u65b0\u589e\n--[[\n{\n hidden = false, -- \u662f\u5426\u9690\u85cfSSID, \u9ed8\u8ba4false,\u4e0d\u9690\u85cf\n max_conn = 4 -- \u6700\u5927\u5ba2\u6237\u7aef\u6570\u91cf, \u9ed8\u8ba44\n}\n]]\n", "prefix": "wlan.createAP"}, "wlan.stopAP": {"body": "wlan.stopAP()", "description": "wlan.stopAP() - \u5173\u95edAP\u529f\u80fd\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u521b\u5efa\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\nwlan.stopAP()\n", "prefix": "wlan.stopAP"}, "wlan.getInfo": {"body": "wlan.getInfo()", "description": "wlan.getInfo() - \u83b7\u53d6\u4fe1\u606f,\u5982AP\u7684bssid,\u4fe1\u53f7\u5f3a\u5ea6, STA\u8054\u7f51\u540e\u53ef\u83b7\u53d6\n\u8fd4\u56de\u503c\uff1a\ntable \u8be6\u60c5,\u952e\u503c\u5bf9\u5f62\u5f0f\n\u4f8b\u5b50\uff1a\n\nlog.info(\"wlan\", \"info\", json.encode(wlan.getInfo()))\n--[[\n\u5178\u578b\u8f93\u51fa\n{\n \"bssid\" : \"xxxxxx\",\n \"rssi\" : -89,\n \"gw\" : \"192.168.1.1\"\n}\n]]\n", "prefix": "wlan.getInfo"}, "wlan.powerSave": {"body": "wlan.powerSave(${1:mode})", "description": "wlan.powerSave(mode) - \u8bfb\u53d6\u6216\u8bbe\u7f6e\u7701\u7535\u6a21\u5f0f\n\u4f20\u5165\u503c\uff1a\nint \u7701\u7535\u6a21\u5f0f,\u53ef\u9009, \u4f20\u5165\u5c31\u662f\u8bbe\u7f6e, \u4f8b\u5982wlan.PS_NONE\n\u8fd4\u56de\u503c\uff1a\nint \u5f53\u524d\u7701\u7535\u6a21\u5f0f/\u8bbe\u7f6e\u540e\u7684\u7701\u7535\u6a21\u5f0f\n\u4f8b\u5b50\uff1a\n-- \u8bf7\u67e5\u9605\u5e38\u91cf\u8868 PS_NONE/PS_MIN_MODEM/PS_MAX_MODEM\nlog.info(\"wlan\", \"PS\", wlan.powerSave(wlan.PS_NONE))\n-- \u672cAPI\u4e8e 2023.03.31 \u65b0\u589e\n", "prefix": "wlan.powerSave"}, "wlan.hostname": {"body": "wlan.hostname(${1:new_name})", "description": "wlan.hostname(new_name) - \u8bfb\u53d6\u6216\u8bbe\u7f6eHostname\n\u4f20\u5165\u503c\uff1a\nstring \u65b0\u7684hostname,\u53ef\u9009, \u4f20\u5165\u5c31\u662f\u8bbe\u7f6e\n\u8fd4\u56de\u503c\uff1a\nstring \u5f53\u524d\u7684hostname\u6216\u8005\u8bbe\u7f6e\u540e\u7684hostname\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e 2023.07.23 \u65b0\u589e\n-- \u672c\u51fd\u6570\u5e94\u8be5\u5728wlan.init\u4e4b\u524d\u8bbe\u7f6e\u597d, \u6700\u665a\u5e94\u65e9\u4e8ewlan.connect\n-- hostname\u7684\u9ed8\u8ba4\u503c\u662f \"LUATOS_\" + \u8bbe\u5907\u7684MAC\u503c\n-- \u4f8b\u5982: LUATOS_0022EECC2399\n\nwlan.hostname(\"\u6211\u7684wifi\u7269\u8054\u7f51\u8bbe\u5907\")\n", "prefix": "wlan.hostname"}, "wlan.staIp": {"body": "wlan.staIp(${1:dhcp_enable},${2:ip},${3:netmask},${4:gateway})", "description": "wlan.staIp(dhcp_enable, ip, netmask, gateway) - \u8bbe\u7f6eStation\u6a21\u5f0f\u4e0b\u7684IP\u83b7\u53d6\u6a21\u5f0f\n\u4f20\u5165\u503c\uff1a\nbool \u662f\u5426\u542f\u7528DHCP,\u9ed8\u8ba4\u662ftrue\nstring \u672c\u673aIP\u5730\u5740,\u4f8b\u5982192.168.2.200, \u7981\u7528DHCP\u65f6\u5fc5\u586b\nstring \u672c\u673aIP\u63a9\u7801,\u4f8b\u5982255.255.255.0, \u7981\u7528DHCP\u65f6\u5fc5\u586b\nstring \u672c\u673aIP\u7f51\u5173,\u4f8b\u5982192.168.2.1, \u7981\u7528DHCP\u65f6\u5fc5\u586b\n\u8fd4\u56de\u503c\uff1a\nbool \u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56defalse\n\u4f8b\u5b50\uff1a\n-- \u672cAPI\u4e8e 2023.10.06 \u65b0\u589e\n-- \u672c\u51fd\u6570\u9700\u8981\u5728wlan.init\u4e4b\u540e\u624d\u5141\u8bb8\u8c03\u7528\n\n-- \u542f\u7528DHCP, \u9ed8\u8ba4\u4e5f\u662f\u542f\u7528DHCP,\u8fd9\u91cc\u662f\u6f14\u793aAPI\u4f7f\u7528\nwlan.staIp(true)\n-- \u7981\u7528DHCP,\u81ea\u884c\u8bbe\u7f6eIP/\u63a9\u7801/\u7f51\u5173\nwlan.staIp(false, \"192.168.2.200\", \"255.255.255.0\", \"192.168.2.1\")\n", "prefix": "wlan.staIp"}, "wlanraw.setup": {"body": "wlanraw.setup(${1:opts},${2:cb})", "description": "wlanraw.setup(opts, cb) - \u521d\u59cb\u5316WLAN\u7684RAW\u5c42\n\u4f20\u5165\u503c\uff1a\ntable opts \u914d\u7f6e\u53c2\u6570\nfunction \u56de\u8c03\u51fd\u6570,\u5f62\u5f0ffunction(buff, size)\n\u8fd4\u56de\u503c\uff1a\nboolean true\u8868\u793a\u6210\u529f,\u5176\u4ed6\u5931\u8d25\n\u4f8b\u5b50\uff1a\n-- \u5f53\u524d\u4ec5XT804\u7cfb\u5217\u652f\u6301, \u4f8b\u5982 Air101/Air103/Air601/Air690\nwlanraw.setup({\n buffsize = 1600, -- \u7f13\u51b2\u533a\u5927\u5c0f, \u9ed8\u8ba41600\u5b57\u8282\n buffcount = 10, -- \u7f13\u51b2\u533a\u6570\u91cf, \u9ed8\u8ba48\n}, cb)\n", "prefix": "wlanraw.setup"}, "ws2812.create": {"body": "ws2812.create(${1:mode},${2:count},${3:id})", "description": "ws2812.create(mode, count, id) - \u521b\u5efa\u4e0a\u4e0b\u6587\n\u4f20\u5165\u503c\uff1a\nint \u4f20\u8f93\u6a21\u5f0f, \u4f8b\u5982 ws2812.GPIO, ws2812.PWM, ws2812.SPI\nint RGB\u706f\u603b\u4e2a\u6570\nint \u4e3b\u53c2\u6570id, \u5bf9\u4e8e\u4e0d\u540c\u7684\u6a21\u5f0f\u6709\u4e0d\u540c\u7684\u503c\n\u8fd4\u56de\u503c\uff1a\nuserdata \u521b\u5efa\u6210\u529f\u8fd4\u56de\u4e0a\u4e0b\u6587,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- GPIO\u6a21\u5f0f, 64\u4e2a\u706f, \u4f7f\u7528GPIO9\nlocal leds = ws2812.create(ws2812.GPIO, 64, 9)\n-- SPI\u6a21\u5f0f, 32\u4e2a\u706f, \u4f7f\u7528SPI1\nlocal leds = ws2812.create(ws2812.SPI, 32, 1)\n-- PWM\u6a21\u5f0f, 16\u4e2a\u706f, \u4f7f\u7528PWM4\nlocal leds = ws2812.create(ws2812.PWM, 16, 4)\n-- HW\u6a21\u5f0f, 64\u4e2a\u706f, \u4f7f\u7528\u786c\u4ef6\u4e13\u7528\u5b9e\u73b0,\u5177\u4f53id\u9700\u8981\u5bf9\u7167\u624b\u518c\nlocal leds = ws2812.create(ws2812.RMT, 64, 2)\n\n-- \u6ce8\u610f: \u5e76\u975e\u6240\u6709\u6a21\u5757\u90fd\u652f\u6301\u4ee5\u4e0a\u6240\u6709\u6a21\u5f0f\n-- \u800c\u4e14, \u56fa\u4ef6\u9700\u8981\u5f00\u542f\u5bf9\u5e94\u7684GPIO/SPI/PWM\u529f\u80fd\u624d\u80fd\u4f7f\u7528\u5bf9\u5e94\u7684\u6a21\u5f0f\n\n", "prefix": "ws2812.create"}, "ws2812.set": {"body": "ws2812.set(${1:leds},${2:index},${3:R},${4:G},${5:B})", "description": "ws2812.set(leds,index, R, G, B) - \u8bbe\u7f6e\u706f\u7684\u989c\u8272\n\u4f20\u5165\u503c\uff1a\nuserdata \u901a\u8fc7ws2812.create\u83b7\u53d6\u5230\u7684\u4e0a\u4e0b\u6587\nint \u706f\u7684\u7f16\u53f7,\u4ece0\u5f00\u59cb\nint RGB\u503c\u4e2d\u7684R\u503c\nint RGB\u503c\u4e2d\u7684G\u503c\nint RGB\u503c\u4e2d\u7684B\u503c\n\u8fd4\u56de\u503c\uff1a\nboolean \u8bbe\u7f6e\u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- RGB\u9010\u4e2a\u989c\u8272\u4f20\u9012\nws2812.set(leds, 5, 0xFF, 0xAA, 0x11)\n-- \u4e5f\u652f\u6301\u4e00\u4e2a\u53c2\u6570\u4f20\u5b8c, \u4e0e\u524d\u4e00\u6761\u7b49\u4ef7\nws2812.set(leds, 5, 0xFFAA11)\n", "prefix": "ws2812.set"}, "ws2812.send": {"body": "ws2812.send(${1:leds})", "description": "ws2812.send(leds) - \u53d1\u9001\u6570\u636e\u5230\u8bbe\u5907\n\u4f20\u5165\u503c\uff1a\nuserdata \u901a\u8fc7ws2812.create\u83b7\u53d6\u5230\u7684\u4e0a\u4e0b\u6587\n\u8fd4\u56de\u503c\uff1a\nboolean \u8bbe\u7f6e\u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u6ca1\u6709\u66f4\u591a\u53c2\u6570, \u53d1\u5c31\u5b8c\u4e8b\u4e86\nws2812.send(leds)\n", "prefix": "ws2812.send"}, "ws2812.args": {"body": "ws2812.args(${1:leds},${2:arg0},${3:arg1},${4:arg2},${5:arg3},${6:arg4})", "description": "ws2812.args(leds, arg0, arg1, arg2, arg3, arg4) - \u914d\u7f6e\u989d\u5916\u53c2\u6570\n\u4f20\u5165\u503c\uff1a\nuserdata \u901a\u8fc7ws2812.create\u83b7\u53d6\u5230\u7684\u4e0a\u4e0b\u6587\nint \u989d\u5916\u53c2\u65700\nint \u989d\u5916\u53c2\u65701\nint \u989d\u5916\u53c2\u65702\nint \u989d\u5916\u53c2\u65703\nint \u989d\u5916\u53c2\u65704\n\u8fd4\u56de\u503c\uff1a\nboolean \u8bbe\u7f6e\u6210\u529f\u8fd4\u56detrue,\u5426\u5219\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u672c\u51fd\u6570\u4e0e\u5177\u4f53\u6a21\u5f0f\u6709\u5173\n\n--GPIO\u6a21\u5f0f\u53ef\u8c03\u6574T0H T0L, T1H T1L \u7684\u5177\u4f53\u5ef6\u65f6\nws2812.send(leds, t0h, t0l, t1h, t1l)\n", "prefix": "ws2812.args"}, "xxtea.encrypt": {"body": "xxtea.encrypt(${1:data},${2:key})", "description": "xxtea.encrypt(data, key) - \u52a0\u5bc6\n\u4f20\u5165\u503c\uff1a\nstring data \u5f85\u52a0\u5bc6\u7684\u6570\u636e\nstring key \u52a0\u5bc6\u7528\u7684\u5bc6\u94a5\n\u8fd4\u56de\u503c\uff1a\nstring \u52a0\u5bc6\u540e\u7684\u6570\u636e, \u5931\u8d25\u8fd4\u56denil\n", "prefix": "xxtea.encrypt"}, "xxtea.decrypt": {"body": "xxtea.decrypt(${1:data},${2:key})", "description": "xxtea.decrypt(data, key) - \u89e3\u5bc6\n\u4f20\u5165\u503c\uff1a\nstring data \u5f85\u89e3\u5bc6\u7684\u6570\u636e\nstring key \u89e3\u5bc6\u7528\u7684\u5bc6\u94a5\n\u8fd4\u56de\u503c\uff1a\nstring \u89e3\u5bc6\u540e\u7684\u6570\u636e, \u5931\u8d25\u8fd4\u56denil\n", "prefix": "xxtea.decrypt"}, "ymodem.create": {"body": "ymodem.create(${1:dir_path},${2:file_path})", "description": "ymodem.create(dir_path,file_path) - \u521b\u5efa\u4e00\u4e2aymodem\u5904\u7406\u53e5\u67c4\n\u4f20\u5165\u503c\uff1a\nstring \u4fdd\u5b58\u7684\u6587\u4ef6\u5939\u8def\u5f84\uff0c\u9ed8\u8ba4\u662f\"/\"\nstring \u5f3a\u5236\u4fdd\u5b58\u7684\u7edd\u5bf9\u6587\u4ef6\u8def\u5f84\uff0c\u9ed8\u8ba4\u662f\u7a7a\uff0c\u5982\u679c\u8bbe\u7f6e\u4e86\uff0c\u5c31\u4f1a\u76f4\u63a5\u4fdd\u5b58\u5728\u8be5\u6587\u4ef6\u4e2d\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529ftrue, \u5931\u8d25false\n\u4f8b\u5b50\uff1a\nlocal handler = ymodem.create(\"/\")\n", "prefix": "ymodem.create"}, "ymodem.receive": {"body": "ymodem.receive(${1:handler},${2:data})", "description": "ymodem.receive(handler, data) - ymodem\u63a5\u6536\u6587\u4ef6\u6570\u636e\u5e76\u4fdd\u5b58\n\u4f20\u5165\u503c\uff1a\nuserdata ymodem\u5904\u7406\u53e5\u67c4\nzbuff/string \u8f93\u5165\u7684\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nboolean \u6210\u529ftrue\uff0c\u5931\u8d25false\nint ack\u503c\uff0c\u9700\u8981\u901a\u8fc7\u4e32\u53e3/\u7f51\u7edc\u7b49\u9014\u5f84\u8fd4\u56de\u53d1\u9001\u65b9\nint flag\u503c\uff0c\u9700\u8981\u901a\u8fc7\u4e32\u53e3/\u7f51\u7edc\u7b49\u9014\u5f84\u8fd4\u56de\u53d1\u9001\u65b9\uff0c\u5982\u679c\u6709ack\u503c\u5219\u4e0d\u53d1\u9001flag\nboolean, \u4e00\u4e2a\u6587\u4ef6\u63a5\u6536\u5b8c\u6210true\uff0c\u4f20\u8f93\u4e2dfalse\nboolean, \u6574\u4e2a\u4f20\u8f93\u5b8c\u6210true \u5426\u5219false\n\u4f8b\u5b50\uff1a\n-- \u6ce8\u610f, \u6570\u636e\u6765\u6e90\u4e0d\u9650, \u901a\u5e38\u662fuart.read\u5f97\u5230data\nno_error,ack,flag,file_done,all_done = ymodem.receive(handler, data)\n", "prefix": "ymodem.receive"}, "ymodem.reset": {"body": "ymodem.reset(${1:handler})", "description": "ymodem.reset(handler) - \u91cd\u7f6eymodem\u5904\u7406\u8fc7\u7a0b\n\u4f20\u5165\u503c\uff1a\nuserdata ymodem\u5904\u7406\u53e5\u67c4\n\u4f8b\u5b50\uff1a\n-- \u6062\u590d\u5230\u521d\u59cb\u72b6\u6001\uff0c\u4e00\u822c\u7528\u4e8e\u63a5\u6536\u51fa\u9519\u540e\u91cd\u7f6e\uff0c\u4ece\u800c\u8fdb\u884c\u4e0b\u4e00\u6b21\u63a5\u6536\nymodem.reset(handler)\n", "prefix": "ymodem.reset"}, "ymodem.release": {"body": "ymodem.release(${1:handler})", "description": "ymodem.release(handler) - \u91ca\u653eymodem\u5904\u7406\u53e5\u67c4\n\u4f20\u5165\u503c\uff1a\nuserdata handler\n\u4f8b\u5b50\uff1a\nymodem.release(handler)\n", "prefix": "ymodem.release"}, "zbuff.create": {"body": "zbuff.create(${1:length},${2:data},${3:type})", "description": "zbuff.create(length,data,type) - \u521b\u5efazbuff\n\u4f20\u5165\u503c\uff1a\nint \u5b57\u8282\u6570\nany \u53ef\u9009\u53c2\u6570\uff0cnumber\u65f6\u4e3a\u586b\u5145\u6570\u636e\uff0cstring\u65f6\u4e3a\u586b\u5145\u5b57\u7b26\u4e32\nnumber \u53ef\u9009\u53c2\u6570\uff0c\u5185\u5b58\u7c7b\u578b\uff0c\u53ef\u9009\uff1azbuff.HEAP_SRAM(\u5185\u90e8sram,\u9ed8\u8ba4) zbuff.HEAP_PSRAM(\u5916\u90e8psram) zbuff.HEAP_AUTO(\u81ea\u52a8\u7533\u8bf7,\u5982\u5b58\u5728psram\u5219\u5728psram\u8fdb\u884c\u7533\u8bf7,\u5982\u4e0d\u5b58\u5728\u6216\u5931\u8d25\u5219\u5728sram\u8fdb\u884c\u7533\u8bf7) \u6ce8\u610f:\u6b64\u9879\u4e0e\u786c\u4ef6\u652f\u6301\u6709\u5173\n\u8fd4\u56de\u503c\uff1a\nobject zbuff\u5bf9\u8c61\uff0c\u5982\u679c\u521b\u5efa\u5931\u8d25\u4f1a\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\n-- \u521b\u5efazbuff\nlocal buff = zbuff.create(1024) -- \u7a7a\u767d\u7684\nlocal buff = zbuff.create(1024, 0x33) --\u521b\u5efa\u4e00\u4e2a\u521d\u503c\u5168\u4e3a0x33\u7684\u5185\u5b58\u533a\u57df\nlocal buff = zbuff.create(1024, \"123321456654\") -- \u521b\u5efa\uff0c\u5e76\u586b\u5145\u4e00\u4e2a\u5df2\u6709\u5b57\u7b26\u4e32\u7684\u5185\u5bb9\n\n-- \u521b\u5efaframebuff\u7528\u7684zbuff\n-- zbuff.create({width,height,bit},data,type)\n-- table \u5bbd\u5ea6\u3001\u9ad8\u5ea6\u3001\u8272\u4f4d\u6df1\u5ea6\n@int \u53ef\u9009\u53c2\u6570\uff0c\u586b\u5145\u6570\u636e\n@number \u53ef\u9009\u53c2\u6570\uff0c\u5185\u5b58\u7c7b\u578b\uff0c\u53ef\u9009\uff1azbuff.HEAP_SRAM(\u5185\u90e8sram,\u9ed8\u8ba4) zbuff.HEAP_PSRAM(\u5916\u90e8psram) zbuff.HEAP_AUTO(\u81ea\u52a8\u7533\u8bf7,\u5982\u5b58\u5728psram\u5219\u5728psram\u8fdb\u884c\u7533\u8bf7,\u5982\u4e0d\u5b58\u5728\u6216\u5931\u8d25\u5219\u5728sram\u8fdb\u884c\u7533\u8bf7) \u6ce8\u610f:\u6b64\u9879\u4e0e\u786c\u4ef6\u652f\u6301\u6709\u5173\n@return object zbuff\u5bf9\u8c61\uff0c\u5982\u679c\u521b\u5efa\u5931\u8d25\u4f1a\u8fd4\u56denil\n@usage\n-- \u521b\u5efazbuff\nlocal buff = zbuff.create({128,160,16})--\u521b\u5efa\u4e00\u4e2a128*160\u7684framebuff\nlocal buff = zbuff.create({128,160,16},0xf800)--\u521b\u5efa\u4e00\u4e2a128*160\u7684framebuff\uff0c\u521d\u59cb\u72b6\u6001\u7ea2\u8272\n", "prefix": "zbuff.create"}, "buff:write": {"body": "buff:write(${1:para},${2:...})", "description": "buff:write(para,...) - zbuff\u5199\u6570\u636e\uff08\u4ece\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u5f00\u59cb\uff1b\u6267\u884c\u540e\u6307\u9488\u4f1a\u5411\u540e\u79fb\u52a8\uff09\n\u4f20\u5165\u503c\uff1a\nany \u5199\u5165buff\u7684\u6570\u636e\uff0cstring\u65f6\u4e3a\u4e00\u4e2a\u53c2\u6570\uff0cnumber\u65f6\u53ef\u4e3a\u591a\u4e2a\u53c2\u6570\n\u8fd4\u56de\u503c\uff1a\nnumber \u6570\u636e\u6210\u529f\u5199\u5165\u7684\u957f\u5ea6\n\u4f8b\u5b50\uff1a\n-- \u7c7bfile\u7684\u8bfb\u5199\u64cd\u4f5c\nlocal len = buff:write(\"123\") -- \u5199\u5165\u6570\u636e, \u6307\u9488\u76f8\u5e94\u5730\u5f80\u540e\u79fb\u52a8\uff0c\u8fd4\u56de\u5199\u5165\u7684\u6570\u636e\u957f\u5ea6\nlocal len = buff:write(0x1a,0x30,0x31,0x32,0x00,0x01) -- \u6309\u6570\u503c\u5199\u5165\u591a\u4e2a\u5b57\u8282\u6570\u636e\n", "prefix": "buff:write"}, "buff:read": {"body": "buff:read(${1:length})", "description": "buff:read(length) - zbuff\u8bfb\u6570\u636e\uff08\u4ece\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u5f00\u59cb\uff1b\u6267\u884c\u540e\u6307\u9488\u4f1a\u5411\u540e\u79fb\u52a8\uff09\n\u4f20\u5165\u503c\uff1a\nint \u8bfb\u53d6buff\u4e2d\u7684\u5b57\u8282\u6570\n\u8fd4\u56de\u503c\uff1a\nstring \u8bfb\u53d6\u7ed3\u679c\n\u4f8b\u5b50\uff1a\n-- \u7c7bfile\u7684\u8bfb\u5199\u64cd\u4f5c\nlocal str = buff:read(3)\n", "prefix": "buff:read"}, "buff:clear": {"body": "buff:clear(${1:num})", "description": "buff:clear(num) - zbuff\u6e05\u7a7a\u6570\u636e\uff08\u4e0e\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u65e0\u5173\uff1b\u6267\u884c\u540e\u6307\u9488\u4f4d\u7f6e\u4e0d\u53d8\uff09\n\u4f20\u5165\u503c\uff1a\nint \u53ef\u9009\uff0c\u9ed8\u8ba4\u4e3a0\u3002\u8981\u8bbe\u7f6e\u4e3a\u7684\u503c\uff0c\u4e0d\u4f1a\u6539\u53d8buff\u6307\u9488\u4f4d\u7f6e\n\u4f8b\u5b50\uff1a\n-- \u5168\u90e8\u521d\u59cb\u5316\u4e3a0\nbuff:clear(0)\n", "prefix": "buff:clear"}, "buff:seek": {"body": "buff:seek(${1:base},${2:offset})", "description": "buff:seek(base,offset) - zbuff\u8bbe\u7f6e\u5149\u6807\u4f4d\u7f6e\uff08\u53ef\u80fd\u4e0e\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u6709\u5173\uff1b\u6267\u884c\u540e\u6307\u9488\u4f1a\u88ab\u8bbe\u7f6e\u5230\u6307\u5b9a\u4f4d\u7f6e\uff09\n\u4f20\u5165\u503c\uff1a\nint \u504f\u79fb\u957f\u5ea6\nint where, \u57fa\u70b9\uff0c\u9ed8\u8ba4zbuff.SEEK_SET\u3002zbuff.SEEK_SET: \u57fa\u70b9\u4e3a 0 \uff08\u6587\u4ef6\u5f00\u5934\uff09\uff0czbuff.SEEK_CUR: \u57fa\u70b9\u4e3a\u5f53\u524d\u4f4d\u7f6e\uff0czbuff.SEEK_END: \u57fa\u70b9\u4e3a\u6587\u4ef6\u5c3e\n\u8fd4\u56de\u503c\uff1a\nint \u8bbe\u7f6e\u5149\u6807\u540e\u4ecebuff\u5f00\u5934\u8ba1\u7b97\u8d77\u7684\u5149\u6807\u7684\u4f4d\u7f6e\n\u4f8b\u5b50\uff1a\nbuff:seek(0) -- \u628a\u5149\u6807\u8bbe\u7f6e\u5230\u6307\u5b9a\u4f4d\u7f6e\nbuff:seek(5,zbuff.SEEK_CUR)\nbuff:seek(-3,zbuff.SEEK_END)\n", "prefix": "buff:seek"}, "buff:pack": {"body": "buff:pack(${1:format},${2:val1},${3:val2},${4:...})", "description": "buff:pack(format,val1, val2,...) - \u5c06\u4e00\u7cfb\u5217\u6570\u636e\u6309\u7167\u683c\u5f0f\u5b57\u7b26\u8f6c\u5316\uff0c\u5e76\u5199\u5165\uff08\u4ece\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u5f00\u59cb\uff1b\u6267\u884c\u540e\u6307\u9488\u4f1a\u5411\u540e\u79fb\u52a8\uff09\n\u4f20\u5165\u503c\uff1a\nstring \u540e\u9762\u6570\u636e\u7684\u683c\u5f0f\uff08\u7b26\u53f7\u542b\u4e49\u89c1\u4e0b\u9762\u7684\u4f8b\u5b50\uff09\nval \u4f20\u5165\u7684\u6570\u636e\uff0c\u53ef\u4ee5\u4e3a\u591a\u4e2a\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u5199\u5165\u7684\u6570\u636e\u957f\u5ea6\n\u4f8b\u5b50\uff1a\nbuff:pack(\">IIHA\", 0x1234, 0x4567, 0x12,\"abcdefg\") -- \u6309\u683c\u5f0f\u5199\u5165\u51e0\u4e2a\u6570\u636e\n-- A string\n-- f float\n-- d double\n-- n Lua number\n-- c char\n-- b byte / unsignen char\n-- h short\n-- H unsigned short\n-- i int\n-- I unsigned int\n-- l long\n-- L unsigned long\n-- < \u5c0f\u7aef\n-- > \u5927\u7aef\n-- = \u9ed8\u8ba4\u5927\u5c0f\u7aef\n", "prefix": "buff:pack"}, "buff:unpack": {"body": "buff:unpack(${1:format})", "description": "buff:unpack(format) - \u5c06\u4e00\u7cfb\u5217\u6570\u636e\u6309\u7167\u683c\u5f0f\u5b57\u7b26\u8bfb\u53d6\u51fa\u6765\uff08\u4ece\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u5f00\u59cb\uff1b\u6267\u884c\u540e\u6307\u9488\u4f1a\u5411\u540e\u79fb\u52a8\uff09\n\u4f20\u5165\u503c\uff1a\nstring \u6570\u636e\u7684\u683c\u5f0f\uff08\u7b26\u53f7\u542b\u4e49\u89c1\u4e0a\u9762pack\u63a5\u53e3\u7684\u4f8b\u5b50\uff09\n\u8fd4\u56de\u503c\uff1a\nint \u6210\u529f\u8bfb\u53d6\u7684\u6570\u636e\u5b57\u8282\u957f\u5ea6\nany \u6309\u683c\u5f0f\u8bfb\u51fa\u6765\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\nlocal cnt,a,b,c,s = buff:unpack(\">IIHA10\") -- \u6309\u683c\u5f0f\u8bfb\u53d6\u51e0\u4e2a\u6570\u636e\n--\u5982\u679c\u5168\u90e8\u6210\u529f\u8bfb\u53d6\uff0ccnt\u5c31\u662f4+4+2+10=20\n", "prefix": "buff:unpack"}, "buff:read\u7c7b\u578b": {"body": "buff:read\u7c7b\u578b()", "description": "buff:read\u7c7b\u578b() - \u8bfb\u53d6\u4e00\u4e2a\u6307\u5b9a\u7c7b\u578b\u7684\u6570\u636e\uff08\u4ece\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u5f00\u59cb\uff1b\u6267\u884c\u540e\u6307\u9488\u4f1a\u5411\u540e\u79fb\u52a8\uff09\n\u4f20\u5165\u503c\uff1a\n\u6ce8\u91ca \u8bfb\u53d6\u7c7b\u578b\u53ef\u4e3a\uff1aI8\u3001U8\u3001I16\u3001U16\u3001I32\u3001U32\u3001I64\u3001U64\u3001F32\u3001F64\n\u8fd4\u56de\u503c\uff1a\nnumber \u8bfb\u53d6\u7684\u6570\u636e\uff0c\u5982\u679c\u8d8a\u754c\u5219\u4e3anil\n\u4f8b\u5b50\uff1a\nlocal data = buff:readI8()\nlocal data = buff:readU32()\n", "prefix": "buff:read\u7c7b\u578b"}, "buff:write\u7c7b\u578b": {"body": "buff:write\u7c7b\u578b()", "description": "buff:write\u7c7b\u578b() - \u5199\u5165\u4e00\u4e2a\u6307\u5b9a\u7c7b\u578b\u7684\u6570\u636e\uff08\u4ece\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u5f00\u59cb\uff1b\u6267\u884c\u540e\u6307\u9488\u4f1a\u5411\u540e\u79fb\u52a8\uff09\n\u4f20\u5165\u503c\uff1a\nnumber \u5f85\u5199\u5165\u7684\u6570\u636e\n\u6ce8\u91ca \u5199\u5165\u7c7b\u578b\u53ef\u4e3a\uff1aI8\u3001U8\u3001I16\u3001U16\u3001I32\u3001U32\u3001I64\u3001U64\u3001F32\u3001F64\n\u8fd4\u56de\u503c\uff1a\nnumber \u6210\u529f\u5199\u5165\u7684\u957f\u5ea6\n\u4f8b\u5b50\uff1a\nlocal len = buff:writeI8(10)\nlocal len = buff:writeU32(1024)\n", "prefix": "buff:write\u7c7b\u578b"}, "buff:toStr": {"body": "buff:toStr(${1:offset},${2:length})", "description": "buff:toStr(offset,length) - \u6309\u8d77\u59cb\u4f4d\u7f6e\u548c\u957f\u5ea6\u53d6\u51fa\u6570\u636e\uff08\u4e0e\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u65e0\u5173\uff1b\u6267\u884c\u540e\u6307\u9488\u4f4d\u7f6e\u4e0d\u53d8\uff09\n\u4f20\u5165\u503c\uff1a\nint \u6570\u636e\u7684\u8d77\u59cb\u4f4d\u7f6e\uff08\u8d77\u59cb\u4f4d\u7f6e\u4e3a0\uff09,\u9ed8\u8ba4\u503c\u4e5f\u662f0\nint \u6570\u636e\u7684\u957f\u5ea6,\u9ed8\u8ba4\u662f\u5168\u90e8\u6570\u636e\n\u8fd4\u56de\u503c\uff1a\nstring \u8bfb\u51fa\u6765\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\nlocal s = buff:toStr(0,5)--\u8bfb\u53d6\u5f00\u5934\u7684\u4e94\u4e2a\u5b57\u8282\u6570\u636e\nlocal s = buff:toStr() -- \u53d6\u51fa\u6574\u4e2azbuff\u7684\u6570\u636e\nlocal s = buff:toStr(0, buff:used()) -- \u53d6\u51fa\u5df2\u4f7f\u7528\u7684\u90e8\u5206, \u4e0ebuff:query()\u4e00\u6837\n", "prefix": "buff:toStr"}, "buff:len": {"body": "buff:len()", "description": "buff:len() - \u83b7\u53d6zbuff\u5bf9\u8c61\u7684\u957f\u5ea6\uff08\u4e0e\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u65e0\u5173\uff1b\u6267\u884c\u540e\u6307\u9488\u4f4d\u7f6e\u4e0d\u53d8\uff09\n\u8fd4\u56de\u503c\uff1a\nint zbuff\u5bf9\u8c61\u7684\u957f\u5ea6\n\u4f8b\u5b50\uff1a\nlen = buff:len()\nlen = #buff\n", "prefix": "buff:len"}, "buff:setFrameBuffer": {"body": "buff:setFrameBuffer(${1:width},${2:height},${3:bit},${4:color})", "description": "buff:setFrameBuffer(width,height,bit,color) - \u8bbe\u7f6ebuff\u5bf9\u8c61\u7684FrameBuffer\u5c5e\u6027\uff08\u4e0e\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u65e0\u5173\uff1b\u6267\u884c\u540e\u6307\u9488\u4f4d\u7f6e\u4e0d\u53d8\uff09\n\u4f20\u5165\u503c\uff1a\nint FrameBuffer\u7684\u5bbd\u5ea6\nint FrameBuffer\u7684\u9ad8\u5ea6\nint FrameBuffer\u7684\u8272\u4f4d\u6df1\u5ea6\nint FrameBuffer\u7684\u521d\u59cb\u989c\u8272\n\u8fd4\u56de\u503c\uff1a\nbool \u8bbe\u7f6e\u6210\u529f\u4f1a\u8fd4\u56detrue\n\u4f8b\u5b50\uff1a\nresult = buff:setFrameBuffer(320,240,16,0xffff)\n", "prefix": "buff:setFrameBuffer"}, "buff:pixel": {"body": "buff:pixel(${1:x},${2:y},${3:color})", "description": "buff:pixel(x,y,color) - \u8bbe\u7f6e\u6216\u83b7\u53d6FrameBuffer\u67d0\u4e2a\u50cf\u7d20\u70b9\u7684\u989c\u8272\uff08\u4e0e\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u65e0\u5173\uff1b\u6267\u884c\u540e\u6307\u9488\u4f4d\u7f6e\u4e0d\u53d8\uff09\n\u4f20\u5165\u503c\uff1a\nint \u4e0e\u6700\u5de6\u8fb9\u7684\u8ddd\u79bb\uff0c\u8303\u56f4\u662f0~\u5bbd\u5ea6-1\nint \u4e0e\u6700\u4e0a\u8fb9\u7684\u8ddd\u79bb\uff0c\u8303\u56f4\u662f0~\u9ad8\u5ea6-1\nint \u989c\u8272\uff0c\u5982\u679c\u7559\u7a7a\u5219\u8868\u793a\u83b7\u53d6\u8be5\u4f4d\u7f6e\u7684\u989c\u8272\n\u8fd4\u56de\u503c\uff1a\nany \u8bbe\u7f6e\u989c\u8272\u65f6\uff0c\u8bbe\u7f6e\u6210\u529f\u4f1a\u8fd4\u56detrue\uff1b\u8bfb\u53d6\u989c\u8272\u65f6\uff0c\u8fd4\u56de\u989c\u8272\u7684\u503c\uff0c\u8bfb\u53d6\u5931\u8d25\u8fd4\u56denil\n\u4f8b\u5b50\uff1a\nrerult = buff:pixel(0,3,0)\ncolor = buff:pixel(0,3)\n", "prefix": "buff:pixel"}, "buff:drawLine": {"body": "buff:drawLine(${1:x1},${2:y1},${3:x2},${4:y2},${5:color})", "description": "buff:drawLine(x1,y1,x2,y2,color) - \u753b\u4e00\u6761\u7ebf\uff08\u4e0e\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u65e0\u5173\uff1b\u6267\u884c\u540e\u6307\u9488\u4f4d\u7f6e\u4e0d\u53d8\uff09\n\u4f20\u5165\u503c\uff1a\nint \u8d77\u59cb\u5750\u6807\u70b9\u4e0e\u6700\u5de6\u8fb9\u7684\u8ddd\u79bb\uff0c\u8303\u56f4\u662f0~\u5bbd\u5ea6-1\nint \u8d77\u59cb\u5750\u6807\u70b9\u4e0e\u6700\u4e0a\u8fb9\u7684\u8ddd\u79bb\uff0c\u8303\u56f4\u662f0~\u9ad8\u5ea6-1\nint \u7ed3\u675f\u5750\u6807\u70b9\u4e0e\u6700\u5de6\u8fb9\u7684\u8ddd\u79bb\uff0c\u8303\u56f4\u662f0~\u5bbd\u5ea6-1\nint \u7ed3\u675f\u5750\u6807\u70b9\u4e0e\u6700\u4e0a\u8fb9\u7684\u8ddd\u79bb\uff0c\u8303\u56f4\u662f0~\u9ad8\u5ea6-1\nint \u53ef\u9009\uff0c\u989c\u8272\uff0c\u9ed8\u8ba4\u4e3a0\n\u8fd4\u56de\u503c\uff1a\nbool \u753b\u6210\u529f\u4f1a\u8fd4\u56detrue\n\u4f8b\u5b50\uff1a\nrerult = buff:drawLine(0,0,2,3,0xffff)\n", "prefix": "buff:drawLine"}, "buff:drawRect": {"body": "buff:drawRect(${1:x1},${2:y1},${3:x2},${4:y2},${5:color},${6:fill})", "description": "buff:drawRect(x1,y1,x2,y2,color,fill) - \u753b\u4e00\u4e2a\u77e9\u5f62\uff08\u4e0e\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u65e0\u5173\uff1b\u6267\u884c\u540e\u6307\u9488\u4f4d\u7f6e\u4e0d\u53d8\uff09\n\u4f20\u5165\u503c\uff1a\nint \u8d77\u59cb\u5750\u6807\u70b9\u4e0e\u6700\u5de6\u8fb9\u7684\u8ddd\u79bb\uff0c\u8303\u56f4\u662f0~\u5bbd\u5ea6-1\nint \u8d77\u59cb\u5750\u6807\u70b9\u4e0e\u6700\u4e0a\u8fb9\u7684\u8ddd\u79bb\uff0c\u8303\u56f4\u662f0~\u9ad8\u5ea6-1\nint \u7ed3\u675f\u5750\u6807\u70b9\u4e0e\u6700\u5de6\u8fb9\u7684\u8ddd\u79bb\uff0c\u8303\u56f4\u662f0~\u5bbd\u5ea6-1\nint \u7ed3\u675f\u5750\u6807\u70b9\u4e0e\u6700\u4e0a\u8fb9\u7684\u8ddd\u79bb\uff0c\u8303\u56f4\u662f0~\u9ad8\u5ea6-1\nint \u53ef\u9009\uff0c\u989c\u8272\uff0c\u9ed8\u8ba4\u4e3a0\nbool \u53ef\u9009\uff0c\u662f\u5426\u5728\u5185\u90e8\u586b\u5145\uff0c\u9ed8\u8ba4nil\n\u8fd4\u56de\u503c\uff1a\nbool \u753b\u6210\u529f\u4f1a\u8fd4\u56detrue\n\u4f8b\u5b50\uff1a\nrerult = buff:drawRect(0,0,2,3,0xffff)\n", "prefix": "buff:drawRect"}, "buff:drawCircle": {"body": "buff:drawCircle(${1:x},${2:y},${3:r},${4:color},${5:fill})", "description": "buff:drawCircle(x,y,r,color,fill) - \u753b\u4e00\u4e2a\u5706\u5f62\uff08\u4e0e\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u65e0\u5173\uff1b\u6267\u884c\u540e\u6307\u9488\u4f4d\u7f6e\u4e0d\u53d8\uff09\n\u4f20\u5165\u503c\uff1a\nint **\u5706\u5fc3**\u4e0e\u6700\u5de6\u8fb9\u7684\u8ddd\u79bb\uff0c\u8303\u56f4\u662f0~\u5bbd\u5ea6-1\nint **\u5706\u5fc3**\u4e0e\u6700\u4e0a\u8fb9\u7684\u8ddd\u79bb\uff0c\u8303\u56f4\u662f0~\u9ad8\u5ea6-1\nint \u5706\u7684\u534a\u5f84\nint \u53ef\u9009\uff0c\u5706\u7684\u989c\u8272\uff0c\u9ed8\u8ba4\u4e3a0\nbool \u53ef\u9009\uff0c\u662f\u5426\u5728\u5185\u90e8\u586b\u5145\uff0c\u9ed8\u8ba4nil\n\u8fd4\u56de\u503c\uff1a\nbool \u753b\u6210\u529f\u4f1a\u8fd4\u56detrue\n\u4f8b\u5b50\uff1a\nrerult = buff:drawCircle(15,5,3,0xC)\nrerult = buff:drawCircle(15,5,3,0xC,true)\n", "prefix": "buff:drawCircle"}, "buff[n": {"body": "buff[n]", "description": "buff[n] - \u4ee5\u4e0b\u6807\u5f62\u5f0f\u8fdb\u884c\u6570\u636e\u8bfb\u5199\uff08\u4e0e\u5f53\u524d\u6307\u9488\u4f4d\u7f6e\u65e0\u5173\uff1b\u6267\u884c\u540e\u6307\u9488\u4f4d\u7f6e\u4e0d\u53d8\uff09\n\u4f20\u5165\u503c\uff1a\nint \u7b2c\u51e0\u4e2a\u6570\u636e\uff0c\u4ee50\u5f00\u59cb\u7684\u4e0b\u6807\uff08C\u6807\u51c6\uff09\n\u8fd4\u56de\u503c\uff1a\nnumber \u8be5\u4f4d\u7f6e\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\nbuff[0] = 0xc8\nlocal data = buff[0]\n", "prefix": "buff[n"}, "buff:free": {"body": "buff:free()", "description": "buff:free() - \u91ca\u653ezbuff\u6240\u7533\u8bf7\u5185\u5b58 \u6ce8\u610f\uff1agc\u65f6\u4f1a\u81ea\u52a8\u91ca\u653ezbuff\u4ee5\u53cazbuff\u6240\u7533\u8bf7\u5185\u5b58\uff0c\u6240\u4ee5\u901a\u5e38\u65e0\u9700\u8c03\u7528\u6b64\u51fd\u6570\uff0c\u8c03\u7528\u524d\u8bf7\u786e\u8ba4\u60a8\u5df2\u6e05\u695a\u6b64\u51fd\u6570\u7528\u5904\uff01\u8c03\u7528\u6b64\u51fd\u6570\u5e76\u4e0d\u4f1a\u91ca\u653e\u6389zbuff\uff0c\u4ec5\u4f1a\u91ca\u653e\u6389zbuff\u6240\u7533\u8bf7\u7684\u5185\u5b58\uff0czbuff\u9700\u7b49gc\u65f6\u81ea\u52a8\u91ca\u653e\uff01\uff01\uff01\n\u4f8b\u5b50\uff1a\nbuff:free()\n", "prefix": "buff:free"}, "buff:resize": {"body": "buff:resize(${1:n})", "description": "buff:resize(n) - \u8c03\u6574zbuff\u5b9e\u9645\u5206\u914d\u7a7a\u95f4\u7684\u5927\u5c0f\uff0c\u7c7b\u4f3c\u4e8erealloc\u7684\u6548\u679c\uff0cnew = realloc(old, n)\uff0c\u53ef\u4ee5\u6269\u5927\u6216\u8005\u7f29\u5c0f\uff08\u5982\u679c\u7f29\u5c0f\u540elen\u5c0f\u4e8e\u4e86used\uff0c\u90a3\u4e48used=\u65b0len\uff09\n\u4f20\u5165\u503c\uff1a\nint \u65b0\u7a7a\u95f4\u5927\u5c0f\n\u4f8b\u5b50\uff1a\nbuff:resize(20)\n", "prefix": "buff:resize"}, "buff:copy": {"body": "buff:copy(${1:start},${2:para},${3:...})", "description": "buff:copy(start, para,...) - zbuff\u52a8\u6001\u5199\u6570\u636e\uff0c\u7c7b\u4f3c\u4e8ememcpy\u6548\u679c\uff0c\u5f53\u539f\u6709\u7a7a\u95f4\u4e0d\u8db3\u65f6\u52a8\u6001\u6269\u5927\u7a7a\u95f4\n\u4f20\u5165\u503c\uff1a\nint \u5199\u5165buff\u7684\u8d77\u59cb\u4f4d\u7f6e\uff0c\u5982\u679c\u4e0d\u4e3a\u6570\u5b57\uff0c\u5219\u4e3abuff\u7684used\uff0c\u5982\u679c\u5c0f\u4e8e0\uff0c\u5219\u4eceused\u5f80\u524d\u6570\uff0c-1 = used - 1\nany \u5199\u5165buff\u7684\u6570\u636e\uff0cstring\u6216zbuff\u8005\u65f6\u4e3a\u4e00\u4e2a\u53c2\u6570\uff0cnumber\u65f6\u53ef\u4e3a\u591a\u4e2a\u53c2\u6570\n\u8fd4\u56de\u503c\uff1a\nnumber \u6570\u636e\u6210\u529f\u5199\u5165\u7684\u957f\u5ea6\n\u4f8b\u5b50\uff1a\nlocal len = buff:copy(nil, \"123\") -- \u7c7b\u4f3c\u4e8ememcpy(&buff[used], \"123\", 3) used+= 3 \u4ecebuff\u5f00\u59cb\u5199\u5165\u6570\u636e,\u6307\u9488\u76f8\u5e94\u5730\u5f80\u540e\u79fb\u52a8\nlocal len = buff:copy(0, \"123\") -- \u7c7b\u4f3c\u4e8ememcpy(&buff[0], \"123\", 3) if (used < 3) used = 3 \u4ece\u4f4d\u7f6e0\u5199\u5165\u6570\u636e,\u6307\u9488\u6709\u53ef\u80fd\u4f1a\u79fb\u52a8\nlocal len = buff:copy(2, 0x1a,0x30,0x31,0x32,0x00,0x01) -- \u7c7b\u4f3c\u4e8ememcpy(&buff[2], [0x1a,0x30,0x31,0x32,0x00,0x01], 6) if (used < (2+6)) used = (2+6)\u4ece\u4f4d\u7f6e2\u5f00\u59cb\uff0c\u6309\u6570\u503c\u5199\u5165\u591a\u4e2a\u5b57\u8282\u6570\u636e\nlocal len = buff:copy(9, buff2) -- \u7c7b\u4f3c\u4e8ememcpy(&buff[9], &buff2[0], buff2\u7684used) if (used < (9+buff2\u7684used)) used = (9+buff2\u7684used) \u4ece\u4f4d\u7f6e9\u5f00\u59cb\uff0c\u5408\u5e76\u5165buff2\u91cc0~used\u7684\u5185\u5bb9\nlocal len = buff:copy(5, buff2, 10, 1024) -- \u7c7b\u4f3c\u4e8ememcpy(&buff[5], &buff2[10], 1024) if (used < (5+1024)) used = (5+1024)\n", "prefix": "buff:copy"}, "buff:used": {"body": "buff:used()", "description": "buff:used() - \u83b7\u53d6zbuff\u91cc\u6700\u540e\u4e00\u4e2a\u6570\u636e\u4f4d\u7f6e\u6307\u9488\u5230\u9996\u5730\u5740\u7684\u504f\u79fb\u91cf\uff0c\u6765\u8868\u793azbuff\u5185\u5df2\u6709\u6709\u6548\u6570\u636e\u91cf\u5927\u5c0f\uff0c\u6ce8\u610f\u8fd9\u4e2a\u4e0d\u540c\u4e8e\u5206\u914d\u7684\u7a7a\u95f4\u5927\u5c0f\uff0c\u7531\u4e8eseek()\u4f1a\u6539\u53d8\u6700\u540e\u4e00\u4e2a\u6570\u636e\u4f4d\u7f6e\u6307\u9488\uff0c\u56e0\u6b64\u4e5f\u4f1a\u5f71\u54cd\u5230used()\u8fd4\u56de\u503c\u3002\n\u8fd4\u56de\u503c\uff1a\nint \u6709\u6548\u6570\u636e\u91cf\u5927\u5c0f\n\u4f8b\u5b50\uff1a\nbuff:used()\n", "prefix": "buff:used"}, "buff:del": {"body": "buff:del(${1:offset},${2:length})", "description": "buff:del(offset,length) - \u5220\u9664zbuff 0~used\u8303\u56f4\u5185\u7684\u4e00\u6bb5\u6570\u636e\uff0c\u6ce8\u610f\u53ea\u662f\u6539\u53d8\u4e86used\u7684\u503c\uff0c\u5e76\u4e0d\u662f\u771f\u7684\u5728ram\u91cc\u53bb\u6e05\u9664\u6389\u6570\u636e\n\u4f20\u5165\u503c\uff1a\nint \u8d77\u59cb\u4f4d\u7f6estart, \u9ed8\u8ba40\uff0c\u5982\u679c<0\u5219\u4eceused\u5f80\u524d\u6570\uff0c\u6bd4\u5982 -1 \u90a3\u4e48start= used - 1\nint \u957f\u5ea6del_len\uff0c\u9ed8\u8ba4\u4e3aused\uff0c\u5982\u679cstart + del_len\u6570\u503c\u5927\u4e8eused\uff0c\u4f1a\u5f3a\u5236\u8c03\u6574del_len = used - start\n\u4f8b\u5b50\uff1a\nbuff:del(1,4) --\u4ece\u4f4d\u7f6e1\u5f00\u59cb\u5220\u96644\u4e2a\u5b57\u8282\u6570\u636e\nbuff:del(-1,4) --\u4ece\u4f4d\u7f6eused-1\u5f00\u59cb\u5220\u96644\u4e2a\u5b57\u8282\u6570\u636e\uff0c\u4f46\u662f\u8fd9\u80af\u5b9a\u4f1a\u8d85\u8fc7used\uff0c\u6240\u4ee5del_len\u4f1a\u8c03\u6574\u4e3a1\uff0c\u5b9e\u9645\u4e0a\u5c31\u662f\u5220\u6389\u4e86\u6700\u540e\u4e00\u4e2a\u5b57\u8282\n", "prefix": "buff:del"}, "buff:query": {"body": "buff:query(${1:offset},${2:length},${3:isbigend},${4:issigned},${5:isfloat})", "description": "buff:query(offset,length,isbigend,issigned,isfloat) - \u6309\u8d77\u59cb\u4f4d\u7f6e\u548c\u957f\u5ea60~used\u8303\u56f4\u5185\u53d6\u51fa\u6570\u636e\uff0c\u5982\u679c\u662f1,2,4,8\u5b57\u8282\uff0c\u6839\u636e\u540e\u7eed\u53c2\u6570\u8f6c\u6362\u6210\u6d6e\u70b9\u6216\u8005\u6574\u5f62\n\u4f20\u5165\u503c\uff1a\nint \u6570\u636e\u7684\u8d77\u59cb\u4f4d\u7f6e\uff08\u8d77\u59cb\u4f4d\u7f6e\u4e3a0\uff09\nint \u6570\u636e\u7684\u957f\u5ea6\nboolean \u662f\u5426\u662f\u5927\u7aef\u683c\u5f0f\uff0c\u5982\u679c\u4e3anil\uff0c\u5219\u4e0d\u4f1a\u8f6c\u6362\uff0c\u76f4\u63a5\u5b57\u8282\u6d41\u8f93\u51fa\nboolean \u662f\u5426\u662f\u6709\u7b26\u53f7\u7684\uff0c\u9ed8\u8ba4\u4e3afalse\nboolean \u662f\u5426\u662f\u6d6e\u70b9\u578b\uff0c\u9ed8\u8ba4\u4e3afalse\n\u8fd4\u56de\u503c\uff1a\nstring \u8bfb\u51fa\u6765\u7684\u6570\u636e\n\u4f8b\u5b50\uff1a\nlocal s = buff:query(0,5)--\u8bfb\u53d6\u5f00\u5934\u7684\u4e94\u4e2a\u5b57\u8282\u6570\u636e\n", "prefix": "buff:query"}, "buff:set": {"body": "buff:set(${1:start},${2:num},${3:len})", "description": "buff:set(start, num, len) - zbuff\u7684\u7c7b\u4f3c\u4e8ememset\u64cd\u4f5c\uff0c\u7c7b\u4f3c\u4e8ememset(&buff[start], num, len)\uff0c\u5f53\u7136\u6709ram\u8d8a\u754c\u4fdd\u62a4\uff0c\u4f1a\u5bf9len\u6709\u4e00\u5b9a\u7684\u9650\u5236\n\u4f20\u5165\u503c\uff1a\nint \u53ef\u9009\uff0c\u5f00\u59cb\u4f4d\u7f6e\uff0c\u9ed8\u8ba4\u4e3a0,\nint \u53ef\u9009\uff0c\u9ed8\u8ba4\u4e3a0\u3002\u8981\u8bbe\u7f6e\u4e3a\u7684\u503c\nint \u53ef\u9009\uff0c\u957f\u5ea6\uff0c\u9ed8\u8ba4\u4e3a\u5168\u90e8\u7a7a\u95f4\uff0c\u5982\u679c\u8d85\u51fa\u8303\u56f4\u4e86\uff0c\u4f1a\u81ea\u52a8\u622a\u65ad\n\u4f8b\u5b50\uff1a\n-- \u5168\u90e8\u521d\u59cb\u5316\u4e3a0\nbuff:set() --\u7b49\u540c\u4e8e memset(buff, 0, sizeof(buff))\nbuff:set(8) --\u7b49\u540c\u4e8e memset(&buff[8], 0, sizeof(buff) - 8)\nbuff:set(0, 0x55) --\u7b49\u540c\u4e8e memset(buff, 0x55, sizeof(buff))\nbuff:set(4, 0xaa, 12) --\u7b49\u7528\u4e8e memset(&buff[4], 0xaa, 12)\n", "prefix": "buff:set"}, "buff:isEqual": {"body": "buff:isEqual(${1:start},${2:buff2},${3:start2},${4:len})", "description": "buff:isEqual(start, buff2, start2, len) - zbuff\u7684\u7c7b\u4f3c\u4e8ememcmp\u64cd\u4f5c\uff0c\u7c7b\u4f3c\u4e8ememcmp(&buff[start], &buff2[start2], len)\n\u4f20\u5165\u503c\uff1a\nint \u53ef\u9009\uff0c\u5f00\u59cb\u4f4d\u7f6e\uff0c\u9ed8\u8ba4\u4e3a0,\nzbuff \u6bd4\u8f83\u7684\u5bf9\u8c61\nint \u53ef\u9009\uff0c\u6bd4\u8f83\u7684\u5bf9\u8c61\u7684\u5f00\u59cb\u4f4d\u7f6e\uff0c\u9ed8\u8ba4\u4e3a0\nint \u6bd4\u8f83\u957f\u5ea6\n\u8fd4\u56de\u503c\uff1a\nboolean true\u76f8\u7b49\uff0cfalse\u4e0d\u76f8\u7b49\nint \u76f8\u7b49\u8fd4\u56de0\uff0c\u4e0d\u76f8\u7b49\u8fd4\u56de\u7b2c\u4e00\u4e2a\u4e0d\u76f8\u7b49\u4f4d\u7f6e\u7684\u5e8f\u53f7\n\u4f8b\u5b50\uff1a\nlocal result, offset = buff:isEqual(1, buff2, 2, 10) --\u7b49\u540c\u4e8ememcmp(&buff[1], &buff2[2], 10)\n", "prefix": "buff:isEqual"}, "zlib.c": {"body": "zlib.c(${1:input_file},${2:output_file})", "description": "zlib.c(input_file,output_file) - zlib\u538b\u7f29(\u9700\u8981\u5927\u7ea6270k\u5185\u5b58\uff0c\u5927\u90e8\u5206mcu\u4e0d\u652f\u6301)\n\u4f20\u5165\u503c\uff1a\nstring input_file \u8f93\u5165\u6587\u4ef6\nstring output_file \u8f93\u51fa\u6587\u4ef6\n\u8fd4\u56de\u503c\uff1a\nbool \u6b63\u5e38\u8fd4\u56de ture \u5931\u8d25\u8fd4\u56de false\n\u4f8b\u5b50\uff1a\nzlib.c(\"/sd/1.txt\",\"/sd/zlib\")\n", "prefix": "zlib.c"}, "zlib.d": {"body": "zlib.d(${1:input_file},${2:output_file})", "description": "zlib.d(input_file,output_file) - zlib\u89e3\u538b\u7f29(\u9700\u8981\u5927\u7ea618k\u5185\u5b58\uff0c\u5927\u90e8\u5206mcu\u90fd\u652f\u6301)\n\u4f20\u5165\u503c\uff1a\nstring input_file \u8f93\u5165\u6587\u4ef6\nstring output_file \u8f93\u51fa\u6587\u4ef6\n\u8fd4\u56de\u503c\uff1a\nbool \u6b63\u5e38\u8fd4\u56de ture \u5931\u8d25\u8fd4\u56de false\n\u4f8b\u5b50\uff1a\nzlib.d(\"/sd/zlib\",\"/sd/1.txt\")\n", "prefix": "zlib.d"}} \ No newline at end of file diff --git a/api/rtc.md b/api/rtc.md index c5771801..90d97ce7 100644 --- a/api/rtc.md +++ b/api/rtc.md @@ -32,7 +32,6 @@ ```lua rtc.set({year=2021,mon=8,day=31,hour=17,min=8,sec=43}) ---目前只有Air101/Air103/Air105/EC618系列支持时间戳方式 rtc.set(1652230554) ```