WiringPi 3.0 - let's revive the projecttags/3.0
@@ -26,8 +26,4 @@ To un-install wiringPi: | |||
For help and support see: | |||
* https://github.com/WiringPi/WiringPi/issues | |||
* https://discord.gg/SM4WUVG | |||
wiringPi originally created by Gordon Henderson | |||
https://projects.drogon.net/ |
@@ -31,3 +31,5 @@ Andre Crone | |||
Rik Teerling | |||
Pointing out some silly mistooks in the I2C code... | |||
And everyone else that's been working on this project! |
@@ -1,20 +1,127 @@ | |||
:warning: This library was deprecated by its author in August 2019. As of 31st October 2023 nobody has shown an interest in properly maintaining it. Between this, and changes to GPIO in Rasberry Pi OS Bookworm and on the Raspberry Pi 5, this project is going nowhere. It has been archived to more clearly indicate this status. | |||
# WiringPi | |||
WiringPi (Unofficial Mirror/Fork) | |||
================================= | |||
WiringPi is a _performant_ GPIO access library written in C for Raspberry Pi boards. | |||
This is an unofficial mirror/fork of wiringPi to support ports (Python/Ruby/etc). With the | |||
[end of official development](https://web.archive.org/web/20220405225008/http://wiringpi.com/wiringpi-deprecated/), this repository | |||
has become a mirror of the last "official" source release, plus a fork facilitating updates | |||
to support newer hardware (primarily for use by the ports) and fix bugs. | |||
:warning:️ :construction: on Pi5, PWM support is currently under development and _will not work at this point_. If you're interested in the progress, please check the [corresponding issue](https://github.com/GrazerComputerClub/WiringPi/issues/21). | |||
* The final "official" source release can be found at the | |||
[`final_source_2.50`](https://github.com/WiringPi/WiringPi/tree/final_official_2.50) tag. | |||
* The default `master` branch contains code that has been written since that final source | |||
release to provide support for newer hardware. | |||
Ports | |||
----- | |||
To compile programs with wiringPi, you need to include `wiringPi.h` as well as link against `wiringPi`: | |||
```c | |||
#include <wiringPi.h> // Include WiringPi library! | |||
int main(void) | |||
{ | |||
// uses BCM numbering of the GPIOs and directly accesses the GPIO registers. | |||
wiringPiSetupGpio(); | |||
// pin mode ..(INPUT, OUTPUT, PWM_OUTPUT, GPIO_CLOCK) | |||
// set pin 17 to input | |||
pinMode(17, INPUT); | |||
// pull up/down mode (PUD_OFF, PUD_UP, PUD_DOWN) => down | |||
pullUpDnControl(17, PUD_DOWN); | |||
// get state of pin 17 | |||
int value = digitalRead(17); | |||
if (HIGH == value) | |||
{ | |||
// your code | |||
} | |||
} | |||
``` | |||
To compile this code, link against wiringPi: | |||
```sh | |||
gcc -o myapp myapp.c -l wiringPi | |||
``` | |||
Be sure to check out the [examples](./examples/), build them using Make: | |||
```sh | |||
cd examples | |||
make <example-name | really-all> | |||
``` | |||
The tool `gpio` can be used to set single pins as well as get the state of everything at once: | |||
``` | |||
pi@wiringdemo:~ $ gpio readall | |||
+-----+-----+---------+------+---+---Pi 3B--+---+------+---------+-----+-----+ | |||
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM | | |||
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+ | |||
| | | 3.3v | | | 1 || 2 | | | 5v | | | | |||
| 2 | 8 | SDA.1 | IN | 1 | 3 || 4 | | | 5v | | | | |||
| 3 | 9 | SCL.1 | IN | 1 | 5 || 6 | | | 0v | | | | |||
| 4 | 7 | GPIO. 7 | IN | 0 | 7 || 8 | 0 | IN | TxD | 15 | 14 | | |||
| | | 0v | | | 9 || 10 | 1 | IN | RxD | 16 | 15 | | |||
| 17 | 0 | GPIO. 0 | IN | 1 | 11 || 12 | 1 | IN | GPIO. 1 | 1 | 18 | | |||
| 27 | 2 | GPIO. 2 | IN | 1 | 13 || 14 | | | 0v | | | | |||
| 22 | 3 | GPIO. 3 | IN | 1 | 15 || 16 | 0 | IN | GPIO. 4 | 4 | 23 | | |||
| | | 3.3v | | | 17 || 18 | 1 | IN | GPIO. 5 | 5 | 24 | | |||
| 10 | 12 | MOSI | IN | 0 | 19 || 20 | | | 0v | | | | |||
| 9 | 13 | MISO | IN | 0 | 21 || 22 | 1 | IN | GPIO. 6 | 6 | 25 | | |||
| 11 | 14 | SCLK | IN | 0 | 23 || 24 | 1 | IN | CE0 | 10 | 8 | | |||
| | | 0v | | | 25 || 26 | 0 | IN | CE1 | 11 | 7 | | |||
| 0 | 30 | SDA.0 | IN | 1 | 27 || 28 | 1 | IN | SCL.0 | 31 | 1 | | |||
| 5 | 21 | GPIO.21 | IN | 0 | 29 || 30 | | | 0v | | | | |||
| 6 | 22 | GPIO.22 | IN | 0 | 31 || 32 | 1 | IN | GPIO.26 | 26 | 12 | | |||
| 13 | 23 | GPIO.23 | IN | 1 | 33 || 34 | | | 0v | | | | |||
| 19 | 24 | GPIO.24 | IN | 1 | 35 || 36 | 1 | IN | GPIO.27 | 27 | 16 | | |||
| 26 | 25 | GPIO.25 | IN | 1 | 37 || 38 | 1 | IN | GPIO.28 | 28 | 20 | | |||
| | | 0v | | | 39 || 40 | 1 | IN | GPIO.29 | 29 | 21 | | |||
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+ | |||
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM | | |||
+-----+-----+---------+------+---+---Pi 3B--+---+------+---------+-----+-----+ | |||
``` | |||
## Installing | |||
You can either build it yourself or use the prebuilt binaries: | |||
### From Source | |||
1. create debian-package | |||
```sh | |||
# fetch the source | |||
sudo apt install git | |||
git clone https://github.com/WiringPi/WiringPi.git | |||
cd WiringPi | |||
# build the package | |||
./build debian | |||
mv debian-template/wiringpi-3.0-1.deb . | |||
# install it | |||
sudo apt install ./wiringpi-3.0-1.deb | |||
``` | |||
### Prebuilt Binaries | |||
Grab the latest release from [here](https://github.com/WiringPi/WiringPi/releases). | |||
Unzip/use the portable prebuilt verison: | |||
```sh | |||
# unzip the archive | |||
tar -xfv wiringpi_3.0.tar.gz | |||
``` | |||
Install the debian package: | |||
```sh | |||
# install a dpkg | |||
sudo apt install ./wiringpi-3.0-1.deb | |||
``` | |||
## Ports | |||
wiringPi has been wrapped for multiple languages: | |||
@@ -24,7 +131,26 @@ wiringPi has been wrapped for multiple languages: | |||
* Python - https://github.com/WiringPi/WiringPi-Python | |||
* Ruby - https://github.com/WiringPi/WiringPi-Ruby | |||
Support | |||
------- | |||
## Support | |||
Please use the [issue system](https://github.com/WiringPi/WiringPi/issues) of GitHub. | |||
Please do not email Gordon or @Gadgetoid. | |||
Please don't email GC2 for reporting issues, you might [contact us](mailto:wiringpi@gc2.at) for anything that's not meant for the public. | |||
## History | |||
This repository is the continuation of 'Gordon's wiringPi' which has been [deprecated](https://web.archive.org/web/20220405225008/http://wiringpi.com/wiringpi-deprecated/), a while ago. | |||
* The last "old wiringPi" source of Gordon's release can be found at the | |||
[`final_source_2.50`](https://github.com/WiringPi/WiringPi/tree/final_official_2.50) tag. | |||
* The default `master` branch contains code that has been written since version 2.5 | |||
to provide support for newer hardware as well as new features. | |||
: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. | |||
## Debug | |||
Please do not email Gordon if you have issues, he will not be able to help. | |||
WIRINGPI_DEBUG=1 ./my_wiringpi_program | |||
WIRINGPI_DEBUG=1 ./gpio readall |
@@ -1 +1 @@ | |||
2.70 | |||
3.0 |
@@ -1,13 +1,13 @@ | |||
Package: wiringpi | |||
Version: 2.70 | |||
Version: 3.0 | |||
Section: libraries | |||
Priority: optional | |||
Architecture: armhf | |||
Depends: libc6 | |||
Maintainer: Phil Howard <wiringpi@gadgetoid.com> | |||
Uploaders: Phil Howard <wiringpi@gadgetoid.com> | |||
Maintainer: Grazer Computer Club - GC2 <wiringpi@gc2.at> | |||
Uploaders: Grazer Computer Club - GC2 <wiringpi@gc2.at> | |||
Description: The wiringPi libraries, headers and gpio command | |||
Libraries to allow GPIO access on a Raspberry Pi from C and C++ | |||
and BASIC programs as well as from the command-line | |||
Homepage: https://github.com/WiringPi/WiringPi/ | |||
Bugs: https://github.com/WiringPi/WiringPi/ | |||
programs as well as from the command-line | |||
Homepage: https://github.com/WiringPi/WiringPi | |||
Bugs: https://github.com/WiringPi/WiringPi/issues |
@@ -1,5 +1,5 @@ | |||
#!/bin/sh | |||
set -e | |||
/bin/chown root.root /usr/bin/gpio | |||
/bin/chown root:root /usr/bin/gpio | |||
/bin/chmod 4755 /usr/bin/gpio | |||
/sbin/ldconfig |
@@ -2,7 +2,7 @@ | |||
* gpio.c: | |||
* Swiss-Army-Knife, Set-UID command-line interface to the Raspberry | |||
* Pi's GPIO. | |||
* Copyright (c) 2012-2018 Gordon Henderson | |||
* Copyright (c) 2012-2024 Gordon Henderson and contributors | |||
*********************************************************************** | |||
* This file is part of wiringPi: | |||
* https://github.com/WiringPi/WiringPi/ | |||
@@ -88,6 +88,15 @@ char *usage = "Usage: gpio -v\n" | |||
" gpio gbw <channel> <value>" ; // No trailing newline needed here. | |||
int GPIOToSysFS_ExitonFail (const int pin, const char* name) { | |||
int pinFS = GPIOToSysFS(pin); | |||
if (pinFS<0) { | |||
fprintf (stderr, "%s: invalid sysfs pin of bcm pin %d\n", name, pin) ; | |||
exit (1) ; | |||
} | |||
return pinFS; | |||
} | |||
#ifdef NOT_FOR_NOW | |||
/* | |||
* decodePin: | |||
@@ -391,16 +400,19 @@ static void doI2Cdetect (UNU int argc, char *argv []) | |||
static void doExports (UNU int argc, UNU char *argv []) | |||
{ | |||
int fd ; | |||
int i, l, first ; | |||
int pin, l, first ; | |||
char fName [128] ; | |||
char buf [16] ; | |||
for (first = 0, i = 0 ; i < 64 ; ++i) // Crude, but effective | |||
for (first = 0, pin = 0 ; pin < 64 ; ++pin) // Crude, but effective | |||
{ | |||
// Try to read the direction | |||
sprintf (fName, "/sys/class/gpio/gpio%d/direction", i) ; | |||
int pinFS = GPIOToSysFS(pin); | |||
if (pinFS<0) { | |||
continue; | |||
} | |||
sprintf (fName, "/sys/class/gpio/gpio%d/direction", pinFS) ; | |||
if ((fd = open (fName, O_RDONLY)) == -1) | |||
continue ; | |||
@@ -410,7 +422,11 @@ static void doExports (UNU int argc, UNU char *argv []) | |||
printf ("GPIO Pins exported:\n") ; | |||
} | |||
printf ("%4d: ", i) ; | |||
if(pinFS==pin) { | |||
printf ("%4d: ", pin) ; | |||
} else { | |||
printf ("%4d (%4d): ", pin, pinFS) ; | |||
} | |||
if ((l = read (fd, buf, 16)) == 0) | |||
sprintf (buf, "%s", "?") ; | |||
@@ -425,7 +441,7 @@ static void doExports (UNU int argc, UNU char *argv []) | |||
// Try to Read the value | |||
sprintf (fName, "/sys/class/gpio/gpio%d/value", i) ; | |||
sprintf (fName, "/sys/class/gpio/gpio%d/value", pinFS) ; | |||
if ((fd = open (fName, O_RDONLY)) == -1) | |||
{ | |||
printf ("No Value file (huh?)\n") ; | |||
@@ -443,7 +459,7 @@ static void doExports (UNU int argc, UNU char *argv []) | |||
// Read any edge trigger file | |||
sprintf (fName, "/sys/class/gpio/gpio%d/edge", i) ; | |||
sprintf (fName, "/sys/class/gpio/gpio%d/edge", pinFS) ; | |||
if ((fd = open (fName, O_RDONLY)) == -1) | |||
{ | |||
printf ("\n") ; | |||
@@ -485,7 +501,7 @@ void doExport (int argc, char *argv []) | |||
} | |||
pin = atoi (argv [2]) ; | |||
int pinFS = GPIOToSysFS_ExitonFail(pin, argv [0]); | |||
mode = argv [3] ; | |||
if ((fd = fopen ("/sys/class/gpio/export", "w")) == NULL) | |||
@@ -494,10 +510,9 @@ void doExport (int argc, char *argv []) | |||
exit (1) ; | |||
} | |||
fprintf (fd, "%d\n", pin) ; | |||
fprintf (fd, "%d\n", pinFS) ; | |||
fclose (fd) ; | |||
sprintf (fName, "/sys/class/gpio/gpio%d/direction", pin) ; | |||
sprintf (fName, "/sys/class/gpio/gpio%d/direction", pinFS) ; | |||
if ((fd = fopen (fName, "w")) == NULL) | |||
{ | |||
fprintf (stderr, "%s: Unable to open GPIO direction interface for pin %d: %s\n", argv [0], pin, strerror (errno)) ; | |||
@@ -522,10 +537,10 @@ void doExport (int argc, char *argv []) | |||
// Change ownership so the current user can actually use it | |||
sprintf (fName, "/sys/class/gpio/gpio%d/value", pin) ; | |||
sprintf (fName, "/sys/class/gpio/gpio%d/value", pinFS) ; | |||
changeOwner (argv [0], fName) ; | |||
sprintf (fName, "/sys/class/gpio/gpio%d/edge", pin) ; | |||
sprintf (fName, "/sys/class/gpio/gpio%d/edge", pinFS) ; | |||
changeOwner (argv [0], fName) ; | |||
} | |||
@@ -599,6 +614,7 @@ void doEdge (int argc, char *argv []) | |||
} | |||
pin = atoi (argv [2]) ; | |||
int pinFS = GPIOToSysFS_ExitonFail(pin, argv [0]); | |||
mode = argv [3] ; | |||
// Export the pin and set direction to input | |||
@@ -609,10 +625,10 @@ void doEdge (int argc, char *argv []) | |||
exit (1) ; | |||
} | |||
fprintf (fd, "%d\n", pin) ; | |||
fprintf (fd, "%d\n", pinFS) ; | |||
fclose (fd) ; | |||
sprintf (fName, "/sys/class/gpio/gpio%d/direction", pin) ; | |||
sprintf (fName, "/sys/class/gpio/gpio%d/direction", pinFS) ; | |||
if ((fd = fopen (fName, "w")) == NULL) | |||
{ | |||
fprintf (stderr, "%s: Unable to open GPIO direction interface for pin %d: %s\n", argv [0], pin, strerror (errno)) ; | |||
@@ -622,7 +638,7 @@ void doEdge (int argc, char *argv []) | |||
fprintf (fd, "in\n") ; | |||
fclose (fd) ; | |||
sprintf (fName, "/sys/class/gpio/gpio%d/edge", pin) ; | |||
sprintf (fName, "/sys/class/gpio/gpio%d/edge", pinFS) ; | |||
if ((fd = fopen (fName, "w")) == NULL) | |||
{ | |||
fprintf (stderr, "%s: Unable to open GPIO edge interface for pin %d: %s\n", argv [0], pin, strerror (errno)) ; | |||
@@ -641,10 +657,10 @@ void doEdge (int argc, char *argv []) | |||
// Change ownership of the value and edge files, so the current user can actually use it! | |||
sprintf (fName, "/sys/class/gpio/gpio%d/value", pin) ; | |||
sprintf (fName, "/sys/class/gpio/gpio%d/value", pinFS) ; | |||
changeOwner (argv [0], fName) ; | |||
sprintf (fName, "/sys/class/gpio/gpio%d/edge", pin) ; | |||
sprintf (fName, "/sys/class/gpio/gpio%d/edge", pinFS) ; | |||
changeOwner (argv [0], fName) ; | |||
fclose (fd) ; | |||
@@ -670,6 +686,7 @@ void doUnexport (int argc, char *argv []) | |||
} | |||
pin = atoi (argv [2]) ; | |||
int pinFS = GPIOToSysFS_ExitonFail(pin, argv [0]); | |||
if ((fd = fopen ("/sys/class/gpio/unexport", "w")) == NULL) | |||
{ | |||
@@ -677,7 +694,7 @@ void doUnexport (int argc, char *argv []) | |||
exit (1) ; | |||
} | |||
fprintf (fd, "%d\n", pin) ; | |||
fprintf (fd, "%d\n", pinFS) ; | |||
fclose (fd) ; | |||
} | |||
@@ -697,13 +714,16 @@ void doUnexportall (char *progName) | |||
for (pin = 0 ; pin < 63 ; ++pin) | |||
{ | |||
if ((fd = fopen ("/sys/class/gpio/unexport", "w")) == NULL) | |||
{ | |||
fprintf (stderr, "%s: Unable to open GPIO export interface\n", progName) ; | |||
exit (1) ; | |||
int pinFS = GPIOToSysFS(pin); | |||
if (pinFS>=0) { | |||
if ((fd = fopen ("/sys/class/gpio/unexport", "w")) == NULL) | |||
{ | |||
fprintf (stderr, "%s: Unable to open GPIO export interface\n", progName) ; | |||
exit (1) ; | |||
} | |||
fprintf (fd, "%d\n", pinFS) ; | |||
fclose (fd) ; | |||
} | |||
fprintf (fd, "%d\n", pin) ; | |||
fclose (fd) ; | |||
} | |||
} | |||
@@ -774,6 +794,31 @@ void doMode (int argc, char *argv []) | |||
********************************************************************************* | |||
*/ | |||
static void doPadDrivePin (int argc, char *argv []) | |||
{ | |||
if (argc != 4) { | |||
fprintf (stderr, "Usage: %s drivepin pin value\n", argv [0]) ; | |||
exit (1) ; | |||
} | |||
int pin = atoi (argv [2]) ; | |||
int val = atoi (argv [3]) ; | |||
if ((pin < 0) || (pin > 27)) { | |||
fprintf (stderr, "%s: drive pin not 0-27: %d\n", argv [0], pin) ; | |||
exit (1) ; | |||
} | |||
if ((val < 0) || (val > 3)) { | |||
fprintf (stderr, "%s: drive value not 0-3: %d\n", argv [0], val) ; | |||
exit (1) ; | |||
} | |||
setPadDrivePin (pin, val) ; | |||
} | |||
static void doPadDrive (int argc, char *argv []) | |||
{ | |||
int group, val ; | |||
@@ -787,7 +832,7 @@ static void doPadDrive (int argc, char *argv []) | |||
group = atoi (argv [2]) ; | |||
val = atoi (argv [3]) ; | |||
if ((group < 0) || (group > 2)) | |||
if ((group < -1) || (group > 2)) //-1 hidden feature for read and print values | |||
{ | |||
fprintf (stderr, "%s: drive group not 0, 1 or 2: %d\n", argv [0], group) ; | |||
exit (1) ; | |||
@@ -1268,7 +1313,7 @@ static void doVersion (char *argv []) | |||
wiringPiVersion (&vMaj, &vMin) ; | |||
printf ("gpio version: %d.%d\n", vMaj, vMin) ; | |||
printf ("Copyright (c) 2012-2018 Gordon Henderson\n") ; | |||
printf ("Copyright (c) 2012-2024 Gordon Henderson and contributors\n") ; | |||
printf ("This is free software with ABSOLUTELY NO WARRANTY.\n") ; | |||
printf ("For details type: %s -warranty\n", argv [0]) ; | |||
printf ("\n") ; | |||
@@ -1293,7 +1338,7 @@ static void doVersion (char *argv []) | |||
} | |||
} | |||
if (stat ("/dev/gpiomem", &statBuf) == 0) // User level GPIO is GO | |||
if (wiringPiUserLevelAccess()) // User level GPIO is GO | |||
printf (" * This Raspberry Pi supports user-level GPIO access.\n") ; | |||
else | |||
printf (" * Root or sudo required for GPIO access.\n") ; | |||
@@ -1353,7 +1398,7 @@ int main (int argc, char *argv []) | |||
if (strcasecmp (argv [1], "-warranty") == 0) | |||
{ | |||
printf ("gpio version: %s\n", VERSION) ; | |||
printf ("Copyright (c) 2012-2018 Gordon Henderson\n") ; | |||
printf ("Copyright (c) 2012-2024 Gordon Henderson and contributors\n") ; | |||
printf ("\n") ; | |||
printf (" This program is free software; you can redistribute it and/or modify\n") ; | |||
printf (" it under the terms of the GNU Leser General Public License as published\n") ; | |||
@@ -1516,6 +1561,7 @@ int main (int argc, char *argv []) | |||
else if (strcasecmp (argv [1], "pwmc" ) == 0) doPwmClock (argc, argv) ; | |||
else if (strcasecmp (argv [1], "pwmTone" ) == 0) doPwmTone (argc, argv) ; | |||
else if (strcasecmp (argv [1], "drive" ) == 0) doPadDrive (argc, argv) ; | |||
else if (strcasecmp (argv [1], "drivepin" ) == 0) doPadDrivePin(argc, argv) ; | |||
else if (strcasecmp (argv [1], "readall" ) == 0) doReadall () ; | |||
else if (strcasecmp (argv [1], "nreadall" ) == 0) doReadall () ; | |||
else if (strcasecmp (argv [1], "pins" ) == 0) doReadall () ; | |||
@@ -1,7 +1,7 @@ | |||
/* | |||
* readall.c: | |||
* The readall functions - getting a bit big, so split them out. | |||
* Copyright (c) 2012-2018 Gordon Henderson | |||
* Copyright (c) 2012-2024 Gordon Henderson and contributors | |||
*********************************************************************** | |||
* This file is part of wiringPi: | |||
* https://github.com/WiringPi/WiringPi/ | |||
@@ -75,11 +75,23 @@ static void doReadallExternal (void) | |||
********************************************************************************* | |||
*/ | |||
static char *alts [] = | |||
static const char unknown_alt[] = " - "; | |||
static const char *alts [] = | |||
{ | |||
"IN", "OUT", "ALT5", "ALT4", "ALT0", "ALT1", "ALT2", "ALT3" | |||
"IN", "OUT", "ALT5", "ALT4", "ALT0", "ALT1", "ALT2", "ALT3", "ALT6", "ALT7", "ALT8", "ALT9" | |||
} ; | |||
static const char* GetAltString(int alt) { | |||
if (alt>=0 && alt<=11) { | |||
return alts[alt]; | |||
} | |||
return unknown_alt; | |||
} | |||
static int physToWpi [64] = | |||
{ | |||
-1, // 0 | |||
@@ -177,7 +189,7 @@ static void readallPhys (int physPin) | |||
else | |||
pin = physToWpi [physPin] ; | |||
printf (" | %4s", alts [getAlt (pin)]) ; | |||
printf (" | %4s", GetAltString(getAlt (pin))) ; | |||
printf (" | %d", digitalRead (pin)) ; | |||
} | |||
@@ -201,7 +213,7 @@ static void readallPhys (int physPin) | |||
pin = physToWpi [physPin] ; | |||
printf (" | %d", digitalRead (pin)) ; | |||
printf (" | %-4s", alts [getAlt (pin)]) ; | |||
printf (" | %-4s", GetAltString(getAlt (pin))) ; | |||
} | |||
printf (" | %-5s", physNames [physPin]) ; | |||
@@ -233,11 +245,11 @@ static void allReadall (void) | |||
for (pin = 0 ; pin < 27 ; ++pin) | |||
{ | |||
printf ("| %3d ", pin) ; | |||
printf ("| %-4s ", alts [getAlt (pin)]) ; | |||
printf ("| %-4s ", GetAltString(getAlt (pin))) ; | |||
printf ("| %s ", digitalRead (pin) == HIGH ? "High" : "Low ") ; | |||
printf ("| ") ; | |||
printf ("| %3d ", pin + 27) ; | |||
printf ("| %-4s ", alts [getAlt (pin + 27)]) ; | |||
printf ("| %-4s ", GetAltString(getAlt (pin + 27))) ; | |||
printf ("| %s ", digitalRead (pin + 27) == HIGH ? "High" : "Low ") ; | |||
printf ("|\n") ; | |||
} | |||
@@ -315,6 +327,8 @@ static void plus2header (int model) | |||
printf (" +-----+-----+---------+------+---+---Pi 4B--+---+------+---------+-----+-----+\n") ; | |||
else if (model == PI_MODEL_400) | |||
printf (" +-----+-----+---------+------+---+---Pi 400-+---+------+---------+-----+-----+\n") ; | |||
else if (model == PI_MODEL_5) | |||
printf (" +-----+-----+---------+------+---+---Pi 5---+---+------+---------+-----+-----+\n") ; | |||
else | |||
printf (" +-----+-----+---------+------+---+---Pi ?---+---+------+---------+-----+-----+\n") ; | |||
} | |||
@@ -363,7 +377,8 @@ void doReadall (void) | |||
(model == PI_MODEL_3AP) || | |||
(model == PI_MODEL_3B) || (model == PI_MODEL_3BP) || | |||
(model == PI_MODEL_4B) || (model == PI_MODEL_400) || (model == PI_MODEL_CM4) || | |||
(model == PI_MODEL_ZERO) || (model == PI_MODEL_ZERO_W) || (model == PI_MODEL_ZERO_2W)) | |||
(model == PI_MODEL_ZERO) || (model == PI_MODEL_ZERO_W) || (model == PI_MODEL_ZERO_2W) || | |||
(model == PI_MODEL_5) ) | |||
piPlusReadall (model) ; | |||
else if ((model == PI_MODEL_CM) || (model == PI_MODEL_CM3) || (model == PI_MODEL_CM3P) ) | |||
allReadall () ; | |||
@@ -401,5 +416,5 @@ void doQmode (int argc, char *argv []) | |||
} | |||
pin = atoi (argv [2]) ; | |||
printf ("%s\n", alts [getAlt (pin)]) ; | |||
printf ("%s\n", GetAltString(getAlt (pin))) ; | |||
} |
@@ -40,8 +40,8 @@ Section: libraries | |||
Priority: optional | |||
Architecture: armhf | |||
Depends: libc6 | |||
Maintainer: Phil Howard <wiringpi@gadgetoid.com> | |||
Uploaders: Phil Howard <wiringpi@gadgetoid.com> | |||
Maintainer: Grazer Computer Club - GC2 <wiringpi@gc2.at> | |||
Uploaders: Grazer Computer Club - GC2 <wiringpi@gc2.at> | |||
Description: The wiringPi libraries, headers and gpio command | |||
Libraries to allow GPIO access on a Raspberry Pi from C and C++ | |||
and BASIC programs as well as from the command-line | |||
@@ -1,5 +0,0 @@ | |||
#!/bin/sh | |||
# update - update source files from master on yakko | |||
rsync -aHx --exclude='*.o' --exclude='*~' -v --delete gordon@yakko:rpi/git/wiringPi/ . |
@@ -1,3 +1,3 @@ | |||
#define VERSION "2.70" | |||
#define VERSION_MAJOR 2 | |||
#define VERSION_MINOR 70 | |||
#define VERSION "3.0" | |||
#define VERSION_MAJOR 3 | |||
#define VERSION_MINOR 0 |
@@ -107,6 +107,8 @@ | |||
#define PI_MODEL_ZERO_2W 18 | |||
#define PI_MODEL_400 19 | |||
#define PI_MODEL_CM4 20 | |||
#define PI_MODEL_CM4S 21 | |||
#define PI_MODEL_5 23 | |||
#define PI_VERSION_1 0 | |||
#define PI_VERSION_1_1 1 | |||
@@ -118,7 +120,9 @@ | |||
#define PI_MAKER_EMBEST 2 | |||
#define PI_MAKER_UNKNOWN 3 | |||
extern const char *piModelNames [21] ; | |||
extern const char *piModelNames [24] ; | |||
extern const char *piProcessor [ 5] ; | |||
extern const char *piRevisionNames [16] ; | |||
extern const char *piMakerNames [16] ; | |||
extern const int piMemorySize [ 8] ; | |||
@@ -199,7 +203,10 @@ extern int wiringPiFailure (int fatal, const char *message, ...) ; | |||
extern struct wiringPiNodeStruct *wiringPiFindNode (int pin) ; | |||
extern struct wiringPiNodeStruct *wiringPiNewNode (int pinBase, int numPins) ; | |||
extern int GPIOToSysFS(const int pin) ; | |||
extern void wiringPiVersion (int *major, int *minor) ; | |||
extern int wiringPiUserLevelAccess (void) ; | |||
extern int wiringPiSetup (void) ; | |||
extern int wiringPiSetupSys (void) ; | |||
extern int wiringPiSetupGpio (void) ; | |||
@@ -230,6 +237,7 @@ extern void piBoardId (int *model, int *rev, int *mem, int *m | |||
extern int wpiPinToGpio (int wpiPin) ; | |||
extern int physPinToGpio (int physPin) ; | |||
extern void setPadDrive (int group, int value) ; | |||
extern void setPadDrivePin (int pin, int value); // Interface V2 | |||
extern int getAlt (int pin) ; | |||
extern void pwmToneWrite (int pin, int freq) ; | |||
extern void pwmSetMode (int mode) ; | |||