Format adc headers
This commit is contained in:
@@ -70,7 +70,7 @@ void start_adc_tip(void) {
|
|||||||
// The ADC has a 32 sample FiFo; we set this up to fire and interrupt at 16 samples
|
// The ADC has a 32 sample FiFo; we set this up to fire and interrupt at 16 samples
|
||||||
// Then using that IRQ to know that sampling is done and can be stored
|
// Then using that IRQ to know that sampling is done and can be stored
|
||||||
ADC_Stop();
|
ADC_Stop();
|
||||||
ADC_Scan_Channel_Config((ADC_Chan_Type *)adc_tip_pos_chans, (ADC_Chan_Type *)adc_tip_neg_chans, 2, ENABLE);
|
ADC_Scan_Channel_Config((ADC_Chan_Type *)adc_tip_pos_chans, (ADC_Chan_Type *)adc_tip_neg_chans, 1, ENABLE);
|
||||||
ADC_Start();
|
ADC_Start();
|
||||||
}
|
}
|
||||||
const ADC_Chan_Type adc_misc_pos_chans[] = {TMP36_ADC_CHANNEL, VIN_ADC_CHANNEL};
|
const ADC_Chan_Type adc_misc_pos_chans[] = {TMP36_ADC_CHANNEL, VIN_ADC_CHANNEL};
|
||||||
|
|||||||
@@ -37,8 +37,9 @@
|
|||||||
#define __BL702_ADC_H__
|
#define __BL702_ADC_H__
|
||||||
|
|
||||||
#include "aon_reg.h"
|
#include "aon_reg.h"
|
||||||
#include "gpip_reg.h"
|
|
||||||
#include "bl702_common.h"
|
#include "bl702_common.h"
|
||||||
|
#include "gpip_reg.h"
|
||||||
|
|
||||||
|
|
||||||
/** @addtogroup BL702_Peripheral_Driver
|
/** @addtogroup BL702_Peripheral_Driver
|
||||||
* @{
|
* @{
|
||||||
@@ -235,8 +236,7 @@ typedef enum {
|
|||||||
/**
|
/**
|
||||||
* @brief ADC mic type definition
|
* @brief ADC mic type definition
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
ADC_MICBOOST_DB_Type micboostDb; /*!< MIC boost db */
|
ADC_MICBOOST_DB_Type micboostDb; /*!< MIC boost db */
|
||||||
ADC_PGA2_GAIN_Type micPga2Gain; /*!< MIC pga2 gain */
|
ADC_PGA2_GAIN_Type micPga2Gain; /*!< MIC pga2 gain */
|
||||||
ADC_MIC_MODE_Type mic1Mode; /*!< MIC1 single or diff */
|
ADC_MIC_MODE_Type mic1Mode; /*!< MIC1 single or diff */
|
||||||
@@ -250,8 +250,7 @@ typedef struct
|
|||||||
/**
|
/**
|
||||||
* @brief ADC configuration type definition
|
* @brief ADC configuration type definition
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
ADC_V18_SEL_Type v18Sel; /*!< ADC 1.8V select */
|
ADC_V18_SEL_Type v18Sel; /*!< ADC 1.8V select */
|
||||||
ADC_V11_SEL_Type v11Sel; /*!< ADC 1.1V select */
|
ADC_V11_SEL_Type v11Sel; /*!< ADC 1.1V select */
|
||||||
ADC_CLK_Type clkDiv; /*!< Clock divider */
|
ADC_CLK_Type clkDiv; /*!< Clock divider */
|
||||||
@@ -270,8 +269,7 @@ typedef struct
|
|||||||
/**
|
/**
|
||||||
* @brief ADC configuration type definition
|
* @brief ADC configuration type definition
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
int8_t posChan; /*!< Positive channel */
|
int8_t posChan; /*!< Positive channel */
|
||||||
int8_t negChan; /*!< Negative channel */
|
int8_t negChan; /*!< Negative channel */
|
||||||
uint16_t value; /*!< ADC value */
|
uint16_t value; /*!< ADC value */
|
||||||
@@ -304,8 +302,7 @@ typedef enum {
|
|||||||
/**
|
/**
|
||||||
* @brief ADC FIFO configuration structure type definition
|
* @brief ADC FIFO configuration structure type definition
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
ADC_FIFO_Threshold_Type fifoThreshold; /*!< ADC FIFO threshold */
|
ADC_FIFO_Threshold_Type fifoThreshold; /*!< ADC FIFO threshold */
|
||||||
BL_Fun_Type dmaEn; /*!< ADC DMA enable */
|
BL_Fun_Type dmaEn; /*!< ADC DMA enable */
|
||||||
} ADC_FIFO_Cfg_Type;
|
} ADC_FIFO_Cfg_Type;
|
||||||
@@ -313,8 +310,7 @@ typedef struct
|
|||||||
/**
|
/**
|
||||||
* @brief ADC REG GAIN CAL
|
* @brief ADC REG GAIN CAL
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
BL_Fun_Type adcGainCoeffEnable; /*!< ADC_Gain_Coeff enable */
|
BL_Fun_Type adcGainCoeffEnable; /*!< ADC_Gain_Coeff enable */
|
||||||
uint16_t adcgainCoeffVal; /*!< ADC_Gain_Coeff value */
|
uint16_t adcgainCoeffVal; /*!< ADC_Gain_Coeff value */
|
||||||
float coe; /*!< ADC_Gain_Coeff result */
|
float coe; /*!< ADC_Gain_Coeff result */
|
||||||
@@ -329,169 +325,106 @@ typedef struct
|
|||||||
/** @defgroup ADC_CHAN_TYPE
|
/** @defgroup ADC_CHAN_TYPE
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define IS_ADC_CHAN_TYPE(type) (((type) == ADC_CHAN0) || \
|
#define IS_ADC_CHAN_TYPE(type) \
|
||||||
((type) == ADC_CHAN1) || \
|
(((type) == ADC_CHAN0) || ((type) == ADC_CHAN1) || ((type) == ADC_CHAN2) || ((type) == ADC_CHAN3) || ((type) == ADC_CHAN4) || ((type) == ADC_CHAN5) || ((type) == ADC_CHAN6) \
|
||||||
((type) == ADC_CHAN2) || \
|
|| ((type) == ADC_CHAN7) || ((type) == ADC_CHAN8) || ((type) == ADC_CHAN9) || ((type) == ADC_CHAN10) || ((type) == ADC_CHAN11) || ((type) == ADC_CHAN_DAC_OUTA) || ((type) == ADC_CHAN_DAC_OUTB) \
|
||||||
((type) == ADC_CHAN3) || \
|
|| ((type) == ADC_CHAN_TSEN_P) || ((type) == ADC_CHAN_TSEN_N) || ((type) == ADC_CHAN_VREF) || ((type) == ADC_CHAN_DCTEST) || ((type) == ADC_CHAN_VABT_HALF) || ((type) == ADC_CHAN_SENP3) \
|
||||||
((type) == ADC_CHAN4) || \
|
|| ((type) == ADC_CHAN_SENP2) || ((type) == ADC_CHAN_SENP1) || ((type) == ADC_CHAN_SENP0) || ((type) == ADC_CHAN_GND))
|
||||||
((type) == ADC_CHAN5) || \
|
|
||||||
((type) == ADC_CHAN6) || \
|
|
||||||
((type) == ADC_CHAN7) || \
|
|
||||||
((type) == ADC_CHAN8) || \
|
|
||||||
((type) == ADC_CHAN9) || \
|
|
||||||
((type) == ADC_CHAN10) || \
|
|
||||||
((type) == ADC_CHAN11) || \
|
|
||||||
((type) == ADC_CHAN_DAC_OUTA) || \
|
|
||||||
((type) == ADC_CHAN_DAC_OUTB) || \
|
|
||||||
((type) == ADC_CHAN_TSEN_P) || \
|
|
||||||
((type) == ADC_CHAN_TSEN_N) || \
|
|
||||||
((type) == ADC_CHAN_VREF) || \
|
|
||||||
((type) == ADC_CHAN_DCTEST) || \
|
|
||||||
((type) == ADC_CHAN_VABT_HALF) || \
|
|
||||||
((type) == ADC_CHAN_SENP3) || \
|
|
||||||
((type) == ADC_CHAN_SENP2) || \
|
|
||||||
((type) == ADC_CHAN_SENP1) || \
|
|
||||||
((type) == ADC_CHAN_SENP0) || \
|
|
||||||
((type) == ADC_CHAN_GND))
|
|
||||||
|
|
||||||
/** @defgroup ADC_V18_SEL_TYPE
|
/** @defgroup ADC_V18_SEL_TYPE
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define IS_ADC_V18_SEL_TYPE(type) (((type) == ADC_V18_SEL_1P62V) || \
|
#define IS_ADC_V18_SEL_TYPE(type) (((type) == ADC_V18_SEL_1P62V) || ((type) == ADC_V18_SEL_1P72V) || ((type) == ADC_V18_SEL_1P82V) || ((type) == ADC_V18_SEL_1P92V))
|
||||||
((type) == ADC_V18_SEL_1P72V) || \
|
|
||||||
((type) == ADC_V18_SEL_1P82V) || \
|
|
||||||
((type) == ADC_V18_SEL_1P92V))
|
|
||||||
|
|
||||||
/** @defgroup ADC_V11_SEL_TYPE
|
/** @defgroup ADC_V11_SEL_TYPE
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define IS_ADC_V11_SEL_TYPE(type) (((type) == ADC_V11_SEL_1P0V) || \
|
#define IS_ADC_V11_SEL_TYPE(type) (((type) == ADC_V11_SEL_1P0V) || ((type) == ADC_V11_SEL_1P1V) || ((type) == ADC_V11_SEL_1P18V) || ((type) == ADC_V11_SEL_1P26V))
|
||||||
((type) == ADC_V11_SEL_1P1V) || \
|
|
||||||
((type) == ADC_V11_SEL_1P18V) || \
|
|
||||||
((type) == ADC_V11_SEL_1P26V))
|
|
||||||
|
|
||||||
/** @defgroup ADC_CLK_TYPE
|
/** @defgroup ADC_CLK_TYPE
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define IS_ADC_CLK_TYPE(type) (((type) == ADC_CLK_DIV_1) || \
|
#define IS_ADC_CLK_TYPE(type) \
|
||||||
((type) == ADC_CLK_DIV_4) || \
|
(((type) == ADC_CLK_DIV_1) || ((type) == ADC_CLK_DIV_4) || ((type) == ADC_CLK_DIV_8) || ((type) == ADC_CLK_DIV_12) || ((type) == ADC_CLK_DIV_16) || ((type) == ADC_CLK_DIV_20) \
|
||||||
((type) == ADC_CLK_DIV_8) || \
|
|| ((type) == ADC_CLK_DIV_24) || ((type) == ADC_CLK_DIV_32))
|
||||||
((type) == ADC_CLK_DIV_12) || \
|
|
||||||
((type) == ADC_CLK_DIV_16) || \
|
|
||||||
((type) == ADC_CLK_DIV_20) || \
|
|
||||||
((type) == ADC_CLK_DIV_24) || \
|
|
||||||
((type) == ADC_CLK_DIV_32))
|
|
||||||
|
|
||||||
/** @defgroup ADC_DELAY_SEL_TYPE
|
/** @defgroup ADC_DELAY_SEL_TYPE
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define IS_ADC_DELAY_SEL_TYPE(type) (((type) == ADC_DELAY_SEL_0) || \
|
#define IS_ADC_DELAY_SEL_TYPE(type) \
|
||||||
((type) == ADC_DELAY_SEL_1) || \
|
(((type) == ADC_DELAY_SEL_0) || ((type) == ADC_DELAY_SEL_1) || ((type) == ADC_DELAY_SEL_2) || ((type) == ADC_DELAY_SEL_3) || ((type) == ADC_DELAY_SEL_4) || ((type) == ADC_DELAY_SEL_5) \
|
||||||
((type) == ADC_DELAY_SEL_2) || \
|
|| ((type) == ADC_DELAY_SEL_6) || ((type) == ADC_DELAY_SEL_7))
|
||||||
((type) == ADC_DELAY_SEL_3) || \
|
|
||||||
((type) == ADC_DELAY_SEL_4) || \
|
|
||||||
((type) == ADC_DELAY_SEL_5) || \
|
|
||||||
((type) == ADC_DELAY_SEL_6) || \
|
|
||||||
((type) == ADC_DELAY_SEL_7))
|
|
||||||
|
|
||||||
/** @defgroup ADC_PGA_GAIN_TYPE
|
/** @defgroup ADC_PGA_GAIN_TYPE
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define IS_ADC_PGA_GAIN_TYPE(type) (((type) == ADC_PGA_GAIN_NONE) || \
|
#define IS_ADC_PGA_GAIN_TYPE(type) \
|
||||||
((type) == ADC_PGA_GAIN_1) || \
|
(((type) == ADC_PGA_GAIN_NONE) || ((type) == ADC_PGA_GAIN_1) || ((type) == ADC_PGA_GAIN_2) || ((type) == ADC_PGA_GAIN_4) || ((type) == ADC_PGA_GAIN_8) || ((type) == ADC_PGA_GAIN_16) \
|
||||||
((type) == ADC_PGA_GAIN_2) || \
|
|| ((type) == ADC_PGA_GAIN_32))
|
||||||
((type) == ADC_PGA_GAIN_4) || \
|
|
||||||
((type) == ADC_PGA_GAIN_8) || \
|
|
||||||
((type) == ADC_PGA_GAIN_16) || \
|
|
||||||
((type) == ADC_PGA_GAIN_32))
|
|
||||||
|
|
||||||
/** @defgroup ADC_BIAS_SEL_TYPE
|
/** @defgroup ADC_BIAS_SEL_TYPE
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define IS_ADC_BIAS_SEL_TYPE(type) (((type) == ADC_BIAS_SEL_MAIN_BANDGAP) || \
|
#define IS_ADC_BIAS_SEL_TYPE(type) (((type) == ADC_BIAS_SEL_MAIN_BANDGAP) || ((type) == ADC_BIAS_SEL_AON_BANDGAP))
|
||||||
((type) == ADC_BIAS_SEL_AON_BANDGAP))
|
|
||||||
|
|
||||||
/** @defgroup ADC_CHOP_MOD_TYPE
|
/** @defgroup ADC_CHOP_MOD_TYPE
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define IS_ADC_CHOP_MOD_TYPE(type) (((type) == ADC_CHOP_MOD_ALL_OFF) || \
|
#define IS_ADC_CHOP_MOD_TYPE(type) (((type) == ADC_CHOP_MOD_ALL_OFF) || ((type) == ADC_CHOP_MOD_AZ_ON) || ((type) == ADC_CHOP_MOD_AZ_PGA_ON) || ((type) == ADC_CHOP_MOD_AZ_PGA_RPC_ON))
|
||||||
((type) == ADC_CHOP_MOD_AZ_ON) || \
|
|
||||||
((type) == ADC_CHOP_MOD_AZ_PGA_ON) || \
|
|
||||||
((type) == ADC_CHOP_MOD_AZ_PGA_RPC_ON))
|
|
||||||
|
|
||||||
/** @defgroup ADC_PGA_VCM_TYPE
|
/** @defgroup ADC_PGA_VCM_TYPE
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define IS_ADC_PGA_VCM_TYPE(type) (((type) == ADC_PGA_VCM_1V) || \
|
#define IS_ADC_PGA_VCM_TYPE(type) (((type) == ADC_PGA_VCM_1V) || ((type) == ADC_PGA_VCM_1P2V) || ((type) == ADC_PGA_VCM_1P4V) || ((type) == ADC_PGA_VCM_1P6V))
|
||||||
((type) == ADC_PGA_VCM_1P2V) || \
|
|
||||||
((type) == ADC_PGA_VCM_1P4V) || \
|
|
||||||
((type) == ADC_PGA_VCM_1P6V))
|
|
||||||
|
|
||||||
/** @defgroup ADC_TSEN_MOD_TYPE
|
/** @defgroup ADC_TSEN_MOD_TYPE
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define IS_ADC_TSEN_MOD_TYPE(type) (((type) == ADC_TSEN_MOD_INTERNAL_DIODE) || \
|
#define IS_ADC_TSEN_MOD_TYPE(type) (((type) == ADC_TSEN_MOD_INTERNAL_DIODE) || ((type) == ADC_TSEN_MOD_EXTERNAL_DIODE))
|
||||||
((type) == ADC_TSEN_MOD_EXTERNAL_DIODE))
|
|
||||||
|
|
||||||
/** @defgroup ADC_VREF_TYPE
|
/** @defgroup ADC_VREF_TYPE
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define IS_ADC_VREF_TYPE(type) (((type) == ADC_VREF_3P3V) || \
|
#define IS_ADC_VREF_TYPE(type) (((type) == ADC_VREF_3P3V) || ((type) == ADC_VREF_2V))
|
||||||
((type) == ADC_VREF_2V))
|
|
||||||
|
|
||||||
/** @defgroup ADC_SIG_INPUT_TYPE
|
/** @defgroup ADC_SIG_INPUT_TYPE
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define IS_ADC_SIG_INPUT_TYPE(type) (((type) == ADC_INPUT_SINGLE_END) || \
|
#define IS_ADC_SIG_INPUT_TYPE(type) (((type) == ADC_INPUT_SINGLE_END) || ((type) == ADC_INPUT_DIFF))
|
||||||
((type) == ADC_INPUT_DIFF))
|
|
||||||
|
|
||||||
/** @defgroup ADC_DATA_WIDTH_TYPE
|
/** @defgroup ADC_DATA_WIDTH_TYPE
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define IS_ADC_DATA_WIDTH_TYPE(type) (((type) == ADC_DATA_WIDTH_12) || \
|
#define IS_ADC_DATA_WIDTH_TYPE(type) \
|
||||||
((type) == ADC_DATA_WIDTH_14_WITH_16_AVERAGE) || \
|
(((type) == ADC_DATA_WIDTH_12) || ((type) == ADC_DATA_WIDTH_14_WITH_16_AVERAGE) || ((type) == ADC_DATA_WIDTH_14_WITH_64_AVERAGE) || ((type) == ADC_DATA_WIDTH_16_WITH_128_AVERAGE) \
|
||||||
((type) == ADC_DATA_WIDTH_14_WITH_64_AVERAGE) || \
|
|| ((type) == ADC_DATA_WIDTH_16_WITH_256_AVERAGE))
|
||||||
((type) == ADC_DATA_WIDTH_16_WITH_128_AVERAGE) || \
|
|
||||||
((type) == ADC_DATA_WIDTH_16_WITH_256_AVERAGE))
|
|
||||||
|
|
||||||
/** @defgroup ADC_MICBOOST_DB_TYPE
|
/** @defgroup ADC_MICBOOST_DB_TYPE
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define IS_ADC_MICBOOST_DB_TYPE(type) (((type) == ADC_MICBOOST_DB_16DB) || \
|
#define IS_ADC_MICBOOST_DB_TYPE(type) (((type) == ADC_MICBOOST_DB_16DB) || ((type) == ADC_MICBOOST_DB_32DB))
|
||||||
((type) == ADC_MICBOOST_DB_32DB))
|
|
||||||
|
|
||||||
/** @defgroup ADC_PGA2_GAIN_TYPE
|
/** @defgroup ADC_PGA2_GAIN_TYPE
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define IS_ADC_PGA2_GAIN_TYPE(type) (((type) == ADC_PGA2_GAIN_0DB) || \
|
#define IS_ADC_PGA2_GAIN_TYPE(type) (((type) == ADC_PGA2_GAIN_0DB) || ((type) == ADC_PGA2_GAIN_6DB) || ((type) == ADC_PGA2_GAIN_N6DB) || ((type) == ADC_PGA2_GAIN_12DB))
|
||||||
((type) == ADC_PGA2_GAIN_6DB) || \
|
|
||||||
((type) == ADC_PGA2_GAIN_N6DB) || \
|
|
||||||
((type) == ADC_PGA2_GAIN_12DB))
|
|
||||||
|
|
||||||
/** @defgroup ADC_MIC_MODE_TYPE
|
/** @defgroup ADC_MIC_MODE_TYPE
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define IS_ADC_MIC_MODE_TYPE(type) (((type) == ADC_MIC_MODE_SINGLE) || \
|
#define IS_ADC_MIC_MODE_TYPE(type) (((type) == ADC_MIC_MODE_SINGLE) || ((type) == ADC_MIC_MODE_DIFF))
|
||||||
((type) == ADC_MIC_MODE_DIFF))
|
|
||||||
|
|
||||||
/** @defgroup ADC_FIFO_THRESHOLD_TYPE
|
/** @defgroup ADC_FIFO_THRESHOLD_TYPE
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define IS_ADC_FIFO_THRESHOLD_TYPE(type) (((type) == ADC_FIFO_THRESHOLD_1) || \
|
#define IS_ADC_FIFO_THRESHOLD_TYPE(type) (((type) == ADC_FIFO_THRESHOLD_1) || ((type) == ADC_FIFO_THRESHOLD_4) || ((type) == ADC_FIFO_THRESHOLD_8) || ((type) == ADC_FIFO_THRESHOLD_16))
|
||||||
((type) == ADC_FIFO_THRESHOLD_4) || \
|
|
||||||
((type) == ADC_FIFO_THRESHOLD_8) || \
|
|
||||||
((type) == ADC_FIFO_THRESHOLD_16))
|
|
||||||
|
|
||||||
/** @defgroup ADC_INT_TYPE
|
/** @defgroup ADC_INT_TYPE
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define IS_ADC_INT_TYPE(type) (((type) == ADC_INT_POS_SATURATION) || \
|
#define IS_ADC_INT_TYPE(type) \
|
||||||
((type) == ADC_INT_NEG_SATURATION) || \
|
(((type) == ADC_INT_POS_SATURATION) || ((type) == ADC_INT_NEG_SATURATION) || ((type) == ADC_INT_FIFO_UNDERRUN) || ((type) == ADC_INT_FIFO_OVERRUN) || ((type) == ADC_INT_ADC_READY) \
|
||||||
((type) == ADC_INT_FIFO_UNDERRUN) || \
|
|| ((type) == ADC_INT_FIFO_READY) || ((type) == ADC_INT_ALL))
|
||||||
((type) == ADC_INT_FIFO_OVERRUN) || \
|
|
||||||
((type) == ADC_INT_ADC_READY) || \
|
|
||||||
((type) == ADC_INT_FIFO_READY) || \
|
|
||||||
((type) == ADC_INT_ALL))
|
|
||||||
|
|
||||||
/*@} end of group ADC_Public_Constants */
|
/*@} end of group ADC_Public_Constants */
|
||||||
|
|
||||||
@@ -514,7 +447,7 @@ void ADC_Enable(void);
|
|||||||
void ADC_Disable(void);
|
void ADC_Disable(void);
|
||||||
void ADC_Init(ADC_CFG_Type *cfg);
|
void ADC_Init(ADC_CFG_Type *cfg);
|
||||||
void ADC_Channel_Config(ADC_Chan_Type posCh, ADC_Chan_Type negCh, BL_Fun_Type contEn);
|
void ADC_Channel_Config(ADC_Chan_Type posCh, ADC_Chan_Type negCh, BL_Fun_Type contEn);
|
||||||
void ADC_Scan_Channel_Config(ADC_Chan_Type posChList[], ADC_Chan_Type negChList[], uint8_t scanLength, BL_Fun_Type contEn);
|
void ADC_Scan_Channel_Config(const ADC_Chan_Type posChList[], const ADC_Chan_Type negChList[], uint8_t scanLength, BL_Fun_Type contEn);
|
||||||
void ADC_Start(void);
|
void ADC_Start(void);
|
||||||
void ADC_Stop(void);
|
void ADC_Stop(void);
|
||||||
void ADC_FIFO_Cfg(ADC_FIFO_Cfg_Type *fifoCfg);
|
void ADC_FIFO_Cfg(ADC_FIFO_Cfg_Type *fifoCfg);
|
||||||
|
|||||||
@@ -74,7 +74,7 @@
|
|||||||
/** @defgroup ADC_Private_Variables
|
/** @defgroup ADC_Private_Variables
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
static intCallback_Type *adcIntCbfArra[ADC_INT_ALL] = { NULL };
|
static intCallback_Type *adcIntCbfArra[ADC_INT_ALL] = {NULL};
|
||||||
static ADC_Gain_Coeff_Type adcGainCoeffCal = {
|
static ADC_Gain_Coeff_Type adcGainCoeffCal = {
|
||||||
.adcGainCoeffEnable = DISABLE,
|
.adcGainCoeffEnable = DISABLE,
|
||||||
.adcgainCoeffVal = 0,
|
.adcgainCoeffVal = 0,
|
||||||
@@ -112,9 +112,8 @@ static ADC_Gain_Coeff_Type adcGainCoeffCal = {
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void ADC_Reset(void)
|
void ADC_Reset(void) {
|
||||||
{
|
|
||||||
uint32_t regCmd;
|
uint32_t regCmd;
|
||||||
|
|
||||||
/* reset ADC */
|
/* reset ADC */
|
||||||
@@ -131,9 +130,8 @@ void ADC_Reset(void)
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void ADC_Enable(void)
|
void ADC_Enable(void) {
|
||||||
{
|
|
||||||
uint32_t tmpVal;
|
uint32_t tmpVal;
|
||||||
|
|
||||||
tmpVal = BL_RD_REG(AON_BASE, AON_GPADC_REG_CMD);
|
tmpVal = BL_RD_REG(AON_BASE, AON_GPADC_REG_CMD);
|
||||||
@@ -148,9 +146,8 @@ void ADC_Enable(void)
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void ADC_Disable(void)
|
void ADC_Disable(void) {
|
||||||
{
|
|
||||||
uint32_t tmpVal;
|
uint32_t tmpVal;
|
||||||
|
|
||||||
tmpVal = BL_RD_REG(AON_BASE, AON_GPADC_REG_CMD);
|
tmpVal = BL_RD_REG(AON_BASE, AON_GPADC_REG_CMD);
|
||||||
@@ -165,9 +162,8 @@ void ADC_Disable(void)
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void ADC_Init(ADC_CFG_Type *cfg)
|
void ADC_Init(ADC_CFG_Type *cfg) {
|
||||||
{
|
|
||||||
uint32_t regCfg1;
|
uint32_t regCfg1;
|
||||||
uint32_t regCfg2;
|
uint32_t regCfg2;
|
||||||
uint32_t regCalib;
|
uint32_t regCalib;
|
||||||
@@ -243,9 +239,8 @@ void ADC_Init(ADC_CFG_Type *cfg)
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void ADC_Channel_Config(ADC_Chan_Type posCh, ADC_Chan_Type negCh, BL_Fun_Type contEn)
|
void ADC_Channel_Config(ADC_Chan_Type posCh, ADC_Chan_Type negCh, BL_Fun_Type contEn) {
|
||||||
{
|
|
||||||
uint32_t regCmd;
|
uint32_t regCmd;
|
||||||
uint32_t regCfg1;
|
uint32_t regCfg1;
|
||||||
|
|
||||||
@@ -275,9 +270,8 @@ void ADC_Channel_Config(ADC_Chan_Type posCh, ADC_Chan_Type negCh, BL_Fun_Type co
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void ADC_Scan_Channel_Config(ADC_Chan_Type posChList[], ADC_Chan_Type negChList[], uint8_t scanLength, BL_Fun_Type contEn)
|
void ADC_Scan_Channel_Config(const ADC_Chan_Type posChList[], const ADC_Chan_Type negChList[], uint8_t scanLength, BL_Fun_Type contEn) {
|
||||||
{
|
|
||||||
uint32_t tmpVal, i;
|
uint32_t tmpVal, i;
|
||||||
uint32_t dealLen;
|
uint32_t dealLen;
|
||||||
|
|
||||||
@@ -346,9 +340,8 @@ void ADC_Scan_Channel_Config(ADC_Chan_Type posChList[], ADC_Chan_Type negChList[
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void ADC_Start(void)
|
void ADC_Start(void) {
|
||||||
{
|
|
||||||
uint32_t regCmd;
|
uint32_t regCmd;
|
||||||
|
|
||||||
/* disable convert start */
|
/* disable convert start */
|
||||||
@@ -371,9 +364,8 @@ void ADC_Start(void)
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void ADC_Stop(void)
|
void ADC_Stop(void) {
|
||||||
{
|
|
||||||
uint32_t regCmd;
|
uint32_t regCmd;
|
||||||
|
|
||||||
/* disable convert start */
|
/* disable convert start */
|
||||||
@@ -389,9 +381,8 @@ void ADC_Stop(void)
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void ADC_FIFO_Cfg(ADC_FIFO_Cfg_Type *fifoCfg)
|
void ADC_FIFO_Cfg(ADC_FIFO_Cfg_Type *fifoCfg) {
|
||||||
{
|
|
||||||
uint32_t tmpVal;
|
uint32_t tmpVal;
|
||||||
|
|
||||||
/* Check the parameters */
|
/* Check the parameters */
|
||||||
@@ -423,9 +414,8 @@ void ADC_FIFO_Cfg(ADC_FIFO_Cfg_Type *fifoCfg)
|
|||||||
*
|
*
|
||||||
* @return data count in FIFO
|
* @return data count in FIFO
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
uint8_t ADC_Get_FIFO_Count(void)
|
uint8_t ADC_Get_FIFO_Count(void) {
|
||||||
{
|
|
||||||
uint32_t tmpVal;
|
uint32_t tmpVal;
|
||||||
|
|
||||||
tmpVal = BL_RD_REG(GPIP_BASE, GPIP_GPADC_CONFIG);
|
tmpVal = BL_RD_REG(GPIP_BASE, GPIP_GPADC_CONFIG);
|
||||||
@@ -440,9 +430,8 @@ uint8_t ADC_Get_FIFO_Count(void)
|
|||||||
*
|
*
|
||||||
* @return SET or RESET
|
* @return SET or RESET
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
BL_Sts_Type ADC_FIFO_Is_Full(void)
|
BL_Sts_Type ADC_FIFO_Is_Full(void) {
|
||||||
{
|
|
||||||
uint32_t tmpVal;
|
uint32_t tmpVal;
|
||||||
|
|
||||||
tmpVal = BL_RD_REG(GPIP_BASE, GPIP_GPADC_CONFIG);
|
tmpVal = BL_RD_REG(GPIP_BASE, GPIP_GPADC_CONFIG);
|
||||||
@@ -461,9 +450,8 @@ BL_Sts_Type ADC_FIFO_Is_Full(void)
|
|||||||
*
|
*
|
||||||
* @return SET or RESET
|
* @return SET or RESET
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
BL_Sts_Type ADC_FIFO_Is_Empty(void)
|
BL_Sts_Type ADC_FIFO_Is_Empty(void) {
|
||||||
{
|
|
||||||
uint32_t tmpVal;
|
uint32_t tmpVal;
|
||||||
|
|
||||||
tmpVal = BL_RD_REG(GPIP_BASE, GPIP_GPADC_CONFIG);
|
tmpVal = BL_RD_REG(GPIP_BASE, GPIP_GPADC_CONFIG);
|
||||||
@@ -482,9 +470,8 @@ BL_Sts_Type ADC_FIFO_Is_Empty(void)
|
|||||||
*
|
*
|
||||||
* @return ADC result if return 0 that means this is error data,user should ignore this data.
|
* @return ADC result if return 0 that means this is error data,user should ignore this data.
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
uint32_t ADC_Read_FIFO(void)
|
uint32_t ADC_Read_FIFO(void) {
|
||||||
{
|
|
||||||
uint32_t tmpVal;
|
uint32_t tmpVal;
|
||||||
|
|
||||||
tmpVal = BL_RD_REG(GPIP_BASE, GPIP_GPADC_DMA_RDATA);
|
tmpVal = BL_RD_REG(GPIP_BASE, GPIP_GPADC_DMA_RDATA);
|
||||||
@@ -501,9 +488,8 @@ uint32_t ADC_Read_FIFO(void)
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void ADC_Parse_Result(uint32_t *orgVal, uint32_t len, ADC_Result_Type *result)
|
void ADC_Parse_Result(uint32_t *orgVal, uint32_t len, ADC_Result_Type *result) {
|
||||||
{
|
|
||||||
uint8_t neg = 0;
|
uint8_t neg = 0;
|
||||||
uint32_t tmpVal1 = 0, tmpVal2 = 0;
|
uint32_t tmpVal1 = 0, tmpVal2 = 0;
|
||||||
ADC_Data_Width_Type dataType;
|
ADC_Data_Width_Type dataType;
|
||||||
@@ -534,12 +520,10 @@ void ADC_Parse_Result(uint32_t *orgVal, uint32_t len, ADC_Result_Type *result)
|
|||||||
if (dataType == ADC_DATA_WIDTH_12) {
|
if (dataType == ADC_DATA_WIDTH_12) {
|
||||||
result[i].value = (unsigned int)(((orgVal[i] & 0xffff) >> 4) / coe);
|
result[i].value = (unsigned int)(((orgVal[i] & 0xffff) >> 4) / coe);
|
||||||
result[i].volt = result[i].value / 4096.0 * ref;
|
result[i].volt = result[i].value / 4096.0 * ref;
|
||||||
} else if ((dataType == ADC_DATA_WIDTH_14_WITH_16_AVERAGE) ||
|
} else if ((dataType == ADC_DATA_WIDTH_14_WITH_16_AVERAGE) || (dataType == ADC_DATA_WIDTH_14_WITH_64_AVERAGE)) {
|
||||||
(dataType == ADC_DATA_WIDTH_14_WITH_64_AVERAGE)) {
|
|
||||||
result[i].value = (unsigned int)(((orgVal[i] & 0xffff) >> 2) / coe);
|
result[i].value = (unsigned int)(((orgVal[i] & 0xffff) >> 2) / coe);
|
||||||
result[i].volt = result[i].value / 16384.0 * ref;
|
result[i].volt = result[i].value / 16384.0 * ref;
|
||||||
} else if ((dataType == ADC_DATA_WIDTH_16_WITH_128_AVERAGE) ||
|
} else if ((dataType == ADC_DATA_WIDTH_16_WITH_128_AVERAGE) || (dataType == ADC_DATA_WIDTH_16_WITH_256_AVERAGE)) {
|
||||||
(dataType == ADC_DATA_WIDTH_16_WITH_256_AVERAGE)) {
|
|
||||||
result[i].value = (unsigned int)((orgVal[i] & 0xffff) / coe);
|
result[i].value = (unsigned int)((orgVal[i] & 0xffff) / coe);
|
||||||
result[i].volt = result[i].value / 65536.0 * ref;
|
result[i].volt = result[i].value / 65536.0 * ref;
|
||||||
}
|
}
|
||||||
@@ -559,12 +543,10 @@ void ADC_Parse_Result(uint32_t *orgVal, uint32_t len, ADC_Result_Type *result)
|
|||||||
if (dataType == ADC_DATA_WIDTH_12) {
|
if (dataType == ADC_DATA_WIDTH_12) {
|
||||||
result[i].value = (unsigned int)(((orgVal[i] & 0xffff) >> 4) / coe);
|
result[i].value = (unsigned int)(((orgVal[i] & 0xffff) >> 4) / coe);
|
||||||
result[i].volt = result[i].value / 2048.0 * ref;
|
result[i].volt = result[i].value / 2048.0 * ref;
|
||||||
} else if ((dataType == ADC_DATA_WIDTH_14_WITH_16_AVERAGE) ||
|
} else if ((dataType == ADC_DATA_WIDTH_14_WITH_16_AVERAGE) || (dataType == ADC_DATA_WIDTH_14_WITH_64_AVERAGE)) {
|
||||||
(dataType == ADC_DATA_WIDTH_14_WITH_64_AVERAGE)) {
|
|
||||||
result[i].value = (unsigned int)(((orgVal[i] & 0xffff) >> 2) / coe);
|
result[i].value = (unsigned int)(((orgVal[i] & 0xffff) >> 2) / coe);
|
||||||
result[i].volt = result[i].value / 8192.0 * ref;
|
result[i].volt = result[i].value / 8192.0 * ref;
|
||||||
} else if ((dataType == ADC_DATA_WIDTH_16_WITH_128_AVERAGE) ||
|
} else if ((dataType == ADC_DATA_WIDTH_16_WITH_128_AVERAGE) || (dataType == ADC_DATA_WIDTH_16_WITH_256_AVERAGE)) {
|
||||||
(dataType == ADC_DATA_WIDTH_16_WITH_256_AVERAGE)) {
|
|
||||||
result[i].value = (unsigned int)((orgVal[i] & 0xffff) / coe);
|
result[i].value = (unsigned int)((orgVal[i] & 0xffff) / coe);
|
||||||
result[i].volt = result[i].value / 32768.0 * ref;
|
result[i].volt = result[i].value / 32768.0 * ref;
|
||||||
}
|
}
|
||||||
@@ -584,9 +566,8 @@ void ADC_Parse_Result(uint32_t *orgVal, uint32_t len, ADC_Result_Type *result)
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
BL_Mask_Type ADC_IntGetMask(ADC_INT_Type intType)
|
BL_Mask_Type ADC_IntGetMask(ADC_INT_Type intType) {
|
||||||
{
|
|
||||||
uint32_t tmpVal;
|
uint32_t tmpVal;
|
||||||
|
|
||||||
/* Check the parameters */
|
/* Check the parameters */
|
||||||
@@ -637,9 +618,8 @@ BL_Mask_Type ADC_IntGetMask(ADC_INT_Type intType)
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void ADC_IntMask(ADC_INT_Type intType, BL_Mask_Type intMask)
|
void ADC_IntMask(ADC_INT_Type intType, BL_Mask_Type intMask) {
|
||||||
{
|
|
||||||
uint32_t tmpVal;
|
uint32_t tmpVal;
|
||||||
|
|
||||||
/* Check the parameters */
|
/* Check the parameters */
|
||||||
@@ -772,9 +752,8 @@ void ADC_IntMask(ADC_INT_Type intType, BL_Mask_Type intMask)
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void ADC_IntClr(ADC_INT_Type intType)
|
void ADC_IntClr(ADC_INT_Type intType) {
|
||||||
{
|
|
||||||
uint32_t tmpVal;
|
uint32_t tmpVal;
|
||||||
|
|
||||||
/* Check the parameters */
|
/* Check the parameters */
|
||||||
@@ -919,9 +898,8 @@ void ADC_IntClr(ADC_INT_Type intType)
|
|||||||
*
|
*
|
||||||
* @return SET or RESET
|
* @return SET or RESET
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
BL_Sts_Type ADC_GetIntStatus(ADC_INT_Type intType)
|
BL_Sts_Type ADC_GetIntStatus(ADC_INT_Type intType) {
|
||||||
{
|
|
||||||
uint32_t tmpVal;
|
uint32_t tmpVal;
|
||||||
BL_Sts_Type bitStatus = RESET;
|
BL_Sts_Type bitStatus = RESET;
|
||||||
|
|
||||||
@@ -977,9 +955,8 @@ BL_Sts_Type ADC_GetIntStatus(ADC_INT_Type intType)
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void ADC_Int_Callback_Install(ADC_INT_Type intType, intCallback_Type *cbFun)
|
void ADC_Int_Callback_Install(ADC_INT_Type intType, intCallback_Type *cbFun) {
|
||||||
{
|
|
||||||
/* Check the parameters */
|
/* Check the parameters */
|
||||||
CHECK_PARAM(IS_GPIP_ADC_INT_TYPE(intType));
|
CHECK_PARAM(IS_GPIP_ADC_INT_TYPE(intType));
|
||||||
|
|
||||||
@@ -993,10 +970,9 @@ void ADC_Int_Callback_Install(ADC_INT_Type intType, intCallback_Type *cbFun)
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
#ifndef BFLB_USE_HAL_DRIVER
|
#ifndef BFLB_USE_HAL_DRIVER
|
||||||
void GPADC_DMA_IRQHandler(void)
|
void GPADC_DMA_IRQHandler(void) {
|
||||||
{
|
|
||||||
if (ADC_GetIntStatus(ADC_INT_POS_SATURATION) == SET) {
|
if (ADC_GetIntStatus(ADC_INT_POS_SATURATION) == SET) {
|
||||||
ADC_IntClr(ADC_INT_POS_SATURATION);
|
ADC_IntClr(ADC_INT_POS_SATURATION);
|
||||||
|
|
||||||
@@ -1054,9 +1030,8 @@ void GPADC_DMA_IRQHandler(void)
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void ADC_Vbat_Enable(void)
|
void ADC_Vbat_Enable(void) {
|
||||||
{
|
|
||||||
uint32_t tmpVal;
|
uint32_t tmpVal;
|
||||||
|
|
||||||
tmpVal = BL_RD_REG(AON_BASE, AON_GPADC_REG_CONFIG2);
|
tmpVal = BL_RD_REG(AON_BASE, AON_GPADC_REG_CONFIG2);
|
||||||
@@ -1071,9 +1046,8 @@ void ADC_Vbat_Enable(void)
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void ADC_Vbat_Disable(void)
|
void ADC_Vbat_Disable(void) {
|
||||||
{
|
|
||||||
uint32_t tmpVal;
|
uint32_t tmpVal;
|
||||||
|
|
||||||
tmpVal = BL_RD_REG(AON_BASE, AON_GPADC_REG_CONFIG2);
|
tmpVal = BL_RD_REG(AON_BASE, AON_GPADC_REG_CONFIG2);
|
||||||
@@ -1088,9 +1062,8 @@ void ADC_Vbat_Disable(void)
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void ADC_Tsen_Init(ADC_TSEN_MOD_Type tsenMod)
|
void ADC_Tsen_Init(ADC_TSEN_MOD_Type tsenMod) {
|
||||||
{
|
|
||||||
uint32_t tmpVal;
|
uint32_t tmpVal;
|
||||||
|
|
||||||
CHECK_PARAM(IS_AON_ADC_TSEN_MOD_TYPE(type));
|
CHECK_PARAM(IS_AON_ADC_TSEN_MOD_TYPE(type));
|
||||||
@@ -1150,9 +1123,8 @@ void ADC_Tsen_Init(ADC_TSEN_MOD_Type tsenMod)
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void ADC_Tsen_Enable(void)
|
void ADC_Tsen_Enable(void) {
|
||||||
{
|
|
||||||
uint32_t tmpVal;
|
uint32_t tmpVal;
|
||||||
|
|
||||||
tmpVal = BL_RD_REG(AON_BASE, AON_GPADC_REG_CONFIG2);
|
tmpVal = BL_RD_REG(AON_BASE, AON_GPADC_REG_CONFIG2);
|
||||||
@@ -1165,9 +1137,8 @@ void ADC_Tsen_Enable(void)
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void ADC_Tsen_Disable(void)
|
void ADC_Tsen_Disable(void) {
|
||||||
{
|
|
||||||
uint32_t tmpVal;
|
uint32_t tmpVal;
|
||||||
|
|
||||||
tmpVal = BL_RD_REG(AON_BASE, AON_GPADC_REG_CONFIG2);
|
tmpVal = BL_RD_REG(AON_BASE, AON_GPADC_REG_CONFIG2);
|
||||||
@@ -1180,9 +1151,8 @@ void ADC_Tsen_Disable(void)
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void ADC_FIFO_Clear(void)
|
void ADC_FIFO_Clear(void) {
|
||||||
{
|
|
||||||
uint32_t tmpVal;
|
uint32_t tmpVal;
|
||||||
|
|
||||||
/* clear fifo by SET GPIP_GPADC_FIFO_CLR bit*/
|
/* clear fifo by SET GPIP_GPADC_FIFO_CLR bit*/
|
||||||
@@ -1198,9 +1168,8 @@ void ADC_FIFO_Clear(void)
|
|||||||
* @param pga_os_cal: pga os cal value
|
* @param pga_os_cal: pga os cal value
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void ADC_PGA_Config(uint8_t pga_vcmi_enable, uint8_t pga_os_cal)
|
void ADC_PGA_Config(uint8_t pga_vcmi_enable, uint8_t pga_os_cal) {
|
||||||
{
|
|
||||||
uint32_t tmpVal;
|
uint32_t tmpVal;
|
||||||
|
|
||||||
tmpVal = BL_RD_REG(AON_BASE, AON_GPADC_REG_CONFIG2);
|
tmpVal = BL_RD_REG(AON_BASE, AON_GPADC_REG_CONFIG2);
|
||||||
@@ -1222,9 +1191,8 @@ void ADC_PGA_Config(uint8_t pga_vcmi_enable, uint8_t pga_os_cal)
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
uint32_t TSEN_Get_V_Error(void)
|
uint32_t TSEN_Get_V_Error(void) {
|
||||||
{
|
|
||||||
uint32_t v0 = 0, v1 = 0;
|
uint32_t v0 = 0, v1 = 0;
|
||||||
uint32_t v_error = 0;
|
uint32_t v_error = 0;
|
||||||
uint32_t regVal = 0;
|
uint32_t regVal = 0;
|
||||||
@@ -1282,9 +1250,8 @@ uint32_t TSEN_Get_V_Error(void)
|
|||||||
*
|
*
|
||||||
* @return SUCCESS or ERROR
|
* @return SUCCESS or ERROR
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
BL_Err_Type ATTR_CLOCK_SECTION ADC_Trim_TSEN(uint16_t *tsen_offset)
|
BL_Err_Type ATTR_CLOCK_SECTION ADC_Trim_TSEN(uint16_t *tsen_offset) {
|
||||||
{
|
|
||||||
Efuse_TSEN_Refcode_Corner_Type trim;
|
Efuse_TSEN_Refcode_Corner_Type trim;
|
||||||
|
|
||||||
EF_Ctrl_Read_TSEN_Trim(&trim);
|
EF_Ctrl_Read_TSEN_Trim(&trim);
|
||||||
@@ -1306,9 +1273,8 @@ BL_Err_Type ATTR_CLOCK_SECTION ADC_Trim_TSEN(uint16_t *tsen_offset)
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void ADC_SET_TSVBE_LOW(void)
|
void ADC_SET_TSVBE_LOW(void) {
|
||||||
{
|
|
||||||
uint32_t tmpVal;
|
uint32_t tmpVal;
|
||||||
tmpVal = BL_RD_REG(AON_BASE, AON_GPADC_REG_CONFIG2);
|
tmpVal = BL_RD_REG(AON_BASE, AON_GPADC_REG_CONFIG2);
|
||||||
tmpVal = BL_CLR_REG_BIT(tmpVal, AON_GPADC_TSVBE_LOW);
|
tmpVal = BL_CLR_REG_BIT(tmpVal, AON_GPADC_TSVBE_LOW);
|
||||||
@@ -1322,9 +1288,8 @@ void ADC_SET_TSVBE_LOW(void)
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void ADC_SET_TSVBE_HIGH(void)
|
void ADC_SET_TSVBE_HIGH(void) {
|
||||||
{
|
|
||||||
uint32_t tmpVal;
|
uint32_t tmpVal;
|
||||||
tmpVal = BL_RD_REG(AON_BASE, AON_GPADC_REG_CONFIG2);
|
tmpVal = BL_RD_REG(AON_BASE, AON_GPADC_REG_CONFIG2);
|
||||||
tmpVal = BL_SET_REG_BIT(tmpVal, AON_GPADC_TSVBE_LOW);
|
tmpVal = BL_SET_REG_BIT(tmpVal, AON_GPADC_TSVBE_LOW);
|
||||||
@@ -1338,9 +1303,8 @@ void ADC_SET_TSVBE_HIGH(void)
|
|||||||
*
|
*
|
||||||
* @return tempture
|
* @return tempture
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
float TSEN_Get_Temp(uint32_t tsen_offset)
|
float TSEN_Get_Temp(uint32_t tsen_offset) {
|
||||||
{
|
|
||||||
uint32_t v0 = 0, v1 = 0;
|
uint32_t v0 = 0, v1 = 0;
|
||||||
float temp = 0;
|
float temp = 0;
|
||||||
uint32_t regVal = 0;
|
uint32_t regVal = 0;
|
||||||
@@ -1403,9 +1367,8 @@ float TSEN_Get_Temp(uint32_t tsen_offset)
|
|||||||
*
|
*
|
||||||
* @return success or not
|
* @return success or not
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
BL_Err_Type ADC_Mic_Init(ADC_MIC_Type *adc_mic_config)
|
BL_Err_Type ADC_Mic_Init(ADC_MIC_Type *adc_mic_config) {
|
||||||
{
|
|
||||||
uint32_t tmpVal1 = 0, tmpVal2 = 0;
|
uint32_t tmpVal1 = 0, tmpVal2 = 0;
|
||||||
|
|
||||||
CHECK_PARAM(IS_ADC_MICBOOST_DB_Type(adc_mic_config->micboostDb));
|
CHECK_PARAM(IS_ADC_MICBOOST_DB_Type(adc_mic_config->micboostDb));
|
||||||
@@ -1448,9 +1411,8 @@ BL_Err_Type ADC_Mic_Init(ADC_MIC_Type *adc_mic_config)
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void ADC_MIC_Bias_Enable(void)
|
void ADC_MIC_Bias_Enable(void) {
|
||||||
{
|
|
||||||
uint32_t tmpVal;
|
uint32_t tmpVal;
|
||||||
|
|
||||||
tmpVal = BL_RD_REG(AON_BASE, AON_GPADC_REG_CMD);
|
tmpVal = BL_RD_REG(AON_BASE, AON_GPADC_REG_CMD);
|
||||||
@@ -1465,9 +1427,8 @@ void ADC_MIC_Bias_Enable(void)
|
|||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void ADC_MIC_Bias_Disable(void)
|
void ADC_MIC_Bias_Disable(void) {
|
||||||
{
|
|
||||||
uint32_t tmpVal;
|
uint32_t tmpVal;
|
||||||
|
|
||||||
tmpVal = BL_RD_REG(AON_BASE, AON_GPADC_REG_CMD);
|
tmpVal = BL_RD_REG(AON_BASE, AON_GPADC_REG_CMD);
|
||||||
@@ -1482,9 +1443,8 @@ void ADC_MIC_Bias_Disable(void)
|
|||||||
*
|
*
|
||||||
* @return SUCCESS or ERROR
|
* @return SUCCESS or ERROR
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
BL_Err_Type ATTR_CLOCK_SECTION ADC_Gain_Trim(void)
|
BL_Err_Type ATTR_CLOCK_SECTION ADC_Gain_Trim(void) {
|
||||||
{
|
|
||||||
Efuse_ADC_Gain_Coeff_Type trim;
|
Efuse_ADC_Gain_Coeff_Type trim;
|
||||||
uint32_t tmp;
|
uint32_t tmp;
|
||||||
|
|
||||||
@@ -1500,12 +1460,12 @@ BL_Err_Type ATTR_CLOCK_SECTION ADC_Gain_Trim(void)
|
|||||||
tmp = ~tmp;
|
tmp = ~tmp;
|
||||||
tmp += 1;
|
tmp += 1;
|
||||||
tmp = tmp & 0xfff;
|
tmp = tmp & 0xfff;
|
||||||
//printf("val==%08x\r\n",(unsigned int)tmp);
|
// printf("val==%08x\r\n",(unsigned int)tmp);
|
||||||
adcGainCoeffCal.coe = (1.0 + ((float)tmp / 2048.0));
|
adcGainCoeffCal.coe = (1.0 + ((float)tmp / 2048.0));
|
||||||
//printf("coe==%0f\r\n",adcGainCoeffCal.coe);
|
// printf("coe==%0f\r\n",adcGainCoeffCal.coe);
|
||||||
} else {
|
} else {
|
||||||
adcGainCoeffCal.coe = (1.0 - ((float)tmp / 2048.0));
|
adcGainCoeffCal.coe = (1.0 - ((float)tmp / 2048.0));
|
||||||
//printf("coe==%0f\r\n",adcGainCoeffCal.coe);
|
// printf("coe==%0f\r\n",adcGainCoeffCal.coe);
|
||||||
}
|
}
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
|
|||||||
Reference in New Issue
Block a user