diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/nrf/src/bin/uart_idle.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/nrf/src/bin/uart_idle.rs b/examples/nrf/src/bin/uart_idle.rs index 09ec624c0..6af4f7097 100644 --- a/examples/nrf/src/bin/uart_idle.rs +++ b/examples/nrf/src/bin/uart_idle.rs | |||
| @@ -15,7 +15,8 @@ async fn main(_spawner: Spawner) { | |||
| 15 | config.baudrate = uarte::Baudrate::BAUD115200; | 15 | config.baudrate = uarte::Baudrate::BAUD115200; |
| 16 | 16 | ||
| 17 | let irq = interrupt::take!(UARTE0_UART0); | 17 | let irq = interrupt::take!(UARTE0_UART0); |
| 18 | let mut uart = uarte::UarteWithIdle::new(p.UARTE0, p.TIMER0, p.PPI_CH0, p.PPI_CH1, irq, p.P0_08, p.P0_06, config); | 18 | let uart = uarte::Uarte::new(p.UARTE0, irq, p.P0_08, p.P0_06, config); |
| 19 | let (mut tx, mut rx) = uart.split_with_idle(p.TIMER0, p.PPI_CH0, p.PPI_CH1); | ||
| 19 | 20 | ||
| 20 | info!("uarte initialized!"); | 21 | info!("uarte initialized!"); |
| 21 | 22 | ||
| @@ -23,12 +24,12 @@ async fn main(_spawner: Spawner) { | |||
| 23 | let mut buf = [0; 8]; | 24 | let mut buf = [0; 8]; |
| 24 | buf.copy_from_slice(b"Hello!\r\n"); | 25 | buf.copy_from_slice(b"Hello!\r\n"); |
| 25 | 26 | ||
| 26 | unwrap!(uart.write(&buf).await); | 27 | unwrap!(tx.write(&buf).await); |
| 27 | info!("wrote hello in uart!"); | 28 | info!("wrote hello in uart!"); |
| 28 | 29 | ||
| 29 | loop { | 30 | loop { |
| 30 | info!("reading..."); | 31 | info!("reading..."); |
| 31 | let n = unwrap!(uart.read_until_idle(&mut buf).await); | 32 | let n = unwrap!(rx.read_until_idle(&mut buf).await); |
| 32 | info!("got {} bytes", n); | 33 | info!("got {} bytes", n); |
| 33 | } | 34 | } |
| 34 | } | 35 | } |
