Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Raspberry Pi's: raspi-gpio - easily installed
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
jlpoole
Guru
Guru


Joined: 01 Nov 2005
Posts: 483
Location: Salem, OR

PostPosted: Thu Apr 04, 2024 9:46 pm    Post subject: Raspberry Pi's: raspi-gpio - easily installed Reply with quote

Raspberry Pi comes with a command line program raspi-gpio which can be very helpful when working with the GPIOs of Pi. The project for this command is hosted at https://github.com/RPi-Distro/raspi-gpio.

I downloaded the zip file instead of using the standard "git clone" since my current Gentoo image is being kept to a minimum to run on a Pi Zero 2 W. I unzipped the archive under /usr/local/src/. I then executed:

Code:
./configure
make
make install


Here's my session showing at the end the status of GPIO 13 and 21.

Code:
zerofield2 /usr/local/src # cd raspi-gpio-master/
zerofield2 /usr/local/src/raspi-gpio-master # ls
LICENSE  Makefile.am  Makefile.in  README.md  aclocal.m4  compile  configure  configure.ac  depcomp  install-sh  missing  raspi-gpio.c
zerofield2 /usr/local/src/raspi-gpio-master # ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of gcc... gcc3
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: executing depfiles commands
zerofield2 /usr/local/src/raspi-gpio-master # make
gcc -DPACKAGE_NAME=\"raspi-gpio\" -DPACKAGE_TARNAME=\"raspi-gpio\" -DPACKAGE_VERSION=\"0.2\" -DPACKAGE_STRING=\"raspi-gpio\ 0.2\" -DPACKAGE_BUGREPORT=\"serge@raspberrypi.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"raspi-gpio\" -DVERSION=\"0.2\" -I.     -g -O2 -MT raspi-gpio.o -MD -MP -MF .deps/raspi-gpio.Tpo -c -o raspi-gpio.o raspi-gpio.c
mv -f .deps/raspi-gpio.Tpo .deps/raspi-gpio.Po
gcc  -g -O2   -o raspi-gpio raspi-gpio.o
zerofield2 /usr/local/src/raspi-gpio-master # make install
make[1]: Entering directory '/usr/local/src/raspi-gpio-master'
 /usr/bin/mkdir -p '/usr/local/bin'
  /usr/bin/install -c raspi-gpio '/usr/local/bin'
make[1]: Nothing to be done for 'install-data-am'.
make[1]: Leaving directory '/usr/local/src/raspi-gpio-master'
zerofield2 /usr/local/src/raspi-gpio-master # raspi-gpio get 13
GPIO 13: level=0 func=INPUT pull=DOWN
[ raspi-gpio is deprecated - try `pinctrl` instead ]
zerofield2 /usr/local/src/raspi-gpio-master # raspi-gpio get 21
GPIO 21: level=0 func=INPUT pull=DOWN
zerofield2 /usr/local/src/raspi-gpio-master #


Reading literature on the Internet about programming with the Pi's GPIO, there may be reference to this utility, so I thought this posting will serve as proof that the utility can be easily built in a Gentoo image.
Back to top
View user's profile Send private message
jlpoole
Guru
Guru


Joined: 01 Nov 2005
Posts: 483
Location: Salem, OR

PostPosted: Thu Apr 04, 2024 9:51 pm    Post subject: CheatSheet for raspi-gpio Reply with quote

Page 7 of John Woolsey's Raspberry Pi Basics Cheatsheet (13 pages) has a section devoted to the raspi-gpio command line utility that is helpful and demonstrates the utility's prowess.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum