Arduino-LCD
LCD library for Arduino
LCD.h
Go to the documentation of this file.
1 
19 #ifndef LCD_H
20 #define LCD_H
21 
22 namespace LCD {
26 class Device : public Print {
27 public:
31  Device() :
32  Print(),
33  m_x(0),
34  m_y(0),
35  m_tab(4),
36  m_mode(0)
37  {}
38 
45  virtual bool begin() = 0;
46 
52  virtual bool end()
53  {
54  display_clear();
55  display_off();
56  backlight_off();
57  return (true);
58  }
59 
64  virtual void backlight_on() {}
65 
70  virtual void backlight_off() {}
71 
77  virtual void display_contrast(uint8_t level) { (void) level; }
78 
83  virtual void display_on() = 0;
84 
89  virtual void display_off() = 0;
90 
95  virtual void display_normal() {}
96 
101  virtual void display_inverse() {}
102 
107  virtual void display_clear() = 0;
108 
113  virtual void cursor_blink_on() {}
114 
119  virtual void cursor_blink_off() {}
120 
126  void cursor_get(uint8_t& x, uint8_t& y) const
127  __attribute__((always_inline))
128  {
129  x = m_x;
130  y = m_y;
131  }
132 
139  virtual void cursor_set(uint8_t x, uint8_t y) = 0;
140 
145  virtual void cursor_home()
146  {
147  cursor_set(0, 0);
148  }
149 
154  virtual void cursor_update() {}
155 
160  uint8_t tab_step() const
161  __attribute__((always_inline))
162  {
163  return (m_tab);
164  }
165 
170  void tab_step(uint8_t step)
171  __attribute__((always_inline))
172  {
173  m_tab = step;
174  }
175 
179  uint8_t text_mode() const
180  __attribute__((always_inline))
181  {
182  return (m_mode);
183  }
184 
189  __attribute__((always_inline))
190  {
191  m_mode = 0;
192  }
193 
198  __attribute__((always_inline))
199  {
200  m_mode = 0xff;
201  }
202 
203 protected:
204  uint8_t m_x;
205  uint8_t m_y;
206  uint8_t m_tab;
207  uint8_t m_mode;
208 };
209 };
210 #endif
uint8_t m_y
Cursor position y.
Definition: LCD.h:205
uint8_t m_x
Cursor position x.
Definition: LCD.h:204
virtual void cursor_blink_on()
Definition: LCD.h:113
void text_normal_mode()
Definition: LCD.h:188
virtual void cursor_update()
Definition: LCD.h:154
virtual void display_inverse()
Definition: LCD.h:101
virtual void display_off()=0
void cursor_get(uint8_t &x, uint8_t &y) const
Definition: LCD.h:126
Definition: Debug.h:28
virtual void backlight_off()
Definition: LCD.h:70
virtual void cursor_blink_off()
Definition: LCD.h:119
virtual bool begin()=0
uint8_t m_tab
Tab step.
Definition: LCD.h:206
uint8_t text_mode() const
Definition: LCD.h:179
virtual void display_on()=0
virtual void backlight_on()
Definition: LCD.h:64
virtual void display_clear()=0
virtual void display_contrast(uint8_t level)
Definition: LCD.h:77
virtual bool end()
Definition: LCD.h:52
uint8_t m_mode
Text mode.
Definition: LCD.h:207
void tab_step(uint8_t step)
Definition: LCD.h:170
virtual void cursor_set(uint8_t x, uint8_t y)=0
virtual void display_normal()
Definition: LCD.h:95
virtual void cursor_home()
Definition: LCD.h:145
uint8_t tab_step() const
Definition: LCD.h:160
void text_inverted_mode()
Definition: LCD.h:197
Device()
Definition: LCD.h:31