aip31068_regs.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Freie Universität Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
17 #ifndef AIP31068_REGS_H
18 #define AIP31068_REGS_H
19 
20 #include "bitarithm.h"
21 
22 #ifdef __cplusplus
23 extern "C"
24 {
25 #endif
26 
27 /* Commands (page 18, table 3) */
28 
34 #define AIP31068_CMD_CLEAR_DISPLAY 0x01
35 
40 #define AIP31068_CMD_RETURN_HOME 0x02
41 
45 #define AIP31068_CMD_ENTRY_MODE_SET 0x04
46 
51 #define AIP31068_CMD_DISPLAY_CONTROL 0x08
52 
56 #define AIP31068_CMD_CURSOR_DISPLAY_SHIFT 0x10
57 
62 #define AIP31068_CMD_FUNCTION_SET 0x20
63 
67 #define AIP31068_CMD_SET_CGRAM_ADDR 0x40
68 
72 #define AIP31068_CMD_SET_DDRAM_ADDR 0x80
73 
74 /* Bits for AIP31068_CMD_ENTRY_MODE_SET (page 16, section 3) */
75 
80 #define AIP31068_BIT_ENTRY_MODE_INCREMENT BIT1
81 
86 #define AIP31068_BIT_ENTRY_MODE_AUTOINCREMENT BIT0
87 
88 /* Bits for AIP31068_CMD_DISPLAY_CONTROL (page 16, section 4) */
89 
94 #define AIP31068_BIT_DISPLAY_CONTROL_DISPLAY BIT2
95 
100 #define AIP31068_BIT_DISPLAY_CONTROL_CURSOR BIT1
101 
106 #define AIP31068_BIT_DISPLAY_CONTROL_CURSOR_BLINKING BIT0
107 
108 /* Bits for AIP31068_CMD_CURSOR_DISPLAY_SHIFT (page 17, section 5) */
109 
114 #define AIP31068_BIT_CURSOR_DISPLAY_SHIFT_SELECTION BIT3
115 
120 #define AIP31068_BIT_CURSOR_DISPLAY_SHIFT_DIRECTION BIT2
121 
122 /* Bits for AIP31068_CMD_FUNCTION_SET (page 17, section 6) */
123 
128 #define AIP31068_BIT_FUNCTION_SET_BITMODE BIT4
129 
134 #define AIP31068_BIT_FUNCTION_SET_LINECOUNT BIT3
135 
140 #define AIP31068_BIT_FUNCTION_SET_FONTSIZE BIT2
141 
142 /* Bits for control byte (page 12) */
143 
148 #define AIP31068_BIT_CONTROL_BYTE_CO BIT7
149 
154 #define AIP31068_BIT_CONTROL_BYTE_RS BIT6
155 
156 #ifdef __cplusplus
157 }
158 #endif
159 
160 #endif /* AIP31068_REGS_H */
Helper functions for bit arithmetic.