Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
5 years, 7 months ago.
Crash with resistive touchpad
Hi David,
I use TFT-8'' with resitive touchpad and after library update my old code (2016) crash. My investigation on constructor RA8875::RA8875 shows that pointer touchInfo is NULL. The pointer is used in TouchPanelReadable and with NULL my code crash. Does exist constructor RA8875 with memory alocation for touchInfo ? At the moment I allocate memory and change your library.
My code: TouchCode_t touch; point_t p;
lcd.init( 800, 480, 16,40, false, true); lcd.frequency(10000000); InitTS();
lcd.foreground( White ); while (1) { touch = lcd.TouchPanelReadable( &p ); if( touch != no_touch ) { lcd.printf( " \r" ); lcd.printf( "X=%d Y=%d C=%d\r\n", p.x, p.y, touch ); }; };
My change: JK_START touchInfo = (touchInfo_T *)malloc(FT5206_TOUCH_POINTS * sizeof(touchInfo_T)); JK_END
Best regards, Janusz
Question relating to:
1 Answer
5 years, 7 months ago.
Hi Janusz,
This is quite embarrassing that I did not spot that (or test that combination after recent changes to support another touch controller). I have a couple of resistive touch displays in use, but haven't taken them out of service for an update after my last set of changes for the other touch controllers.
I reviewed your proposal, which is nearly what I implemented. The change was basically as you suggested, in the constructor used for the resistive touch. However, the resistive supports only a single touch, so the # touch points can be 1. I created a #define for that, to be consistent with the other touch controllers, and so that also affected two other files.
I just published an update to the library (as revision 176). I'm hoping you will spot this note, give it a go, and follow up here indicating success/failure.