Basic TouchGFX Project with Monochrome SPI E-Paper Display
Hello,
I`m trying to get TouchGFX run on a Nucleo Board and with a monochrome E-Paper Display via SPI. For the first "Hello World" I want to use the full refresh from the E-Paper Display to show the Single Framebuffer. Maybe only refreshed when Button is clicked or periodically with a Timer Interrupt. I used mostly this Tutorial as a Guide.
In order to do that I did the following Steps:
- Start a new Project with TouchGFX, SPI and working E-Paper Driver
- Created "Hello World " in the Designer (white Box in the Background and a black Label)
- Setting up Timer with Interrupt ~ every 4 sec (tried with LED, so this is working)
- Ive put the following Code in the TouchGFXGeneratedHAL.cpp (not perfect but otherwise I got the error that the function touchgfxSignalVSync is unknown) and called it from the interrupt
extern "C"
void touchgfxSignalVSync(void)
{
/* VSync has occurred, increment TouchGFX engine vsync counter */
touchgfx::HAL::getInstance()->vSync();
/* VSync has occurred, signal TouchGFX engine */
touchgfx::OSWrappers::signalVSync();
}
----- Code Interrupt main.c -----
extern void touchgfxSignalVSync(void);
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
if (htim->Instance == TIM16) {
touchgfxSignalVSync();
}
}
- After that I just took the data transfer files from the tutorial. Ive commented the Callback out, because my Driver is blocking right now (I want to change that when minimum setup is working). And I just ignored the blocks, because I want to do only full refresh.
the data transfer File:
/* Functions called by the TouchGFX HAL to invoke the actual data transfer to ILI9341.
* Pero, 2021
*/
#include "../EPD_GD42_HW_SPI_DRIVER/epd_gd42_hw_spi_driver.h"
#include "TouchGFX_DataTransfer.h"
extern void DisplayDriver_TransferCompleteCallback();
static uint8_t isTransmittingData = 0;
uint32_t touchgfxDisplayDriverTransmitActive(void)
{
return isTransmittingData;
}
void touchgfxDisplayDriverTransmitBlock(uint8_t* pixels, uint16_t x, uint16_t y, uint16_t w, uint16_t h)
{
isTransmittingData = 1;
EPD_HW_Init();
EPD_WhiteScreen_ALL(pixels);
EPD_DeepSleep();
isTransmittingData = 0;
}
#if 0
void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi)
{
if (hspi->Instance == SPI1) {
ILI9341_EndOfDrawBitmap();
isTransmittingData = 0;
DisplayDriver_TransferCompleteCallback();
}
}
#endif
//----------- Header file is like in the Tutorial -----------
...
#ifdef __cplusplus
extern "C" {
#endif
void touchgfxDisplayDriverTransmitBlock(uint8_t* pixels, uint16_t x, uint16_t y, uint16_t w, uint16_t h);
uint32_t touchgfxDisplayDriverTransmitActive(void);
...
So right now the Project is running, but nothing really happens. The code is in a loop between isVSyncAvailable and the Hal.backPorchExited(); in the touchgfx_taskEntry();
What are the right steps to implement just a flush for the complete Display? And did I implemented the signalVSync right?
Maybe I should implement only the flushDisplay Function? But how and where in the DataTransfer/TouchGFXHAL File? And if u have some ideas on how to implement both full and partial refresh I would like to hear some advice. But first I want to figure out how I can get this to work.
Ive verified that the Timer Interrupt and the Display Driver and Connections are working in this project.
I'm new to TouchGFX and still trying to get the Basics. The Documentation is good, but I didn't understood it completely for SPI and this special case. Thank you so much in advance!
