text: /**
    ******************************************************************************
    * File Name          : STM32TouchController.cpp
    ******************************************************************************
    * @attention
    *
    * <h2><center>&copy; Copyright (c) 2021 STMicroelectronics.
    * All rights reserved.</center></h2>
    *
    * This software component is licensed by ST under Ultimate Liberty license
    * SLA0044, the "License"; You may not use this file except in compliance with
    * the License. You may obtain a copy of the License at:
    *                             www.st.com/SLA0044
    *
    ******************************************************************************
    */
  
  /* USER CODE BEGIN STM32TouchController */
  
  #include "XPT2046.h"
  
  //extern void XPT2046_GetTouchPoint(uint16_t *X, uint16_t *Y);
  
  #include <STM32TouchController.hpp>
  
  uint16_t Xread, Yread;
  
  void STM32TouchController::init()
  {
      /**
       * Initialize touch controller and driver
       *
       */
  }
  
  bool STM32TouchController::sampleTouch(int32_t& x, int32_t& y)
  {
      /**
       * By default sampleTouch returns false,
       * return true if a touch has been detected, otherwise false.
       *
       * Coordinates are passed to the caller by reference by x and y.
       *
       * This function is called by the TouchGFX framework.
       * By default sampleTouch is called every tick, this can be adjusted by HAL::setTouchSampleRate(int8_t);
       *
       */
  	if(TouchState==XPT2046_TOUCHED)
  	{
  		XPT2046_GetTouchPoint(&Xread,&Yread);
  		    x=Xread;
  		    y=Yread;
  		    return true;
  	}
      return false;
  }
  
  /* USER CODE END STM32TouchController */
  
  /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
  