Skip to content

Header file on serial console

The header file on serial console library prints the screen as a header file on the serial console.

The header file is added to the source code and included in the project of the application at build-time. Once the application is built, it loads the image into the frame-buffer, ready to be displayed at run-time.

This method is recommended for MCUs, as the management of the SD-card is rather slow and prone to interferences.


Because the file library manages windows, it requires one of the PDLS_EXT3_Advanced_Fast_Large, PDLS_EXT3_Advanced_Fast_Medium, PDLS_EXT3_Advanced_Fast_Small and PDLS_EXT3_Advanced_Fast_Touch libraries.

The header file on serial console library is available on the advanced and commercial editions.


Ensure the screen is declared and initialised according to the configuration procedure.

#include "hV_File_Serial.h"

The pre-processor statement includes the file library.

No external SD library is required, as the header file is sent to the serial console.

File_Serial myFile(&myScreen);

The constructor File_Serial() sets the link to the screen.

As the header file is printed on the serial console, the SD-card doesn't need to be initialised.




saveScreenSerial() prints the screen as a header file on the serial console.

The required parameter is

  • The first line provides the name of the file without the .h extension.
    40, 71, 100, 50) // x y dx dy

saveWindowHeader() save a window on a header file on the SD-card as a header file.

The required parameters are

  • The first line provides the name of the file without the .h extension.

  • The second line defines the window with vector coordinates.

The coordinates are rounded as multiple of 8.

For example, the vector coordinates (70, 44, 155, 64) are changed to (70, 40, 155, 72).

The printed header file contains the structure Image_MyHeader.

Capture the content of the serial console and copy it into a header file, for example MyHeader.h.


To use the image on the header file, proceed as explained for the header file.


This is the core of the code from example File_Serial.ino.

void displayWriteConsole()
    // No SD-card initialisation required


    myScreen.gText(4, 4, "Image to be saved");

    char * text = "Hello!";

    uint16_t x, y, dx, dy;
    x = myScreen.screenSizeX();
    y = myScreen.screenSizeY();
    dx = myScreen.stringSizeX(text);
    dy = myScreen.characterSizeY();
    x = (x - dx) / 2;
    y = (y - dy) / 2;

    hV_HAL_Debug_println("xy= %i %i dxy= %i %i '%s'", x, y, dx, dy, text);

    myScreen.gText(x, y, text, myColours.white,;


    // Print to serial console
    myFile.saveWindowSerial("Hello", x, y, dx, dy);
The generated header file is the same as the file generated by the header file procedure.

Back to top