/**
  ******************************************************************************
  * @file    ys32f030_vrefbuf.h
  * @author  YSPRING Application Team
  * @version V1.0.1
  * @date    2023.6.25
  * @brief   This file contains all the functions prototypes for the VREFBUF 
  *          firmware library.
  ******************************************************************************
  */

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

#ifdef __cplusplus
 extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "ys32f030.h"


/** @addtogroup YS32F030_StdPeriph_Driver
  * @{
  */

/** @addtogroup VREFBUF
  * @{
  */

/* Exported types ------------------------------------------------------------*/

typedef struct
{
  uint32_t vref_latency;		
  uint32_t vref_tmp;
  uint32_t vref_pllmull;
  uint32_t vref_pllsource;
  uint32_t vref_hsiClk;	
  uint32_t vref_hsiDiv;		
  uint32_t vref_hclk;		
  uint32_t vref_pclk;		
}Vref_ClocksTypeDef;	
  
/** @defgroup VREFBUF CONFIG 
  * @{
  */

#define VREFBUF_ADC_VREF          VREFBUF_CSR_VREF_SEL_VREF
#define VREFBUF_ADC_VCC           VREFBUF_CSR_VREF_SEL_VCC
#define VREFBUF_ADC_VREFBUF       VREFBUF_CSR_VREF_SEL_VREFBUF
#define IS_VREFBUF_ADC_CONFIG(ADC_CFG) (((ADC_CFG) == VREFBUF_ADC_VREF) || \
                                        ((ADC_CFG) == VREFBUF_ADC_VCC)  || \
                                        ((ADC_CFG) == VREFBUF_ADC_VREFBUF))
                            
#define IS_VREFBUF_TRIM_VALUE(VALUE) ((VALUE) <= 0x7)
/**
  * @}
  */

/* Exported functions ------------------------------------------------------- */ 
void VREFBUF_Cmd(FunctionalState NewState);
void VREFBUF_ADC_Config(uint32_t VrefConfig);
void VREFBUF_Trim(uint32_t Value);
  
#ifdef __cplusplus
}
#endif

#endif /* __YS32F030_VREFBUF_H */

/**
  * @}
  */

/**
  * @}
  */
