esp-hal icon indicating copy to clipboard operation
esp-hal copied to clipboard

Remove `EspWifiInitFor` & more granular init/deinit per driver

Open MabezDev opened this issue 1 year ago • 1 comments
trafficstars

Thank you for your contribution!

We appreciate the time and effort you've put into this pull request. To help us review it efficiently, please ensure you've gone through the following checklist:

Submission Checklist 📝

  • [ ] I have updated existing examples or added new ones (if applicable).
  • [x] I have used cargo xtask fmt-packages command to ensure that all changed code is formatted correctly.
  • [ ] My changes were added to the CHANGELOG.md in the proper section.
  • [ ] I have added necessary changes to user code to the Migration Guide.
  • [x] My changes are in accordance to the esp-rs API guidelines

Extra:

Pull Request Details 📖

Description

  • Rework EspWifiInit to EspWifiController - bikeshedding welcome
  • No longer require EspWifiInitFor on initialize
  • Add Drop impls for each driver, and add Drop for EspWifiController to fully deinit the stack
  • deinit no longer returns the used resources, instead the peripheral ref pattern will take care of this

I haven't updated all the examples yet, I'll do so after a bit of review.

Testing

Try this modified wifi_dhcp example: https://gist.github.com/MabezDev/78aac5133c482a56db9600697c179650

MabezDev avatar Oct 08 '24 10:10 MabezDev