Git Product home page Git Product logo

Comments (5)

vsergeev avatar vsergeev commented on August 15, 2024 1

No worries. Feel free to open an issue if you have any other questions or problems.

from c-periphery.

vsergeev avatar vsergeev commented on August 15, 2024

Hi @yyykkkyyy. It sounds like your program is terminating after the gpio_write()? If you are using character device GPIOs, e.g. with a /dev/gpiochipN device, you should keep in mind that the GPIOs won't retain their output state and will revert to a default state (likely an input) after being released when the program exits.

from c-periphery.

yyykkkyyy avatar yyykkkyyy commented on August 15, 2024

Thank you for your replying @vsergeev !!
Yeah, as you mentioned above, I use /dev/gpiochipN char device.
And I use the sample code which is on the README.

If you are using character device GPIOs, e.g. with a /dev/gpiochipN device, you should keep in mind that the GPIOs won't retain their output state and will revert to a default state (likely an input) after being released when the program exits.

Is this behavior the specification of /dev/gpiochipN?
Can I retain the GPIO's state ?

from c-periphery.

vsergeev avatar vsergeev commented on August 15, 2024

Yeah, that's the behavior of the Linux character device GPIO API. You can retain state after close with the sysfs GPIO API if you export the GPIO before c-periphery opens it (gpio_open_sysfs()), but the Linux sysfs GPIO API is deprecated and will be removed in future versions of Linux.

from c-periphery.

yyykkkyyy avatar yyykkkyyy commented on August 15, 2024

Oh, Okay. I understood the behavior !
In fact, I used the sysfs GPIO but I knew it will be deprecated. So I explore the other way.
Thank you very much @vsergeev !!!
And sorry for my poor English :-)

from c-periphery.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.