/*!
 * @file        bmp561_eint.h
 *
 * @brief       This file contains all the functions prototypes for the EINT firmware library
 *
 * @version     V1.0.0
 *
 * @date        2025-01-01
 *
 * @attention
 *
 *  Copyright (C) 2025 Geehy Semiconductor
 *
 *  You may not use this file except in compliance with the
 *  GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
 *
 *  The program is only for reference, which is distributed in the hope
 *  that it will be useful and instructional for customers to develop
 *  their software. Unless required by applicable law or agreed to in
 *  writing, the program is distributed on an "AS IS" BASIS, WITHOUT
 *  ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions
 *  and limitations under the License.
 */

/* Define to prevent recursive inclusion */
#ifndef __BMP561_EINT_H
#define __BMP561_EINT_H

/* Includes */
#include "bmp561.h"

#ifdef __cplusplus
  extern "C" {
#endif

/** @addtogroup Peripherals_Library Standard Peripheral Library
  @{
*/

/** @addtogroup EINT_Driver EINT Driver
  @{
*/

/** @addtogroup EINT_Enumerations Enumerations
  @{
*/

/**
 * @brief    EINT port
 */
typedef enum
{
    EINT_PORT_0 = 0x00,    /*!< EINT0 */
    EINT_PORT_1 = 0x01,    /*!< EINT1 */
    EINT_PORT_2 = 0x02     /*!< EINT2 */
} EINT_PORT_T;

/**
 * @brief    EINT trigger enumeration
 */
typedef enum
{
    EINT_TRIGGER_HIGH    = 0x00,    /*!< High level */
    EINT_TRIGGER_LOW     = 0x01,    /*!< Low level */
    EINT_TRIGGER_RISING  = 0x02,    /*!< Rising edge */
    EINT_TRIGGER_FALLING = 0x03,    /*!< Falling edge */
    EINT_TRIGGER_DOUBLE  = 0x04     /*!< Double edges */
} EINT_TRIGGER_T;

/**
 * @brief    EINT filter
 */
typedef enum
{
    EINT_FILTER_0 = 0x00,    /*!< Filter 0 time */
    EINT_FILTER_1 = 0x01,    /*!< Filter 1 time */
    EINT_FILTER_2 = 0x02,    /*!< Filter 2 times */
    EINT_FILTER_3 = 0x03     /*!< Filter 3 times */
} EINT_FILTER_T;

/**
 * @brief    EINT clock divider
 */
typedef enum
{
    EINT_DIV_1 = 0x00,    /*!< Bypass */
    EINT_DIV_2 = 0x01,    /*!< 1/2 */
    EINT_DIV_4 = 0x02,    /*!< 1/4 */
    EINT_DIV_8 = 0x03     /*!< 1/8 */
} EINT_DIV_T;

/**@} end of group EINT_Enumerations */

/** @addtogroup EINT_Functions Functions
  @{
*/

void EINT_Reset(void);
void EINT_EnableModule(EINT_PORT_T line);
void EINT_DisableModule(EINT_PORT_T line);
void EINT_EnableSoftTrig(EINT_PORT_T line);
void EINT_DisableSoftTrig(EINT_PORT_T line);
void EINT_ConfigTrig(EINT_PORT_T line, EINT_TRIGGER_T trigger);
void EINT_ConfigFilter(EINT_PORT_T line, EINT_FILTER_T filter);
void EINT_ConfigClockDiv(EINT_PORT_T line, EINT_DIV_T div);
void EINT_EnableInterrupt(EINT_PORT_T line);
void EINT_DisableInterrupt(EINT_PORT_T line);
uint8_t EINT_ReadInterruptStatus(EINT_PORT_T line);
void EINT_ClearInterruptStatus(EINT_PORT_T line);

/**@} end of group EINT_Functions*/
/**@} end of group EINT_Driver*/
/**@} end of group Peripherals_Library*/

#ifdef __cplusplus
}
#endif

#endif /* __BMP561_EINT_H */
