H753_CPP_SPI_Resistive_Touch_Screen_Controller 1.0
STM32H753 SPI resistive touchscreen (Adafruit 333 overlay + 5767 TSC2046 controller) driver and tutorial
Loading...
Searching...
No Matches
touchZones.h File Reference

Maps raw TSC2046 X/Y readings to the printed button zones on the panel overlay. More...

#include <stdint.h>

Go to the source code of this file.

Enumerations

enum  touchZone_t {
  TOUCH_ZONE_NONE = 0 , TOUCH_ZONE_LED1_OFF , TOUCH_ZONE_LED1_ON , TOUCH_ZONE_LED2_OFF ,
  TOUCH_ZONE_LED2_ON , TOUCH_ZONE_LED3_OFF , TOUCH_ZONE_LED3_ON , TOUCH_ZONE_BEEP
}
 The button zones on the printed panel, or TOUCH_ZONE_NONE for a point outside them. More...
 

Functions

touchZone_t touchZoneFromPoint (int16_t x, int16_t y)
 Classifies a raw touch position into a button zone.
 
const char * touchZoneName (touchZone_t zone)
 Gives a short printable name for a zone.
 

Detailed Description

Maps raw TSC2046 X/Y readings to the printed button zones on the panel overlay.

The panel has LED 1/2/3 buttons, each split OFF|ON, plus a full-width BEEP zone. Boundaries come from measured touches on the actual panel, not the printed geometry – resistive panels are not perfectly linear.

Created on: Sep 18, 2026 Author: johng

Definition in file touchZones.h.

Enumeration Type Documentation

◆ touchZone_t

The button zones on the printed panel, or TOUCH_ZONE_NONE for a point outside them.

Definition at line 23 of file touchZones.h.

Function Documentation

◆ touchZoneFromPoint()

touchZone_t touchZoneFromPoint ( int16_t x,
int16_t y )

Classifies a raw touch position into a button zone.

Parameters
xRaw 12-bit X (0-4095).
yRaw 12-bit Y (0-4095).
Return values
Thezone containing the point, or TOUCH_ZONE_NONE if it falls outside the calibrated active area.

Definition at line 35 of file touchZones.c.

References TOUCH_X_MAX, TOUCH_X_SPLIT, TOUCH_Y_LED1_LED2, TOUCH_Y_LED2_LED3, TOUCH_Y_LED3_BEEP, and TOUCH_Y_MAX.

Referenced by main().

◆ touchZoneName()

const char * touchZoneName ( touchZone_t zone)

Gives a short printable name for a zone.

Parameters
zoneThe zone to name.
Return values
Ashort printable name for the zone, e.g. "LED 2 ON", or "none" for TOUCH_ZONE_NONE.

Definition at line 55 of file touchZones.c.

Referenced by main().