Skip to content

Commit c45373c

Browse files
committed
Clean up
1 parent d230335 commit c45373c

File tree

7 files changed

+1
-18
lines changed

7 files changed

+1
-18
lines changed

src/crc.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ impl Crc {
3737

3838
// manual says unit must be reset (or DR read) before change of polynomial
3939
// (technically only in case of ongoing calculation, but DR is buffered)
40-
//NOTE(unsafe) Only valid bit patterns are written
4140
self.reg.cr().modify(|_, w| {
4241
w.polysize()
4342
.set(config.poly.polysize())
@@ -124,7 +123,6 @@ impl Crc {
124123
///
125124
/// The IDR is not involved with CRC calculation.
126125
pub fn set_idr(&mut self, value: u32) {
127-
//NOTE(unsafe) All bit patterns are valid
128126
self.reg.idr().write(|w| w.idr().set(value));
129127
}
130128

src/dma/bdma.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,6 @@ where
353353
#[inline(always)]
354354
fn set_priority(&mut self, priority: config::Priority) {
355355
//NOTE(unsafe) We only access the registers that belongs to the StreamX
356-
//NOTE(unsafe) We only write valid bit patterns
357356
unsafe {
358357
Self::stream()
359358
.cr()
@@ -464,7 +463,6 @@ where
464463
#[inline(always)]
465464
fn set_number_of_transfers(&mut self, value: u16) {
466465
//NOTE(unsafe) We only access the registers that belongs to the StreamX
467-
//NOTE(unsafe) All bit patterns are valid for ndt
468466
unsafe {
469467
Self::stream().ndtr().write(|w| w.ndt().set(value));
470468
}

src/dma/dma.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,6 @@ impl<I: Instance, const S: u8> StreamX<I, S> {
352352
#[inline(always)]
353353
fn set_fifo_threshold(&mut self, fifo_threshold: config::FifoThreshold) {
354354
//NOTE(unsafe) We only access the registers that belongs to the StreamX
355-
//NOTE(unsafe) We only write valid bit patterns
356355
unsafe {
357356
Self::stream()
358357
.fcr()
@@ -372,7 +371,6 @@ impl<I: Instance, const S: u8> StreamX<I, S> {
372371
#[inline(always)]
373372
fn set_memory_burst(&mut self, memory_burst: config::BurstMode) {
374373
//NOTE(unsafe) We only access the registers that belongs to the StreamX
375-
//NOTE(unsafe) We only write valid bit patterns
376374
unsafe {
377375
Self::stream()
378376
.cr()
@@ -383,7 +381,6 @@ impl<I: Instance, const S: u8> StreamX<I, S> {
383381
#[inline(always)]
384382
fn set_peripheral_burst(&mut self, peripheral_burst: config::BurstMode) {
385383
//NOTE(unsafe) We only access the registers that belongs to the StreamX
386-
//NOTE(unsafe) We only write valid bit patterns
387384
unsafe {
388385
Self::stream()
389386
.cr()
@@ -514,7 +511,6 @@ where
514511
#[inline(always)]
515512
fn set_priority(&mut self, priority: config::Priority) {
516513
//NOTE(unsafe) We only access the registers that belongs to the StreamX
517-
//NOTE(unsafe) We only write valid bit patterns
518514
unsafe {
519515
Self::stream()
520516
.cr()
@@ -643,7 +639,6 @@ where
643639
#[inline(always)]
644640
fn set_number_of_transfers(&mut self, value: u16) {
645641
//NOTE(unsafe) We only access the registers that belongs to the StreamX
646-
//NOTE(unsafe) All bit pattern for ndt are valid
647642
unsafe {
648643
Self::stream().ndtr().write(|w| w.ndt().set(value));
649644
}

src/rcc/rec.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ use super::Rcc;
7676
use crate::stm32::{rcc, RCC};
7777
use cortex_m::interrupt;
7878

79-
//const X: stm32h7::stm32h743v::rcc::d1ccipr::FMCSEL = ();
80-
8179
/// A trait for Resetting, Enabling and Disabling a single peripheral
8280
pub trait ResetEnable {
8381
/// Enable this peripheral

src/rtc.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@ impl Rtc {
230230
"Invalid RTC prescaler value"
231231
);
232232

233-
//NOTE(unsafe) Only valid bit patterns are writte, values are checked above
234233
rtc.prer().write(|w| {
235234
w.prediv_s()
236235
.set(u16(s_pre - 1).unwrap())
@@ -259,7 +258,6 @@ impl Rtc {
259258
///
260259
/// Panics if `reg` is greater than 31.
261260
pub fn write_backup_reg(&mut self, reg: u8, value: u32) {
262-
//NOTE(unsafe) All bit patterns are valid
263261
self.reg.bkpr(reg as usize).write(|w| w.bkp().set(value));
264262
}
265263

@@ -286,7 +284,6 @@ impl Rtc {
286284
let st = second / 10;
287285
let su = second % 10;
288286

289-
//NOTE(unsafe) Only valid bit patterns are written
290287
self.reg.tr().write(|w| {
291288
w.pm()
292289
.clear_bit()

src/system_watchdog.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,7 @@ impl WatchdogEnable for SystemWindowWatchdog {
162162

163163
// write the config values, matching the set timeout the most
164164
self.wwdg.cfr().modify(|_, w| w.wdgtb().set(wdgtb));
165-
166165
self.wwdg.cfr().modify(|_, w| w.w().set(self.down_counter));
167-
168166
self.wwdg.cr().modify(|_, w| w.t().set(self.down_counter));
169167
// For some reason, setting the t value makes the early wakeup pending.
170168
// That's bad behaviour, so lets turn it off again.

src/timer.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl GetClk for LPTIM3 {
116116
// unsafe: read only
117117
let srdccipr = &unsafe { &*stm32::RCC::ptr() }.srdccipr();
118118

119-
match srdccipr.read().lptim3sel().set() {
119+
match srdccipr.read().lptim3sel().bits() {
120120
0 => Some(clocks.pclk4()),
121121
1 => clocks.pll2_p_ck(),
122122
2 => clocks.pll3_r_ck(),
@@ -452,7 +452,6 @@ macro_rules! hal {
452452
let div = self.clk / frequency.raw();
453453

454454
let psc = u16(div - 1).unwrap();
455-
//NOTE(unsafe) All bit patterns are valid
456455
self.tim.psc().write(|w| w.psc().set(psc));
457456

458457
let counter_max = u32(<$cntType>::MAX);

0 commit comments

Comments
 (0)