Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pi5 support #23

Merged
merged 17 commits into from
Feb 25, 2024
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

:warning: This library was deprecated by its author in August 2019. Until 31st October 2023 it was maintaining at https://github.com/WiringPi/WiringPi/ but later set to read only because there was no interest in properly maintaining it.
In 2024 GC2 fork the project to maintaining it and to keep the best GPIO Library for Raspberry Pi running. We do our best, but we have limited resources and can not give support.
ℹ️ 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.

WiringPi (Unofficial Mirror/Fork)
=================================
Expand Down Expand Up @@ -42,9 +40,10 @@ wiringPi has been wrapped for multiple languages:
Support
-------

Please do not email Gordon if you have issues, he will not be able to help.
Dont' email @Gadgetoid.
Don't email GC2, use issue system of github to report errors.
Please use the [issue system](https://github.com/WiringPi/WiringPi/issues) of GitHub.
Please do not email Gordon if you have issues.
Dont' email @Gadgetoid.
Please don't email GC2 for reporting issues, you might [contact us]([email protected]) for anything that's not for the public eye.

Debug
-------
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.72
2.73
2 changes: 1 addition & 1 deletion debian-template/wiringPi/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: wiringpi
Version: 2.72
Version: 2.73
Section: libraries
Priority: optional
Architecture: armhf
Expand Down
28 changes: 27 additions & 1 deletion gpio/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -794,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 ;
Expand All @@ -807,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) ;
Expand Down Expand Up @@ -1536,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 () ;
Expand Down
31 changes: 23 additions & 8 deletions gpio/readall.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)) ;
}

Expand All @@ -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]) ;
Expand Down Expand Up @@ -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") ;
}
Expand Down Expand Up @@ -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") ;
}
Expand Down Expand Up @@ -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 () ;
Expand Down Expand Up @@ -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))) ;
}
Empty file modified newVersion
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions version.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#define VERSION "2.72"
#define VERSION "2.73"
#define VERSION_MAJOR 2
#define VERSION_MINOR 72
#define VERSION_MINOR 73
Loading
Loading