Skip to content

Commit a9cdd17

Browse files
committed
getting some response
1 parent ba2f88e commit a9cdd17

File tree

3 files changed

+38
-16
lines changed

3 files changed

+38
-16
lines changed

src/Adafruit_EPD.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#ifndef _ADAFRUIT_EPD_H_
2121
#define _ADAFRUIT_EPD_H_
2222

23-
//#define EPD_DEBUG
23+
#define EPD_DEBUG
2424

2525
#define RAMBUFSIZE 64 ///< size of the ram buffer
2626

src/drivers/Adafruit_ACeP.cpp

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// clang-format off
77

88
const uint8_t acep_default_init_code[] {
9+
0xFF, 10, // wait a lil bit
910
ACEP_PANEL_SETTING, 2, 0xEF, 0x08, // LUT from OTP
1011
ACEP_POWER_SETTING, 4, 0x37, 0x00, 0x23, 0x23, // 0x05&0x05?
1112
ACEP_POWER_OFF_SEQUENCE, 1, 0x00,
@@ -16,6 +17,8 @@ const uint8_t acep_default_init_code[] {
1617
ACEP_TCON, 1, 0x22,
1718
ACEP_RESOLUTION, 4, 0x02, 0x58, 0x01, 0xC0,
1819
ACEP_PWS, 1, 0xAA,
20+
0xFF, 100, // 100 ms delay
21+
ACEP_CDI, 1, 0x37,
1922
0xFE};
2023

2124
// clang-format on
@@ -119,7 +122,7 @@ void Adafruit_ACEP::begin(bool reset) {
119122
Adafruit_EPD::begin(reset);
120123

121124
delay(100);
122-
powerDown();
125+
//powerDown();
123126
}
124127

125128
/**************************************************************************/
@@ -128,20 +131,25 @@ void Adafruit_ACEP::begin(bool reset) {
128131
*/
129132
/**************************************************************************/
130133
void Adafruit_ACEP::update() {
134+
131135
uint8_t buf[4];
132-
/*
133-
// clear data
136+
/***************** clear data first */
134137
buf[0] = 0x02;
135138
buf[1] = 0x58;
136139
buf[2] = 0x01;
137140
buf[3] = 0xC0;
138141
EPD_command(ACEP_RESOLUTION, buf, 4);
142+
139143
EPD_command(ACEP_DTM);
140-
for (int i=0; i< 134400/256; i++) {
144+
uint32_t remaining = (600UL * 448UL / 2);
145+
while (remaining) {
141146
uint8_t block[256];
142-
memset(block, 0x77, 256);
143-
EPD_data(block, 256);
147+
uint32_t numbytes = min(remaining, sizeof(block));
148+
memset(block, 0x77, numbytes);
149+
EPD_data(block, numbytes);
150+
remaining -= numbytes;
144151
}
152+
145153
EPD_command(ACEP_POWER_ON);
146154
busy_wait();
147155
EPD_command(ACEP_DISPLAY_REFRESH);
@@ -154,26 +162,40 @@ void Adafruit_ACEP::update() {
154162
}
155163
} else {
156164
delay(BUSY_WAIT);
157-
}*/
165+
}
166+
167+
delay(500);
158168

159169
// actual data
160-
// clear data
170+
// setresolution, write data
161171
buf[0] = 0x02;
162172
buf[1] = 0x58;
163173
buf[2] = 0x01;
164174
buf[3] = 0xC0;
165175
EPD_command(ACEP_RESOLUTION, buf, 4);
166176
EPD_command(ACEP_DTM);
167-
for (int i = 0; i < 134400 / 256; i++) {
177+
178+
remaining = (600UL * 448UL / 2);
179+
while (remaining) {
168180
uint8_t block[256];
169-
memset(block, ((i % 6) << 4) | (i % 6), 256);
170-
EPD_data(block, 256);
181+
uint32_t numbytes = min(remaining, sizeof(block));
182+
memset(block, 0x44, numbytes);
183+
EPD_data(block, numbytes);
184+
remaining -= numbytes;
171185
}
186+
172187
EPD_command(ACEP_POWER_ON);
173188
busy_wait();
174189
EPD_command(ACEP_DISPLAY_REFRESH);
175190
busy_wait();
176191
EPD_command(ACEP_POWER_OFF);
192+
if (_busy_pin >= 0) {
193+
while (digitalRead(_busy_pin)) { // wait for busy LOW
194+
delay(10);
195+
}
196+
} else {
197+
delay(BUSY_WAIT);
198+
}
177199
}
178200

179201
/**************************************************************************/
@@ -193,11 +215,11 @@ void Adafruit_ACEP::powerUp() {
193215
init_code = _epd_init_code;
194216
}
195217
EPD_commandList(init_code);
196-
delay(1000);
197-
buf[0] = 0x37;
198-
EPD_command(ACEP_CDI, buf, 1);
218+
delay(100);
199219
}
200220

221+
222+
201223
/**************************************************************************/
202224
/*!
203225
@brief wind down the display

src/drivers/Adafruit_ACeP.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#define ACEP_DTM 0x10
1515
#define ACEP_DISPLAY_REFRESH 0x12
1616
#define ACEP_PLL 0x30
17-
#define ACEP_TSE 0x41
17+
#define ACEP_TSE 0x40
1818
#define ACEP_CDI 0x50
1919
#define ACEP_TCON 0x60
2020
#define ACEP_RESOLUTION 0x61

0 commit comments

Comments
 (0)