forked from nanoframework/nanoFramework.IoT.Device
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
365 lines (319 loc) · 17.9 KB
/
Program.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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
//
// Copyright (c) 2022 The nanoFramework project contributors
// See LICENSE file in the project root for full license information.
//
using System;
using System.Device.Gpio;
using System.Device.Pwm;
using System.Device.Spi;
using System.Globalization;
using System.Threading;
using Iot.Device.CharacterLcd;
namespace Pcd8544.samples
{
public class Program
{
public static void Main()
{
var resetPin = 32;
var dataCommandPin = 33;
var backlightPin = 21;
var gpioController = new GpioController();
var spiConnectionSettings = new SpiConnectionSettings(1, 5)
{
ClockFrequency = 5_000_000,
Mode = SpiMode.Mode0,
DataFlow = DataFlow.MsbFirst,
ChipSelectLineActiveState = PinValue.Low
};
var spiDevice = new SpiDevice(spiConnectionSettings);
var pwmChannel = PwmChannel.CreateFromPin(backlightPin);
var lcd = new Iot.Device.Pcd8544(dataCommandPin, spiDevice, resetPin, pwmChannel, gpioController, false);
lcd.Enabled = true;
lcd.Bias = 6;
lcd.Contrast = 40;
BrightnessContrastTemperatureBias(lcd);
lcd.Bias = 6;
lcd.Contrast = 40;
Thread.Sleep(5000);
DisplayTextChangePositionBlink(lcd);
Thread.Sleep(5000);
LcdConsole(lcd);
Thread.Sleep(5000);
DisplayLinesPointsRectabngles(lcd);
Thread.Sleep(5000);
DisplayBitmap(lcd);
while (true)
{
Thread.Sleep(10000);
}
}
static void BrightnessContrastTemperatureBias(Iot.Device.Pcd8544 lcd)
{
lcd.Clear();
Console.WriteLine("Adjusting brightness from 0 to 1.0");
for (int i = 0; i < 10; i++)
{
lcd.SetCursorPosition(0, 0);
lcd.WriteLine("Test for brightness");
lcd.Write($"{i * 10} %");
lcd.BacklightBrightness = i / 10.0f;
Thread.Sleep(500);
}
lcd.Clear();
Console.WriteLine("Reseting brightness to 1 (100%)");
lcd.BacklightBrightness = 1f;
Console.WriteLine("Adjusting contrast from 0 to 127");
for (byte i = 0; i < 128; i++)
{
lcd.SetCursorPosition(0, 0);
lcd.WriteLine("Test for contrast");
lcd.Write($"{i}");
lcd.Contrast = i;
Thread.Sleep(100);
}
Console.WriteLine("Reseting contrast to recommended value 40");
lcd.Contrast = 40;
lcd.Clear();
Console.WriteLine("Testing the 4 different temperature modes");
lcd.WriteLine("Test temp 0");
lcd.Temperature = Iot.Device.Pcd8544Enums.ScreenTemperature.Coefficient0;
Thread.Sleep(1500);
lcd.WriteLine("Test temp 1");
lcd.Temperature = Iot.Device.Pcd8544Enums.ScreenTemperature.Coefficient1;
Thread.Sleep(1500);
lcd.WriteLine("Test temp 2");
lcd.Temperature = Iot.Device.Pcd8544Enums.ScreenTemperature.Coefficient2;
Thread.Sleep(1500);
lcd.WriteLine("Test temp 3");
lcd.Temperature = Iot.Device.Pcd8544Enums.ScreenTemperature.Coefficient3;
Thread.Sleep(1500);
lcd.Temperature = Iot.Device.Pcd8544Enums.ScreenTemperature.Coefficient0;
lcd.Clear();
Console.WriteLine("Adjusting bias from 0 to 6");
// Adjusting the bias
for (byte i = 0; i < 7; i++)
{
// Adjusting the bias
lcd.Bias = i;
lcd.SetCursorPosition(0, 0);
lcd.WriteLine("Adjusting bias");
lcd.Write($"bias = {i}");
Thread.Sleep(2000);
lcd.Clear();
}
Console.WriteLine("Reseting bias to recommended value 4");
lcd.Bias = 4;
}
static void DisplayTextChangePositionBlink(Iot.Device.Pcd8544 lcd)
{
lcd.Clear();
Console.WriteLine("Display is on and will switch on and off");
lcd.Write("Display is on and will switch on and off");
for (int i = 0; i < 5; i++)
{
Thread.Sleep(1000);
lcd.Enabled = !lcd.Enabled;
}
lcd.Enabled = true;
lcd.Clear();
Console.WriteLine("Displaying multi line with WriteLine");
lcd.SetCursorPosition(0, 0);
lcd.Write("First line");
lcd.SetCursorPosition(0, 1);
lcd.Write("Second one");
lcd.SetCursorPosition(0, 2);
lcd.Write("3rd");
lcd.SetCursorPosition(0, 3);
lcd.Write("Guess!");
lcd.SetCursorPosition(0, 4);
lcd.Write("One more...");
lcd.SetCursorPosition(0, 5);
lcd.Write("last line");
Thread.Sleep(1500);
Console.WriteLine("Inverting the color screen");
// this will blink the screen
for (int i = 0; i < 6; i++)
{
lcd.InvertedColors = !lcd.InvertedColors;
Thread.Sleep(1000);
}
Console.WriteLine("Activating the cursor, writting numbers in a raw");
lcd.Clear();
lcd.SetCursorPosition(0, 0);
lcd.UnderlineCursorVisible = true;
for (int i = 0; i < 50; i++)
{
lcd.Write($"{i}");
Thread.Sleep(500);
}
lcd.Clear();
Console.WriteLine("Testing backspace to remove character");
lcd.Write("Basckspace");
for (int i = 0; i < 5; i++)
{
Thread.Sleep(2000);
lcd.Write("\b");
}
Console.WriteLine("Displaying more text and moving the cursor around");
lcd.Clear();
lcd.Write("More text");
Thread.Sleep(1500);
lcd.SetCursorPosition(0, 0);
Thread.Sleep(1500);
lcd.SetCursorPosition(5, 0);
Thread.Sleep(1500);
lcd.SetCursorPosition(0, 5);
Thread.Sleep(1500);
lcd.UnderlineCursorVisible = false;
Console.WriteLine("This will display a line of random bits");
lcd.Clear();
lcd.WriteLine("This will display a line of random characters");
Thread.Sleep(1500);
char[] textToSend = new char[lcd.Size.Height * lcd.Size.Width];
var rand = new Random(123456);
for (int i = 0; i < textToSend.Length; i++)
{
textToSend[i] = (char)rand.Next(255);
}
lcd.Clear();
lcd.SetCursorPosition(0, 0);
lcd.Write(textToSend);
Thread.Sleep(1000);
lcd.Clear();
}
static void DisplayBitmap(Iot.Device.Pcd8544 lcd)
{
lcd.Clear();
//var nokaiHomePage = new byte[] { 0x00, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00,
// 0x00, 0xC0, 0x00, 0xC0, 0x40, 0x40, 0xC0, 0x00, 0xC0, 0x80, 0x80, 0xC0, 0x40, 0x00, 0xC0, 0x00, 0x00, 0x00, 0xC0,
// 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0xF7, 0xF7, 0xF7, 0xF7, 0xF7, 0x07,
// 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x01, 0x03, 0x0E, 0x1F, 0x00, 0x1F, 0x10, 0x10, 0x1F, 0x00, 0x1F, 0x07, 0x0C,
// 0x18, 0x10, 0x00, 0x1F, 0x00, 0x1C, 0x07, 0x05, 0x05, 0x07, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
// 0x00, 0x00, 0xEF, 0xEF, 0xEF, 0xEF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// 0x00, 0x00, 0x00, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0x00, 0x00, 0xF7, 0xF7, 0xF7, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x7E, 0x7E, 0x7E, 0x00, 0x00, 0xBD,
// 0xBD, 0x81, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// 0x00, 0x80, 0xDF, 0xDF, 0x9F, 0x00, 0x00, 0x00, 0x01, 0x0F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// 0x7C, 0x0C, 0x18, 0x0C, 0x7C, 0x00, 0x7C, 0x54, 0x54, 0x44, 0x00, 0x7C, 0x08, 0x10, 0x7C, 0x00, 0x7C, 0x40, 0x40,
// 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// 0x00, 0x00, 0x00, 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 0x00, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE,
0xF8, 0xF0, 0xE0, 0xE0, 0xE0, 0xE3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xE1, 0xE0, 0xE0, 0xF0, 0xF8, 0xF8, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xF0, 0x70, 0x60, 0x60, 0x41, 0x43, 0x43, 0x43, 0x43,
0x03, 0x01, 0x00, 0x20, 0x00, 0x10, 0x08, 0x04, 0x03, 0x03, 0x03, 0x01, 0x01, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
lcd.SetByteMap(nanoFramewokrLogo);
lcd.Draw();
}
static void DisplayLinesPointsRectabngles(Iot.Device.Pcd8544 lcd)
{
lcd.Clear();
Console.WriteLine("Drawing point, line and rectangles");
lcd.DrawPoint(5, 5, true);
lcd.DrawLine(0, 0, 15, 35, true);
lcd.DrawRectangle(10, 30, 10, 20, true, true);
lcd.DrawRectangle(12, 32, 6, 16, false, true);
// You should not forget to refresh to draw everything
lcd.Draw();
Thread.Sleep(2000);
lcd.Clear();
Console.WriteLine("Drawing 4 points at the 4 edges");
lcd.DrawPoint(0, 0, true);
lcd.DrawPoint(Iot.Device.Pcd8544.PixelScreenSize.Width - 1, 0, true);
lcd.DrawPoint(Iot.Device.Pcd8544.PixelScreenSize.Width - 1, Iot.Device.Pcd8544.PixelScreenSize.Height - 1, true);
lcd.DrawPoint(0, Iot.Device.Pcd8544.PixelScreenSize.Height - 1, true);
lcd.Draw();
Thread.Sleep(2000);
Console.WriteLine("Drawing a rectangle at 2 pixels from the edge");
lcd.DrawRectangle(2, 2, Iot.Device.Pcd8544.PixelScreenSize.Width - 4, Iot.Device.Pcd8544.PixelScreenSize.Height - 4, true, false);
lcd.Draw();
Thread.Sleep(2000);
lcd.Clear();
Console.WriteLine("Drawing 2 diagonal lines");
lcd.DrawLine(0, 0, Iot.Device.Pcd8544.PixelScreenSize.Width - 1, Iot.Device.Pcd8544.PixelScreenSize.Height - 1, true);
lcd.DrawLine(0, Iot.Device.Pcd8544.PixelScreenSize.Height - 1, Iot.Device.Pcd8544.PixelScreenSize.Width - 1, 0, true);
lcd.Draw();
Thread.Sleep(2000);
}
static void LcdConsole(Iot.Device.Pcd8544 lcd)
{
lcd.Clear();
LcdConsole console = new LcdConsole(lcd, string.Empty, false);
console.LineFeedMode = LineWrapMode.Truncate;
Console.WriteLine("Nowrap test:");
console.Write("This is a long text that should not wrap and just extend beyond the display");
console.WriteLine("This has CRLF\r\nin it and should \r\n wrap.");
console.Write("This goes to the last line of the display");
console.WriteLine("This isn't printed, because it's off the screen");
Thread.Sleep(1500);
Console.WriteLine("Autoscroll test:");
console.LineFeedMode = LineWrapMode.Wrap;
console.WriteLine();
console.WriteLine("Now the display should move up.");
console.WriteLine("And more up.");
for (int i = 0; i < 20; i++)
{
console.WriteLine($"This is line {i + 1}/{20}, but longer than the screen but you really have to add a lot of text to make it big enough");
Thread.Sleep(500);
}
console.LineFeedMode = LineWrapMode.Wrap;
console.WriteLine("Same again, this time with full wrapping.");
for (int i = 0; i < 20; i++)
{
console.Write($"This is string {i + 1}/{20} longer than the screen but you really have to add a lot of text to make it big enough");
Thread.Sleep(500);
}
Thread.Sleep(1500);
Console.WriteLine("Intelligent wrapping test");
console.LineFeedMode = LineWrapMode.WordWrap;
console.WriteLine("Now intelligent wrapping should wrap this long sentence at word borders and ommit spaces at the start of lines.");
Console.WriteLine("Not wrappable test");
Thread.Sleep(1500);
console.WriteLine("NowThisIsOneSentenceInOneWordThatCannotBeWrappedButStillAppearAllOverUpToTheEnd");
Thread.Sleep(1500);
Console.WriteLine("Individual line test");
Thread.Sleep(1500);
console.Clear();
console.Dispose();
}
}
}