Bouffalo SDK  1.0
Bouffalolab Software Development Kit
ADC
Collaboration diagram for ADC:

Modules

 adc channel definition
 
 adc clock divison definition
 
 adc resolution definition
 
 adc reference select definition
 
 adc tsen mode definition
 
 adc interrupt status definition
 
 adc interrupt clear definition
 

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...
 

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...
 

Detailed Description

Function Documentation

◆ bflb_adc_channel_config()

int bflb_adc_channel_config ( struct bflb_device_s dev,
struct bflb_adc_channel_s chan,
uint8_t  channels 
)

Config adc channels to sample.

Parameters
[in]devdevice handle
[in]chanpointer to the channel configurations.
[in]channelspair number of channels
Returns
Zero on success; a negated errno value on failure

◆ bflb_adc_deinit()

void bflb_adc_deinit ( struct bflb_device_s dev)

Deinitialize adc.

Parameters
[in]devdevice handle

◆ bflb_adc_errint_mask()

void bflb_adc_errint_mask ( struct bflb_device_s dev,
bool  mask 
)

Enable or disable adc error interrupt.

Parameters
[in]devdevice handle
[in]masktrue means disable, false means enable

◆ bflb_adc_get_count()

uint8_t bflb_adc_get_count ( struct bflb_device_s dev)

Get adc number of completed conversions.

Parameters
[in]devdevice handle
Returns
number of completed conversions

◆ bflb_adc_get_intstatus()

uint32_t bflb_adc_get_intstatus ( struct bflb_device_s dev)

Get adc interrupt instatus.

Parameters
[in]devdevice handle
Returns
interrupt instatus value, use adc interrupt status definition

◆ bflb_adc_init()

void bflb_adc_init ( struct bflb_device_s dev,
const struct bflb_adc_config_s config 
)

Initialize adc.

Parameters
[in]devdevice handle
[in]configpointer to save adc configuration

◆ bflb_adc_int_clear()

void bflb_adc_int_clear ( struct bflb_device_s dev,
uint32_t  int_clear 
)

Clear adc interrupt instatus.

Parameters
[in]devdevice handle
[in]int_clearinterrupt clear value, use adc interrupt clear definition

◆ bflb_adc_link_rxdma()

void bflb_adc_link_rxdma ( struct bflb_device_s dev,
bool  enable 
)

Enable adc rx dma.

Parameters
[in]devdevice handle
[in]enabletrue means enable, otherwise disable.

◆ bflb_adc_parse_result()

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.

Parameters
[in]devdevice handle
[in]bufferpointer to adc original value from bflb_adc_read_raw api
[out]resultpointer to save parse result
[in]countcount to parse

◆ bflb_adc_read_raw()

uint32_t bflb_adc_read_raw ( struct bflb_device_s dev)

Read adc conversion value.

Parameters
[in]devdevice handle
Returns
conversion value

◆ bflb_adc_rxint_mask()

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.

Parameters
[in]devdevice handle
[in]masktrue means disable, false means enable

◆ bflb_adc_set_reference_channel()

void bflb_adc_set_reference_channel ( int  channel,
int32_t  millivolt 
)

Select reference channel.

Parameters
[in]channelchannel number
[in]millivoltrefercence millivolt

◆ bflb_adc_start_conversion()

void bflb_adc_start_conversion ( struct bflb_device_s dev)

Start adc conversion.

Parameters
[in]devdevice handle

◆ bflb_adc_stop_conversion()

void bflb_adc_stop_conversion ( struct bflb_device_s dev)

Stop adc conversion.

Parameters
[in]devdevice handle

◆ bflb_adc_tsen_get_temp()

float bflb_adc_tsen_get_temp ( struct bflb_device_s dev)

Get adc temperature.

Parameters
[in]devdevice handle
Returns
temperature

◆ bflb_adc_tsen_init()

void bflb_adc_tsen_init ( struct bflb_device_s dev,
uint8_t  tsen_mod 
)

Initialize adc temperature sensor.

Parameters
[in]devdevice handle
[in]tsen_modtemperature sensor mode, use adc tsen mode definition

◆ bflb_adc_vbat_disable()

void bflb_adc_vbat_disable ( struct bflb_device_s dev)

Disable adc vbat power.

Parameters
[in]devdevice handle

◆ bflb_adc_vbat_enable()

void bflb_adc_vbat_enable ( struct bflb_device_s dev)

Enable adc vbat power.

Parameters
[in]devdevice handle