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 
9 #pragma once
10 
19 #include "bitarithm.h"
20 
21 #ifdef __cplusplus
22 extern "C"
23 {
24 #endif
25 
26 /* Commands (page 18, table 3) */
27 
33 #define AIP31068_CMD_CLEAR_DISPLAY 0x01
34 
39 #define AIP31068_CMD_RETURN_HOME 0x02
40 
44 #define AIP31068_CMD_ENTRY_MODE_SET 0x04
45 
50 #define AIP31068_CMD_DISPLAY_CONTROL 0x08
51 
55 #define AIP31068_CMD_CURSOR_DISPLAY_SHIFT 0x10
56 
61 #define AIP31068_CMD_FUNCTION_SET 0x20
62 
66 #define AIP31068_CMD_SET_CGRAM_ADDR 0x40
67 
71 #define AIP31068_CMD_SET_DDRAM_ADDR 0x80
72 
73 /* Bits for AIP31068_CMD_ENTRY_MODE_SET (page 16, section 3) */
74 
79 #define AIP31068_BIT_ENTRY_MODE_INCREMENT BIT1
80 
85 #define AIP31068_BIT_ENTRY_MODE_AUTOINCREMENT BIT0
86 
87 /* Bits for AIP31068_CMD_DISPLAY_CONTROL (page 16, section 4) */
88 
93 #define AIP31068_BIT_DISPLAY_CONTROL_DISPLAY BIT2
94 
99 #define AIP31068_BIT_DISPLAY_CONTROL_CURSOR BIT1
100 
105 #define AIP31068_BIT_DISPLAY_CONTROL_CURSOR_BLINKING BIT0
106 
107 /* Bits for AIP31068_CMD_CURSOR_DISPLAY_SHIFT (page 17, section 5) */
108 
113 #define AIP31068_BIT_CURSOR_DISPLAY_SHIFT_SELECTION BIT3
114 
119 #define AIP31068_BIT_CURSOR_DISPLAY_SHIFT_DIRECTION BIT2
120 
121 /* Bits for AIP31068_CMD_FUNCTION_SET (page 17, section 6) */
122 
127 #define AIP31068_BIT_FUNCTION_SET_BITMODE BIT4
128 
133 #define AIP31068_BIT_FUNCTION_SET_LINECOUNT BIT3
134 
139 #define AIP31068_BIT_FUNCTION_SET_FONTSIZE BIT2
140 
141 /* Bits for control byte (page 12) */
142 
147 #define AIP31068_BIT_CONTROL_BYTE_CO BIT7
148 
153 #define AIP31068_BIT_CONTROL_BYTE_RS BIT6
154 
155 #ifdef __cplusplus
156 }
157 #endif
158 
Helper functions for bit arithmetic.