/*!
    @defgroup etmr_ic_driver eTMR Input Capture Driver (eTMR_IC)
    @ingroup etmr
    @details
    @brief eTMR Input Capture Peripheral Driver.

    ## Hardware background ##
    The eTMR of the YTM32B1L is based on a 16 bits counter and supports: input capture, output compare, PWM and some instances
    include quadrature decoder.

    ## How to use eTMR driver in your application ##
    For all operation modes (without Quadrature Decoder mode) the user need to configure etmr_user_config_t. This structure will be used for initialization
    (eTMR_DRV_Init). The next functions used are specific for each operation mode.

    ### Single edge input capture mode ###
    For this mode the user needs to configure parameters such: maximum counter value, number of channels, input capture operation mode
    (for single edge input are used edge detect mode) and edge alignment. All this information is included in the etmr_input_param_t structure.

    ## Integration guideline ##

    ### Compilation units ###

    The following files need to be compiled in the project:
    \verbatim
    ${SDK_PATH}\platform\drivers\src\etmr\etmr_ic_driver.c
    ${SDK_PATH}\platform\drivers\src\etmr\etmr_common.c
    ${SDK_PATH}\platform\drivers\src\etmr\etmr_hw_access.c
    \endverbatim

    ### Include path ###

    The following paths need to be added to the include path of the toolchain:
    \verbatim
    ${SDK_PATH}\platform\drivers\inc\
    ${SDK_PATH}\platform\drivers\src\etmr\
    \endverbatim

    ### Compile symbols ###

    No special symbols are required for this component

    ### Dependencies ###

    \ref clock_manager
    \ref interrupt_manager

   Example:
    @code
    /* The state structure of instance in the input capture mode */
    etmr_state_t stateInputCapture;
    #define eTMR_IC_INSTANCE        0UL
    /* Channels configuration structure for inputCapture input capture */
    etmr_input_ch_param_t inputCapture_InputCaptureChannelConfig[1] =
    {
        {
        0U,                             /* Channel Id */
        eTMR_EDGE_DETECT,                /* Input capture operation Mode */
        eTMR_RISING_EDGE,                /* Edge alignment Mode */
        eTMR_NO_MEASUREMENT,             /* Signal measurement operation type */
        0U,                             /* Filter value */
        false,                          /* Filter disabled */
        true                            /* Continuous mode measurement */
        NULL,                           /* Vector of callbacks  parameters for channels events */
        NULL                            /* Vector of callbacks for channels events */
        }
    };
    /* Input capture configuration for inputCapture */
    etmr_input_param_t inputCapture_InputCaptureConfig =
    {
        1U,                                     /* Number of channels */
        65535U,                                 /* Maximum count value */
        inputCapture_InputCaptureChannelConfig  /* Channels configuration */
    };
    /* Timer mode configuration for inputCapture */
    /* Global configuration of inputCapture */
    etmr_user_config_t  inputCapture_InitConfig =
    {
        {
            false,                      /* Software trigger state */
            false,                      /* Hardware trigger 1 state */
            false,                      /* Hardware trigger 2 state */
            false,                      /* Hardware trigger 3 state */
            false,                      /* Maximum loading point state */
            false,                      /* Min loading point state */
            eTMR_SYSTEM_CLOCK,           /* Update mode for INVCTRL register */
            eTMR_SYSTEM_CLOCK,           /* Update mode for SWOCTRL register */
            eTMR_SYSTEM_CLOCK,           /* Update mode for OUTMASK register */
            eTMR_SYSTEM_CLOCK,           /* Update mode for INIT register */
            false,                      /* Auto clear trigger state for hardware trigger */
            eTMR_UPDATE_NOW,             /* Select synchronization method */
        },
        eTMR_MODE_INPUT_CAPTURE,         /* Mode of operation for eTMR */
        eTMR_CLOCK_DIVID_BY_4,           /* eTMR clock pre-scaler */
        eTMR_CLOCK_SOURCE_SYSTEMCLK,     /* eTMR clock source */
        eTMR_BDM_MODE_00,                /* eTMR debug mode */
        false,                          /* Interrupt state */
        false                           /* Initialization trigger */
    };
    eTMR_DRV_Init(eTMR_IC_INSTANCE, &inputCapture_InitConfig, &stateInputCapture);
    eTMR_DRV_InitInputCapture(eTMR_IC_INSTANCE, &inputCapture_InputCaptureConfig);
    counter = eTMR_DRV_GetInputCaptureMeasurement(eTMR_IC_INSTANCE, 0UL);
    @endcode
   eTMR_DRV_GetInputCaptureMeasurement is now used in interrupt mode and this function is used to save time stamps
   in internal buffers.

   ### Edge-Aligned PWM and Input Capture mode ###
   - Support both Edge-Aligned PWM and Input Capture mode can work over the same eTMR instance.
   - The guideline can be found here \ref etmr_pwm_driver

*/
