Skip to content

Conversation

burrbull
Copy link
Member

Yet one change related to #186

@burrbull
Copy link
Member Author

@usbalbin Why InputPin was implemented on Output<PushPull> pin?
It should not.

@usbalbin
Copy link
Member

@usbalbin Why InputPin was implemented on Output<PushPull> pin? It should not.

Not sure. I guess it could make sense for an Output<OpenDrain> but not really for PushPull. Feel free to remove it

@burrbull
Copy link
Member Author

I already removed it. But you use it in tests.


impl<MODE> InputPin for $PXx<Output<MODE>> {
impl embedded_hal_old::digital::v2::InputPin for $PXx<Output<OpenDrain>> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already removed it. But you use it in tests.

Oh, but those could probably use https://github.com/stm32-rs/stm32g4xx-hal/blob/main/tests/nucleo-g474.rs#L368 ?

(I have a branch somewhere that breaks out the common test functions into examples/utils/mod.rs so as not to duplicate them between the test files. Will try to clean that up at some point)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, but those could probably use https://github.com/stm32-rs/stm32g4xx-hal/blob/main/tests/nucleo-g474.rs#L368 ?

On PushPull pin? I think no. You can use ODR to check is_set_high. But the only way (I think) to see real voltage on the pin is to connect it to another Input pin.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would interpret rm0440 9.3.10 as the input machinery still being active. But I may be missing something

9.3.10 Output configuration
When the I/O port is programmed as output:
• The output buffer is enabled:
– Open drain mode: A “0” in the Output register activates the N-MOS whereas a “1”
in the Output register leaves the port in Hi-Z (the P-MOS is never activated)
– Push-pull mode: A “0” in the Output register activates the N-MOS whereas a “1” in
the Output register activates the P-MOS
The Schmitt trigger input is activated

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still active in Alternate mode too. However not in Analog mode.

@usbalbin usbalbin added this pull request to the merge queue May 28, 2025
@usbalbin
Copy link
Member

Thanks! :)

Merged via the queue into stm32-rs:main with commit 64aa1ff May 28, 2025
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants