epaper 0.1.0 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/Rakefile +1 -1
- data/ext/epaper/DEV_Config.c +385 -0
- data/ext/epaper/DEV_Config.h +108 -0
- data/ext/epaper/Debug.h +47 -0
- data/ext/epaper/EPD_7in5_V2.c +321 -0
- data/ext/epaper/EPD_7in5_V2.h +49 -0
- data/ext/epaper/GUI_Paint.c +779 -0
- data/ext/epaper/GUI_Paint.h +215 -0
- data/ext/epaper/RPI_sysfs_gpio.c +152 -0
- data/ext/epaper/RPI_sysfs_gpio.h +82 -0
- data/ext/epaper/dev_hardware_SPI.c +362 -0
- data/ext/epaper/dev_hardware_SPI.h +120 -0
- data/ext/epaper/fonts.h +97 -0
- data/lib/epaper/version.rb +1 -1
- data/lib/epaper.rb +20 -1
- metadata +14 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18072d9581c0211fb2ffadcf529f31e2937dac5a8d71353a83d1b99301a2978c
|
4
|
+
data.tar.gz: d6321cea5dbe732f1204951ce8e1717e798bb344614bc9ccb590ad7311aea337
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6569536588da5aac3492ccbe3d48947720df4c0f0390480704bdbda62ed2b6ad8b06bed1631f14112a9c3a00282de68586f7a7cc37b176fdd230b1acee7a9f1
|
7
|
+
data.tar.gz: ca00dbd0d90ff8878c184a4d6e2c4a61911f9b83fa4acafc85c5f5be7f0c7083bfc0dd10d023031130d4065483d4951d33a054ec6fcd5c8a98f4b9365b0165e2
|
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
@@ -0,0 +1,385 @@
|
|
1
|
+
/*****************************************************************************
|
2
|
+
* | File : DEV_Config.c
|
3
|
+
* | Author : Waveshare team
|
4
|
+
* | Function : Hardware underlying interface
|
5
|
+
* | Info :
|
6
|
+
*----------------
|
7
|
+
* | This version: V3.0
|
8
|
+
* | Date : 2019-07-31
|
9
|
+
* | Info :
|
10
|
+
#
|
11
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
12
|
+
# of this software and associated documnetation files (the "Software"), to deal
|
13
|
+
# in the Software without restriction, including without limitation the rights
|
14
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
15
|
+
# copies of theex Software, and to permit persons to whom the Software is
|
16
|
+
# furished to do so, subject to the following conditions:
|
17
|
+
#
|
18
|
+
# The above copyright notice and this permission notice shall be included in
|
19
|
+
# all copies or substantial portions of the Software.
|
20
|
+
#
|
21
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
22
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
23
|
+
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
24
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
25
|
+
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
26
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
27
|
+
# THE SOFTWARE.
|
28
|
+
#
|
29
|
+
******************************************************************************/
|
30
|
+
#include "DEV_Config.h"
|
31
|
+
#include <fcntl.h>
|
32
|
+
|
33
|
+
/**
|
34
|
+
* GPIO
|
35
|
+
**/
|
36
|
+
int EPD_RST_PIN;
|
37
|
+
int EPD_DC_PIN;
|
38
|
+
int EPD_CS_PIN;
|
39
|
+
int EPD_BUSY_PIN;
|
40
|
+
|
41
|
+
/**
|
42
|
+
* GPIO read and write
|
43
|
+
**/
|
44
|
+
void DEV_Digital_Write(UWORD Pin, UBYTE Value)
|
45
|
+
{
|
46
|
+
#ifdef RPI
|
47
|
+
#ifdef USE_BCM2835_LIB
|
48
|
+
bcm2835_gpio_write(Pin, Value);
|
49
|
+
#elif USE_WIRINGPI_LIB
|
50
|
+
digitalWrite(Pin, Value);
|
51
|
+
#elif USE_DEV_LIB
|
52
|
+
SYSFS_GPIO_Write(Pin, Value);
|
53
|
+
#endif
|
54
|
+
#endif
|
55
|
+
|
56
|
+
#ifdef JETSON
|
57
|
+
#ifdef USE_DEV_LIB
|
58
|
+
SYSFS_GPIO_Write(Pin, Value);
|
59
|
+
#elif USE_HARDWARE_LIB
|
60
|
+
Debug("not support");
|
61
|
+
#endif
|
62
|
+
#endif
|
63
|
+
}
|
64
|
+
|
65
|
+
UBYTE DEV_Digital_Read(UWORD Pin)
|
66
|
+
{
|
67
|
+
UBYTE Read_value = 0;
|
68
|
+
#ifdef RPI
|
69
|
+
#ifdef USE_BCM2835_LIB
|
70
|
+
Read_value = bcm2835_gpio_lev(Pin);
|
71
|
+
#elif USE_WIRINGPI_LIB
|
72
|
+
Read_value = digitalRead(Pin);
|
73
|
+
#elif USE_DEV_LIB
|
74
|
+
Read_value = SYSFS_GPIO_Read(Pin);
|
75
|
+
#endif
|
76
|
+
#endif
|
77
|
+
|
78
|
+
#ifdef JETSON
|
79
|
+
#ifdef USE_DEV_LIB
|
80
|
+
Read_value = SYSFS_GPIO_Read(Pin);
|
81
|
+
#elif USE_HARDWARE_LIB
|
82
|
+
Debug("not support");
|
83
|
+
#endif
|
84
|
+
#endif
|
85
|
+
return Read_value;
|
86
|
+
}
|
87
|
+
|
88
|
+
/**
|
89
|
+
* SPI
|
90
|
+
**/
|
91
|
+
void DEV_SPI_WriteByte(uint8_t Value)
|
92
|
+
{
|
93
|
+
#ifdef RPI
|
94
|
+
#ifdef USE_BCM2835_LIB
|
95
|
+
bcm2835_spi_transfer(Value);
|
96
|
+
#elif USE_WIRINGPI_LIB
|
97
|
+
wiringPiSPIDataRW(0,&Value,1);
|
98
|
+
#elif USE_DEV_LIB
|
99
|
+
DEV_HARDWARE_SPI_TransferByte(Value);
|
100
|
+
#endif
|
101
|
+
#endif
|
102
|
+
|
103
|
+
#ifdef JETSON
|
104
|
+
#ifdef USE_DEV_LIB
|
105
|
+
SYSFS_software_spi_transfer(Value);
|
106
|
+
#elif USE_HARDWARE_LIB
|
107
|
+
Debug("not support");
|
108
|
+
#endif
|
109
|
+
#endif
|
110
|
+
}
|
111
|
+
|
112
|
+
void DEV_SPI_Write_nByte(uint8_t *pData, uint32_t Len)
|
113
|
+
{
|
114
|
+
#ifdef RPI
|
115
|
+
#ifdef USE_BCM2835_LIB
|
116
|
+
char rData[Len];
|
117
|
+
bcm2835_spi_transfernb((char *)pData,rData,Len);
|
118
|
+
#elif USE_WIRINGPI_LIB
|
119
|
+
wiringPiSPIDataRW(0, pData, Len);
|
120
|
+
#elif USE_DEV_LIB
|
121
|
+
DEV_HARDWARE_SPI_Transfer(pData, Len);
|
122
|
+
#endif
|
123
|
+
#endif
|
124
|
+
|
125
|
+
#ifdef JETSON
|
126
|
+
#ifdef USE_DEV_LIB
|
127
|
+
//JETSON nano waits for hardware SPI
|
128
|
+
Debug("not support");
|
129
|
+
#elif USE_HARDWARE_LIB
|
130
|
+
Debug("not support");
|
131
|
+
#endif
|
132
|
+
#endif
|
133
|
+
}
|
134
|
+
|
135
|
+
/**
|
136
|
+
* GPIO Mode
|
137
|
+
**/
|
138
|
+
void DEV_GPIO_Mode(UWORD Pin, UWORD Mode)
|
139
|
+
{
|
140
|
+
#ifdef RPI
|
141
|
+
#ifdef USE_BCM2835_LIB
|
142
|
+
if(Mode == 0 || Mode == BCM2835_GPIO_FSEL_INPT) {
|
143
|
+
bcm2835_gpio_fsel(Pin, BCM2835_GPIO_FSEL_INPT);
|
144
|
+
} else {
|
145
|
+
bcm2835_gpio_fsel(Pin, BCM2835_GPIO_FSEL_OUTP);
|
146
|
+
}
|
147
|
+
#elif USE_WIRINGPI_LIB
|
148
|
+
if(Mode == 0 || Mode == INPUT) {
|
149
|
+
pinMode(Pin, INPUT);
|
150
|
+
pullUpDnControl(Pin, PUD_UP);
|
151
|
+
} else {
|
152
|
+
pinMode(Pin, OUTPUT);
|
153
|
+
// Debug (" %d OUT \r\n",Pin);
|
154
|
+
}
|
155
|
+
#elif USE_DEV_LIB
|
156
|
+
SYSFS_GPIO_Export(Pin);
|
157
|
+
if(Mode == 0 || Mode == SYSFS_GPIO_IN) {
|
158
|
+
SYSFS_GPIO_Direction(Pin, SYSFS_GPIO_IN);
|
159
|
+
// Debug("IN Pin = %d\r\n",Pin);
|
160
|
+
} else {
|
161
|
+
SYSFS_GPIO_Direction(Pin, SYSFS_GPIO_OUT);
|
162
|
+
// Debug("OUT Pin = %d\r\n",Pin);
|
163
|
+
}
|
164
|
+
#endif
|
165
|
+
#endif
|
166
|
+
|
167
|
+
#ifdef JETSON
|
168
|
+
#ifdef USE_DEV_LIB
|
169
|
+
SYSFS_GPIO_Export(Pin);
|
170
|
+
SYSFS_GPIO_Direction(Pin, Mode);
|
171
|
+
#elif USE_HARDWARE_LIB
|
172
|
+
Debug("not support");
|
173
|
+
#endif
|
174
|
+
#endif
|
175
|
+
}
|
176
|
+
|
177
|
+
/**
|
178
|
+
* delay x ms
|
179
|
+
**/
|
180
|
+
void DEV_Delay_ms(UDOUBLE xms)
|
181
|
+
{
|
182
|
+
#ifdef RPI
|
183
|
+
#ifdef USE_BCM2835_LIB
|
184
|
+
bcm2835_delay(xms);
|
185
|
+
#elif USE_WIRINGPI_LIB
|
186
|
+
delay(xms);
|
187
|
+
#elif USE_DEV_LIB
|
188
|
+
UDOUBLE i;
|
189
|
+
for(i=0; i < xms; i++) {
|
190
|
+
usleep(1000);
|
191
|
+
}
|
192
|
+
#endif
|
193
|
+
#endif
|
194
|
+
|
195
|
+
#ifdef JETSON
|
196
|
+
UDOUBLE i;
|
197
|
+
for(i=0; i < xms; i++) {
|
198
|
+
usleep(1000);
|
199
|
+
}
|
200
|
+
#endif
|
201
|
+
}
|
202
|
+
|
203
|
+
static int DEV_Equipment_Testing(void)
|
204
|
+
{
|
205
|
+
int i;
|
206
|
+
int fd;
|
207
|
+
char value_str[20];
|
208
|
+
fd = open("/etc/issue", O_RDONLY);
|
209
|
+
printf("Current environment: ");
|
210
|
+
while(1) {
|
211
|
+
if (fd < 0) {
|
212
|
+
Debug( "Read failed Pin\n");
|
213
|
+
return -1;
|
214
|
+
}
|
215
|
+
for(i=0;; i++) {
|
216
|
+
if (read(fd, &value_str[i], 1) < 0) {
|
217
|
+
Debug( "failed to read value!\n");
|
218
|
+
return -1;
|
219
|
+
}
|
220
|
+
if(value_str[i] ==32) {
|
221
|
+
printf("\r\n");
|
222
|
+
break;
|
223
|
+
}
|
224
|
+
printf("%c",value_str[i]);
|
225
|
+
}
|
226
|
+
break;
|
227
|
+
}
|
228
|
+
#ifdef RPI
|
229
|
+
if(i<5) {
|
230
|
+
printf("Unrecognizable\r\n");
|
231
|
+
} else {
|
232
|
+
char RPI_System[10] = {"Raspbian"};
|
233
|
+
for(i=0; i<6; i++) {
|
234
|
+
if(RPI_System[i]!= value_str[i]) {
|
235
|
+
printf("Please make JETSON !!!!!!!!!!\r\n");
|
236
|
+
return -1;
|
237
|
+
}
|
238
|
+
}
|
239
|
+
}
|
240
|
+
#endif
|
241
|
+
#ifdef JETSON
|
242
|
+
if(i<5) {
|
243
|
+
Debug("Unrecognizable\r\n");
|
244
|
+
} else {
|
245
|
+
char JETSON_System[10]= {"Ubuntu"};
|
246
|
+
for(i=0; i<6; i++) {
|
247
|
+
if(JETSON_System[i]!= value_str[i] ) {
|
248
|
+
printf("Please make RPI !!!!!!!!!!\r\n");
|
249
|
+
return -1;
|
250
|
+
}
|
251
|
+
}
|
252
|
+
}
|
253
|
+
#endif
|
254
|
+
return 0;
|
255
|
+
}
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
void DEV_GPIO_Init(void)
|
260
|
+
{
|
261
|
+
#ifdef RPI
|
262
|
+
EPD_RST_PIN = 17;
|
263
|
+
EPD_DC_PIN = 25;
|
264
|
+
EPD_CS_PIN = 8;
|
265
|
+
EPD_BUSY_PIN = 24;
|
266
|
+
#elif JETSON
|
267
|
+
EPD_RST_PIN = GPIO17;
|
268
|
+
EPD_DC_PIN = GPIO25;
|
269
|
+
EPD_CS_PIN = SPI0_CS0;
|
270
|
+
EPD_BUSY_PIN = GPIO24;
|
271
|
+
#endif
|
272
|
+
|
273
|
+
DEV_GPIO_Mode(EPD_RST_PIN, 1);
|
274
|
+
DEV_GPIO_Mode(EPD_DC_PIN, 1);
|
275
|
+
DEV_GPIO_Mode(EPD_CS_PIN, 1);
|
276
|
+
DEV_GPIO_Mode(EPD_BUSY_PIN, 0);
|
277
|
+
|
278
|
+
DEV_Digital_Write(EPD_CS_PIN, 1);
|
279
|
+
}
|
280
|
+
/******************************************************************************
|
281
|
+
function: Module Initialize, the library and initialize the pins, SPI protocol
|
282
|
+
parameter:
|
283
|
+
Info:
|
284
|
+
******************************************************************************/
|
285
|
+
UBYTE DEV_Module_Init(void)
|
286
|
+
{
|
287
|
+
printf("/***********************************/ \r\n");
|
288
|
+
if(DEV_Equipment_Testing() < 0) {
|
289
|
+
return 1;
|
290
|
+
}
|
291
|
+
#ifdef RPI
|
292
|
+
#ifdef USE_BCM2835_LIB
|
293
|
+
if(!bcm2835_init()) {
|
294
|
+
printf("bcm2835 init failed !!! \r\n");
|
295
|
+
return 1;
|
296
|
+
} else {
|
297
|
+
printf("bcm2835 init success !!! \r\n");
|
298
|
+
}
|
299
|
+
|
300
|
+
// GPIO Config
|
301
|
+
DEV_GPIO_Init();
|
302
|
+
|
303
|
+
bcm2835_spi_begin(); //Start spi interface, set spi pin for the reuse function
|
304
|
+
bcm2835_spi_setBitOrder(BCM2835_SPI_BIT_ORDER_MSBFIRST); //High first transmission
|
305
|
+
bcm2835_spi_setDataMode(BCM2835_SPI_MODE0); //spi mode 0
|
306
|
+
bcm2835_spi_setClockDivider(BCM2835_SPI_CLOCK_DIVIDER_128); //Frequency
|
307
|
+
bcm2835_spi_chipSelect(BCM2835_SPI_CS0); //set CE0
|
308
|
+
bcm2835_spi_setChipSelectPolarity(BCM2835_SPI_CS0, LOW); //enable cs0
|
309
|
+
|
310
|
+
#elif USE_WIRINGPI_LIB
|
311
|
+
//if(wiringPiSetup() < 0)//use wiringpi Pin number table
|
312
|
+
if(wiringPiSetupGpio() < 0) { //use BCM2835 Pin number table
|
313
|
+
printf("set wiringPi lib failed !!! \r\n");
|
314
|
+
return 1;
|
315
|
+
} else {
|
316
|
+
printf("set wiringPi lib success !!! \r\n");
|
317
|
+
}
|
318
|
+
|
319
|
+
// GPIO Config
|
320
|
+
DEV_GPIO_Init();
|
321
|
+
wiringPiSPISetup(0,10000000);
|
322
|
+
// wiringPiSPISetupMode(0, 32000000, 0);
|
323
|
+
#elif USE_DEV_LIB
|
324
|
+
printf("Write and read /dev/spidev0.0 \r\n");
|
325
|
+
DEV_GPIO_Init();
|
326
|
+
DEV_HARDWARE_SPI_begin("/dev/spidev0.0");
|
327
|
+
DEV_HARDWARE_SPI_setSpeed(10000000);
|
328
|
+
#endif
|
329
|
+
|
330
|
+
#elif JETSON
|
331
|
+
#ifdef USE_DEV_LIB
|
332
|
+
DEV_GPIO_Init();
|
333
|
+
printf("Software spi\r\n");
|
334
|
+
SYSFS_software_spi_begin();
|
335
|
+
SYSFS_software_spi_setBitOrder(SOFTWARE_SPI_MSBFIRST);
|
336
|
+
SYSFS_software_spi_setDataMode(SOFTWARE_SPI_Mode0);
|
337
|
+
SYSFS_software_spi_setClockDivider(SOFTWARE_SPI_CLOCK_DIV4);
|
338
|
+
#elif USE_HARDWARE_LIB
|
339
|
+
printf("Write and read /dev/spidev0.0 \r\n");
|
340
|
+
DEV_GPIO_Init();
|
341
|
+
DEV_HARDWARE_SPI_begin("/dev/spidev0.0");
|
342
|
+
#endif
|
343
|
+
|
344
|
+
#endif
|
345
|
+
printf("/***********************************/ \r\n");
|
346
|
+
return 0;
|
347
|
+
}
|
348
|
+
|
349
|
+
/******************************************************************************
|
350
|
+
function: Module exits, closes SPI and BCM2835 library
|
351
|
+
parameter:
|
352
|
+
Info:
|
353
|
+
******************************************************************************/
|
354
|
+
void DEV_Module_Exit(void)
|
355
|
+
{
|
356
|
+
#ifdef RPI
|
357
|
+
#ifdef USE_BCM2835_LIB
|
358
|
+
DEV_Digital_Write(EPD_CS_PIN, LOW);
|
359
|
+
DEV_Digital_Write(EPD_DC_PIN, LOW);
|
360
|
+
DEV_Digital_Write(EPD_RST_PIN, LOW);
|
361
|
+
|
362
|
+
bcm2835_spi_end();
|
363
|
+
bcm2835_close();
|
364
|
+
#elif USE_WIRINGPI_LIB
|
365
|
+
DEV_Digital_Write(EPD_CS_PIN, 0);
|
366
|
+
DEV_Digital_Write(EPD_DC_PIN, 0);
|
367
|
+
DEV_Digital_Write(EPD_RST_PIN, 0);
|
368
|
+
#elif USE_DEV_LIB
|
369
|
+
DEV_HARDWARE_SPI_end();
|
370
|
+
DEV_Digital_Write(EPD_CS_PIN, 0);
|
371
|
+
DEV_Digital_Write(EPD_DC_PIN, 0);
|
372
|
+
DEV_Digital_Write(EPD_RST_PIN, 0);
|
373
|
+
#endif
|
374
|
+
|
375
|
+
#elif JETSON
|
376
|
+
#ifdef USE_DEV_LIB
|
377
|
+
SYSFS_GPIO_Unexport(EPD_CS_PIN);
|
378
|
+
SYSFS_GPIO_Unexport(EPD_DC_PIN);
|
379
|
+
SYSFS_GPIO_Unexport(EPD_RST_PIN);
|
380
|
+
SYSFS_GPIO_Unexport(EPD_BUSY_PIN);
|
381
|
+
#elif USE_HARDWARE_LIB
|
382
|
+
Debug("not support");
|
383
|
+
#endif
|
384
|
+
#endif
|
385
|
+
}
|
@@ -0,0 +1,108 @@
|
|
1
|
+
/*****************************************************************************
|
2
|
+
* | File : DEV_Config.h
|
3
|
+
* | Author : Waveshare team
|
4
|
+
* | Function : Hardware underlying interface
|
5
|
+
* | Info :
|
6
|
+
* Used to shield the underlying layers of each master
|
7
|
+
* and enhance portability
|
8
|
+
*----------------
|
9
|
+
* | This version: V2.0
|
10
|
+
* | Date : 2018-10-30
|
11
|
+
* | Info :
|
12
|
+
* 1.add:
|
13
|
+
* UBYTE\UWORD\UDOUBLE
|
14
|
+
* 2.Change:
|
15
|
+
* EPD_RST -> EPD_RST_PIN
|
16
|
+
* EPD_DC -> EPD_DC_PIN
|
17
|
+
* EPD_CS -> EPD_CS_PIN
|
18
|
+
* EPD_BUSY -> EPD_BUSY_PIN
|
19
|
+
* 3.Remote:
|
20
|
+
* EPD_RST_1\EPD_RST_0
|
21
|
+
* EPD_DC_1\EPD_DC_0
|
22
|
+
* EPD_CS_1\EPD_CS_0
|
23
|
+
* EPD_BUSY_1\EPD_BUSY_0
|
24
|
+
* 3.add:
|
25
|
+
* #define DEV_Digital_Write(_pin, _value) bcm2835_GPIOI_write(_pin, _value)
|
26
|
+
* #define DEV_Digital_Read(_pin) bcm2835_GPIOI_lev(_pin)
|
27
|
+
* #define DEV_SPI_WriteByte(__value) bcm2835_spi_transfer(__value)
|
28
|
+
#
|
29
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
30
|
+
# of this software and associated documnetation files (the "Software"), to deal
|
31
|
+
# in the Software without restriction, including without limitation the rights
|
32
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
33
|
+
# copies of the Software, and to permit persons to whom the Software is
|
34
|
+
# furished to do so, subject to the following conditions:
|
35
|
+
#
|
36
|
+
# The above copyright notice and this permission notice shall be included in
|
37
|
+
# all copies or substantial portions of the Software.
|
38
|
+
#
|
39
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
40
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
41
|
+
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
42
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
43
|
+
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
44
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
45
|
+
# THE SOFTWARE.
|
46
|
+
#
|
47
|
+
******************************************************************************/
|
48
|
+
#ifndef _DEV_CONFIG_H_
|
49
|
+
#define _DEV_CONFIG_H_
|
50
|
+
|
51
|
+
#include <stdint.h>
|
52
|
+
#include <stdio.h>
|
53
|
+
#include <unistd.h>
|
54
|
+
#include <errno.h>
|
55
|
+
#include <stdio.h>
|
56
|
+
#include <string.h>
|
57
|
+
#include "Debug.h"
|
58
|
+
|
59
|
+
#ifdef RPI
|
60
|
+
#ifdef USE_BCM2835_LIB
|
61
|
+
#include <bcm2835.h>
|
62
|
+
#elif USE_WIRINGPI_LIB
|
63
|
+
#include <wiringPi.h>
|
64
|
+
#include <wiringPiSPI.h>
|
65
|
+
#elif USE_DEV_LIB
|
66
|
+
#include "RPI_sysfs_gpio.h"
|
67
|
+
#include "dev_hardware_SPI.h"
|
68
|
+
#endif
|
69
|
+
#endif
|
70
|
+
|
71
|
+
#ifdef JETSON
|
72
|
+
#ifdef USE_DEV_LIB
|
73
|
+
#include "sysfs_gpio.h"
|
74
|
+
#include "sysfs_software_spi.h"
|
75
|
+
#elif USE_HARDWARE_LIB
|
76
|
+
|
77
|
+
#endif
|
78
|
+
|
79
|
+
#endif
|
80
|
+
|
81
|
+
/**
|
82
|
+
* data
|
83
|
+
**/
|
84
|
+
#define UBYTE uint8_t
|
85
|
+
#define UWORD uint16_t
|
86
|
+
#define UDOUBLE uint32_t
|
87
|
+
|
88
|
+
/**
|
89
|
+
* GPIOI config
|
90
|
+
**/
|
91
|
+
extern int EPD_RST_PIN;
|
92
|
+
extern int EPD_DC_PIN;
|
93
|
+
extern int EPD_CS_PIN;
|
94
|
+
extern int EPD_BUSY_PIN;
|
95
|
+
|
96
|
+
/*------------------------------------------------------------------------------------------------------*/
|
97
|
+
void DEV_Digital_Write(UWORD Pin, UBYTE Value);
|
98
|
+
UBYTE DEV_Digital_Read(UWORD Pin);
|
99
|
+
|
100
|
+
void DEV_SPI_WriteByte(UBYTE Value);
|
101
|
+
void DEV_SPI_Write_nByte(uint8_t *pData, uint32_t Len);
|
102
|
+
void DEV_Delay_ms(UDOUBLE xms);
|
103
|
+
|
104
|
+
UBYTE DEV_Module_Init(void);
|
105
|
+
void DEV_Module_Exit(void);
|
106
|
+
|
107
|
+
|
108
|
+
#endif
|
data/ext/epaper/Debug.h
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
/*****************************************************************************
|
2
|
+
* | File : Debug.h
|
3
|
+
* | Author : Waveshare team
|
4
|
+
* | Function : debug with printf
|
5
|
+
* | Info :
|
6
|
+
* Image scanning
|
7
|
+
* Please use progressive scanning to generate images or fonts
|
8
|
+
*----------------
|
9
|
+
* | This version: V2.0
|
10
|
+
* | Date : 2018-10-30
|
11
|
+
* | Info :
|
12
|
+
* 1.USE_DEBUG -> DEBUG, If you need to see the debug information,
|
13
|
+
* clear the execution: make DEBUG=-DDEBUG
|
14
|
+
#
|
15
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
16
|
+
# of this software and associated documnetation files (the "Software"), to deal
|
17
|
+
# in the Software without restriction, including without limitation the rights
|
18
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
19
|
+
# copies of the Software, and to permit persons to whom the Software is
|
20
|
+
# furished to do so, subject to the following conditions:
|
21
|
+
#
|
22
|
+
# The above copyright notice and this permission notice shall be included in
|
23
|
+
# all copies or substantial portions of the Software.
|
24
|
+
#
|
25
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
26
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
27
|
+
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
28
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
29
|
+
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
30
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
31
|
+
# THE SOFTWARE.
|
32
|
+
#
|
33
|
+
|
34
|
+
******************************************************************************/
|
35
|
+
#ifndef __DEBUG_H
|
36
|
+
#define __DEBUG_H
|
37
|
+
|
38
|
+
#include <stdio.h>
|
39
|
+
|
40
|
+
#if DEBUG
|
41
|
+
#define Debug(__info,...) printf("Debug: " __info,##__VA_ARGS__)
|
42
|
+
#else
|
43
|
+
#define Debug(__info,...)
|
44
|
+
#endif
|
45
|
+
|
46
|
+
#endif
|
47
|
+
|