mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-10-30 22:01:02 +00:00
no need for a PeripheralRef
This commit is contained in:
parent
ebf46d37aa
commit
4843c060d0
@ -7,14 +7,14 @@
|
|||||||
/// [Link explaining it](https://www.physicsclassroom.com/class/sound/Lesson-3/Interference-and-Beats)
|
/// [Link explaining it](https://www.physicsclassroom.com/class/sound/Lesson-3/Interference-and-Beats)
|
||||||
use defmt::*;
|
use defmt::*;
|
||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
use embassy_rp::{gpio, PeripheralRef};
|
use embassy_rp::gpio;
|
||||||
use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex;
|
use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex;
|
||||||
use embassy_sync::mutex::Mutex;
|
use embassy_sync::mutex::Mutex;
|
||||||
use embassy_time::{Duration, Ticker};
|
use embassy_time::{Duration, Ticker};
|
||||||
use gpio::{AnyPin, Level, Output};
|
use gpio::{AnyPin, Level, Output};
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
type LedType = Mutex<ThreadModeRawMutex, Option<PeripheralRef<'static, Output<'static, AnyPin>>>>;
|
type LedType = Mutex<ThreadModeRawMutex, Option<Output<'static, AnyPin>>>;
|
||||||
static LED: LedType = Mutex::new(None);
|
static LED: LedType = Mutex::new(None);
|
||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
@ -25,7 +25,7 @@ async fn main(spawner: Spawner) {
|
|||||||
// inner scope is so that once the mutex is written to, the MutexGuard is dropped, thus the
|
// inner scope is so that once the mutex is written to, the MutexGuard is dropped, thus the
|
||||||
// Mutex is released
|
// Mutex is released
|
||||||
{
|
{
|
||||||
*(LED.lock().await) = Some(PeripheralRef::new(led));
|
*(LED.lock().await) = Some(led);
|
||||||
}
|
}
|
||||||
let dt = 100 * 1_000_000;
|
let dt = 100 * 1_000_000;
|
||||||
let k = 1.003;
|
let k = 1.003;
|
||||||
|
Loading…
Reference in New Issue
Block a user