|
SmartSnippets DA1459x SDK
|
Initialization, configuration, measurement and voltage conversion functions. More...
Functions | |
| void | hw_sdadc_init (const hw_sdadc_config_t *cfg) |
| Initialize SDADC. More... | |
| void | hw_sdadc_audio_init (hw_sdadc_interrupt_cb cb, const hw_sdadc_pga_config_t *cfg) |
| Initialize the SDADC to configure the audio path. More... | |
| void | hw_sdadc_configure (const hw_sdadc_config_t *cfg) |
| Configure SDADC. More... | |
| void | hw_sdadc_register_interrupt (hw_sdadc_interrupt_cb cb) |
| Register interrupt handler. More... | |
| void | hw_sdadc_unregister_interrupt (void) |
| Unregister interrupt handler. More... | |
| __STATIC_INLINE void | hw_sdadc_clear_interrupt (void) |
| Clear interrupt. More... | |
| void | hw_sdadc_stop_and_wait (void) |
| Stop and Wait. More... | |
| __STATIC_INLINE void | hw_sdadc_enable (void) |
| Enable SDADC. More... | |
| __STATIC_INLINE void | hw_sdadc_disable (void) |
| Disable SDADC. More... | |
| __STATIC_INLINE bool | hw_sdadc_is_enabled (void) |
| Get the enable status of the SDADC. More... | |
| void | hw_sdadc_start (void) |
| Start conversion. More... | |
| __STATIC_INLINE void | hw_sdadc_adc_measure (void) |
| Start the ADC conversion engine, providing one measurement. More... | |
| int32_t | hw_sdadc_get_voltage (const hw_sdadc_config_t *cfg) |
| Perform an ADC measurement and return the ADC value converted to mV. More... | |
| int32_t | hw_sdadc_convert_to_millivolt (const hw_sdadc_config_t *cfg, uint16_t raw) |
| Convert the ADC value to mV. More... | |
| bool | hw_sdadc_read (uint32_t nof_conv, uint16_t *out_buf, hw_sdadc_read_cb cb, void *user_data) |
| Generic read function Follows. More... | |
| void | hw_sdadc_abort_read (void) |
| Stop conversions. More... | |
| void | hw_sdadc_store_ext_ref_calibration_values (int16_t gain, int16_t offset) |
| Store external reference voltage calibration values. More... | |
| __STATIC_INLINE bool | hw_sdadc_in_progress (void) |
| Check if conversion is in progress. More... | |
Initialization, configuration, measurement and voltage conversion functions.
| void hw_sdadc_abort_read | ( | void | ) |
Stop conversions.
Application can call this function to abort an ongoing read operation. It is applicable only when the ADC operates either in interrupt or DMA mode.
| __STATIC_INLINE void hw_sdadc_adc_measure | ( | void | ) |
Start the ADC conversion engine, providing one measurement.
| void hw_sdadc_audio_init | ( | hw_sdadc_interrupt_cb | cb, |
| const hw_sdadc_pga_config_t * | cfg | ||
| ) |
Initialize the SDADC to configure the audio path.
Sets the SDADC control register to support the audio path and registers the function to be called upon SDADC_IRQn interrupt firing. Still, hw_sdadc_start() must be called by the application to start conversion.
| [in] | cb | interrupt callback function |
| [in] | cfg | pga configuration |
| __STATIC_INLINE void hw_sdadc_clear_interrupt | ( | void | ) |
Clear interrupt.
Application should call this in interrupt handler to clear interrupt.
| void hw_sdadc_configure | ( | const hw_sdadc_config_t * | cfg | ) |
Configure SDADC.
Shortcut to call appropriate configuration function. If cfg is NULL, this function does nothing.
| [in] | cfg | configuration |
| int32_t hw_sdadc_convert_to_millivolt | ( | const hw_sdadc_config_t * | cfg, |
| uint16_t | raw | ||
| ) |
Convert the ADC value to mV.
| [in] | cfg | sdadc configuration |
| [in] | raw | adc raw value |
| __STATIC_INLINE void hw_sdadc_disable | ( | void | ) |
Disable SDADC.
Application should wait for conversion to be completed before disabling SDADC. In case of continuous mode, application should disable continuous mode and then wait for conversion to be completed in order to have SDADC in defined state.
| __STATIC_INLINE void hw_sdadc_enable | ( | void | ) |
Enable SDADC.
This function enables the SDADC. LDO, bias currents and modulator are enabled. To start a conversion, the application should call hw_sdadc_start().
| int32_t hw_sdadc_get_voltage | ( | const hw_sdadc_config_t * | cfg | ) |
Perform an ADC measurement and return the ADC value converted to mV.
| [in] | cfg | sdadc configuration |
| __STATIC_INLINE bool hw_sdadc_in_progress | ( | void | ) |
Check if conversion is in progress.
| void hw_sdadc_init | ( | const hw_sdadc_config_t * | cfg | ) |
Initialize SDADC.
Stops ongoing sdadc operation, if any, sets the SDADC control register to default values, then enables the SDADC and calls the configuration function. It also disables and clears pending SDADC interrupts.
cfg can be NULL - no SDADC enabling and no configuration is performed in such case.
| [in] | cfg | configuration |
| __STATIC_INLINE bool hw_sdadc_is_enabled | ( | void | ) |
Get the enable status of the SDADC.
| bool hw_sdadc_read | ( | uint32_t | nof_conv, |
| uint16_t * | out_buf, | ||
| hw_sdadc_read_cb | cb, | ||
| void * | user_data | ||
| ) |
Generic read function Follows.
| [in] | nof_conv | number of conversions to be delivered. Must be non-zero |
| [out] | out_buf | buffer to place the conversion results, NULL is allowed but user has to set a user callback in order to be able to fetch the converted results from the SD_ADC_RESULT_REG |
| [in] | cb | user callback to execute when conversions are over, NULL for polling mode which blocks until conversions are over |
| [in] | user_data | parameter for callback |
| void hw_sdadc_register_interrupt | ( | hw_sdadc_interrupt_cb | cb | ) |
Register interrupt handler.
Interrupt is enabled after calling this function. Application is responsible for clearing interrupt using hw_sdadc_clear_interrupt(). If no callback is specified interrupt is cleared by driver.
| [in] | cb | callback fired on interrupt |
| void hw_sdadc_start | ( | void | ) |
Start conversion.
Application should not call this function while conversion is still in progress.
| void hw_sdadc_stop_and_wait | ( | void | ) |
Stop and Wait.
Disable the continuous mode, and wait for the ADC engine to finish
| void hw_sdadc_store_ext_ref_calibration_values | ( | int16_t | gain, |
| int16_t | offset | ||
| ) |
Store external reference voltage calibration values.
| [in] | gain | gain correction value |
| [in] | offset | offset correction value |
| void hw_sdadc_unregister_interrupt | ( | void | ) |
Unregister interrupt handler.
Interrupt is disabled after calling this function.
1.8.16