在线时间776 小时
UID126526
注册时间2008-5-19
NXP金币0
TA的每日心情 | 奋斗 2023-9-17 19:57 |
---|
签到天数: 2310 天 [LV.Master]伴坛终老
金牌会员
- 积分
- 10481
- 最后登录
- 2023-9-17
|
本帖最后由 shaoziyang 于 2015-2-12 11:16 编辑
用Mbed+TSIHW库做了一个简单的触摸按键测试程序,供大家参考。
- /*
- YL-KL26Z TSI测试
- 邵子扬
- 2015.2
- */
- #include "mbed.h"
- #include "TSIHW.h"
- Serial pc(USBTX, USBRX);
- DigitalOut myled1(LED1);
- DigitalOut myled2(LED2);
- DigitalOut myled3(LED3);
- TSI touch(0,0,0,2,2);
- int main() {
- uint16_t s;
-
- pc.baud(115200);
- touch.ActivateChannel(9);
- touch.ActivateChannel(10);
- touch.ActivateChannel(13);
-
- while(1) {
- touch.Start(9);
- s = 0;
- while(!s)
- s = touch.Read();
- pc.printf("%d ", s);
- myled3 = (s<300);
- touch.Start(10);
- s = 0;
- while(!s)
- s = touch.Read();
- pc.printf("%d ", s);
- myled2 = (s<300);
- touch.Start(13);
- s = 0;
- while(!s)
- s = touch.Read();
- pc.printf("%d\r\n", s);
- myled1 = (s<300);
- wait(0.3);
- }
- }
复制代码
TSI_1.ZIP
(780.91 KB, 下载次数: 8)
|
|