touchkey - Touch keys#

Adaptation status unknown

Note

This page document is automatically generated by this file. If there is any error, please submit issue or help modify pr, thank you!

touchkey.setup(id, scan_period, window, threshold)#

Configure touch buttons

Parameters

Incoming Value Type

Explanation

int

For the sensor ID, please refer to the hardware documentation, for example, air101/air103 supports 1~15, for example, PA7 corresponds touch id=1

int

Scanning interval, range 1 ~ 0x3F, unit 16ms, optional

int

Scan window, range 2-7, optional

int

Threshold, range 0-127, optional

Return Value

return value type

explanation

bool

Returns true on success and true on failure false

Examples

touchkey.setup(1)
sys.subscribe("TOUCHKEY_INC", function(id, count)
    -- Sensor id
    -- Counter, touch count
    log.info("touchkey", id, count)
end)

touchkey.close(id)#

Turn off initial touch key

Parameters

Incoming Value Type

Explanation

int

sensor id, please refer to the hardware documentation

Return Value

return value type

explanation

nil

No return value

Examples

-- Not likely to need to be turned off
touchkey.close(1)