dgpio 0.0.2

Tiny GPIO control library for single board computers


To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

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 2016-Feb-09
Show all 3 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 1 downloads this month

  • 72 downloads total