19#ifndef TSC2046_TSC2046_HPP_
20#define TSC2046_TSC2046_HPP_
22#include "STM32SPIDevice.hpp"
77 TSC2046(SPI_HandleTypeDef *hspi, GPIO_TypeDef *csPort, uint16_t csPin);
87 void begin(uint32_t xPlateResistance = 400);
176 uint16_t readCoord(uint8_t channelSelect);
177 uint16_t readExtra(uint8_t channelSelect);
178 float effectiveVRef();
179 float readTemperatureKelvin();
180 static uint16_t extractTwelveBitValue(uint32_t registerValue);
183 uint32_t _xPlateResistance;
185 float _touchedThreshold;
186 bool _interruptsEnabled;
Wraps one SPI peripheral + chip-select pin into read/write/transfer operations, mirroring the hardwar...
STM32 HAL driver for a TI/Adafruit TSC2046 resistive touchscreen controller, reached over SPI via an ...
float readTemperatureF()
Same reading as readTemperatureC(), converted to degrees Fahrenheit.
void setVRef(float vref)
Sets the voltage connected to the TSC2046's VRef pin, if any.
TSC2046(SPI_HandleTypeDef *hspi, GPIO_TypeDef *csPort, uint16_t csPin)
Constructs the driver and its underlying STM32SPIDevice. Does not touch hardware – call begin() befor...
float readAuxiliaryVoltage()
float readBatteryVoltage()
void enableInterrupts(bool enable)
Enables or disables the TSC2046's own touch interrupt (IRQ pin pulled low on touch)....
TSC2046TouchPoint getPoint()
Reads the current touch position and pressure.
bool isTouched()
Determines if the touchscreen is currently being touched, based on the pressure value from getPoint()...
void setTouchedThreshold(float touchedThresholdOhms)
Sets the pressure threshold used by isTouched().
float readTemperatureC()
Reads the TSC2046's on-die temperature sensor, in degrees Celsius.
void begin(uint32_t xPlateResistance=400)
Initializes the driver. Call once before any other method.
One touch reading: raw X/Y position and a pressure-proportional resistance value.
int16_t x
Raw 12-bit X coordinate (0-4095). Meaningless if not touched.
int16_t y
Raw 12-bit Y coordinate (0-4095). Meaningless if not touched.