/**
 * @file hv_drv_Gpio.c
 * @brief gpio driver  layer file.
 * @details This file provides the following functions: \n
 *          (1) gpio pull up/down \n
 *          (2) gpio set direction \n
 *          (3) gpio set irq trigger mode/callback \n
 *          (4) gpio read irq state \n
 *          (5) gpio read level \n
 *
 * @author HiView SoC Software Team
 * @version 1.0.0
 * @date 2023-05-30
 * @copyright Copyright(c),2023-5, Hiview Software. All rights reserved.
 * @par History:
  */
#include "hv_drv_Gpio.h"

/**@brief Enable the designated gpio interrupt
 *  @param[in] ucPinIdx Specified GPIO pin
 */
VOID Hv_Drv_Gpio_EnableInt(UCHAR8 ucPinIdx)
{
    Hv_Cal_Gpio_EnableInt(ucPinIdx);
}

/**@brief Disable the designated gpio interrupt
 *  @param[in] ucPinIdx Specified GPIO pin
 */
VOID Hv_Drv_Gpio_DisableInt(UCHAR8 ucPinIdx)
{
    Hv_Cal_Gpio_DisableInt(ucPinIdx);
}

/**@brief Get interrupt state of designated gpio
 *  @param[in] ucPinIdx Specified GPIO pin
 */
BOOL Hv_Drv_Gpio_GetIntState(UCHAR8 ucPinIdx)
{
    return Hv_Drv_Gpio_GetIntState(ucPinIdx);
}

/**@brief Clear the gpio interrupt status
 *  @param[in]: ucPinIdx Specified GPIO pin
 */
VOID Hv_Drv_Gpio_ClrIntState(UCHAR8 ucPinIdx)
{
    Hv_Cal_Gpio_ClrIntState(ucPinIdx);
}

/**@brief Set gpio pin interrupt callback
 *  @param ucPinIdx Specified GPIO pin, pfCallBack Specified callback @ref GpioIntCallBack
 */
VOID Hv_Drv_Gpio_SetIntCallBack(UCHAR8 ucPinIdx, GpioIntCallBack pfCallBack)
{
    Hv_Cal_Gpio_SetIntCallBack(ucPinIdx, pfCallBack);
}

/**@brief Set gpio pin interrupt trigger type
 *  @param[in] ucPinIdx Specified GPIO pin, enPull Specified pull acion @ref GpioIntTrigMode
 */
VOID Hv_Drv_Gpio_SetIntTriggerMode(UCHAR8 ucPinIdx, GpioIntTrigMode enIntTrigMode)
{
    Hv_Cal_Gpio_SetIntTriggerMode(ucPinIdx, enIntTrigMode);
}

/** Set gpio pin interrupt callback
 *  @param[in/out] N/A
 */
VOID Hv_Drv_Gpio_CleanupInt(VOID)
{
    Hv_Cal_Gpio_CleanupInt();
}

/**@brief Set gpio pin direction
 *  @param[in] ucPinIdx Specified GPIO pin, enPull Specified pull acion @ref GpioDir
 */
VOID Hv_Drv_Gpio_SetDirection(UCHAR8 ucPinIdx, GpioDir enDir)
{
    Hv_Cal_Gpio_SetDirection(ucPinIdx, enDir);
}

/**@brief Get gpio pin direction
 *  @param[in] ucPinIdx Specified GPIO pin
 *  @param[out] @ref GpioDir
 */
GpioDir Hv_Drv_Gpio_GetDirection(UCHAR8 ucPinIdx)
{
    return Hv_Cal_Gpio_GetDirection(ucPinIdx);
}

/**@brief Set gpio pin level
 *  @param ucPinIdx Specified GPIO pin
 *  @param enLevel high(1) or low(0) level
 */
VOID Hv_Drv_Gpio_SetPinLevel(UCHAR8 ucPinIdx, GpioLevel enLevel)
{
    Hv_Cal_Gpio_SetPinLevel(ucPinIdx, enLevel);
}

/**@brief Get gpio pin out level
 *  @param[in]  :ucPinIdx Specified GPIO pin
 *  @param[out]: state high(1)/low(0)/invalid(2)
 */
GpioLevel Hv_Drv_Gpio_GetPinLevel(UCHAR8 ucPinIdx)
{
    return Hv_Cal_Gpio_GetPinLevel(ucPinIdx);
}