ESP32学习笔记(五) 外部中断
目录:
ESP32学习笔记(一) 芯片型号介绍
ESP32学习笔记(二) 开发环境搭建 VSCode+platformio
ESP32学习笔记(三) 硬件资源介绍
ESP32学习笔记(四) 串口通信
ESP32学习笔记(五) 外部中断
ESP32学习笔记(六) 定时器
ESP32学习笔记(七) 复位和时钟
把电容触摸放在外部中断这里是因为 电容触摸也可以触发中断
1.电容触摸功能
1.1相关API
void touchSetCycles(uint16_t measure, uint16_t sleep);
touch_value_t touchRead(uint8_t pin); //Read touch pad (values close to 0 mean touch detected)
void touchAttachInterrupt(uint8_t pin, void (*userFunc)(void), touch_value_t threshold);
void touchAttachInterruptArg(uint8_t pin, void (*userFunc)(void*), void *arg, touch_value_t threshold);
void touchDetachInterrupt(uint8_t pin); //停止中断
#if SOC_TOUCH_VERSION_1 // Only for ESP32 SoC
void touchInterruptSetThresholdDirection(bool mustbeLower); //设置是低于阈值 还是高于阈值 来触发isr 默认是低
#endif
我实际的测量值 如函数描述一样 较小的值表示触摸到