Closed neil-benn closed 2 years ago
Hi Neil, this would be a great feature enhancement. In the short term I could very easily extend the low-level API here to allow this. At the moment it only supports setting to digital input / output and PWM. It would be trivial to extend this class to add a method that allows any mode to be set on the assumption that the caller is responsible for specifying a valid mode.
Something like:
public void setMode(int gpio, int mode);
To invoke, you would need to get the MmapGpioInterface
from the BoardInfo
instance via the createMmapGpio
operation. There is an example here: https://github.com/mattjlewis/diozero/blob/main/diozero-sampleapps/src/main/java/com/diozero/sampleapps/perf/MmapGpioPerfTest.java#L60
Hello,
Thanks; I'll take a look at it - struggling with trying to get a dd equivalent working on win 1- at the moment. It used to work but now brings down PowerShell - grr!!
Cheers,
Neil
--
Neil Benn MSc Ziath Ltd Phone: +44 (0) 1223 855021 http://www.ziath.comhttp://www.ziath.com/
Please consider the environment before printing this email.
Follow us on Facebookhttp://www.facebook.com/ziathltd, Twitterhttp://www.twitter.com/ziath_ltd or LinkedInhttp://www.linkedin.com/company/ziath-ltd
IMPORTANT NOTICE: This message, including any attached documents, is intended only for the use of the individual or entity to which it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify Ziath Ltd immediately by email at @.**@.>. Thank you.
From: Matthew Lewis @.> Sent: 10 March 2022 14:39 To: mattjlewis/diozero @.> Cc: Neil Benn @.>; Author @.> Subject: Re: [mattjlewis/diozero] Alt Fucntion on GPIO (Issue #90)
Hi Neil, this would be a great feature enhancement. In the short term I could very easily extend the low-level API herehttps://github.com/mattjlewis/diozero/blob/main/diozero-core/src/main/java/com/diozero/internal/board/raspberrypi/RaspberryPiMmapGpio.java#L231 to allow this. At the moment it only supports setting to digital input / output and PWM. It would be trivial to extend this class to add a method that allows any mode to be set on the assumption that the caller is responsible for specifying a valid mode.
Something like: public void setMode(int gpio, int mode);
To invoke, you would need to get the MmapGpioInterface from the BoardInfo instance via the createMmapGpio operation. There is an example here: https://github.com/mattjlewis/diozero/blob/main/diozero-sampleapps/src/main/java/com/diozero/sampleapps/perf/MmapGpioPerfTest.java#L60
— Reply to this email directly, view it on GitHubhttps://github.com/mattjlewis/diozero/issues/90#issuecomment-1064133223, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADY2NXSTC2S3W6VQNVSKE23U7ICRTANCNFSM5QML2N5A. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.Message ID: @.***>
Taking another look at this and I can see that getMode is actually fairly comprehensive. It should just be a matter of doing the equivalent in the setMode method.
Feature added to 1.3.4
Great thanks - I'll wrap this into our app code and update to test. It'll be a few weeks as I'm off for a couple of weeks.
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: Matthew Lewis @.> Sent: Wednesday, August 17, 2022 8:38:44 PM To: mattjlewis/diozero @.> Cc: Neil Benn @.>; Author @.> Subject: Re: [mattjlewis/diozero] Alt Fucntion on GPIO (Issue #90)
Feature added to 1.3.4
— Reply to this email directly, view it on GitHubhttps://github.com/mattjlewis/diozero/issues/90#issuecomment-1218415878, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADY2NXXTOSTQISZM2KLAX53VZU5UJANCNFSM5QML2N5A. You are receiving this because you authored the thread.Message ID: @.***>
Hello,
Is there a way to set the alt function of a gpio from within diozero? I'm trying to keep within diozero as much as possible without resorting to calling system functions.
Cheers,
Neil