diff --git a/VERSION b/VERSION index f398a20..8c50098 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0 \ No newline at end of file +3.1 diff --git a/build b/build index c993792..d898ec7 100755 --- a/build +++ b/build @@ -3,7 +3,7 @@ # build # Simple wiringPi build and install script # -# Copyright (c) 2012-2015 Gordon Henderson +# Copyright (c) 2012-2024 Gordon Henderson and contributors ################################################################################# # This file is part of wiringPi: # A "wiring" library for the Raspberry Pi @@ -83,11 +83,14 @@ fi # Only if you know what you're doing! if [ x$1 = "xdebian" ]; then + vMaj=`cut -d. -f1 VERSION` + vMin=`cut -d. -f2 VERSION` here=`pwd` deb_destdir=${here}/debian-template/wiringPi cd debian-template/wiringPi + export VERSION=$vMaj.$vMin export ARCH=$(dpkg-architecture -qDEB_HOST_ARCH) - echo architecture $ARCH + echo version:$VERSION architecture:$ARCH envsubst < control_template > DEBIAN/control rm -rf usr cd $here/wiringPi diff --git a/debian-template/wiringPi/control_template b/debian-template/wiringPi/control_template index 383b388..7a3cb99 100644 --- a/debian-template/wiringPi/control_template +++ b/debian-template/wiringPi/control_template @@ -1,5 +1,5 @@ Package: wiringpi -Version: 3.0 +Version: $VERSION Section: libraries Priority: optional Architecture: $ARCH @@ -11,3 +11,4 @@ Description: The wiringPi libraries, headers and gpio command programs as well as from the command-line Homepage: https://github.com/WiringPi/WiringPi Bugs: https://github.com/WiringPi/WiringPi/issues + diff --git a/gpio/gpio.c b/gpio/gpio.c index c4d698e..680305a 100644 --- a/gpio/gpio.c +++ b/gpio/gpio.c @@ -368,7 +368,7 @@ static void doUnLoad (int argc, char *argv []) static void doI2Cdetect (UNU int argc, char *argv []) { - int port = piGpioLayout () == 1 ? 0 : 1 ; + int port = piGpioLayout () == GPIO_LAYOUT_PI1_REV1 ? 0 : 1 ; char *c, *command ; if ((c = findExecutable (I2CDETECT)) == NULL) diff --git a/newVersion b/newVersion index b8cbef1..34eace3 100755 --- a/newVersion +++ b/newVersion @@ -32,19 +32,3 @@ echo "#define VERSION \"`cat VERSION`\"" > version.h echo "#define VERSION_MAJOR $vMaj" >> version.h echo "#define VERSION_MINOR $vMin" >> version.h -rm -f debian-template/wiringPi/DEBIAN/control -cat > debian-template/wiringPi/DEBIAN/control < -Uploaders: Grazer Computer Club - GC2 -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/ -EOF diff --git a/reinstall b/reinstall new file mode 100755 index 0000000..cf20a0c --- /dev/null +++ b/reinstall @@ -0,0 +1,11 @@ +#!/bin/sh +vMaj=`cut -d. -f1 VERSION` +vMin=`cut -d. -f2 VERSION` +DEBVERSION=$vMaj.$vMin +sudo apt -y remove wiringpi +./build clean +./build debian +mv debian-template/wiringpi_${DEBVERSION}_armhf.deb . +sudo apt install ./wiringpi_${DEBVERSION}_armhf.deb + + diff --git a/version.h b/version.h index 5ea9974..5842f31 100644 --- a/version.h +++ b/version.h @@ -1,3 +1,3 @@ -#define VERSION "3.0" +#define VERSION "3.1" #define VERSION_MAJOR 3 -#define VERSION_MINOR 0 +#define VERSION_MINOR 1 diff --git a/wiringPi/Makefile b/wiringPi/Makefile index 28501ec..88fc48e 100644 --- a/wiringPi/Makefile +++ b/wiringPi/Makefile @@ -61,7 +61,8 @@ SRC = wiringPi.c \ bmp180.c htu21d.c ds18b20.c rht03.c \ drcSerial.c drcNet.c \ pseudoPins.c \ - wpiExtensions.c + wpiExtensions.c \ + wiringPiLegacy.c HEADERS = $(shell ls *.h) diff --git a/wiringPi/wiringPi.c b/wiringPi/wiringPi.c index bbf1713..28dfe61 100644 --- a/wiringPi/wiringPi.c +++ b/wiringPi/wiringPi.c @@ -70,12 +70,14 @@ #include #include #include +#include #include "softPwm.h" #include "softTone.h" #include "wiringPi.h" #include "../version.h" +#include "wiringPiLegacy.h" // Environment Variables @@ -379,7 +381,8 @@ static int wiringPiMode = WPI_MODE_UNINITIALISED ; static volatile int pinPass = -1 ; static pthread_mutex_t pinMutex ; -static int RaspberryPiModel = -1; +static int RaspberryPiModel = -1; +static int RaspberryPiLayout = -1; // Debugging & Return codes @@ -874,141 +877,21 @@ static void usingGpioMemCheck (const char *what) ********************************************************************************* */ -static void piGpioLayoutOops (const char *why) +void piGpioLayoutOops (const char *why) { fprintf (stderr, "Oops: Unable to determine board revision from /proc/cpuinfo\n") ; fprintf (stderr, " -> %s\n", why) ; - fprintf (stderr, " -> You'd best google the error to find out why.\n") ; -//fprintf (stderr, " -> http://www.raspberrypi.org/phpBB3/viewtopic.php?p=184410#p184410\n") ; + fprintf (stderr, " -> Check at https://github.com/wiringpi/wiringpi/issues.\n") ; exit (EXIT_FAILURE) ; } int piGpioLayout (void) { - FILE *cpuFd ; - char line [120] ; - char *c ; - static int gpioLayout = -1 ; - - if (gpioLayout != -1) // No point checking twice - return gpioLayout ; - - if ((cpuFd = fopen ("/proc/cpuinfo", "r")) == NULL) - piGpioLayoutOops ("Unable to open /proc/cpuinfo") ; - -#ifdef DONT_CARE_ANYMORE -// Start by looking for the Architecture to make sure we're really running -// on a Pi. I'm getting fed-up with people whinging at me because -// they can't get it to work on weirdFruitPi boards... - while (fgets (line, 120, cpuFd) != NULL) - if (strncmp (line, "Hardware", 8) == 0) - break ; - - if (strncmp (line, "Hardware", 8) != 0) - piGpioLayoutOops ("No \"Hardware\" line") ; - - if (wiringPiDebug) - printf ("piGpioLayout: Hardware: %s\n", line) ; - -// See if it's BCM2708 or BCM2709 or the new BCM2835. - -// OK. As of Kernel 4.8, we have BCM2835 only, regardless of model. -// However I still want to check because it will trap the cheapskates and rip- -// off merchants who want to use wiringPi on non-Raspberry Pi platforms - which -// I do not support so don't email me your bleating whinges about anything -// other than a genuine Raspberry Pi. - - if (! (strstr (line, "BCM2708") || strstr (line, "BCM2709") || strstr (line, "BCM2835"))) - { - fprintf (stderr, "Unable to determine hardware version. I see: %s,\n", line) ; - fprintf (stderr, " - expecting BCM2708, BCM2709 or BCM2835.\n") ; - fprintf (stderr, "If this is a genuine Raspberry Pi then please report this\n") ; - fprintf (stderr, "at GitHub.com/wiringPi/wiringPi. If this is not a Raspberry Pi then you\n") ; - fprintf (stderr, "are on your own as wiringPi is designed to support the\n") ; - fprintf (stderr, "Raspberry Pi ONLY.\n") ; - exit (EXIT_FAILURE) ; + if (-1==RaspberryPiLayout) { + int model, rev, mem, maker, overVolted ; + piBoardId (&model, &rev, &mem, &maker, &overVolted) ; } - -// Actually... That has caused me more than 10,000 emails so-far. Mosty by -// people who think they know better by creating a statically linked -// version that will not run with a new 4.9 kernel. I utterly hate and -// despise those people. -// -// I also get bleats from people running other than Raspbian with another -// distros compiled kernel rather than a foundation compiled kernel, so -// this might actually help them. It might not - I only have the capacity -// to support Raspbian. -// -// However, I've decided to leave this check out and rely purely on the -// Revision: line for now. It will not work on a non-pi hardware or weird -// kernels that don't give you a suitable revision line. - -// So - we're Probably on a Raspberry Pi. Check the revision field for the real -// hardware type -// In-future, I ought to use the device tree as there are now Pi entries in -// /proc/device-tree/ ... -// but I'll leave that for the next revision. Or the next. -#endif - -// Isolate the Revision line - - rewind (cpuFd) ; - while (fgets (line, 120, cpuFd) != NULL) - if (strncmp (line, "Revision", 8) == 0) - break ; - - fclose (cpuFd) ; - - if (strncmp (line, "Revision", 8) != 0) - piGpioLayoutOops ("No \"Revision\" line") ; - -// Chomp trailing CR/NL - - for (c = &line [strlen (line) - 1] ; (*c == '\n') || (*c == '\r') ; --c) - *c = 0 ; - - if (wiringPiDebug) - printf ("piGpioLayout: Revision string: %s\n", line) ; - -// Scan to the first character of the revision number - - for (c = line ; *c ; ++c) - if (*c == ':') - break ; - - if (*c != ':') - piGpioLayoutOops ("Bogus \"Revision\" line (no colon)") ; - -// Chomp spaces - - ++c ; - while (isspace (*c)) - ++c ; - - if (!isxdigit (*c)) - piGpioLayoutOops ("Bogus \"Revision\" line (no hex digit at start of revision)") ; - -// Make sure its long enough - - if (strlen (c) < 4) - piGpioLayoutOops ("Bogus revision line (too small)") ; - -// Isolate last 4 characters: (in-case of overvolting or new encoding scheme) - - c = c + strlen (c) - 4 ; - - if (wiringPiDebug) - printf ("piGpioLayout: last4Chars are: \"%s\"\n", c) ; - - if ( (strcmp (c, "0002") == 0) || (strcmp (c, "0003") == 0)) - gpioLayout = 1 ; - else - gpioLayout = 2 ; // Covers everything else from the B revision 2 to the B+, the Pi v2, v3, zero and CM's. - - if (wiringPiDebug) - printf ("piGpioLayoutOops: Returning revision: %d\n", gpioLayout) ; - - return gpioLayout ; + return RaspberryPiLayout; } /* @@ -1023,6 +906,36 @@ int piBoardRev (void) } +const char* revfile = "/proc/device-tree/system/linux,revision"; + + +const char* GetPiRevision(char* line, int linelength, unsigned int* revision) { + + const char* c = NULL; + uint32_t Revision = 0; + _Static_assert(sizeof(Revision)==4, "should be unsigend integer with 4 byte size"); + + FILE* fp = fopen(revfile,"rb"); + if (!fp) { + if (wiringPiDebug) + perror(revfile); + return NULL; // revision file not found or no access + } + int result = fread(&Revision, sizeof(Revision), 1, fp); + fclose(fp); + if (result<1) { + if (wiringPiDebug) + perror(revfile); + return NULL; // read error + } + Revision = bswap_32(Revision); + snprintf(line, linelength, "Revision\t: %04x", Revision); + c = &line[11]; + *revision = Revision; + if (wiringPiDebug) + printf("GetPiRevision: Revision string: \"%s\" (%s) - 0x%x\n", line, c, *revision); + return c; +} /* * piBoardId: @@ -1093,62 +1006,21 @@ int piBoardRev (void) void piBoardId (int *model, int *rev, int *mem, int *maker, int *warranty) { - FILE *cpuFd ; - char line [120] ; - char *c ; - unsigned int revision ; + const int maxlength = 120; + char line [maxlength+1] ; + const char *c ; + unsigned int revision = 0x00 ; int bRev, bType, bProc, bMfg, bMem, bWarranty ; -// Will deal with the properly later on - for now, lets just get it going... -// unsigned int modelNum ; - - (void)piGpioLayout () ; // Call this first to make sure all's OK. Don't care about the result. - - if ((cpuFd = fopen ("/proc/cpuinfo", "r")) == NULL) - piGpioLayoutOops ("Unable to open /proc/cpuinfo") ; - - while (fgets (line, 120, cpuFd) != NULL) - if (strncmp (line, "Revision", 8) == 0) - break ; - - fclose (cpuFd) ; - - if (strncmp (line, "Revision", 8) != 0) - piGpioLayoutOops ("No \"Revision\" line") ; - -// Chomp trailing CR/NL - - for (c = &line [strlen (line) - 1] ; (*c == '\n') || (*c == '\r') ; --c) - *c = 0 ; - - if (wiringPiDebug) - printf ("piBoardId: Revision string: %s\n", line) ; - -// Need to work out if it's using the new or old encoding scheme: - -// Scan to the first character of the revision number - - for (c = line ; *c ; ++c) - if (*c == ':') - break ; - - if (*c != ':') - piGpioLayoutOops ("Bogus \"Revision\" line (no colon)") ; - -// Chomp spaces - - ++c ; - while (isspace (*c)) - ++c ; - - if (!isxdigit (*c)) - piGpioLayoutOops ("Bogus \"Revision\" line (no hex digit at start of revision)") ; - - revision = (unsigned int)strtol (c, NULL, 16) ; // Hex number with no leading 0x - -// Check for new way: + c = GetPiRevision(line, maxlength, &revision); // device tree + if (NULL==c) { + c = GetPiRevisionLegacy(line, maxlength, &revision); // proc/cpuinfo + } + if (NULL==c) { + piGpioLayoutOops ("GetPiRevision failed!") ; + } - if ((revision & (1 << 23)) != 0) // New way + if ((revision & (1 << 23)) != 0) // New style, not available for Raspberry Pi 1B/A, CM { if (wiringPiDebug) printf ("piBoardId: New Way: revision is: %08X\n", revision) ; @@ -1166,6 +1038,7 @@ void piBoardId (int *model, int *rev, int *mem, int *maker, int *warranty) *mem = bMem ; *maker = bMfg ; *warranty = bWarranty ; + RaspberryPiLayout = GPIO_LAYOUT_DEFAULT ; //default if (wiringPiDebug) printf ("piBoardId: rev: %d, type: %d, proc: %d, mfg: %d, mem: %d, warranty: %d\n", @@ -1193,9 +1066,9 @@ void piBoardId (int *model, int *rev, int *mem, int *maker, int *warranty) c = c + strlen (c) - 4 ; // Fill out the replys as appropriate - - /**/ if (strcmp (c, "0002") == 0) { *model = PI_MODEL_B ; *rev = PI_VERSION_1 ; *mem = 0 ; *maker = PI_MAKER_EGOMAN ; } - else if (strcmp (c, "0003") == 0) { *model = PI_MODEL_B ; *rev = PI_VERSION_1_1 ; *mem = 0 ; *maker = PI_MAKER_EGOMAN ; } + RaspberryPiLayout = GPIO_LAYOUT_DEFAULT ; //default + /**/ if (strcmp (c, "0002") == 0) { *model = PI_MODEL_B ; *rev = PI_VERSION_1 ; *mem = 0 ; *maker = PI_MAKER_EGOMAN ; RaspberryPiLayout = GPIO_LAYOUT_PI1_REV1; } + else if (strcmp (c, "0003") == 0) { *model = PI_MODEL_B ; *rev = PI_VERSION_1_1 ; *mem = 0 ; *maker = PI_MAKER_EGOMAN ; RaspberryPiLayout = GPIO_LAYOUT_PI1_REV1; } else if (strcmp (c, "0004") == 0) { *model = PI_MODEL_B ; *rev = PI_VERSION_1_2 ; *mem = 0 ; *maker = PI_MAKER_SONY ; } else if (strcmp (c, "0005") == 0) { *model = PI_MODEL_B ; *rev = PI_VERSION_1_2 ; *mem = 0 ; *maker = PI_MAKER_EGOMAN ; } @@ -2600,7 +2473,7 @@ int wiringPiSetup (void) // but it will give us information like the GPIO layout scheme (2 variants // on the older 26-pin Pi's) and the GPIO peripheral base address. // and if we're running on a compute module, then wiringPi pin numbers -// don't really many anything, so force native BCM mode anyway. +// don't really mean anything, so force native BCM mode anyway. piBoardId (&model, &rev, &mem, &maker, &overVolted) ; @@ -2611,7 +2484,7 @@ int wiringPiSetup (void) else wiringPiMode = WPI_MODE_PINS ; - /**/ if (piGpioLayout () == 1) // A, B, Rev 1, 1.1 + /**/ if (piGpioLayout () == GPIO_LAYOUT_PI1_REV1) // A, B, Rev 1, 1.1 { pinToGpio = pinToGpioR1 ; physToGpio = physToGpioR1 ; @@ -2867,7 +2740,7 @@ int wiringPiSetupSys (void) int model, rev, mem, maker, overVolted ; piBoardId (&model, &rev, &mem, &maker, &overVolted) ; - if (piGpioLayout () == 1) + if (piGpioLayout () == GPIO_LAYOUT_PI1_REV1) { pinToGpio = pinToGpioR1 ; physToGpio = physToGpioR1 ; diff --git a/wiringPi/wiringPi.h b/wiringPi/wiringPi.h index 94875b2..0212016 100644 --- a/wiringPi/wiringPi.h +++ b/wiringPi/wiringPi.h @@ -120,6 +120,8 @@ #define PI_MAKER_EMBEST 2 #define PI_MAKER_UNKNOWN 3 +#define GPIO_LAYOUT_PI1_REV1 1 //Pi 1 A/B Revision 1, 1.1, CM +#define GPIO_LAYOUT_DEFAULT 2 extern const char *piModelNames [24] ; extern const char *piProcessor [ 5] ; @@ -195,7 +197,7 @@ extern "C" { // Data // Internal - +extern void piGpioLayoutOops (const char *why); extern int wiringPiFailure (int fatal, const char *message, ...) ; // Core wiringPi functions @@ -232,7 +234,7 @@ extern int wiringPiSetupPiFaceForGpioProg (void) ; // Don't use this - for gpio // On-Board Raspberry Pi hardware specific stuff extern int piGpioLayout (void) ; -extern int piBoardRev (void) ; // Deprecated +extern int piBoardRev (void) ; // Deprecated, but does the same as piGpioLayout extern void piBoardId (int *model, int *rev, int *mem, int *maker, int *overVolted) ; extern int wpiPinToGpio (int wpiPin) ; extern int physPinToGpio (int physPin) ; diff --git a/wiringPi/wiringPiLegacy.c b/wiringPi/wiringPiLegacy.c new file mode 100644 index 0000000..faedd4e --- /dev/null +++ b/wiringPi/wiringPiLegacy.c @@ -0,0 +1,188 @@ + +#include +#include "wiringPiLegacy.h" +#include +#include +#include +#include + +extern int wiringPiDebug ; + +const char* GetPiRevisionLegacy(char* line, int linelength, unsigned int* revision) { + FILE *cpuFd ; + char *c = NULL; + + if ((cpuFd = fopen ("/proc/cpuinfo", "r")) == NULL) + piGpioLayoutOops ("Unable to open /proc/cpuinfo") ; + + while (fgets (line, linelength, cpuFd) != NULL) + if (strncmp (line, "Revision", 8) == 0) + break ; + + fclose (cpuFd) ; + + if (strncmp (line, "Revision", 8) != 0) + piGpioLayoutOops ("No \"Revision\" line") ; + +// Chomp trailing CR/NL + + for (c = &line [strlen (line) - 1] ; (*c == '\n') || (*c == '\r') ; --c) + *c = 0 ; + + if (wiringPiDebug) + printf ("GetPiRevisionLegacy: Revision string: %s\n", line) ; + +// Need to work out if it's using the new or old encoding scheme: + +// Scan to the first character of the revision number + + for (c = line ; *c ; ++c) + if (*c == ':') + break ; + + if (*c != ':') + piGpioLayoutOops ("Bogus \"Revision\" line (no colon)") ; + +// Chomp spaces + + ++c ; + while (isspace (*c)) + ++c ; + + if (!isxdigit (*c)) + piGpioLayoutOops ("Bogus \"Revision\" line (no hex digit at start of revision)") ; + + *revision = (unsigned int)strtol (c, NULL, 16) ; // Hex number with no leading 0x + return c; +} + + + +// useless +int piGpioLayoutLegacy (void) +{ + FILE *cpuFd ; + char line [120] ; + char *c ; + static int gpioLayout = -1 ; + + if (gpioLayout != -1) // No point checking twice + return gpioLayout ; + + if ((cpuFd = fopen ("/proc/cpuinfo", "r")) == NULL) + piGpioLayoutOops ("Unable to open /proc/cpuinfo") ; + +#ifdef DONT_CARE_ANYMORE +// Start by looking for the Architecture to make sure we're really running +// on a Pi. I'm getting fed-up with people whinging at me because +// they can't get it to work on weirdFruitPi boards... + while (fgets (line, 120, cpuFd) != NULL) + if (strncmp (line, "Hardware", 8) == 0) + break ; + + if (strncmp (line, "Hardware", 8) != 0) + piGpioLayoutOops ("No \"Hardware\" line") ; + + if (wiringPiDebug) + printf ("piGpioLayout: Hardware: %s\n", line) ; + +// See if it's BCM2708 or BCM2709 or the new BCM2835. + +// OK. As of Kernel 4.8, we have BCM2835 only, regardless of model. +// However I still want to check because it will trap the cheapskates and rip- +// off merchants who want to use wiringPi on non-Raspberry Pi platforms - which +// I do not support so don't email me your bleating whinges about anything +// other than a genuine Raspberry Pi. + + if (! (strstr (line, "BCM2708") || strstr (line, "BCM2709") || strstr (line, "BCM2835"))) + { + fprintf (stderr, "Unable to determine hardware version. I see: %s,\n", line) ; + fprintf (stderr, " - expecting BCM2708, BCM2709 or BCM2835.\n") ; + fprintf (stderr, "If this is a genuine Raspberry Pi then please report this\n") ; + fprintf (stderr, "at GitHub.com/wiringPi/wiringPi. If this is not a Raspberry Pi then you\n") ; + fprintf (stderr, "are on your own as wiringPi is designed to support the\n") ; + fprintf (stderr, "Raspberry Pi ONLY.\n") ; + exit (EXIT_FAILURE) ; + } + +// Actually... That has caused me more than 10,000 emails so-far. Mosty by +// people who think they know better by creating a statically linked +// version that will not run with a new 4.9 kernel. I utterly hate and +// despise those people. +// +// I also get bleats from people running other than Raspbian with another +// distros compiled kernel rather than a foundation compiled kernel, so +// this might actually help them. It might not - I only have the capacity +// to support Raspbian. +// +// However, I've decided to leave this check out and rely purely on the +// Revision: line for now. It will not work on a non-pi hardware or weird +// kernels that don't give you a suitable revision line. + +// So - we're Probably on a Raspberry Pi. Check the revision field for the real +// hardware type +// In-future, I ought to use the device tree as there are now Pi entries in +// /proc/device-tree/ ... +// but I'll leave that for the next revision. Or the next. +#endif + +// Isolate the Revision line + + rewind (cpuFd) ; + while (fgets (line, 120, cpuFd) != NULL) + if (strncmp (line, "Revision", 8) == 0) + break ; + + fclose (cpuFd) ; + + if (strncmp (line, "Revision", 8) != 0) + piGpioLayoutOops ("No \"Revision\" line") ; + +// Chomp trailing CR/NL + + for (c = &line [strlen (line) - 1] ; (*c == '\n') || (*c == '\r') ; --c) + *c = 0 ; + + if (wiringPiDebug) + printf ("piGpioLayout: Revision string: %s\n", line) ; + +// Scan to the first character of the revision number + + for (c = line ; *c ; ++c) + if (*c == ':') + break ; + + if (*c != ':') + piGpioLayoutOops ("Bogus \"Revision\" line (no colon)") ; + +// Chomp spaces + + ++c ; + while (isspace (*c)) + ++c ; + + if (!isxdigit (*c)) + piGpioLayoutOops ("Bogus \"Revision\" line (no hex digit at start of revision)") ; + +// Make sure its long enough + + if (strlen (c) < 4) + piGpioLayoutOops ("Bogus revision line (too small)") ; + +// Isolate last 4 characters: (in-case of overvolting or new encoding scheme) + + c = c + strlen (c) - 4 ; + + if (wiringPiDebug) + printf ("piGpioLayout: last4Chars are: \"%s\"\n", c) ; + + if ( (strcmp (c, "0002") == 0) || (strcmp (c, "0003") == 0)) + gpioLayout = 1 ; + else + gpioLayout = 2 ; // Covers everything else from the B revision 2 to the B+, the Pi v2, v3, zero and CM's. + + if (wiringPiDebug) + printf ("piGpioLayout: Returning revision: %d\n", gpioLayout) ; + + return gpioLayout ; +} \ No newline at end of file diff --git a/wiringPi/wiringPiLegacy.h b/wiringPi/wiringPiLegacy.h new file mode 100644 index 0000000..e6edc8b --- /dev/null +++ b/wiringPi/wiringPiLegacy.h @@ -0,0 +1,2 @@ + +const char* GetPiRevisionLegacy(char* line, int linelength, unsigned int* revision); \ No newline at end of file