/*
 * exo_ahw_al_uart_conv.c
 *
 *  Created on: May 16, 2023
 *      Author: Invcuser_63
 */

//#include "exo_ahw_vdp_uart_conv_max14830.h"

#include "exo_ahw_al_uart_conv.h"
#include "exo_ahw_vdp_uart_conv_max14830.h"

#ifndef LINUX_TEMP_PORT
/**
 * @brief Mapping API to initializes the control block memory and do the basic configurations
 */
hal_ret_sts ahw_al_uart_conv_common_init(s_ahw_max14830_hdle *huart_conv)
{
	hal_ret_sts sts;

	switch(huart_conv->ahw_gen_info.ahw_inst_id)
	{
	case UART_EXPANDER_MAX14830_OBC:
	//case I2C_TO_UART:
		sts = ahw_vdp_uart_conv_init(huart_conv);
		break;
	default:
		sts = HAL_AH_INVLD_INST_ID;
	}
	return sts;
}

/**
 * @brief This API transmit the data
 */
hal_ret_sts ahw_al_uart_conv_common_init_intf(s_ahw_max14830_hdle *huart_conv,s_ahw_max14830_init_cfg *init_cfg)
{
	hal_ret_sts sts;

	switch(huart_conv->ahw_gen_info.ahw_inst_id)
	{
	case UART_EXPANDER_MAX14830_OBC:
		sts = ahw_vdp_uart_conv_init_intf(huart_conv,init_cfg);
		break;
	//case I2C_TO_UART:
		//break;
	default:
		sts = HAL_AH_INVLD_INST_ID;
	}
	return sts;
}

/**
 * @brief This API transmit the data
 */
hal_ret_sts ahw_al_uart_conv_common_transmit(s_ahw_max14830_hdle *huart_conv,uint8_t port,uint8_t *tx_buff,uint16_t tx_len)
{
	hal_ret_sts sts;

	switch(huart_conv->ahw_gen_info.ahw_inst_id)
	{
	case UART_EXPANDER_MAX14830_OBC:
		sts = ahw_vdp_uart_conv_transmit(huart_conv,port,tx_buff,tx_len);
		break;
	//case I2C_TO_UART:
		//break;
	default:
		sts = HAL_AH_INVLD_INST_ID;
	}
	return sts;
}

#if 1
/**
 * @brief This API transmit the data
 */
hal_ret_sts ahw_al_uart_conv_common_receive(s_ahw_max14830_hdle *huart_conv,uint8_t port,uint16_t rx_len,max14830_callback_fptr_t callback_func)
{
	hal_ret_sts sts;

	switch(huart_conv->ahw_gen_info.ahw_inst_id)
	{
	case UART_EXPANDER_MAX14830_OBC:
		sts = ahw_vdp_uart_conv_receive(huart_conv,port,rx_len,callback_func);
		break;
	//case I2C_TO_UART:
		//break;
	default:
		sts = HAL_AH_INVLD_INST_ID;
	}
	return sts;
}
#endif
#endif
