COSA
An Object-Oriented Platform for Arduino Programming
HD44780_SR3W.cpp
Go to the documentation of this file.
1 
21 #include "HD44780.hh"
22 
25  Board::DigitalPin en) :
26  m_port(),
27  m_sda(sda),
28  m_scl(scl),
29  m_en(en)
30 {
31 }
32 
33 bool
35 {
36  return (false);
37 }
38 
39 void
41 {
42  m_port.data = data;
43  uint8_t value = m_port;
44  synchronized {
45  m_sda._write(value & 0x20);
46  m_scl._toggle();
47  m_scl._toggle();
48  m_sda._write(value & 0x10);
49  m_scl._toggle();
50  m_scl._toggle();
51  m_sda._write(value & 0x08);
52  m_scl._toggle();
53  m_scl._toggle();
54  m_sda._write(value & 0x04);
55  m_scl._toggle();
56  m_scl._toggle();
57  m_sda._write(value & 0x02);
58  m_scl._toggle();
59  m_scl._toggle();
60  m_sda._write(value & 0x01);
61  m_scl._toggle();
62  m_scl._toggle();
63  m_en._toggle();
64  m_en._toggle();
65  }
66 }
67 
68 void
70 {
71  write4b(data >> 4);
72  write4b(data);
73 #if (I_CPU >= 16)
75 #endif
76 }
77 
78 void
80 {
81  m_port.rs = flag;
82 }
83 
84 void
86 {
87  m_port.bt = flag;
88 }
SR3W(Board::DigitalPin sda=Board::D7, Board::DigitalPin scl=Board::D6, Board::DigitalPin en=Board::D5)
OutputPin m_en
Starts data read/write.
Definition: HD44780.hh:564
#define DELAY(us)
Definition: Types.h:280
uint8_t rs
Command/Data select (Q4).
Definition: HD44780.hh:547
virtual void write4b(uint8_t data)
virtual void write8b(uint8_t data)
void _toggle() const
Definition: OutputPin.hh:153
virtual void set_backlight(uint8_t flag)
OutputPin m_sda
Serial data output.
Definition: HD44780.hh:562
void _write(int value) const
Definition: OutputPin.hh:219
virtual void set_mode(uint8_t flag)
port_t m_port
Port setting.
Definition: HD44780.hh:561
uint8_t bt
Back-light control (Q5).
Definition: HD44780.hh:548
uint8_t data
Data port (Q0..Q3).
Definition: HD44780.hh:546
static const uint16_t SHORT_EXEC_TIME
Definition: HD44780.hh:540
OutputPin m_scl
Serial clock.
Definition: HD44780.hh:563
virtual bool setup()