prenticedavid / MCUFRIEND_kbv

MCUFRIEND_kbv Library for Uno 2.4, 2.8, 3.5, 3.6, 3.95 inch mcufriend Shields
Other
363 stars 181 forks source link

Where is println method used in MCUFRIEND_kbv/examples/aspect_kbv/aspect_kbv.ino #179

Closed andrejmz closed 3 years ago

andrejmz commented 3 years ago

Hi

It's more a question than an issue really, i apologise in advance if i lack c++ (that's not my main language) basic knowledge. I cant find the definition of println ( tft.println(msg[aspect]); ) in MCUFRIEND_kbv.cpp or Adafruit_GFX.cpp

best regards.

prenticedavid commented 3 years ago

Adafruit_GFX inherits from Print (and Stream) classes. e.g. overloaded print() and println() functions

Serial and many other "display" classes inherit from Print.h Hence you get the same behaviour for tft.print(1234, HEX) as Serial.print(1234, HEX) as lcd.print(1234, HEX)

Multiple inheritance is one of the best things about C++ However it does mean that your target needs Print.h, WString.h, ...

The actual mechanism that sends the print() characters to the output device is the write() function.

It also means that converting a C++ library to C gets messy.

David.

andrejmz commented 3 years ago

Ok thanks!