Skip to content

Commit fbf10ed

Browse files
authored
Merge pull request #26 from therealprof/e-h-1.0.0-alpha.8
Adds support for embedded-hal v1.0.0-alpha.8 traits
2 parents d61f3e7 + 78905ca commit fbf10ed

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

spi/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "display-interface-spi"
33
description = "Generic SPI implementation for display interfaces"
4-
version = "0.4.1"
4+
version = "0.5.0-alpha.1"
55
authors = ["Daniel Egger <[email protected]>"]
66
repository = "https://github.com/therealprof/display-interface"
77
documentation = "https://docs.rs/display-interface-spi"
@@ -18,6 +18,6 @@ edition = "2018"
1818
all-features = true
1919

2020
[dependencies]
21-
embedded-hal = "0.2.3"
22-
display-interface = "0.4"
21+
embedded-hal = "1.0.0-alpha.8"
22+
display-interface = "0.4.1"
2323
byte-slice-cast = { version = "0.3.5", default-features = false }

spi/src/lib.rs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,20 @@
22

33
//! Generic SPI interface for display drivers
44
5-
use embedded_hal::blocking::spi;
6-
use embedded_hal::digital::v2::OutputPin;
5+
use embedded_hal::{
6+
digital::blocking::OutputPin,
7+
spi::blocking::{SpiBusWrite, SpiDevice},
8+
};
79

810
use display_interface::{DataFormat, DisplayError, WriteOnlyDataCommand};
911

1012
type Result = core::result::Result<(), DisplayError>;
1113

12-
fn send_u8<SPI: spi::Write<u8>>(spi: &mut SPI, words: DataFormat<'_>) -> Result {
14+
fn send_u8<SPI>(spi: &mut SPI, words: DataFormat<'_>) -> Result
15+
where
16+
SPI: SpiDevice,
17+
SPI::Bus: SpiBusWrite,
18+
{
1319
match words {
1420
DataFormat::U8(slice) => spi.write(slice).map_err(|_| DisplayError::BusWriteError),
1521
DataFormat::U16(slice) => {
@@ -115,7 +121,8 @@ pub struct SPIInterface<SPI, DC, CS> {
115121

116122
impl<SPI, DC, CS> SPIInterface<SPI, DC, CS>
117123
where
118-
SPI: spi::Write<u8>,
124+
SPI: SpiDevice,
125+
SPI::Bus: SpiBusWrite,
119126
DC: OutputPin,
120127
CS: OutputPin,
121128
{
@@ -149,7 +156,8 @@ where
149156

150157
impl<SPI, DC, CS> WriteOnlyDataCommand for SPIInterface<SPI, DC, CS>
151158
where
152-
SPI: spi::Write<u8>,
159+
SPI: SpiDevice,
160+
SPI::Bus: SpiBusWrite,
153161
DC: OutputPin,
154162
CS: OutputPin,
155163
{
@@ -172,7 +180,8 @@ pub struct SPIInterfaceNoCS<SPI, DC> {
172180

173181
impl<SPI, DC> SPIInterfaceNoCS<SPI, DC>
174182
where
175-
SPI: spi::Write<u8>,
183+
SPI: SpiDevice,
184+
SPI::Bus: SpiBusWrite,
176185
DC: OutputPin,
177186
{
178187
/// Create new SPI interface for communciation with a display driver
@@ -189,7 +198,8 @@ where
189198

190199
impl<SPI, DC> WriteOnlyDataCommand for SPIInterfaceNoCS<SPI, DC>
191200
where
192-
SPI: spi::Write<u8>,
201+
SPI: SpiDevice,
202+
SPI::Bus: SpiBusWrite,
193203
DC: OutputPin,
194204
{
195205
fn send_commands(&mut self, cmds: DataFormat<'_>) -> Result {

0 commit comments

Comments
 (0)