Add capacitive touch-button test optimized from btntest.
TTP223-style debounce (majority, min touch, rearm), SoftSPI+LVGL shell, flashable firmware/cyd. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
16
include/button.h
Normal file
16
include/button.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void button_init();
|
||||
/** 轮询:检测有效触摸边沿,返回本周期是否有一次有效触摸 */
|
||||
bool button_poll_press();
|
||||
uint32_t button_count();
|
||||
void button_reset_count();
|
||||
bool button_is_down();
|
||||
/** 当前持续触摸时长(ms);未触摸为 0 */
|
||||
uint32_t button_hold_ms();
|
||||
/** 原始电平:1=HIGH,0=LOW */
|
||||
int button_raw_level();
|
||||
/** 触摸有效电平:1=HIGH 有效,0=LOW 有效(开机按空闲电平自动判定) */
|
||||
int button_active_level();
|
||||
Reference in New Issue
Block a user