upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
hd44780_bits.hpp
1 /*
2  * Author: Jon Trulson <jtrulson@ics.com>
3  * Copyright (c) 2015 Intel Corporation.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sublicense, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 #pragma once
25 
26 // This file contains bit definitions for the HD44780 and compatible
27 // LCD controllers. They are used by most drivers in this (LCD)
28 // library, though the SSD controllers only seem to make use of the
29 // LCD_DATA and LCD_CMD values.
30 //
31 // Those values (DATA, CMD) are specific to the implementation of the
32 // i2C expander in use, so may not be appropriate for inclusion into
33 // this file. But for now, we will leave them here.
34 
35 #include <stdint.h>
36 
37 namespace upm
38 {
39 // commands
40  const uint8_t LCD_CLEARDISPLAY = 0x01;
41  const uint8_t LCD_RETURNHOME = 0x02;
42  const uint8_t LCD_ENTRYMODESET = 0x04;
43  const uint8_t LCD_DISPLAYCONTROL = 0x08;
44  const uint8_t LCD_CURSORSHIFT = 0x10;
45  const uint8_t LCD_FUNCTIONSET = 0x20;
46 
47  const uint8_t LCD_BACKLIGHT = 0x08;
48  const uint8_t LCD_NOBACKLIGHT = 0x00;
49 
50  // flags for display entry mode
51  const uint8_t LCD_ENTRYRIGHT = 0x00;
52  const uint8_t LCD_ENTRYLEFT = 0x02;
53  const uint8_t LCD_ENTRYSHIFTINCREMENT = 0x01;
54  const uint8_t LCD_ENTRYSHIFTDECREMENT = 0x00;
55 
56  // flags for display on/off control
57  const uint8_t LCD_DISPLAYON = 0x04;
58  const uint8_t LCD_DISPLAYOFF = 0x00;
59  const uint8_t LCD_CURSORON = 0x02;
60  const uint8_t LCD_CURSOROFF = 0x00;
61  const uint8_t LCD_BLINKON = 0x01;
62  const uint8_t LCD_BLINKOFF = 0x00;
63 
64  // flags for display/cursor shift
65  const uint8_t LCD_DISPLAYMOVE = 0x08;
66  const uint8_t LCD_MOVERIGHT = 0x04;
67  const uint8_t LCD_MOVELEFT = 0x00;
68 
69  // flags for function set
70  const uint8_t LCD_8BITMODE = 0x10;
71  const uint8_t LCD_4BITMODE = 0x00;
72  const uint8_t LCD_2LINE = 0x08;
73  const uint8_t LCD_1LINE = 0x00;
74  const uint8_t LCD_5x10DOTS = 0x04;
75  const uint8_t LCD_5x8DOTS = 0x00;
76 
77  // flags for CGRAM
78  const uint8_t LCD_SETCGRAMADDR = 0x40;
79 
80  // may be implementation specific
81  const uint8_t LCD_EN = 0x04; // Enable bit
82  const uint8_t LCD_RW = 0x02; // Read/Write bit
83  const uint8_t LCD_RS = 0x01; // Register select bit
84  const uint8_t LCD_DATA = 0x40;
85  const uint8_t LCD_CMD = 0x80;
86 }
C++ API wrapper for the bh1749 driver.
Definition: a110x.hpp:29