Bouffalo SDK  1.0
Bouffalolab Software Development Kit
bflb_adc.h File Reference
#include "bflb_core.h"
Include dependency graph for bflb_adc.h:

Go to the source code of this file.

Data Structures

struct  bflb_adc_config_s
 ADC configuration structure. More...
 
struct  bflb_adc_channel_s
 ADC channel select. More...
 
struct  bflb_adc_result_s
 ADC result select. More...
 

Macros

#define ADC_CHANNEL_0   0
 
#define ADC_CHANNEL_1   1
 
#define ADC_CHANNEL_2   2
 
#define ADC_CHANNEL_3   3
 
#define ADC_CHANNEL_4   4
 
#define ADC_CHANNEL_5   5
 
#define ADC_CHANNEL_6   6
 
#define ADC_CHANNEL_7   7
 
#define ADC_CHANNEL_8   8
 
#define ADC_CHANNEL_9   9
 
#define ADC_CHANNEL_10   10
 
#define ADC_CHANNEL_11   11
 
#define ADC_CHANNEL_DACA   12
 
#define ADC_CHANNEL_DACB   13
 
#define ADC_CHANNEL_TSEN_P   14
 
#define ADC_CHANNEL_TSEN_N   15
 
#define ADC_CHANNEL_VREF   16
 
#define ADC_CHANNEL_VABT_HALF   18
 
#define ADC_CHANNEL_GND   23
 
#define ADC_CLK_DIV_4   1
 
#define ADC_CLK_DIV_8   2
 
#define ADC_CLK_DIV_12   3
 
#define ADC_CLK_DIV_16   4
 
#define ADC_CLK_DIV_20   5
 
#define ADC_CLK_DIV_24   6
 
#define ADC_CLK_DIV_32   7
 
#define ADC_RESOLUTION_12B   0
 
#define ADC_RESOLUTION_14B   2
 
#define ADC_RESOLUTION_16B   4
 
#define ADC_VREF_3P2V   0
 
#define ADC_VREF_2P0V   1
 
#define ADC_TSEN_MOD_INTERNAL_DIODE   0
 
#define ADC_TSEN_MOD_EXTERNAL_DIODE   1
 
#define ADC_INTSTS_NEG_SATURATION   (1 << 0)
 
#define ADC_INTSTS_POS_SATURATION   (1 << 1)
 
#define ADC_INTSTS_FIFO_UNDERRUN   (1 << 2)
 
#define ADC_INTSTS_FIFO_OVERRUN   (1 << 3)
 
#define ADC_INTSTS_ADC_READY   (1 << 4)
 
#define ADC_INTCLR_NEG_SATURATION   (1 << 0)
 
#define ADC_INTCLR_POS_SATURATION   (1 << 1)
 
#define ADC_INTCLR_FIFO_UNDERRUN   (1 << 2)
 
#define ADC_INTCLR_FIFO_OVERRUN   (1 << 3)
 
#define ADC_INTCLR_ADC_READY   (1 << 4)
 

Functions

void bflb_adc_init (struct bflb_device_s *dev, const struct bflb_adc_config_s *config)
 Initialize adc. More...
 
void bflb_adc_deinit (struct bflb_device_s *dev)
 Deinitialize adc. More...
 
void bflb_adc_link_rxdma (struct bflb_device_s *dev, bool enable)
 Enable adc rx dma. More...
 
void bflb_adc_set_reference_channel (int channel, int32_t millivolt)
 Select reference channel. More...
 
int bflb_adc_channel_config (struct bflb_device_s *dev, struct bflb_adc_channel_s *chan, uint8_t channels)
 Config adc channels to sample. More...
 
void bflb_adc_start_conversion (struct bflb_device_s *dev)
 Start adc conversion. More...
 
void bflb_adc_stop_conversion (struct bflb_device_s *dev)
 Stop adc conversion. More...
 
uint8_t bflb_adc_get_count (struct bflb_device_s *dev)
 Get adc number of completed conversions. More...
 
uint32_t bflb_adc_read_raw (struct bflb_device_s *dev)
 Read adc conversion value. More...
 
void bflb_adc_rxint_mask (struct bflb_device_s *dev, bool mask)
 Enable or disable adc conversion completion interrupt. Triggerring when a channel conversion is completed. More...
 
void bflb_adc_errint_mask (struct bflb_device_s *dev, bool mask)
 Enable or disable adc error interrupt. More...
 
uint32_t bflb_adc_get_intstatus (struct bflb_device_s *dev)
 Get adc interrupt instatus. More...
 
void bflb_adc_int_clear (struct bflb_device_s *dev, uint32_t int_clear)
 Clear adc interrupt instatus. More...
 
void bflb_adc_parse_result (struct bflb_device_s *dev, uint32_t *buffer, struct bflb_adc_result_s *result, uint16_t count)
 Parse adc conversion value into millivolt and actual numerical value. More...
 
void bflb_adc_tsen_init (struct bflb_device_s *dev, uint8_t tsen_mod)
 Initialize adc temperature sensor. More...
 
float bflb_adc_tsen_get_temp (struct bflb_device_s *dev)
 Get adc temperature. More...
 
void bflb_adc_vbat_enable (struct bflb_device_s *dev)
 Enable adc vbat power. More...
 
void bflb_adc_vbat_disable (struct bflb_device_s *dev)
 Disable adc vbat power. More...