-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDisplayprnocto.c
126 lines (102 loc) · 5.54 KB
/
Displayprnocto.c
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
/*
=================================================================================
Name : Displayprn.c
Version : 1
Simple display statux and makibox logo
needs:
wiringpi --> https://projects.drogon.net/raspberry-pi/wiringpi/
PCD8544 library --> http://binerry.de/post/25787954149/pcd8544-library-for-raspberry-pi
Description :
LCD pins Raspberry Pi
LCD1 - GND P06 - GND
LCD2 - VCC P01 - 3.3V
LCD3 - CLK P11 - GPIO0
LCD4 - Din P12 - GPIO1
LCD5 - DC P13 - GPIO2
LCD6 - CS-CE P15 - GPIO3
LCD7 - RST P16 - GPIO4
LCD8 - LED P06 - GND
free to modify free to share but please no sell it :)
================================================================================
*/
#include <wiringPi.h>
#include <stdio.h>
#include <stdlib.h>
#include "PCD8544.h"
// pin setup
int _din = 1;
int _sclk = 0;
int _dc = 2;
int _rst = 4;
int _cs = 3;
// lcd contrast
int contrast = 50;
//use png and convert with http://www.henningkarlsen.com/electronics/t_imageconverter_mono.php
const uint8_t logoprinter[]={
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x0010 (16) pixels
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x90, 0x68, 0x18, // 0x0020 (32) pixels
0x14, 0x0C, 0x0A, 0x12, 0x12, 0x61, 0x81, 0x01, 0x01, 0x01, 0x01, 0x01, 0x81, 0x61, 0x12, 0x12, // 0x0030 (48) pixels
0x0A, 0x0C, 0x14, 0x18, 0x68, 0x90, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x0040 (64) pixels
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x0050 (80) pixels
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x0060 (96) pixels
0xE0, 0x10, 0x08, 0x84, 0x44, 0x44, 0x42, 0x82, 0x02, 0x04, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, // 0x0070 (112) pixels
0x07, 0x19, 0x66, 0xC8, 0x1E, 0x11, 0x19, 0x0E, 0x08, 0x06, 0x81, 0x80, 0x80, 0x80, 0x80, 0x80, // 0x0080 (128) pixels
0x81, 0x06, 0x08, 0x0E, 0x19, 0x11, 0x1E, 0xC8, 0x66, 0x19, 0x07, 0x80, 0x40, 0x20, 0x10, 0x08, // 0x0090 (144) pixels
0x04, 0x04, 0x02, 0x82, 0x42, 0x44, 0x44, 0x84, 0x08, 0x10, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x00A0 (160) pixels
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x00B0 (176) pixels
0x00, 0x00, 0x00, 0x07, 0x18, 0x3C, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0C, 0xF0, 0x00, // 0x00C0 (192) pixels
0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x09, 0x0E, 0x00, 0x00, 0x80, 0x80, 0x41, 0x4E, 0x54, // 0x00D0 (208) pixels
0x64, 0x64, 0x64, 0x54, 0x4E, 0x41, 0x80, 0x80, 0x00, 0x00, 0x0E, 0x09, 0x04, 0x04, 0x03, 0x00, // 0x00E0 (224) pixels
0x00, 0x00, 0x00, 0x00, 0xF0, 0x0C, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x3C, 0x18, 0x07, // 0x00F0 (240) pixels
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x0100 (256) pixels
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x0110 (272) pixels
0x00, 0x03, 0x0C, 0x90, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x44, 0xA6, 0x95, 0x94, // 0x0120 (288) pixels
0x0A, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0A, 0x94, 0x95, 0xA6, 0x44, 0x40, // 0x0130 (304) pixels
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x90, 0x0C, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x0140 (320) pixels
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x0150 (336) pixels
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x0160 (352) pixels
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x10, 0x20, 0x20, 0x20, 0xE0, 0x00, 0x00, 0x00, 0x3C, // 0x0170 (368) pixels
0xC4, 0x82, 0x02, 0x02, 0x03, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x03, 0x02, // 0x0180 (384) pixels
0x02, 0x82, 0xC4, 0x3C, 0x00, 0x00, 0x00, 0xE0, 0x20, 0x20, 0x20, 0x10, 0x0F, 0x00, 0x00, 0x00, // 0x0190 (400) pixels
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x01A0 (416) pixels
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x01B0 (432) pixels
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x33, 0x60, // 0x01C0 (448) pixels
0x40, 0x80, 0x9E, 0xA1, 0xA0, 0xA0, 0x61, 0x7E, 0x30, 0x62, 0x42, 0x42, 0x42, 0x46, 0x46, 0x44, // 0x01D0 (464) pixels
0x44, 0x64, 0x34, 0x7E, 0x61, 0xA0, 0xA0, 0xA1, 0x9E, 0x80, 0x40, 0x60, 0x33, 0x0C, 0x00, 0x00, // 0x01E0 (480) pixels
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x01F0 (496) pixels
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
int main ( int argc, char *argv[] )
{
// check wiringPi setup
if (wiringPiSetup() == -1)
{
printf("wiringPi-Error\n");
exit(1);
}
// init and clear lcd
LCDInit(_sclk, _din, _dc, _cs, _rst, contrast);
LCDclear();
LCDclear();
delay(500);
if ( argc < 5 ) /* argc should be 2 for correct execution */
{
LCDclear();
LCDdrawbitmap(0, 0, logoprinter, 84, 64, BLACK);
LCDdisplay();
delay(100);
}
else
{
LCDdrawstring(0, 0, argv[1]);
LCDdrawline(0, 7, 83, 7, BLACK);
LCDdrawstring(0, 9, argv[2]);
LCDdrawstring(0, 17, argv[3]);
LCDdrawstring(0, 25, argv[4]);
LCDdrawstring(0, 33, argv[5]);
LCDdrawstring(0, 41, argv[6]);
LCDdisplay();
delay(100);
}
return 0;
}