Example #1
0
tsTouchData_t tsRenderCalibrationScreen(uint16_t x, uint16_t y, uint16_t radius)
{
  drawFill(COLOR_WHITE);
  tsCalibCenterText(TS_LINE1, 50, COLOR_GRAY_50);
  tsCalibCenterText(TS_LINE2, 65, COLOR_GRAY_50);
  tsCalibCenterText(TS_LINE3, 80, COLOR_GRAY_50);
  drawCircle(x, y, radius, COLOR_RED);
  drawCircle(x, y, radius + 2, COLOR_GRAY_128);

  // Wait for a valid touch events
  tsTouchData_t data;
  tsTouchError_t error;
  bool valid = false;
  while (!valid)
  {    
    // Set calibration flag for ts read
    error = tsRead(&data, true);
    if (!error && data.valid)
    {
      valid = true;
    }
  }

  return data;
}
Example #2
0
void tsRenderCalibrationScreen(uint16_t x, uint16_t y, uint16_t radius)
{

  drawFill(COLOR_WHITE);
  tsCalibCenterText(TS_LINE1, 50, COLOR_DARKGRAY);
  tsCalibCenterText(TS_LINE2, 65, COLOR_DARKGRAY);
  tsCalibCenterText(TS_LINE3, 80, COLOR_DARKGRAY);
  drawCircle(x, y, radius, COLOR_RED);
  drawCircle(x, y, radius + 2, COLOR_MEDIUMGRAY);

  // Wait for touch
  uint32_t z1, z2;
  z1 = z2 = 0;
  while (z2 < CFG_TFTLCD_TS_THRESHOLD) 
    tsReadZ(&z1, &z2);
}