aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2022-02-12 02:26:15 +0100
committerDario Nieuwenhuis <[email protected]>2022-02-12 02:45:52 +0100
commit340eb4eeadd1c7a022143d92bf6e3bb7ce141131 (patch)
tree6081c324f814f1aa59f6bbf3c1f8cb51f208c950 /embassy-stm32/src
parentf2eb4389055ae6cf135168c1e5cb6ccd27800d63 (diff)
stm32: add rust stable support
Diffstat (limited to 'embassy-stm32/src')
-rw-r--r--embassy-stm32/src/exti.rs6
-rw-r--r--embassy-stm32/src/i2c/v2.rs8
-rw-r--r--embassy-stm32/src/lib.rs6
-rw-r--r--embassy-stm32/src/spi/mod.rs7
-rw-r--r--embassy-stm32/src/usart/mod.rs7
5 files changed, 28 insertions, 6 deletions
diff --git a/embassy-stm32/src/exti.rs b/embassy-stm32/src/exti.rs
index 7d974c2dc..07d086843 100644
--- a/embassy-stm32/src/exti.rs
+++ b/embassy-stm32/src/exti.rs
@@ -150,7 +150,6 @@ mod eh02 {
150mod eh1 { 150mod eh1 {
151 use super::*; 151 use super::*;
152 use core::convert::Infallible; 152 use core::convert::Infallible;
153 use futures::FutureExt;
154 153
155 impl<'d, T: GpioPin> embedded_hal_1::digital::ErrorType for ExtiInput<'d, T> { 154 impl<'d, T: GpioPin> embedded_hal_1::digital::ErrorType for ExtiInput<'d, T> {
156 type Error = Infallible; 155 type Error = Infallible;
@@ -165,6 +164,11 @@ mod eh1 {
165 Ok(self.is_low()) 164 Ok(self.is_low())
166 } 165 }
167 } 166 }
167}
168#[cfg(all(feature = "unstable-traits", feature = "nightly"))]
169mod eh1a {
170 use super::*;
171 use futures::FutureExt;
168 172
169 impl<'d, T: GpioPin> embedded_hal_async::digital::Wait for ExtiInput<'d, T> { 173 impl<'d, T: GpioPin> embedded_hal_async::digital::Wait for ExtiInput<'d, T> {
170 type WaitForHighFuture<'a> 174 type WaitForHighFuture<'a>
diff --git a/embassy-stm32/src/i2c/v2.rs b/embassy-stm32/src/i2c/v2.rs
index 9c05187a5..58ab771b7 100644
--- a/embassy-stm32/src/i2c/v2.rs
+++ b/embassy-stm32/src/i2c/v2.rs
@@ -912,7 +912,6 @@ impl Timings {
912mod eh1 { 912mod eh1 {
913 use super::super::{RxDma, TxDma}; 913 use super::super::{RxDma, TxDma};
914 use super::*; 914 use super::*;
915 use core::future::Future;
916 915
917 impl embedded_hal_1::i2c::Error for Error { 916 impl embedded_hal_1::i2c::Error for Error {
918 fn kind(&self) -> embedded_hal_1::i2c::ErrorKind { 917 fn kind(&self) -> embedded_hal_1::i2c::ErrorKind {
@@ -935,6 +934,13 @@ mod eh1 {
935 { 934 {
936 type Error = Error; 935 type Error = Error;
937 } 936 }
937}
938
939#[cfg(all(feature = "unstable-traits", feature = "nightly"))]
940mod eh1a {
941 use super::super::{RxDma, TxDma};
942 use super::*;
943 use core::future::Future;
938 944
939 impl<'d, T: Instance, TXDMA: TxDma<T>, RXDMA: RxDma<T>> embedded_hal_async::i2c::I2c 945 impl<'d, T: Instance, TXDMA: TxDma<T>, RXDMA: RxDma<T>> embedded_hal_async::i2c::I2c
940 for I2c<'d, T, TXDMA, RXDMA> 946 for I2c<'d, T, TXDMA, RXDMA>
diff --git a/embassy-stm32/src/lib.rs b/embassy-stm32/src/lib.rs
index b985b3e4f..9c94e5f3f 100644
--- a/embassy-stm32/src/lib.rs
+++ b/embassy-stm32/src/lib.rs
@@ -1,6 +1,8 @@
1#![no_std] 1#![no_std]
2#![feature(generic_associated_types)] 2#![cfg_attr(
3#![feature(type_alias_impl_trait)] 3 feature = "nightly",
4 feature(generic_associated_types, type_alias_impl_trait)
5)]
4 6
5#[cfg(feature = "unstable-pac")] 7#[cfg(feature = "unstable-pac")]
6pub use stm32_metapac as pac; 8pub use stm32_metapac as pac;
diff --git a/embassy-stm32/src/spi/mod.rs b/embassy-stm32/src/spi/mod.rs
index d92f21f82..04f95820f 100644
--- a/embassy-stm32/src/spi/mod.rs
+++ b/embassy-stm32/src/spi/mod.rs
@@ -664,7 +664,6 @@ mod eh02 {
664#[cfg(feature = "unstable-traits")] 664#[cfg(feature = "unstable-traits")]
665mod eh1 { 665mod eh1 {
666 use super::*; 666 use super::*;
667 use core::future::Future;
668 667
669 impl<'d, T: Instance, Tx, Rx> embedded_hal_1::spi::ErrorType for Spi<'d, T, Tx, Rx> { 668 impl<'d, T: Instance, Tx, Rx> embedded_hal_1::spi::ErrorType for Spi<'d, T, Tx, Rx> {
670 type Error = Error; 669 type Error = Error;
@@ -680,6 +679,12 @@ mod eh1 {
680 } 679 }
681 } 680 }
682 } 681 }
682}
683
684#[cfg(all(feature = "unstable-traits", feature = "nightly"))]
685mod eh1a {
686 use super::*;
687 use core::future::Future;
683 688
684 impl<'d, T: Instance, Tx: TxDma<T>, Rx> embedded_hal_async::spi::Write<u8> for Spi<'d, T, Tx, Rx> { 689 impl<'d, T: Instance, Tx: TxDma<T>, Rx> embedded_hal_async::spi::Write<u8> for Spi<'d, T, Tx, Rx> {
685 type WriteFuture<'a> 690 type WriteFuture<'a>
diff --git a/embassy-stm32/src/usart/mod.rs b/embassy-stm32/src/usart/mod.rs
index f17ae0add..718559813 100644
--- a/embassy-stm32/src/usart/mod.rs
+++ b/embassy-stm32/src/usart/mod.rs
@@ -256,7 +256,6 @@ mod eh02 {
256#[cfg(feature = "unstable-traits")] 256#[cfg(feature = "unstable-traits")]
257mod eh1 { 257mod eh1 {
258 use super::*; 258 use super::*;
259 use core::future::Future;
260 259
261 impl embedded_hal_1::serial::Error for Error { 260 impl embedded_hal_1::serial::Error for Error {
262 fn kind(&self) -> embedded_hal_1::serial::ErrorKind { 261 fn kind(&self) -> embedded_hal_1::serial::ErrorKind {
@@ -274,6 +273,12 @@ mod eh1 {
274 { 273 {
275 type Error = Error; 274 type Error = Error;
276 } 275 }
276}
277
278#[cfg(all(feature = "unstable-traits", feature = "nightly"))]
279mod eh1a {
280 use super::*;
281 use core::future::Future;
277 282
278 impl<'d, T: Instance, TxDma, RxDma> embedded_hal_async::serial::Write for Uart<'d, T, TxDma, RxDma> 283 impl<'d, T: Instance, TxDma, RxDma> embedded_hal_async::serial::Write for Uart<'d, T, TxDma, RxDma>
279 where 284 where