TTP229 16key touch keypad
Embed:
(wiki syntax)
Show/hide line numbers
TTP229.cpp
00001 #include "TTP229.h" 00002 00003 TTP229::TTP229 (PinName sdopin, PinName sclpin) : sdo(sdopin), sdoInt(sdopin), scl(sclpin) 00004 { 00005 scl=1; 00006 sdoInt.fall(this, &TTP229::interrupt); 00007 } 00008 00009 void TTP229::interrupt() 00010 { 00011 sdoInt.disable_irq(); 00012 swnum=0; 00013 while(!sdo) {} 00014 wait_us(10); 00015 for(int i=0; i<16; i++) { 00016 scl=0; 00017 wait_us(2); 00018 if((sw[i]=!sdo)==true) swnum=i+1; 00019 scl=1; 00020 wait_us(2); 00021 } 00022 callback(); 00023 sdoInt.enable_irq(); 00024 }
Generated on Fri Jul 29 2022 01:21:48 by 1.7.2