mirror of
https://github.com/italicsjenga/rp-hal-boards.git
synced 2024-12-24 05:01:31 +11:00
Fixed failing doctest
This commit is contained in:
parent
86444448a4
commit
8f63be0f22
|
@ -22,10 +22,8 @@
|
||||||
//! pins.gpio1.into_mode::<FunctionUart>(),
|
//! pins.gpio1.into_mode::<FunctionUart>(),
|
||||||
//! );
|
//! );
|
||||||
//! // Need to perform clock init before using UART or it will freeze.
|
//! // Need to perform clock init before using UART or it will freeze.
|
||||||
//! let uart = UartPeripheral::enable(
|
//! let uart = UartPeripheral::new(peripherals.UART0, pins, &mut peripherals.RESETS)
|
||||||
//! peripherals.UART0,
|
//! .enable(
|
||||||
//! pins,
|
|
||||||
//! &mut peripherals.RESETS,
|
|
||||||
//! uart::common_configs::_9600_8_N_1,
|
//! uart::common_configs::_9600_8_N_1,
|
||||||
//! clocks.peripheral_clock.into(),
|
//! clocks.peripheral_clock.into(),
|
||||||
//! ).unwrap();
|
//! ).unwrap();
|
||||||
|
|
|
@ -16,17 +16,19 @@
|
||||||
//! let mut watchdog = Watchdog::new(peripherals.WATCHDOG);
|
//! let mut watchdog = Watchdog::new(peripherals.WATCHDOG);
|
||||||
//! let mut clocks = init_clocks_and_plls(XOSC_CRYSTAL_FREQ, peripherals.XOSC, peripherals.CLOCKS, peripherals.PLL_SYS, peripherals.PLL_USB, &mut peripherals.RESETS, &mut watchdog).ok().unwrap();
|
//! let mut clocks = init_clocks_and_plls(XOSC_CRYSTAL_FREQ, peripherals.XOSC, peripherals.CLOCKS, peripherals.PLL_SYS, peripherals.PLL_USB, &mut peripherals.RESETS, &mut watchdog).ok().unwrap();
|
||||||
//!
|
//!
|
||||||
|
//! // Set up UART on GP0 and GP1 (Pico pins 1 and 2)
|
||||||
|
//! let pins = (
|
||||||
|
//! pins.gpio0.into_mode::<FunctionUart>(),
|
||||||
|
//! pins.gpio1.into_mode::<FunctionUart>(),
|
||||||
|
//! );
|
||||||
//! // Need to perform clock init before using UART or it will freeze.
|
//! // Need to perform clock init before using UART or it will freeze.
|
||||||
//! let uart = UartPeripheral::<_, _>::new(peripherals.UART0, &mut peripherals.RESETS)
|
//! let uart = UartPeripheral::new(peripherals.UART0, pins, &mut peripherals.RESETS)
|
||||||
//! .enable(
|
//! .enable(
|
||||||
//! uart::common_configs::_9600_8_N_1,
|
//! uart::common_configs::_9600_8_N_1,
|
||||||
//! clocks.peripheral_clock.into(),
|
//! clocks.peripheral_clock.into(),
|
||||||
//! )
|
//! )
|
||||||
//! .unwrap();
|
//! .unwrap();
|
||||||
//!
|
//!
|
||||||
//! // Set up UART on GP0 and GP1 (Pico pins 1 and 2)
|
|
||||||
//! let _tx_pin = pins.gpio0.into_mode::<FunctionUart>();
|
|
||||||
//! let _rx_pin = pins.gpio1.into_mode::<FunctionUart>();
|
|
||||||
//! uart.write_full_blocking(b"Hello World!\r\n");
|
//! uart.write_full_blocking(b"Hello World!\r\n");
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
|
@ -41,6 +43,9 @@ use embedded_time::rate::Hertz;
|
||||||
use nb::Error::{Other, WouldBlock};
|
use nb::Error::{Other, WouldBlock};
|
||||||
use rp2040_pac::{UART0, UART1};
|
use rp2040_pac::{UART0, UART1};
|
||||||
|
|
||||||
|
#[cfg(feature = "eh1_0_alpha")]
|
||||||
|
use eh1_0_alpha::serial::nb as eh1;
|
||||||
|
|
||||||
/// An UART Peripheral based on an underlying UART device.
|
/// An UART Peripheral based on an underlying UART device.
|
||||||
pub struct UartPeripheral<S: State, D: UartDevice, P: ValidUartPinout<D>> {
|
pub struct UartPeripheral<S: State, D: UartDevice, P: ValidUartPinout<D>> {
|
||||||
device: D,
|
device: D,
|
||||||
|
|
Loading…
Reference in a new issue