Add embassy-embedded-hal nightly feature

This commit is contained in:
Henrik Alsér 2022-07-09 23:41:02 +02:00
parent 880b71a1e8
commit baae64d911
6 changed files with 11 additions and 3 deletions

View file

@ -5,6 +5,8 @@ edition = "2021"
[features] [features]
std = [] std = []
# Enable nightly-only features
nightly = ["embedded-hal-async"]
[dependencies] [dependencies]
embassy = { version = "0.1.0", path = "../embassy" } embassy = { version = "0.1.0", path = "../embassy" }

View file

@ -27,6 +27,7 @@ use core::future::Future;
use embassy::blocking_mutex::raw::RawMutex; use embassy::blocking_mutex::raw::RawMutex;
use embassy::mutex::Mutex; use embassy::mutex::Mutex;
#[cfg(feature = "nightly")]
use embedded_hal_async::i2c; use embedded_hal_async::i2c;
use crate::SetConfig; use crate::SetConfig;
@ -64,6 +65,7 @@ where
type Error = I2cBusDeviceError<BUS::Error>; type Error = I2cBusDeviceError<BUS::Error>;
} }
#[cfg(feature = "nightly")]
impl<M, BUS> i2c::I2c for I2cBusDevice<'_, M, BUS> impl<M, BUS> i2c::I2c for I2cBusDevice<'_, M, BUS>
where where
M: RawMutex + 'static, M: RawMutex + 'static,
@ -139,6 +141,7 @@ where
type Error = I2cBusDeviceError<BUS::Error>; type Error = I2cBusDeviceError<BUS::Error>;
} }
#[cfg(feature = "nightly")]
impl<M, BUS> i2c::I2c for I2cBusDeviceWithConfig<'_, M, BUS> impl<M, BUS> i2c::I2c for I2cBusDeviceWithConfig<'_, M, BUS>
where where
M: RawMutex + 'static, M: RawMutex + 'static,

View file

@ -32,6 +32,7 @@ use embassy::blocking_mutex::raw::RawMutex;
use embassy::mutex::Mutex; use embassy::mutex::Mutex;
use embedded_hal_1::digital::blocking::OutputPin; use embedded_hal_1::digital::blocking::OutputPin;
use embedded_hal_1::spi::ErrorType; use embedded_hal_1::spi::ErrorType;
#[cfg(feature = "nightly")]
use embedded_hal_async::spi; use embedded_hal_async::spi;
use crate::SetConfig; use crate::SetConfig;
@ -74,6 +75,7 @@ where
type Error = SpiBusDeviceError<BUS::Error, CS::Error>; type Error = SpiBusDeviceError<BUS::Error, CS::Error>;
} }
#[cfg(feature = "nightly")]
impl<M, BUS, CS> spi::SpiDevice for SpiBusDevice<'_, M, BUS, CS> impl<M, BUS, CS> spi::SpiDevice for SpiBusDevice<'_, M, BUS, CS>
where where
M: RawMutex + 'static, M: RawMutex + 'static,
@ -133,6 +135,7 @@ where
type Error = SpiBusDeviceError<BUS::Error, CS::Error>; type Error = SpiBusDeviceError<BUS::Error, CS::Error>;
} }
#[cfg(feature = "nightly")]
impl<M, BUS, CS> spi::SpiDevice for SpiBusDeviceWithConfig<'_, M, BUS, CS> impl<M, BUS, CS> spi::SpiDevice for SpiBusDeviceWithConfig<'_, M, BUS, CS>
where where
M: RawMutex + 'static, M: RawMutex + 'static,

View file

@ -21,7 +21,7 @@ time = ["embassy/time"]
defmt = ["dep:defmt", "embassy/defmt", "embassy-usb?/defmt", "embedded-io?/defmt"] defmt = ["dep:defmt", "embassy/defmt", "embassy-usb?/defmt", "embedded-io?/defmt"]
# Enable nightly-only features # Enable nightly-only features
nightly = ["embassy/nightly", "embedded-hal-1", "embedded-hal-async", "embassy-usb", "embedded-storage-async", "dep:embedded-io"] nightly = ["embassy/nightly", "embedded-hal-1", "embedded-hal-async", "embassy-usb", "embedded-storage-async", "dep:embedded-io", "embassy-embedded-hal/nightly"]
# Reexport the PAC for the currently enabled chip at `embassy_nrf::pac`. # Reexport the PAC for the currently enabled chip at `embassy_nrf::pac`.
# This is unstable because semver-minor (non-breaking) releases of embassy-nrf may major-bump (breaking) the PAC version. # This is unstable because semver-minor (non-breaking) releases of embassy-nrf may major-bump (breaking) the PAC version.

View file

@ -20,7 +20,7 @@ flavors = [
unstable-pac = [] unstable-pac = []
# Enable nightly-only features # Enable nightly-only features
nightly = ["embassy/nightly", "embedded-hal-1", "embedded-hal-async"] nightly = ["embassy/nightly", "embedded-hal-1", "embedded-hal-async", "embassy-embedded-hal/nightly"]
# Implement embedded-hal 1.0 alpha traits. # Implement embedded-hal 1.0 alpha traits.
# Implement embedded-hal-async traits if `nightly` is set as well. # Implement embedded-hal-async traits if `nightly` is set as well.

View file

@ -91,7 +91,7 @@ time-driver-tim12 = ["_time-driver"]
time-driver-tim15 = ["_time-driver"] time-driver-tim15 = ["_time-driver"]
# Enable nightly-only features # Enable nightly-only features
nightly = ["embassy/nightly", "embedded-hal-1", "embedded-hal-async", "embedded-storage-async", "dep:embedded-io", "dep:embassy-usb"] nightly = ["embassy/nightly", "embedded-hal-1", "embedded-hal-async", "embedded-storage-async", "dep:embedded-io", "dep:embassy-usb", "embassy-embedded-hal/nightly"]
# Reexport stm32-metapac at `embassy_stm32::pac`. # 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. # This is unstable because semver-minor (non-breaking) releases of embassy-stm32 may major-bump (breaking) the stm32-metapac version.