🍴 LuatOS-SOC接口文档#
请点击左侧列表,查看各个接口。如需搜索,请使用F5进行搜索。
- 适配状态
- adc - 模数转换
- antbot - 蚂蚁链
- audio - 多媒体-音频
- 常量
- audio.start(id, audio_format, num_channels, sample_rate, bits_per_sample, is_signed)
- audio.record(id, record_type, record_time, amr_quailty, path)
- audio.recordStop(id)
- audio.write(id, data)
- audio.stop(id)
- audio.pause(id, pause)
- audio.on(audio_id, func)
- audio.play(id, path, errStop)
- audio.tts(id, data)
- audio.playStop(id)
- audio.isEnd(id)
- audio.getError(id)
- audio.config(id, paPin, onLevel, dacDelay, paDelay, dacPin, dacLevel, dacTimeDelay)
- audio.vol(id, value)
- audio.micVol(id, value)
- audio.setBus(id, bus_type)
- audio.debug(on_off)
- audio.pm(id,pm_mode)
- bit64 - 32位系统上对64位数据的基本算术运算和逻辑运算
- camera - 摄像头
- 常量
- camera.init(InitReg_or_cspi_id, cspi_speed, mode, is_msb, rx_bit, seq_type, is_ddr, only_y, scan_mode, w, h)
- camera.on(id, event, func)
- camera.start(id)
- camera.stop(id)
- camera.close(id)
- camera.capture(id, save_path, quality)
- camera.video(id, w, h, out_path)
- camera.startRaw(id, w, h, buff)
- camera.getRaw(id)
- camera.preview(id, onoff)
- cc - VoLTE通话功能
- codec - 多媒体-编解码
- coremark - 跑分
- crypto - 加解密和hash函数
- crypto.md5(str)
- crypto.hmac_md5(str, key)
- crypto.sha1(str)
- crypto.hmac_sha1(str, key)
- crypto.sha256(str)
- crypto.hmac_sha256(str, key)
- crypto.sha512(str)
- crypto.hmac_sha512(str, key)
- crypto.cipher_encrypt(type, padding, str, key, iv)
- crypto.cipher_decrypt(type, padding, str, key, iv)
- crypto.crc16(method, data, poly, initial, finally, inReversem outReverse)
- crypto.crc16_modbus(data, start)
- crypto.crc32(data)
- crypto.crc8(data, poly, start, revert)
- crypto.crc7(data, poly, start)
- crypto.trng(len)
- crypto.totp(secret,time)
- crypto.base64_encode(data)
- crypto.base64_decode(data)
- crypto.cipher_list()
- crypto.cipher_suites()
- crypto.md_file(tp, path, hmac)
- crypto.md(tp, data, hmac)
- crypto.hash_init(tp)
- crypto.hash_update(stream, data)
- crypto.hash_finish(stream)
- crypto.checksum(data, mode)
- dac - 数模转换
- disp - disp库(已废弃)
- eink - 墨水屏操作库
- 常量
- eink.init(tp, args,spi_device)
- eink.setup(full, spiid, pin_busy, pin_reset, pin_dc, pin_cs)
- eink.sleep()
- eink.clear(color, force)
- eink.setWin(width, height, rotate)
- eink.getWin()
- eink.setFont(font)
- eink.print(x, y, str, colored)
- eink.show(x, y, noClear)
- eink.draw(buff, buff2, noclear)
- eink.line(x, y, x2, y2, colored)
- eink.rect(x, y, x2, y2, colored, fill)
- eink.circle(x, y, radius, colored, fill)
- eink.qrcode(x, y, str, size)
- eink.bat(x, y, bat)
- eink.weather_icon(x, y, code)
- eink.model(m)
- eink.drawXbm(x, y, w, h, data)
- eink.setCtx(index)
- eink.async(index)
- errDump - 错误上报
- fastlz - FastLZ压缩
- fatfs - 读写fatfs格式
- fdb - kv数据库,掉电不丢数据
- fonts - 字体库
- fota - 底层固件升级
- fs - 文件系统额外操作
- fskv - kv数据库,掉电不丢数据
- ftp - ftp 客户端
- gmssl - 国密算法(SM2/SM3/SM4)
- gpio - GPIO操作
- gtfont - 高通字库芯片
- hmeta - 硬件元数据
- ht1621 - 液晶屏驱动(HT1621/HT1621B)
- http - http 客户端
- httpsrv - http服务端
- i2c - I2C操作
- 常量
- i2c.exist(id)
- i2c.setup(id, speed, pullup)
- i2c.createSoft(scl,sda,delay)
- i2c.send(id, addr, data,stop)
- i2c.recv(id, addr, len)
- i2c.writeReg(id, addr, reg, data,stop)
- i2c.readReg(id, addr, reg, len)
- i2c.close(id)
- i2c.readDHT12(id)
- i2c.readSHT30(id,addr)
- i2c.transfer(id, addr, txBuff, rxBuff, rxLen)
- i2c.xfer(id, addr, txBuff, rxBuff, rxLen, transfer_done_topic, timeout)
- i2c.scan(id,speed)
- i2s - 数字音频
- iconv - iconv操作
- io - io操作(扩展)
- ioqueue - io序列操作
- ioqueue.init(hwtimer_id,cmd_cnt,repeat_cnt)
- ioqueue.setdelay(hwtimer_id,time_us,time_tick,continue)
- ioqueue.delay(hwtimer_id)
- ioqueue.setgpio(hwtimer_id,pin,is_input,pull_mode,init_level)
- ioqueue.input(hwtimer_id,pin)
- ioqueue.output(hwtimer_id,pin,level)
- ioqueue.set_cap(hwtimer_id,pin,pull_mode,irq_mode,max_tick)
- ioqueue.capture(hwtimer_id)
- ioqueue.capend(hwtimer_id,pin)
- ioqueue.get(hwtimer_id, input_buff, capture_buff)
- ioqueue.start(hwtimer_id)
- ioqueue.stop(hwtimer_id)
- ioqueue.release(hwtimer_id)
- ioqueue.clear(hwtimer_id)
- ioqueue.done(hwtimer_id)
- ioqueue.exti(pin,pull_mode,irq_mode,onoff)
- iotauth - IoT鉴权库, 用于生成各种云平台的参数
- iotauth.aliyun(product_key, device_name,device_secret,method,cur_timestamp)
- iotauth.onenet(produt_id, device_name,key,method,cur_timestamp,version)
- iotauth.iotda(device_id,device_secret,cur_timestamp)
- iotauth.qcloud(product_id, device_name,device_secret,method,cur_timestamp,sdk_appid)
- iotauth.tuya(device_id,device_secret,cur_timestamp)
- iotauth.baidu(iot_core_id, device_key,device_secret,method,cur_timestamp)
- ir - 红外遥控
- json - json生成和解析库
- keyboard - 键盘矩阵
- lcd - lcd驱动模块
- 常量
- lcd.init(tp, args, spi_dev, init_in_service)
- lcd.close()
- lcd.on()
- lcd.off()
- lcd.sleep()
- lcd.wakeup()
- lcd.invon()
- lcd.invoff()
- lcd.cmd(cmd)
- lcd.data(data)
- lcd.setColor(back,fore)
- lcd.draw(x1, y1, x2, y2,color)
- lcd.clear(color)
- lcd.fill(x1, y1, x2, y2,color)
- lcd.drawPoint(x0,y0,color)
- lcd.drawLine(x0,y0,x1,y1,color)
- lcd.drawRectangle(x0,y0,x1,y1,color)
- lcd.drawCircle(x0,y0,r,color)
- lcd.drawQrcode(x, y, str, size)
- lcd.setFont(font, indentation)
- lcd.drawStr(x,y,str,fg_color)
- lcd.drawGtfontGb2312(str,size,x,y)
- lcd.drawGtfontGb2312Gray(str,size,gray,x,y)
- lcd.drawGtfontUtf8(str,size,x,y)
- lcd.drawGtfontUtf8Gray(str,size,gray,x,y)
- lcd.getSize()
- lcd.drawXbm(x, y, w, h, data)
- lcd.showImage(x, y, file)
- lcd.flush()
- lcd.setupBuff(conf, onheap)
- lcd.autoFlush(enable)
- lcd.rgb565(r, g, b, swap)
- lcdseg - 段式lcd
- libcoap - coap数据处理
- libgnss - NMEA数据处理
- libgnss.parse(str)
- libgnss.isFix()
- libgnss.getIntLocation(speed_type)
- libgnss.getRmc(data_mode)
- libgnss.getGsv()
- libgnss.getGsa(data_mode)
- libgnss.getVtg(data_mode)
- libgnss.getZda()
- libgnss.debug(mode)
- libgnss.getGga(data_mode)
- libgnss.getGll(data_mode)
- libgnss.clear()
- libgnss.bind(id, next_id)
- libgnss.locStr(mode)
- libgnss.rtcAuto(enable)
- libgnss.on(tp, fn)
- libgnss.getTxt()
- libgnss.casic_aid(dt, loc)
- little_flash - LITTLE FLASH 软件包
- log - 日志库
- lora - lora驱动模块
- lora2 - lora2驱动模块(支持多挂)
- lvgl - LVGL图像库
- lvgl.draw_mask_radius_param_t()
- lvgl.draw_mask_radius_param_t_free(radius)
- lvgl.draw_mask_line_param_t()
- lvgl.draw_mask_line_param_t_free(line)
- lvgl.draw_mask_fade_param_t()
- lvgl.draw_mask_fade_param_t_free(fade)
- lvgl.font_get(name)
- lvgl.font_load(path/spi_device,size,bpp,thickness,cache_size,sty_zh,sty_en)
- lvgl.font_free(font)
- lvgl.obj_set_event_cb(obj, func)
- lvgl.obj_set_signal_cb(obj, func)
- lvgl.anim_set_exec_cb(anim, func)
- lvgl.anim_set_ready_cb(anim, func)
- lvgl.anim_path_set_cb(path, func)
- lvgl.event_send(obj, ent)
- lvgl.scr_act()
- lvgl.layer_top()
- lvgl.layer_sys()
- lvgl.scr_load(scr)
- lvgl.scr_load_anim(scr)
- lvgl.theme_set_act(name)
- lvgl.sleep(enable)
- lvgl.init(w, h, lcd, buff_size, buff_mode)
- lvgl.anim_create()
- lvgl.anim_free(anim)
- lvgl.anim_path_t()
- lvgl.anim_path_t_free(anim_path_t)
- lvgl.anim_set_path_str(anim, tp)
- lvgl.qrcode_create(parent, size, dark_color, light_color)
- lvgl.qrcode_update(qrcode, cnt)
- lvgl.qrcode_delete(qrcode)
- lvgl.style_t()
- lvgl.style_create()
- lvgl.style_list_create()
- lvgl.style_list_t()
- lvgl.style_delete(style)
- lvgl.style_list_delete(style)
- lvgl.demo_benchmark()
- lvgl.demo_keypad_encoder()
- lvgl.demo_music()
- lvgl.demo_printer()
- lvgl.demo_stress()
- lvgl.demo_widgets()
- lvgl.indev_drv_register(tp, dtp)
- lvgl.indev_point_emulator_update(x, y, state)
- lvgl.indev_kb_update(key)
- lvgl.gif_create(parent, path)
- lvgl.gif_restart(gif)
- max30102 - 心率模块(MAX30102)
- mcu - 封装mcu一些特殊操作
- 常量
- mcu.setClk(mhz)
- mcu.getClk()
- mcu.unique_id()
- mcu.ticks()
- mcu.hz()
- mcu.reg32(address, value, mask)
- mcu.x32(value)
- mcu.tick64()
- mcu.dtick64(tick1, tick2, check_value)
- mcu.setXTAL(source_main, source_32k, delay)
- mcu.hardfault(mode)
- mcu.iomux(type, channel, value)
- mcu.altfun(type, sn, pad_index, alt_fun, is_input)
- mcu.ticks2(mode)
- mcu.XTALRefOutput(source_main, source_32k)
- miniz - 简易zlib压缩
- mlx90640 - 红外测温(MLX90640)
- mobile - 蜂窝网络
- 常量
- mobile.imei(index)
- mobile.imsi(index)
- mobile.sn()
- mobile.muid()
- mobile.iccid(id)
- mobile.number(id)
- mobile.simid(id)
- mobile.simPin(id,operation,pin1,pin2)
- mobile.rtime(time, auto_reset_stack, data_first)
- mobile.setAuto(check_sim_period, get_cell_period, search_cell_time, auto_reset_stack, network_check_period)
- mobile.apn(index, cid, new_apn_name, user_name, password, ip_type, protocol)
- mobile.ipv6(onff)
- mobile.csq()
- mobile.rssi()
- mobile.rsrp()
- mobile.rsrq()
- mobile.snr()
- mobile.eci()
- mobile.tac()
- mobile.enbid()
- mobile.scell()
- mobile.flymode(index, enable)
- mobile.syncTime(enable)
- mobile.status()
- mobile.getCellInfo()
- mobile.reqCellInfo(timeout)
- mobile.lockCell(mode, earfcn, pci)
- mobile.reset()
- mobile.dataTraffic(clearUplink, clearDownlink)
- mobile.config(item, value)
- mobile.getBand(band, is_default)
- mobile.setBand(band, num)
- mobile.nstOnOff(onoff, uart_id)
- mobile.nstInput(data)
- mobile.vsimInit()
- mobile.vsimOnOff(enable)
- mobile.apnTableInit()
- mobile.apnTableAdd(mcc, mnc, ip_type, protocol, apn_name, user_name, password)
- mobile.apnTablePrint(mcc, mnc)
- mqtt - mqtt客户端
- 常量
- mqttc:subscribe(topic, qos)
- mqttc:unsubscribe(topic)
- mqttc:debug(onoff)
- mqtt.create(adapter,host,port,ssl,isipv6)
- mqttc:auth(client_id,username,password,cleanSession)
- mqttc:keepalive(time)
- mqttc:on(cb)
- mqttc:connect()
- mqttc:disconnect()
- mqttc:autoreconn(reconnect, reconnect_time)
- mqttc:publish(topic, data, qos, retain)
- mqttc:close()
- mqttc:ready()
- mqttc:state()
- mqttc:will(topic, payload, qos, retain)
- os - os操作
- otp - OTP操作库
- pack - 打包和解包格式串
- pin - 管脚命名映射
- pm - 电源管理
- protobuf - ProtoBuffs编解码
- pwm - PWM模块
- repl - “读取-求值-输出” 循环
- rsa - RSA加密解密
- rtc - 实时时钟
- rtos - RTOS底层操作库
- rtos.receive(timeout)
- rtos.timer_start(id,timeout,_repeat)
- rtos.timer_stop(id)
- rtos.reboot()
- rtos.buildDate()
- rtos.bsp()
- rtos.version()
- rtos.standy(timeout)
- rtos.meminfo(type)
- rtos.firmware()
- rtos.setPaths(pathA, pathB, pathC, pathD)
- rtos.nop()
- rtos.autoCollectMem(period, warning_level, force_level)
- sdio - sdio
- sensor - 传感器操作库
- sensor.ds18b20(pin, check_crc)
- sensor.w1_reset(pin)
- sensor.w1_connect(pin)
- sensor.w1_write(pin, data1,data2)
- sensor.w1_read(pin, len)
- sensor.hx711(pin_date,pin_clk)
- sensor.cs1237(pin_date,pin_clk)
- sensor.ws2812b(pin,data,T0H,T0L,T1H,T1L)
- sensor.ws2812b_pwm(pin,data)
- sensor.ws2812b_spi(pin,data)
- sensor.dht1x(pin)
- sensor.sc12a(sda,scl)
- sensor.yhm27xxx(pin, chip_id, reg, data)
- sfd - SPI FLASH操作库
- sfud - SPI FLASH sfud软件包
- sfud.init(spi_id, spi_cs, spi_bandrate)/sfud.init(spi_device)
- sfud.getDeviceNum()
- sfud.getDevice(index)
- sfud.getDeviceTable()
- sfud.chipErase(flash)
- sfud.erase(flash,add,size)
- sfud.read(flash, addr, size)
- sfud.write(flash, addr,data)
- sfud.eraseWrite(flash, addr,data)
- sfud.getInfo(flash)
- sfud.mount(flash, mount_point, offset, maxsize)
- sms - 短信
- socket - 网络接口
- 常量
- socket.sntp(sntp_server)
- socket.ntptm()
- socket.sntp_port(port)
- socket.localIP(adapter)
- socket.create(adapter, cb)
- socket.debug(ctrl, onoff)
- socket.config(ctrl, local_port, is_udp, is_tls, keep_idle, keep_interval, keep_cnt, server_cert, client_cert, client_key, client_password)
- socket.linkup(ctrl)
- socket.connect(ctrl, ip, remote_port, need_ipv6_dns)
- socket.discon(ctrl)
- socket.close(ctrl)
- socket.tx(ctrl, data, ip, port, flag)
- socket.rx(ctrl, buff, flag, limit)
- socket.read(netc, len)
- socket.wait(ctrl)
- socket.listen(ctrl)
- socket.accept(ctrl)
- socket.state(ctrl)
- socket.release(ctrl)
- socket.setDNS(adapter_index, dns_index, ip)
- socket.sslLog(log_level)
- socket.adapter(index)
- socket.remoteIP(ctrl)
- softkb - 软件键盘矩阵
- spi - spi操作库
- 常量
- spi.setup(id, cs, CPHA, CPOL, dataw, bandrate, bitdict, ms, mode)
- spi.createSoft(cs, mosi, miso, clk, CPHA, CPOL, dataw, bitdict, ms, mode)
- spi.close(id)
- spi.transfer(id, send_data, send_len, recv_len)
- spi.recv(id, size, buff)
- spi.send(id, data[, len])
- spi.deviceSetup(id, cs, CPHA, CPOL, dataw, bandrate, bitdict, ms, mode)
- spi_device:close()
- spi_device:transfer(send_data[, len])
- spi_device:send(data[, len])
- spi_device:recv(size)
- spi.xfer(id, txbuff, rxbuff, rx_len, transfer_done_topic)
- statem - SM状态机
- string - 字符串操作函数
- string.toHex(str, separator)
- string.fromHex(hex)
- string.split(str, delimiter, keepEmtry)
- string.toValue(str)
- string.urlEncode(“123 abc”)
- string.toBase64(str)
- string.fromBase64(str)
- string.toBase32(str)
- string.fromBase32(str)
- string.startsWith(str, prefix)
- string.endsWith(str, suffix)
- string.trim(str, ltrim, rtrim)
- sys - sys库
- sys.wait(timeout)
- sys.waitUntil(topic, timeout)
- sys.taskInit(func, arg1, arg2, argN)
- sys.timerStart(func, timeout, arg1, arg2, argN)
- sys.timerLoopStart(func, timeout, arg1, arg2, argN)
- sys.timerStop(id)
- sys.timerStopAll(fnc)
- sys.publish(topic, arg1, agr2, argN)
- sys.subscribe(topic, func)
- sys.unsubscribe(topic, func)
- sys.run()
- sysplus - sys库的强力补充
- timer - 操作底层定时器
- touchkey - 触摸按键
- u8g2 - u8g2图形处理库
- 常量
- u8g2.begin(conf)
- u8g2.close()
- u8g2.ClearBuffer()
- u8g2.SendBuffer()
- u8g2.DrawUTF8(str, x, y)
- u8g2.DrawButtonUTF8(str, x, y, flags, w, h, v, str)
- u8g2.SetFontMode(mode)
- u8g2.SetFont(font, indentation)
- u8g2.GetDisplayHeight()
- u8g2.GetDisplayWidth()
- u8g2.SetDrawColor(c)
- u8g2.DrawPixel(x,y)
- u8g2.DrawLine(x0,y0,x1,y1)
- u8g2.DrawCircle(x0,y0,rad,opt)
- u8g2.DrawDisc(x0,y0,rad,opt)
- u8g2.DrawEllipse(x0,y0,rx,ry,opt)
- u8g2.DrawFilledEllipse(x0,y0,rx,ry,opt)
- u8g2.DrawBox(x,y,w,h)
- u8g2.DrawFrame(x,y,w,h)
- u8g2.DrawRBox(x,y,w,h,r)
- u8g2.DrawRFrame(x,y,w,h,r)
- u8g2.DrawGlyph(x,y,encoding)
- u8g2.DrawTriangle(x0,y0,x1,y1,x2,y2)
- u8g2.SetBitmapMode(mode)
- u8g2.DrawXBM(x, y, w, h, data)
- u8g2.DrawDrcode(x, y, str, size)
- u8g2.SetContrast(contrast)
- u8g2.drawGtfontGb2312(str,size,x,y)
- u8g2.drawGtfontUtf8(str,size,x,y)
- u8g2.CopyBuffer(buff)
- u8g2.SetPowerSave(is_enable)
- uart - 串口操作库
- 常量
- uart.setup(id, baud_rate, data_bits, stop_bits, partiy, bit_order, buff_size, rs485_gpio, rs485_level, rs485_delay, debug_enable, error_drop)
- uart.write(id, data)
- uart.read(id, len)
- uart.close(id)
- uart.on(id, event, func)
- uart.wait485(id)
- uart.exist(id)
- uart.rx(id, buff)
- uart.rxSize(id)
- uart.rxClear(id)
- uart.tx(id, buff, start, len)
- uart.createSoft(tx_pin, tx_hwtimer_id, rx_pin, rx_hwtimer_id, adjust_period)
- uart.list(max)
- usbapp - USB功能操作
- w5500 - w5500以太网驱动
- wdt - watchdog操作库
- websocket - websocket客户端
- wlan - wifi操作
- 常量
- wlan.init()
- wlan.setMode(mode)
- wlan.ready()
- wlan.connect(ssid, password, auto_reconnect, bssid)
- wlan.disconnect()
- wlan.scan()
- wlan.scanResult()
- wlan.smartconfig(mode)
- wlan.getMac(tp, hexstr)
- wlan.setMac(tp, mac)
- wlan.getIP()
- wlan.createAP(ssid, passwd, gateway, netmask, channel, opts)
- wlan.stopAP()
- wlan.getInfo()
- wlan.powerSave(mode)
- wlan.hostname(new_name)
- wlan.staIp(dhcp_enable, ip, netmask, gateway)
- xxtea - xxtea加密解密
- ymodem - ymodem协议
- zbuff - c内存数据操作库
- 常量
- zbuff.create(length,data,type)
- buff:write(para,…)
- buff:read(length)
- buff:clear(num)
- buff:seek(base,offset)
- buff:pack(format,val1, val2,…)
- buff:unpack(format)
- buff:read类型()
- buff:write类型()
- buff:toStr(offset,length)
- buff:len()
- buff:setFrameBuffer(width,height,bit,color)
- buff:pixel(x,y,color)
- buff:drawLine(x1,y1,x2,y2,color)
- buff:drawRect(x1,y1,x2,y2,color,fill)
- buff:drawCircle(x,y,r,color,fill)
- buff[n]
- buff:free()
- buff:resize(n)
- buff:copy(start, para,…)
- buff:used()
- buff:del(offset,length)
- buff:query(offset,length,isbigend,issigned,isfloat)
- buff:set(start, num, len)
- buff:isEqual(start, buff2, start2, len)