Hi,
I am using this code with my Adafruit FT232H:
#include <gpio++.hpp>
#include <asio.hpp>
#include <iostream>
#include <thread>
int main( int argc, char** argv )
{
asio::io_service io;
auto chip = gpio::get_chip(io, "0");
auto pin = chip->pin(2);
if( pin->supports(gpio::in) )
{
pin->as(gpio::mode::in); // <- Throws
std::cout << "Success" << std::endl;
}
std::cout << "Monitoring pin:" << std::endl;
pin->on_state_changed([](gpio::state s)
{
std::cout << "State=" << s << std::endl;
});
io.run();
return 0;
}
I am getting this:
*** Program received signal SIGABRT (Aborted) ***
terminate called after throwing an instance of 'std::runtime_error'
what(): chip:0#2: Cannot set pin mode - No such device
Some info:
$ gpioinfo
gpiochip0 - 4 lines:
line 0: unnamed unused input active-high
line 1: unnamed unused input active-high
line 2: unnamed unused input active-high
line 3: unnamed kernel input active-high [used]
I am trying to read an input event with a physical button connected to pin 2 (C8 for my board). Needless to say that using the pins as output (flashing a led) is working ok. Also, the other pins don't work for input - they crash too.
Any ideas why the library is throwing?