-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathepd4in01f.h
89 lines (81 loc) · 2.3 KB
/
epd4in01f.h
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
/**
******************************************************************************
* @file edp4in01f.h
* @author Waveshare Team
* @version V1.0.0
* @date 29-Dec-2020
* @brief This file describes initialisation of 4.01f e-Papers
*
******************************************************************************
*/
/*****************************************************************************
EPD_4IN01F
******************************************************************************/
static void EPD_4IN01F_BusyHigh(void)// If BUSYN=0 then waiting
{
Serial.print("\r\ne-Paper busy\r\n");
while(!(digitalRead(BUSY_PIN)))
delay(50);
Serial.print("e-Paper busy release\r\n");
}
static void EPD_4IN01F_BusyLow(void)// If BUSYN=1 then waiting
{
Serial.print("\r\ne-Paper busy\r\n");
while(digitalRead(BUSY_PIN))
delay(50);
Serial.print("e-Paper busy release\r\n");
}
static void EPD_4IN01F_Show(void)
{
EPD_SendCommand(0x04);//0x04
EPD_4IN01F_BusyHigh();
EPD_SendCommand(0x12);//0x12
EPD_4IN01F_BusyHigh();
EPD_SendCommand(0x02);//0x02
EPD_4IN01F_BusyLow();
delay(200);
Serial.print("EPD_4IN01F_Show END\r\n");
delay(100);
EPD_SendCommand(0x07);//sleep
EPD_SendData(0xA5);
delay(100);
}
int EPD_4IN01F_init()
{
EPD_Reset();
EPD_4IN01F_BusyHigh();
EPD_SendCommand(0x00);
EPD_SendData(0x2f);
EPD_SendData(0x00);
EPD_SendCommand(0x01);
EPD_SendData(0x37);
EPD_SendData(0x00);
EPD_SendData(0x05);
EPD_SendData(0x05);
EPD_SendCommand(0x03);
EPD_SendData(0x00);
EPD_SendCommand(0x06);
EPD_SendData(0xC7);
EPD_SendData(0xC7);
EPD_SendData(0x1D);
EPD_SendCommand(0x41);
EPD_SendData(0x00);
EPD_SendCommand(0x50);
EPD_SendData(0x37);
EPD_SendCommand(0x60);
EPD_SendData(0x22);
EPD_SendCommand(0x61);
EPD_SendData(0x02);
EPD_SendData(0x80);
EPD_SendData(0x01);
EPD_SendData(0x90);
EPD_SendCommand(0xE3);
EPD_SendData(0xAA);
EPD_SendCommand(0x61);//Set Resolution setting
EPD_SendData(0x02);
EPD_SendData(0x80);
EPD_SendData(0x01);
EPD_SendData(0x90);
EPD_SendCommand(0x10);//begin write data to e-Paper
return 0;
}