Functions
Functions
Peripheral Driver » APP DRIVER » ADC

## Functions
uint16_t | app_adc_init (app_adc_params_t *p_params, app_adc_evt_handler_t evt_handler)
| Initialize the APP ADC DRIVER according to the specified parameters in the app_adc_params_t and app_adc_evt_handler_t. More...
uint16_t | app_adc_deinit (void)
| De-initialize the APP ADC DRIVER peripheral. More...
uint16_t | app_adc_conversion_sync (uint16_t *p_data, uint32_t length, uint32_t timeout)
| Polling for conversion. More...
uint16_t | app_adc_conversion_async (uint16_t *p_data, uint32_t length)
| DMA for conversion. More...
uint16_t | app_adc_voltage_intern (uint16_t *inbuf, double *outbuf, uint32_t buflen)
| Convert the ADC conversion results to a voltage value(internal reference). More...
uint16_t | app_adc_voltage_extern (double ref, uint16_t *inbuf, double *outbuf, uint32_t buflen)
| Convert the ADC conversion results to a voltage value(external reference). More...
adc_handle_t * | app_adc_get_handle (void)
| Return the ADC handle. More...

## Detailed Description

## Function Documentation

## ◆ app_adc_conversion_async()

uint16_t app_adc_conversion_async | ( | uint16_t * | p_data,
|  | uint32_t | length
| ) |  |

DMA for conversion.

Parameters

  [in] | p_data | Pointer to data buffer which to storage ADC conversion results.
  [in] | length | Length of data buffer, ranging between 0 and 4095.

Returns
  Result of operation.

## ◆ app_adc_conversion_sync()

uint16_t app_adc_conversion_sync | ( | uint16_t * | p_data,
|  | uint32_t | length,
|  | uint32_t | timeout
| ) |  |

Polling for conversion.

Parameters

  [in] | p_data | Pointer to data buffer which to storage ADC conversion results.
  [in] | length | Length of data buffer.
  [in] | timeout | : Timeout duration

Returns
  Result of operation.

## ◆ app_adc_deinit()

uint16_t app_adc_deinit | ( | void |  | ) |

De-initialize the APP ADC DRIVER peripheral.

Returns
  Result of De-initialization.

## ◆ app_adc_get_handle()

adc_handle_t* app_adc_get_handle | ( | void |  | ) |

Return the ADC handle.

Returns
  Pointer to the ADC handle.

## ◆ app_adc_init()

uint16_t app_adc_init | ( | app_adc_params_t * | p_params,
|  | app_adc_evt_handler_t | evt_handler
| ) |  |

Initialize the APP ADC DRIVER according to the specified parameters in the app_adc_params_t and app_adc_evt_handler_t.

Note
  If DMA mode is set, you can use blocking mode. Conversely, if blocking mode is set, you can't use DMA mode.

Parameters

  [in] | p_params | Pointer to app_adc_params_t parameter which contains the configuration information for the specified ADC module.
  [in] | evt_handler | ADC user callback function.

Returns
  Result of initialization.

## ◆ app_adc_voltage_extern()

uint16_t app_adc_voltage_extern | ( | double | ref,
|  | uint16_t * | inbuf,
|  | double * | outbuf,
|  | uint32_t | buflen
| ) |  |

Convert the ADC conversion results to a voltage value(external reference).

Parameters

  [in] | ref | slope 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.

## ◆ app_adc_voltage_intern()

uint16_t app_adc_voltage_intern | ( | uint16_t * | inbuf,
|  | double * | outbuf,
|  | uint32_t | buflen
| ) |  |

Convert the ADC conversion results to a voltage value(internal reference).

Parameters

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