Skip to content

Commit 133aef1

Browse files
committed
Added default transactional spi impl
1 parent 7b619fa commit 133aef1

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

Cargo.toml

+5
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,8 @@ required-features = ["rt", "stm32f429"]
124124
[[example]]
125125
name = "rng-display"
126126
required-features = ["rt", "stm32f407"]
127+
128+
129+
[patch.crates-io]
130+
#embedded-hal = { git = "https://github.com/ryankurte/embedded-hal.git", branch = "feature/spi-transactions" }
131+
embedded-hal = { path = "../embedded-hal" }

src/spi.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1059,3 +1059,8 @@ impl<SPI, PINS> embedded_hal::blocking::spi::write::Default<u8> for Spi<SPI, PIN
10591059
SPI: Deref<Target = spi1::RegisterBlock>
10601060
{
10611061
}
1062+
1063+
impl<SPI, PINS> embedded_hal::blocking::spi::transactional::Default<u8> for Spi<SPI, PINS> where
1064+
SPI: Deref<Target = spi1::RegisterBlock>
1065+
{
1066+
}

src/timer.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use cast::{u16, u32};
44
use cortex_m::peripheral::syst::SystClkSource;
55
use cortex_m::peripheral::SYST;
66
use embedded_hal::timer::{Cancel, CountDown, Periodic};
7-
use void::Void;
7+
use core::convert::Infallible;
88

99
use crate::stm32::RCC;
1010
#[cfg(any(
@@ -146,7 +146,7 @@ impl CountDown for Timer<SYST> {
146146
self.tim.enable_counter();
147147
}
148148

149-
fn wait(&mut self) -> nb::Result<(), Void> {
149+
fn wait(&mut self) -> nb::Result<(), Infallible> {
150150
if self.tim.has_wrapped() {
151151
Ok(())
152152
} else {
@@ -264,7 +264,7 @@ macro_rules! hal {
264264
self.tim.cr1.modify(|_, w| w.cen().set_bit());
265265
}
266266

267-
fn wait(&mut self) -> nb::Result<(), Void> {
267+
fn wait(&mut self) -> nb::Result<(), Infallible> {
268268
if self.tim.sr.read().uif().bit_is_clear() {
269269
Err(nb::Error::WouldBlock)
270270
} else {

0 commit comments

Comments
 (0)