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

: Main program body More...

#include "main.h"
#include <stdio.h>
#include <math.h>
#include "entryPointCPP.hpp"
#include "touchZones.h"

Go to the source code of this file.

Macros

#define OUT_ON   GPIO_PIN_RESET
 Pin level that turns an output ON. LEDs are wired 5V -> resistor -> LED -> GPIO, so low = lit; the buzzer module sounds when its signal pin is low.
 
#define OUT_OFF   GPIO_PIN_SET
 Pin level that turns an output OFF (LED dark, buzzer silent).
 

Functions

static void outputsAllOff (void)
 Drives all three LEDs and the buzzer to their OFF level (LEDs dark, buzzer silent).
 
static void applyZoneAction (touchZone_t zone)
 Applies the action for a settled touch zone. LEDs latch: an ON zone turns that LED on and an OFF zone turns it off. The buzzer sounds only while the BEEP zone is held, so any non-BEEP zone silences it.
 
int main (void)
 The application entry point.
 

Detailed Description

: Main program body

Attention

Copyright (c) 2026 STMicroelectronics. All rights reserved.

This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is provided AS-IS.

Definition in file main.c.

Macro Definition Documentation

◆ OUT_OFF

#define OUT_OFF   GPIO_PIN_SET

Pin level that turns an output OFF (LED dark, buzzer silent).

Definition at line 46 of file main.c.

Referenced by applyZoneAction(), main(), and outputsAllOff().

◆ OUT_ON

#define OUT_ON   GPIO_PIN_RESET

Pin level that turns an output ON. LEDs are wired 5V -> resistor -> LED -> GPIO, so low = lit; the buzzer module sounds when its signal pin is low.

Definition at line 44 of file main.c.

Referenced by applyZoneAction().

Function Documentation

◆ applyZoneAction()

static void applyZoneAction ( touchZone_t zone)
static

Applies the action for a settled touch zone. LEDs latch: an ON zone turns that LED on and an OFF zone turns it off. The buzzer sounds only while the BEEP zone is held, so any non-BEEP zone silences it.

Parameters
zoneThe zone that just settled (see touchZoneFromPoint()).

Definition at line 504 of file main.c.

References OUT_OFF, and OUT_ON.

Referenced by main().

◆ main()

int main ( void )

The application entry point.

Return values
int

Definition at line 100 of file main.c.

References applyZoneAction(), initTSC2046(), OUT_OFF, outputsAllOff(), touchSelfTestRunAll(), touchZoneFromPoint(), touchZoneName(), and tsc2046GetPoint().

◆ outputsAllOff()

static void outputsAllOff ( void )
static

Drives all three LEDs and the buzzer to their OFF level (LEDs dark, buzzer silent).

Definition at line 490 of file main.c.

References OUT_OFF.

Referenced by main().