aboutsummaryrefslogtreecommitdiff
path: root/embassy-mcxa/src/pins.rs
blob: 9adbe64c834cb3283e961bc9808b4a5cca542c8d (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
//! Pin configuration helpers (separate from peripheral drivers).
use crate::pac;

/// Configure pins for ADC usage.
///
/// # Safety
///
/// Must be called after PORT clocks are enabled.
pub unsafe fn configure_adc_pins() {
    // P1_10 = ADC1_A8
    let port1 = &*pac::Port1::ptr();
    port1.pcr10().write(|w| {
        w.ps()
            .ps0()
            .pe()
            .pe0()
            .sre()
            .sre0()
            .ode()
            .ode0()
            .dse()
            .dse0()
            .mux()
            .mux0()
            .ibe()
            .ibe0()
            .inv()
            .inv0()
            .lk()
            .lk0()
    });
    core::arch::asm!("dsb sy; isb sy");
}