0 value tsInitialised \ -- flag
Returns true when the touchscreen has been initialised.
2variable tsLastPos \ -- addr
Holds the position of the last touchscreen press as 32 bit
x and y values. The y coordinate is at the low address so:
tsLastPos 2@ ( -- x y )
: tsInit \ --
Initialise the touchscreen.
struct /TS_State \ -- len
Structure used to hold the touchscreen state.
/TS_State Buffer: TS_State[] \ -- addr
A global buffer holding the touchscreen state.
: tsKey? \ -- flag
Return non-zero if the touchscreen is being pressed.
: tsWaitDown \ --
Wait until the screen has been touched. Some debounce should
be added.
: tsWaitUp \ --
Wait until the screen is no longer being touched. Some
debounce should be added.
: tsWaitKey \ -- x y
Wait until the screen has been touched and return the
position.
: tsWaitPress \ --
Wait until a screen press takes place and save the x,y
coordinates in the variable tsLastPos
.
: tsKey \ -- x y -1 | 0
Return the x,y coordinate of the last place touched on the
touchscreen, and true if still pressed. If the touchscreen
is not being pressed, just return zero.
Edit the conditional compilation at the end of the file to enable or disable the test code.
: ttts \ --
display the X and Y coordinates when the touchscreen is pressed