-
Notifications
You must be signed in to change notification settings - Fork 182
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
Added all timers for all variants as described by CubeMX #133
Conversation
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.
LGTM, thanks !
ce95872
to
ee1729e
Compare
I left the piddling little rustfmt changes from random files out but added the pwm_input formatting fix back in as a separate commit because it took me half an hour to tweak the indentation and I feel like it's worth keeping ;) |
ee1729e
to
ece00ba
Compare
a946265
to
7b0ffc6
Compare
Rebased latest changes from master. Is there anything else I need to address to get this merged? I'm going to have a go at implementing the various PWM input & output features for the advanced timers and want to make sure that PR is easy to merge too. Thanks |
TIM8: (tim8, pclk2_tim, dbg_tim8_stop), | ||
} | ||
|
||
//TODO: restore these timers once stm32-rs has been updated |
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.
stm32-rs
0.9 released and we now use it or you mean something other?
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.
That refers to the missing dbg_tim(9 to 14)_stop fields on dbgmcu. They haven't been implemented in stm32-rs yet.
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.
Apart from the #[allow(unused_unsafe)]
comment, this looks good to me
// 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)] |
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.
I think this error should have been fixed by the latest PAC release, could you check that?
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.
There are still instances of mixed safe & unsafe registers. Examples:
stm32f100::tim1::aar::AAR_W::bits is safe
stm32f100::tim6::aar::AAR_W::bits is unsafe
I think the original comment still stands for now.
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.
Depending on how many such warnings there are, I would prefer having the #[allow]
thing on the lines/functions where it happens. That way we don't miss actually useful warnings
Although, we could do that in a separate PR
I think it can be merged after conflicts to be resolved. |
7b0ffc6
to
ba2e15d
Compare
Updated with latest master. |
I've added all the timers according to the CubeMX database with the correct device & density flags.
The only one's I've had to comment out are 9, 10, 12, 13 and 14 on some devices because fields for these are missing from the underlying pac. The code is there to enable them when stm32-rs fixes up those SVDs.
This might be a minor breaking change as previously some of the devices had timers enabled that aren't actually available across the whole range - the fix is to add the appropriate density feature. I've added some info about this to the README so hopefully people will find this without a problem.
There's also some minor formatting stuff mostly from rustfmt in case you are wondering about the whitespace changes in pwm_input.
I should also draw your attention to the fact I added #![allow(unused_unsafe)] (with a comment) to lib.rs to hide the extremely numerous warnings that were coming up because some pac have safe fields incorrectly identified as unsafe. I think adding #![allow(unused_unsafe)] to the crate is fine and preffererable to it being harder to read the compiler output but I'm happy to be persuaded otherwise if you disagree.