STM8 RC触摸库简单介绍
来源:互联网 发布:互联网营销数据分析 编辑:程序博客网 时间:2024/05/16 05:40
触摸检测到按键按下调用流程 :TSL_Action -> TSL_SCKEY_P1_Acquisition() -> TSL_IO_Acquisition() -> TSL_SCKey_Process() -> TSL_SCKey_DetectedTreatment() ,其中TSL_Action ()和TSL_SCKey_Process() 还有其他的状态变化和处理。
TSL_IO_Acquisition() 函数为充放电时间检测函数,其中最重要的变量应该是充放电时间和检测到超过预设范围的次数,函数外部会用到,分别为FinalMeasurementValue和RejectionCounter。
void TSL_IO_SW_Burst_Wait_Vil(void)//只看IAR编译器的内容
{
#if defined(_COSMIC_)
......
#elif defined(_IAR_)
__asm("ld a, S:AcquisitionBitMask"); //将AcquisitionBitMask放到a中
__asm("ldw x, S:sTouchIO"); // 将sTouchIO放到x中 装载字(16位)
__asm("incw x"); //增加一个字
// Loop = 1 + 1 + 2 + 2 + 2 cycles = 8 cycles
__asm("WaitForVil:");
// To be sure that the loop last 8 cycles the first instruction must be a 1-byte instruction
// This is to be sure it is fully fetched in 1 cycle. The second instruction must be shorter than 4 bytes.
// If this not the case, the code must be aligned.
__asm("bcp a, (x)"); // 1 cycles 逻辑比较
__asm("jreq ??EndWaitForVil"); //跳转到EndWaitForVil处
__asm("ldw y, TIMACQ_CNTR"); // 2 cycles; hw counter also used for timeout ...
__asm("cpw y, #0x0E00"); // 2 cycles; Timeout compare 字数值比较
__asm("jrult ??WaitForVil");
__asm("EndWaitForVil:");
#else //_RAISONANCE_
......
#endif
}
这个函数的大概意思是说检测对应管脚的电平,直到相同电平或者超时跳出,FinalMeasurementValue中装的应该就是TIMACQ_CNTR计数器的值(不知道是否正确,请大神指正)
注:
触摸方案的设计摘要:http://download.csdn.net/detail/wr1040982587/9697492
触摸方案的简单工程:http://download.csdn.net/detail/wr1040982587/9697482
有需要可以下载参考下!
- STM8 RC触摸库简单介绍
- DC和RC的简单介绍
- stm8触摸按键调试笔记(1)
- Android启动init.rc与Android.mk简单介绍
- 安卓触摸事件处理机制的简单介绍
- STM8
- sysv-rc-conf介绍
- Android init.rc介绍
- init.rc语法介绍
- init.rc语法介绍
- Selenium-RC使用介绍
- init.rc语法介绍
- init.rc介绍
- init.rc语法介绍
- Android init.rc init.vendor.rc 介绍
- STM8的TIM1定时器简单使用
- 关于STM8的FWLIB库
- HTML5-简单触摸事件
- Java并发系列-11、线程通信
- Android 仿网易新闻评论Dialog
- Android 笔记:获取本机手机号(适用于双卡双待手机)
- 在与C语言交互时出现的char 类型length不一致,作为转换特出下列
- 舞蹈链纯模板(kuangbin)hust1017
- STM8 RC触摸库简单介绍
- Android之如何顺利修改工程的包名?
- 《Objective-C 高级编程》读书笔记之 ARC
- addr2line查看死机代码的位置
- 常用的jquery在线引用地址
- Swift-枚举
- 测试特制微型气泵在低温环境下的稳定性
- Git 常用命令大全
- Java 多线程 并发编程------超全面