COSA
An Object-Oriented Platform for Arduino Programming
DFRobot_IIC_LCD_Module Class Reference

#include <DFRobot_IIC_LCD_Module.hh>

Inheritance diagram for DFRobot_IIC_LCD_Module:
Inheritance graph
Collaboration diagram for DFRobot_IIC_LCD_Module:
Collaboration graph

Classes

union  port_t
 

Public Member Functions

 DFRobot_IIC_LCD_Module (uint8_t subaddr=7)
 
virtual bool setup ()
 
virtual void write4b (uint8_t data)
 
virtual void write8b (uint8_t data)
 
virtual void write8n (const void *buf, size_t size)
 
virtual void set_mode (uint8_t flag)
 
virtual void set_backlight (uint8_t flag)
 

Protected Attributes

port_t m_port
 Port setting. More...
 

Static Protected Attributes

static const uint8_t TMP_MAX = 32
 

Private Member Functions

bool data_direction (uint8_t ddr)
 
bool input_pin (uint8_t pin)
 
bool output_pin (uint8_t pin)
 
bool read (uint8_t pin)
 
uint8_t read ()
 
bool write (uint8_t pin, uint8_t value)
 
bool write (uint8_t value)
 
bool write (void *buf, size_t size)
 

Private Attributes

uint8_t m_ddr
 

Static Private Attributes

static const uint8_t PIN_MASK = 0x07
 

Detailed Description

IO handler for HD44780 (LCD-II) Dot Matix Liquid Crystal Display Controller/Driver when using the DFRobot IO expander board based on PCF8574 I2C IO expander device driver.

Circuit

PCF8574/DFRobot
+------U-----+
(GND)---[ ]---------1-|A0 VCC|-16--------------(VCC)
(GND)---[ ]---------2-|A1 SDA|-15-----------(SDA/A4)
(GND)---[ ]---------3-|A2 SCL|-14-----------(SCL/A5)
(LCD/RS)------------4-|P0 INT|-13
(LCD/RW)------------5-|P1 P7|-12-----------(LCD/D7)
(LCD/EN)------------6-|P2 P6|-11-----------(LCD/D6)
(LCD/BT)------------7-|P3 P5|-10-----------(LCD/D5)
(GND)---------------8-|GND P4|-9------------(LCD/D4)
+------------+

Definition at line 47 of file DFRobot_IIC_LCD_Module.hh.

Constructor & Destructor Documentation

DFRobot_IIC_LCD_Module::DFRobot_IIC_LCD_Module ( uint8_t  subaddr = 7)
inline

Construct HD44780 IO port handler using the DFRobot I2C/TWI I/O expander with given sub-address (A0..A2).

Parameters
[in]subaddrsub-address (0..7, default 7).

Definition at line 54 of file DFRobot_IIC_LCD_Module.hh.

Member Function Documentation

void DFRobot_IIC_LCD_Module::set_backlight ( uint8_t  flag)
virtual

Set backlight on/off.

Parameters
[in]flag.

Implements HD44780::IO.

Definition at line 92 of file DFRobot_IIC_LCD_Module.cpp.

void DFRobot_IIC_LCD_Module::set_mode ( uint8_t  flag)
virtual

Set instruction/data mode; zero for instruction, non-zero for data mode.

Parameters
[in]flag.

Implements HD44780::IO.

Definition at line 86 of file DFRobot_IIC_LCD_Module.cpp.

bool DFRobot_IIC_LCD_Module::setup ( )
virtual

Initiate TWI interface. Returns false.

Returns
bool.

Implements HD44780::IO.

Definition at line 24 of file DFRobot_IIC_LCD_Module.cpp.

void DFRobot_IIC_LCD_Module::write4b ( uint8_t  data)
virtual

Write nibble to display using TWI interface.

Parameters
[in]data(4b) to write.

Implements HD44780::IO.

Definition at line 31 of file DFRobot_IIC_LCD_Module.cpp.

void DFRobot_IIC_LCD_Module::write8b ( uint8_t  data)
virtual

Write byte (8bit) to display.

Parameters
[in]data(8b) to write.

Reimplemented from HD44780::IO.

Definition at line 43 of file DFRobot_IIC_LCD_Module.cpp.

void DFRobot_IIC_LCD_Module::write8n ( const void *  buf,
size_t  size 
)
virtual

Write character buffer to display.

Parameters
[in]bufpointer to buffer.
[in]sizenumber of bytes in buffer.

Reimplemented from HD44780::IO.

Definition at line 60 of file DFRobot_IIC_LCD_Module.cpp.

Member Data Documentation

port_t DFRobot_IIC_LCD_Module::m_port
protected

Port setting.

Definition at line 123 of file DFRobot_IIC_LCD_Module.hh.

const uint8_t DFRobot_IIC_LCD_Module::TMP_MAX = 32
staticprotected

Max size of temporary buffer for TWI message.

Definition at line 102 of file DFRobot_IIC_LCD_Module.hh.


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