PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
HD44780_Demo.cpp

Utilize the PropWare::Printer class to print formatted text to an LCD

cmake_minimum_required(VERSION 3.12)
find_package(PropWare REQUIRED)
project(HD44780_Demo)
create_simple_executable(${PROJECT_NAME} HD44780_Demo.cpp)
// Control pins
static const Port::Mask RS = Port::Mask::P16;
static const Port::Mask RW = Port::Mask::P17;
static const Port::Mask EN = Port::Mask::P18;
// Data pins
static const Pin::Mask FIRST_DATA_PIN = Pin::Mask::P19;
static const HD44780::BusWidth BITMODE = HD44780::BusWidth::WIDTH8;
static const HD44780::Dimensions DIMENSIONS = HD44780::Dimensions::DIM_16x2;
int main () {
// Create and initialize our LCD object
HD44780 lcd(FIRST_DATA_PIN, RS, RW, EN, BITMODE, DIMENSIONS);
lcd.start();
// Create a printer for easy, formatted writing to the LCD
Printer lcdPrinter(lcd);
// Print to the LCD (exactly 32 characters so that we fill up both lines)
lcdPrinter.printf("%u %s%d 0x%07X", 123456789, "Hello!", -12345, 0xabcdef);
return 0;
}
printer.h
PropWare::Pin
Utility class to handle general purpose I/O pins.
Definition: pin.h:36
PropWare::Port
Flexible port that can have any pin enabled or disabled. Pins are independent of each other.
Definition: port.h:38
main
int main(void)
Definition: GraphicsTest.c:20
PropWare.h
hd44780.h
PropWare::HD44780
Support for the common "character LCD" modules using the HD44780 controller for the Parallax Propelle...
Definition: hd44780.h:43
PropWare::Printer
Container class that has formatting methods for human-readable output. This class can be constructed ...
Definition: printer.h:76
PropWare
Generic definitions and functions for the Parallax Propeller.
Definition: runnable.h:33
BITMODE
static const SPI::BitMode BITMODE
Definition: SPI_Demo.cpp:50