MCUFRIEND library quirk?

I have a tiny program included that prints hello world to the screen and then gets a touch screen point. I will later send that point x & y to the Serial Monitor. The code below works fine but when you un-comment the line //p = ts.getPoint(); the screen blanks out.

Why does getting the touch screen point blank the screen?

#include <TouchScreen.h>
#include <MCUFRIEND_kbv.h>

#define YP A2  // must be an analog pin, use "An" notation!
#define XM A3  // must be an analog pin, use "An" notation!
#define YM 8   // can be a digital pin
#define XP 9   // can be a digital pin

MCUFRIEND_kbv tft;
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);
TSPoint p;

void setup()
{
  Serial.begin(9600);
  tft.begin();
  tft.setRotation(135);
  tft.fillScreen(0x0000);
  tft.setTextColor(0xfe00, 0x0000);
  tft.setTextSize(2);
}

void loop()
{
  tft.setCursor(10, 10);
  tft.print("Hello World");
  //p = ts.getPoint();
}

The Touch pins are shared with the TFT controller.
The TouchScreen library calls leave YP, XM in Analog (input) mode. YM, XP are left in Digital (output) mode.

Always restore YP, XM pins to OUTPUT after every getPoint() call.

This feature is mentioned in every TouchScreen example.

David.

Thanks David. I'll give that a try.

Yes, that fixed the problem. Guess i should do a better job of reading the comments in sample programs.