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.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
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)
|
||||
sbi(P_DIN, B_DIN);
|
||||
else
|
||||
cbi(P_DIN, B_DIN);
|
||||
temp = temp << 1;
|
||||
cbi(P_CLK, B_CLK);
|
||||
sbi(P_CLK, B_CLK);
|
||||
}
|
||||
}
|
||||
|
||||
word UTouch::touch_ReadData()
|
||||
{
|
||||
word data = 0;
|
||||
|
||||
for(byte count=0; count<12; count++)
|
||||
{
|
||||
data <<= 1;
|
||||
sbi(P_CLK, B_CLK);
|
||||
cbi(P_CLK, B_CLK);
|
||||
if (rbi(P_DOUT, B_DOUT))
|
||||
data++;
|
||||
}
|
||||
return(data);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
// *** Hardwarespecific defines ***
|
||||
#define cbi(reg, bitmask) *reg &= ~bitmask
|
||||
#define sbi(reg, bitmask) *reg |= bitmask
|
||||
#define rbi(reg, bitmask) ((*reg) & bitmask)
|
||||
|
||||
#define pulse_high(reg, bitmask) sbi(reg, bitmask); cbi(reg, bitmask);
|
||||
#define pulse_low(reg, bitmask) cbi(reg, bitmask); sbi(reg, bitmask);
|
||||
|
||||
#define swap(type, i, j) {type t = i; i = j; j = t;}
|
||||
|
||||
#define regtype volatile uint8_t
|
||||
#define regsize uint8_t
|
||||
Reference in New Issue
Block a user