Arduino-LCD
LCD library for Arduino
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
SR3W.h
Go to the documentation of this file.
1
18
#ifndef LCD_ADAPTER_SR3W_H
19
#define LCD_ADAPTER_SR3W_H
20
21
#include "
LCD.h
"
22
#include "
Driver/HD44780.h
"
23
#include "GPIO.h"
24
75
namespace
LCD
{
76
template
<BOARD::pin_t SDA_PIN, BOARD::pin_t SCL_PIN, BOARD::pin_t EN_PIN>
77
class
SR3W
:
public
HD44780::Adapter
{
78
public
:
82
SR3W
() :
83
HD44780
::Adapter(),
84
m_port
()
85
{
86
m_sda
.output();
87
m_scl
.output();
88
m_en
.output();
89
}
90
96
virtual
bool
setup
()
97
{
98
return
(
false
);
99
}
100
106
virtual
void
write4b
(uint8_t data)
107
{
108
m_port
.
data
= data;
109
data =
m_port
;
110
uint8_t mask = 0x20;
111
do
{
112
m_sda
= data & mask;
113
m_scl
.toggle();
114
mask >>= 1;
115
m_scl
.toggle();
116
}
while
(mask);
117
m_en
.toggle();
118
m_en
.toggle();
119
}
120
126
virtual
void
write8b
(uint8_t data)
127
{
128
write4b
(data >> 4);
129
write4b
(data);
130
delayMicroseconds(
SHORT_EXEC_TIME
);
131
}
132
139
virtual
void
set_mode
(uint8_t flag)
140
{
141
m_port
.
rs
= flag;
142
}
143
149
virtual
void
set_backlight
(uint8_t flag)
150
{
151
m_port
.
bt
= flag;
152
}
153
154
protected
:
156
static
const
uint16_t
SHORT_EXEC_TIME
= 32;
157
159
union
port_t
{
160
uint8_t
as_uint8
;
161
struct
{
162
uint8_t
data
:4;
163
uint8_t
rs
:1;
164
uint8_t
bt
:1;
165
uint8_t
app2
:1;
166
uint8_t
app1
:1;
167
};
168
operator
uint8_t() {
return
(as_uint8); }
169
port_t
() { as_uint8 = 0; }
170
};
171
172
port_t
m_port
;
173
GPIO<SDA_PIN>
m_sda
;
174
GPIO<SCL_PIN>
m_scl
;
175
GPIO<EN_PIN>
m_en
;
176
};
177
};
178
#endif
LCD::SR3W::SHORT_EXEC_TIME
static const uint16_t SHORT_EXEC_TIME
Definition:
SR3W.h:156
LCD::SR3W::port_t::app2
uint8_t app2
Application bit#2 (Q6).
Definition:
SR3W.h:165
LCD::SR3W::port_t::rs
uint8_t rs
Command/Data select (Q4).
Definition:
SR3W.h:163
LCD::SR3W::setup
virtual bool setup()
Definition:
SR3W.h:96
LCD
Definition:
Debug.h:28
LCD::SR3W::set_mode
virtual void set_mode(uint8_t flag)
Definition:
SR3W.h:139
LCD::SR3W::port_t::bt
uint8_t bt
Back-light control (Q5).
Definition:
SR3W.h:164
LCD::SR3W::m_port
port_t m_port
Port setting.
Definition:
SR3W.h:172
LCD::SR3W::m_sda
GPIO< SDA_PIN > m_sda
Serial data output.
Definition:
SR3W.h:173
LCD::SR3W
Definition:
SR3W.h:77
LCD::SR3W::port_t::data
uint8_t data
Data port (Q0..Q3).
Definition:
SR3W.h:162
LCD::SR3W::port_t::port_t
port_t()
Definition:
SR3W.h:169
LCD::SR3W::write8b
virtual void write8b(uint8_t data)
Definition:
SR3W.h:126
LCD::SR3W::port_t
Definition:
SR3W.h:159
HD44780::Adapter
Definition:
HD44780.h:40
LCD::SR3W::port_t::as_uint8
uint8_t as_uint8
Unsigned byte access.
Definition:
SR3W.h:160
LCD::SR3W::port_t::app1
uint8_t app1
Application bit#1 (Q7).
Definition:
SR3W.h:166
LCD::SR3W::m_scl
GPIO< SCL_PIN > m_scl
Serial clock.
Definition:
SR3W.h:174
LCD::SR3W::SR3W
SR3W()
Definition:
SR3W.h:82
HD44780
Definition:
HD44780.h:34
LCD.h
LCD::SR3W::write4b
virtual void write4b(uint8_t data)
Definition:
SR3W.h:106
LCD::SR3W::set_backlight
virtual void set_backlight(uint8_t flag)
Definition:
SR3W.h:149
HD44780.h
LCD::SR3W::m_en
GPIO< EN_PIN > m_en
Starts data read/write.
Definition:
SR3W.h:175
src
Adapter
SR3W.h
Generated on Sat Oct 14 2017 03:06:11 for Arduino-LCD by
1.8.11