Provides a cleaner construction of the channel with the common "new" naming

This commit is contained in:
huntc
2021-07-15 12:08:35 +10:00
parent 6f78527aeb
commit 3778f55d80
3 changed files with 51 additions and 88 deletions

View File

@ -37,9 +37,10 @@ async fn my_task(sender: Sender<'static, WithNoThreads, LedState, 1>) {
#[embassy::main]
async fn main(spawner: Spawner, p: Peripherals) {
let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard);
let channel = CHANNEL.put(Channel::with_no_threads());
let channel = CHANNEL.put(Channel::new());
let (sender, mut receiver) = mpsc::split(channel);
spawner.spawn(my_task(sender)).unwrap();