diff options
Diffstat (limited to 'examples/src/lib.rs')
| -rw-r--r-- | examples/src/lib.rs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/examples/src/lib.rs b/examples/src/lib.rs new file mode 100644 index 000000000..a45ab708d --- /dev/null +++ b/examples/src/lib.rs | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | #![no_std] | ||
| 2 | |||
| 3 | //! Shared board-specific helpers for the FRDM-MCXA276 examples. | ||
| 4 | //! These live with the examples so the HAL stays generic. | ||
| 5 | |||
| 6 | use hal::{clocks, pins}; | ||
| 7 | use {embassy_mcxa as hal, panic_probe as _}; | ||
| 8 | |||
| 9 | /// Initialize clocks and pin muxing for UART2 debug console. | ||
| 10 | /// Safe to call multiple times; writes are idempotent for our use. | ||
| 11 | #[allow(dead_code)] | ||
| 12 | pub unsafe fn init_uart2(_p: &hal::pac::Peripherals) { | ||
| 13 | // NOTE: Lpuart has been updated to properly enable + reset its own clocks. | ||
| 14 | // GPIO has not. | ||
| 15 | _ = clocks::enable_and_reset::<hal::peripherals::PORT2>(&clocks::NoConfig); | ||
| 16 | pins::configure_uart2_pins_port2(); | ||
| 17 | } | ||
| 18 | |||
| 19 | /// Initialize clocks for the LED GPIO/PORT used by the blink example. | ||
| 20 | #[allow(dead_code)] | ||
| 21 | pub unsafe fn init_led(_p: &hal::pac::Peripherals) { | ||
| 22 | _ = clocks::enable_and_reset::<hal::peripherals::PORT3>(&clocks::NoConfig); | ||
| 23 | _ = clocks::enable_and_reset::<hal::peripherals::GPIO3>(&clocks::NoConfig); | ||
| 24 | } | ||
| 25 | |||
| 26 | /// Initialize clocks and pin muxing for ADC. | ||
| 27 | #[allow(dead_code)] | ||
| 28 | pub unsafe fn init_adc(_p: &hal::pac::Peripherals) { | ||
| 29 | // NOTE: Lpuart has been updated to properly enable + reset its own clocks. | ||
| 30 | // GPIO has not. | ||
| 31 | _ = clocks::enable_and_reset::<hal::peripherals::PORT1>(&clocks::NoConfig); | ||
| 32 | pins::configure_adc_pins(); | ||
| 33 | } | ||
