chiark / gitweb /
Minor changes to the PiGlow code - got the orange & yellow the right way
[wiringPi.git] / wiringPi / wiringPi.c
index e7ae3863c7ca0fe6f5b66e08a833293965d9325b..ba45f4ddc30704da97e801d2feb314dc380cb0f6 100644 (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 ;
 }