InPlay API
|
HAL_ADC. More...
Enumerations | |
enum | adc_ch { ADC_CH0 = 0, ADC_CH1, ADC_CH2, ADC_CH3, ADC_CH4, ADC_CH5, ADC_CH6, ADC_CH7, ADC_CH8, ADC_CH9, ADC_CH10 = 10, ADC_CH11, ADC_CH12, ADC_CH13, ADC_CH14 = 14, ADC_CH15 = 15 } |
enum | adc_vref { ADC_VREF_1P0 = 0, ADC_VREF_1P5 = 1 } |
Functions | |
int | hal_adc_open (adc_init_t *init) |
Open ADC device. More... | |
void | hal_adc_close (void) |
Close ADC device. More... | |
int | hal_adc_force_mode_enable_ch (int ch) |
Enable channel in force mode. More... | |
int | hal_adc_force_mode_disable_ch (int ch) |
Disable channel in force mode. More... | |
int | hal_adc_force_mode_start (int ch, uint16_t *buff, uint16_t sample_num) |
Start force mode. More... | |
int | hal_adc_auto_mode_enable_ch (int ch, uint16_t *buf, uint16_t buf_sz) |
Enable channel in auto mode. More... | |
int | hal_adc_auto_mode_disable_ch (int ch) |
Disable channel in auto mode. More... | |
int | hal_adc_auto_mode_config (uint8_t grp_intv) |
Config auto mode. More... | |
int | hal_adc_auto_mode_start (uint16_t sample_num) |
Start auto mode. More... | |
int | hal_adc_set_vref (int vref) |
Set ADC reference. Default is internal 1.0v. More... | |
int | hal_adc_measure_analog_ch (int ch, float vref, float *vc) |
read analog channel voltage. More... | |
float | hal_adc_sample_convert (uint16_t adc_val) |
convert adc sample value to voltage, unit is mV, vref must be 1.0v More... | |
float | hal_adc_vbat_sample_convert (uint16_t adc_val) |
convert vbat(channel 14) sample value to voltage, unit is mV More... | |
float | hal_adc_temp_sample_convert (uint16_t adc_val) |
convert temperature sample(channel 15) value to temperature, unit is centigrade More... | |
int | hal_adc_auto_mode_cap_clk (int ch, uint32_t cap_clk) |
Set capture clock for auto mode. More... | |
int | hal_adc_force_mode_cap_clk (uint32_t cap_clk) |
Set capture clock for force mode. More... | |
int | hal_adc_measure_temp (uint16_t sample_num, float *temp) |
Read temperature, this function is more accurate than hal_adc_force_mode_start or hal_adc_auto_mode_start. More... | |
HAL_ADC.
enum adc_ch |
enum adc_vref |
int hal_adc_auto_mode_cap_clk | ( | int | ch, |
uint32_t | cap_clk | ||
) |
Set capture clock for auto mode.
ch | channel |
cap_clk | capture clock. Default is about 470KHz. |
int hal_adc_auto_mode_config | ( | uint8_t | grp_intv | ) |
Config auto mode.
[in] | grp_intv | Group interval. |
int hal_adc_auto_mode_disable_ch | ( | int | ch | ) |
Disable channel in auto mode.
[in] | ch | Channel. |
int hal_adc_auto_mode_enable_ch | ( | int | ch, |
uint16_t * | buf, | ||
uint16_t | buf_sz | ||
) |
Enable channel in auto mode.
[in] | ch | Channel. |
[in] | buf | Buffer for this channel. |
[in] | buf_sz | Buffer size for this channel |
int hal_adc_auto_mode_start | ( | uint16_t | sample_num | ) |
Start auto mode.
[in] | sample_num | Sample number. |
void hal_adc_close | ( | void | ) |
Close ADC device.
int hal_adc_force_mode_cap_clk | ( | uint32_t | cap_clk | ) |
Set capture clock for force mode.
cap_clk | capture clock. Default is about 470KHz. |
int hal_adc_force_mode_disable_ch | ( | int | ch | ) |
Disable channel in force mode.
[in] | ch | Channel. |
int hal_adc_force_mode_enable_ch | ( | int | ch | ) |
Enable channel in force mode.
[in] | ch | Channel. |
int hal_adc_force_mode_start | ( | int | ch, |
uint16_t * | buff, | ||
uint16_t | sample_num | ||
) |
Start force mode.
[in] | ch | channel. |
[in] | buff | ADC sample value buffer. |
[in] | sample_num | Sample number. |
int hal_adc_measure_analog_ch | ( | int | ch, |
float | vref, | ||
float * | vc | ||
) |
read analog channel voltage.
Deprecation
[in] | ch | Analog channel, |
[in] | vref | Vref voltage, unit is V. |
[out] | vc | Channel voltage, unit is V. |
int hal_adc_measure_temp | ( | uint16_t | sample_num, |
float * | temp | ||
) |
Read temperature, this function is more accurate than hal_adc_force_mode_start or hal_adc_auto_mode_start.
[in] | sample_num | sample number, recommanded value is 128 |
[out] | temp | temperature |
int hal_adc_open | ( | adc_init_t * | init | ) |
Open ADC device.
[in] | init | ADC init struct. |
float hal_adc_sample_convert | ( | uint16_t | adc_val | ) |
convert adc sample value to voltage, unit is mV, vref must be 1.0v
adc_val | ADC sample value |
int hal_adc_set_vref | ( | int | vref | ) |
Set ADC reference. Default is internal 1.0v.
Deprecation
[in] | vref |
float hal_adc_temp_sample_convert | ( | uint16_t | adc_val | ) |
convert temperature sample(channel 15) value to temperature, unit is centigrade
adc_val | ADC sample value |
float hal_adc_vbat_sample_convert | ( | uint16_t | adc_val | ) |
convert vbat(channel 14) sample value to voltage, unit is mV
adc_val | ADC sample value |