Learning to display characters on a display

Looking at an Adafruit_GFX example to figure out how to display characters on a display with print("Something"); I ran across this class specification with an unfamiliar form.

class Adafruit_GFX : public Print 
{

public:
  Adafruit_GFX(int16_t w, int16_t h); // Constructor

What does the ": public print" after that class name do?

I looked up C++ class specifier and it does not show anything between the class name and opening {.

class class_name {
access_specifier_1:
member1;
access_specifier_2:
member2;
...
} object_names;

It means the class inherits from the Print class.

Thank you!

Learning to display characters on a display

most displays have a print() to display a string.

what kind of display do you have?

most display libraries inherit all print/println() functions from the print class.
The library inheriting from print just needs to implement the write() of one character. All variants print/println are reused from print.h

My display is from SKPang and it has a Teensy 4.0 on an integrated board. I managed to get a DisplayClass built that can do graphics on it, but the Print is a real challenge to me.

Teensy 4.0 NMEA 2000 MFD with 800x480 5" Touch LCD — SK Pang Electronics Ltd

This is what I have accomplished so far, mostly from altering the supplied code and Adafruit's GFX code. It uses the SSD1963 chip.

IIRC,there is only one function to implement - "write", to draw the single provided character on the screen.
Everything else comes for free.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.