低功耗触摸唤醒
Overview
以 AC638N 为例,提供低功耗触摸唤醒的应用示例、工程配置、API 介绍和常见问题。
应用示例
- 低功耗触摸唤醒的具体源代码详见 sdk/bsp/AC638N/src/lp_touch_key.c 
- lp_touch_key.c中参考示例如下:- /**********低功耗触摸唤醒参考示例**********/ #include "asm/power_interface.h" void lp_touch_key_wakeup_test(void) { lp_touch_key_enable(); power_set_soft_poweroff(); } 
工程配置
- 在 sdk/bsp/AC638N/board/board_demo.c 中配置低功耗触摸唤醒io: - /**********LP TOUCH KEY**********/ #if TCFG_LP_TOUCH_KEY_ENABLE const struct lp_touch_key_platform_data lp_touch_key_config = { //CH0: POWER KEY .ch0.enable = 1, .ch0.port = IO_PORTB_01, .ch0.sensitivity = 8, //cap检测灵敏度级数5 .ch0.key_value = 0, }; #endif /* #if TCFG_LP_TOUCH_KEY_ENABLE */ 
- 在 sdk/apps/main.c 中函数 - user_main()添加如下工程代码:- int user_main() { mdelay(5000); extern void lp_touch_key_wakeup_test(void); lp_touch_key_wakeup_test(); } 
- 编译下载后,PB1利用杜邦线接上触摸铜牌,reset后5s进入低功耗模式,进入低功耗模式后按触摸铜牌,观察打印的是否复位唤醒。 
常见问题
- 低功耗触摸唤醒初始化函数在 - board_demo.c的- void board_init()函数中已经声明调用,请确保- #define TCFG_LP_TOUCH_KEY_ENABLE 1。
API参考
低功耗触摸唤醒常用相关 API 介绍,具体软件代码见 sdk/bsp/AC638N/src/lp_touch_key.c