Skip to content

Commit bb24de6

Browse files
committed
serial simplify
1 parent fceedc3 commit bb24de6

File tree

7 files changed

+144
-132
lines changed

7 files changed

+144
-132
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,3 @@ required-features = ["stm32f103"]
153153
[[example]]
154154
name = "serial-interrupt-idle"
155155
required-features = ["stm32f103", "rt", "medium"]
156-
default-target = "thumbv7m-none-eabi"

examples/serial-interrupt-idle.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ unsafe fn write(buf: &[u8]) {
8282
unsafe fn USART1() {
8383
cortex_m::interrupt::free(|_| {
8484
if let Some(rx) = RX.as_mut() {
85-
if rx.is_rxne() {
85+
if rx.is_rx_not_empty() {
8686
if let Ok(w) = nb::block!(rx.read()) {
8787
BUFFER[WIDX] = w;
8888
WIDX += 1;

src/afio.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl AfioExt for AFIO {
4242
/// ```rust
4343
/// let p = pac::Peripherals::take().unwrap();
4444
/// let mut rcc = p.RCC.constrain();
45-
/// let mut afio = p.AFIO.constrain(&mut rcc.apb2);
45+
/// let mut afio = p.AFIO.constrain();
4646
pub struct Parts {
4747
pub evcr: EVCR,
4848
pub mapr: MAPR,
@@ -70,7 +70,7 @@ impl EVCR {
7070
/// ```rust
7171
/// let dp = pac::Peripherals::take().unwrap();
7272
/// let mut rcc = dp.RCC.constrain();
73-
/// let mut afio = dp.AFIO.constrain(&mut rcc.apb2);
73+
/// let mut afio = dp.AFIO.constrain();
7474
/// function_using_mapr(&mut afio.mapr);
7575
/// ```
7676
pub struct MAPR {

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
//! let clocks = rcc.cfgr.freeze(&mut flash.acr);
6363
//!
6464
//! // Prepare the alternate function I/O registers
65-
//! let mut afio = dp.AFIO.constrain(&mut rcc.apb2);
65+
//! let mut afio = dp.AFIO.constrain();
6666
//! ```
6767
//!
6868
//! ## Usage examples

src/pwm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
// Set up the timer as a PWM output. If selected pins may correspond to different remap options,
2525
// then you must specify the remap generic parameter. Otherwise, if there is no such ambiguity,
2626
// the remap generic parameter can be omitted without complains from the compiler.
27-
let (c1, c2, c3, c4) = Timer::tim2(p.TIM2, &clocks, &mut rcc.apb1)
27+
let (c1, c2, c3, c4) = Timer::tim2(p.TIM2, &clocks)
2828
.pwm::<Tim2NoRemap, _, _, _>(pins, &mut afio.mapr, 1.khz())
2929
.3;
3030
@@ -43,7 +43,7 @@
4343
4444
// Put the timer in PWM mode using the specified pins
4545
// with a frequency of 100 hz.
46-
let (c0, c1, c2, c3) = Timer::tim2(device.TIM2, &clocks, &mut rcc.apb1)
46+
let (c0, c1, c2, c3) = Timer::tim2(device.TIM2, &clocks)
4747
.pwm::<Tim2NoRemap, _, _, _>(pins, &mut afio.mapr, 100.hz());
4848
4949
// Set the duty cycle of channel 0 to 50%

0 commit comments

Comments
 (0)