Skip to main content

Requirements:

  • Python 2.7 or 3.4

  • cffi

How to install

Python package on FreeBSD 11 have problem when using python source that needed to compile thing, so the easiest way is to use the binary packages uploaded to pypi:

pip install --only-binary freebsd-11 fbsd_gpio

How to use

The fbsd_gpio module expose two classes, GpioController and GpioPin

Use gpio controller unit 0 (/dev/gpioc0) and list all the pins name:

from fbsd_gpio import GpioController

gpioc = GpioController(0)
for pin in gpioc:
    print(pin)

Set pin 127 to output and logical value 1

from fbsd_gpio import GpioController, GPIO_VALUE_HIGH

gpioc = GpioController(0)
gpioc.pin_output(127)
# The two following lines are equivalent
gpioc.pin_set(127, GPIO_VALUE_HIGH)
gpioc.pin_high(127)

Alternativelly you can use the GpioPin class:

from fbsd_gpio import GpioPin, GPIO_VALUE_HIGH

pin = GpioPin(127, unit=0)
pin.ouput = True
# The following lines are equivalent
pin.set(GPIO_VALUE_HIGH)
pin.high()
pin(GPIO_VALUE_HIGH)

Or use the name of the pin directly:

from fbsd_gpio import GpioController, GPIO_VALUE_HIGH

gpioc = GpioController(0)
gpioc.gpioled0.output = True
# The three following lines are equivalent
gpioc.gpioled.set(GPIO_VALUE_HIGH)
gpioc.gpioled0.high()
gpioc.gpioled0(GPIO_VALUE_HIGH)

Get the value of a pin:

from fbsd_gpio import GpioPin

pin = GpioPin(128, unit=0)
if pin.input:
    print('Pin is input mode')
else
    print('Pin is output mode')
# The two following lines are equivalent
    value = pin.get()
    value = pin()

Toggle the value of a pin:

from fbsd_gpio import GpioPin

pin = GpioPin(128, unit=0)
pin.toggle()

Change the name of a pin:

from fbsd_gpio import GpioPin

pin = GpioPin(128, unit=0)
pin.name = 'green_led'

Metadata

Release files for fbsd_gpio 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fbsd_gpio 0.5.0
File Size Uploaded
fbsd_gpio-0.5.0.tar.gz 5.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for fbsd_gpio 0.5.0
File Interpreter ABI Platform
fbsd_gpio-0.5.0.freebsd-11.0-CURRENT-arm-py34.tar.gz Details
fbsd_gpio-0.5.0.freebsd-11.0-CURRENT-arm-py27.tar.gz Details

Total release size: 34.9 kB

Release files / fbsd_gpio-0.5.0.tar.gz

Download URL fbsd_gpio-0.5.0.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1842c0bf0f1120d61f9a128419d67f7365e710501e66f8387557bccbc6e00dc8
BLAKE2b-256 checksum
How to use checksums
56f0c08556faee2797eb0dad7d01b43815f7ea319c461ff4ac8c3215a3a3fb51
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / fbsd_gpio-0.5.0.freebsd-11.0-CURRENT-arm-py34.tar.gz

Download URL fbsd_gpio-0.5.0.freebsd-11.0-CURRENT-arm-py34.tar.gz
Size 15.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a0749d85cf6ed287d177c9d674dc63b25ff53321faf68faabb2559472260f223
BLAKE2b-256 checksum
How to use checksums
2ff9bae77564332854afdef6a27530a53afe3c89b7f0ed7cf0c1f808dd861cb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / fbsd_gpio-0.5.0.freebsd-11.0-CURRENT-arm-py27.tar.gz

Download URL fbsd_gpio-0.5.0.freebsd-11.0-CURRENT-arm-py27.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
602487371e9fcfb05e7fafebe2b8731f63b20055177244c276f4a12db390f742
BLAKE2b-256 checksum
How to use checksums
5ba0efc00eb75f74afbde525ceae14dfc772335d22f3e5c1b60b583d9ed1087a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.5.0 This release

3 release files

0.4.1

3 release files

0.4.0

3 release files

0.3.0

2 release files

0.2.0

0.1.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page