This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
Package: wiringpi
|
Package: wiringpi
|
||||||
Version: 2.72
|
Version: 2.73
|
||||||
Section: libraries
|
Section: libraries
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Architecture: armhf
|
Architecture: armhf
|
||||||
|
|||||||
@@ -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] =
|
static int physToWpi [64] =
|
||||||
{
|
{
|
||||||
-1, // 0
|
-1, // 0
|
||||||
@@ -177,7 +189,7 @@ static void readallPhys (int physPin)
|
|||||||
else
|
else
|
||||||
pin = physToWpi [physPin] ;
|
pin = physToWpi [physPin] ;
|
||||||
|
|
||||||
printf (" | %4s", alts [getAlt (pin)]) ;
|
printf (" | %4s", GetAltString(getAlt (pin))) ;
|
||||||
printf (" | %d", digitalRead (pin)) ;
|
printf (" | %d", digitalRead (pin)) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,7 +213,7 @@ static void readallPhys (int physPin)
|
|||||||
pin = physToWpi [physPin] ;
|
pin = physToWpi [physPin] ;
|
||||||
|
|
||||||
printf (" | %d", digitalRead (pin)) ;
|
printf (" | %d", digitalRead (pin)) ;
|
||||||
printf (" | %-4s", alts [getAlt (pin)]) ;
|
printf (" | %-4s", GetAltString(getAlt (pin))) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf (" | %-5s", physNames [physPin]) ;
|
printf (" | %-5s", physNames [physPin]) ;
|
||||||
@@ -233,11 +245,11 @@ static void allReadall (void)
|
|||||||
for (pin = 0 ; pin < 27 ; ++pin)
|
for (pin = 0 ; pin < 27 ; ++pin)
|
||||||
{
|
{
|
||||||
printf ("| %3d ", pin) ;
|
printf ("| %3d ", pin) ;
|
||||||
printf ("| %-4s ", alts [getAlt (pin)]) ;
|
printf ("| %-4s ", GetAltString(getAlt (pin))) ;
|
||||||
printf ("| %s ", digitalRead (pin) == HIGH ? "High" : "Low ") ;
|
printf ("| %s ", digitalRead (pin) == HIGH ? "High" : "Low ") ;
|
||||||
printf ("| ") ;
|
printf ("| ") ;
|
||||||
printf ("| %3d ", pin + 27) ;
|
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 ("| %s ", digitalRead (pin + 27) == HIGH ? "High" : "Low ") ;
|
||||||
printf ("|\n") ;
|
printf ("|\n") ;
|
||||||
}
|
}
|
||||||
@@ -404,5 +416,5 @@ void doQmode (int argc, char *argv [])
|
|||||||
}
|
}
|
||||||
|
|
||||||
pin = atoi (argv [2]) ;
|
pin = atoi (argv [2]) ;
|
||||||
printf ("%s\n", alts [getAlt (pin)]) ;
|
printf ("%s\n", GetAltString(getAlt (pin))) ;
|
||||||
}
|
}
|
||||||
|
|||||||
0
newVersion
Normal file → Executable file
0
newVersion
Normal file → Executable file
@@ -1,3 +1,3 @@
|
|||||||
#define VERSION "2.72"
|
#define VERSION "2.73"
|
||||||
#define VERSION_MAJOR 2
|
#define VERSION_MAJOR 2
|
||||||
#define VERSION_MINOR 72
|
#define VERSION_MINOR 73
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ const unsigned int RP1_RIO_OE = (0x0004/4);
|
|||||||
const unsigned int RP1_RIO_IN = (0x0008/4);
|
const unsigned int RP1_RIO_IN = (0x0008/4);
|
||||||
|
|
||||||
//RP1 chip (@Pi5) RIO offset for set/clear value
|
//RP1 chip (@Pi5) RIO offset for set/clear value
|
||||||
const unsigned int RP1_SET_OFFSET = (0x2000/4):
|
const unsigned int RP1_SET_OFFSET = (0x2000/4);
|
||||||
const unsigned int RP1_CLR_OFFSET = (0x3000/4);
|
const unsigned int RP1_CLR_OFFSET = (0x3000/4);
|
||||||
|
|
||||||
//RP1 chip (@Pi5) PDE/PDU pull-up/-down enable
|
//RP1 chip (@Pi5) PDE/PDU pull-up/-down enable
|
||||||
@@ -167,7 +167,7 @@ const unsigned int RP1_PADS0_Addr = 0x400f0000;
|
|||||||
// due to the Pi v2, v3, etc. and the new /dev/gpiomem interface
|
// due to the Pi v2, v3, etc. and the new /dev/gpiomem interface
|
||||||
|
|
||||||
const char* gpiomem_global = "/dev/mem";
|
const char* gpiomem_global = "/dev/mem";
|
||||||
const char* gpiomem_BCM = "/dev/gpiomem"
|
const char* gpiomem_BCM = "/dev/gpiomem";
|
||||||
const char* gpiomem_RP1 = "/dev/gpiomem0";
|
const char* gpiomem_RP1 = "/dev/gpiomem0";
|
||||||
const int gpiomem_RP1_Size = 0x00030000;
|
const int gpiomem_RP1_Size = 0x00030000;
|
||||||
|
|
||||||
@@ -562,11 +562,12 @@ int GetMaxPin() {
|
|||||||
|
|
||||||
#define RETURN_ON_MODEL5 if (PI_MODEL_5 == RaspberryPiModel) { if (wiringPiDebug) printf("Function not supported on Pi5\n"); return; }
|
#define RETURN_ON_MODEL5 if (PI_MODEL_5 == RaspberryPiModel) { if (wiringPiDebug) printf("Function not supported on Pi5\n"); return; }
|
||||||
|
|
||||||
void FailOnModel5() {
|
int FailOnModel5() {
|
||||||
if (PI_MODEL_5 == RaspberryPiModel) {
|
if (PI_MODEL_5 == RaspberryPiModel) {
|
||||||
return wiringPiFailure (WPI_ALMOST, "Function not supported on Raspberry Pi 5.\n"
|
return wiringPiFailure (WPI_ALMOST, "Function not supported on Raspberry Pi 5.\n"
|
||||||
" Unable to continue. Keep an eye of new versions at https://github.com/GrazerComputerClub/WiringPi\n") ;
|
" Unable to continue. Keep an eye of new versions at https://github.com/GrazerComputerClub/WiringPi\n") ;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// gpioToGPFSEL:
|
// gpioToGPFSEL:
|
||||||
@@ -1287,7 +1288,35 @@ int getAlt (int pin)
|
|||||||
return 0 ;
|
return 0 ;
|
||||||
|
|
||||||
if (PI_MODEL_5 == RaspberryPiModel) {
|
if (PI_MODEL_5 == RaspberryPiModel) {
|
||||||
alt = (gpio[2*pin+1] & RP1_FSEL_NONE_HW); //0-4 function, 5-11 debounce time
|
alt = (gpio[2*pin+1] & RP1_FSEL_NONE_HW); //0-4 function
|
||||||
|
|
||||||
|
/* BCM definiton
|
||||||
|
000 = GPIO Pin 9 is an input
|
||||||
|
001 = GPIO Pin 9 is an output
|
||||||
|
100 = GPIO Pin 9 takes alternate function 0
|
||||||
|
101 = GPIO Pin 9 takes alternate function 1
|
||||||
|
110 = GPIO Pin 9 takes alternate function 2
|
||||||
|
111 = GPIO Pin 9 takes alternate function 3
|
||||||
|
011 = GPIO Pin 9 takes alternate function 4
|
||||||
|
010 = GPIO Pin 9 takes alternate function 5
|
||||||
|
*/
|
||||||
|
switch(alt) {
|
||||||
|
case 0: return 4;
|
||||||
|
case 1: return 5;
|
||||||
|
case 2: return 6;
|
||||||
|
case 3: return 7;
|
||||||
|
case 4: return 3;
|
||||||
|
case RP1_FSEL_GPIO: {
|
||||||
|
unsigned int outputmask = gpio[2*pin] & 0x3000; //Bit13-OETOPAD + Bit12-OEFROMPERI
|
||||||
|
return (outputmask==0x3000) ? 1 : 0; //1=OUT 0=IN
|
||||||
|
}
|
||||||
|
case 6: return 8;
|
||||||
|
case 7: return 9;
|
||||||
|
case 8: return 10;
|
||||||
|
case 9: return 11;
|
||||||
|
default:return alt;
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
fSel = gpioToGPFSEL [pin] ;
|
fSel = gpioToGPFSEL [pin] ;
|
||||||
shift = gpioToShift [pin] ;
|
shift = gpioToShift [pin] ;
|
||||||
@@ -1678,7 +1707,6 @@ void pullUpDnControl (int pin, int pud)
|
|||||||
else if (wiringPiMode != WPI_MODE_GPIO)
|
else if (wiringPiMode != WPI_MODE_GPIO)
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
unsigned int pull;
|
|
||||||
if (PI_MODEL_5 == RaspberryPiModel) {
|
if (PI_MODEL_5 == RaspberryPiModel) {
|
||||||
unsigned int pullbits = pads[1+pin] & RP1_INV_PUD_MASK; // remove bits
|
unsigned int pullbits = pads[1+pin] & RP1_INV_PUD_MASK; // remove bits
|
||||||
switch (pud){
|
switch (pud){
|
||||||
@@ -1830,7 +1858,7 @@ void digitalWrite (int pin, int value)
|
|||||||
else if (wiringPiMode != WPI_MODE_GPIO)
|
else if (wiringPiMode != WPI_MODE_GPIO)
|
||||||
return ;
|
return ;
|
||||||
if (PI_MODEL_5 == RaspberryPiModel) {
|
if (PI_MODEL_5 == RaspberryPiModel) {
|
||||||
if (value == LOW)
|
if (value == LOW) {
|
||||||
//printf("Set pin %d >>0x%08x<< to low\n", pin, 1<<pin);
|
//printf("Set pin %d >>0x%08x<< to low\n", pin, 1<<pin);
|
||||||
rio[RP1_RIO_OUT + RP1_CLR_OFFSET] = 1<<pin;
|
rio[RP1_RIO_OUT + RP1_CLR_OFFSET] = 1<<pin;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user