earlgrey/
pinmux_config.rs1use crate::pinmux::{SelectInput, SelectOutput};
8use crate::registers::top_earlgrey::{
9 MuxedPads, PinmuxInsel, PinmuxOutsel, PinmuxPeripheralIn, NUM_MIO_PADS,
10};
11
12pub const INPUT_NUM: usize = PinmuxPeripheralIn::UsbdevSense as usize + 1;
14pub const OUTPUT_NUM: usize = NUM_MIO_PADS;
16
17pub trait EarlGreyPinmuxConfig {
19 const INPUT: &'static [PinmuxInsel; INPUT_NUM];
21
22 const OUTPUT: &'static [PinmuxOutsel; OUTPUT_NUM];
24
25 fn setup() {
27 for index in 0..INPUT_NUM {
29 if let Ok(peripheral) = PinmuxPeripheralIn::try_from(index as u32) {
30 peripheral.connect_input(Self::INPUT[index]);
31 }
32 }
33 for index in 0..OUTPUT_NUM {
35 if let Ok(pad) = MuxedPads::try_from(index as u32) {
36 pad.connect_output(Self::OUTPUT[index]);
37 }
38 }
39 }
40}