From a8112d867771268a61d3f8ef142778568da1db1b Mon Sep 17 00:00:00 2001 From: PinkFreud Date: Thu, 23 Dec 2021 13:22:09 -0500 Subject: [PATCH] Add support for the Zero 2 W (#128) * Changes to support the Zero 2 W (model type 18|0x12) * Increment version in version.h * Increment version in debian-template/wiringPi/DEBIAN/control * Increment version in VERSION as well - I keep missing places where this number is defined * Increment VERSION_MINOR, missed in previous commits; add missing Pi Z2W model name to piModelNames Co-authored-by: schwartz Co-authored-by: PumpkinPi --- VERSION | 2 +- debian-template/wiringPi/DEBIAN/control | 2 +- gpio/readall.c | 6 ++++-- version.h | 4 ++-- wiringPi/wiringPi.c | 4 ++-- wiringPi/wiringPi.h | 1 + 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/VERSION b/VERSION index f6a4163..881307c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.60 +2.61 diff --git a/debian-template/wiringPi/DEBIAN/control b/debian-template/wiringPi/DEBIAN/control index 41c69a8..1302836 100644 --- a/debian-template/wiringPi/DEBIAN/control +++ b/debian-template/wiringPi/DEBIAN/control @@ -1,5 +1,5 @@ Package: wiringpi -Version: 2.60 +Version: 2.61 Section: libraries Priority: optional Architecture: armhf diff --git a/gpio/readall.c b/gpio/readall.c index ec06724..42d6365 100644 --- a/gpio/readall.c +++ b/gpio/readall.c @@ -301,6 +301,8 @@ static void plus2header (int model) printf (" +-----+-----+---------+------+---+-Pi Zero--+---+------+---------+-----+-----+\n") ; else if (model == PI_MODEL_ZERO_W) printf (" +-----+-----+---------+------+---+-Pi ZeroW-+---+------+---------+-----+-----+\n") ; + else if (model == PI_MODEL_ZERO_2W) + printf (" +-----+-----+---------+------+---+Pi Zero 2W+---+------+---------+-----+-----+\n") ; else if (model == PI_MODEL_2) printf (" +-----+-----+---------+------+---+---Pi 2---+---+------+---------+-----+-----+\n") ; else if (model == PI_MODEL_3B) @@ -360,8 +362,8 @@ void doReadall (void) (model == PI_MODEL_2) || (model == PI_MODEL_3AP) || (model == PI_MODEL_3B) || (model == PI_MODEL_3BP) || - (model == PI_MODEL_4B) || (model == PI_MODEL_400) || - (model == PI_MODEL_ZERO) || (model == PI_MODEL_ZERO_W) || (model == PI_MODEL_CM4)) + (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)) piPlusReadall (model) ; else if ((model == PI_MODEL_CM) || (model == PI_MODEL_CM3) || (model == PI_MODEL_CM3P) ) allReadall () ; diff --git a/version.h b/version.h index 812dbdc..f269bf4 100644 --- a/version.h +++ b/version.h @@ -1,3 +1,3 @@ -#define VERSION "2.60" +#define VERSION "2.61" #define VERSION_MAJOR 2 -#define VERSION_MINOR 60 +#define VERSION_MINOR 61 diff --git a/wiringPi/wiringPi.c b/wiringPi/wiringPi.c index b16388c..e97d6fd 100644 --- a/wiringPi/wiringPi.c +++ b/wiringPi/wiringPi.c @@ -239,7 +239,7 @@ const char *piModelNames [21] = "Unknown15", // 15 "CM3+", // 16 "Pi 4B", // 17 - "Unknown18", // 18 + "Pi Zero2-W", // 18 "Pi 400", // 19 "CM4", // 20 } ; @@ -2290,7 +2290,7 @@ int wiringPiSetup (void) pinToGpio = pinToGpioR1 ; physToGpio = physToGpioR1 ; } - else // A2, B2, A+, B+, CM, Pi2, Pi3, Zero + else // A2, B2, A+, B+, CM, Pi2, Pi3, Zero, Zero W, Zero 2 W { pinToGpio = pinToGpioR2 ; physToGpio = physToGpioR2 ; diff --git a/wiringPi/wiringPi.h b/wiringPi/wiringPi.h index fc0d497..6acb57e 100644 --- a/wiringPi/wiringPi.h +++ b/wiringPi/wiringPi.h @@ -103,6 +103,7 @@ #define PI_MODEL_3AP 14 #define PI_MODEL_CM3P 16 #define PI_MODEL_4B 17 +#define PI_MODEL_ZERO_2W 18 #define PI_MODEL_400 19 #define PI_MODEL_CM4 20