#if defined(__PIC24F__)
#include <p24Fxxxx.h>
#endif
#include <incap.h>


#ifdef _ICAP2
/********************************************************************
*    Function Name:  ConfigIntCapture2                              *
*    Description:    Set the Enable Interrupts and Interrupt        *
*                    Priorites  to the Interrupt Control and        *
*                    Interrupt Priority Register respectively       *
*    Parameters:     unsigned int config                            *
*                    config[0:2]  -> priority setting               *
*                    config[3]    -> Interrupt Enable/Disable       *
*                    config[4:15] -> unsused                        *
*    Return Value:   None                                           *
********************************************************************/

void ConfigIntCapture2(unsigned int config)
{
    IFS0bits.IC2IF = 0;                     /* Clear IF bit */
    IPC1bits.IC2IP = (config &0x0007);      /* assigning Interrupt Priority
                                             to IPC Control REgister */
    IEC0bits.IC2IE = (config &0x0008) >> 3; /* assiging InputCapture Enable/
                                              Disable bit of IEC Register*/
}

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