mirror of
https://github.com/italicsjenga/rp-hal-boards.git
synced 2024-12-24 05:01:31 +11:00
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:
parent
4970075974
commit
512172179a
|
@ -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
|
||||||
|
unsafe {
|
||||||
clocks_block.clk_sys_resus_ctrl.write_with_zero(|w| w);
|
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 {
|
||||||
|
|
|
@ -93,8 +93,10 @@ 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());
|
||||||
|
unsafe {
|
||||||
io.gpio[self.pin].gpio_ctrl.write_with_zero(|w| w.funcsel().pwm_a_0());
|
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 {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
Loading…
Reference in a new issue