Skip to content

Commit 0eeb670

Browse files
committed
bump display-interface
1 parent e5f5370 commit 0eeb670

10 files changed

+104
-88
lines changed

Cargo.toml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ sdio-host = { version = "0.6.0", optional = true }
3939
embedded-dma = "0.2.0"
4040
bare-metal = { version = "1" }
4141
void = { default-features = false, version = "1.0.2" }
42-
display-interface = { version = "0.4.1", optional = true }
42+
display-interface = { version = "0.5.0", optional = true }
43+
display-interface-04 = { package = "display-interface", version = "0.4.1", optional = true }
4344
fugit = "0.3.7"
4445
fugit-timer = "0.1.3"
4546
# rtic1
@@ -83,8 +84,9 @@ panic-semihosting = "0.6.0"
8384
cortex-m-semihosting = "0.5.0"
8485
heapless = "0.8"
8586
panic-halt = "0.2.0"
86-
ssd1306 = "0.7.1"
87-
embedded-graphics = "0.7.1"
87+
ssd1306 = "0.8.4"
88+
embedded-graphics = "0.8.1"
89+
embedded-graphics-07 = { package = "embedded-graphics", version = "0.7.1" }
8890
usb-device = "0.3.1"
8991
usbd-serial = "0.2.0"
9092
micromath = "2"
@@ -96,7 +98,8 @@ ist7920 = "0.1.1"
9698
smart-leds = "0.3.0"
9799
ws2812-spi = { version = "0.4.0", features = [] }
98100
hd44780-driver = "0.4.0"
99-
display-interface = "0.4"
101+
display-interface = "0.5"
102+
display-interface-04 = { package = "display-interface", version = "0.4.1" }
100103
ft6x06 = "0.1.2"
101104
ushell = "0.3.5"
102105

@@ -288,7 +291,7 @@ usb_fs = ["dep:synopsys-usb-otg", "synopsys-usb-otg/fs"]
288291
usb_hs = ["dep:synopsys-usb-otg", "synopsys-usb-otg/hs"]
289292

290293
## LCD support via FMC/FSMC peripheral. See [display-interface](https://crates.io/crates/display-interface)
291-
fsmc_lcd = ["dep:display-interface"]
294+
fsmc_lcd = ["dep:display-interface", "dep:display-interface-04"]
292295

293296
## SDIO peripheral support. See [sdio-host](https://crates.io/crates/sdio-host)
294297
sdio-host = ["dep:sdio-host"]

examples/analog-stopwatch-with-spi-ssd1306.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ fn main() -> ! {
147147
let mut format_buf = String::<10>::new();
148148
format_elapsed(&mut format_buf, elapsed);
149149

150-
disp.clear();
150+
disp.clear_buffer();
151151

152152
let state = free(|cs| STATE.borrow(cs).get());
153153
let state_msg = match state {

examples/display-touch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use stm32f4xx_hal::{
2525
rcc::Rcc,
2626
};
2727

28-
use embedded_graphics::{
28+
use embedded_graphics_07::{
2929
pixelcolor::Rgb565,
3030
prelude::*,
3131
primitives::{Circle, PrimitiveStyle},

examples/f413disco-lcd-ferris.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ use crate::hal::{
2222
prelude::*,
2323
};
2424

25-
use embedded_graphics::geometry::Size;
26-
use embedded_graphics::image::*;
27-
use embedded_graphics::pixelcolor::Rgb565;
28-
use embedded_graphics::prelude::*;
29-
use embedded_graphics::primitives::*;
25+
use embedded_graphics_07::geometry::Size;
26+
use embedded_graphics_07::image::*;
27+
use embedded_graphics_07::pixelcolor::Rgb565;
28+
use embedded_graphics_07::prelude::*;
29+
use embedded_graphics_07::primitives::*;
3030
use st7789::*;
3131

32-
pub use display_interface::{DisplayError, WriteOnlyDataCommand};
32+
pub use display_interface_04::{DisplayError, WriteOnlyDataCommand};
3333

3434
/// Define the lovely ferris crab sprite
3535
const FERRIS: [u8; 11008] = [

examples/rng-display.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ fn main() -> ! {
8787
let mut format_buf = String::<20>::new();
8888
loop {
8989
//display clear
90-
disp.clear();
90+
disp.clear_buffer();
9191

9292
//this will continuously report an error if RNG_CLK < HCLK/16
9393
let rand_val = rand_source.next_u32();

examples/rtic-usart-shell-ssd1306.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ mod usart_shell {
190190
} else {
191191
write!(ledstr, "LED is OFF").unwrap();
192192
}
193-
ldisp.clear();
193+
ldisp.clear_buffer();
194194
Text::with_baseline(fpsstr.as_str(), Point::zero(), text_style, Baseline::Top)
195195
.draw(ldisp)
196196
.unwrap();

examples/st7789-lcd.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ use core::slice::Iter;
2525
use cortex_m_rt::entry;
2626
use panic_semihosting as _;
2727

28-
use embedded_graphics::pixelcolor::Rgb565;
29-
use embedded_graphics::prelude::*;
28+
use embedded_graphics_07::pixelcolor::Rgb565;
29+
use embedded_graphics_07::prelude::*;
3030

31-
use embedded_graphics::primitives::{Circle, PrimitiveStyle};
31+
use embedded_graphics_07::primitives::{Circle, PrimitiveStyle};
3232
use st7789::ST7789;
3333
use stm32f4xx_hal::fsmc_lcd::{DataPins16, FsmcLcd, LcdPins, Timing};
3434
use stm32f4xx_hal::pac::{CorePeripherals, Peripherals};

examples/stopwatch-with-ssd1306-and-interrupts-and-dma-i2c.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use core::ops::DerefMut;
3838
use core::sync::atomic::{AtomicBool, Ordering};
3939
use cortex_m::interrupt::{free, CriticalSection, Mutex};
4040
use cortex_m_rt::entry;
41-
use display_interface::{DataFormat, DisplayError, WriteOnlyDataCommand};
41+
use display_interface_04::{DataFormat, DisplayError, WriteOnlyDataCommand};
4242
use embedded_graphics::{
4343
mono_font::{
4444
ascii::{FONT_6X12, FONT_9X15},
@@ -226,7 +226,7 @@ fn main() -> ! {
226226
let mut format_buf = String::<10>::new();
227227
format_elapsed(&mut format_buf, elapsed);
228228

229-
disp.clear();
229+
disp.clear_buffer();
230230

231231
let state = free(|cs| STATE.borrow(cs).get());
232232
let state_msg = match state {

examples/stopwatch-with-ssd1306-and-interrupts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ fn main() -> ! {
109109
let mut format_buf = String::<10>::new();
110110
format_elapsed(&mut format_buf, elapsed);
111111

112-
disp.clear();
112+
disp.clear_buffer();
113113

114114
let state = free(|cs| STATE.borrow(cs).get());
115115
let state_msg = match state {
Lines changed: 80 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,89 @@
1-
use display_interface::{DataFormat, DisplayError, WriteOnlyDataCommand};
2-
31
use super::{Lcd, SubBank};
42

5-
impl<S> WriteOnlyDataCommand for Lcd<S>
6-
where
7-
S: SubBank,
8-
{
9-
fn send_commands(&mut self, cmd: DataFormat<'_>) -> Result<(), DisplayError> {
10-
match cmd {
11-
DataFormat::U8(slice) => {
12-
for value in slice {
13-
self.write_command(u16::from(*value));
14-
}
15-
}
16-
DataFormat::U16(slice) => {
17-
for value in slice {
18-
self.write_command(*value);
19-
}
20-
}
21-
DataFormat::U16BE(slice) | DataFormat::U16LE(slice) => {
22-
// As long as the data bus is 16 bits wide, the byte order doesn't matter.
23-
for value in slice {
24-
self.write_command(*value);
3+
macro_rules! impl_display_interface {
4+
($display_interface:ident) => {
5+
impl<S> $display_interface::WriteOnlyDataCommand for Lcd<S>
6+
where
7+
S: SubBank,
8+
{
9+
fn send_commands(
10+
&mut self,
11+
cmd: $display_interface::DataFormat<'_>,
12+
) -> Result<(), $display_interface::DisplayError> {
13+
use $display_interface::DataFormat;
14+
match cmd {
15+
DataFormat::U8(slice) => {
16+
for value in slice {
17+
self.write_command(u16::from(*value));
18+
}
19+
}
20+
DataFormat::U16(slice) => {
21+
for value in slice {
22+
self.write_command(*value);
23+
}
24+
}
25+
DataFormat::U16BE(slice) | DataFormat::U16LE(slice) => {
26+
// As long as the data bus is 16 bits wide, the byte order doesn't matter.
27+
for value in slice {
28+
self.write_command(*value);
29+
}
30+
}
31+
DataFormat::U8Iter(iter) => {
32+
for value in iter {
33+
self.write_command(u16::from(value));
34+
}
35+
}
36+
DataFormat::U16BEIter(iter) | DataFormat::U16LEIter(iter) => {
37+
// As long as the data bus is 16 bits wide, the byte order doesn't matter.
38+
for value in iter {
39+
self.write_command(value);
40+
}
41+
}
42+
_ => return Err($display_interface::DisplayError::DataFormatNotImplemented),
2543
}
44+
Ok(())
2645
}
27-
DataFormat::U8Iter(iter) => {
28-
for value in iter {
29-
self.write_command(u16::from(value));
30-
}
31-
}
32-
DataFormat::U16BEIter(iter) | DataFormat::U16LEIter(iter) => {
33-
// As long as the data bus is 16 bits wide, the byte order doesn't matter.
34-
for value in iter {
35-
self.write_command(value);
36-
}
37-
}
38-
_ => return Err(DisplayError::DataFormatNotImplemented),
39-
}
40-
Ok(())
41-
}
4246

43-
fn send_data(&mut self, buf: DataFormat<'_>) -> Result<(), DisplayError> {
44-
match buf {
45-
DataFormat::U8(slice) => {
46-
for value in slice {
47-
self.write_data(u16::from(*value));
47+
fn send_data(
48+
&mut self,
49+
buf: $display_interface::DataFormat<'_>,
50+
) -> Result<(), $display_interface::DisplayError> {
51+
use $display_interface::DataFormat;
52+
match buf {
53+
DataFormat::U8(slice) => {
54+
for value in slice {
55+
self.write_data(u16::from(*value));
56+
}
57+
}
58+
DataFormat::U16(slice) => {
59+
for value in slice {
60+
self.write_data(*value);
61+
}
62+
}
63+
DataFormat::U16BE(slice) | DataFormat::U16LE(slice) => {
64+
// As long as the data bus is 16 bits wide, the byte order doesn't matter.
65+
for value in slice {
66+
self.write_data(*value);
67+
}
68+
}
69+
DataFormat::U8Iter(iter) => {
70+
for value in iter {
71+
self.write_data(u16::from(value));
72+
}
73+
}
74+
DataFormat::U16BEIter(iter) | DataFormat::U16LEIter(iter) => {
75+
// As long as the data bus is 16 bits wide, the byte order doesn't matter.
76+
for value in iter {
77+
self.write_data(value);
78+
}
79+
}
80+
_ => return Err($display_interface::DisplayError::DataFormatNotImplemented),
4881
}
82+
Ok(())
4983
}
50-
DataFormat::U16(slice) => {
51-
for value in slice {
52-
self.write_data(*value);
53-
}
54-
}
55-
DataFormat::U16BE(slice) | DataFormat::U16LE(slice) => {
56-
// As long as the data bus is 16 bits wide, the byte order doesn't matter.
57-
for value in slice {
58-
self.write_data(*value);
59-
}
60-
}
61-
DataFormat::U8Iter(iter) => {
62-
for value in iter {
63-
self.write_data(u16::from(value));
64-
}
65-
}
66-
DataFormat::U16BEIter(iter) | DataFormat::U16LEIter(iter) => {
67-
// As long as the data bus is 16 bits wide, the byte order doesn't matter.
68-
for value in iter {
69-
self.write_data(value);
70-
}
71-
}
72-
_ => return Err(DisplayError::DataFormatNotImplemented),
7384
}
74-
Ok(())
75-
}
85+
};
7686
}
87+
88+
impl_display_interface!(display_interface);
89+
impl_display_interface!(display_interface_04);

0 commit comments

Comments
 (0)