Skip to content

Commit de6d81a

Browse files
authored
Merge pull request #552 from justapig9020/doc/update-out-of-date
Update UART remapping usage in document
2 parents c561e9e + 083197a commit de6d81a

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/serial.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,8 @@
6363
//! let pin_rx = gpioa.pa10;
6464
//! // Create an interface struct for USART1 with 9600 Baud
6565
//! let serial = Serial::new(
66-
//! dp.USART1,
66+
//! dp.USART1.remap(&mut afio.mapr),
6767
//! (pin_tx, pin_rx),
68-
//! &mut afio.mapr,
6968
//! Config::default()
7069
//! .baudrate(9600.bps())
7170
//! .wordlength_9bits()
@@ -519,7 +518,17 @@ impl<USART: Instance, Otype, PULL> Serial<USART, Otype, PULL> {
519518
/// Basic usage:
520519
///
521520
/// ```
522-
/// let mut serial = Serial::new(usart, (tx_pin, rx_pin), &mut afio.mapr, 9600.bps(), &mut rcc);
521+
/// let serial = Serial::new(
522+
/// usart.remap(&mut afio.mapr),
523+
/// (tx_pin, rx_pin),
524+
/// 9600.bps(),
525+
/// &mut rcc);
526+
///
527+
/// // Or
528+
///
529+
/// let serial = usart
530+
/// .remap(&mut afio.mapr)
531+
/// .serial((tx_pin, rx_pin), 9600.bps(), &mut rcc);
523532
///
524533
/// // You can split the `Serial`
525534
/// let Serial { tx, rx, token } = serial;

0 commit comments

Comments
 (0)