5.11.0.0R3
Software Development Kit
 
Loading...
Searching...
No Matches

Functions

wiced_result_t wiced_adc_deinit (wiced_adc_t adc)
 
wiced_result_t wiced_adc_init (wiced_adc_t adc, uint32_t sampling_cycle)
 
wiced_result_t wiced_adc_take_sample (wiced_adc_t adc, uint16_t *output)
 
wiced_result_t wiced_adc_take_sample_stream (wiced_adc_t adc, void *buffer, uint16_t buffer_length)
 

Detailed Description

Analog to Digital Converter (ADC) Functions

Example usage (Check for return values)

 // WICED_ADC_x is the ADC port , enumerated in
 // <WICED_SDK>/platform/<platform_name>/platform.h
 // from WICED_ADC_1 to WICED_ADC_MAX
 wiced_adc_init( WICED_ADC_3, sample_cycle);

 // For one sample
 wiced_adc_take_sample(WICED_ADC_3, &sample_value);

 // For multiple sample values
 wiced_adc_take_sample_stream(WICED_ADC_3, read_buffer, read_buffer_length);

 wiced_adc_deinit(WICED_ADC_3);

Function Documentation

◆ wiced_adc_deinit()

wiced_result_t wiced_adc_deinit ( wiced_adc_t adc)

De-initializes an ADC interface

Turns off an ADC hardware interface

Parameters
[in]adc: The interface which should be de-initialized
Returns
WICED_SUCCESS : on success.
WICED_ERROR : if an error occurred with any step

◆ wiced_adc_init()

wiced_result_t wiced_adc_init ( wiced_adc_t adc,
uint32_t sampling_cycle )

Initializes an ADC interface

Prepares an ADC hardware interface for sampling

Parameters
[in]adc: The interface which should be initialized
[in]sampling_cycle: Sampling period in number of ADC clock cycles. If the MCU does not support the value provided, the closest supported value is used.
Returns
WICED_SUCCESS : on success.
WICED_ERROR : if an error occurred with any step

◆ wiced_adc_take_sample()

wiced_result_t wiced_adc_take_sample ( wiced_adc_t adc,
uint16_t * output )

Takes a single sample from an ADC interface

Takes a single sample from an ADC interface

Parameters
[in]adc: The interface which should be sampled
[out]output: Pointer to a variable which will receive the sample
Returns
WICED_SUCCESS : on success.
WICED_ERROR : if an error occurred with any step

◆ wiced_adc_take_sample_stream()

wiced_result_t wiced_adc_take_sample_stream ( wiced_adc_t adc,
void * buffer,
uint16_t buffer_length )

Takes multiple samples from an ADC interface

Takes multiple samples from an ADC interface and stores them in a memory buffer

Parameters
[in]adc: The interface which should be sampled
[out]buffer: A memory buffer which will receive the samples Each sample will be uint16_t little endian.
[in]buffer_length: Length in bytes of the memory buffer.
Returns
WICED_SUCCESS : on success.
WICED_ERROR : if an error occurred with any step