diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-11-29 17:23:48 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2023-11-29 17:26:33 +0100 |
| commit | c6989dfbca51787146f50270c671af9db434f577 (patch) | |
| tree | 5974a8ec41c108d5208e4f68027b918d424a2046 /embassy-embedded-hal | |
| parent | 384bad7bfaa1f2415baf2cd3b69ebf36dc0a02d7 (diff) | |
Remove nightly and unstable-traits features in preparation for 1.75.
Diffstat (limited to 'embassy-embedded-hal')
| -rw-r--r-- | embassy-embedded-hal/Cargo.toml | 10 | ||||
| -rw-r--r-- | embassy-embedded-hal/build.rs | 18 | ||||
| -rw-r--r-- | embassy-embedded-hal/src/flash/concat_flash.rs | 3 | ||||
| -rw-r--r-- | embassy-embedded-hal/src/flash/mem_flash.rs | 3 | ||||
| -rw-r--r-- | embassy-embedded-hal/src/flash/partition/mod.rs | 2 | ||||
| -rw-r--r-- | embassy-embedded-hal/src/lib.rs | 8 | ||||
| -rw-r--r-- | embassy-embedded-hal/src/shared_bus/asynch/i2c.rs | 13 | ||||
| -rw-r--r-- | embassy-embedded-hal/src/shared_bus/asynch/spi.rs | 11 | ||||
| -rw-r--r-- | embassy-embedded-hal/src/shared_bus/mod.rs | 2 |
9 files changed, 36 insertions, 34 deletions
diff --git a/embassy-embedded-hal/Cargo.toml b/embassy-embedded-hal/Cargo.toml index 52ecd5c71..db4dc9587 100644 --- a/embassy-embedded-hal/Cargo.toml +++ b/embassy-embedded-hal/Cargo.toml | |||
| @@ -8,27 +8,25 @@ license = "MIT OR Apache-2.0" | |||
| 8 | [package.metadata.embassy_docs] | 8 | [package.metadata.embassy_docs] |
| 9 | src_base = "https://github.com/embassy-rs/embassy/blob/embassy-embedded-hal-v$VERSION/embassy-embedded-hal/src/" | 9 | src_base = "https://github.com/embassy-rs/embassy/blob/embassy-embedded-hal-v$VERSION/embassy-embedded-hal/src/" |
| 10 | src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-embedded-hal/src/" | 10 | src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-embedded-hal/src/" |
| 11 | features = ["nightly", "std"] | 11 | features = ["std"] |
| 12 | target = "x86_64-unknown-linux-gnu" | 12 | target = "x86_64-unknown-linux-gnu" |
| 13 | 13 | ||
| 14 | [features] | 14 | [features] |
| 15 | std = [] | 15 | std = [] |
| 16 | # Enable nightly-only features | ||
| 17 | nightly = ["embassy-futures", "embedded-hal-async", "embedded-storage-async"] | ||
| 18 | time = ["dep:embassy-time"] | 16 | time = ["dep:embassy-time"] |
| 19 | default = ["time"] | 17 | default = ["time"] |
| 20 | 18 | ||
| 21 | [dependencies] | 19 | [dependencies] |
| 22 | embassy-futures = { version = "0.1.0", path = "../embassy-futures", optional = true } | 20 | embassy-futures = { version = "0.1.0", path = "../embassy-futures" } |
| 23 | embassy-sync = { version = "0.4.0", path = "../embassy-sync" } | 21 | embassy-sync = { version = "0.4.0", path = "../embassy-sync" } |
| 24 | embassy-time = { version = "0.1.5", path = "../embassy-time", optional = true } | 22 | embassy-time = { version = "0.1.5", path = "../embassy-time", optional = true } |
| 25 | embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = [ | 23 | embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = [ |
| 26 | "unproven", | 24 | "unproven", |
| 27 | ] } | 25 | ] } |
| 28 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" } | 26 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-rc.2" } |
| 29 | embedded-hal-async = { version = "=1.0.0-rc.2", optional = true } | 27 | embedded-hal-async = { version = "=1.0.0-rc.2" } |
| 30 | embedded-storage = "0.3.0" | 28 | embedded-storage = "0.3.0" |
| 31 | embedded-storage-async = { version = "0.4.0", optional = true } | 29 | embedded-storage-async = { version = "0.4.0" } |
| 32 | nb = "1.0.0" | 30 | nb = "1.0.0" |
| 33 | 31 | ||
| 34 | defmt = { version = "0.3", optional = true } | 32 | defmt = { version = "0.3", optional = true } |
diff --git a/embassy-embedded-hal/build.rs b/embassy-embedded-hal/build.rs new file mode 100644 index 000000000..78bd27ec7 --- /dev/null +++ b/embassy-embedded-hal/build.rs | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | use std::env; | ||
| 2 | use std::ffi::OsString; | ||
| 3 | use std::process::Command; | ||
| 4 | |||
| 5 | fn main() { | ||
| 6 | println!("cargo:rerun-if-changed=build.rs"); | ||
| 7 | |||
| 8 | let rustc = env::var_os("RUSTC").unwrap_or_else(|| OsString::from("rustc")); | ||
| 9 | |||
| 10 | let output = Command::new(rustc) | ||
| 11 | .arg("--version") | ||
| 12 | .output() | ||
| 13 | .expect("failed to run `rustc --version`"); | ||
| 14 | |||
| 15 | if String::from_utf8_lossy(&output.stdout).contains("nightly") { | ||
| 16 | println!("cargo:rustc-cfg=nightly"); | ||
| 17 | } | ||
| 18 | } | ||
diff --git a/embassy-embedded-hal/src/flash/concat_flash.rs b/embassy-embedded-hal/src/flash/concat_flash.rs index 1ea84269c..499941d19 100644 --- a/embassy-embedded-hal/src/flash/concat_flash.rs +++ b/embassy-embedded-hal/src/flash/concat_flash.rs | |||
| @@ -1,5 +1,4 @@ | |||
| 1 | use embedded_storage::nor_flash::{ErrorType, NorFlash, NorFlashError, ReadNorFlash}; | 1 | use embedded_storage::nor_flash::{ErrorType, NorFlash, NorFlashError, ReadNorFlash}; |
| 2 | #[cfg(feature = "nightly")] | ||
| 3 | use embedded_storage_async::nor_flash::{NorFlash as AsyncNorFlash, ReadNorFlash as AsyncReadNorFlash}; | 2 | use embedded_storage_async::nor_flash::{NorFlash as AsyncNorFlash, ReadNorFlash as AsyncReadNorFlash}; |
| 4 | 3 | ||
| 5 | /// Convenience helper for concatenating two consecutive flashes into one. | 4 | /// Convenience helper for concatenating two consecutive flashes into one. |
| @@ -117,7 +116,6 @@ where | |||
| 117 | } | 116 | } |
| 118 | } | 117 | } |
| 119 | 118 | ||
| 120 | #[cfg(feature = "nightly")] | ||
| 121 | impl<First, Second, E> AsyncReadNorFlash for ConcatFlash<First, Second> | 119 | impl<First, Second, E> AsyncReadNorFlash for ConcatFlash<First, Second> |
| 122 | where | 120 | where |
| 123 | First: AsyncReadNorFlash<Error = E>, | 121 | First: AsyncReadNorFlash<Error = E>, |
| @@ -146,7 +144,6 @@ where | |||
| 146 | } | 144 | } |
| 147 | } | 145 | } |
| 148 | 146 | ||
| 149 | #[cfg(feature = "nightly")] | ||
| 150 | impl<First, Second, E> AsyncNorFlash for ConcatFlash<First, Second> | 147 | impl<First, Second, E> AsyncNorFlash for ConcatFlash<First, Second> |
| 151 | where | 148 | where |
| 152 | First: AsyncNorFlash<Error = E>, | 149 | First: AsyncNorFlash<Error = E>, |
diff --git a/embassy-embedded-hal/src/flash/mem_flash.rs b/embassy-embedded-hal/src/flash/mem_flash.rs index afb0d1a15..d24c61823 100644 --- a/embassy-embedded-hal/src/flash/mem_flash.rs +++ b/embassy-embedded-hal/src/flash/mem_flash.rs | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | use alloc::vec::Vec; | 1 | use alloc::vec::Vec; |
| 2 | 2 | ||
| 3 | use embedded_storage::nor_flash::{ErrorType, NorFlash, ReadNorFlash}; | 3 | use embedded_storage::nor_flash::{ErrorType, NorFlash, ReadNorFlash}; |
| 4 | #[cfg(feature = "nightly")] | ||
| 5 | use embedded_storage_async::nor_flash::{NorFlash as AsyncNorFlash, ReadNorFlash as AsyncReadNorFlash}; | 4 | use embedded_storage_async::nor_flash::{NorFlash as AsyncNorFlash, ReadNorFlash as AsyncReadNorFlash}; |
| 6 | 5 | ||
| 7 | extern crate alloc; | 6 | extern crate alloc; |
| @@ -93,7 +92,6 @@ impl<const SIZE: usize, const ERASE_SIZE: usize, const WRITE_SIZE: usize> NorFla | |||
| 93 | } | 92 | } |
| 94 | } | 93 | } |
| 95 | 94 | ||
| 96 | #[cfg(feature = "nightly")] | ||
| 97 | impl<const SIZE: usize, const ERASE_SIZE: usize, const WRITE_SIZE: usize> AsyncReadNorFlash | 95 | impl<const SIZE: usize, const ERASE_SIZE: usize, const WRITE_SIZE: usize> AsyncReadNorFlash |
| 98 | for MemFlash<SIZE, ERASE_SIZE, WRITE_SIZE> | 96 | for MemFlash<SIZE, ERASE_SIZE, WRITE_SIZE> |
| 99 | { | 97 | { |
| @@ -109,7 +107,6 @@ impl<const SIZE: usize, const ERASE_SIZE: usize, const WRITE_SIZE: usize> AsyncR | |||
| 109 | } | 107 | } |
| 110 | } | 108 | } |
| 111 | 109 | ||
| 112 | #[cfg(feature = "nightly")] | ||
| 113 | impl<const SIZE: usize, const ERASE_SIZE: usize, const WRITE_SIZE: usize> AsyncNorFlash | 110 | impl<const SIZE: usize, const ERASE_SIZE: usize, const WRITE_SIZE: usize> AsyncNorFlash |
| 114 | for MemFlash<SIZE, ERASE_SIZE, WRITE_SIZE> | 111 | for MemFlash<SIZE, ERASE_SIZE, WRITE_SIZE> |
| 115 | { | 112 | { |
diff --git a/embassy-embedded-hal/src/flash/partition/mod.rs b/embassy-embedded-hal/src/flash/partition/mod.rs index 42c8a308d..6177ed9ab 100644 --- a/embassy-embedded-hal/src/flash/partition/mod.rs +++ b/embassy-embedded-hal/src/flash/partition/mod.rs | |||
| @@ -2,11 +2,9 @@ | |||
| 2 | 2 | ||
| 3 | use embedded_storage::nor_flash::{NorFlashError, NorFlashErrorKind}; | 3 | use embedded_storage::nor_flash::{NorFlashError, NorFlashErrorKind}; |
| 4 | 4 | ||
| 5 | #[cfg(feature = "nightly")] | ||
| 6 | mod asynch; | 5 | mod asynch; |
| 7 | mod blocking; | 6 | mod blocking; |
| 8 | 7 | ||
| 9 | #[cfg(feature = "nightly")] | ||
| 10 | pub use asynch::Partition; | 8 | pub use asynch::Partition; |
| 11 | pub use blocking::BlockingPartition; | 9 | pub use blocking::BlockingPartition; |
| 12 | 10 | ||
diff --git a/embassy-embedded-hal/src/lib.rs b/embassy-embedded-hal/src/lib.rs index ce5fac3f0..b40f892f4 100644 --- a/embassy-embedded-hal/src/lib.rs +++ b/embassy-embedded-hal/src/lib.rs | |||
| @@ -1,15 +1,13 @@ | |||
| 1 | #![cfg_attr(not(feature = "std"), no_std)] | 1 | #![cfg_attr(not(feature = "std"), no_std)] |
| 2 | #![cfg_attr(feature = "nightly", feature(async_fn_in_trait, impl_trait_projections))] | 2 | #![cfg_attr(nightly, feature(async_fn_in_trait, impl_trait_projections))] |
| 3 | #![cfg_attr(feature = "nightly", allow(stable_features, unknown_lints, async_fn_in_trait))] | 3 | #![cfg_attr(nightly, allow(stable_features, unknown_lints))] |
| 4 | #![allow(async_fn_in_trait)] | ||
| 4 | #![warn(missing_docs)] | 5 | #![warn(missing_docs)] |
| 5 | 6 | ||
| 6 | //! Utilities to use `embedded-hal` traits with Embassy. | 7 | //! Utilities to use `embedded-hal` traits with Embassy. |
| 7 | 8 | ||
| 8 | #[cfg(feature = "nightly")] | ||
| 9 | pub mod adapter; | 9 | pub mod adapter; |
| 10 | |||
| 11 | pub mod flash; | 10 | pub mod flash; |
| 12 | |||
| 13 | pub mod shared_bus; | 11 | pub mod shared_bus; |
| 14 | 12 | ||
| 15 | /// Set the configuration of a peripheral driver. | 13 | /// Set the configuration of a peripheral driver. |
diff --git a/embassy-embedded-hal/src/shared_bus/asynch/i2c.rs b/embassy-embedded-hal/src/shared_bus/asynch/i2c.rs index 1053d3849..779c04263 100644 --- a/embassy-embedded-hal/src/shared_bus/asynch/i2c.rs +++ b/embassy-embedded-hal/src/shared_bus/asynch/i2c.rs | |||
| @@ -2,16 +2,15 @@ | |||
| 2 | //! | 2 | //! |
| 3 | //! # Example (nrf52) | 3 | //! # Example (nrf52) |
| 4 | //! | 4 | //! |
| 5 | //! ```rust | 5 | //! ```rust,ignore |
| 6 | //! use embassy_embedded_hal::shared_bus::i2c::I2cDevice; | 6 | //! use embassy_embedded_hal::shared_bus::asynch::i2c::I2cDevice; |
| 7 | //! use embassy_sync::mutex::Mutex; | 7 | //! use embassy_sync::mutex::Mutex; |
| 8 | //! use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; | 8 | //! use embassy_sync::blocking_mutex::raw::NoopRawMutex; |
| 9 | //! | 9 | //! |
| 10 | //! static I2C_BUS: StaticCell<Mutex::<ThreadModeRawMutex, Twim<TWISPI0>>> = StaticCell::new(); | 10 | //! static I2C_BUS: StaticCell<Mutex<NoopRawMutex, Twim<TWISPI0>>> = StaticCell::new(); |
| 11 | //! let config = twim::Config::default(); | 11 | //! let config = twim::Config::default(); |
| 12 | //! let irq = interrupt::take!(SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0); | 12 | //! let i2c = Twim::new(p.TWISPI0, Irqs, p.P0_03, p.P0_04, config); |
| 13 | //! let i2c = Twim::new(p.TWISPI0, irq, p.P0_03, p.P0_04, config); | 13 | //! let i2c_bus = Mutex::new(i2c); |
| 14 | //! let i2c_bus = Mutex::<ThreadModeRawMutex, _>::new(i2c); | ||
| 15 | //! let i2c_bus = I2C_BUS.init(i2c_bus); | 14 | //! let i2c_bus = I2C_BUS.init(i2c_bus); |
| 16 | //! | 15 | //! |
| 17 | //! // Device 1, using embedded-hal-async compatible driver for QMC5883L compass | 16 | //! // Device 1, using embedded-hal-async compatible driver for QMC5883L compass |
diff --git a/embassy-embedded-hal/src/shared_bus/asynch/spi.rs b/embassy-embedded-hal/src/shared_bus/asynch/spi.rs index b4f53c623..62b2c92a0 100644 --- a/embassy-embedded-hal/src/shared_bus/asynch/spi.rs +++ b/embassy-embedded-hal/src/shared_bus/asynch/spi.rs | |||
| @@ -2,17 +2,16 @@ | |||
| 2 | //! | 2 | //! |
| 3 | //! # Example (nrf52) | 3 | //! # Example (nrf52) |
| 4 | //! | 4 | //! |
| 5 | //! ```rust | 5 | //! ```rust,ignore |
| 6 | //! use embassy_embedded_hal::shared_bus::spi::SpiDevice; | 6 | //! use embassy_embedded_hal::shared_bus::spi::SpiDevice; |
| 7 | //! use embassy_sync::mutex::Mutex; | 7 | //! use embassy_sync::mutex::Mutex; |
| 8 | //! use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; | 8 | //! use embassy_sync::blocking_mutex::raw::NoopRawMutex; |
| 9 | //! | 9 | //! |
| 10 | //! static SPI_BUS: StaticCell<Mutex<ThreadModeRawMutex, spim::Spim<SPI3>>> = StaticCell::new(); | 10 | //! static SPI_BUS: StaticCell<Mutex<NoopRawMutex, spim::Spim<SPI3>>> = StaticCell::new(); |
| 11 | //! let mut config = spim::Config::default(); | 11 | //! let mut config = spim::Config::default(); |
| 12 | //! config.frequency = spim::Frequency::M32; | 12 | //! config.frequency = spim::Frequency::M32; |
| 13 | //! let irq = interrupt::take!(SPIM3); | 13 | //! let spi = spim::Spim::new_txonly(p.SPI3, Irqs, p.P0_15, p.P0_18, config); |
| 14 | //! let spi = spim::Spim::new_txonly(p.SPI3, irq, p.P0_15, p.P0_18, config); | 14 | //! let spi_bus = Mutex::new(spi); |
| 15 | //! let spi_bus = Mutex::<ThreadModeRawMutex, _>::new(spi); | ||
| 16 | //! let spi_bus = SPI_BUS.init(spi_bus); | 15 | //! let spi_bus = SPI_BUS.init(spi_bus); |
| 17 | //! | 16 | //! |
| 18 | //! // Device 1, using embedded-hal-async compatible driver for ST7735 LCD display | 17 | //! // Device 1, using embedded-hal-async compatible driver for ST7735 LCD display |
diff --git a/embassy-embedded-hal/src/shared_bus/mod.rs b/embassy-embedded-hal/src/shared_bus/mod.rs index ab96df134..d835306bc 100644 --- a/embassy-embedded-hal/src/shared_bus/mod.rs +++ b/embassy-embedded-hal/src/shared_bus/mod.rs | |||
| @@ -3,9 +3,7 @@ use core::fmt::Debug; | |||
| 3 | 3 | ||
| 4 | use embedded_hal_1::{i2c, spi}; | 4 | use embedded_hal_1::{i2c, spi}; |
| 5 | 5 | ||
| 6 | #[cfg(feature = "nightly")] | ||
| 7 | pub mod asynch; | 6 | pub mod asynch; |
| 8 | |||
| 9 | pub mod blocking; | 7 | pub mod blocking; |
| 10 | 8 | ||
| 11 | /// Error returned by I2C device implementations in this crate. | 9 | /// Error returned by I2C device implementations in this crate. |
