blob: cf41945590d3cf6f6ba02fb5db191f2ddac6720a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#![no_std]
//! Shared board-specific helpers for the FRDM-MCXA276 examples.
//! These live with the examples so the HAL stays generic.
use hal::{clocks, pins, reset};
use {defmt_rtt as _, embassy_mcxa as hal, panic_probe as _};
/// Initialize clocks and pin muxing for UART2 debug console.
/// Safe to call multiple times; writes are idempotent for our use.
///
/// # Safety
///
/// Called only once to initialize the peripheral
#[allow(dead_code)]
pub unsafe fn init_uart2(p: &hal::pac::Peripherals) {
clocks::ensure_frolf_running(p);
clocks::enable_uart2_port2(p);
reset::release_reset_port2(p);
reset::release_reset_lpuart2(p);
pins::configure_uart2_pins_port2();
clocks::select_uart2_clock(p);
}
/// Initialize clocks for the LED GPIO/PORT used by the blink example.
///
/// # Safety
///
/// Called only once to initialize the peripheral
#[allow(dead_code)]
pub unsafe fn init_led(p: &hal::pac::Peripherals) {
clocks::enable_led_port(p);
reset::release_reset_gpio3(p);
reset::release_reset_port3(p);
}
/// Initialize clocks for OSTIMER0 (1 MHz source).
///
/// # Safety
///
/// Called only once to initialize the peripheral
#[allow(dead_code)]
pub unsafe fn init_ostimer0(p: &hal::pac::Peripherals) {
clocks::ensure_frolf_running(p);
clocks::enable_ostimer0(p);
reset::release_reset_ostimer0(p);
clocks::select_ostimer0_clock_1m(p);
}
/// Initialize clocks and pin muxing for ADC.
///
/// # Safety
///
/// Called only once to initialize the peripheral
#[allow(dead_code)]
pub unsafe fn init_adc(p: &hal::pac::Peripherals) {
clocks::ensure_frolf_running(p);
clocks::enable_adc(p);
reset::release_reset_port1(p);
reset::release_reset_adc1(p);
pins::configure_adc_pins();
clocks::select_adc_clock(p);
}
|