You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It should be now possible to implement dynamic pin allocation on the zephyr RTOS port, here are my thoughts/plans about it:
First off, any platform will require 2 things: the peripherals having the deinit capability in their drivers, and secondly, awareness on the micropython side of the pin capabilities at the platform level, so beyond just the zephyr API.
in the case of bflb for example, this could mean reading the yaml files that contain the pin capabilities and generate all the bindings. Alternatively, there can be dedicated code for each platform (platform group?) that is aware of the platform specific pinctrl_soc_pin_t struct and generates the binding dynamically from the pin capability data. Both solutions require some amount platform-specific awareness on the side of micropython.
On actual implementation, i think it could take the pin list like regular ports, I2C(sda=2, scl=3) for example, then have the code deinit/check deinited the peripheral, parse through the possible assignement, and if valid apply the pinctrl setting via https://docs.zephyrproject.org/apidoc/latest/group__pinctrl__interface__dynamic.html, and then re-initialize the peripheral.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
It should be now possible to implement dynamic pin allocation on the zephyr RTOS port, here are my thoughts/plans about it:
First off, any platform will require 2 things: the peripherals having the deinit capability in their drivers, and secondly, awareness on the micropython side of the pin capabilities at the platform level, so beyond just the zephyr API.
in the case of bflb for example, this could mean reading the yaml files that contain the pin capabilities and generate all the bindings. Alternatively, there can be dedicated code for each platform (platform group?) that is aware of the platform specific pinctrl_soc_pin_t struct and generates the binding dynamically from the pin capability data. Both solutions require some amount platform-specific awareness on the side of micropython.
On actual implementation, i think it could take the pin list like regular ports, I2C(sda=2, scl=3) for example, then have the code deinit/check deinited the peripheral, parse through the possible assignement, and if valid apply the pinctrl setting via https://docs.zephyrproject.org/apidoc/latest/group__pinctrl__interface__dynamic.html, and then re-initialize the peripheral.
Beta Was this translation helpful? Give feedback.
All reactions