Code: Select all
{
********************************************************************************
* Name : PenPressure (PUBLIC) *
* Purpose : Returns a value between 0-255 indicating pen pressure. *
* : Testing this value will allow a sensible value for *
* : Pen_Down_Threshold to be calculated. *
********************************************************************************
}
Public Function PenPressure() As Byte
Input(TS_X1) // X1 is input
Input(TS_X2) // X2 is input
Output(TS_Y1) // Y1 is output
Output(TS_Y2) // Y2 is output
TS_Y1 = 1 // Both Y plates high
TS_Y2 = 1
DelayUS(Pen_Down_DelayUS)
PenPressure = ADC.Read(BitOf(TS_X2,false)) >> 2 // Read ADC
Input(TS_Y1) // Y1 is input - power save
Input(TS_Y2) // Y2 is input - power save
End Function
{
********************************************************************************
* Name : ReadX (PRIVATE) *
* Purpose : *
********************************************************************************
}
Function ReadX() As Word
DelayMS(Read_XY_DelayMS) // Stabilise
Result = Max(ADC.Read(BitOf(TS_X1,false)), ADC.Read(BitOf(TS_X2,false))) // Read X co-ordinate
End Function
{
********************************************************************************
* Name : ReadY (PRIVATE) *
* Purpose : *
********************************************************************************
}
Function ReadY() As Word
DelayMS(Read_XY_DelayMS) // Stabilise
Result = Max(ADC.Read(BitOf(TS_Y1,false)), ADC.Read(BitOf(TS_Y2,false))) // Read Y co-ordinate
End Function
{
{
I welcome any solutions, although the above fixed my short term port issues. It may be more trouble than it's worth. If one wants to use the library-use it with the default ports and remove the capability to change the ports altogether.
Otherwise the Touchscreen library worked as advertised.....
Thanks Steven
Tom