Add unsafe blocks around write_with_zero calls (#68)

The newer version of svd2rust used in the PAC marks write_with_zero calls as unsafe, where the old one did not.
This PR wraps the only 2 calls instances of this in the HAL with unsafe blocks to fix the compile errors.
This commit is contained in:
9names 2021-07-27 09:31:19 +10:00 committed by GitHub
parent 4970075974
commit 512172179a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -27,7 +27,9 @@ macro_rules! clocks {
/// Exchanges CLOCKS block against Self. /// Exchanges CLOCKS block against Self.
pub fn new(mut clocks_block: CLOCKS) -> Self { pub fn new(mut clocks_block: CLOCKS) -> Self {
// Disable resus that may be enabled from previous software // Disable resus that may be enabled from previous software
clocks_block.clk_sys_resus_ctrl.write_with_zero(|w| w); unsafe {
clocks_block.clk_sys_resus_ctrl.write_with_zero(|w| w);
}
let shared_clocks = ShareableClocks::new(&mut clocks_block); let shared_clocks = ShareableClocks::new(&mut clocks_block);
ClocksManager { ClocksManager {

View file

@ -93,7 +93,9 @@ impl $PXi {
pad.gpio[self.pin].write(|w| w.ie().set_bit()); pad.gpio[self.pin].write(|w| w.ie().set_bit());
pad.gpio[self.pin].write(|w| w.od().clear_bit()); pad.gpio[self.pin].write(|w| w.od().clear_bit());
io.gpio[self.pin].gpio_ctrl.write_with_zero(|w| w.funcsel().pwm_a_0()); unsafe {
io.gpio[self.pin].gpio_ctrl.write_with_zero(|w| w.funcsel().pwm_a_0());
}
} }
fn cc(&self) -> &pac::$pwmx::ch::CC { fn cc(&self) -> &pac::$pwmx::ch::CC {