By entering this site you need to consent to the use of cookies and their functional use according to this privacy policy. Cookies help us to provide the functional services of the website. Kindly read the below message of use and consent to the use.
The following cookies are stored and shared when accessing this website:
- Internal cookies for the MediaWiki site. This is used for user authentication and article modifications.
- Third-party cookies from Google providing services for Google AdSense and Google Analytics
We will never use data collected outside of the above scope.
Once the touchscreen is initialized, you can start polling touch data:
+
u8 raw_touchdata[0x40];
+
spi_select_reg(3, 0x67);
+
spi_read_offset(3, 0x26); //The return value of this is checked against "& 2"
+
spi_select_reg(3, 0xFB);
+
spi_read_offset_array(3, 1, raw_touchdata, 0x34);
+
+
This is the format of the touchdata report:
+
{| class="wikitable" border="1"
+
|-
+
! Offset
+
! Width
+
! Description
+
|-
+
| 0x00
+
| 2*5
+
| Five Touchscreen X Coordinates (big-endian MSB,LSB each. 12 bits number)
+
|-
+
| 0x0A
+
| 2*5
+
| Five Touchscreen Y Coordinates (big-endian MSB,LSB each. 12 bits number)
+
|-
+
| 0x20
+
| ??
+
| ??
+
|}
+
+
When the touchscreen is not touched, all the coordinates report 0xFFFF, and since touch coordinates have only 12 bits, you can check if the touchscreen is pressed by checking the 4th bit of the MSB. For example: pendown = !(raw_touchdata[0] & BIT(4))