dgpio ~master

Tiny GPIO control library for single board computers


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

dgpio

dgpio is a tiny GPIO control library for all linux single board computers in D language.

Install

If dub is installed

git clone https://github.com/ozanselte/dgpio.git
cd dgpio

# with dub
sudo dub

# with dmd
cd sources
dmd -lib dgpio.d -oflibdgpio.a

# with gdc
cd sources
gdc -c -o dgpio.o dgpio.d
ar rsc libdgpio.a dgpio.o

Usage

Import library

import dgpio;

Create new GPIO class

GPIO gpio = new GPIO(17);

Read value from GPIO pin

gpio.setInput();
bool gpioHigh = gpio.isHigh();
bool gpioLow = gpio.isLow();
assert(gpio.isHigh() != gpio.isLow());

Write digital value

gpio.setOutput();
gpio.setHigh();
assert(gpio.isHigh() == true);
gpio.setLow();
assert(gpio.isHigh() == false);

Check GPIO pin

ubyte gpioPin = gpio.gpio;
bool isInput = gpio.isInput();
bool isOutput = gpio.isOutput();

Close GPIO pin

gpio.deactivate();
Authors:
  • Ozan Şelte
Dependencies:
none
Versions:
0.0.2 2016-Feb-09
0.0.1 2016-Feb-01
~master 2019-Oct-02
Show all 3 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 2 downloads this month

  • 116 downloads total

Score:
1.0
Short URL:
dgpio.dub.pm