upm  1.6.0
Sensor/Actuator repository for libmraa (v1.9.0)
lcm1602.hpp
1 /*
2  * Author: Jon Trulson <jtrulson@ics.com>
3  * Copyright (c) 2016 Intel Corporation.
4  *
5  * Based on UPM C++ drivers originally developed by:
6  * Author: Daniel Mosquera
7  * Copyright (c) 2013 Daniel Mosquera
8  *
9  * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
10  * Copyright (c) 2014 Intel Corporation.
11  *
12  * Contributions: Sergey Kiselev <sergey.kiselev@intel.com>
13  *
14  * Permission is hereby granted, free of charge, to any person obtaining
15  * a copy of this software and associated documentation files (the
16  * "Software"), to deal in the Software without restriction, including
17  * without limitation the rights to use, copy, modify, merge, publish,
18  * distribute, sublicense, and/or sell copies of the Software, and to
19  * permit persons to whom the Software is furnished to do so, subject to
20  * the following conditions:
21  *
22  * The above copyright notice and this permission notice shall be
23  * included in all copies or substantial portions of the Software.
24  *
25  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
29  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
30  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32  */
33 
34 #pragma once
35 
36 #include <string>
37 #include <vector>
38 #include "lcm1602.h"
39 
40 namespace upm
41 {
73  class Lcm1602
74  {
75  public:
86  Lcm1602(int bus = 0, int address = 0x27, bool isExpander=true,
87  uint8_t numColumns = 16, uint8_t numRows = 2);
88 
103  Lcm1602(int rs, int enable,
104  int d0, int d1, int d2, int d3,
105  uint8_t numColumns = 16, uint8_t numRows = 2);
106 
110  ~Lcm1602();
111 
119  upm_result_t write(std::string msg);
120 
128  upm_result_t setCursor(int row, int column);
129 
135  upm_result_t clear();
136 
142  upm_result_t home();
143 
151  upm_result_t createChar(uint8_t charSlot,
152  std::vector<uint8_t> charData);
153 
159  upm_result_t displayOn();
160 
166  upm_result_t displayOff();
167 
173  upm_result_t cursorOn();
174 
180  upm_result_t cursorOff();
181 
187  upm_result_t cursorBlinkOn();
188 
194  upm_result_t cursorBlinkOff();
195 
201  upm_result_t backlightOn();
202 
208  upm_result_t backlightOff();
209 
215  upm_result_t scrollDisplayLeft();
216 
222  upm_result_t scrollDisplayRight();
223 
229  upm_result_t entryLeftToRight();
230 
236  upm_result_t entryRightToLeft();
237 
243  upm_result_t autoscrollOn();
244 
250  upm_result_t autoscrollOff();
251 
252 
253  protected:
254  lcm1602_context m_lcm1602;
255  upm_result_t command(uint8_t cmd);
256  upm_result_t data(uint8_t data);
257 
258  private:
259  /* Disable implicit copy and assignment operators */
260  Lcm1602(const Lcm1602&) = delete;
261  Lcm1602 &operator=(const Lcm1602&) = delete;
262  };
263 }
Definition: lcm1602.h:59
upm_result_t createChar(uint8_t charSlot, std::vector< uint8_t > charData)
Definition: lcm1602.cxx:88
~Lcm1602()
Definition: lcm1602.cxx:63
upm_result_t home()
Definition: lcm1602.cxx:83
upm_result_t scrollDisplayRight()
Definition: lcm1602.cxx:139
upm_result_t autoscrollOff()
Definition: lcm1602.cxx:159
upm_result_t backlightOn()
Definition: lcm1602.cxx:124
upm_result_t cursorOn()
Definition: lcm1602.cxx:104
upm_result_t displayOff()
Definition: lcm1602.cxx:99
upm_result_t cursorBlinkOn()
Definition: lcm1602.cxx:114
upm_result_t scrollDisplayLeft()
Definition: lcm1602.cxx:134
C++ API for the kxtj3 driver.
Definition: a110x.hpp:29
upm_result_t displayOn()
Definition: lcm1602.cxx:94
upm_result_t write(std::string msg)
Definition: lcm1602.cxx:68
Lcm1602(int bus=0, int address=0x27, bool isExpander=true, uint8_t numColumns=16, uint8_t numRows=2)
Definition: lcm1602.cxx:42
upm_result_t entryLeftToRight()
Definition: lcm1602.cxx:144
upm_result_t backlightOff()
Definition: lcm1602.cxx:129
upm_result_t cursorBlinkOff()
Definition: lcm1602.cxx:119
upm_result_t entryRightToLeft()
Definition: lcm1602.cxx:149
upm_result_t setCursor(int row, int column)
Definition: lcm1602.cxx:73
upm_result_t autoscrollOn()
Definition: lcm1602.cxx:154
C API for the LCM1602 family of LCD displays.
upm_result_t clear()
Definition: lcm1602.cxx:78
API for the LCM1602 I2C controller for HD44780-based displays.
Definition: lcm1602.hpp:73
upm_result_t cursorOff()
Definition: lcm1602.cxx:109