-
Notifications
You must be signed in to change notification settings - Fork 594
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
Make System.Device.Gpio work on Mono #1095
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome thanks for fixing and for checking with the Mono team about the right fix. I assume we tested this suggestion they gave and it worked right?
@joperezr yes, I've tried if calling SpiDevice.Create/I2cDevice.Create/new GpioGontroller/PwmChannel.Create doesn't cause any TypeLoadException. |
Thanks a lot @krwq for fixing the issue! This new version works like a charm with mono on my Raspberry Pi Zero. |
I still have problems with System.Device.Gpio on mono (running on my Raspberry Pi Zero). hope you can help :) |
@R10Rasmus, just a stupid question: are you running a .NET Framework 4.8 application on the Pi Zero? .NET Core application are not supported. |
@Ellerbach I did run a .Net Core version. I is now convert to an .NET Framework 4.8 application, but I get the same issue. mono diode.exe Unhandled Exception: |
@R10Rasmus , try from https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json one of the latest version like 1.1.0-prerelease.20276.1 |
@Ellerbach I use version 1.1.0-prerelease.20153.1. If I try to install 1.1.0-prerelease.20276.1 from https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json I gen an dependency error: Attempting to gather dependency information for package 'System.Device.Gpio.1.1.0-prerelease.20276.1' with respect to project 'C:\Users\rasmu\source\repos\pi\diod', targeting 'Any,Version=v0.0'
I still get this error, if I install System.Memory from nuget.org :( |
@Ellerbach I got it to work :) |
Great! Yes, libgpiod-dev is needed in the Pi Zero. I have a service running for the last few weeks like a charm. Few things to keep in mind: you you want to manage gpio pin state changes, it's not working the best. If you have only 1 thread, then the events are coming in. If you start to have a large app with a lot of thread, then for some reason, you'll stop getting the events. So in this case, just do a thread dedicated to the pin change. |
Fixes #1089
Use workaround provided by Mono for the type loading issue.
cc: @Ellerbach