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.c File Reference

Zone boundaries and classification for the printed panel layout. More...

#include "touchZones.h"

Go to the source code of this file.

Macros

#define TOUCH_X_MIN   300
 Lowest accepted raw X.
 
#define TOUCH_X_MAX   3700
 Highest accepted raw X.
 
#define TOUCH_Y_MIN   300
 Lowest accepted raw Y.
 
#define TOUCH_Y_MAX   3650
 Highest accepted raw Y.
 
#define TOUCH_X_SPLIT   2060
 Raw X that separates the OFF (left) half from the ON (right) half, from measured button centers.
 
#define TOUCH_Y_LED1_LED2   1285
 Raw Y boundary between the LED 1 row and the LED 2 row.
 
#define TOUCH_Y_LED2_LED3   2075
 Raw Y boundary between the LED 2 row and the LED 3 row.
 
#define TOUCH_Y_LED3_BEEP   2900
 Raw Y boundary between the LED 3 row and the BEEP row.
 

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

Zone boundaries and classification for the printed panel layout.

Created on: Sep 18, 2026 Author: johng

Definition in file touchZones.c.

Macro Definition Documentation

◆ TOUCH_X_MAX

#define TOUCH_X_MAX   3700

Highest accepted raw X.

Definition at line 17 of file touchZones.c.

Referenced by touchZoneFromPoint().

◆ TOUCH_X_MIN

#define TOUCH_X_MIN   300

Lowest accepted raw X.

Definition at line 15 of file touchZones.c.

◆ TOUCH_X_SPLIT

#define TOUCH_X_SPLIT   2060

Raw X that separates the OFF (left) half from the ON (right) half, from measured button centers.

Definition at line 24 of file touchZones.c.

Referenced by touchZoneFromPoint().

◆ TOUCH_Y_LED1_LED2

#define TOUCH_Y_LED1_LED2   1285

Raw Y boundary between the LED 1 row and the LED 2 row.

Definition at line 29 of file touchZones.c.

Referenced by touchZoneFromPoint().

◆ TOUCH_Y_LED2_LED3

#define TOUCH_Y_LED2_LED3   2075

Raw Y boundary between the LED 2 row and the LED 3 row.

Definition at line 31 of file touchZones.c.

Referenced by touchZoneFromPoint().

◆ TOUCH_Y_LED3_BEEP

#define TOUCH_Y_LED3_BEEP   2900

Raw Y boundary between the LED 3 row and the BEEP row.

Definition at line 33 of file touchZones.c.

Referenced by touchZoneFromPoint().

◆ TOUCH_Y_MAX

#define TOUCH_Y_MAX   3650

Highest accepted raw Y.

Definition at line 21 of file touchZones.c.

Referenced by touchZoneFromPoint().

◆ TOUCH_Y_MIN

#define TOUCH_Y_MIN   300

Lowest accepted raw Y.

Definition at line 19 of file touchZones.c.

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().