Document that UART TX should be set up first (#2914)
This commit is contained in:
parent
9f553b1b0e
commit
409641dd7e
@ -830,6 +830,11 @@ where
|
|||||||
/// Assign the RX pin for UART instance.
|
/// Assign the RX pin for UART instance.
|
||||||
///
|
///
|
||||||
/// Sets the specified pin to input and connects it to the UART RX signal.
|
/// Sets the specified pin to input and connects it to the UART RX signal.
|
||||||
|
///
|
||||||
|
/// Note: when you listen for the output of the UART peripheral, you should
|
||||||
|
/// configure the driver side (i.e. the TX pin), or ensure that the line is
|
||||||
|
/// initially high, to avoid receiving a non-data byte caused by an
|
||||||
|
/// initial low signal level.
|
||||||
pub fn with_rx(self, rx: impl Peripheral<P = impl PeripheralInput> + 'd) -> Self {
|
pub fn with_rx(self, rx: impl Peripheral<P = impl PeripheralInput> + 'd) -> Self {
|
||||||
crate::into_mapped_ref!(rx);
|
crate::into_mapped_ref!(rx);
|
||||||
rx.init_input(Pull::Up, Internal);
|
rx.init_input(Pull::Up, Internal);
|
||||||
@ -1046,6 +1051,11 @@ where
|
|||||||
/// Assign the RX pin for UART instance.
|
/// Assign the RX pin for UART instance.
|
||||||
///
|
///
|
||||||
/// Sets the specified pin to input and connects it to the UART RX signal.
|
/// Sets the specified pin to input and connects it to the UART RX signal.
|
||||||
|
///
|
||||||
|
/// Note: when you listen for the output of the UART peripheral, you should
|
||||||
|
/// configure the driver side (i.e. the TX pin), or ensure that the line is
|
||||||
|
/// initially high, to avoid receiving a non-data byte caused by an
|
||||||
|
/// initial low signal level.
|
||||||
pub fn with_rx(self, rx: impl Peripheral<P = impl PeripheralInput> + 'd) -> Self {
|
pub fn with_rx(self, rx: impl Peripheral<P = impl PeripheralInput> + 'd) -> Self {
|
||||||
crate::into_mapped_ref!(rx);
|
crate::into_mapped_ref!(rx);
|
||||||
rx.init_input(Pull::Up, Internal);
|
rx.init_input(Pull::Up, Internal);
|
||||||
|
|||||||
@ -26,9 +26,7 @@ mod tests {
|
|||||||
fn init() -> Context {
|
fn init() -> Context {
|
||||||
let peripherals = esp_hal::init(esp_hal::Config::default());
|
let peripherals = esp_hal::init(esp_hal::Config::default());
|
||||||
|
|
||||||
let (_, pin) = hil_test::common_test_pins!(peripherals);
|
let (rx, tx) = hil_test::common_test_pins!(peripherals);
|
||||||
|
|
||||||
let (rx, tx) = pin.split();
|
|
||||||
|
|
||||||
let uart = Uart::new(peripherals.UART1, uart::Config::default())
|
let uart = Uart::new(peripherals.UART1, uart::Config::default())
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user