From 30d79dab76770a139748c0d8a8280d25241eb4d1 Mon Sep 17 00:00:00 2001 From: Gordon Henderson Date: Wed, 5 Sep 2012 21:01:12 +0100 Subject: [PATCH] A-Ha! discovered that overvolted Raspberry Pi's have 10000 added to their hardware revision number... So have adapted wiringPi to cope. --- wiringPi/wiringPi.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/wiringPi/wiringPi.c b/wiringPi/wiringPi.c index 2a5c533..b89309d 100644 --- a/wiringPi/wiringPi.c +++ b/wiringPi/wiringPi.c @@ -840,7 +840,7 @@ int wiringPiSetup (void) wiringPiDebug = TRUE ; if (wiringPiDebug) - printf ("wiringPiSetup called\n") ; + printf ("wiringPi: wiringPiSetup called\n") ; pinMode = pinModeWPi ; pullUpDnControl = pullUpDnControlWPi ; @@ -879,6 +879,15 @@ int wiringPiSetup (void) return -1 ; } +// If you have overvolted the Pi, then it appears that the revision +// has 100000 added to it! + + if (wiringPiDebug) + if (revision > 1000) + printf ("wiringPi: This Pi has/is overvolted!\n") ; + + revision %= 100 ; + /**/ if ((revision == 2) || (revision == 3)) boardRevision = 1 ; else if ((revision == 4) || (revision == 5) || (revision == 6)) @@ -897,7 +906,7 @@ int wiringPiSetup (void) pinToGpio = pinToGpioR2 ; if (wiringPiDebug) - printf ("Revision: %d, board revision: %d\n", revision, boardRevision) ; + printf ("wiringPi: Revision: %d, board revision: %d\n", revision, boardRevision) ; // Open the master /dev/memory device @@ -1042,7 +1051,7 @@ int wiringPiSetupGpio (void) int x ; if (wiringPiDebug) - printf ("wiringPiSetupGpio called\n") ; + printf ("wiringPi: wiringPiSetupGpio called\n") ; if ((x = wiringPiSetup ()) < 0) return x ; @@ -1078,7 +1087,7 @@ int wiringPiSetupSys (void) char fName [128] ; if (wiringPiDebug) - printf ("wiringPiSetupSys called\n") ; + printf ("wiringPi: wiringPiSetupSys called\n") ; pinMode = pinModeSys ; pullUpDnControl = pullUpDnControlSys ; -- 2.30.2