-
Couldn't load subscription status.
- Fork 108
resolve all warnings and clippy lints #298
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -158,12 +158,24 @@ impl RtcConfig { | |
| } | ||
|
|
||
| impl Rtc { | ||
| #[allow(clippy::self_named_constructors)] | ||
| #[deprecated = "use `new()` instead"] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is potentially controversial. Opinions? |
||
| pub fn rtc( | ||
| rtc: RTC, | ||
| apb1r1: &mut APB1R1, | ||
| bdcr: &mut BDCR, | ||
| pwrcr1: &mut pwr::CR1, | ||
| rtc_config: RtcConfig, | ||
| ) -> Self { | ||
| Self::new(rtc, apb1r1, bdcr, pwrcr1, rtc_config) | ||
| } | ||
|
|
||
| pub fn new( | ||
| rtc: RTC, | ||
| apb1r1: &mut APB1R1, | ||
| bdcr: &mut BDCR, | ||
| pwrcr1: &mut pwr::CR1, | ||
| rtc_config: RtcConfig, | ||
| ) -> Self { | ||
| // assert_eq!(clocks.lsi(), true); // make sure LSI is enabled | ||
| // enable peripheral clock for communication | ||
|
|
@@ -178,9 +190,6 @@ impl Rtc { | |
|
|
||
| /// Get date and time touple | ||
| pub fn get_date_time(&self) -> (Date, Time) { | ||
| let time; | ||
| let date; | ||
|
|
||
| let sync_p = self.rtc_config.sync_prescaler as u32; | ||
| let micros = | ||
| 1_000_000u32 / (sync_p + 1) * (sync_p - self.rtc.ssr.read().ss().bits() as u32); | ||
|
|
@@ -191,15 +200,15 @@ impl Rtc { | |
| // calendar shadow registers until RTC_DR is read. | ||
| let dater = self.rtc.dr.read(); | ||
|
|
||
| time = Time::new( | ||
| let time = Time::new( | ||
| (bcd2_to_byte((timer.ht().bits(), timer.hu().bits())) as u32).hours(), | ||
| (bcd2_to_byte((timer.mnt().bits(), timer.mnu().bits())) as u32).minutes(), | ||
| (bcd2_to_byte((timer.st().bits(), timer.su().bits())) as u32).secs(), | ||
| micros.micros(), | ||
| cr.bkp().bit(), | ||
| ); | ||
|
|
||
| date = Date::new( | ||
| let date = Date::new( | ||
| dater.wdu().bits().into(), | ||
| bcd2_to_byte((dater.dt().bits(), dater.du().bits())).into(), | ||
| bcd2_to_byte((dater.mt().bit() as u8, dater.mu().bits())).into(), | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was causing peripheral / register defines to raise clippy warnings. It was only in a single module IIRC, so could move this to only the scope of that module potentially?