/* Reads the current Z/pressure level using the ADC.  */
void tsReadZ(uint32_t *z1, uint32_t *z2)
/* Reads the current Z/pressure level using the ADC.  */
void tsReadZ(uint32_t *z1, uint32_t *z2)
{
  if (!_tsInitialised) tsInit();
  TS_XM_FUNC_GPIO;
  TS_YP_FUNC_GPIO;
  TS_YM_FUNC_GPIO;
  gpioSetDir (TS_XM_PORT, TS_XM_PIN, 1);
  gpioSetDir (TS_YP_PORT, TS_YP_PIN, 1);
  gpioSetDir (TS_YM_PORT, TS_YM_PIN, 0);
  gpioSetValue(TS_XM_PORT, TS_XM_PIN, 0);
  gpioSetValue(TS_YP_PORT, TS_YP_PIN, 1);
  TS_XP_FUNC_ADC;
  *z1 = adcRead(TS_XP_ADC_CHANNEL);
  TS_XP_FUNC_GPIO;
  gpioSetDir (TS_YM_PORT, TS_YM_PIN, 0);
  TS_YM_FUNC_ADC;
  *z2 = adcRead(TS_YM_ADC_CHANNEL);
}