Skip to content

Commit 1df0671

Browse files
ahdinosaurmaximeborges
authored andcommitted
improve serial parity example
1 parent 69ecdf3 commit 1df0671

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

examples/serial_parity.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ fn main() -> ! {
2323
let p = pac::Peripherals::take().unwrap();
2424

2525
let rcc = p.RCC.constrain();
26-
let clocks = rcc.cfgr.sysclk(216_000_000.Hz()).freeze();
26+
let clocks = rcc.cfgr.sysclk(48.MHz()).freeze();
27+
28+
let mut delay = p.TIM5.delay_ms(&clocks);
2729

2830
let gpiod = p.GPIOD.split();
2931

@@ -50,6 +52,8 @@ fn main() -> ! {
5052
loop {
5153
block!(tx.write(byte)).ok();
5254

53-
byte += 1;
55+
byte = byte.wrapping_add(1);
56+
57+
delay.delay(10.millis());
5458
}
5559
}

0 commit comments

Comments
 (0)