Comments (5)
No worries. Feel free to open an issue if you have any other questions or problems.
from c-periphery.
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.
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.
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.
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)
- Support GPIO line bias. HOT 2
- Change param name
- Handle allocating on stack HOT 7
- Warning spi.c in function 'spi_tostring' HOT 3
- PWM functions are hardware PWM ? HOT 1
- Bias compile settings HOT 4
- SPI R/W REG HOT 2
- serial_set_parity(serial, PARITY_ODD) fails on RaspiPi3 B+ HOT 1
- test_gpio gpio_set_bias(gpio, GPIO_BIAS_PULL_UP) fails HOT 1
- gpio_open_sysfs(): Opening GPIO: writing 'export': Invalid argument [errno 22] HOT 1
- Update GPIO code? HOT 2
- ADC - implemented? HOT 3
- Portage error: make: *** No rule to make target 'install'. Stop. HOT 1
- Jetson Nano - not operate discrete output (GPIO), SPI works HOT 1
- Gpio
- GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME missing for Debian 11 x86/x86_64
- Building on Rasberry Pi HOT 1
- spi.c Error message builder is buggy HOT 1
- Unknown CMake command "check_source_compiles" on Debian Bullseye
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from c-periphery.