COSA
An Object-Oriented Platform for Arduino Programming
ERM1602_5.hh
Go to the documentation of this file.
1 
21 #ifndef COSA_ERM1602_5_HH
22 #define COSA_ERM1602_5_HH
23 
24 #include <HD44780.h>
25 #include "Cosa/OutputPin.hh"
26 
49 class ERM1602_5 : public HD44780::IO {
50 public:
59 #if !defined(BOARD_ATTINY)
64 #else
69 #endif
70 
76  virtual bool setup();
77 
83  virtual void write4b(uint8_t data);
84 
90  virtual void write8b(uint8_t data);
91 
98  virtual void write8n(const void* buf, size_t size);
99 
106  virtual void set_mode(uint8_t flag);
107 
113  virtual void set_backlight(uint8_t flag);
114 
115 protected:
117  static const uint16_t SHORT_EXEC_TIME = 20;
118 
123  uint8_t m_rs;
124  uint8_t m_dirty;
125 
129  void flush();
130 };
131 
132 #endif
uint8_t m_dirty
Mark register select change required.
Definition: ERM1602_5.hh:124
virtual void write4b(uint8_t data)
Definition: ERM1602_5.cpp:43
virtual void set_backlight(uint8_t flag)
Definition: ERM1602_5.cpp:91
virtual void set_mode(uint8_t flag)
Definition: ERM1602_5.cpp:83
virtual bool setup()
Definition: ERM1602_5.cpp:37
uint8_t m_rs
Register select (0/instruction, 1/data).
Definition: ERM1602_5.hh:123
OutputPin m_en
Starts data read/write.
Definition: ERM1602_5.hh:121
static const uint16_t SHORT_EXEC_TIME
Definition: ERM1602_5.hh:117
OutputPin m_scl
Serial clock.
Definition: ERM1602_5.hh:120
virtual void write8n(const void *buf, size_t size)
Definition: ERM1602_5.cpp:63
void flush()
Definition: ERM1602_5.cpp:97
ERM1602_5(Board::DigitalPin sda=Board::D7, Board::DigitalPin scl=Board::D6, Board::DigitalPin en=Board::D5, Board::DigitalPin bt=Board::D4)
Definition: ERM1602_5.cpp:23
OutputPin m_bt
Back-light control (0/on, 1/off).
Definition: ERM1602_5.hh:122
OutputPin m_sda
Serial data output.
Definition: ERM1602_5.hh:119
virtual void write8b(uint8_t data)
Definition: ERM1602_5.cpp:49