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

@@ -2,7 +2,7 @@
* gpio.c:
* Swiss-Army-Knife, Set-UID command-line interface to the Raspberry
* Pi's GPIO.
* Copyright (c) 2012-2013 Gordon Henderson
* Copyright (c) 2012-2014 Gordon Henderson
***********************************************************************
* This file is part of wiringPi:
* https://projects.drogon.net/raspberry-pi/wiringpi/
@@ -53,7 +53,7 @@ extern void doPins (void) ;
# define FALSE (1==2)
#endif
#define VERSION "2.20"
#define VERSION "2.21"
#define PI_USB_POWER_CONTROL 38
#define I2CDETECT "/usr/sbin/i2cdetect"
@@ -612,23 +612,44 @@ static void doResetExternal (void)
static void doReset (char *progName)
{
int pin ;
int model, rev, mem, maker, overVolted ;
int pin, endPin ;
if (wiringPiNodes != NULL) // External reset
printf ("GPIO Reset is dangerous!\n") ;
printf (" - Do Not rely on this to do anything sensible!\n") ;
if (wiringPiNodes != NULL) // External
{
doResetExternal () ;
return ;
}
piBoardId (&model, &rev, &mem, &maker, &overVolted) ;
/**/ if ((model == PI_MODEL_A) || (model == PI_MODEL_B))
endPin = 16 ;
else if (model == PI_MODEL_BP)
endPin = 39 ;
else if (model == PI_MODEL_CM)
{
printf (" - Don't know how to reset a comput module:\n") ;
printf (" Write a shell-script to reset the pins to the state you need.\n") ;
return ;
}
else
{
doUnexportall (progName) ;
printf ("Oops - unable to determine board type... model: %d\n", model) ;
return ;
}
for (pin = 0 ; pin < 64 ; ++pin)
{
if (wpiPinToGpio (pin) == -1)
continue ;
for (pin = 0 ; pin <= endPin ; ++pin)
{
if (wpiPinToGpio (pin) == -1)
continue ;
digitalWrite (pin, LOW) ;
pinMode (pin, INPUT) ;
pullUpDnControl (pin, PUD_OFF) ;
}
digitalWrite (pin, LOW) ;
pinMode (pin, INPUT) ;
pullUpDnControl (pin, PUD_OFF) ;
}
}

View File

@@ -278,23 +278,31 @@ void abReadall (int model, int rev)
/*
* bPlusReadall:
* Read all the pins on the model B+
* piPlusReadall:
* Read all the pins on the model A+ or the B+
*********************************************************************************
*/
void bPlusReadall (void)
void piPlusReadall (int model)
{
int pin ;
printf (" +-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+\n") ;
if (model == PI_MODEL_AP)
printf (" +-----+-----+---------+------+---+--A Plus--+---+------+---------+-----+-----+\n") ;
else
printf (" +-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+\n") ;
printf (" | BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |\n") ;
printf (" +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+\n") ;
for (pin = 1 ; pin <= 40 ; pin += 2)
readallPhys (pin) ;
printf (" +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+\n") ;
printf (" | BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |\n") ;
printf (" +-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+\n") ;
if (model == PI_MODEL_AP)
printf (" +-----+-----+---------+------+---+--A Plus--+---+------+---------+-----+-----+\n") ;
else
printf (" +-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+\n") ;
}
@@ -312,8 +320,8 @@ void doReadall (void)
/**/ if ((model == PI_MODEL_A) || (model == PI_MODEL_B))
abReadall (model, rev) ;
else if (model == PI_MODEL_BP)
bPlusReadall () ;
else if ((model == PI_MODEL_BP) || (model == PI_MODEL_AP))
piPlusReadall (model) ;
else if (model == PI_MODEL_CM)
cmReadall () ;
else