I do not have any code in C/C++ i can show you but i recently wrote a very
simple Nodejs ( javascript ) wrapper library for much more than just gpio
but here . . . if you can read Javascript, which you should if you're using
C++ . . .

"use strict";
var fs = require('fs');
var path = "/sys/class/gpio/gpio";

exports.read = function(pin, file){
    fs.access(path + pin + "/" + file, fs.F_OK, (err) => {
        if(err){throw err;}
    });

    return fs.readFileSync(path + pin + "/" + file, 'utf8');
};

exports.write = function(pin, file, value){
    fs.access(path + pin + "/" + file, fs.F_OK, (err) => {
        if(err){throw err;}
    });

    fs.writeFileSync(path + pin + "/" + file, value, 'utf8');
};

exports.export_pin = function(pin){
    var file ="/sys/class/gpio/export";

    fs.writeFileSync(file, pin, 'utf8');
};

exports.unexport_pin = function(pin){
    var file ="/sys/class/gpio/unexport";

    fs.writeFileSync(file, pin, 'utf8');
};


Not very difficult is it ?

On Tue, Jun 7, 2016 at 12:56 PM, William Hermans <[email protected]> wrote:

> Your asking in the wrong place. You should be asking the maintainer of the
> code you're using, not here. I can tell you that wrapping the GPIO sysfs
> system would be trivial for even an aatuer C/C++ developer. Once you
> understood how sysfs applies to the gpio stuff.
>
> On Tue, Jun 7, 2016 at 12:36 PM, <[email protected]> wrote:
>
>> So I have a BeagleBone Black board (Debian distro), and I want to be able
>> to set some GPIO pin from a lowvalue to a high value.
>>
>>
>> For achieving this I'm using the BlackLib [1] library (a C++ library
>> that offers general access to all beaglebone's pins).
>>
>>
>> That library haves a class called BlackGPIO that offers the
>> functionality that I want.
>>
>> BlackLib::BlackGPIO NSLP_pin(BlackLib::GPIO_61, BlackLib::output, 
>> BlackLib::SecureMode);
>>
>> auto NSLP_pinMode = NSLP_pin.getValue();
>>
>> NSLP_pin.setValue(BlackLib::high);
>>
>>
>> I expect that this lines of code will set the signal from a low value to
>> a high one (the signal is low by default).
>>
>>
>> The problem is that the signal goes high only for about ~10ms (measured
>> on a scope), and after that it goes low again.
>>
>>
>> What I do wrong?
>>
>>
>> How can I set the some GPIO pin at a certain value, and remain like that
>> until I change it?
>>
>>
>> [1] link <http://blacklib.yigityuce.com/classBlackLib_1_1BlackGPIO.html>.
>>
>> --
>> For more options, visit http://beagleboard.org/discuss
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "BeagleBoard" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/beagleboard/139dd924-dcd7-43e0-8a79-89e1ecc5c5ea%40googlegroups.com
>> <https://groups.google.com/d/msgid/beagleboard/139dd924-dcd7-43e0-8a79-89e1ecc5c5ea%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/CALHSORo7L2PdsL%3DRsKVQ2Q9V-Dj-7E7THFG1d8UCkHPswK1ErA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to