mstroh76 преди 2 месеца
родител
ревизия
9e7c71f67d
променени са 4 файла, в които са добавени 13 реда и са изтрити 10 реда
  1. +1
    -1
      VERSION
  2. +3
    -2
      gpio/readall.c
  3. +2
    -2
      version.h
  4. +7
    -5
      wiringPi/wiringPi.c

+ 1
- 1
VERSION Целия файл

@@ -1 +1 @@
3.9
3.10

+ 3
- 2
gpio/readall.c Целия файл

@@ -75,8 +75,9 @@ static void doReadallExternal (void)
*********************************************************************************
*/

#define MAX_ALTS 11
static const char unknown_alt[] = " - ";
static const char *alts [] =
static const char *alts [MAX_ALTS+1] =
{
"IN", "OUT", "ALT5", "ALT4", "ALT0", "ALT1", "ALT2", "ALT3", "ALT6", "ALT7", "ALT8", "ALT9"
} ;
@@ -84,7 +85,7 @@ static const char *alts [] =

static const char* GetAltString(int alt) {

if (alt>=0 && alt<=11) {
if (alt>=0 && alt<=MAX_ALTS) {
return alts[alt];
}



+ 2
- 2
version.h Целия файл

@@ -1,3 +1,3 @@
#define VERSION "3.9"
#define VERSION "3.10"
#define VERSION_MAJOR 3
#define VERSION_MINOR 9
#define VERSION_MINOR 10

+ 7
- 5
wiringPi/wiringPi.c Целия файл

@@ -1671,14 +1671,14 @@ int OpenAndCheckGpioChip(int GPIONo, const char* label, const unsigned int lines
return Fd;
} else {
if (wiringPiDebug) {
printf ("wiringPi: Open chip %s succeded, fd=%d\n", szGPIOChip, Fd) ;
printf("wiringPi: Open chip %s succeded, fd=%d\n", szGPIOChip, Fd) ;
}
struct gpiochip_info chipinfo;
ZeroMemory(&chipinfo, sizeof(chipinfo));
int ret = ioctl(Fd, GPIO_GET_CHIPINFO_IOCTL, &chipinfo);
if (0==ret) {
if (wiringPiDebug) {
printf ("%s: name=%s, label=%s, lines=%u\n", szGPIOChip, chipinfo.name, chipinfo.label, chipinfo.lines) ;
printf("%s: name=%s, label=%s, lines=%u\n", szGPIOChip, chipinfo.name, chipinfo.label, chipinfo.lines) ;
}
int chipOK = 1;
if (label[0]!='\0' && NULL==strstr(chipinfo.label, label)) {
@@ -1688,10 +1688,12 @@ int OpenAndCheckGpioChip(int GPIONo, const char* label, const unsigned int lines
chipOK = 0;
}
if (chipOK) {
printf ("%s: valid, fd=%d\n", szGPIOChip, Fd);
if (wiringPiDebug) {
printf("%s: valid, fd=%d\n", szGPIOChip, Fd);
}
} else {
if (wiringPiDebug) {
printf ("%s: invalid, search for '%s' with %u lines!\n", szGPIOChip, label, lines) ;
printf("%s: invalid, search for '%s' with %u lines!\n", szGPIOChip, label, lines) ;
}
close(Fd);
return -1; // invalid chip
@@ -1710,7 +1712,7 @@ int wiringPiGpioDeviceGetFd() {
chipFd = OpenAndCheckGpioChip(4, "rp1", 54); // /dev/gpiochip4 @ Pi5 with older kernel
}
} else {
// not sure if all Pis have 54 lines (Pi1v1, Pi1v2 and CM ?), so this check is disabled
// not all Pis have same number of lines: Pi0, Pi1, Pi3, 54 lines, Pi4, 58 lines (CM ?), see #280, so this check is disabled
chipFd = OpenAndCheckGpioChip(0, "bcm", 0);
}
}


Зареждане…
Отказ
Запис