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

#ifdef _ICAP4
/*******************************************************************************
* Function Name:  OpenCapture4                                                 *
* Description:    This routine include configuring clock ,                     *
*                 number of capture per interrupt ,capture mode                *
* Parameters:     unsigned int config                                          *
*                 bit[15:14] Unused                                            *
*                 bit[13]    ICSIDL : Input Capture x Stop in Idle Control bit *
*                 bit[12:8]  Unused                                            *
*                 bit[7]     ICTMR: Input Capture x Timer Select bit(1)        *
*                            1 = TMR2 contents are captured on capture event   *
*                            0 = TMR3 contents are captured on capture event   *
*                 bit[6:5]   ICI<1:0>: Select Number of Captures per Interrupt *
*                            11 = Interrupt on every fourth capture event      *
*                            10 = Interrupt on every third capture event       *
*                            01 = Interrupt on every second capture event      *
*                            00 = Interrupt on every capture event             *
*                 bit[4]     ICOV: Input Capture x Overflow Status Flag bit    *
*                                 (read-only)                                  *
*                            1 = Input capture overflow occurred               *
*                            0 = No input capture overflow occurred            *
*                 bit[3]     ICBNE: Input Capture x Buffer Empty Status bit    *
*                                   (read-only)                                *
*                            1 = Input capture buffer is not empty, at least   *
*                                one more capture value can be read            *
*                            0 = Input capture buffer is empty                 *
*                 bit[2:0]   ICM<2:0>: Input Capture x Mode Select bits        *
*                            111 = Input capture functions as interrupt pin    *
*                                  only when device is in Sleep or Idle mode   *
*                            110 = Unused (module disabled)                    *
*                            101 = Capture mode, every 16th rising edge        *
*                            100 = Capture mode, every 4th rising edge         *
*                            011 = Capture mode, every rising edge             *
*                            010 = Capture mode, every falling edge            *
*                            001 = Capture mode, every edge – rising and       *
*                                  falling (the ICI<1:0> bits do not control   *
*                                  interrupt generation for this mode)         *
*                            000 = Input capture module turned off             *
* Return Value:   None                                                         *
********************************************************************************/

void OpenCapture4( unsigned int config)
{
    /* Config contains Clock source, number of Captures per interuppt
                                    and Capture Mode */
    IC4CON = config;  
}

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