gpiod | native Go library for accessing GPIO lines

 by   warthog618 Go Version: v0.8.1 License: MIT

kandi X-RAY | gpiod Summary

kandi X-RAY | gpiod Summary

gpiod is a Go library. gpiod has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

A native Go library for Linux GPIO. gpiod is a library for accessing GPIO pins/lines on Linux platforms using the GPIO character device. The goal of this library is to provide the Go equivalent of the C libgpiod library. The intent is not to mirror the libgpiod API but to provide the equivalent functionality. :warning: v0.6.0 introduces a few API breaking changes. Refer to the release notes if updating from an older version.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              gpiod has a low active ecosystem.
              It has 298 star(s) with 31 fork(s). There are 12 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 0 open issues and 30 have been closed. On average issues are closed in 23 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of gpiod is v0.8.1

            kandi-Quality Quality

              gpiod has 0 bugs and 0 code smells.

            kandi-Security Security

              gpiod has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              gpiod code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              gpiod is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              gpiod releases are not available. You will need to build from source code and install.
              Installation instructions, examples and code snippets are available.
              It has 13192 lines of code, 519 functions and 50 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of gpiod
            Get all kandi verified functions for this library.

            gpiod Key Features

            No Key Features are available at this moment for gpiod.

            gpiod Examples and Code Snippets

            No Code Snippets are available at this moment for gpiod.

            Community Discussions

            QUESTION

            STM32F4 Timers - Prescaler or period value must be divided by two to get what I expect
            Asked 2021-Oct-15 at 09:45

            I am working on STM32F4 and I noticed some strange behaviors with Timers.

            I need three timer : the first one must generate an interrupt every 1ms (I chose TIMER 1, an advanced control timer), the second one must generate an interrupt every 10ms (TIMER2, general purpose interrupt) and the third one must have its CNT counter incremented every 1µs (so interrupt is generated every 65.535 ms, as I am using TIMER 3 for this one and CNT is 16 bits).

            In order to compute PSC (prescaler) and ARR (period) values, I used this thread. So the formula I am using is (for a period in ms):

            ...

            ANSWER

            Answered 2021-Oct-15 at 09:45

            Timer1 is the advanced timer and timer2 & 3 are general purpose timer. Timer1 is from APB2 and timer 2,3 from APB1. You can check reference book or check your clock setting to see more details.

            Source https://stackoverflow.com/questions/69582650

            QUESTION

            (Raspbian + C# + Mono) Type initializer for 'System.Device.Gpio.Drivers.LibGpiodDriver' threw an exception
            Asked 2021-Sep-09 at 12:18

            I'm conducting a preliminary study for a new project. I've purchased a Raspberry Pi 3B and I'm trying to run a small program to check all our requisites:

            1. SQL Server connection.
            2. Save configuration files on disk.
            3. Configure and use some DI/DO in Raspberry GPIO.

            By now I've installed Mono libraries on it and I'm using Visual Studio 2019 in my windows machine to build a WinForms application.

            ...

            ANSWER

            Answered 2021-Aug-11 at 12:39

            WinForms is only designed to run on Windows. It may work with Mono, but you would probably want to compile it on a Windows machine. It seems that Mono is, as of now, supporting up to .NET Framework 4.7 — so this is probably where the message comes from.

            If you don't want to compile on Windows, try targeting 4.7 or use dotnet core and write a command line app to test your backend requirements.

            Source https://stackoverflow.com/questions/68739618

            QUESTION

            USART3 Initilization STM32F103RB
            Asked 2021-Jun-03 at 22:28

            I'm a beginner when it comes to using STM chips, and I have a project where I have to use all three USART terminals in Uvision.

            I am using an STM32F103RB chip, and I already got the first two USART_init functions working, but I can't get the third one to work for some reason. I would really appreciate any help Here are my USART_init functions:

            ...

            ANSWER

            Answered 2021-May-31 at 07:34

            Your first line for the USART3 initialization is wrong :-)

            RCC->APB2ENR |= 1; // enable clock for AF

            must be (without a clock the USART doesn't work)

            RCC->APB1ENR |= (1<<18); // enable clock for USART

            And as an additional hint, do not use all these magic numbers for the bits. This is much more readable (and the needed defines are already done in the CMSIS:

            RCC->APB1ENR |= RCC_APB1ENR_USART3EN; // enable clock for USART

            Source https://stackoverflow.com/questions/67766841

            QUESTION

            Having trouble getting timer interrupts to enable on the STM32f4xx
            Asked 2021-Mar-22 at 23:38

            I am working on a project that will require timer interrupts.

            Using STM32cubeIDE, I generated code that should work with timer-interrupts. Here is a truncation of what my main.cpp looks like: (htim1 is a global handle)

            ...

            ANSWER

            Answered 2021-Mar-22 at 23:38

            I would never use HAL library to set up the timers. It makes no sense for me. In the example below I will omit clock (in my case 168MHz) & GPIO settings. As you did not state what model of STM32F4 you use, this code was tested using STM32F446RET uC. Other STM32F4 have identical timers.

            1. Setting the timer:

            Source https://stackoverflow.com/questions/66754960

            QUESTION

            STM32 spi receive procedure without hal
            Asked 2021-Feb-02 at 22:15

            Good afternoon,

            I am a newbie in the programing of stm32. Just working on a project, where is a serious problem with timing. Trying to implement FOC on the PMSM motor where I need to do a calculation in 50us loop, which is fast to communicate with angle sensor via SPI and HAL. Let me explain the situation.

            I tried to work with HAL, but as I read everywhere and explored by myself: if you need speed put it away. So my plan is to use CubeMX to configure all necessary registers and read data directly from the register DR. One small thing, that sensor communicates with a 16-bit frame.

            Code that I produce:

            ...

            ANSWER

            Answered 2021-Feb-02 at 22:06

            You have two mistakes:

            First, you are reading the data register in the wait loop. You should have an empty loop that does nothing repeatedly until RXNE becomes 1, then read the data.

            Second you don't do anything to trigger the clock. In master mode the clock starts when you write data for transmission. After driving the chip-select low, write something to DR:

            Source https://stackoverflow.com/questions/66016375

            QUESTION

            Embedded Buildroot and Yocto Linux crash 50% of the time
            Asked 2020-Nov-04 at 18:22

            I am getting the below error 50% of the time during startup on an STM32 based processor (OSD32MP15x).

            I've tried over 40 versions configs and setups none work and I am under high pressure to deliver this piece of hardware to a client. To me this looks like some kind of timing issue because it doesn't always happen.

            I've tried to disable USB related configs, change DTS files and strip out everything that is not needed and last but not least change power config in the linux config and DTS.

            Questions: How can I debug the below? What does this error look like to you?

            ...

            ANSWER

            Answered 2020-Nov-04 at 18:22

            It looks like the problem was introduced by the patch: regulator: stpmic1: Usb boost over-current protection workaround.

            • The "boost" interrupt handler stpmic1_boost_irq_handler calls regulator_lock(usb_data->boost_rdev);
            • The "boost" interrupt handler (stpmic1_boost_irq_handler) is set up by the stpmic1_boost_register function, but usb_data->boost_rdev is still null at this time.
            • usb_data->boost_rdev is set to the return value of the stpmic1_boost_register function by thestpmic1_regulator_probe function.
            • If the "boost" interrupt handler stpmic1_boost_irq_handler gets called before usb_data->boost_rdev has been set by the stpmic1_regulator_probe function, then the crash occurs.

            A workaround would be to set usb_data->boost_rdev = rdev; in the stpmic1_boost_register function after it has set rdev but before it sets up the interrupt handler.

            This should be reported to the author of the patch. See the "Signed-off-by:" line in the patch for the email address.

            Source https://stackoverflow.com/questions/64684509

            QUESTION

            How to remove gpiod error in SWupdate Installations
            Asked 2020-Nov-03 at 17:10

            I am currently installing swupdate but getting an error while running make command in swupdate file.

            I followed the following steps to first install it -

            1. sudo apt-get install libgpiod-dev

            2. Ran make command in the swupdate file

            Even after installing gpiod following error was shown

            error

            ...

            ANSWER

            Answered 2020-Nov-03 at 17:10

            libgpiod has rather changed its API and the signature of that function. To fix this, you have to set (or unset, it depends on the installed libgpiod) CONFIG_UCFW_OLD_LIBGPIOD in SWUpdate configuration.

            Source https://stackoverflow.com/questions/63823254

            QUESTION

            Should I use `gpio_free` before using `gpio_desc` which is returned by `gpio_to_desc`?
            Asked 2020-Oct-31 at 04:06
            Update at 2020/10/31

            Thanks for 0andriy asking the question on mailing list. And Alexandre Courbot aka Gunurou answered my question!

            I have to thank 0andriy again! Your are the true hero behind this question.

            Old Question:

            This question seems like typo in documentation, but I want to double check.

            My question is the last two paragraphs in the last section of GPIO Descriptor Consumer Interface.

            the following two functions allow you to convert a GPIO descriptor into the GPIO integer namespace and vice-versa:

            ...

            ANSWER

            Answered 2020-Oct-21 at 16:21

            All the same, a GPIO number passed to gpio_to_desc() must have been properly acquired, and usage of the returned GPIO descriptor is only possible after the GPIO number has been released.

            Shouldn't after be changed to before?

            Probably neither of them. I guess that the sentence wants to express not to mix legacy gpio_XXX and modern gpiod_XXX APIs. E.g. to release gpio resources before working with gpiod ones.

            You are right, that using the descriptor after gpio_free() is wrong.

            In practice, the kernel violates the stated sentence itself because nearly every gpio operation uses gpio_to_desc(). E.g.

            Source https://stackoverflow.com/questions/64455505

            QUESTION

            How to enable UART for STM32 Nucleo F429ZI?
            Asked 2020-Jun-25 at 08:53

            I am trying to enable UART for STM32 Nucleo - F429ZI. I have gone through user manual and it says by default USART 3 can be configured for virtual com port purpose. Here is my code. I can see that USART 3 has pins D8 and D9. Here is my code. What am I doing wrong here, I don't see prints on my com port.

            Data sheet refered - https://www.st.com/resource/en/data_brief/nucleo-f429zi.pdf https://www.st.com/resource/en/user_manual/dm00244518-stm32-nucleo-144-boards-stmicroelectronics.pdf

            ...

            ANSWER

            Answered 2020-Jun-25 at 08:53

            you forgot to set what AF mode to be used (there are possible 16 AF modes for every pin). At the moment AF registers are set to the 0 and it is wrong. You need to make it 7.

            How can it be archived using the SPL library (depreciated and not supported anymore) I do not know.

            Here is the register version

            Source https://stackoverflow.com/questions/62569017

            QUESTION

            Reading content from .bin file in C Error on first fread value
            Asked 2020-Apr-21 at 01:34

            i've been having some issue with my fread function. everything reads nicely but my error checker goes off on the first value of fread and i have absolutely no idea to as why.

            if i've rewinded back to the begining of the file, and it prints my value correctly then what failed ?

            ...

            ANSWER

            Answered 2020-Apr-17 at 08:01

            You have a number of subtle errors and then are checking the return of fread against an improper value. In your call to fread, there is no need to precede Buffer4Can with the & (address of) operator. Buffer4Can is an array, and will be converted to a pointer to the first element on access (see: C11 Standard - 6.3.2.1 Other Operands - Lvalues, arrays, and function designators(p3))

            When you take the address of Buffer4Can you change the pointer type you provide to fread from uint8_t* (without the &) to uint8_t (*)[120000) (with the & the type becomes a pointer-to-array-of uint8_t[120000]). Now by happy coincidence being that Buffer4Can is an array, both the pointer-to uint8_t and *pointer-to-array-of uint8_t[120000] will both resolve to the same address (but are of vastly different types).

            Since they resolve to the same address and since fread() takes a parameter of void* for its first parameter, the error goes silently unnoticed. (suffice it to say if you attempted fread (&Buffer4Can + 1, ... things would not work out well...)

            The other issue pointed out by @Domenic is your comparison of the fread() return. The prototype for fread() is:

            Source https://stackoverflow.com/questions/61263258

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install gpiod

            A simple piece of wire example that reads the value of an input line (pin 2) and writes its value to an output line (pin 3):. Error handling and releasing of resources omitted for brevity.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/warthog618/gpiod.git

          • CLI

            gh repo clone warthog618/gpiod

          • sshUrl

            git@github.com:warthog618/gpiod.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link