|
F439_CPP_SPI_RA8875_TFT_LCD_03 1.0
STM32F439 SPI RA8875 7-inch TFT display demo built on the STM32_GFX and STM32_RA8875 libraries
|
C-callable entry points into the C++ RA8875 display code. More...
#include "main.h"Go to the source code of this file.
Functions | |
| void | initTest (SPI_HandleTypeDef *halSPI) |
| Creates the display object and starts the RA8875 controller. | |
| void | testLCD (bool buildTest) |
| Runs one of the two display demonstrations. | |
C-callable entry points into the C++ RA8875 display code.
The CubeMX-generated main.c is plain C, so it cannot create or call the C++ Adafruit_RA8875 object directly. This header declares the small set of extern "C" functions that main.c calls instead; their bodies are in entryPointCPP.cpp, which owns the display object.
Created on: Jan 26, 2025 Author: johng
Definition in file entryPointCPP.hpp.
| void initTest | ( | SPI_HandleTypeDef * | halSPI | ) |
Creates the display object and starts the RA8875 controller.
| halSPI | Handle of the SPI peripheral wired to the display (SPI1 here, set up by CubeMX as master, full duplex, 8-bit, mode 0, MSB first, software NSS). |
Constructs an Adafruit_RA8875 with the SPI handle and the CS (RA8875_CS_*) and RESET (LCD_RESET_*) pins from main.h, then calls Adafruit_RA8875::begin() for an 800x480 panel. begin() sets CS high, pulses RESET, reads the chip ID (it must be 0x75), initialises the controller and raises the SPI clock, so nothing else needs to be done here. Prints "RA8875 Found" on the redirected USART; if the chip does not answer it prints a message and calls Error_Handler(). The WAIT and INT pins are not used.
MX_..._Init() calls, inside a USER CODE section. The object is created with new at this point, not as a global, so it is not constructed before the clocks and the SPI peripheral exist. Definition at line 21 of file entryPointCPP.cpp.
References Adafruit_RA8875::begin(), initTest(), and RA8875_800x480.
Referenced by initTest(), and main().
| void testLCD | ( | bool | buildTest | ) |
Runs one of the two display demonstrations.
| buildTest | true runs the graphics demo, false runs the text demo. |
The graphics demo turns the display on, enables the backlight output, fills the screen with seven colours in turn, then draws a circle, rectangles, a rounded rectangle, single pixels, a line, triangles, ellipses and curves using the RA8875's hardware drawing commands. The text demo clears the screen, switches to the controller's text mode and prints "Hello, World!" in several foreground and background colours and four enlargement sizes, with a blinking cursor. Progress is printed on the redirected USART. If PWM is defined at build time, the graphics demo also sweeps the PWM1 output down and up; it is compiled out by default because on Adafruit's board PWM1 does not reach the backlight (see the Adafruit_RA8875 documentation).
Definition at line 33 of file entryPointCPP.cpp.
References Adafruit_RA8875::cursorBlink(), Adafruit_RA8875::displayOn(), Adafruit_RA8875::drawCircle(), Adafruit_RA8875::drawCurve(), Adafruit_RA8875::drawEllipse(), Adafruit_RA8875::drawLine(), Adafruit_RA8875::drawPixel(), Adafruit_RA8875::drawRect(), Adafruit_RA8875::drawTriangle(), Adafruit_RA8875::fillCircle(), Adafruit_RA8875::fillCurve(), Adafruit_RA8875::fillEllipse(), Adafruit_RA8875::fillRect(), Adafruit_RA8875::fillRoundRect(), Adafruit_RA8875::fillScreen(), Adafruit_RA8875::fillTriangle(), Adafruit_RA8875::GPIOX(), Adafruit_RA8875::graphicsMode(), Adafruit_RA8875::PWM1config(), Adafruit_RA8875::PWM1out(), RA8875_BLACK, RA8875_BLUE, RA8875_CYAN, RA8875_GREEN, RA8875_MAGENTA, RA8875_PWM_CLK_DIV1024, RA8875_RED, RA8875_WHITE, RA8875_YELLOW, testLCD(), Adafruit_RA8875::textColor(), Adafruit_RA8875::textEnlarge(), Adafruit_RA8875::textMode(), Adafruit_RA8875::textSetCursor(), Adafruit_RA8875::textTransparent(), and Adafruit_RA8875::textWrite().