Closed m3astwood closed 3 years ago
Hello,
Does it show in the console anything like this: "Failed to set gpio pin direction2", "Failed to set gpio pin direction1", "Failed to allocate gpio pin" etc?
What is the content of /sys/class/gpio/gpio6/direction
file, when the program running?
I'm sorry, I don't have raspberry by hand right now.
WirePi works through BCM chip library, while lcdgfx uses the standard linux interface GPIO class.
Thanks for responding so quickly. I don't get any errors from the console, and when I check the /sys/class/gpio/gpio6/direction
it does read in.
I tried pressing my button and checking the /sys/class/gpio/gpio6/value
and it does in fact change from 1 to 0.
@m3astwood
I'm so sorry for that. GPIO read is not implemented for linux now
int lcd_gpioRead(int pin)
{
return LCD_LOW;
}
But you can quickly replace the code in the file lcdgfx/src/lcd_hal/linux/platform.cpp at lines 310 - 313 with:
int lcd_gpioRead(int pin)
{
return gpio_read(pin) ? LCD_HIGH : LCD_LOW;
}
Let me know if it works
Cool thanks, I'll give that a go and report back.
@lexus2k that worked a charm. Thanks so much for your help!
Hi, I added support for Linux to read gpio. Let me know if the fix fits your needs.
Thank you
Feel free to reopen the issue, if the issue still exists.
Thanks - yes I've had to put my project on hold for a little so I haven't been able to verify yet but when it comes back to the top of my list I'll update you.
@lexus2k can confirm it is working great! thanks for you help :+1:
Hello, I'm quite new to C++ and my problem is probably user error. I am unable to read pin inputs from the GPIO while able to write without issues. I have managed to get my functionality working with WiringPi (to test my circuit) but am unable to translate it to use the lcd_gpioRead() function.
All I'm trying to do is get the input of a push button. GPIO and WiringPi pin numbers are different for the same pins. Thanks in advance for any help...
My WiringPi code :
My lcdgfx code :