/*
 * @file exo_io_al_stm32f7xx_adc.h
 *
 * @brief This file contains structures,enumerations
 * and function declaration for ADC interface
 *
 * @copyright Copyright 2023 Antaris, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef DRIVERS_EXO_HAL_DRIVER_FW_EXO_IO_AL_DRIVER_API_EXO_IO_AL_WRAPPER_EXO_IO_AL_STM32F7XX_ADC_INC_EXO_IO_AL_STM32F7XX_ADC_H_
#define DRIVERS_EXO_HAL_DRIVER_FW_EXO_IO_AL_DRIVER_API_EXO_IO_AL_WRAPPER_EXO_IO_AL_STM32F7XX_ADC_INC_EXO_IO_AL_STM32F7XX_ADC_H_
#include <stdint.h>
#include "exo_types.h"
#include "exo_hal_common.h"
#include "exo_io_al_common.h"
#include "exo_io_al_adc_common.h"



/* Prototype Definitions */
/**
 * @brief  This function initializes the ADC peripheral according to the specified
 *         parameters
 */
hal_ret_sts io_hal_stm32f7xx_adc_init(ioal_adc_hdle *ioal_hadc);

/**
 * @brief  This function starts the ADC interface.
 * @param[in]  ioal_hadc - ioal_hadc pointer to a ioal_adc_hdle structure that contains
 *         the configuration information for the specified ADC.
 * @retval HAL status
 */
hal_ret_sts io_hal_stm32f7xx_adc_start (ioal_adc_hdle *ioal_hadc);

/**
 * @brief  This function stop the ADC interface.
 * @param[in]  ioal_hadc - ioal_hadc pointer to a ioal_adc_hdle structure that contains
 *         the configuration information for the specified ADC.
 * @retval HAL status
 */
hal_ret_sts io_hal_stm32f7xx_adc_stop (ioal_adc_hdle *ioal_hadc);

/**
 * @brief This function used to PollForConversion
 * @param[in] ioal_hadc - ioal_hadc pointer to a ioal_adc_hdle structure that contains
 * @param[in] timeout - timeout duration
 * @retval HAL status
 */
hal_ret_sts io_hal_stm32f7xx_adc_pollforconversion (ioal_adc_hdle *ioal_hadc, uint32_t Timeout);

/**
 * @brief This function used to Pollforevent
 * @param[in] ioal_hadc - ioal_hadc pointer to a ioal_adc_hdle structure that contains
 * @param[in] ioal_hadc - EventType the ADC event type.
 * @param[in] timeout   - timeout duration
 * @retval HAL status
 */
hal_ret_sts io_hal_stm32f7xx_adc_pollforevent(ioal_adc_hdle *ioal_hadc, uint32_t EventType, uint32_t Timeout);

/**
 * @brief  This function start_it in ADC.
 * @param[in]  ioal_hadc - ioal_hadc pointer to a ioal_adc_hdle structure that contains
 *         the configuration information for the specified ADC.
 * @retval HAL status
 */
hal_ret_sts io_hal_stm32f7xx_adc_start_it(ioal_adc_hdle *ioal_hadc);

/**
 * @brief  This function stop_it in ADC.
 * @param[in]  ioal_hadc - ioal_hadc pointer to a ioal_adc_hdle structure that contains
 *         the configuration information for the specified ADC.
 * @retval HAL status
 */
hal_ret_sts io_hal_stm32f7xx_adc_stop_it(ioal_adc_hdle *ioal_hadc);

/**
 * @brief This function start the DMA mode
 * @param[in] ioal_hadc - ioal_hadc pointer to a ioal_adc_hdle structure that contains
 * 							the configuration information for ADC.
 * @param[out]pdata - pointer to a data
 * @param[in] Length - size of the data
 * @retval HAL status
 */
hal_ret_sts io_hal_stm32f7xx_adc_start_dma(ioal_adc_hdle *ioal_hadc, uint32_t* pData, uint32_t Length);

/**
 * @brief This function stop the DMA mode.
 * @param[in] ioal_hadc - ioal_hadc pointer to a ioal_adc_hdle structure that contains
 * 							the configuration information for ADC.
 * @retval HAL status
 */
hal_ret_sts io_hal_stm32f7xx_adc_stop_dma(ioal_adc_hdle *ioal_hadc);

/**
 * @brief  This function get the ADC value state.
 * @param[in] ioal_hadc - ioal_hadc pointer to a ioal_adc_hdle structure that contains
 *         the configuration information for the specified ADC.
 * @retval HAL state
 */
uint32_t io_hal_stm32f7xx_adc_getvalue(ioal_adc_hdle *ioal_hadc);

/**
 * @brief This function config the channel.
 * @param[in] ioal_hadc - ioal_hadc pointer to a ioal_adc_hdle structure that contains
 * 						the configuration information for ADC.
 * @param[in]sconfig - sConfig ADC configuration structure.
 * @retval HAL status
 */
hal_ret_sts io_hal_stm32f7xx_adc_configchannel(ioal_adc_hdle *ioal_hadc, adc_channelconftypedef* sconfig);

/**
 * @brief This function configures the analog watchdog in ADC.
 * @param[in] ioal_hadc - ioal_hadc pointer to a ioal_adc_hdle structure that contains
 * 						the configuration information for ADC.
 * @param[in]sconfig - sconfig contains the configuration information of ADC analog watchdog.
 * @retval HAL status
 */
hal_ret_sts io_hal_stm32f7xx_adc_analogwdgconfig(ioal_adc_hdle *ioal_hadc, adc_channelconftypedef* sconfig);

/**
 * @brief API to get the ADC state.
 * @param[in] ioal_hadc - ioal_hadc pointer to a ioal_adc_hdle structure that contains
 * 							the configuration information for ADC.
 * @retval ADC State
 */
hal_ret_sts io_hal_stm32f7xx_adc_getstate(ioal_adc_hdle *ioal_hadc);

/**
 * @brief  This function get the ADC error state.
 * @param[in] ioal_hadc - ioal_hadc pointer to a ioal_adc_hdle structure that contains
 *         the configuration information for the specified ADC.
 * @retval HAL state
 */
hal_ret_sts io_hal_stm32f7xx_adc_geterror(ioal_adc_hdle *ioal_hadc);

/* API Mapping */
#define io_hal_common_adc_init                     io_hal_stm32f7xx_adc_init
#define io_hal_common_adc_start	                   io_hal_stm32f7xx_adc_start
#define io_hal_common_adc_stop                     io_hal_stm32f7xx_adc_stop
#define io_hal_common_adc_pollforconversion        io_hal_stm32f7xx_adc_pollforconversion
#define io_hal_common_adc_pollforevent             io_hal_stm32f7xx_adc_pollforevent
#define io_hal_common_adc_start_it                 io_hal_stm32f7xx_adc_start_it

#define io_hal_common_adc_stop_it                  io_hal_stm32f7xx_adc_stop_it
#define io_hal_common_adc_start_dma                io_hal_stm32f7xx_adc_start_dma
#define io_hal_common_adc_stop_dma                 io_hal_stm32f7xx_adc_stop_dma
#define io_hal_common_adc_getvalue                 io_hal_stm32f7xx_adc_getvalue

#define io_hal_common_adc_configchannel            io_hal_stm32f7xx_adc_configchannel
#define io_hal_common_adc_analogwdgconfig          io_hal_stm32f7xx_adc_analogwdgconfig
#define io_hal_common_adc_getstate                 io_hal_stm32f7xx_adc_getstate
#define io_hal_common_adc_geterror                 io_hal_stm32f7xx_adc_geterror


#endif /* DRIVERS_EXO_HAL_DRIVER_FW_EXO_IO_AL_DRIVER_API_EXO_IO_AL_WRAPPER_EXO_IO_AL_STM32F7XX_ADC_INC_EXO_IO_AL_STM32F7XX_ADC_H_ */
