- KEYWORDS: Module,HYSTM32,HYSTM32_24,HYSTM32_28,HYSTM32_32,Touchscreen,SPI,ADS7843,Sensor
This is a common touchscreen controller used in a lot of boards, including the 'HY' boards that can run Espruino. It is handled by the [[ADS7843.js]] module.
Note: If you're using this on a board with a built-in LCD, you should probably use the [[Touchscreen]] module, as this has built-in support.
In the module, 'connect' takes arguments for SPI, Chip Select, IRQ, and then offsets for x and y as well as multipliers.
The final argument is the callback function, which has two arguments (X and Y). When you move your finger on the touchscreen the X and Y coordinates are reported back, and when you lift your finger, the callback function is called once with X and Y set to undefined.
SPI1.setup({sck:A5,miso:A6,mosi:A7});
require("ADS7843").connect(SPI1, A4, B6, 0, 0, 320, 240, function(x,y) {
if (x!==undefined)
LCD.fillRect(x-1,y-1,x+1,y+1);
});
See Touchscreen