stm32: add rust stable support

This commit is contained in:
Dario Nieuwenhuis
2022-02-12 02:26:15 +01:00
parent f2eb438905
commit 340eb4eead
24 changed files with 149 additions and 52 deletions

View File

@ -6,7 +6,7 @@ edition = "2018"
resolver = "2"
[dependencies]
embassy = { version = "0.1.0", path = "../embassy", features = ["nightly"]}
embassy = { version = "0.1.0", path = "../embassy" }
embassy-macros = { version = "0.1.0", path = "../embassy-macros", features = ["stm32"] }
embassy-hal-common = {version = "0.1.0", path = "../embassy-hal-common" }
embassy-net = { version = "0.1.0", path = "../embassy-net", default-features = false, optional = true }
@ -57,14 +57,18 @@ time-driver-tim3 = ["_time-driver"]
time-driver-tim4 = ["_time-driver"]
time-driver-tim5 = ["_time-driver"]
# Enable nightly-only features
nightly = ["embassy/nightly", "embedded-hal-1", "embedded-hal-async"]
# Reexport stm32-metapac at `embassy_stm32::pac`.
# This is unstable because semver-minor (non-breaking) releases of embassy-stm32 may major-bump (breaking) the stm32-metapac version.
# If this is an issue for you, you're encouraged to directly depend on a fixed version of the PAC.
# There are no plans to make this stable.
unstable-pac = []
# Implement embedded-hal 1.0 alpha and embedded-hal-async traits.
unstable-traits = ["embedded-hal-1", "embedded-hal-async"]
# Implement embedded-hal 1.0 alpha traits.
# Implement embedded-hal-async traits if `nightly` is set as well.
unstable-traits = ["embedded-hal-1"]
# BEGIN GENERATED FEATURES
# Generated by stm32-gen-features. DO NOT EDIT.

View File

@ -150,7 +150,6 @@ mod eh02 {
mod eh1 {
use super::*;
use core::convert::Infallible;
use futures::FutureExt;
impl<'d, T: GpioPin> embedded_hal_1::digital::ErrorType for ExtiInput<'d, T> {
type Error = Infallible;
@ -165,6 +164,11 @@ mod eh1 {
Ok(self.is_low())
}
}
}
#[cfg(all(feature = "unstable-traits", feature = "nightly"))]
mod eh1a {
use super::*;
use futures::FutureExt;
impl<'d, T: GpioPin> embedded_hal_async::digital::Wait for ExtiInput<'d, T> {
type WaitForHighFuture<'a>

View File

@ -912,7 +912,6 @@ impl Timings {
mod eh1 {
use super::super::{RxDma, TxDma};
use super::*;
use core::future::Future;
impl embedded_hal_1::i2c::Error for Error {
fn kind(&self) -> embedded_hal_1::i2c::ErrorKind {
@ -935,6 +934,13 @@ mod eh1 {
{
type Error = Error;
}
}
#[cfg(all(feature = "unstable-traits", feature = "nightly"))]
mod eh1a {
use super::super::{RxDma, TxDma};
use super::*;
use core::future::Future;
impl<'d, T: Instance, TXDMA: TxDma<T>, RXDMA: RxDma<T>> embedded_hal_async::i2c::I2c
for I2c<'d, T, TXDMA, RXDMA>

View File

@ -1,6 +1,8 @@
#![no_std]
#![feature(generic_associated_types)]
#![feature(type_alias_impl_trait)]
#![cfg_attr(
feature = "nightly",
feature(generic_associated_types, type_alias_impl_trait)
)]
#[cfg(feature = "unstable-pac")]
pub use stm32_metapac as pac;

View File

@ -664,7 +664,6 @@ mod eh02 {
#[cfg(feature = "unstable-traits")]
mod eh1 {
use super::*;
use core::future::Future;
impl<'d, T: Instance, Tx, Rx> embedded_hal_1::spi::ErrorType for Spi<'d, T, Tx, Rx> {
type Error = Error;
@ -680,6 +679,12 @@ mod eh1 {
}
}
}
}
#[cfg(all(feature = "unstable-traits", feature = "nightly"))]
mod eh1a {
use super::*;
use core::future::Future;
impl<'d, T: Instance, Tx: TxDma<T>, Rx> embedded_hal_async::spi::Write<u8> for Spi<'d, T, Tx, Rx> {
type WriteFuture<'a>

View File

@ -256,7 +256,6 @@ mod eh02 {
#[cfg(feature = "unstable-traits")]
mod eh1 {
use super::*;
use core::future::Future;
impl embedded_hal_1::serial::Error for Error {
fn kind(&self) -> embedded_hal_1::serial::ErrorKind {
@ -274,6 +273,12 @@ mod eh1 {
{
type Error = Error;
}
}
#[cfg(all(feature = "unstable-traits", feature = "nightly"))]
mod eh1a {
use super::*;
use core::future::Future;
impl<'d, T: Instance, TxDma, RxDma> embedded_hal_async::serial::Write for Uart<'d, T, TxDma, RxDma>
where