diff options
| author | Mathis Deroo <[email protected]> | 2025-12-09 15:13:07 -0800 |
|---|---|---|
| committer | Mathis Deroo <[email protected]> | 2025-12-09 15:13:07 -0800 |
| commit | 4f0eb421de9e08bbbf7f9a58f8b29c451de59894 (patch) | |
| tree | 3443f4b877101a88e18a4eb4eada7627aa1e6365 /examples/mcxa/src | |
| parent | 06c16ca54dc846efa4b256620b4658a5b8378f81 (diff) | |
run rustfmt
Signed-off-by: Mathis Deroo <[email protected]>
Diffstat (limited to 'examples/mcxa/src')
| -rw-r--r-- | examples/mcxa/src/bin/adc_interrupt.rs | 11 | ||||
| -rw-r--r-- | examples/mcxa/src/bin/adc_polling.rs | 4 |
2 files changed, 7 insertions, 8 deletions
diff --git a/examples/mcxa/src/bin/adc_interrupt.rs b/examples/mcxa/src/bin/adc_interrupt.rs index 257e04491..5876923a1 100644 --- a/examples/mcxa/src/bin/adc_interrupt.rs +++ b/examples/mcxa/src/bin/adc_interrupt.rs | |||
| @@ -2,16 +2,16 @@ | |||
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | 3 | ||
| 4 | use embassy_executor::Spawner; | 4 | use embassy_executor::Spawner; |
| 5 | use hal::adc::{Adc, LpadcConfig, TriggerPriorityPolicy, InterruptHandler}; | 5 | use hal::adc::{Adc, InterruptHandler, LpadcConfig, TriggerPriorityPolicy}; |
| 6 | use hal::bind_interrupts; | ||
| 6 | use hal::clocks::PoweredClock; | 7 | use hal::clocks::PoweredClock; |
| 7 | use hal::config::Config; | ||
| 8 | use hal::clocks::config::Div8; | 8 | use hal::clocks::config::Div8; |
| 9 | use hal::clocks::periph_helpers::{AdcClockSel, Div4}; | 9 | use hal::clocks::periph_helpers::{AdcClockSel, Div4}; |
| 10 | use hal::config::Config; | ||
| 10 | use hal::pac::adc1::cfg::{Pwrsel, Refsel}; | 11 | use hal::pac::adc1::cfg::{Pwrsel, Refsel}; |
| 11 | use hal::pac::adc1::cmdl1::{Adch, Mode}; | 12 | use hal::pac::adc1::cmdl1::{Adch, Mode}; |
| 12 | use hal::pac::adc1::ctrl::CalAvgs; | 13 | use hal::pac::adc1::ctrl::CalAvgs; |
| 13 | use hal::pac::adc1::tctrl::Tcmd; | 14 | use hal::pac::adc1::tctrl::Tcmd; |
| 14 | use hal::bind_interrupts; | ||
| 15 | use hal::peripherals::ADC1; | 15 | use hal::peripherals::ADC1; |
| 16 | use {defmt_rtt as _, embassy_mcxa as hal, panic_probe as _}; | 16 | use {defmt_rtt as _, embassy_mcxa as hal, panic_probe as _}; |
| 17 | 17 | ||
| @@ -19,12 +19,11 @@ bind_interrupts!(struct Irqs { | |||
| 19 | ADC1 => InterruptHandler<ADC1>; | 19 | ADC1 => InterruptHandler<ADC1>; |
| 20 | }); | 20 | }); |
| 21 | 21 | ||
| 22 | |||
| 23 | #[embassy_executor::main] | 22 | #[embassy_executor::main] |
| 24 | async fn main(_spawner: Spawner) { | 23 | async fn main(_spawner: Spawner) { |
| 25 | let mut config = Config::default(); | 24 | let mut config = Config::default(); |
| 26 | config.clock_cfg.sirc.fro_lf_div = Div8::from_divisor(1); | 25 | config.clock_cfg.sirc.fro_lf_div = Div8::from_divisor(1); |
| 27 | 26 | ||
| 28 | let p = hal::init(config); | 27 | let p = hal::init(config); |
| 29 | 28 | ||
| 30 | defmt::info!("ADC interrupt Example"); | 29 | defmt::info!("ADC interrupt Example"); |
| @@ -62,7 +61,7 @@ async fn main(_spawner: Spawner) { | |||
| 62 | defmt::info!("ADC configuration done..."); | 61 | defmt::info!("ADC configuration done..."); |
| 63 | 62 | ||
| 64 | loop { | 63 | loop { |
| 65 | match adc.read().await { | 64 | match adc.read().await { |
| 66 | Ok(value) => { | 65 | Ok(value) => { |
| 67 | defmt::info!("*** ADC interrupt TRIGGERED! *** -- value: {}", value); | 66 | defmt::info!("*** ADC interrupt TRIGGERED! *** -- value: {}", value); |
| 68 | } | 67 | } |
diff --git a/examples/mcxa/src/bin/adc_polling.rs b/examples/mcxa/src/bin/adc_polling.rs index b11b8957f..d048bb56f 100644 --- a/examples/mcxa/src/bin/adc_polling.rs +++ b/examples/mcxa/src/bin/adc_polling.rs | |||
| @@ -4,9 +4,9 @@ | |||
| 4 | use embassy_executor::Spawner; | 4 | use embassy_executor::Spawner; |
| 5 | use hal::adc::{Adc, LpadcConfig, TriggerPriorityPolicy}; | 5 | use hal::adc::{Adc, LpadcConfig, TriggerPriorityPolicy}; |
| 6 | use hal::clocks::PoweredClock; | 6 | use hal::clocks::PoweredClock; |
| 7 | use hal::config::Config; | ||
| 8 | use hal::clocks::config::Div8; | 7 | use hal::clocks::config::Div8; |
| 9 | use hal::clocks::periph_helpers::{AdcClockSel, Div4}; | 8 | use hal::clocks::periph_helpers::{AdcClockSel, Div4}; |
| 9 | use hal::config::Config; | ||
| 10 | use hal::pac::adc1::cfg::{Pwrsel, Refsel}; | 10 | use hal::pac::adc1::cfg::{Pwrsel, Refsel}; |
| 11 | use hal::pac::adc1::cmdl1::{Adch, Mode}; | 11 | use hal::pac::adc1::cmdl1::{Adch, Mode}; |
| 12 | use hal::pac::adc1::ctrl::CalAvgs; | 12 | use hal::pac::adc1::ctrl::CalAvgs; |
| @@ -19,7 +19,7 @@ const G_LPADC_RESULT_SHIFT: u32 = 0; | |||
| 19 | async fn main(_spawner: Spawner) { | 19 | async fn main(_spawner: Spawner) { |
| 20 | let mut config = Config::default(); | 20 | let mut config = Config::default(); |
| 21 | config.clock_cfg.sirc.fro_lf_div = Div8::from_divisor(1); | 21 | config.clock_cfg.sirc.fro_lf_div = Div8::from_divisor(1); |
| 22 | 22 | ||
| 23 | let p = hal::init(config); | 23 | let p = hal::init(config); |
| 24 | 24 | ||
| 25 | defmt::info!("=== ADC polling Example ==="); | 25 | defmt::info!("=== ADC polling Example ==="); |
