This commit is contained in:
mstroh76
2024-02-11 20:22:00 +01:00
parent 6d0c68b75d
commit af5baeac32
6 changed files with 57 additions and 17 deletions

View File

@@ -75,11 +75,23 @@ static void doReadallExternal (void)
*********************************************************************************
*/
static char *alts [] =
static const char unknown_alt[] = " - ";
static const char *alts [] =
{
"IN", "OUT", "ALT5", "ALT4", "ALT0", "ALT1", "ALT2", "ALT3"
"IN", "OUT", "ALT5", "ALT4", "ALT0", "ALT1", "ALT2", "ALT3", "ALT6", "ALT7", "ALT8", "ALT9"
} ;
static const char* GetAltString(int alt) {
if (alt>=0 && alt<=11) {
return alts[alt];
}
return unknown_alt;
}
static int physToWpi [64] =
{
-1, // 0
@@ -177,7 +189,7 @@ static void readallPhys (int physPin)
else
pin = physToWpi [physPin] ;
printf (" | %4s", alts [getAlt (pin)]) ;
printf (" | %4s", GetAltString(getAlt (pin))) ;
printf (" | %d", digitalRead (pin)) ;
}
@@ -201,7 +213,7 @@ static void readallPhys (int physPin)
pin = physToWpi [physPin] ;
printf (" | %d", digitalRead (pin)) ;
printf (" | %-4s", alts [getAlt (pin)]) ;
printf (" | %-4s", GetAltString(getAlt (pin))) ;
}
printf (" | %-5s", physNames [physPin]) ;
@@ -233,11 +245,11 @@ static void allReadall (void)
for (pin = 0 ; pin < 27 ; ++pin)
{
printf ("| %3d ", pin) ;
printf ("| %-4s ", alts [getAlt (pin)]) ;
printf ("| %-4s ", GetAltString(getAlt (pin))) ;
printf ("| %s ", digitalRead (pin) == HIGH ? "High" : "Low ") ;
printf ("| ") ;
printf ("| %3d ", pin + 27) ;
printf ("| %-4s ", alts [getAlt (pin + 27)]) ;
printf ("| %-4s ", GetAltString(getAlt (pin + 27))) ;
printf ("| %s ", digitalRead (pin + 27) == HIGH ? "High" : "Low ") ;
printf ("|\n") ;
}
@@ -404,5 +416,5 @@ void doQmode (int argc, char *argv [])
}
pin = atoi (argv [2]) ;
printf ("%s\n", alts [getAlt (pin)]) ;
printf ("%s\n", GetAltString(getAlt (pin))) ;
}