Skip to content

Commit

Permalink
Try to make inference make everything just work
Browse files Browse the repository at this point in the history
  • Loading branch information
usbalbin committed Aug 25, 2024
1 parent f8b448c commit 8b96486
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion examples/comp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn main() -> ! {
.output_inverted(),
&rcc.clocks,
);
let led2 = gpioa.pa12.into_push_pull_output();
let led2 = gpioa.pa12.into_alternate();
// Configure PA12 to the comparator's alternate function so it gets
// changed directly by the comparator.
comp2.output_pin(led2);
Expand Down
2 changes: 1 addition & 1 deletion examples/comp_w_dac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn main() -> ! {
&rcc.clocks,
);

let led2 = gpioa.pa0.into_push_pull_output();
let led2 = gpioa.pa0.into_alternate();
// Configure PA12 to the comparator's alternate function so it gets
// changed directly by the comparator.
comp.output_pin(led2);
Expand Down
32 changes: 16 additions & 16 deletions src/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,43 +353,43 @@ macro_rules! gpio {
}

#[allow(clippy::from_over_into)]
impl<F> Into<$PXi<Input<PullDown>, F>> for $PXi<DefaultMode> {
fn into(self) -> $PXi<Input<PullDown>, F> {
impl Into<$PXi<Input<PullDown>>> for $PXi<DefaultMode> {
fn into(self) -> $PXi<Input<PullDown>> {
self.into_pull_down_input()
}
}

#[allow(clippy::from_over_into)]
impl<F> Into<$PXi<Input<PullUp>, F>> for $PXi<DefaultMode> {
fn into(self) -> $PXi<Input<PullUp>, F> {
impl Into<$PXi<Input<PullUp>>> for $PXi<DefaultMode> {
fn into(self) -> $PXi<Input<PullUp>> {
self.into_pull_up_input()
}
}

#[allow(clippy::from_over_into)]
impl<F> Into<$PXi<Analog, F>> for $PXi<DefaultMode> {
fn into(self) -> $PXi<Analog, F> {
impl Into<$PXi<Analog>> for $PXi<DefaultMode> {
fn into(self) -> $PXi<Analog, IsNotFrozen> {
self.into_analog()
}
}

#[allow(clippy::from_over_into)]
impl<F> Into<$PXi<Output<OpenDrain>, F>> for $PXi<DefaultMode> {
fn into(self) -> $PXi<Output<OpenDrain>, F> {
impl Into<$PXi<Output<OpenDrain>>> for $PXi<DefaultMode> {
fn into(self) -> $PXi<Output<OpenDrain>> {
self.into_open_drain_output()
}
}

#[allow(clippy::from_over_into)]
impl<F> Into<$PXi<Output<PushPull>, F>> for $PXi<DefaultMode> {
fn into(self) -> $PXi<Output<PushPull>, F> {
impl Into<$PXi<Output<PushPull>>> for $PXi<DefaultMode> {
fn into(self) -> $PXi<Output<PushPull>> {
self.into_push_pull_output()
}
}

impl<MODE> $PXi<MODE, IsNotFrozen> {
/// Configures the pin to operate as a floating input pin
pub fn into_floating_input<F>(self) -> $PXi<Input<Floating>, F> {
pub fn into_floating_input(self) -> $PXi<Input<Floating>> {
let offset = 2 * $i;
unsafe {
let gpio = &(*$GPIOX::ptr());
Expand All @@ -404,7 +404,7 @@ macro_rules! gpio {
}

/// Configures the pin to operate as a pulled down input pin
pub fn into_pull_down_input<F>(self) -> $PXi<Input<PullDown>, F> {
pub fn into_pull_down_input(self) -> $PXi<Input<PullDown>> {
let offset = 2 * $i;
unsafe {
let gpio = &(*$GPIOX::ptr());
Expand All @@ -419,7 +419,7 @@ macro_rules! gpio {
}

/// Configures the pin to operate as a pulled up input pin
pub fn into_pull_up_input<F>(self) -> $PXi<Input<PullUp>, F> {
pub fn into_pull_up_input(self) -> $PXi<Input<PullUp>> {
let offset = 2 * $i;
unsafe {
let gpio = &(*$GPIOX::ptr());
Expand Down Expand Up @@ -449,7 +449,7 @@ macro_rules! gpio {
}

/// Configures the pin to operate as an open drain output pin
pub fn into_open_drain_output<F>(self) -> $PXi<Output<OpenDrain>, F> {
pub fn into_open_drain_output(self) -> $PXi<Output<OpenDrain>> {
let offset = 2 * $i;
unsafe {
let gpio = &(*$GPIOX::ptr());
Expand All @@ -467,7 +467,7 @@ macro_rules! gpio {
}

/// Configures the pin to operate as an push pull output pin
pub fn into_push_pull_output<F>(self) -> $PXi<Output<PushPull>, F> {
pub fn into_push_pull_output(self) -> $PXi<Output<PushPull>> {
let offset = 2 * $i;
unsafe {
let gpio = &(*$GPIOX::ptr());
Expand All @@ -485,7 +485,7 @@ macro_rules! gpio {
}

/// Configures the pin as external trigger
pub fn listen<F>(self, edge: SignalEdge, exti: &mut EXTI) -> $PXi<Input<PushPull>, F> {
pub fn listen(self, edge: SignalEdge, exti: &mut EXTI) -> $PXi<Input<PushPull>> {
let offset = 2 * $i;
unsafe {
let gpio = &(*$GPIOX::ptr());
Expand Down

0 comments on commit 8b96486

Please sign in to comment.