/*************************************************  
  File name     : hal_interface_radar_sensor.c
  Module        : hal radar_sensor library interface
  Author        : weipeng.li
  Version       :
  Created on    : 2021-05-24
  Description   :
      Data structure and function definitions required by 
      the radar_sensor interface
    
  Modify History:   
  1. Date:        Author:         Modification:
  2021-05-24     weipeng.li         create
*************************************************/
#include "pal.h"
#include "hal_product_config.h"
#include "hal_interface_radar_sensor.h"

#ifndef HAL_CFG_RADAR_SENSOR_TYPE
#define HAL_CFG_RADAR_SENSOR_TYPE   HAL_TYPE_NONE
#endif

#if (HAL_CFG_RADAR_SENSOR_TYPE ==  HAL_CFG_RADAR_SENSOR_TYPE_MCU)
#include "radar_sensor_mcu.h"
#endif

#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */

static ST_HAL_RADAR_SENSOR_INTERFACE gHalRadarSensorInterface[] =
{
    #if (HAL_CFG_RADAR_SENSOR_TYPE ==  HAL_CFG_RADAR_SENSOR_TYPE_MCU)
	{
        .pfnInit = Mcu_RadarSensor_Init,
        .pfnDeinit = Mcu_RadarSensor_Deinit,
        .pfnSetEnable = Mcu_RadarSensor_SetEnable,
        .pfnGetEnable = Mcu_RadarSensor_GetEnable,
        .pfnSetTrigerDistance = Mcu_RadarSensor_SetTrigerDistance,
        .pfnGetTrigerDistance = Mcu_RadarSensor_GetTrigerDistance,
        .pfnGetObjectDistance = Mcu_RadarSensor_GetObjectDistance,
        .pfnSetBlockEnable = Mcu_RadarSensor_SetBlockEnable,
        .pfnSetWanderDetectParam = Mcu_RadarSensor_SetWanderDetectParam,
    }
    #endif
};


ST_HAL_RADAR_SENSOR_INTERFACE * HAL_RadarSensor_GetInterface(int32_t Channel)
{
#if (HAL_CFG_RADAR_SENSOR_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 &gHalRadarSensorInterface[idx];
#endif
}

#ifdef __cplusplus
}
#endif /* __cplusplus */


