writeByte() is the low-level operation to write a byte to the LCD in two parts of 4 bits. That is because the class uses the 4bit databus mode to control the LCD rather than the normal 8bit mode. This saves datapins on the mbed.
You can find the declaration of writeByte just above TextLCD::writeCommand.
void TextLCD::writeByte(int value) {
_d = value >> 4;
wait(0.000040f); // most instructions take 40us
_e = 0;
wait(0.000040f);
_e = 1;
_d = value >> 0;
wait(0.000040f);
_e = 0;
wait(0.000040f); // most instructions take 40us
_e = 1;
}
Depending on the value of the _rs bit a written byte will be interpreted by the LCD as either a command or a databyte (ie character in most cases).
TextLCD::_getc() needs to be implemented since TextLCD was defined as implementing the Stream protocol.
See TextLCD.h
class TextLCD : public Stream {
We want to have 'Stream' so that we can make free use of all the neat printf() formatting stuff :)
Stream needs implementations for _putc() and _getc().
The _putc() has been implemented to just send the character to the current LCD cursor location.
However, _getc() makes no sense for the LCD and it is implemented as a dummy just returning -1.
Hello Everyone, I'm getting my head round classes again after a LONG break. I'm using the TextLCD.h and Text.cpp file from Simon Ford as examples. I've got my head round naming classes, what member declaration is and member functions, what enumeration is, what public: and private: means but I'm at a loss with the following:-
What is the syntax DOXYGEN_ONLY ????
What do these three Private Member functions do? I've kind of understood a virtual function declaration as part of the polymorphism portion of OOP
Am I right in thinking that writeByte is a function? If it is I simply can't find it or I'm missing something fundamental.
Greatly appreciate any help here.