目录

Tact

轻触开关类,配置单个轻触开关的触发事件并随时读取开关即时状态。

方法

__init__(self, pin, real_true = GPIO.HIGH)

初始化对象,设置引脚和触发电平(高电平或低电平触发)。

is_on(self)

返回当前轻触开关的按下状态。true 或 false。

register(self, observer)

为当前轻触开关注册监听对象。observer 为监听对象。当按钮按下或松开时会触发 observer 对象的 on_tact_event(self, pin, status) 方法。pin 为开关引脚编号,status 为该触发发生时的按钮状态。

deregister(self, observer)

为当前轻触开关注销监听对象。observer 为监听对象。