void portableMasterCloseI2C(I2cBus* i2cBus) {
    if (i2cBus == NULL) {
        CloseI2C1();
    }
    else {
        unsigned portIndex = i2cBus->port;
        if (portIndex == I2C_BUS_PORT_1) {
            CloseI2C1();
        }
    #if defined _I2C2
        else if (portIndex == I2C_BUS_PORT_2) {
            CloseI2C2();
        }
    #endif
    #if defined _I2C3
        else if (portIndex == I2C_BUS_PORT_3) {
            // TODO : Throw Not Implemented
            // I2C3CONCLR = _I2C3CON_ON_MASK,
            // DisableIntSI2C3,
            // DisableIntMI2C3,
            // DisableIntBI2C3
        }
    #endif
    #if defined _I2C4
        else if (portIndex == I2C_BUS_PORT_4) {
            // TODO : Throw Not Implemented
            // I2C4CONCLR = _I2C4CON_ON_MASK,
            // mI2C4SIntEnable(0),
            // mI2C4MIntEnable(0),
            // mI2C1BIntEnable(0)
        }
    }
    #endif
}
/*
 * configures and starts incoming data communication
 * The incoming I2C uses MSSP2
 */
int setupIncoming() {

    int SLAVE_ADDRESS = 0x28; // the slave address
    // set pins RC14, RC15 as inputs
    TRISCbits.TRISC3 = 1; // SCL1
    ANSELCbits.ANSC3 = 0;

    TRISCbits.TRISC4 = 1; // SDA1
    ANSELCbits.ANSC4 = 0;

    // configure MSSP2 for i2c slave operation.
    CloseI2C2();
    OpenI2C2(SLAVE_7, SLEW_OFF);
    SSPADD = SLAVE_ADDRESS;
    return (1);
}