Minor changes to the PiGlow code - got the orange & yellow the right way

round at last..

Updated for the 0x0012 board revision on the new A+
This commit is contained in:
Gordon Henderson
2014-11-10 10:55:23 +00:00
parent df45388f64
commit 0a9fdeb29d
11 changed files with 264 additions and 40 deletions

View File

@@ -203,13 +203,14 @@ static volatile uint32_t *timerIrqRaw ;
// and PI_VERSION_X defines in wiringPi.h
// Only intended for the gpio command - use at your own risk!
const char *piModelNames [5] =
const char *piModelNames [6] =
{
"Unknown",
"Model A",
"Model B",
"Model B+",
"Compute Module",
"Model A+",
} ;
const char *piRevisionNames [5] =
@@ -620,6 +621,7 @@ int wiringPiFailure (int fatal, const char *message, ...)
* 000f - Model B, Rev 2, 512MB, Qisda
* 0010 - Model B+, Rev 1.2, 512MB, Sony
* 0011 - Pi CM, Rev 1.2, 512MB, Sony
* 0012 - Model A+ Rev 1.2, 256MB, Sony
*
* A small thorn is the olde style overvolting - that will add in
* 1000000
@@ -687,10 +689,12 @@ int piBoardRev (void)
// If you have overvolted the Pi, then it appears that the revision
// has 100000 added to it!
// The actual condition for it being set is:
// (force_turbo || current_limit_override || temp_limit>85) && over_voltage>0
if (wiringPiDebug)
if (strlen (c) != 4)
printf ("piboardRev: This Pi has/is overvolted!\n") ;
printf ("piboardRev: This Pi has/is (force_turbo || current_limit_override || temp_limit>85) && over_voltage>0\n") ;
// Isolate last 4 characters:
@@ -782,6 +786,7 @@ void piBoardId (int *model, int *rev, int *mem, int *maker, int *overVolted)
else if (strcmp (c, "000f") == 0) { *model = PI_MODEL_B ; *rev = PI_VERSION_2 ; *mem = 512 ; *maker = PI_MAKER_EGOMAN ; }
else if (strcmp (c, "0010") == 0) { *model = PI_MODEL_BP ; *rev = PI_VERSION_1_2 ; *mem = 512 ; *maker = PI_MAKER_SONY ; }
else if (strcmp (c, "0011") == 0) { *model = PI_MODEL_CM ; *rev = PI_VERSION_1_2 ; *mem = 512 ; *maker = PI_MAKER_SONY ; }
else if (strcmp (c, "0012") == 0) { *model = PI_MODEL_AP ; *rev = PI_VERSION_1_2 ; *mem = 256 ; *maker = PI_MAKER_SONY ; }
else { *model = 0 ; *rev = 0 ; *mem = 0 ; *maker = 0 ; }
}
@@ -1474,8 +1479,10 @@ int waitForInterrupt (int pin, int mS)
// Do a dummy read to clear the interrupt
// A one character read appars to be enough.
// Followed by a seek to reset it.
(void)read (fd, &c, 1) ;
lseek (fd, 0, SEEK_SET) ;
return x ;
}