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_multi_channel_conversion_async (app_adc_samle_node_t *p_begin_node, uint32_t total_nodes)
| DMA for multi channels conversion; evt_handler in app_adc_init will callback when all channels finish. 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 2 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, must >=2.
  [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_multi_channel_conversion_async()

uint16_t app_adc_multi_channel_conversion_async | ( | app_adc_samle_node_t * | p_begin_node,
|  | uint32_t | total_nodes
| ) |  |

DMA for multi channels conversion; evt_handler in app_adc_init will callback when all channels finish.

Parameters

  [in] | p_begin_node | Pointer to the multi sample channels list node.
  [in] | total_nodes | total sample channels.

Returns
  Result of operation.

## ◆ 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 2 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 2 and 4095.

Returns
  Result of operation.