stm32-rs / stm32l0xx-hal

A hardware abstraction layer (HAL) for the STM32L0 series microcontrollers written in Rust
BSD Zero Clause License
96 stars 60 forks source link

PXi.downgrade() erases the port identifier as well #190

Closed blakesmith closed 3 years ago

blakesmith commented 3 years ago

PXi.downgrade() should erase the port identifier, allowing pins to be collected into an array. See full description here: https://github.com/stm32-rs/stm32l0xx-hal/issues/189.

Most of this is borrowed from stm32f0xx-hal.

Still waiting on my board to arrive, so I can fully test this during board bring-up, but wanted to get the code up early.

blakesmith commented 3 years ago

Thanks for taking a look @hannobraun! I'll dig into the CI and try to get that cleared up.

blakesmith commented 3 years ago

Alright. I was able to silence the warnings (that were already present) in this commit.

I also added an example blink_downgrade in this commit, that I was able to verify is working on a custom board that uses an STM32L053R8Tx:

cargo objcopy --release --features mcu-STM32L053R8Tx --example blinky_downgrade -- -O ihex blinky_downgrade.hex

@hannobraun Let me know what you think, and if CI is looking better now!

hannobraun commented 3 years ago

Thank you, @blakesmith. I just triggered another CI run, let's see what happens.

blakesmith commented 3 years ago

@hannobraun Thanks! Looks like we have some more example failures. I'll dig in more later tonight or early tomorrow morning (US time).

blakesmith commented 3 years ago

@hannobraun I updated the breaking examples in this commit, and ran the same command as CI to verfy:

cross build --release --examples --features rt,mcu-STM32L011D3Px

All the examples are now building for me locally. That commit pretty clearly shows how code in the field that tries to update to the latest stm32l0xx-hal version would need to be modified with a similar change, if it's using the existing port-specific downgraded pin types.

Let me know what you think!

blakesmith commented 3 years ago

Thanks @hannobraun!

So the only thing we are waiting for is for your hardware to arrive, so you can give it a quick test. Someone else jumping in and testing would be fine too, of course.

I actually was able to use my revision 1 prototype board that has a STM32L053R8Tx on it to verify things work using the new blinky_downgrade example I added.

Built using:

cargo objcopy --release --features mcu-STM32L053R8Tx --example blinky_downgrade -- -O ihex blinky_downgrade.hex

Happy to do some more testing / verification with my board where you think it's warranted!

hannobraun commented 3 years ago

Thank you for the latest changes, @blakesmith!

Happy to do some more testing / verification with my board where you think it's warranted!

I think this is good enough, thanks!

blakesmith commented 3 years ago

Thank you @hannobraun for the review, and help with everything. Appreciate your effort on this board crate, it's much appreciated!