COSA
An Object-Oriented Platform for Arduino Programming
Adafruit_I2C_LCD_Backpack.hh
Go to the documentation of this file.
1 
21 #ifndef COSA_ADAFRUIT_I2C_LCD_BACKPACK_HH
22 #define COSA_ADAFRUIT_I2C_LCD_BACKPACK_HH
23 
24 #include <HD44780.h>
25 #include <MCP23008.h>
26 
52 public:
58  Adafruit_I2C_LCD_Backpack(uint8_t subaddr = 0) :
59  MCP23008(subaddr),
60  m_port()
61  {}
62 
68  virtual bool setup();
69 
75  virtual void write4b(uint8_t data);
76 
82  virtual void write8b(uint8_t data);
83 
90  virtual void write8n(const void* buf, size_t size);
91 
98  virtual void set_mode(uint8_t flag);
99 
105  virtual void set_backlight(uint8_t flag);
106 
107 protected:
109  static const uint8_t TMP_MAX = 32;
110 
112  union port_t {
113  uint8_t as_uint8;
114  struct {
115  uint8_t nc:1;
116  uint8_t rs:1;
117  uint8_t en:1;
118  uint8_t data:4;
119  uint8_t bt:1;
120  };
121  operator uint8_t()
122  {
123  return (as_uint8);
124  }
126  {
127  as_uint8 = 0;
128  }
129  };
131 };
132 
133 #endif
virtual void write8b(uint8_t data)
virtual void set_backlight(uint8_t flag)
uint8_t rs
Command/Data select (GP1).
uint8_t as_uint8
Unsigned byte access.
virtual void write8n(const void *buf, size_t size)
virtual void set_mode(uint8_t flag)
Adafruit_I2C_LCD_Backpack(uint8_t subaddr=0)
virtual void write4b(uint8_t data)