Stm32 usart: better names for open drain pin modes
This commit is contained in:
@@ -142,20 +142,20 @@ pub enum HalfDuplexReadback {
|
||||
pub enum OutputConfig {
|
||||
/// Push pull allows for faster baudrates, no internal pullup
|
||||
PushPull,
|
||||
/// Open drain output using external pull down resistor
|
||||
OpenDrainExternal,
|
||||
/// Open drain output (external pull up needed)
|
||||
OpenDrain,
|
||||
#[cfg(not(gpio_v1))]
|
||||
/// Open drain output using internal pull up resistor
|
||||
OpenDrainInternal,
|
||||
/// Open drain output with internal pull up resistor
|
||||
OpenDrainPullUp,
|
||||
}
|
||||
|
||||
impl OutputConfig {
|
||||
const fn af_type(self) -> AfType {
|
||||
match self {
|
||||
OutputConfig::PushPull => AfType::output(OutputType::PushPull, Speed::Medium),
|
||||
OutputConfig::OpenDrainExternal => AfType::output(OutputType::OpenDrain, Speed::Medium),
|
||||
OutputConfig::OpenDrain => AfType::output(OutputType::OpenDrain, Speed::Medium),
|
||||
#[cfg(not(gpio_v1))]
|
||||
OutputConfig::OpenDrainInternal => AfType::output_pull(OutputType::OpenDrain, Speed::Medium, Pull::Up),
|
||||
OutputConfig::OpenDrainPullUp => AfType::output_pull(OutputType::OpenDrain, Speed::Medium, Pull::Up),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ fn create_onewire(p: embassy_stm32::Peripherals) -> OneWire<UartTx<'static, Asyn
|
||||
});
|
||||
|
||||
let mut config = Config::default();
|
||||
config.tx_config = OutputConfig::OpenDrainExternal;
|
||||
config.tx_config = OutputConfig::OpenDrain;
|
||||
|
||||
let usart = Uart::new_half_duplex(
|
||||
p.USART1,
|
||||
@@ -53,7 +53,7 @@ fn create_onewire(p: embassy_stm32::Peripherals) -> OneWire<BufferedUartTx<'stat
|
||||
|
||||
const BUFFER_SIZE: usize = 16;
|
||||
let mut config = Confi::default();
|
||||
config.tx_config = OutputConfig::OpenDrainExternal;
|
||||
config.tx_config = OutputConfig::OpenDrain;
|
||||
let tx_buf: &mut [u8; BUFFER_SIZE] = singleton!(TX_BUF: [u8; BUFFER_SIZE] = [0; BUFFER_SIZE]).unwrap();
|
||||
let rx_buf: &mut [u8; BUFFER_SIZE] = singleton!(RX_BUF: [u8; BUFFER_SIZE] = [0; BUFFER_SIZE]).unwrap();
|
||||
let usart = BufferedUart::new_half_duplex(
|
||||
|
||||
Reference in New Issue
Block a user