From 0a27b6cedb52453123190671f294bbd34918e09a Mon Sep 17 00:00:00 2001 From: Dominik Boehi Date: Mon, 9 Jan 2023 22:29:58 +0100 Subject: Rename examples/nrf to examples/nrf52840 --- examples/nrf/src/bin/uart_split.rs | 60 -------------------------------------- 1 file changed, 60 deletions(-) delete mode 100644 examples/nrf/src/bin/uart_split.rs (limited to 'examples/nrf/src/bin/uart_split.rs') diff --git a/examples/nrf/src/bin/uart_split.rs b/examples/nrf/src/bin/uart_split.rs deleted file mode 100644 index 1adaf53fd..000000000 --- a/examples/nrf/src/bin/uart_split.rs +++ /dev/null @@ -1,60 +0,0 @@ -#![no_std] -#![no_main] -#![feature(type_alias_impl_trait)] - -use defmt::*; -use embassy_executor::Spawner; -use embassy_nrf::peripherals::UARTE0; -use embassy_nrf::uarte::UarteRx; -use embassy_nrf::{interrupt, uarte}; -use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; -use embassy_sync::channel::Channel; -use {defmt_rtt as _, panic_probe as _}; - -static CHANNEL: Channel = Channel::new(); - -#[embassy_executor::main] -async fn main(spawner: Spawner) { - let p = embassy_nrf::init(Default::default()); - let mut config = uarte::Config::default(); - config.parity = uarte::Parity::EXCLUDED; - config.baudrate = uarte::Baudrate::BAUD115200; - - let irq = interrupt::take!(UARTE0_UART0); - let uart = uarte::Uarte::new(p.UARTE0, irq, p.P0_08, p.P0_06, config); - let (mut tx, rx) = uart.split(); - - info!("uarte initialized!"); - - // Spawn a task responsible purely for reading - - unwrap!(spawner.spawn(reader(rx))); - - // Message must be in SRAM - { - let mut buf = [0; 23]; - buf.copy_from_slice(b"Type 8 chars to echo!\r\n"); - - unwrap!(tx.write(&buf).await); - info!("wrote hello in uart!"); - } - - // Continue reading in this main task and write - // back out the buffer we receive from the read - // task. - loop { - let buf = CHANNEL.recv().await; - info!("writing..."); - unwrap!(tx.write(&buf).await); - } -} - -#[embassy_executor::task] -async fn reader(mut rx: UarteRx<'static, UARTE0>) { - let mut buf = [0; 8]; - loop { - info!("reading..."); - unwrap!(rx.read(&mut buf).await); - CHANNEL.send(buf).await; - } -} -- cgit