| 234 | */ |
| 235 | |
| 236 | int 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 | /* |
no test coverage detected