aboutsummaryrefslogtreecommitdiff
path: root/embassy-embedded-hal/src
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-embedded-hal/src')
-rw-r--r--embassy-embedded-hal/src/flash/concat_flash.rs3
-rw-r--r--embassy-embedded-hal/src/flash/mem_flash.rs3
-rw-r--r--embassy-embedded-hal/src/flash/partition/mod.rs2
-rw-r--r--embassy-embedded-hal/src/lib.rs8
-rw-r--r--embassy-embedded-hal/src/shared_bus/asynch/i2c.rs13
-rw-r--r--embassy-embedded-hal/src/shared_bus/asynch/spi.rs11
-rw-r--r--embassy-embedded-hal/src/shared_bus/mod.rs2
7 files changed, 14 insertions, 28 deletions
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 @@
1use embedded_storage::nor_flash::{ErrorType, NorFlash, NorFlashError, ReadNorFlash}; 1use embedded_storage::nor_flash::{ErrorType, NorFlash, NorFlashError, ReadNorFlash};
2#[cfg(feature = "nightly")]
3use embedded_storage_async::nor_flash::{NorFlash as AsyncNorFlash, ReadNorFlash as AsyncReadNorFlash}; 2use 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")]
121impl<First, Second, E> AsyncReadNorFlash for ConcatFlash<First, Second> 119impl<First, Second, E> AsyncReadNorFlash for ConcatFlash<First, Second>
122where 120where
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")]
150impl<First, Second, E> AsyncNorFlash for ConcatFlash<First, Second> 147impl<First, Second, E> AsyncNorFlash for ConcatFlash<First, Second>
151where 148where
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 @@
1use alloc::vec::Vec; 1use alloc::vec::Vec;
2 2
3use embedded_storage::nor_flash::{ErrorType, NorFlash, ReadNorFlash}; 3use embedded_storage::nor_flash::{ErrorType, NorFlash, ReadNorFlash};
4#[cfg(feature = "nightly")]
5use embedded_storage_async::nor_flash::{NorFlash as AsyncNorFlash, ReadNorFlash as AsyncReadNorFlash}; 4use embedded_storage_async::nor_flash::{NorFlash as AsyncNorFlash, ReadNorFlash as AsyncReadNorFlash};
6 5
7extern crate alloc; 6extern 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")]
97impl<const SIZE: usize, const ERASE_SIZE: usize, const WRITE_SIZE: usize> AsyncReadNorFlash 95impl<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")]
113impl<const SIZE: usize, const ERASE_SIZE: usize, const WRITE_SIZE: usize> AsyncNorFlash 110impl<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
3use embedded_storage::nor_flash::{NorFlashError, NorFlashErrorKind}; 3use embedded_storage::nor_flash::{NorFlashError, NorFlashErrorKind};
4 4
5#[cfg(feature = "nightly")]
6mod asynch; 5mod asynch;
7mod blocking; 6mod blocking;
8 7
9#[cfg(feature = "nightly")]
10pub use asynch::Partition; 8pub use asynch::Partition;
11pub use blocking::BlockingPartition; 9pub 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")]
9pub mod adapter; 9pub mod adapter;
10
11pub mod flash; 10pub mod flash;
12
13pub mod shared_bus; 11pub 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
4use embedded_hal_1::{i2c, spi}; 4use embedded_hal_1::{i2c, spi};
5 5
6#[cfg(feature = "nightly")]
7pub mod asynch; 6pub mod asynch;
8
9pub mod blocking; 7pub mod blocking;
10 8
11/// Error returned by I2C device implementations in this crate. 9/// Error returned by I2C device implementations in this crate.