diff options
| author | Bogdan Petru Chircu Mare <[email protected]> | 2025-12-01 20:46:22 -0800 |
|---|---|---|
| committer | Bogdan Petru Chircu Mare <[email protected]> | 2025-12-01 20:46:22 -0800 |
| commit | 6a1eed83b9df8ffa81b93860f530f5bb3252d996 (patch) | |
| tree | f6d389efa7de2f1a0c5ab8c304718cd3f5fe68ce /examples | |
| parent | a18cf2fd0d8158f4b1f24f8982e187477b58267c (diff) | |
| parent | 717346f21a4cf4993c2a1f046e26b6bf647d89cb (diff) | |
Merge upstream/main to incorporate LPUART constructor refactor (#51) and GPIO Drive/Slew fix (#57)
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/src/bin/button.rs | 6 | ||||
| -rw-r--r-- | examples/src/bin/button_async.rs | 5 | ||||
| -rw-r--r-- | examples/src/bin/dma_channel_link.rs | 2 | ||||
| -rw-r--r-- | examples/src/bin/dma_interleave_transfer.rs | 2 | ||||
| -rw-r--r-- | examples/src/bin/dma_mem_to_mem.rs | 2 | ||||
| -rw-r--r-- | examples/src/bin/dma_memset.rs | 2 | ||||
| -rw-r--r-- | examples/src/bin/dma_ping_pong_transfer.rs | 2 | ||||
| -rw-r--r-- | examples/src/bin/dma_scatter_gather.rs | 2 | ||||
| -rw-r--r-- | examples/src/bin/dma_scatter_gather_builder.rs | 2 | ||||
| -rw-r--r-- | examples/src/bin/dma_wrap_transfer.rs | 2 | ||||
| -rw-r--r-- | examples/src/bin/hello.rs | 14 | ||||
| -rw-r--r-- | examples/src/bin/i2c-scan-blocking.rs | 4 | ||||
| -rw-r--r-- | examples/src/bin/lpuart_buffered.rs | 2 | ||||
| -rw-r--r-- | examples/src/bin/lpuart_dma.rs | 2 | ||||
| -rw-r--r-- | examples/src/bin/lpuart_polling.rs | 2 | ||||
| -rw-r--r-- | examples/src/bin/lpuart_ring_buffer.rs | 4 |
16 files changed, 18 insertions, 37 deletions
diff --git a/examples/src/bin/button.rs b/examples/src/bin/button.rs index 2abfe0a9f..943edbb15 100644 --- a/examples/src/bin/button.rs +++ b/examples/src/bin/button.rs | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | use embassy_executor::Spawner; | 4 | use embassy_executor::Spawner; |
| 5 | use embassy_time::Timer; | 5 | use embassy_time::Timer; |
| 6 | use hal::gpio::{DriveStrength, Input, Pull, SlewRate}; | 6 | use hal::gpio::{Input, Pull}; |
| 7 | use {defmt_rtt as _, embassy_mcxa as hal, panic_probe as _}; | 7 | use {defmt_rtt as _, embassy_mcxa as hal, panic_probe as _}; |
| 8 | 8 | ||
| 9 | #[embassy_executor::main] | 9 | #[embassy_executor::main] |
| @@ -12,7 +12,9 @@ async fn main(_spawner: Spawner) { | |||
| 12 | 12 | ||
| 13 | defmt::info!("Button example"); | 13 | defmt::info!("Button example"); |
| 14 | 14 | ||
| 15 | let monitor = Input::new(p.P1_7, Pull::Disabled, DriveStrength::Normal, SlewRate::Slow); | 15 | // This button is labeled "WAKEUP" on the FRDM-MCXA276 |
| 16 | // The board already has a 10K pullup | ||
| 17 | let monitor = Input::new(p.P1_7, Pull::Disabled); | ||
| 16 | 18 | ||
| 17 | loop { | 19 | loop { |
| 18 | defmt::info!("Pin level is {:?}", monitor.get_level()); | 20 | defmt::info!("Pin level is {:?}", monitor.get_level()); |
diff --git a/examples/src/bin/button_async.rs b/examples/src/bin/button_async.rs index 1ecec2e48..6cc7b62cd 100644 --- a/examples/src/bin/button_async.rs +++ b/examples/src/bin/button_async.rs | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | use embassy_executor::Spawner; | 4 | use embassy_executor::Spawner; |
| 5 | use embassy_time::Timer; | 5 | use embassy_time::Timer; |
| 6 | use hal::gpio::{DriveStrength, Input, Pull, SlewRate}; | 6 | use hal::gpio::{Input, Pull}; |
| 7 | use {defmt_rtt as _, embassy_mcxa as hal, panic_probe as _}; | 7 | use {defmt_rtt as _, embassy_mcxa as hal, panic_probe as _}; |
| 8 | 8 | ||
| 9 | #[embassy_executor::main] | 9 | #[embassy_executor::main] |
| @@ -13,7 +13,8 @@ async fn main(_spawner: Spawner) { | |||
| 13 | defmt::info!("GPIO interrupt example"); | 13 | defmt::info!("GPIO interrupt example"); |
| 14 | 14 | ||
| 15 | // This button is labeled "WAKEUP" on the FRDM-MCXA276 | 15 | // This button is labeled "WAKEUP" on the FRDM-MCXA276 |
| 16 | let mut pin = Input::new(p.P1_7, Pull::Up, DriveStrength::Normal, SlewRate::Fast); | 16 | // The board already has a 10K pullup |
| 17 | let mut pin = Input::new(p.P1_7, Pull::Disabled); | ||
| 17 | 18 | ||
| 18 | let mut press_count = 0u32; | 19 | let mut press_count = 0u32; |
| 19 | 20 | ||
diff --git a/examples/src/bin/dma_channel_link.rs b/examples/src/bin/dma_channel_link.rs index 361c9ebc7..92c7a9681 100644 --- a/examples/src/bin/dma_channel_link.rs +++ b/examples/src/bin/dma_channel_link.rs | |||
| @@ -120,8 +120,6 @@ async fn main(_spawner: Spawner) { | |||
| 120 | 120 | ||
| 121 | let config = Config { | 121 | let config = Config { |
| 122 | baudrate_bps: 115_200, | 122 | baudrate_bps: 115_200, |
| 123 | enable_tx: true, | ||
| 124 | enable_rx: false, | ||
| 125 | ..Default::default() | 123 | ..Default::default() |
| 126 | }; | 124 | }; |
| 127 | 125 | ||
diff --git a/examples/src/bin/dma_interleave_transfer.rs b/examples/src/bin/dma_interleave_transfer.rs index c0ebb0a46..7876e8978 100644 --- a/examples/src/bin/dma_interleave_transfer.rs +++ b/examples/src/bin/dma_interleave_transfer.rs | |||
| @@ -84,8 +84,6 @@ async fn main(_spawner: Spawner) { | |||
| 84 | 84 | ||
| 85 | let config = Config { | 85 | let config = Config { |
| 86 | baudrate_bps: 115_200, | 86 | baudrate_bps: 115_200, |
| 87 | enable_tx: true, | ||
| 88 | enable_rx: false, | ||
| 89 | ..Default::default() | 87 | ..Default::default() |
| 90 | }; | 88 | }; |
| 91 | 89 | ||
diff --git a/examples/src/bin/dma_mem_to_mem.rs b/examples/src/bin/dma_mem_to_mem.rs index 72916384f..68f70e742 100644 --- a/examples/src/bin/dma_mem_to_mem.rs +++ b/examples/src/bin/dma_mem_to_mem.rs | |||
| @@ -90,8 +90,6 @@ async fn main(_spawner: Spawner) { | |||
| 90 | // Create UART for debug output | 90 | // Create UART for debug output |
| 91 | let config = Config { | 91 | let config = Config { |
| 92 | baudrate_bps: 115_200, | 92 | baudrate_bps: 115_200, |
| 93 | enable_tx: true, | ||
| 94 | enable_rx: false, | ||
| 95 | ..Default::default() | 93 | ..Default::default() |
| 96 | }; | 94 | }; |
| 97 | 95 | ||
diff --git a/examples/src/bin/dma_memset.rs b/examples/src/bin/dma_memset.rs index 9fbba85e9..95e365e47 100644 --- a/examples/src/bin/dma_memset.rs +++ b/examples/src/bin/dma_memset.rs | |||
| @@ -83,8 +83,6 @@ async fn main(_spawner: Spawner) { | |||
| 83 | 83 | ||
| 84 | let config = Config { | 84 | let config = Config { |
| 85 | baudrate_bps: 115_200, | 85 | baudrate_bps: 115_200, |
| 86 | enable_tx: true, | ||
| 87 | enable_rx: false, | ||
| 88 | ..Default::default() | 86 | ..Default::default() |
| 89 | }; | 87 | }; |
| 90 | 88 | ||
diff --git a/examples/src/bin/dma_ping_pong_transfer.rs b/examples/src/bin/dma_ping_pong_transfer.rs index 692515441..f8f543382 100644 --- a/examples/src/bin/dma_ping_pong_transfer.rs +++ b/examples/src/bin/dma_ping_pong_transfer.rs | |||
| @@ -142,8 +142,6 @@ async fn main(_spawner: Spawner) { | |||
| 142 | 142 | ||
| 143 | let config = Config { | 143 | let config = Config { |
| 144 | baudrate_bps: 115_200, | 144 | baudrate_bps: 115_200, |
| 145 | enable_tx: true, | ||
| 146 | enable_rx: false, | ||
| 147 | ..Default::default() | 145 | ..Default::default() |
| 148 | }; | 146 | }; |
| 149 | 147 | ||
diff --git a/examples/src/bin/dma_scatter_gather.rs b/examples/src/bin/dma_scatter_gather.rs index 9844071b7..4b26bc2ed 100644 --- a/examples/src/bin/dma_scatter_gather.rs +++ b/examples/src/bin/dma_scatter_gather.rs | |||
| @@ -129,8 +129,6 @@ async fn main(_spawner: Spawner) { | |||
| 129 | 129 | ||
| 130 | let config = Config { | 130 | let config = Config { |
| 131 | baudrate_bps: 115_200, | 131 | baudrate_bps: 115_200, |
| 132 | enable_tx: true, | ||
| 133 | enable_rx: false, | ||
| 134 | ..Default::default() | 132 | ..Default::default() |
| 135 | }; | 133 | }; |
| 136 | 134 | ||
diff --git a/examples/src/bin/dma_scatter_gather_builder.rs b/examples/src/bin/dma_scatter_gather_builder.rs index d42ff841e..e483bb81f 100644 --- a/examples/src/bin/dma_scatter_gather_builder.rs +++ b/examples/src/bin/dma_scatter_gather_builder.rs | |||
| @@ -87,8 +87,6 @@ async fn main(_spawner: Spawner) { | |||
| 87 | // Create UART for debug output | 87 | // Create UART for debug output |
| 88 | let config = Config { | 88 | let config = Config { |
| 89 | baudrate_bps: 115_200, | 89 | baudrate_bps: 115_200, |
| 90 | enable_tx: true, | ||
| 91 | enable_rx: false, | ||
| 92 | ..Default::default() | 90 | ..Default::default() |
| 93 | }; | 91 | }; |
| 94 | 92 | ||
diff --git a/examples/src/bin/dma_wrap_transfer.rs b/examples/src/bin/dma_wrap_transfer.rs index 0babf4c20..82936d9d0 100644 --- a/examples/src/bin/dma_wrap_transfer.rs +++ b/examples/src/bin/dma_wrap_transfer.rs | |||
| @@ -84,8 +84,6 @@ async fn main(_spawner: Spawner) { | |||
| 84 | 84 | ||
| 85 | let config = Config { | 85 | let config = Config { |
| 86 | baudrate_bps: 115_200, | 86 | baudrate_bps: 115_200, |
| 87 | enable_tx: true, | ||
| 88 | enable_rx: false, | ||
| 89 | ..Default::default() | 87 | ..Default::default() |
| 90 | }; | 88 | }; |
| 91 | 89 | ||
diff --git a/examples/src/bin/hello.rs b/examples/src/bin/hello.rs index f426d1898..e371d9413 100644 --- a/examples/src/bin/hello.rs +++ b/examples/src/bin/hello.rs | |||
| @@ -2,27 +2,29 @@ | |||
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | 3 | ||
| 4 | use embassy_executor::Spawner; | 4 | use embassy_executor::Spawner; |
| 5 | use embassy_mcxa::clocks::config::Div8; | ||
| 5 | use hal::lpuart::{Blocking, Config, Lpuart}; | 6 | use hal::lpuart::{Blocking, Config, Lpuart}; |
| 6 | use {defmt_rtt as _, embassy_mcxa as hal, panic_probe as _}; | 7 | use {defmt_rtt as _, embassy_mcxa as hal, panic_probe as _}; |
| 7 | 8 | ||
| 8 | /// Simple helper to write a byte as hex to UART | 9 | /// Simple helper to write a byte as hex to UART |
| 9 | fn write_hex_byte(uart: &mut Lpuart<'_, Blocking>, byte: u8) { | 10 | fn write_hex_byte(uart: &mut Lpuart<'_, Blocking>, byte: u8) { |
| 10 | const HEX_DIGITS: &[u8] = b"0123456789ABCDEF"; | 11 | const HEX_DIGITS: &[u8] = b"0123456789ABCDEF"; |
| 11 | uart.write_byte(HEX_DIGITS[(byte >> 4) as usize]); | 12 | let _ = uart.write_byte(HEX_DIGITS[(byte >> 4) as usize]); |
| 12 | uart.write_byte(HEX_DIGITS[(byte & 0xF) as usize]); | 13 | let _ = uart.write_byte(HEX_DIGITS[(byte & 0xF) as usize]); |
| 13 | } | 14 | } |
| 14 | 15 | ||
| 15 | #[embassy_executor::main] | 16 | #[embassy_executor::main] |
| 16 | async fn main(_spawner: Spawner) { | 17 | async fn main(_spawner: Spawner) { |
| 17 | let p = hal::init(hal::config::Config::default()); | 18 | let mut cfg = hal::config::Config::default(); |
| 19 | cfg.clock_cfg.sirc.fro_12m_enabled = true; | ||
| 20 | cfg.clock_cfg.sirc.fro_lf_div = Some(Div8::no_div()); | ||
| 21 | let p = hal::init(cfg); | ||
| 18 | 22 | ||
| 19 | defmt::info!("boot"); | 23 | defmt::info!("boot"); |
| 20 | 24 | ||
| 21 | // Create UART configuration | 25 | // Create UART configuration |
| 22 | let config = Config { | 26 | let config = Config { |
| 23 | baudrate_bps: 115_200, | 27 | baudrate_bps: 115_200, |
| 24 | enable_tx: true, | ||
| 25 | enable_rx: true, | ||
| 26 | ..Default::default() | 28 | ..Default::default() |
| 27 | }; | 29 | }; |
| 28 | 30 | ||
| @@ -97,7 +99,7 @@ async fn main(_spawner: Spawner) { | |||
| 97 | // Regular character | 99 | // Regular character |
| 98 | buffer[buf_idx] = byte; | 100 | buffer[buf_idx] = byte; |
| 99 | buf_idx += 1; | 101 | buf_idx += 1; |
| 100 | uart.write_byte(byte); | 102 | let _ = uart.write_byte(byte); |
| 101 | } | 103 | } |
| 102 | } | 104 | } |
| 103 | } | 105 | } |
diff --git a/examples/src/bin/i2c-scan-blocking.rs b/examples/src/bin/i2c-scan-blocking.rs index 72f9d09e0..4e203597b 100644 --- a/examples/src/bin/i2c-scan-blocking.rs +++ b/examples/src/bin/i2c-scan-blocking.rs | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | 3 | ||
| 4 | use embassy_executor::Spawner; | 4 | use embassy_executor::Spawner; |
| 5 | use embassy_mcxa::gpio::{DriveStrength, Pull, SlewRate}; | 5 | use embassy_mcxa::gpio::Pull; |
| 6 | use embassy_mcxa::Input; | 6 | use embassy_mcxa::Input; |
| 7 | use embassy_time::Timer; | 7 | use embassy_time::Timer; |
| 8 | use hal::clocks::config::Div8; | 8 | use hal::clocks::config::Div8; |
| @@ -25,7 +25,7 @@ async fn main(_spawner: Spawner) { | |||
| 25 | // Note: P0_2 is connected to P1_8 on the FRDM_MCXA276 via a resistor, and | 25 | // Note: P0_2 is connected to P1_8 on the FRDM_MCXA276 via a resistor, and |
| 26 | // defaults to SWO on the debug peripheral. Explicitly make it a high-z | 26 | // defaults to SWO on the debug peripheral. Explicitly make it a high-z |
| 27 | // input. | 27 | // input. |
| 28 | let _pin = Input::new(p.P0_2, Pull::Disabled, DriveStrength::Normal, SlewRate::Slow); | 28 | let _pin = Input::new(p.P0_2, Pull::Disabled); |
| 29 | let mut i2c = I2c::new_blocking(p.LPI2C2, p.P1_9, p.P1_8, config).unwrap(); | 29 | let mut i2c = I2c::new_blocking(p.LPI2C2, p.P1_9, p.P1_8, config).unwrap(); |
| 30 | 30 | ||
| 31 | for addr in 0x01..=0x7f { | 31 | for addr in 0x01..=0x7f { |
diff --git a/examples/src/bin/lpuart_buffered.rs b/examples/src/bin/lpuart_buffered.rs index 7f77d557d..420589d00 100644 --- a/examples/src/bin/lpuart_buffered.rs +++ b/examples/src/bin/lpuart_buffered.rs | |||
| @@ -27,8 +27,6 @@ async fn main(_spawner: Spawner) { | |||
| 27 | // UART configuration (enable both TX and RX) | 27 | // UART configuration (enable both TX and RX) |
| 28 | let config = Config { | 28 | let config = Config { |
| 29 | baudrate_bps: 115_200, | 29 | baudrate_bps: 115_200, |
| 30 | enable_tx: true, | ||
| 31 | enable_rx: true, | ||
| 32 | rx_fifo_watermark: 0, | 30 | rx_fifo_watermark: 0, |
| 33 | tx_fifo_watermark: 0, | 31 | tx_fifo_watermark: 0, |
| 34 | ..Default::default() | 32 | ..Default::default() |
diff --git a/examples/src/bin/lpuart_dma.rs b/examples/src/bin/lpuart_dma.rs index f4dfbcf39..5497f8646 100644 --- a/examples/src/bin/lpuart_dma.rs +++ b/examples/src/bin/lpuart_dma.rs | |||
| @@ -41,8 +41,6 @@ async fn main(_spawner: Spawner) { | |||
| 41 | // Create UART configuration | 41 | // Create UART configuration |
| 42 | let config = Config { | 42 | let config = Config { |
| 43 | baudrate_bps: 115_200, | 43 | baudrate_bps: 115_200, |
| 44 | enable_tx: true, | ||
| 45 | enable_rx: true, | ||
| 46 | ..Default::default() | 44 | ..Default::default() |
| 47 | }; | 45 | }; |
| 48 | 46 | ||
diff --git a/examples/src/bin/lpuart_polling.rs b/examples/src/bin/lpuart_polling.rs index 9cea418cc..b80668834 100644 --- a/examples/src/bin/lpuart_polling.rs +++ b/examples/src/bin/lpuart_polling.rs | |||
| @@ -19,8 +19,6 @@ async fn main(_spawner: Spawner) { | |||
| 19 | // Create UART configuration | 19 | // Create UART configuration |
| 20 | let config = Config { | 20 | let config = Config { |
| 21 | baudrate_bps: 115_200, | 21 | baudrate_bps: 115_200, |
| 22 | enable_tx: true, | ||
| 23 | enable_rx: true, | ||
| 24 | ..Default::default() | 22 | ..Default::default() |
| 25 | }; | 23 | }; |
| 26 | 24 | ||
diff --git a/examples/src/bin/lpuart_ring_buffer.rs b/examples/src/bin/lpuart_ring_buffer.rs index 0946bad03..1d1a51970 100644 --- a/examples/src/bin/lpuart_ring_buffer.rs +++ b/examples/src/bin/lpuart_ring_buffer.rs | |||
| @@ -19,10 +19,10 @@ | |||
| 19 | #![no_main] | 19 | #![no_main] |
| 20 | 20 | ||
| 21 | use embassy_executor::Spawner; | 21 | use embassy_executor::Spawner; |
| 22 | use embassy_mcxa::bind_interrupts; | ||
| 22 | use embassy_mcxa::clocks::config::Div8; | 23 | use embassy_mcxa::clocks::config::Div8; |
| 23 | use embassy_mcxa::dma::{DmaCh0InterruptHandler, DmaCh1InterruptHandler}; | 24 | use embassy_mcxa::dma::{DmaCh0InterruptHandler, DmaCh1InterruptHandler}; |
| 24 | use embassy_mcxa::lpuart::{Config, LpuartDma, LpuartTxDma}; | 25 | use embassy_mcxa::lpuart::{Config, LpuartDma, LpuartTxDma}; |
| 25 | use embassy_mcxa::bind_interrupts; | ||
| 26 | use {defmt_rtt as _, embassy_mcxa as hal, panic_probe as _}; | 26 | use {defmt_rtt as _, embassy_mcxa as hal, panic_probe as _}; |
| 27 | 27 | ||
| 28 | // Bind DMA channel interrupts | 28 | // Bind DMA channel interrupts |
| @@ -61,8 +61,6 @@ async fn main(_spawner: Spawner) { | |||
| 61 | // Create UART configuration | 61 | // Create UART configuration |
| 62 | let config = Config { | 62 | let config = Config { |
| 63 | baudrate_bps: 115_200, | 63 | baudrate_bps: 115_200, |
| 64 | enable_tx: true, | ||
| 65 | enable_rx: true, | ||
| 66 | ..Default::default() | 64 | ..Default::default() |
| 67 | }; | 65 | }; |
| 68 | 66 | ||
