Rpi-hw  0.7.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
rpihw::display::pcd8544 Class Reference

Philips PCD8544 LCD controller. More...

#include <pcd8544.hpp>

+ Inheritance diagram for rpihw::display::pcd8544:

Public Types

enum  Commands {
  DISPLAY = 0x08, FUNC = 0x20, YADDR = 0x40, XADDR = 0x80,
  TEMP = 0x04, BIAS = 0x10, VOP = 0x80
}
 The controller command set. More...
 
enum  Settings {
  DISPLAY_E = 0x01, DISPLAY_D = 0x04, FUNC_H = 0x01, FUNC_V = 0x02,
  FUNC_PD = 0x04, BIAS_BS0 = 0x01, BIAS_BS1 = 0x02, BIAS_BS2 = 0x04
}
 The controller command set (bit flags). More...
 
enum  DisplaySize { LCD_WIDTH = 84, LCD_HEIGHT = 48 }
 The size of the display.
 
enum  RamSize { DDRAM_WIDTH = LCD_WIDTH, DDRAM_HEIGHT = LCD_HEIGHT / 8, DDRAM_SIZE = DDRAM_WIDTH * DDRAM_HEIGHT }
 The size of the DDRAM.
 
enum  DataPin {
  DIN = 0, SCLK = 1, DC = 0, RST = 1,
  SCE = 2
}
 The controller data pins. More...
 
enum  Color { BLACK = 0, WHITE = 1 }
 The display colors.
 
- Public Types inherited from rpihw::designer< int8_t, bool, 1 >
enum  TextFlags
 Parameters of text.
 

Public Member Functions

 pcd8544 (uint8_t sclk, uint8_t sdin, uint8_t dc, uint8_t sce, uint8_t rst)
 Constructor method (4-bit mode). More...
 
virtual ~pcd8544 ()
 Destructor method.
 
void init (uint8_t contrast=80, bool inverse=false)
 Initializes the display. More...
 
void cmd (uint8_t data)
 Sends a command to the display. More...
 
void sendData (uint8_t data)
 Sends a data to the display. More...
 
void setContrast (uint8_t value)
 Sets the contrast of the display. More...
 
void setColor (bool color)
 Sets the foreground color. More...
 
bool getColor () const
 Gets the current foreground color. More...
 
void setPixel (int8_t x, int8_t y, bool color)
 Sets the color of a pixel. More...
 
bool getPixel (int8_t x, int8_t y) const
 Returns the color of a pixel. More...
 
uint16_t redraw ()
 Redraws the display. More...
 
void clear ()
 Clears the display.
 
- Public Member Functions inherited from rpihw::designer< int8_t, bool, 1 >
 designer (int8_twidth, int8_theight)
 Constructor method. More...
 
virtual ~designer ()
 Destructor method.
 
void setPenColor (const std::vector< bool > &color)
 Sets the pen color. More...
 
const std::vector< bool > & getPenColor () const
 Gets the current pen color. More...
 
virtual void setPenPosition (int8_tx, int8_ty)
 Sets the pen position. More...
 
void setFont (font::base &font)
 Sets the text font. More...
 
font::basegetFont () const
 Returns the current text font. More...
 
void drawPoint (int8_tx, int8_ty)
 Draws a point. More...
 
void drawLine (int8_tx0, int8_ty0, int8_tx1, int8_ty1)
 Draws a line. More...
 
void drawRect (int8_tx0, int8_ty0, int8_tx1, int8_ty1)
 Draws a rectangle. More...
 
void drawCircle (int8_tcx, int8_tcy, int8_tradius)
 Draws a circle. More...
 
void drawEllipse (int8_tcx, int8_tcy, int8_ta, int8_tb)
 Draws an ellipse. More...
 
void fillRect (int8_tx0, int8_ty0, int8_tx1, int8_ty1)
 Draws a filled rectangle. More...
 
void fillCircle (int8_tcx, int8_tcy, int8_tradius)
 Draws a filled circle. More...
 
void fillEllipse (int8_tcx, int8_tcy, int8_ta, int8_tb)
 Draws a filled ellipse. More...
 
void drawImage (const image::base< bool > &img)
 Draws an image. More...
 
void drawImage (int8_tx, int8_ty, const image::base< bool > &img)
 Moves the pen position and draws an image. More...
 
void drawText (char32_t charcode)
 Draws a character. More...
 
void drawText (int8_tx, int8_ty, char32_t charcode)
 Moves the pen position and draws a character. More...
 
void drawText (iterator it, iterator end)
 Draws a string. More...
 
void drawText (iterator it, iterator end, int8_twidth, int8_theight, uint8_t flags)
 Draws a multiline string. More...
 
void drawText (int8_tx, int8_ty, iterator it, iterator end)
 Moves the pen position and draws a string. More...
 
void drawText (int8_tx, int8_ty, iterator it, iterator end, int8_twidth, int8_theight, uint8_t flags)
 Moves the pen position and draws a multiline string. More...
 
void drawText (const std::string &text)
 Draws a string. More...
 
void drawText (const std::string &text, int8_twidth, int8_theight, uint8_t flags=ALIGN_LEFT)
 Draws a multiline string. More...
 
void drawText (int8_tx, int8_ty, const std::string &text)
 Moves the pen position and draws a string. More...
 
void drawText (int8_tx, int8_ty, const std::string &text, int8_twidth, int8_theight, uint8_t flags=ALIGN_LEFT)
 Moves the pen position and draws a multiline string. More...
 
void drawText (const std::u32string &text)
 Draws a unicode string. More...
 
void drawText (const std::u32string &text, int8_twidth, int8_theight, uint8_t flags=ALIGN_LEFT)
 Draws a multiline unicode string. More...
 
void drawText (int8_tx, int8_ty, const std::u32string &text)
 Moves the pen position and draws a unicode string. More...
 
void drawText (int8_tx, int8_ty, const std::u32string &text, int8_twidth, int8_theight, uint8_t flags=ALIGN_LEFT)
 Moves the pen position and draws a multiline unicode string. More...
 

Protected Member Functions

void updateBoundingBox (uint8_t left, uint8_t top, uint8_t right, uint8_t bottom)
 Updates the bounding box. More...
 
virtual void drawPixel (int8_t x, int8_t y, color_iterator< bool > color)
 Sets the color of a pixel. More...
 
- Protected Member Functions inherited from rpihw::designer< int8_t, bool, 1 >
void drawChar (char32_t charcode)
 Draws a character. More...
 
void drawCirclePoints (int8_tcx, int8_tcy, int8_tx, int8_ty)
 Draws the symmetric points of the circle.
 
void drawCircleAreas (int8_tcx, int8_tcy, int8_tx, int8_ty)
 Draws the symmetric areas of the circle.
 
void drawEllipsePoints (int8_tcx, int8_tcy, int8_tx, int8_ty)
 Draws the symmetric points of the ellipse.
 
void drawEllipseAreas (int8_tcx, int8_tcy, int8_tx, int8_ty)
 Draws the symmetric areas of the ellipse.
 

Protected Attributes

iface::outputm_control
 Output interface to the control pins.
 
iface::shiftOutm_data
 Shift-out interface to the data pins.
 
std::vector< uint8_t > m_buffer
 Data buffer.
 
std::vector< bool > m_updates
 Buffer of updates.
 
- Protected Attributes inherited from rpihw::designer< int8_t, bool, 1 >
std::vector< bool > m_color
 Foreground color.
 
font::basem_font
 Text font.
 
int8_t m_area_w
 Size of the drawing area.
 
int8_t m_area_h
 
int8_t m_pos_x
 Pen position.
 
int8_t m_pos_y
 

Detailed Description

Philips PCD8544 LCD controller.

Examples:
display/pcd8544.cpp.

Definition at line 48 of file pcd8544.hpp.

Member Enumeration Documentation

The controller command set.

Enumerator
DISPLAY 

Display control.

FUNC 

Function set.

YADDR 

Set Y address of RAM.

XADDR 

Set Y address of RAM.

TEMP 

Temperature control.

BIAS 

Bias system.

VOP 

Set Vop.

Definition at line 53 of file pcd8544.hpp.

The controller data pins.

Enumerator
DIN 

Serial data input.

SCLK 

Input for the clock signal.

DC 

Data/Command mode select.

RST 

External rst input.

SCE 

Chip Enable (CS/SS).

Definition at line 96 of file pcd8544.hpp.

The controller command set (bit flags).

Enumerator
DISPLAY_E 

Sets display configuration.

DISPLAY_D 

Sets display configuration.

FUNC_H 

Extended instruction set.

FUNC_V 

Entry mode.

FUNC_PD 

Power down control.

BIAS_BS0 

Set bias system.

BIAS_BS1 

Set bias system.

BIAS_BS2 

Set bias system.

Definition at line 66 of file pcd8544.hpp.

Constructor & Destructor Documentation

rpihw::display::pcd8544::pcd8544 ( uint8_t  sclk,
uint8_t  sdin,
uint8_t  dc,
uint8_t  sce,
uint8_t  rst 
)

Constructor method (4-bit mode).

Parameters
[in]sclkThe GPIO pin connected to the sclk pin.
[in]sdinThe GPIO pin connected to the sda pin.
[in]dcThe GPIO pin connected to the dorc pin.
[in]sceThe GPIO pin connected to the cs pin.
[in]rstThe GPIO pin connected to the rst pin.

Member Function Documentation

void rpihw::display::pcd8544::cmd ( uint8_t  data)

Sends a command to the display.

Parameters
[in]dataThe command.
virtual void rpihw::display::pcd8544::drawPixel ( int8_t  x,
int8_t  y,
color_iterator< bool >  color 
)
protectedvirtual

Sets the color of a pixel.

Parameters
[in]xThe horizontal position of the pixel.
[in]yThe vertical position of the pixel.
[in]colorAn iterator to the color data.

Implements rpihw::designer< int8_t, bool, 1 >.

bool rpihw::display::pcd8544::getColor ( ) const
inline

Gets the current foreground color.

Returns
The foreground color.

Definition at line 37 of file pcd8544-inl.hpp.

bool rpihw::display::pcd8544::getPixel ( int8_t  x,
int8_t  y 
) const

Returns the color of a pixel.

Parameters
[in]xThe horizontal position of the pixel.
[in]yThe vertical position of the pixel.
Returns
The pixel color.
void rpihw::display::pcd8544::init ( uint8_t  contrast = 80,
bool  inverse = false 
)

Initializes the display.

Parameters
[in]contrastThe contrast of the display.
[in]inverseInvert the colors of the display.
Examples:
display/pcd8544.cpp.
uint16_t rpihw::display::pcd8544::redraw ( )

Redraws the display.

Returns
The number of updated blocks.
Examples:
display/pcd8544.cpp.
void rpihw::display::pcd8544::sendData ( uint8_t  data)

Sends a data to the display.

Parameters
[in]dataThe 8-bit data to be sended.
void rpihw::display::pcd8544::setColor ( bool  color)
inline

Sets the foreground color.

Parameters
[in]colorThe new foreground color.

Definition at line 30 of file pcd8544-inl.hpp.

void rpihw::display::pcd8544::setContrast ( uint8_t  value)

Sets the contrast of the display.

Parameters
[in]valueThe contrast of the display.
void rpihw::display::pcd8544::setPixel ( int8_t  x,
int8_t  y,
bool  color 
)
inline

Sets the color of a pixel.

Parameters
[in]xThe horizontal position of the pixel.
[in]yThe vertical position of the pixel.
[in]colorThe new pixel color.

Definition at line 44 of file pcd8544-inl.hpp.

void rpihw::display::pcd8544::updateBoundingBox ( uint8_t  left,
uint8_t  top,
uint8_t  right,
uint8_t  bottom 
)
protected

Updates the bounding box.

Parameters
[in]leftThe left side of the bounding box.
[in]topThe top side of the bounding box.
[in]rightThe right side of the bounding box.
[in]bottomThe bottom side of the bounding box.

The documentation for this class was generated from the following files: