+ GPIO_Pin *gpio = &g_gpio[g_pin_gpio_to_index[pin]];
+ if (!gpio->initialised)
+ {
+ AbortBool("GPIO %d is not initialised.", pin);
+ }
+
+ if (pwrite(gpio->fd_direction, "in", 2, 0) != 2)
+ {
+ AbortBool("Couldn't set GPIO %d direction - %s", pin, strerror(errno));
+ }
+
+ char c = '0';
+ if (pread(gpio->fd_value, &c, 1, 0) != 1)
+ {
+ AbortBool("Couldn't read GPIO %d value - %s", pin, strerror(errno));
+ }