#if defined(__PIC24F__)
#include <p24Fxxxx.h>
#endif
#include <i2c.h>
/*********************************************************************
*    Function Name:  CloseI2C2                                      
*    Description:    This routine disables the I2C2 module by 
*                    clearing the I2CEN bit in I2C2CON register.
*                    The MI2C2 and SI2C2 interrupts are disabled and 
*                    the corresponding IF flags are cleared
*    Parameters:     void                                   
*    Return Value:   void
*********************************************************************/

#ifdef _I2C_V2_2

void CloseI2C2(void)
{
    /* clear the I2CEN bit */
    I2C2CONbits.I2CEN = 0;

    /* clear the SI2C2 & MI2C2 Interrupt enable bits */
    IEC3bits.SI2C2IE = 0;
    IEC3bits.MI2C2IE = 0;

    /* clear the SI2C2 & MI2C2 Interrupt flag bits */
    IFS3bits.SI2C2IF = 0;
    IFS3bits.MI2C2IF = 0;
}

#else
#warning "Does not build on this target"
#endif
