Files
MySensors/libraries/UTouch/hardware/arm/HW_ARM.inc
T
Henrik Ekblad 2fd948fc66 Add new scene controller with touch display example.
Upgraded RF24 to latest version which supports SoftSPI. 
Added DigitalIO and UTFT libraries to support the new example.
Fix problem reported in RelayWithButtonActuator example.
2014-10-17 00:01:55 +02:00

37 lines
633 B
C++

// Results becomes inaccurate if direct port manipulation is used hence the use of digitalWrite() and digitalRead()
void UTouch::touch_WriteData(byte data)
{
byte temp;
temp=data;
cbi(P_CLK, B_CLK);
for(byte count=0; count<8; count++)
{
if(temp & 0x80)
digitalWrite(T_DIN, HIGH);
else
digitalWrite(T_DIN, LOW);
temp = temp << 1;
digitalWrite(T_CLK, LOW);
digitalWrite(T_CLK, HIGH);
}
}
word UTouch::touch_ReadData()
{
word data = 0;
for(byte count=0; count<12; count++)
{
data <<= 1;
digitalWrite(T_CLK, HIGH);
digitalWrite(T_CLK, LOW);
if (digitalRead(T_DOUT))
data++;
}
return(data);
}