WiringPi: Bring back all of the stuffs I removed to do with peripherals

Imported from the official WiringPi repository, version 2.60.

Signed-off-by: Deokgyu Yang <secugyu@gmail.com>
Change-Id: I82dc00ab9f038f9bc4c6a9c4ca3affe5a5d33ae1
This commit is contained in:
Deokgyu Yang
2020-04-28 10:56:11 +09:00
parent 73d5c3f375
commit 2c7e86b898
120 changed files with 13827 additions and 5 deletions

View File

@@ -42,6 +42,28 @@ extern int wpMode ;
# define FALSE (1==2)
#endif
/*----------------------------------------------------------------------------*/
/*
* doReadallExternal:
* A relatively crude way to read the pins on an external device.
* We don't know the input/output mode of pins, but we can tell
* if it's an analog pin or a digital one...
*/
/*----------------------------------------------------------------------------*/
static void doReadallExternal (void)
{
int pin ;
printf ("+------+---------+--------+\n") ;
printf ("| Pin | Digital | Analog |\n") ;
printf ("+------+---------+--------+\n") ;
for (pin = wiringPiNodes->pinBase ; pin <= wiringPiNodes->pinMax ; ++pin)
printf ("| %4d | %4d | %4d |\n", pin, digitalRead (pin), analogRead (pin)) ;
printf ("+------+---------+--------+\n") ;
}
/*----------------------------------------------------------------------------*/
static const char *alts [] =
{
@@ -694,6 +716,12 @@ void doReadall(int argc, char *argv[]) {
int model, rev, mem, maker, overVolted, isAll;
char *headerName, *physNames;
// External readall
if (wiringPiNodes != NULL) {
doReadallExternal();
return;
}
if (argc <= 2) {
isAll = FALSE;
} else if (argc == 3 && (strcasecmp(argv[2], "-a") == 0 || strcasecmp(argv[2], "--all") == 0)) {