Skip to content

Commit 7b4a7f0

Browse files
authored
v0.3.2 - some timing fixes (#29)
* Fixed some missing wait_until_idle calls * prepared release of 0.3.2 * cargo fmt This is known to fail on travis because it uses the deprecated old digital v1 embedded hal pins
1 parent 20fc874 commit 7b4a7f0

File tree

5 files changed

+76
-19
lines changed

5 files changed

+76
-19
lines changed

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10-
<!-- ## [v0.3.1] - 2019-04-04 -->
10+
<!-- ## [v0.3.2] - 2019-04-04 -->
11+
12+
## [v0.3.2] - 2019-06-17
13+
14+
### Fixed
15+
- Added some more missing wait_until_idle calls
1116

1217
## [v0.3.1] - 2019-04-06
1318

@@ -61,6 +66,7 @@ Initial release with Changelog
6166
- Renamed to `epd-waveshare`
6267

6368

64-
[Unreleased]: https://github.com/Caemor/eink-waveshare-rs/compare/v0.3.1...HEAD
69+
[Unreleased]: https://github.com/Caemor/eink-waveshare-rs/compare/v0.3.2...HEAD
70+
[v0.3.2]: https://github.com/Caemor/eink-waveshare-rs/compare/v0.3.1...v0.3.2
6571
[v0.3.1]: https://github.com/Caemor/eink-waveshare-rs/compare/v0.3.0...v0.3.1
6672
[v0.3.0]: https://github.com/Caemor/eink-waveshare-rs/compare/v0.2.0...v0.3.0

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ license = "ISC"
99
name = "epd-waveshare"
1010
readme = "README.md"
1111
repository = "https://github.com/Caemor/epd-waveshare.git"
12-
version = "0.3.1"
12+
version = "0.3.2"
1313
edition = "2018"
1414

1515
[badges]

src/epd1in54/mod.rs

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ where
125125
self.interface
126126
.cmd_with_data(spi, Command::DATA_ENTRY_MODE_SETTING, &[0x03])?;
127127

128-
self.set_lut(spi, None)
128+
self.set_lut(spi, None)?;
129+
130+
self.wait_until_idle();
131+
Ok(())
129132
}
130133
}
131134

@@ -188,7 +191,10 @@ where
188191
fn update_frame(&mut self, spi: &mut SPI, buffer: &[u8]) -> Result<(), SPI::Error> {
189192
self.use_full_frame(spi)?;
190193
self.interface
191-
.cmd_with_data(spi, Command::WRITE_RAM, buffer)
194+
.cmd_with_data(spi, Command::WRITE_RAM, buffer)?;
195+
196+
self.wait_until_idle();
197+
Ok(())
192198
}
193199

194200
//TODO: update description: last 3 bits will be ignored for width and x_pos
@@ -205,7 +211,10 @@ where
205211
self.set_ram_counter(spi, x, y)?;
206212

207213
self.interface
208-
.cmd_with_data(spi, Command::WRITE_RAM, buffer)
214+
.cmd_with_data(spi, Command::WRITE_RAM, buffer)?;
215+
216+
self.wait_until_idle();
217+
Ok(())
209218
}
210219

211220
fn display_frame(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {
@@ -230,7 +239,11 @@ where
230239
let color = self.background_color.get_byte_value();
231240

232241
self.interface.cmd(spi, Command::WRITE_RAM)?;
233-
self.interface.data_x_times(spi, color, WIDTH / 8 * HEIGHT)
242+
self.interface
243+
.data_x_times(spi, color, WIDTH / 8 * HEIGHT)?;
244+
245+
self.wait_until_idle();
246+
Ok(())
234247
}
235248

236249
fn set_background_color(&mut self, background_color: Color) {
@@ -309,7 +322,10 @@ where
309322
end_y as u8,
310323
(end_y >> 8) as u8,
311324
],
312-
)
325+
)?;
326+
327+
self.wait_until_idle();
328+
Ok(())
313329
}
314330

315331
pub(crate) fn set_ram_counter(
@@ -336,8 +352,12 @@ where
336352

337353
fn set_lut_helper(&mut self, spi: &mut SPI, buffer: &[u8]) -> Result<(), SPI::Error> {
338354
assert!(buffer.len() == 30);
355+
339356
self.interface
340-
.cmd_with_data(spi, Command::WRITE_LUT_REGISTER, buffer)
357+
.cmd_with_data(spi, Command::WRITE_LUT_REGISTER, buffer)?;
358+
359+
self.wait_until_idle();
360+
Ok(())
341361
}
342362
}
343363

src/epd2in9/mod.rs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,20 @@ where
180180
spi: &mut SPI,
181181
delay: &mut DELAY,
182182
) -> Result<(), SPI::Error> {
183-
self.init(spi, delay)
183+
self.init(spi, delay)?;
184+
185+
self.wait_until_idle();
186+
Ok(())
184187
}
185188

186189
fn update_frame(&mut self, spi: &mut SPI, buffer: &[u8]) -> Result<(), SPI::Error> {
187190
self.use_full_frame(spi)?;
188191

189192
self.interface
190-
.cmd_with_data(spi, Command::WRITE_RAM, buffer)
193+
.cmd_with_data(spi, Command::WRITE_RAM, buffer)?;
194+
195+
self.wait_until_idle();
196+
Ok(())
191197
}
192198

193199
//TODO: update description: last 3 bits will be ignored for width and x_pos
@@ -204,7 +210,10 @@ where
204210
self.set_ram_counter(spi, x, y)?;
205211

206212
self.interface
207-
.cmd_with_data(spi, Command::WRITE_RAM, buffer)
213+
.cmd_with_data(spi, Command::WRITE_RAM, buffer)?;
214+
215+
self.wait_until_idle();
216+
Ok(())
208217
}
209218

210219
fn display_frame(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {
@@ -229,7 +238,11 @@ where
229238
let color = self.background_color.get_byte_value();
230239

231240
self.interface.cmd(spi, Command::WRITE_RAM)?;
232-
self.interface.data_x_times(spi, color, WIDTH / 8 * HEIGHT)
241+
self.interface
242+
.data_x_times(spi, color, WIDTH / 8 * HEIGHT)?;
243+
244+
self.wait_until_idle();
245+
Ok(())
233246
}
234247

235248
fn set_background_color(&mut self, background_color: Color) {
@@ -332,7 +345,9 @@ where
332345
fn set_lut_helper(&mut self, spi: &mut SPI, buffer: &[u8]) -> Result<(), SPI::Error> {
333346
assert!(buffer.len() == 30);
334347
self.interface
335-
.cmd_with_data(spi, Command::WRITE_LUT_REGISTER, buffer)
348+
.cmd_with_data(spi, Command::WRITE_LUT_REGISTER, buffer)?;
349+
self.wait_until_idle();
350+
Ok(())
336351
}
337352
}
338353

src/epd4in2/mod.rs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ where
128128

129129
self.set_lut(spi, None)?;
130130

131+
self.wait_until_idle();
131132
Ok(())
132133
}
133134
}
@@ -200,7 +201,10 @@ where
200201
self.command(spi, Command::POWER_OFF)?;
201202
self.wait_until_idle();
202203
self.interface
203-
.cmd_with_data(spi, Command::DEEP_SLEEP, &[0xA5])
204+
.cmd_with_data(spi, Command::DEEP_SLEEP, &[0xA5])?;
205+
206+
self.wait_until_idle();
207+
Ok(())
204208
}
205209

206210
fn update_frame(&mut self, spi: &mut SPI, buffer: &[u8]) -> Result<(), SPI::Error> {
@@ -221,7 +225,10 @@ where
221225
.data_x_times(spi, color_value, WIDTH / 8 * HEIGHT)?;
222226

223227
self.interface
224-
.cmd_with_data(spi, Command::DATA_START_TRANSMISSION_2, buffer)
228+
.cmd_with_data(spi, Command::DATA_START_TRANSMISSION_2, buffer)?;
229+
230+
self.wait_until_idle();
231+
Ok(())
225232
}
226233

227234
fn update_partial_frame(
@@ -265,7 +272,10 @@ where
265272

266273
self.send_data(spi, buffer)?;
267274

268-
self.command(spi, Command::PARTIAL_OUT)
275+
self.command(spi, Command::PARTIAL_OUT)?;
276+
277+
self.wait_until_idle();
278+
Ok(())
269279
}
270280

271281
fn display_frame(&mut self, spi: &mut SPI) -> Result<(), SPI::Error> {
@@ -288,7 +298,10 @@ where
288298
self.interface
289299
.cmd(spi, Command::DATA_START_TRANSMISSION_2)?;
290300
self.interface
291-
.data_x_times(spi, color_value, WIDTH / 8 * HEIGHT)
301+
.data_x_times(spi, color_value, WIDTH / 8 * HEIGHT)?;
302+
303+
self.wait_until_idle();
304+
Ok(())
292305
}
293306

294307
fn set_background_color(&mut self, color: Color) {
@@ -397,7 +410,10 @@ where
397410
self.cmd_with_data(spi, Command::LUT_WHITE_TO_BLACK, lut_wb)?;
398411

399412
// LUT BLACK to BLACK
400-
self.cmd_with_data(spi, Command::LUT_BLACK_TO_BLACK, lut_bb)
413+
self.cmd_with_data(spi, Command::LUT_BLACK_TO_BLACK, lut_bb)?;
414+
415+
self.wait_until_idle();
416+
Ok(())
401417
}
402418
}
403419

0 commit comments

Comments
 (0)