mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
add bio bit setting and also add input bit mapping to board file
This commit is contained in:
parent
514b27eb18
commit
a4d9fc9dc7
2 changed files with 20 additions and 1 deletions
|
|
@ -321,6 +321,21 @@ pub fn setup_trng_power_pin<T: IoSetup + IoGpio>(iox: &T) -> (IoxPort, u8) {
|
|||
(port, pin)
|
||||
}
|
||||
|
||||
pub fn setup_trng_input_pin<T: IoSetup + IoGpio>(iox: &T) -> u8 {
|
||||
let (port, pin) = (IoxPort::PC, 15);
|
||||
iox.setup_pin(
|
||||
port,
|
||||
pin,
|
||||
Some(IoxDir::Input),
|
||||
Some(IoxFunction::Gpio),
|
||||
Some(IoxEnable::Enable), // enable the schmitt trigger on this pad
|
||||
Some(IoxEnable::Disable),
|
||||
None,
|
||||
Some(IoxDriveStrength::Drive2mA),
|
||||
);
|
||||
iox.set_pio_bit_from_port_and_pin(port, pin).expect("Couldn't allocate TRNG input pin")
|
||||
}
|
||||
|
||||
// sentinel used by test infrastructure to assist with parsing
|
||||
// The format of any test infrastructure output to recover is as follows:
|
||||
// _|TT|_<ident>,<data separated by commas>,_|TE|_
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ impl Iox {
|
|||
}
|
||||
}
|
||||
IoxPort::PC => {
|
||||
if (pin != 6 && pin != 11 && pin != 14 && pin != 15) && pin < 16 {
|
||||
if pin < 16 {
|
||||
self.set_alternate_function(port, pin, IoxFunction::AF1);
|
||||
let pio_bit = pin + 16;
|
||||
self.csr.wo(iox::SFR_PIOSEL, self.csr.r(iox::SFR_PIOSEL) | (1 << pio_bit as u32));
|
||||
|
|
@ -376,6 +376,10 @@ impl IoSetup for Iox {
|
|||
self.set_drive_strength(port, pin, s);
|
||||
}
|
||||
}
|
||||
|
||||
fn set_pio_bit_from_port_and_pin(&self, port: IoxPort, pin: u8) -> Option<u8> {
|
||||
self.set_pio_bit_from_port_and_pin(port, pin)
|
||||
}
|
||||
}
|
||||
|
||||
impl IoGpio for Iox {
|
||||
|
|
|
|||
Loading…
Reference in a new issue