@@ -1138,7 +1138,7 @@ static void doVersion (char *argv []) | |||||
printf (" * root or sudo may be required for direct GPIO access.\n") ; | printf (" * root or sudo may be required for direct GPIO access.\n") ; | ||||
} | } | ||||
} | } | ||||
if (GetChipFd()>0) { | |||||
if (wiringPiGpioDeviceGetFd()>0) { | |||||
printf (" * Supports basic user-level GPIO access via /dev/gpiochip (slow).\n") ; | printf (" * Supports basic user-level GPIO access via /dev/gpiochip (slow).\n") ; | ||||
} | } | ||||
@@ -1503,7 +1503,7 @@ void pinEnableED01Pi (int pin) | |||||
const char DEV_GPIO_PI[] ="/dev/gpiochip0"; | const char DEV_GPIO_PI[] ="/dev/gpiochip0"; | ||||
const char DEV_GPIO_PI5[]="/dev/gpiochip4"; | const char DEV_GPIO_PI5[]="/dev/gpiochip4"; | ||||
int GetChipFd() { | |||||
int wiringPiGpioDeviceGetFd() { | |||||
if (chipFd<0) { | if (chipFd<0) { | ||||
piBoard(); | piBoard(); | ||||
const char* gpiochip = PI_MODEL_5 == RaspberryPiModel ? DEV_GPIO_PI5 : DEV_GPIO_PI; | const char* gpiochip = PI_MODEL_5 == RaspberryPiModel ? DEV_GPIO_PI5 : DEV_GPIO_PI; | ||||
@@ -1540,7 +1540,7 @@ int requestLine(int pin, unsigned int lineRequestFlags) { | |||||
} | } | ||||
//requested line | //requested line | ||||
if (GetChipFd()<0) { | |||||
if (wiringPiGpioDeviceGetFd()<0) { | |||||
return -1; // error | return -1; // error | ||||
} | } | ||||
rq.lineoffsets[0] = pin; | rq.lineoffsets[0] = pin; | ||||
@@ -2338,7 +2338,7 @@ int waitForInterruptInit (int pin, int mode) | |||||
/* open gpio */ | /* open gpio */ | ||||
sleep(1); | sleep(1); | ||||
if (GetChipFd()<0) { | |||||
if (wiringPiGpioDeviceGetFd()<0) { | |||||
return -1; | return -1; | ||||
} | } | ||||
@@ -3052,7 +3052,7 @@ int wiringPiSetupGpioDevice (enum WPIPinType pinType) { | |||||
if (getenv (ENV_CODES) != NULL) | if (getenv (ENV_CODES) != NULL) | ||||
wiringPiReturnCodes = TRUE ; | wiringPiReturnCodes = TRUE ; | ||||
if (GetChipFd()<0) { | |||||
if (wiringPiGpioDeviceGetFd()<0) { | |||||
return -1; | return -1; | ||||
} | } | ||||
wiringPiSetuped = TRUE ; | wiringPiSetuped = TRUE ; | ||||
@@ -216,7 +216,7 @@ enum WPIPinType { | |||||
}; | }; | ||||
extern void wiringPiVersion (int *major, int *minor) ; | extern void wiringPiVersion (int *major, int *minor) ; | ||||
extern int wiringPiGlobalMemoryAccess(void); //Interface V3.3 | |||||
extern int wiringPiGlobalMemoryAccess(void); //Interface V3.3 | |||||
extern int wiringPiUserLevelAccess (void) ; | extern int wiringPiUserLevelAccess (void) ; | ||||
extern int wiringPiSetup (void) ; | extern int wiringPiSetup (void) ; | ||||
extern int wiringPiSetupSys (void) ; | extern int wiringPiSetupSys (void) ; | ||||
@@ -225,7 +225,7 @@ extern int wiringPiSetupPhys (void) ; | |||||
extern int wiringPiSetupPinType (enum WPIPinType pinType); //Interface V3.3 | extern int wiringPiSetupPinType (enum WPIPinType pinType); //Interface V3.3 | ||||
extern int wiringPiSetupGpioDevice(enum WPIPinType pinType); //Interface V3.3 | extern int wiringPiSetupGpioDevice(enum WPIPinType pinType); //Interface V3.3 | ||||
extern int GetChipFd (); | |||||
extern int wiringPiGpioDeviceGetFd(); //Interface V3.3 | |||||
extern void pinModeAlt (int pin, int mode) ; | extern void pinModeAlt (int pin, int mode) ; | ||||
extern void pinMode (int pin, int mode) ; | extern void pinMode (int pin, int mode) ; | ||||
extern void pullUpDnControl (int pin, int pud) ; | extern void pullUpDnControl (int pin, int pud) ; | ||||