forked from chrysn/efm32gg-hal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
328 additions
and
283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
#[macro_export] | ||
macro_rules! timerchannel_pin { | ||
($TimerN: ident, $ChannelX: ident, $Pin: ident, $locI: ident, $ccXloc: ident, $ccXpen: ident) => { | ||
impl super::HasLocForFunction<$TimerN, $ChannelX> | ||
for crate::gpio::pins::$Pin<crate::gpio::Output> | ||
{ | ||
unsafe fn configure() { | ||
// FIXME https://github.com/chrysn/efm32gg-hal/issues/1 | ||
let reg = &mut *crate::timer::TimerChannel::<$TimerN, $ChannelX>::register(); | ||
cortex_m::interrupt::free(|_| { | ||
reg.routeloc0.modify(|_, w| w.$ccXloc().$locI()); | ||
reg.routepen.modify(|_, w| w.$ccXpen().set_bit()); | ||
}); | ||
} | ||
|
||
impl super::HasLocForFunction<$TimerN, $ChannelX> for crate::gpio::pins::$Pin<crate::gpio::Output> { | ||
unsafe fn configure() { | ||
// FIXME https://github.com/chrysn/efm32gg-hal/issues/1 | ||
let reg = &mut *crate::timer::TimerChannel::<$TimerN, $ChannelX>::register(); | ||
cortex_m::interrupt::free(|_| { | ||
reg.routeloc0.modify(|_, w| w.$ccXloc().$locI()); | ||
reg.routepen.modify(|_, w| w.$ccXpen().set_bit()); | ||
}); | ||
} | ||
|
||
unsafe fn deconfigure() { | ||
// FIXME https://github.com/chrysn/efm32gg-hal/issues/1 | ||
let reg = &mut *crate::timer::TimerChannel::<$TimerN, $ChannelX>::register(); | ||
cortex_m::interrupt::free(|_| { | ||
reg.routepen.modify(|_, w| w.$ccXpen().clear_bit()); | ||
}); | ||
} | ||
} | ||
|
||
} | ||
unsafe fn deconfigure() { | ||
// FIXME https://github.com/chrysn/efm32gg-hal/issues/1 | ||
let reg = &mut *crate::timer::TimerChannel::<$TimerN, $ChannelX>::register(); | ||
cortex_m::interrupt::free(|_| { | ||
reg.routepen.modify(|_, w| w.$ccXpen().clear_bit()); | ||
}); | ||
} | ||
} | ||
}; | ||
} | ||
|
||
pub(crate) use timerchannel_pin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,32 @@ | ||
#[macro_export] | ||
macro_rules! timerperipheral_pin { | ||
($TimerN: ident, $ChannelX: ident, $Pin: ident, $is_locI: ident, $ccXpen: ident) => { | ||
impl super::HasLocForFunction<$TimerN, $ChannelX> | ||
for crate::gpio::pins::$Pin<crate::gpio::Output> | ||
{ | ||
unsafe fn configure() { | ||
// This is safe because it's read-only access | ||
let reg = &mut *crate::timer::TimerChannel::<$TimerN, $ChannelX>::register(); | ||
assert!( | ||
reg.route.read().location().$is_locI(), | ||
"Pin was not adaequately pre-routed" | ||
); | ||
|
||
impl super::HasLocForFunction<$TimerN, $ChannelX> for crate::gpio::pins::$Pin<crate::gpio::Output> { | ||
unsafe fn configure() { | ||
// This is safe because it's read-only access | ||
let reg = &mut *crate::timer::TimerChannel::<$TimerN, $ChannelX>::register(); | ||
assert!(reg.route.read().location().$is_locI(), "Pin was not adaequately pre-routed"); | ||
// FIXME https://github.com/chrysn/efm32gg-hal/issues/1 | ||
cortex_m::interrupt::free(|_| { | ||
reg.route.modify(|_, w| w.$ccXpen().set_bit()); | ||
}); | ||
} | ||
|
||
// FIXME https://github.com/chrysn/efm32gg-hal/issues/1 | ||
cortex_m::interrupt::free(|_| { | ||
reg.route.modify(|_, w| w.$ccXpen().set_bit()); | ||
}); | ||
} | ||
|
||
unsafe fn deconfigure() { | ||
// FIXME https://github.com/chrysn/efm32gg-hal/issues/1 | ||
let reg = &mut *crate::timer::TimerChannel::<$TimerN, $ChannelX>::register(); | ||
cortex_m::interrupt::free(|_| { | ||
reg.route.modify(|_, w| w.$ccXpen().clear_bit()); | ||
}); | ||
} | ||
} | ||
|
||
} | ||
unsafe fn deconfigure() { | ||
// FIXME https://github.com/chrysn/efm32gg-hal/issues/1 | ||
let reg = &mut *crate::timer::TimerChannel::<$TimerN, $ChannelX>::register(); | ||
cortex_m::interrupt::free(|_| { | ||
reg.route.modify(|_, w| w.$ccXpen().clear_bit()); | ||
}); | ||
} | ||
} | ||
}; | ||
} | ||
|
||
pub(crate) use timerperipheral_pin; |
Oops, something went wrong.