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
use hal::gpio::gpio0::{Pin16, Pin17, OUT_XOR, IOF_SEL, IOF_EN};
use hal::gpio::{IOF0, NoInvert};
use hal::serial::{Tx, Rx};
use hal::e310x::UART0;
pub type TxPin = Pin17<IOF0<NoInvert>>;
pub type RxPin = Pin16<IOF0<NoInvert>>;
pub type TX = Tx<UART0>;
pub type RX = Rx<UART0>;
pub fn tx_rx<X, Y>(
tx: Pin17<X>, rx: Pin16<Y>,
out_xor: &mut OUT_XOR, iof_sel: &mut IOF_SEL,
iof_en: &mut IOF_EN
) -> (TxPin, RxPin)
{
let tx: TxPin = tx.into_iof0(out_xor, iof_sel, iof_en);
let rx: RxPin = rx.into_iof0(out_xor, iof_sel, iof_en);
(tx, rx)
}