Skip to main content

gpio for linux

Project description

g4l

Usage

class

  • Gpio(num)
    • parameter
      • num : gpio number

methods

  • Gpio.direction(dir)

    • parameters
      • dir : pin's direction ( Gpio.IN, Gpio.OUT )
  • Gpio.edge(edge)

    • parameters
      • edge : interrupt edge (Gpio.NONE, Gpio.RISING, Gpio.FALLING, Gpio.BOTH)
  • Gpio.input()

    • returns
      • input value
  • Gpio.output(value)

    • parameters
      • value : output value
  • Gpio.setisr(isr)

    • parameters
      • isr : interrupt service routines's callback function

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


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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

g4l-0.1.4-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file g4l-0.1.4.tar.gz.

File metadata

  • Download URL: g4l-0.1.4.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for g4l-0.1.4.tar.gz
Algorithm Hash digest
SHA256 9a040a136cfc8da962d67d762d672564e50d7a1acbe8d9eff7b3ee328be0d29c
MD5 230a6b70604fec47bcedbbadcfa347e9
BLAKE2b-256 7e31565666351b7d18287477538973a7eac5fbedd56abaa554f85d0a3e83241c

See more details on using hashes here.

File details

Details for the file g4l-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: g4l-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for g4l-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8f41c96baa5c0771b4655b236363f8bb035116b9e9ff1e3a5992d117076cf810
MD5 883d1f2b17dd9de748fbb51e8446da56
BLAKE2b-256 c12938d937bba8ccf9ecdd24e890452dca1bc4908435464616f294afe6c50e00

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page