gpio for linux
Project description
g4l
- gpio for linux (tested with jetson tx2, nano)
- link : https://gitlab.com/telelian/peripheral-library/g4l
Usage
class
- Gpio(num)
- parameter
- num : gpio number
- parameter
methods
-
Gpio.direction(dir)
- parameters
- dir : pin's direction ( Gpio.IN, Gpio.OUT )
- parameters
-
Gpio.edge(edge)
- parameters
- edge : interrupt edge (Gpio.NONE, Gpio.RISING, Gpio.FALLING, Gpio.BOTH)
- parameters
-
Gpio.input()
- returns
- input value
- returns
-
Gpio.output(value)
- parameters
- value : output value
- parameters
-
Gpio.setisr(isr)
- parameters
- isr : interrupt service routines's callback function
- parameters
example
input interrupt
from time import sleep
from g4l import Gpio
print('g4l example')
gpio = Gpio(100)
gpio.direction(Gpio.IN)
gpio.edge(Gpio.RISING)
gpio.setisr(lambda:print('gpio isr'))
print('loop start - toggle gpio')
cnt = 0
while True:
print(f'loop {cnt}')
cnt += 1
sleep(5)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
g4l-0.1.4.tar.gz
(3.6 kB
view hashes)
Built Distribution
g4l-0.1.4-py3-none-any.whl
(3.9 kB
view hashes)