aboutsummaryrefslogtreecommitdiff
path: root/examples/src/lib.rs
diff options
context:
space:
mode:
authorJames Munns <[email protected]>2025-11-14 19:03:26 +0100
committerJames Munns <[email protected]>2025-11-14 19:03:26 +0100
commit0bae6aa5aaab5d0f3a3e7e1ec83a0cee909de115 (patch)
tree1740876a3af2f06bcc129b62e3a6e87f4472d5f3 /examples/src/lib.rs
parent8cdccae3c6c4a805cf5003b1a859734c105d76e8 (diff)
parent77b2c602a60e41c7c977003a6d40367ac285930e (diff)
Merge remote-tracking branch 'origin/main' into james/impl-clocks
Diffstat (limited to 'examples/src/lib.rs')
-rw-r--r--examples/src/lib.rs33
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
6use hal::{clocks, pins};
7use {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)]
12pub 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)]
21pub 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)]
28pub 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}