/*************************************************  
  File name     : hal_interface_finger.c
  Module        : hal finger library interface
  Author        : Edwin.Xiao@anker.com
  Version       :
  Created on    : 2021-11-15
  Description   :
      Data structure and function definitions required by 
      the finger interface
    
  Modify History:   
  1. Date:        Author:         Modification:
  2021-11-15    Edwin.xiao         create
*************************************************/
#include "hal_product_config.h"
#include "hal_interface_finger.h"
#include "hal_interface.h"

#ifndef HAL_CFG_FINGER_TYPE
#error HAL_CFG_FINGER_TYPE undefined !!! Go to "hal_gernerate_product_config_h.sh" settings
#endif

#if (HAL_CFG_FINGER_TYPE ==  HAL_CFG_FINGER_TYPE_T31)

#elif (HAL_CFG_FINGER_TYPE ==  HAL_CFG_FINGER_TYPE_MCU)
#include "finger_mcu.h"
#endif

ST_HAL_FINGER_INTERFACE gHalFingerInterface[] = 
{
#if (HAL_CFG_FINGER_TYPE ==  HAL_CFG_FINGER_TYPE_T31)
        {
            .pfnInit             = NULL,
            .pfnDeinit           = NULL,
         },
#elif (HAL_CFG_FINGER_TYPE ==  HAL_CFG_FINGER_TYPE_MCU)
          {
            .pfnInit             = Mcu_Finger_Init,
            .pfnDeinit           = Mcu_Finger_Deinit,
         },
#endif
};

ST_HAL_FINGER_INTERFACE * HAL_Finger_GetInterface(int32_t Channel)
{
#if (HAL_CFG_FINGER_TYPE == HAL_TYPE_NONE)
    return NULL;
    
#else
    HAL_ITF_INDEX idx = HAL_SELF;

    if ( Channel == HAL_CHANNEL_SELF )
    {
        idx = HAL_SELF;
    }
    else
    {
        // 需要从NV获取通道号Channel对应的设备类型对应的hal
        //idx = HAL_REMOTE_SUB1G;
        return NULL;
    }
    return &gHalFingerInterface[idx];
#endif
}

