Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed crate level allow(unused_unsafe) in favour of attributes on the specific instances #140

Merged
merged 1 commit into from
Nov 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,6 @@

#![no_std]

// Some pac crates have fields specified in such a way that they are safe and other
// have them unsafe (likely an SVD error that needs patching). Unsafe blocks for
// one device cause warnings for the safe devices. This disables that warning.
#![allow(unused_unsafe)]

// If no target specified, print error message.
#[cfg(not(any(feature = "stm32f100", feature = "stm32f101", feature = "stm32f103")))]
compile_error!("Target not found. A `--feature <target-name>` is required.");
Expand Down
3 changes: 3 additions & 0 deletions src/rtc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ impl Rtc {
// Set alarm time
// See section 18.3.5 for explanation
let alarm_value = counter_value - 1;

// TODO: Remove this `allow` once these fields are made safe for stm32f100
#[allow(unused_unsafe)]
self.perform_write(|s| {
s.regs.alrh.write(|w| unsafe{w.alrh().bits((alarm_value >> 16) as u16)});
s.regs.alrl.write(|w| unsafe{w.alrl().bits(alarm_value as u16)});
Expand Down
3 changes: 3 additions & 0 deletions src/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ macro_rules! hal {

let (psc, arr) = compute_arr_presc(timeout.into().0, self.clk.0);
self.tim.psc.write(|w| w.psc().bits(psc) );

// TODO: Remove this `allow` once this field is made safe for stm32f100
#[allow(unused_unsafe)]
self.tim.arr.write(|w| unsafe { w.arr().bits(arr) });

// Trigger an update event to load the prescaler value to the clock
Expand Down