
5 Jan
2019
5 Jan
'19
2:19 p.m.
On 1/4/19 5:48 PM, Julien Béraud wrote:
gpio_get_value should return 0 or 1, not 1 << pin
Is this documented somewhere ?
I should have mentioned that the following code in cmd/gpio.c expects it and displays a warning else. ... gpio_direction_output(gpio, value); } printf("gpio: pin %s (gpio %i) value is ", str_gpio, gpio);
int nval = gpio_get_value(gpio);
if (IS_ERR_VALUE(nval)) printf(" Warning: no access to GPIO output value\n"); else if (nval != value) printf(" Warning: value of pin is still %d\n", nval); ...
So with the current altera pio code, calling "gpio set N" with N != 0 prints a warning "value of pin is still 1 << N"
return readl(®s->data) & (1 << pin);
return (readl(®s->data) >> pin) & 1;
return !!(..condition..);
Sure. I'll resend.
Julien