Derived from original work by Limor Fried/Ladyada for Adafruit Industries.
class BeagleBone::PCD8544: public rgb_driver
This class is a specialization of the abstract RGB driver class for the PCD8544.
The PCD8544 LCD controller is used in Nokia 5110 displays. These simple black and white displays are inexpensive and can be connected directly to the header expansion connectors of the BeagleBone without requiring any level shifters (see picture at the top of this page --VCC should be connected to the VDD_5V (Pins 5 or 6 on P8) and LED should be connected either to GND (off) or VDD_5V).
To make the class visible:
#include "bonelib/PCD8544.hpp"
PCD8544::PCD8544(gpio sclk, gpio din, gpio dc, gpio cs, gpio rst)
Create an instance of the class, with the SCLK, SDIN, D/C, SCE and RES inputs connected to the specified GPIO pins.
void PCD8544::begin(uint8_t constrast = 40)
Initialize the device with the specified contrast value.
void PCD8544::setContrast(uint8_t val)
Modify the contrast value to the specified value.
void PCD8544::command(uint8_t c)
Send the specified command to the device.
void PCD8544::data(uint8_t c)
Send the specified data to the device.
None.
BeagleBone::PCD8544 drv(BeagleBone::gpio::P8(46), // CLK
BeagleBone::gpio::P8(44), // DIN
BeagleBone::gpio::P8(42), // D/C
BeagleBone::gpio::P8(40), // CS
BeagleBone::gpio::P8(38)); // RST
drv.begin();
drv.clear();
drv.refresh();
// Draw a vertical line across the display
for (int x = 0; x < drv.get_width(); x++) {
drv.drawPixel(x, 5, BeagleBone::RGB::black);
}
drv.refresh();
Wiki: C++ User Documentation
Wiki: gpio.hpp
Wiki: rgb_driver.hpp