Skip to content

Commit fe60562

Browse files
author
Renaud Guillard
committed
Merge tag '3.14' into merge-3.14
2 parents c94bdc3 + 4639b7a commit fe60562

File tree

193 files changed

+5396
-1654
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+5396
-1654
lines changed

INSTALL

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,4 @@ To un-install wiringPi:
2626
For help and support see:
2727

2828
* https://github.com/WiringPi/WiringPi/issues
29-
* https://discord.gg/SM4WUVG
3029

31-
32-
wiringPi originally created by Gordon Henderson
33-
https://projects.drogon.net/

People

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@ Andre Crone
3131

3232
Rik Teerling
3333
Pointing out some silly mistooks in the I2C code...
34+
35+
And everyone else that's been working on this project!

README.md

Lines changed: 149 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,132 @@
1-
WiringPi (Unofficial Mirror/Fork)
2-
=================================
1+
# WiringPi Library
2+
Welcome to the WiringPi Library, the highly performant GPIO access library for Raspberry Pi boards. This library is written in C and is designed to provide fast and efficient control of the GPIO pins by directly accessing the hardware registers using DMA.
33

4-
This is an unofficial mirror/fork of wiringPi to support ports (Python/Ruby/etc). With the
5-
[end of official development](http://wiringpi.com/wiringpi-deprecated/), this repository
6-
has become a mirror of the last "official" source release, plus a fork facilitating updates
7-
to support newer hardware (primarily for use by the ports) and fix bugs.
4+
**Key Features:**
5+
- **Support:** WiringPi supports all Raspberry Pi Boards including Pi 5 ( :construction: On the Pi 5, only the GCLK functionality is currently not supported due to missing documentation of the RP1 chip).
6+
- **High Performance:** By directly accessing the hardware registers, WiringPi ensures minimal latency and maximum performance for your GPIO operations.
7+
- **Wide Adoption:** WiringPi is widely used in numerous projects, making it a reliable choice for your Raspberry Pi GPIO needs.
88

9-
* The final "official" source release can be found at the
10-
[`final_source_2.50`](https://github.com/WiringPi/WiringPi/tree/final_official_2.50) tag.
11-
* The default `master` branch contains code that has been written since that final source
12-
release to provide support for newer hardware.
9+
Whether you’re working on a simple LED blink project or a complex automation system, WiringPi provides the tools you need to get the job done efficiently.
1310

14-
Ports
15-
-----
11+
## How to use
12+
13+
To compile programs with wiringPi Library, you need to include `wiringPi.h` as well as link against `wiringPi`:
14+
15+
```c
16+
#include <wiringPi.h> // Include WiringPi library!
17+
18+
int main(void)
19+
{
20+
// uses BCM numbering of the GPIOs and directly accesses the GPIO registers.
21+
wiringPiSetupGpio();
22+
23+
// pin mode ..(INPUT, OUTPUT, PWM_OUTPUT, GPIO_CLOCK)
24+
// set pin 17 to input
25+
pinMode(17, INPUT);
26+
27+
// pull up/down mode (PUD_OFF, PUD_UP, PUD_DOWN) => down
28+
pullUpDnControl(17, PUD_DOWN);
29+
30+
// get state of pin 17
31+
int value = digitalRead(17);
32+
33+
if (HIGH == value)
34+
{
35+
// your code
36+
}
37+
}
38+
```
39+
40+
To compile this code, link against wiringPi:
41+
42+
```sh
43+
gcc -o myapp myapp.c -l wiringPi
44+
```
45+
46+
Be sure to check out the [examples](./examples/), build them using Make:
47+
48+
```sh
49+
cd examples
50+
make <example-name | really-all>
51+
```
52+
53+
The tool `gpio` can be used to set single pins as well as get the state of everything at once:
54+
55+
```
56+
pi@wiringdemo:~ $ gpio readall
57+
+-----+-----+---------+------+---+---Pi 3B--+---+------+---------+-----+-----+
58+
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
59+
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
60+
| | | 3.3v | | | 1 || 2 | | | 5v | | |
61+
| 2 | 8 | SDA.1 | IN | 1 | 3 || 4 | | | 5v | | |
62+
| 3 | 9 | SCL.1 | IN | 1 | 5 || 6 | | | 0v | | |
63+
| 4 | 7 | GPIO. 7 | IN | 0 | 7 || 8 | 0 | IN | TxD | 15 | 14 |
64+
| | | 0v | | | 9 || 10 | 1 | IN | RxD | 16 | 15 |
65+
| 17 | 0 | GPIO. 0 | IN | 1 | 11 || 12 | 1 | IN | GPIO. 1 | 1 | 18 |
66+
| 27 | 2 | GPIO. 2 | IN | 1 | 13 || 14 | | | 0v | | |
67+
| 22 | 3 | GPIO. 3 | IN | 1 | 15 || 16 | 0 | IN | GPIO. 4 | 4 | 23 |
68+
| | | 3.3v | | | 17 || 18 | 1 | IN | GPIO. 5 | 5 | 24 |
69+
| 10 | 12 | MOSI | IN | 0 | 19 || 20 | | | 0v | | |
70+
| 9 | 13 | MISO | IN | 0 | 21 || 22 | 1 | IN | GPIO. 6 | 6 | 25 |
71+
| 11 | 14 | SCLK | IN | 0 | 23 || 24 | 1 | IN | CE0 | 10 | 8 |
72+
| | | 0v | | | 25 || 26 | 0 | IN | CE1 | 11 | 7 |
73+
| 0 | 30 | SDA.0 | IN | 1 | 27 || 28 | 1 | IN | SCL.0 | 31 | 1 |
74+
| 5 | 21 | GPIO.21 | IN | 0 | 29 || 30 | | | 0v | | |
75+
| 6 | 22 | GPIO.22 | IN | 0 | 31 || 32 | 1 | IN | GPIO.26 | 26 | 12 |
76+
| 13 | 23 | GPIO.23 | IN | 1 | 33 || 34 | | | 0v | | |
77+
| 19 | 24 | GPIO.24 | IN | 1 | 35 || 36 | 1 | IN | GPIO.27 | 27 | 16 |
78+
| 26 | 25 | GPIO.25 | IN | 1 | 37 || 38 | 1 | IN | GPIO.28 | 28 | 20 |
79+
| | | 0v | | | 39 || 40 | 1 | IN | GPIO.29 | 29 | 21 |
80+
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
81+
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
82+
+-----+-----+---------+------+---+---Pi 3B--+---+------+---------+-----+-----+
83+
```
84+
85+
86+
## Installing
87+
88+
You can either build it yourself or use the prebuilt binaries:
89+
90+
### From Source
91+
92+
1. create debian-package
93+
94+
```sh
95+
# fetch the source
96+
sudo apt install git
97+
git clone https://github.com/WiringPi/WiringPi.git
98+
cd WiringPi
99+
100+
# build the package
101+
./build debian
102+
mv debian-template/wiringpi-3.0-1.deb .
103+
104+
# install it
105+
sudo apt install ./wiringpi-3.0-1.deb
106+
```
107+
108+
109+
### Prebuilt Binaries
110+
111+
Grab the latest release from [here](https://github.com/WiringPi/WiringPi/releases).
112+
113+
114+
Unzip/use the portable prebuilt verison:
115+
116+
```sh
117+
# unzip the archive
118+
tar -xfv wiringpi_3.0.tar.gz
119+
```
120+
121+
Install the debian package:
122+
123+
```sh
124+
# install a dpkg
125+
sudo apt install ./wiringpi-3.0-1.deb
126+
```
127+
128+
129+
## Ports
16130

17131
wiringPi has been wrapped for multiple languages:
18132

@@ -22,12 +136,29 @@ wiringPi has been wrapped for multiple languages:
22136
* Python - https://github.com/WiringPi/WiringPi-Python
23137
* Ruby - https://github.com/WiringPi/WiringPi-Ruby
24138

25-
Support
26-
-------
139+
## Support
140+
141+
Please use the [issue system](https://github.com/WiringPi/WiringPi/issues) of GitHub.
142+
143+
If you're not sure whether to create an issue or not, please engage in [discussions](https://github.com/WiringPi/WiringPi/discussions)!
144+
145+
Please do not email Gordon or @Gadgetoid.
146+
147+
Please don't email GC2 for reporting issues, you might [contact us](mailto:[email protected]) for anything that's not meant for the public.
148+
149+
## History
150+
151+
This repository is the continuation of 'Gordon's wiringPi 2.5' which has been [deprecated](https://web.archive.org/web/20220405225008/http://wiringpi.com/wiringpi-deprecated/), a while ago.
152+
153+
* The last "old wiringPi" source of Gordon's release can be found at the
154+
[`final_source_2.50`](https://github.com/WiringPi/WiringPi/tree/final_official_2.50) tag.
155+
* The default `master` branch contains code that has been written since version 2.5
156+
to provide support for newer hardware as well as new features.
157+
158+
:information_source:️ Since 2024, [GC2](https://github.com/GrazerComputerClub) has taken over maintenance of the project, supporting new OS versions as well as current hardware generations. We are dedicated to keeping the arguably best-performing GPIO Library for Raspberry Pi running smoothly. We strive to do our best, but please note that this is a community effort, and we cannot provide any guarantees or take responsibility for implementing specific features you may need.
27159

28-
Please do not email Gordon if you have issues, he will not be able to help.
160+
## Debug
29161

30-
Pull-requests may be accepted to add or fix support for newer hardware, but new features or
31-
other changes may not be accepted.
162+
WIRINGPI_DEBUG=1 ./my_wiringpi_program
32163

33-
For support, comments, questions, etc please join the WiringPi Discord channel: https://discord.gg/SM4WUVG
164+
WIRINGPI_DEBUG=1 gpio readall

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.61
1+
3.14

build

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# build
44
# Simple wiringPi build and install script
55
#
6-
# Copyright (c) 2012-2015 Gordon Henderson
6+
# Copyright (c) 2012-2024 Gordon Henderson and contributors
77
#################################################################################
88
# This file is part of wiringPi:
99
# A "wiring" library for the Raspberry Pi
@@ -83,9 +83,15 @@ fi
8383
# Only if you know what you're doing!
8484

8585
if [ x$1 = "xdebian" ]; then
86+
vMaj=`cut -d. -f1 VERSION`
87+
vMin=`cut -d. -f2 VERSION`
8688
here=`pwd`
8789
deb_destdir=${here}/debian-template/wiringPi
8890
cd debian-template/wiringPi
91+
export VERSION=$vMaj.$vMin
92+
export ARCH=$(dpkg-architecture -qDEB_HOST_ARCH)
93+
echo version:$VERSION architecture:$ARCH
94+
envsubst < control_template > DEBIAN/control
8995
rm -rf usr
9096
cd $here/wiringPi
9197
make install-deb DEB_DESTDIR=${deb_destdir}
@@ -95,7 +101,7 @@ if [ x$1 = "xdebian" ]; then
95101
make install-deb INCLUDE='-I../wiringPi -I../devLib' LDFLAGS=-L../debian-template/wiringPi/usr/lib DEB_DESTDIR=${deb_destdir}
96102
cd $here/debian-template
97103
fakeroot dpkg-deb --build wiringPi
98-
mv wiringPi.deb wiringpi-`cat $here/VERSION`-1.deb
104+
dpkg-name -o wiringPi.deb
99105
exit
100106
fi
101107

@@ -110,22 +116,6 @@ fi
110116

111117
hardware=`fgrep Hardware /proc/cpuinfo | head -1 | awk '{ print $3 }'`
112118

113-
# if [ x$hardware != "xBCM2708" ]; then
114-
# echo ""
115-
# echo " +------------------------------------------------------------+"
116-
# echo " | wiringPi is designed to run on the Raspberry Pi only. |"
117-
# echo " | This processor does not appear to be a Raspberry Pi. |"
118-
# echo " +------------------------------------------------------------+"
119-
# echo " | In the unlikely event that you think it is a Raspberry Pi, |"
120-
# echo " | then please accept my apologies and email the contents of |"
121-
# echo " | /proc/cpuinfo to [email protected]. |"
122-
# echo " | - Thanks, Gordon |"
123-
# echo " +------------------------------------------------------------+"
124-
# echo ""
125-
# exit 1
126-
# fi
127-
128-
129119
echo
130120
echo "WiringPi Library"
131121
cd wiringPi

debian-template/wiringPi/DEBIAN/control

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/sh
22
set -e
3-
/bin/chown root.root /usr/bin/gpio
3+
/bin/chown root:root /usr/bin/gpio
44
/bin/chmod 4755 /usr/bin/gpio
55
/sbin/ldconfig
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Package: wiringpi
2+
Version: $VERSION
3+
Section: libraries
4+
Priority: optional
5+
Architecture: $ARCH
6+
Depends: libc6
7+
Maintainer: Grazer Computer Club - GC2 <[email protected]>
8+
Uploaders: Grazer Computer Club - GC2 <[email protected]>
9+
Description: The wiringPi libraries, headers and gpio command
10+
Libraries to allow GPIO access on a Raspberry Pi from C and C++
11+
programs as well as from the command-line
12+
Homepage: https://github.com/WiringPi/WiringPi
13+
Bugs: https://github.com/WiringPi/WiringPi/issues
14+

debian/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Section: electronics
33
Priority: optional
44
Maintainer: Ian Jackson <[email protected]>
55
Standards-Version: 3.8.0
6-
Homepage: http://wiringpi.com/
6+
Homepage: https://github.com/WiringPi/WiringPi
77
Build-Depends: debhelper (>= 8)
88

99
Package: libwiringpi2

devLib/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Copyright (c) 2012-2016 Gordon Henderson
66
#################################################################################
77
# This file is part of wiringPi:
8-
# https://projects.drogon.net/raspberry-pi/wiringpi/
8+
# https://github.com/wiringPi/wiringPi
99
#
1010
# wiringPi is free software: you can redistribute it and/or modify
1111
# it under the terms of the GNU Lesser General Public License as published by

0 commit comments

Comments
 (0)