Skip to content

Commit

Permalink
Update for new pac with write and modify not returning unit type
Browse files Browse the repository at this point in the history
  • Loading branch information
usbalbin committed Nov 7, 2024
1 parent 8286455 commit 369754d
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 21 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ version = "0.0.2"

[dependencies]
nb = "0.1.1"
stm32g4 = { git = "https://github.com/stm32-rs/stm32-rs-nightlies" } #"0.15.1"
#stm32g4 = { git = "https://github.com/stm32-rs/stm32-rs-nightlies" } #"0.15.1"
stm32g4 = { version = "0.17.0", package = "stm32g4-staging" }
paste = "1.0"
bitflags = "1.2"
vcell = "0.1"
Expand Down
4 changes: 2 additions & 2 deletions src/adc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1947,7 +1947,7 @@ macro_rules! adc {
config::Sequence::Fourteen => self.adc_reg.sqr3().modify(|_, w| unsafe {w.sq14().bits(channel) }),
config::Sequence::Fifteen => self.adc_reg.sqr4().modify(|_, w| unsafe {w.sq15().bits(channel) }),
config::Sequence::Sixteen => self.adc_reg.sqr4().modify(|_, w| unsafe {w.sq16().bits(channel) }),
}
};

//Set the sample time for the channel
let st = u8::from(sample_time);
Expand All @@ -1973,7 +1973,7 @@ macro_rules! adc {
17 => self.adc_reg.smpr2().modify(|_, w| w.smp17().bits(st) ),
18 => self.adc_reg.smpr2().modify(|_, w| w.smp18().bits(st) ),
_ => unimplemented!(),
}
};
}
}
/// Synchronously convert a single sample
Expand Down
10 changes: 5 additions & 5 deletions src/comparator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,13 @@ macro_rules! positive_input_pin {
($COMP:ident, $pin_0:ident, $pin_1:ident) => {
impl PositiveInput<$COMP> for &$pin_0<Analog> {
fn setup(&self, comp: &$COMP) {
comp.csr().modify(|_, w| w.inpsel().bit(false))
comp.csr().modify(|_, w| w.inpsel().bit(false));
}
}

impl PositiveInput<$COMP> for &$pin_1<Analog> {
fn setup(&self, comp: &$COMP) {
comp.csr().modify(|_, w| w.inpsel().bit(true))
comp.csr().modify(|_, w| w.inpsel().bit(true));
}
}
};
Expand Down Expand Up @@ -213,7 +213,7 @@ macro_rules! negative_input_pin_helper {
}

fn setup(&self, comp: &$COMP) {
comp.csr().modify(|_, w| unsafe { w.inmsel().bits($bits) })
comp.csr().modify(|_, w| unsafe { w.inmsel().bits($bits) });
}
}
};
Expand Down Expand Up @@ -268,7 +268,7 @@ macro_rules! refint_input {

fn setup(&self, comp: &$COMP) {
comp.csr()
.modify(|_, w| unsafe { w.inmsel().bits(*self as u8) })
.modify(|_, w| unsafe { w.inmsel().bits(*self as u8) });
}
}
)+};
Expand All @@ -294,7 +294,7 @@ macro_rules! dac_input_helper {
}

fn setup(&self, comp: &$COMP) {
comp.csr().modify(|_, w| unsafe { w.inmsel().bits($bits) })
comp.csr().modify(|_, w| unsafe { w.inmsel().bits($bits) });
}
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/exti.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ impl ExtiExt for EXTI {
line => self
.imr2()
.modify(|r, w| unsafe { w.bits(r.bits() | 1 << (line - 32)) }),
}
};
}

fn unlisten(&self, ev: Event) {
Expand All @@ -133,7 +133,7 @@ impl ExtiExt for EXTI {
line => {
let mask = !(1 << (line - 32));
self.imr2()
.modify(|r, w| unsafe { w.bits(r.bits() & mask) })
.modify(|r, w| unsafe { w.bits(r.bits() & mask) });
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ macro_rules! gpio {
unsafe {
(*$GPIOX::ptr()).ospeedr().modify(|r, w| {
w.bits((r.bits() & !(0b11 << offset)) | ((speed as u32) << offset))
})
});
}
self
}
Expand Down
2 changes: 1 addition & 1 deletion src/pwm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1259,7 +1259,7 @@ macro_rules! tim_hal {
2 => tim.cr1().modify(|_, w| unsafe { w.ckd().bits(1) }),
4 => tim.cr1().modify(|_, w| unsafe { w.ckd().bits(2) }),
_ => panic!("Should be unreachable, invalid deadtime prescaler"),
}
};

let bkp = match self.fault_polarity {
Polarity::ActiveLow => false,
Expand Down
2 changes: 1 addition & 1 deletion src/rcc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ impl Rcc {
unsafe {
// Adjust flash wait states
let flash = &(*FLASH::ptr());
flash.acr().modify(|_, w| w.latency().bits(latency))
flash.acr().modify(|_, w| w.latency().bits(latency));
}
}

Expand Down
16 changes: 8 additions & 8 deletions src/serial/usart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,8 @@ macro_rules! uart_lp {
Event::Rxne => self.tx.usart.cr1().modify(|_, w| w.rxneie().set_bit()),
Event::Txe => self.tx.usart.cr1().modify(|_, w| w.txeie().set_bit()),
Event::Idle => self.tx.usart.cr1().modify(|_, w| w.idleie().set_bit()),
_ => {}
}
_ => unimplemented!(),
};
}

/// Stop listening for an interrupt event
Expand All @@ -539,8 +539,8 @@ macro_rules! uart_lp {
Event::Rxne => self.tx.usart.cr1().modify(|_, w| w.rxneie().clear_bit()),
Event::Txe => self.tx.usart.cr1().modify(|_, w| w.txeie().clear_bit()),
Event::Idle => self.tx.usart.cr1().modify(|_, w| w.idleie().clear_bit()),
_ => {}
}
_ => unimplemented!(),
};
}

/// Check if interrupt event is pending
Expand Down Expand Up @@ -683,8 +683,8 @@ macro_rules! uart_full {
Event::Rxne => self.tx.usart.cr1().modify(|_, w| w.rxneie().set_bit()),
Event::Txe => self.tx.usart.cr1().modify(|_, w| w.txeie().set_bit()),
Event::Idle => self.tx.usart.cr1().modify(|_, w| w.idleie().set_bit()),
_ => {}
}
_ => unimplemented!(),
};
}

/// Stop listening for an interrupt event
Expand All @@ -693,8 +693,8 @@ macro_rules! uart_full {
Event::Rxne => self.tx.usart.cr1().modify(|_, w| w.rxneie().clear_bit()),
Event::Txe => self.tx.usart.cr1().modify(|_, w| w.txeie().clear_bit()),
Event::Idle => self.tx.usart.cr1().modify(|_, w| w.idleie().clear_bit()),
_ => {}
}
_ => unimplemented!(),
};
}

/// Check if interrupt event is pending
Expand Down

0 comments on commit 369754d

Please sign in to comment.