I've been reading about the linux GPIO functions and tried to make a small example using the function gpio_is_valid
, but the compile fails because it can't find linux/gpio.h
.
#include <iostream>
#include <linux/gpio.h>
int main()
{
const bool is17Valid = !!gpio_is_valid(17);
if (is17Valid)
{
std::cout << "17 is valid!" << std::endl;
}
else
{
std::cout << "17 is *not* valid!" << std::endl;
}
return 0;
}
Is linux/gpio.h
available on the Raspberry Pi? If not, are none of the functions described in the linux documentation available?
I'm using the original Debian "Squeeze" image.
root
. Are youroot
? – Jivings Jul 18 '12 at 22:54return 0;
because you're in a function that returns anint
. Omitting this results in a compiler error. – Malvineous Jul 18 '12 at 23:07linux/gpio.h
; have you got an example of one that does? – Alex Chamberlain Jul 19 '12 at 06:23linux/gpio.h
is inaccessible without root access. I don't see how that is irrelevant. – Jivings Jul 19 '12 at 09:20gcc
as root! – Alex Chamberlain Jul 19 '12 at 09:23