https://github.com/initerworker/wait-for-input
Simple Poll Wait For Input
https://github.com/initerworker/wait-for-input
Last synced: about 1 year ago
JSON representation
Simple Poll Wait For Input
- Host: GitHub
- URL: https://github.com/initerworker/wait-for-input
- Owner: IniterWorker
- License: mit
- Created: 2019-07-02T16:06:42.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-12-03T21:26:41.000Z (over 6 years ago)
- Last Synced: 2025-03-25T18:12:37.458Z (about 1 year ago)
- Language: C
- Size: 30.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Wait For Input
Wait for input; It's a primary tool to configure GPIO and poll events.
Describe GPIO Poll like button trigger very quickly, easily and clearly.
## Why I wrote it ?
I wrote this tool to avoid the bash spread of export/direction/edge. When I create a yocto solution for embedded purposes, I need to write a simple file to describe buttons and basic events quickly, easily and clearly.
## Dependencies
- LibCJSON
- API GPIO, sysfs
## Example
Create a simple hello_world event on push button raising the GPIO.
### GPIO Configuration
See more examples `./example`
#### Basic
```json
{
"gpios": [
{
"name": "btn_helloworld",
"gpio_number": 22,
"sh": "echo btn helloworld"
}
]
}
```
#### Advanced
Advanced example with curl and avanced options.
```json
{
"poll": {
"maxfd": 128,
"timeout": -1
},
"gpios": [
{
"name": "btn_reset_inc",
"gpio_number": 22,
"sh": "curl -d '+1' -XPATCH https://kvdb.io/${API_TOKEN}/hits",
"edge": "falling",
"direction": "in",
"debounce": 200,
"allow_already_exported": true
},
{
"name": "btn_dec",
"gpio_number": 27,
"sh": "curl -d '-1' -XPATCH https://kvdb.io/${API_TOKEN}/hits",
"edge": "falling",
"direction": "in",
"debounce": 2000,
"allow_already_exported": true
}
]
}
```
__NOTE__ : debounce unit **ms**
### Simple
```sh
wait_for_input ~/rpi.json
```
### ToDo
- Describe non-poll gpios