diff options
| author | James Munns <[email protected]> | 2025-11-14 19:03:26 +0100 |
|---|---|---|
| committer | James Munns <[email protected]> | 2025-11-14 19:03:26 +0100 |
| commit | 0bae6aa5aaab5d0f3a3e7e1ec83a0cee909de115 (patch) | |
| tree | 1740876a3af2f06bcc129b62e3a6e87f4472d5f3 /examples/src/lib.rs | |
| parent | 8cdccae3c6c4a805cf5003b1a859734c105d76e8 (diff) | |
| parent | 77b2c602a60e41c7c977003a6d40367ac285930e (diff) | |
Merge remote-tracking branch 'origin/main' into james/impl-clocks
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 | } | ||
