mirror of
https://github.com/clockworkpi/WiringPi.git
synced 2026-03-24 12:52:41 +01:00
update for the v3+
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* readall.c:
|
||||
* The readall functions - getting a bit big, so split them out.
|
||||
* Copyright (c) 2012-2017 Gordon Henderson
|
||||
* Copyright (c) 2012-2018 Gordon Henderson
|
||||
***********************************************************************
|
||||
* This file is part of wiringPi:
|
||||
* https://projects.drogon.net/raspberry-pi/wiringpi/
|
||||
@@ -287,16 +287,16 @@ void abReadall (int model, int rev)
|
||||
|
||||
/*
|
||||
* piPlusReadall:
|
||||
* Read all the pins on the model A+ or the B+
|
||||
* Read all the pins on the model A+ or the B+ or actually, all 40-pin Pi's
|
||||
*********************************************************************************
|
||||
*/
|
||||
|
||||
static void plus2header (int model)
|
||||
{
|
||||
/**/ if (model == PI_MODEL_AP)
|
||||
printf (" +-----+-----+---------+------+---+--A Plus--+---+------+---------+-----+-----+\n") ;
|
||||
printf (" +-----+-----+---------+------+---+---Pi A+--+---+------+---------+-----+-----+\n") ;
|
||||
else if (model == PI_MODEL_BP)
|
||||
printf (" +-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+\n") ;
|
||||
printf (" +-----+-----+---------+------+---+---Pi B+--+---+------+---------+-----+-----+\n") ;
|
||||
else if (model == PI_MODEL_ZERO)
|
||||
printf (" +-----+-----+---------+------+---+-Pi Zero--+---+------+---------+-----+-----+\n") ;
|
||||
else if (model == PI_MODEL_ZERO_W)
|
||||
@@ -305,6 +305,8 @@ static void plus2header (int model)
|
||||
printf (" +-----+-----+---------+------+---+---Pi 2---+---+------+---------+-----+-----+\n") ;
|
||||
else if (model == PI_MODEL_3)
|
||||
printf (" +-----+-----+---------+------+---+---Pi 3---+---+------+---------+-----+-----+\n") ;
|
||||
else if (model == PI_MODEL_3P)
|
||||
printf (" +-----+-----+---------+------+---+---Pi 3+--+---+------+---------+-----+-----+\n") ;
|
||||
else
|
||||
printf (" +-----+-----+---------+------+---+---Pi ?---+---+------+---------+-----+-----+\n") ;
|
||||
}
|
||||
@@ -348,7 +350,10 @@ void doReadall (void)
|
||||
|
||||
/**/ if ((model == PI_MODEL_A) || (model == PI_MODEL_B))
|
||||
abReadall (model, rev) ;
|
||||
else if ((model == PI_MODEL_BP) || (model == PI_MODEL_AP) || (model == PI_MODEL_2) || (model == PI_MODEL_3) || (model == PI_MODEL_ZERO) || (model == PI_MODEL_ZERO_W))
|
||||
else if ((model == PI_MODEL_BP) || (model == PI_MODEL_AP) ||
|
||||
(model == PI_MODEL_2) ||
|
||||
(model == PI_MODEL_3) || (model == PI_MODEL_3P) ||
|
||||
(model == PI_MODEL_ZERO) || (model == PI_MODEL_ZERO_W))
|
||||
piPlusReadall (model) ;
|
||||
else if ((model == PI_MODEL_CM) || (model == PI_MODEL_CM3))
|
||||
allReadall () ;
|
||||
@@ -356,6 +361,7 @@ void doReadall (void)
|
||||
printf ("Oops - unable to determine board type... model: %d\n", model) ;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* doAllReadall:
|
||||
* Force reading of all pins regardless of Pi model
|
||||
@@ -366,3 +372,24 @@ void doAllReadall (void)
|
||||
{
|
||||
allReadall () ;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* doQmode:
|
||||
* Query mode on a pin
|
||||
*********************************************************************************
|
||||
*/
|
||||
|
||||
void doQmode (int argc, char *argv [])
|
||||
{
|
||||
int pin ;
|
||||
|
||||
if (argc != 3)
|
||||
{
|
||||
fprintf (stderr, "Usage: %s qmode pin\n", argv [0]) ;
|
||||
exit (EXIT_FAILURE) ;
|
||||
}
|
||||
|
||||
pin = atoi (argv [2]) ;
|
||||
printf ("%s\n", alts [getAlt (pin)]) ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user