ADC control functions.
More...
|
hal_adc_state_t | hal_adc_get_state (adc_handle_t *p_adc) |
| Return the ADC handle state. More...
|
|
uint32_t | hal_adc_get_error (adc_handle_t *p_adc) |
| Return the ADC error code. More...
|
|
hal_status_t | hal_adc_suspend_reg (adc_handle_t *p_adc) |
| Suspend some registers related to ADC configuration before sleep. More...
|
|
hal_status_t | hal_adc_resume_reg (adc_handle_t *p_adc) |
| Restore some registers related to ADC configuration after sleep. This function must be used in conjunction with the hal_adc_suspend_reg(). More...
|
|
hal_status_t | hal_adc_change_channels (adc_handle_t *p_adc) |
| Set the new channels parameter to ADC. More...
|
|
void | hal_adc_voltage_intern (adc_handle_t *hadc, uint16_t *inbuf, double *outbuf, uint32_t buflen) |
| Convert the ADC conversion results to a voltage value(internal reference). More...
|
|
void | hal_adc_voltage_extern (adc_handle_t *hadc, double vref, uint16_t *inbuf, double *outbuf, uint32_t buflen) |
| Convert the ADC conversion results to a voltage value(external reference). More...
|
|
void | hal_adc_temperature_conv (adc_handle_t *hadc, uint16_t *inbuf, double *outbuf, uint32_t buflen) |
| Convert the ADC conversion results to temperature value. More...
|
|
void | hal_adc_vbat_conv (adc_handle_t *hadc, uint16_t *inbuf, double *outbuf, uint32_t buflen) |
| Convert the ADC conversion results to battery value. More...
|
|
ADC control functions.
===============================================================================
##### Peripheral State and Errors functions #####
===============================================================================
[..]
This subsection provides a set of functions allowing to control the ADC.
(+) hal_adc_get_state() API can be helpful to check in run-time the state of the ADC peripheral.
(+) hal_adc_get_error() check in run-time Errors occurring during communication.
◆ hal_adc_change_channels()
Set the new channels parameter to ADC.
- Parameters
-
[in] | p_adc | Pointer to a ADC handle which contains the new channels parameter. |
- Return values
-
◆ hal_adc_get_error()
Return the ADC error code.
- Parameters
-
[in] | p_adc | Pointer to an ADC handle which contains the configuration information for the specified ADC module. |
- Returns
- ADC error code in bitmap format
◆ hal_adc_get_state()
Return the ADC handle state.
- Parameters
-
[in] | p_adc | Pointer to an ADC handle which contains the configuration information for the specified ADC module. |
- Return values
-
◆ hal_adc_resume_reg()
Restore some registers related to ADC configuration after sleep. This function must be used in conjunction with the hal_adc_suspend_reg().
- Parameters
-
[in] | p_adc | Pointer to a ADC handle which contains the configuration information for the specified ADC module. |
- Return values
-
◆ hal_adc_suspend_reg()
Suspend some registers related to ADC configuration before sleep.
- Parameters
-
[in] | p_adc | Pointer to a ADC handle which contains the configuration information for the specified ADC module. |
- Return values
-
◆ hal_adc_temperature_conv()
void hal_adc_temperature_conv |
( |
adc_handle_t * |
hadc, |
|
|
uint16_t * |
inbuf, |
|
|
double * |
outbuf, |
|
|
uint32_t |
buflen |
|
) |
| |
Convert the ADC conversion results to temperature value.
- Parameters
-
[in] | hadc | Pointer to a ADC handle which contains the configuration information for the specified ADC module. |
[in] | inbuf | Pointer to data buffer which storage ADC codes. |
[out] | outbuf | Pointer to data buffer which to storage conversion results. |
[in] | buflen | Length of data buffer, ranging between 0 and 4095. |
- Returns
- Result of operation.
◆ hal_adc_vbat_conv()
void hal_adc_vbat_conv |
( |
adc_handle_t * |
hadc, |
|
|
uint16_t * |
inbuf, |
|
|
double * |
outbuf, |
|
|
uint32_t |
buflen |
|
) |
| |
Convert the ADC conversion results to battery value.
- Parameters
-
[in] | hadc | Pointer to a ADC handle which contains the configuration information for the specified ADC module. |
[in] | inbuf | Pointer to data buffer which storage ADC codes. |
[out] | outbuf | Pointer to data buffer which to storage conversion results. |
[in] | buflen | Length of data buffer, ranging between 0 and 4095. |
- Returns
- Result of operation.
◆ hal_adc_voltage_extern()
void hal_adc_voltage_extern |
( |
adc_handle_t * |
hadc, |
|
|
double |
vref, |
|
|
uint16_t * |
inbuf, |
|
|
double * |
outbuf, |
|
|
uint32_t |
buflen |
|
) |
| |
Convert the ADC conversion results to a voltage value(external reference).
- Parameters
-
[in] | hadc | Pointer to a ADC handle which contains the configuration information for the specified ADC module. |
[in] | vref | external reference value of ADC. |
[in] | inbuf | Pointer to data buffer which storage ADC conversion results. |
[out] | outbuf | Pointer to data buffer which to storage voltage results. |
[in] | buflen | Length of data buffer, ranging between 0 and 4095. |
- Returns
- Result of operation.
◆ hal_adc_voltage_intern()
void hal_adc_voltage_intern |
( |
adc_handle_t * |
hadc, |
|
|
uint16_t * |
inbuf, |
|
|
double * |
outbuf, |
|
|
uint32_t |
buflen |
|
) |
| |
Convert the ADC conversion results to a voltage value(internal reference).
- Parameters
-
[in] | hadc | Pointer to a ADC handle which contains the configuration information for the specified ADC module. |
[in] | inbuf | Pointer to data buffer which storage ADC conversion results. |
[out] | outbuf | Pointer to data buffer which to storage voltage results. |
[in] | buflen | Length of data buffer, ranging between 0 and 4095. |
- Returns
- Result of operation.