aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32h7/src
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2024-10-18 03:18:59 +0200
committerGitHub <[email protected]>2024-10-18 03:18:59 +0200
commit1f58e0efd05e5c96409db301e4d481098038aedf (patch)
tree853857285b5ff14eff9a0486dc3eae645de3ee03 /examples/stm32h7/src
parent3d0c557138e87ce94686e5820337c7495206ae56 (diff)
executor: fix unsoundness due to `impl Trait`, improve macro error handling. (#3425)
* executor-macros: don't parse function bodies. * executor-macros: refactor for better recovery and ide-friendliness on errors. * executor-macros: disallow `impl Trait` in task arguments. Fixes #3420 * Fix example using `impl Trait` in tasks.
Diffstat (limited to 'examples/stm32h7/src')
-rw-r--r--examples/stm32h7/src/bin/i2c_shared.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/stm32h7/src/bin/i2c_shared.rs b/examples/stm32h7/src/bin/i2c_shared.rs
index 6f4815582..136b91eeb 100644
--- a/examples/stm32h7/src/bin/i2c_shared.rs
+++ b/examples/stm32h7/src/bin/i2c_shared.rs
@@ -10,8 +10,10 @@ use embassy_stm32::i2c::{self, I2c};
10use embassy_stm32::mode::Async; 10use embassy_stm32::mode::Async;
11use embassy_stm32::time::Hertz; 11use embassy_stm32::time::Hertz;
12use embassy_stm32::{bind_interrupts, peripherals}; 12use embassy_stm32::{bind_interrupts, peripherals};
13use embassy_sync::blocking_mutex::raw::NoopRawMutex;
13use embassy_sync::blocking_mutex::NoopMutex; 14use embassy_sync::blocking_mutex::NoopMutex;
14use embassy_time::{Duration, Timer}; 15use embassy_time::{Duration, Timer};
16use embedded_hal_1::i2c::I2c as _;
15use static_cell::StaticCell; 17use static_cell::StaticCell;
16use {defmt_rtt as _, panic_probe as _}; 18use {defmt_rtt as _, panic_probe as _};
17 19
@@ -31,7 +33,7 @@ bind_interrupts!(struct Irqs {
31}); 33});
32 34
33#[embassy_executor::task] 35#[embassy_executor::task]
34async fn temperature(mut i2c: impl embedded_hal_1::i2c::I2c + 'static) { 36async fn temperature(mut i2c: I2cDevice<'static, NoopRawMutex, I2c<'static, Async>>) {
35 let mut data = [0u8; 2]; 37 let mut data = [0u8; 2];
36 38
37 loop { 39 loop {
@@ -48,7 +50,7 @@ async fn temperature(mut i2c: impl embedded_hal_1::i2c::I2c + 'static) {
48} 50}
49 51
50#[embassy_executor::task] 52#[embassy_executor::task]
51async fn humidity(mut i2c: impl embedded_hal_1::i2c::I2c + 'static) { 53async fn humidity(mut i2c: I2cDevice<'static, NoopRawMutex, I2c<'static, Async>>) {
52 let mut data = [0u8; 6]; 54 let mut data = [0u8; 6];
53 55
54 loop { 56 loop {