-
Notifications
You must be signed in to change notification settings - Fork 29
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
MultiConfigurePC not usable? #582
Comments
I've used the MultiConfigurePC object successfully on the ESP32-S2 (though it should work on others), I encountered the same limitation and modified the Esp32Gpio code to not use |
OK, I will look at Esp32Gpio and see if I can make a similar modification to LinuxGpio... I wonder: if all of the *Gpio implementations are eventually modified to not use GpioWrapper, what happens to GpioWrapper? -- I wonder if GpioWrapper's set_direction() is plain wrong -- eg why does it have the "restriction" against changing direction? |
I believe most of the Gpio implementations have already moved off GpioWrapper already. |
OK, so GpioWrapper is effectively depreciated? |
I can't say for certain on that, it is still used by a handful of target (STM32 being one). |
I think the question is if we add set_direction to GpioWrapper then what
happens when it is used on a platform whose GPIO class that does not have a
changeable direction?
If someone can put together the magic template arguments
(std::enable_if<...>) then we should be fine.
|
|
Ahh, I landed on a diff page that stated C++14. If we can craft the necessary magic we can certainly go that route. |
I have recoded LinuxGpio to not use GpioWrapper (using Esp32Gpio as a model), but I am getting a compile error: /include -I. -I/home/heller/RRCircuits/MegaIOOpenMRN --std=c++11 -MD -MF compile_cdi.d /home/heller/openmrn/src/openlcb/CompileCdiMain.cxx Code is pushed to my fork: https://github.com/RobertPHeller/openmrn/blob/LinuxGpio-no-GpioWrapper/src/os/LinuxGpio.hxx |
https://github.com/RobertPHeller/openmrn/blob/LinuxGpio-no-GpioWrapper/src/os/LinuxGpio.hxx#L93 declares the template type as "int". I'd suggest drop all usages of |
also it would be better to use |
OK, all fixed now, ready for a pull request once I test things. |
I think you mixed up the type of the template argument (PIN_NUM). Sometimes
it is int, sometimes it is unsigned int.
|
Yeah, a bit of a copy/paste snafu... |
Since the standard thing for Gpio * classes is to use the GpioWrapper class and since the GpioWrapper class does not allow changing direction, this means that one cannot have Gpio Lines that can be configured as input or output, this means that MultiConfigurePC cannot be used. Either it should be removed or GpioWrapper needs to be replaced or possibly something else.
Using the MultiConfigurePC config causes a run-time crash due to the HASSERTs in the set_direction() method of the GpioWrapper class.
The text was updated successfully, but these errors were encountered: