/**
  ******************************************************************************
  * @file    ioctrl_hal.h
  * @author  Product application department
  * @version V1.0
  * @date    2020.03.19
  * @brief   Header file of IOCTRL HAL module.
  * 
  ******************************************************************************
  */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __IOCTRL_HAL_H
#define __IOCTRL_HAL_H

#ifdef __cplusplus
extern "C"
{
#endif

/* Includes ------------------------------------------------------------------*/
#include "type.h"
#include "hal_def.h"
#include "ioctrl_drv.h"

/**@defgroup HAL HAL driver
  *
  *@{
  */

/** @defgroup HAL_IOCTRL IOCTRL
  *
  *@{
  */

/*** 宏定义 *******************************************************************/
/** @defgroup IOCTRL_Exported_Macros Exported Macros
  *
  * @{
  */
  #define _IOCTRL_CLKOUT_SWAP_EN    _ioctrl_clkrstcr_clkout_en
  #define _IOCTRL_CLKOUT_SWAP_DIS   _ioctrl_clkrstcr_clkout_dis
  #define _IOCTRL_RSTOUT_SWAP_EN    _ioctrl_clkrstcr_rstout_en
  #define _IOCTRL_RSTOUT_SWAP_DIS   _ioctrl_clkrstcr_rstout_dis

  /**
  * @}
  */

  /*** 结构体、枚举变量定义 *****************************************************/
  /** @defgroup IOCTRL_Exported_Types Exported Types
  *
  * @{
  */

  /**
 * @brief IOCTRL SPI初始化结构体定义
 *
 */
  typedef struct
  {
    IOCTRL_SPIIDTypeDef id;
    IOCTRL_DSTypeDef ds;
    IOCTRL_SRTypeDef sr;
    IOCTRL_ISTypeDef is;
    IOCTRL_PSTypeDef ps;
    IOCTRL_IETypeDef ie;
    uint8_t pins;

  } IOCTRL_SPIInitTypeDef;

  /**
 * @brief IOCTRL USI初始化结构体定义
 *
 */
  typedef struct
  {
    IOCTRL_USIIDTypeDef id;
    IOCTRL_DSTypeDef ds;
    IOCTRL_SRTypeDef sr;
    IOCTRL_ISTypeDef is;
    IOCTRL_PSTypeDef ps;
    FunctionalState puen_status;
    FunctionalState dien_status;
    FunctionalState dren_status;
    uint8_t pins;

  } IOCTRL_USIInitTypeDef;

  /**
 * @brief IOCTRL I2C初始化结构体定义
 *
 */
  typedef struct
  {
    IOCTRL_I2CIDTypeDef id;
    IOCTRL_DSTypeDef ds;
    IOCTRL_SRTypeDef sr;
    IOCTRL_ISTypeDef is;
    IOCTRL_PSTypeDef ps;
    IOCTRL_IETypeDef ie;
    uint8_t pins;
  } IOCTRL_I2CInitTypeDef;

  /**
 * @brief IOCTRL UART初始化结构体定义
 *
 */
  typedef struct
  {
    IOCTRL_UARTIDTypeDef id;
    IOCTRL_DSTypeDef ds;
    IOCTRL_SRTypeDef sr;
    IOCTRL_ISTypeDef is;
    IOCTRL_PSTypeDef ps;
    uint8_t pins;
  } IOCTRL_UARTInitTypeDef;

  /**
 * @brief IOCTRL GINT初始化结构体定义
 *
 */
  typedef struct
  {
    IOCTRL_GINTIDTypeDef id;
    IOCTRL_DSTypeDef ds;
    IOCTRL_SRTypeDef sr;
    IOCTRL_ISTypeDef is;
    IOCTRL_PSTypeDef ps;
    IOCTRL_IETypeDef ie;
    uint8_t pins;
  } IOCTRL_GINTInitTypeDef;

  /**
 * @brief IOCTRL UARTSwap结构体定义
 *
 */
  typedef struct
  {
    uint8_t pins;
    IOCTRL_UARTSwapGintENTypeDef swap;
  } IOCTRL_UARTSwapTypeDef;

  /**
 * @brief IOCTRL SSI初始化结构体定义
 *
 */
  typedef struct
  {
    IOCTRL_SSIIDTypeDef id;
    IOCTRL_DSTypeDef ds;
    IOCTRL_SRTypeDef sr;
    IOCTRL_ISTypeDef is;
    IOCTRL_PUETypeDef pue;
    IOCTRL_ODETypeDef ode;
    IOCTRL_PSTypeDef ps;
    IOCTRL_IETypeDef ie;
    uint8_t pins;
  } IOCTRL_SSIInitTypeDef;

  /**
  * @}
  */

  /*** 全局变量声明 **************************************************************/
  /** @defgroup IOCTRL_Exported_Variables Exported Variables
  *
  * @{
  */

  /**
  * @}
  */

  /*** 函数声明 ******************************************************************/
  /** @defgroup IOCTRL_Exported_Functions Exported Functions
  * @{
  */
  extern HAL_StatusTypeDef HAL_IOCTRL_SPIInit(IOCTRL_SPIInitTypeDef *pIOSPIInit);
  extern HAL_StatusTypeDef HAL_IOCTRL_USIInit(IOCTRL_USIInitTypeDef *pIOUSIInit);
  extern HAL_StatusTypeDef HAL_IOCTRL_I2CInit(IOCTRL_I2CInitTypeDef *pIOI2CInit);
  extern HAL_StatusTypeDef HAL_IOCTRL_UARTInit(IOCTRL_UARTInitTypeDef *pIOUARTInit);
  extern HAL_StatusTypeDef HAL_IOCTRL_UARTSwapGint(IOCTRL_UARTSwapTypeDef *pUARTSwap);
  extern HAL_StatusTypeDef HAL_IOCTRL_GINTIint(IOCTRL_GINTInitTypeDef *pIOGINTInit);
  extern HAL_StatusTypeDef HAL_IOCTRL_SSIIint(IOCTRL_SSIInitTypeDef *pIOSSIInit);
  extern void HAL_IOCTRL_Swap(IOCTRL_SwapTypeDef pSwap, FunctionalState status);
	extern void HAL_IOCTRL_Swapint(IOCTRL_SwapTypeDef pSwap,FunctionalState status);
	extern void HAL_IOCTRL_SwapintDIS(void);
  /**
  * @}
  */

  /**
  *@}
  */

  /**
  *@}
  */

#ifdef __cplusplus
}
#endif

#endif /* __IOCTRL_HAL_H */

