void TwoWire::begin(void) { // muxSelectI2c(0); if (onBeginCallback) onBeginCallback(); adapter_nr = 255; // if ((adapter_nr = i2c_getadapter(I2C2)) < 0) { // return; // } // if (BOARD == RUN_RASPBERRYPI) // { // adapter_nr = -1; // } // else if (BOARD == RUN_GALILEO) // { // adapter_nr = 0; // } // else // if (BOARD == RUN_EDISON) // { // adapter_nr = 6; // } // else // if (BOARD == RUN_BEAGLEBONE) // { // adapter_nr = 1; // } if ((i2c_fd = i2c_openadapter(adapter_nr)) < 0) { // printf ("i2c initialization problem\n"); return; } }
static void Wire1_Init(void) { if ((adapter_nr = i2c_getadapter(I2C1)) < 0) { return; } if ((i2c_fd = i2c_openadapter(adapter_nr)) < 0) { return; } }
void DFTwoWire::begin(void) { muxSelectI2c(0); if (onBeginCallback) onBeginCallback(); if(adapter_nr < 0){ if ((adapter_nr = i2c_getadapter(I2C2)) < 0) { return; } } if(i2c_fd < 0){ if ((i2c_fd = i2c_openadapter(1)) < 0) { return; } } }