-
Notifications
You must be signed in to change notification settings - Fork 587
/
Flags.cs
138 lines (122 loc) · 4.5 KB
/
Flags.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
namespace Iot.Device.CharacterLcd
{
// Command flags are found on page 24/25 of the HD4478U spec.
[Flags]
internal enum DisplayEntryMode : byte
{
/// <summary>
/// Enabled to shift the display left when <see cref="Increment"/> is enabled
/// or right if <see cref="Increment"/> is disabled.
/// </summary>
/// <remarks>The "S" option from the datasheet.</remarks>
DisplayShift = 0b_0001,
/// <summary>
/// Set to increment the CGRAM/DDRAM address by 1 when a character code is
/// written into or read from and moves the cursor to the right. Disabling
/// decrements and moves the cursor to the left.
/// </summary>
/// <remarks>The "I/D" option from the datasheet.</remarks>
Increment = 0b_0010,
/// <summary>
/// The flag for entry mode- must be set.
/// </summary>
Command = 0b_0100,
}
[Flags]
internal enum DisplayControl : byte
{
/// <summary>
/// Set for enabling cursor blinking.
/// </summary>
/// <remarks>The "B" option from the datasheet.</remarks>
BlinkOn = 0b_0001,
/// <summary>
/// Set for enabling the cursor.
/// </summary>
/// <remarks>The "C" option from the datasheet.</remarks>
CursorOn = 0b_0010,
/// <summary>
/// Set for enabling the entire display.
/// </summary>
/// <remarks>The "D" option from the datasheet.</remarks>
DisplayOn = 0b_0100,
/// <summary>
/// The flag for display control- must be set.
/// </summary>
Command = 0b_1000
}
[Flags]
internal enum DisplayShift : byte
{
/// <summary>
/// When set shifts right, otherwise shifts left.
/// </summary>
/// <remarks>The "R/L" option from the datasheet.</remarks>
Right = 0b_0000_0100,
/// <summary>
/// When set shifts the display when data is entered, otherwise shifts the cursor.
/// </summary>
/// <remarks>The "S/C" option from the datasheet.</remarks>
Display = 0b_0000_1000,
/// <summary>
/// The flag for display and cursor shift- must be set.
/// </summary>
Command = 0b_0001_0000
}
[Flags]
internal enum DisplayFunction : byte
{
/// <summary>
/// When set, commands (other than <see cref="DisplayFunction"/>) are from the
/// extended (NXP/Philips, Sitronix) instruction set. For Sitronix (ST7036) this
/// is extended intstruction set 1.
/// </summary>
/// <remarks>
/// The "H" option from the NXP datasheet. The "IS1" option from Sitronix.
/// Not all driver ICs support this.
/// </remarks>
ExtendedInstructionSet = 0b_0000_0001,
/// <summary>
/// If set font is 5x10, otherwise font is 5x8.
/// </summary>
/// <remarks>
/// The "F" option from the HD44780 datasheet.
///
/// The displays that supported 5x10 are extremely rare.
///
/// On NXP/Philips chips this is the "M" option that
/// controls the number of display lines. When set the
/// driver is set to 2 line x 16 characters. Otherwise
/// the driver is set to 1 line by 32 characters.
///
/// For Sitronix, this is referred to as "DH" and sets
/// double height mode.
/// </remarks>
Font5x10 = 0b_0000_0100,
/// <summary>
/// If set display is two line, otherwise display is one line.
/// </summary>
/// <remarks>
/// The "N" option from the datasheet.
///
/// When set to one line, shifting the display right pulls
/// address 0x4F to the 1st display position. When set to two
/// lines, shifting right pulls 0x27 for the first line and
/// 0x67 for the second.
/// </remarks>
TwoLine = 0b_0000_1000,
/// <summary>
/// If set display uses all eight data pins, otherwise display uses
/// four data pins.
/// </summary>
/// <remarks>The "DL" option from the datasheet.</remarks>
EightBit = 0b_0001_0000,
/// <summary>
/// The flag for setting display function- must be set.
/// </summary>
Command = 0b_0010_0000
}
}