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

#include <Adafruit_I2C_LCD_Backpack.hh>

Inheritance diagram for Adafruit_I2C_LCD_Backpack:
Inheritance graph
Collaboration diagram for Adafruit_I2C_LCD_Backpack:
Collaboration graph

Classes

union  port_t
 

Public Member Functions

 Adafruit_I2C_LCD_Backpack (uint8_t subaddr=0)
 
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 Types

enum  InterruptMode { DISABLE = 0, ON_CHANGE = 1, ON_FALLING = 2, ON_RISING = 3 }
 
enum  {
  IODIR = 0x00, IPOL = 0x01, GPINTEN = 0x02, DEFVAL = 0x03,
  INTCON = 0x04, IOCON = 0x05, GPPU = 0x06, INTF = 0x07,
  INTCAP = 0x08, GPIO = 0x09, OLAT = 0x0a, REG_MAX = 0x0b
}
 
enum  {
  INTPOL = 1, ODR = 2, HAEN = 3, DISSLW = 4,
  SEQOP = 5
}
 

Private Member Functions

bool begin ()
 
bool data_direction (uint8_t iodir)
 
bool pullup (uint8_t gppu)
 
bool input_pin (uint8_t pin)
 
bool pullup_pin (uint8_t pin)
 
bool interrupt_pin (uint8_t pin, InterruptMode mode)
 
bool output_pin (uint8_t pin)
 
bool read_pin (uint8_t pin)
 
bool write_pin (uint8_t pin, uint8_t value)
 
uint8_t read ()
 
bool read (void *buf, size_t size)
 
bool write (uint8_t value)
 
bool write (void *buf, size_t size)
 

Private Attributes

uint8_t m_iodir
 
uint8_t m_gpinten
 
uint8_t m_defval
 
uint8_t m_intcon
 
uint8_t m_gppu
 
uint8_t m_olat
 
uint8_t m_reg
 

Static Private Attributes

static const uint8_t SUBADDR_MASK = 0x07
 
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 Adafruit I2C LCD Backpack with MCP23008 I2C IO expander device driver.

Circuit

Adafruit I2C LCD Backpack/MCP23008
+------------+
(SCL)---------------1-|SCL VCC|-18--------------(VCC)
(SDA)---------------2-|SDA GP7|-17--------------(LCD/BT)
(VCC)----[ ]--------3-|A2 GP6|-16--------------(LCD/D7)
(VCC)----[ ]--------4-|A1 GP5|-15--------------(LCD/D6)
(VCC)----[ ]--------5-|A0 GP4|-14--------------(LCD/D5)
(VCC)---------------6-|RESET/ GP3|-13--------------(LCD/D4)
7-|NC GP2|-12--------------(LCD/EN)
(EXT)---------------8-|INT GP1|-11--------------(LCD/RS)
(GND)---------------9-|GND GP0|-10--------------(NC)
+------------+

References

  1. https://learn.adafruit.com/i2c-spi-lcd-backpack/overview

Definition at line 51 of file Adafruit_I2C_LCD_Backpack.hh.

Constructor & Destructor Documentation

Adafruit_I2C_LCD_Backpack::Adafruit_I2C_LCD_Backpack ( uint8_t  subaddr = 0)
inline

Construct HD44780 IO port handler using the Adafruit I2C LCD Backpack with given sub-address (A0..A2).

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

Definition at line 58 of file Adafruit_I2C_LCD_Backpack.hh.

Member Function Documentation

void Adafruit_I2C_LCD_Backpack::set_backlight ( uint8_t  flag)
virtual

Set backlight on/off.

Parameters
[in]flag.

Implements HD44780::IO.

Definition at line 93 of file Adafruit_I2C_LCD_Backpack.cpp.

void Adafruit_I2C_LCD_Backpack::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 87 of file Adafruit_I2C_LCD_Backpack.cpp.

bool Adafruit_I2C_LCD_Backpack::setup ( )
virtual

Initiate TWI interface. Returns false.

Returns
bool.

Implements HD44780::IO.

Definition at line 24 of file Adafruit_I2C_LCD_Backpack.cpp.

void Adafruit_I2C_LCD_Backpack::write4b ( uint8_t  data)
virtual

Write nibble to display using TWI interface.

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

Implements HD44780::IO.

Definition at line 32 of file Adafruit_I2C_LCD_Backpack.cpp.

void Adafruit_I2C_LCD_Backpack::write8b ( uint8_t  data)
virtual

Write byte (8bit) to display.

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

Reimplemented from HD44780::IO.

Definition at line 44 of file Adafruit_I2C_LCD_Backpack.cpp.

void Adafruit_I2C_LCD_Backpack::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 61 of file Adafruit_I2C_LCD_Backpack.cpp.

Member Data Documentation

port_t Adafruit_I2C_LCD_Backpack::m_port
protected

Port setting.

Definition at line 130 of file Adafruit_I2C_LCD_Backpack.hh.

const uint8_t Adafruit_I2C_LCD_Backpack::TMP_MAX = 32
staticprotected

Max size of temporary buffer for TWI message.

Definition at line 109 of file Adafruit_I2C_LCD_Backpack.hh.


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