Refactor: Impl From for SampleTime and Resolution

This commit is contained in:
Grant Miller
2022-10-26 02:28:39 -05:00
parent 7b38b95e10
commit 2cfe2439c9
7 changed files with 30 additions and 39 deletions

View File

@ -9,10 +9,10 @@ macro_rules! impl_sample_time {
)*
}
impl SampleTime {
pub(crate) fn sample_time(&self) -> $pac {
match self {
$(Self::$variant => <$pac>::$pac_variant),*
impl From<SampleTime> for $pac {
fn from(sample_time: SampleTime) -> $pac {
match sample_time {
$(SampleTime::$variant => <$pac>::$pac_variant),*
}
}
}