LCDGFX LCD display driver  1.2.0
Lightweight graphics library for SSD1306, SSD1325, SSD1327, SSD1331, SSD1351, SH1106, SH1107, IL9163, ST7735, ST7789, ILI9341, PCD8544 displays over I2C/SPI

Linear calibration mapping raw ADC counts from a resistive touch panel into screen pixel coordinates. More...

#include <touch.h>

Public Member Functions

void apply (int16_t rawX, int16_t rawY, int16_t &outX, int16_t &outY) const
 Apply the calibration to a pair of raw ADC samples. More...
 

Public Attributes

int16_t xMin = 200
 
int16_t xMax = 3900
 
int16_t yMin = 200
 
int16_t yMax = 3900
 
uint16_t screenWidth = 320
 
uint16_t screenHeight = 240
 
bool swapXY = false
 
bool invertX = false
 
bool invertY = false
 

Detailed Description

Linear calibration mapping raw ADC counts from a resistive touch panel into screen pixel coordinates.

The mapping is a per-axis affine transform:

screenX = (raw - rawMin) * screenW / (rawMax - rawMin)
screenY = (raw - rawMin) * screenH / (rawMax - rawMin)

with optional axis swap and per-axis inversion to handle different physical mountings of the touch panel relative to the display.

Definition at line 50 of file touch.h.

Member Function Documentation

◆ apply()

void TouchCalibration::apply ( int16_t  rawX,
int16_t  rawY,
int16_t &  outX,
int16_t &  outY 
) const
inline

Apply the calibration to a pair of raw ADC samples.

The result is clamped to [0, screenWidth-1] and [0, screenHeight-1]. Returns x and y by reference.

Definition at line 68 of file touch.h.


The documentation for this struct was generated from the following file: