Skip to content

pavelrevak/gpiosam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gpiosam

Fast GPIO Python driver for Atmel AT91SAM MCUs running Linux.
Thanks to good design of GPIO peripheral in SAM MCU is this script fully reentrant.
This driver need root privileges, because it use direct memory access.
Request python v2.7 or v3.x

Installation

sudo python setup.py install

Examples:

import gpiosam
btn = gpiosam.Gpio('A', 27)
btn.enable = True
btn.output_mode = False
btn.pull_up = False
btn.pull_down = True
btn.input
  False
btn.input
  True
led = gpiosam.Gpio('A', 26)
led.enable = True
led.output_mode = True
led.output = True
led.output
  True
led.output = False
led.output
  False
led.output = not led.output
led.output
  True

API:

Gpio(port, pin)

initialize GPIO on port and pin

Gpio.enable

property (rw) to enable or disable gpio

Gpio.output_mode

property (rw) true to configure GPIO as output or false as input

Gpio.open_drain

property (rw) to configure GPIO as open drain if is as outpu

Gpio.pull_up

property (rw) control pull up resistors

Gpio.pull_down

property (rw) control pull down resistors

Gpio.output

property (rw) to control output on GPIO

Gpio.input

property (r) to read GPIO value

About

Fast GPIO Python driver for Atmel SAM MCUs running Linux

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages