mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 06:42:32 +00:00
rename pins data type and the macro
This commit is contained in:
parent
d35572c11f
commit
7c36e8dbc7
@ -129,7 +129,7 @@ impl<'d, T: Slice> Pwm<'d, T> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn new_output_a(
|
pub fn new_output_a(
|
||||||
inner: impl Peripheral<P = T> + 'd,
|
inner: impl Peripheral<P = T> + 'd,
|
||||||
a: impl Peripheral<P = impl PwmChannelA<T>> + 'd,
|
a: impl Peripheral<P = impl ChannelAPin<T>> + 'd,
|
||||||
config: Config,
|
config: Config,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
into_ref!(a);
|
into_ref!(a);
|
||||||
@ -140,7 +140,7 @@ impl<'d, T: Slice> Pwm<'d, T> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn new_output_b(
|
pub fn new_output_b(
|
||||||
inner: impl Peripheral<P = T> + 'd,
|
inner: impl Peripheral<P = T> + 'd,
|
||||||
b: impl Peripheral<P = impl PwmChannelB<T>> + 'd,
|
b: impl Peripheral<P = impl ChannelBPin<T>> + 'd,
|
||||||
config: Config,
|
config: Config,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
into_ref!(b);
|
into_ref!(b);
|
||||||
@ -151,8 +151,8 @@ impl<'d, T: Slice> Pwm<'d, T> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn new_output_ab(
|
pub fn new_output_ab(
|
||||||
inner: impl Peripheral<P = T> + 'd,
|
inner: impl Peripheral<P = T> + 'd,
|
||||||
a: impl Peripheral<P = impl PwmChannelA<T>> + 'd,
|
a: impl Peripheral<P = impl ChannelAPin<T>> + 'd,
|
||||||
b: impl Peripheral<P = impl PwmChannelB<T>> + 'd,
|
b: impl Peripheral<P = impl ChannelBPin<T>> + 'd,
|
||||||
config: Config,
|
config: Config,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
into_ref!(a, b);
|
into_ref!(a, b);
|
||||||
@ -163,7 +163,7 @@ impl<'d, T: Slice> Pwm<'d, T> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn new_input(
|
pub fn new_input(
|
||||||
inner: impl Peripheral<P = T> + 'd,
|
inner: impl Peripheral<P = T> + 'd,
|
||||||
b: impl Peripheral<P = impl PwmChannelB<T>> + 'd,
|
b: impl Peripheral<P = impl ChannelBPin<T>> + 'd,
|
||||||
mode: InputMode,
|
mode: InputMode,
|
||||||
config: Config,
|
config: Config,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
@ -175,8 +175,8 @@ impl<'d, T: Slice> Pwm<'d, T> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn new_output_input(
|
pub fn new_output_input(
|
||||||
inner: impl Peripheral<P = T> + 'd,
|
inner: impl Peripheral<P = T> + 'd,
|
||||||
a: impl Peripheral<P = impl PwmChannelA<T>> + 'd,
|
a: impl Peripheral<P = impl ChannelAPin<T>> + 'd,
|
||||||
b: impl Peripheral<P = impl PwmChannelB<T>> + 'd,
|
b: impl Peripheral<P = impl ChannelBPin<T>> + 'd,
|
||||||
mode: InputMode,
|
mode: InputMode,
|
||||||
config: Config,
|
config: Config,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
@ -336,43 +336,43 @@ slice!(PWM_SLICE6, 6);
|
|||||||
slice!(PWM_SLICE7, 7);
|
slice!(PWM_SLICE7, 7);
|
||||||
|
|
||||||
/// PWM Channel A.
|
/// PWM Channel A.
|
||||||
pub trait PwmChannelA<T: Slice>: GpioPin {}
|
pub trait ChannelAPin<T: Slice>: GpioPin {}
|
||||||
/// PWM Channel B.
|
/// PWM Channel B.
|
||||||
pub trait PwmChannelB<T: Slice>: GpioPin {}
|
pub trait ChannelBPin<T: Slice>: GpioPin {}
|
||||||
|
|
||||||
macro_rules! impl_channel {
|
macro_rules! impl_pin {
|
||||||
($pin:ident, $channel:ident, $kind:ident) => {
|
($pin:ident, $channel:ident, $kind:ident) => {
|
||||||
impl $kind<peripherals::$channel> for peripherals::$pin {}
|
impl $kind<peripherals::$channel> for peripherals::$pin {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_channel!(PIN_0, PWM_SLICE0, PwmChannelA);
|
impl_pin!(PIN_0, PWM_SLICE0, ChannelAPin);
|
||||||
impl_channel!(PIN_1, PWM_SLICE0, PwmChannelB);
|
impl_pin!(PIN_1, PWM_SLICE0, ChannelBPin);
|
||||||
impl_channel!(PIN_2, PWM_SLICE1, PwmChannelA);
|
impl_pin!(PIN_2, PWM_SLICE1, ChannelAPin);
|
||||||
impl_channel!(PIN_3, PWM_SLICE1, PwmChannelB);
|
impl_pin!(PIN_3, PWM_SLICE1, ChannelBPin);
|
||||||
impl_channel!(PIN_4, PWM_SLICE2, PwmChannelA);
|
impl_pin!(PIN_4, PWM_SLICE2, ChannelAPin);
|
||||||
impl_channel!(PIN_5, PWM_SLICE2, PwmChannelB);
|
impl_pin!(PIN_5, PWM_SLICE2, ChannelBPin);
|
||||||
impl_channel!(PIN_6, PWM_SLICE3, PwmChannelA);
|
impl_pin!(PIN_6, PWM_SLICE3, ChannelAPin);
|
||||||
impl_channel!(PIN_7, PWM_SLICE3, PwmChannelB);
|
impl_pin!(PIN_7, PWM_SLICE3, ChannelBPin);
|
||||||
impl_channel!(PIN_8, PWM_SLICE4, PwmChannelA);
|
impl_pin!(PIN_8, PWM_SLICE4, ChannelAPin);
|
||||||
impl_channel!(PIN_9, PWM_SLICE4, PwmChannelB);
|
impl_pin!(PIN_9, PWM_SLICE4, ChannelBPin);
|
||||||
impl_channel!(PIN_10, PWM_SLICE5, PwmChannelA);
|
impl_pin!(PIN_10, PWM_SLICE5, ChannelAPin);
|
||||||
impl_channel!(PIN_11, PWM_SLICE5, PwmChannelB);
|
impl_pin!(PIN_11, PWM_SLICE5, ChannelBPin);
|
||||||
impl_channel!(PIN_12, PWM_SLICE6, PwmChannelA);
|
impl_pin!(PIN_12, PWM_SLICE6, ChannelAPin);
|
||||||
impl_channel!(PIN_13, PWM_SLICE6, PwmChannelB);
|
impl_pin!(PIN_13, PWM_SLICE6, ChannelBPin);
|
||||||
impl_channel!(PIN_14, PWM_SLICE7, PwmChannelA);
|
impl_pin!(PIN_14, PWM_SLICE7, ChannelAPin);
|
||||||
impl_channel!(PIN_15, PWM_SLICE7, PwmChannelB);
|
impl_pin!(PIN_15, PWM_SLICE7, ChannelBPin);
|
||||||
impl_channel!(PIN_16, PWM_SLICE0, PwmChannelA);
|
impl_pin!(PIN_16, PWM_SLICE0, ChannelAPin);
|
||||||
impl_channel!(PIN_17, PWM_SLICE0, PwmChannelB);
|
impl_pin!(PIN_17, PWM_SLICE0, ChannelBPin);
|
||||||
impl_channel!(PIN_18, PWM_SLICE1, PwmChannelA);
|
impl_pin!(PIN_18, PWM_SLICE1, ChannelAPin);
|
||||||
impl_channel!(PIN_19, PWM_SLICE1, PwmChannelB);
|
impl_pin!(PIN_19, PWM_SLICE1, ChannelBPin);
|
||||||
impl_channel!(PIN_20, PWM_SLICE2, PwmChannelA);
|
impl_pin!(PIN_20, PWM_SLICE2, ChannelAPin);
|
||||||
impl_channel!(PIN_21, PWM_SLICE2, PwmChannelB);
|
impl_pin!(PIN_21, PWM_SLICE2, ChannelBPin);
|
||||||
impl_channel!(PIN_22, PWM_SLICE3, PwmChannelA);
|
impl_pin!(PIN_22, PWM_SLICE3, ChannelAPin);
|
||||||
impl_channel!(PIN_23, PWM_SLICE3, PwmChannelB);
|
impl_pin!(PIN_23, PWM_SLICE3, ChannelBPin);
|
||||||
impl_channel!(PIN_24, PWM_SLICE4, PwmChannelA);
|
impl_pin!(PIN_24, PWM_SLICE4, ChannelAPin);
|
||||||
impl_channel!(PIN_25, PWM_SLICE4, PwmChannelB);
|
impl_pin!(PIN_25, PWM_SLICE4, ChannelBPin);
|
||||||
impl_channel!(PIN_26, PWM_SLICE5, PwmChannelA);
|
impl_pin!(PIN_26, PWM_SLICE5, ChannelAPin);
|
||||||
impl_channel!(PIN_27, PWM_SLICE5, PwmChannelB);
|
impl_pin!(PIN_27, PWM_SLICE5, ChannelBPin);
|
||||||
impl_channel!(PIN_28, PWM_SLICE6, PwmChannelA);
|
impl_pin!(PIN_28, PWM_SLICE6, ChannelAPin);
|
||||||
impl_channel!(PIN_29, PWM_SLICE6, PwmChannelB);
|
impl_pin!(PIN_29, PWM_SLICE6, ChannelBPin);
|
||||||
|
Loading…
Reference in New Issue
Block a user