MCPcopy Create free account
hub / github.com/WiringPi/WiringPi / wiringPiI2CSetupInterface

Function wiringPiI2CSetupInterface

wiringPi/wiringPiI2C.c:236–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

234 */
235
236int wiringPiI2CSetupInterface (const char *device, int devId)
237{
238 int fd ;
239
240 if ((fd = open (device, O_RDWR)) < 0)
241 return wiringPiFailure (WPI_ALMOST, "Unable to open I2C device: %s\n", strerror (errno)) ;
242
243 if (ioctl (fd, I2C_SLAVE, devId) < 0)
244 return wiringPiFailure (WPI_ALMOST, "Unable to select I2C device: %s\n", strerror (errno)) ;
245
246 return fd ;
247}
248
249
250/*

Callers 1

wiringPiI2CSetupFunction · 0.85

Calls 1

wiringPiFailureFunction · 0.85

Tested by

no test coverage detected