-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I2s rework #490
I2s rework #490
Conversation
Possibly stm32f4xx-hal/src/gpio/convert.rs Line 271 in 7e50031
https://github.com/stm32-rs/stm32h7xx-hal/blob/master/examples/gpio_with_input.rs |
Unfortunatly, this is not a solution since it reconfigure the pin. The problem will come with I2s in duplex mode where the WS pin is shared between 2 i2s peripheral. If the first peripheral act as master, reconfiguring the pin will disconnect the WS signal from the WS pin, making it impossible to read. |
Then what you mean saying "read in generic way"? |
I mean i can use that property on a Pin passed as generic parameter. The easiest way would to implement a custom trait, but this may not necessary if this propetery can be implemented through a generic description of pins. More concretly, if you look i2s:: Pins trait, you will see i want to be able to read the WS pin. Since this trait is implemented for a generic set of pins, i need to add something on pins that can operate as WS pin. |
I tryed to progress by creating a WsPin trait and trying to implement on the concerned pins. Unfortunatly, i can't find a way to implement this trait for all concerned pins without manually implementing for each concerned pin. i wanted to reuse existent stuff by mixing generic and macro, but trying to replicate the implementation block for each SPI doesn't work, it produce a "conflicting implementation" of the trait |
DO you need to change WS pin mode from alternate to input for reading or NOT? |
Instead of using https://github.com/stm32-rs/stm32f4xx-hal/blob/i2s_rework/src/i2s.rs |
I need to read WS pin without changing it's physical mode. In the code, I do pointer castings for 2 purpose:
I tried an approach using a pin wrapper, it's seems simpler. |
Hi, now i have a working example. i still have to typestate the driver to avoid meaningless operation, and maybe re-implement i2s transfer to fix existing examples. What do you think of my hack around WsPin ? I fear it's a bit unclear |
Instead of new |
I didn't understood right away your suggestion. You suggest to create a new mode called |
Yes, I suggest to create new MODE + I suggest to reuse existent structure for this: Line 26 in 7e50031
|
This works, i needed to change visibility of gpio::marker to |
As Line 309 in 7e50031
|
Maybe it worth to do the same with |
I'm OK with this. |
@burrbull new version of stm32_v12x have been published. What things need to be done to finish this pull request ? should I synchronize this branch with master ? |
i resynchronized with master and updated CHANGELOG. I don't understand why there is a conflict |
LGTM. Except million commits. Could you squash them before merge? |
@burrbull Is that you wanted ? |
bors r+ |
Hi, I'm currently rewriting stm32_i2s crates, and i try to reflect my change and implement an example here in parallel for validation.
I'm currently stuck on a requirement i have. Using I2s in slave mode require to read a pin in alternate mode and in a generic way. I don't know how to implement that, so i will open an issue for that.