合宙Air724UG LuatOS-Air script lib API--powerKey

powerKey

Table of Contents

powerKey

powerKey.setup(longPrd, longCb, shortCb)

powerKey

模块功能:开机键功能配置

powerKey.setup(longPrd, longCb, shortCb)

配置开机键长按弹起和短按弹起的功能.

如何定义长按键和短按键,例如长按键判断时长为3秒:

按下大于等于3秒再弹起判定为长按键;

按下后,在3秒内弹起,判定为短按键

参数

名称 传入值类型 释义

longPrd number 可选参数,默认为3000 长按键判断时长,单位毫秒

longCb function 可选参数,默认为nil 长按弹起时的回调函数,如果为nil,使用默认的处理函数,会自动关机

shortCb function 可选参数,默认为nil 短按弹起时的回调函数

返回值

nil

例子

powerKey.setup(nil,longCb,shortCb)

powerKey.setup(5000,longCb)

powerKey.setup()

详细指南和示例参考:指南 示例


powerKey

Table of Contents

powerKey

powerKey.setup(longPrd, longCb, shortCb)

powerKey

模块功能:开机键功能配置

powerKey.setup(longPrd, longCb, shortCb)

配置开机键长按弹起和短按弹起的功能.

如何定义长按键和短按键,例如长按键判断时长为3秒:

按下大于等于3秒再弹起判定为长按键;

按下后,在3秒内弹起,判定为短按键

参数

名称 传入值类型 释义

longPrd number 可选参数,默认为3000 长按键判断时长,单位毫秒

longCb function 可选参数,默认为nil 长按弹起时的回调函数,如果为nil,使用默认的处理函数,会自动关机

shortCb function 可选参数,默认为nil 短按弹起时的回调函数

返回值

nil

例子

powerKey.setup(nil,longCb,shortCb)

powerKey.setup(5000,longCb)

powerKey.setup()

详细指南和示例参考:指南 示例

相关推荐
l5317981511 年前
合宙Air724UG LuatOS-Air lvgl字库
air724ug
l5317981511 年前
合宙Air724UG LuatOS-Air LVGL API控件-截屏(Screenshots)
air724ug
l5317981511 年前
合宙Air724UG LuatOS-Air LVGL API控件-图片(Gif)
air724ug
l5317981511 年前
合宙Air724UG LuatOS-Air LVGL API控件-二维码(Qrcode)
air724ug
l5317981511 年前
合宙Air724UG LuatOS-Air LVGL API控件-标签 (Label)
air724ug
l5317981511 年前
合宙Air724UG LuatOS-Air LVGL API控件-窗口 (Window)
air724ug
l5317981511 年前
合宙Air724UG LuatOS-Air LVGL API控件-图片 (Image)
air724ug
l5317981511 年前
合宙Air724UG LuatOS-Air LVGL API控件-表格(Table)
air724ug
l5317981511 年前
合宙Air724UG LuatOS-Air LVGL API控件-开关 (Switch)
air724ug
l5317981511 年前
合宙Air724UG LuatOS-Air LVGL API控件-页面 (Page)
air724ug