diff options
| author | Dion Dokter <[email protected]> | 2021-10-14 15:13:45 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-10-26 14:46:39 +0200 |
| commit | e6ec81b999541cca847b50075ac0d5d826f97dcd (patch) | |
| tree | cc11cd6c61ff53e4bea551b43bcb18b9de89191b | |
| parent | 4950682a50c8561124462cd7d774a72626271294 (diff) | |
Fixed examples and added defmt format to the new error types
| -rw-r--r-- | embassy-nrf/src/buffered_uarte.rs | 1 | ||||
| -rw-r--r-- | embassy-nrf/src/ppi.rs | 1 | ||||
| -rw-r--r-- | embassy-nrf/src/uarte.rs | 1 | ||||
| -rw-r--r-- | examples/nrf/src/bin/buffered_uart.rs | 4 | ||||
| -rw-r--r-- | examples/nrf/src/bin/uart_idle.rs | 4 |
5 files changed, 7 insertions, 4 deletions
diff --git a/embassy-nrf/src/buffered_uarte.rs b/embassy-nrf/src/buffered_uarte.rs index f7e55e428..8ec0fb2ce 100644 --- a/embassy-nrf/src/buffered_uarte.rs +++ b/embassy-nrf/src/buffered_uarte.rs | |||
| @@ -25,6 +25,7 @@ pub use pac::uarte0::{baudrate::BAUDRATE_A as Baudrate, config::PARITY_A as Pari | |||
| 25 | 25 | ||
| 26 | #[non_exhaustive] | 26 | #[non_exhaustive] |
| 27 | #[derive(Clone, Debug)] | 27 | #[derive(Clone, Debug)] |
| 28 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 28 | pub enum Error { | 29 | pub enum Error { |
| 29 | PpiError(ppi::Error), | 30 | PpiError(ppi::Error), |
| 30 | } | 31 | } |
diff --git a/embassy-nrf/src/ppi.rs b/embassy-nrf/src/ppi.rs index 1f825bf47..7aaf17ee5 100644 --- a/embassy-nrf/src/ppi.rs +++ b/embassy-nrf/src/ppi.rs | |||
| @@ -23,6 +23,7 @@ use embassy_hal_common::{unborrow, unsafe_impl_unborrow}; | |||
| 23 | /// Error type of the PPI driver | 23 | /// Error type of the PPI driver |
| 24 | #[non_exhaustive] | 24 | #[non_exhaustive] |
| 25 | #[derive(Clone, Debug)] | 25 | #[derive(Clone, Debug)] |
| 26 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 26 | pub enum Error { | 27 | pub enum Error { |
| 27 | /// There is no capacity to enable this task or event (nRF51 & nRF52 only) | 28 | /// There is no capacity to enable this task or event (nRF51 & nRF52 only) |
| 28 | NoCapacityLeft, | 29 | NoCapacityLeft, |
diff --git a/embassy-nrf/src/uarte.rs b/embassy-nrf/src/uarte.rs index f2bf01f1f..71401a561 100644 --- a/embassy-nrf/src/uarte.rs +++ b/embassy-nrf/src/uarte.rs | |||
| @@ -27,6 +27,7 @@ pub use pac::uarte0::{baudrate::BAUDRATE_A as Baudrate, config::PARITY_A as Pari | |||
| 27 | 27 | ||
| 28 | #[non_exhaustive] | 28 | #[non_exhaustive] |
| 29 | #[derive(Clone, Debug)] | 29 | #[derive(Clone, Debug)] |
| 30 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 30 | pub enum Error { | 31 | pub enum Error { |
| 31 | PpiError(crate::ppi::Error), | 32 | PpiError(crate::ppi::Error), |
| 32 | } | 33 | } |
diff --git a/examples/nrf/src/bin/buffered_uart.rs b/examples/nrf/src/bin/buffered_uart.rs index 69c7de93b..b01c83ce3 100644 --- a/examples/nrf/src/bin/buffered_uart.rs +++ b/examples/nrf/src/bin/buffered_uart.rs | |||
| @@ -26,7 +26,7 @@ async fn main(_spawner: Spawner, p: Peripherals) { | |||
| 26 | let irq = interrupt::take!(UARTE0_UART0); | 26 | let irq = interrupt::take!(UARTE0_UART0); |
| 27 | let mut state = State::new(); | 27 | let mut state = State::new(); |
| 28 | let u = unsafe { | 28 | let u = unsafe { |
| 29 | BufferedUarte::new( | 29 | unwrap!(BufferedUarte::new( |
| 30 | &mut state, | 30 | &mut state, |
| 31 | p.UARTE0, | 31 | p.UARTE0, |
| 32 | p.TIMER0, | 32 | p.TIMER0, |
| @@ -40,7 +40,7 @@ async fn main(_spawner: Spawner, p: Peripherals) { | |||
| 40 | config, | 40 | config, |
| 41 | &mut rx_buffer, | 41 | &mut rx_buffer, |
| 42 | &mut tx_buffer, | 42 | &mut tx_buffer, |
| 43 | ) | 43 | )) |
| 44 | }; | 44 | }; |
| 45 | pin_mut!(u); | 45 | pin_mut!(u); |
| 46 | 46 | ||
diff --git a/examples/nrf/src/bin/uart_idle.rs b/examples/nrf/src/bin/uart_idle.rs index e9f4a285a..e04e5cf04 100644 --- a/examples/nrf/src/bin/uart_idle.rs +++ b/examples/nrf/src/bin/uart_idle.rs | |||
| @@ -21,9 +21,9 @@ async fn main(_spawner: Spawner, p: Peripherals) { | |||
| 21 | 21 | ||
| 22 | let irq = interrupt::take!(UARTE0_UART0); | 22 | let irq = interrupt::take!(UARTE0_UART0); |
| 23 | let mut uart = unsafe { | 23 | let mut uart = unsafe { |
| 24 | uarte::UarteWithIdle::new( | 24 | unwrap!(uarte::UarteWithIdle::new( |
| 25 | p.UARTE0, p.TIMER0, p.PPI_CH0, p.PPI_CH1, irq, p.P0_08, p.P0_06, NoPin, NoPin, config, | 25 | p.UARTE0, p.TIMER0, p.PPI_CH0, p.PPI_CH1, irq, p.P0_08, p.P0_06, NoPin, NoPin, config, |
| 26 | ) | 26 | )) |
| 27 | }; | 27 | }; |
| 28 | 28 | ||
| 29 | info!("uarte initialized!"); | 29 | info!("uarte initialized!"); |
