|
SmartSnippets DA1459x SDK
|
Initialization, configuration, measurement and voltage conversion functions. More...
Functions | |
| void | hw_gpadc_init (const hw_gpadc_config_t *cfg, bool enable) |
| Initialize ADC. More... | |
| void | hw_gpadc_configure (const hw_gpadc_config_t *cfg) |
| Configure ADC. More... | |
| void | hw_gpadc_register_interrupt (hw_gpadc_interrupt_cb cb) |
| Register interrupt handler. More... | |
| void | hw_gpadc_unregister_interrupt (void) |
| Unregister interrupt handler. More... | |
| void | hw_gpadc_unregister_interrupt_no_clear (void) |
| Unregister interrupt handler without clearing the ADC engine interrupt. Only the NVIC interrupt is disabled and cleared. More... | |
| __STATIC_INLINE void | hw_gpadc_clear_interrupt (void) |
| Clear interrupt. More... | |
| __STATIC_INLINE void | hw_gpadc_enable (void) |
| Enable ADC. More... | |
| __STATIC_INLINE void | hw_gpadc_disable (void) |
| Disable ADC. More... | |
| __STATIC_INLINE bool | hw_gpadc_is_enabled (void) |
| ADC enabled state. More... | |
| __STATIC_INLINE void | hw_gpadc_start (void) |
| Start conversion. More... | |
| __STATIC_INLINE bool | hw_gpadc_in_progress (void) |
| Check if conversion is in progress. More... | |
| __STATIC_INLINE uint16_t | hw_gpadc_get_raw_value (void) |
| Get raw ADC value. More... | |
| uint16_t | hw_gpadc_get_value (void) |
| Get conversion result value with gain compensation and over sampling. More... | |
| __STATIC_INLINE void | hw_gpadc_adc_measure (void) |
| Start the ADC conversion engine, providing a measurement. More... | |
| bool | hw_gpadc_read (uint32_t nof_conv, uint16_t *out_buf, hw_gpadc_read_cb cb, void *user_data) |
| Generic read function Follows. More... | |
| void | hw_gpadc_abort_read (void) |
| Stop conversions. More... | |
| uint16_t | hw_gpadc_apply_correction (const hw_gpadc_config_t *cfg, uint16_t raw) |
| Apply a fine trimming algorithm to the conversion result. More... | |
| int16_t | hw_gpadc_convert_to_millivolt (const hw_gpadc_config_t *cfg, uint16_t raw) |
| Convert a GPADC raw measurement to voltage in mVolt. If no configuration is given, the current state of the GPADC control registers is used for the conversion parameters. More... | |
| int16_t | hw_gpadc_get_voltage (void) |
| Get the measured voltage in mVolt. More... | |
Initialization, configuration, measurement and voltage conversion functions.
| void hw_gpadc_abort_read | ( | void | ) |
Stop conversions.
Application can call this function to abort an ongoing read operation. It is applicable only in when the ADC operates either in interrupt or DMA mode.
| __STATIC_INLINE void hw_gpadc_adc_measure | ( | void | ) |
Start the ADC conversion engine, providing a measurement.
| uint16_t hw_gpadc_apply_correction | ( | const hw_gpadc_config_t * | cfg, |
| uint16_t | raw | ||
| ) |
Apply a fine trimming algorithm to the conversion result.
| [in] | cfg | configuration parameters for the conversion, NULL to use the current ADC settings |
| [in] | raw | the raw result of the ADC conversion |
| __STATIC_INLINE void hw_gpadc_clear_interrupt | ( | void | ) |
Clear interrupt.
In case an interrupt handler has been registered, the application does not have to call this function in the interrupt handler to clear the interrupt. This is handled by the GPADC driver module.
| void hw_gpadc_configure | ( | const hw_gpadc_config_t * | cfg | ) |
Configure ADC.
Shortcut to call appropriate configuration function. cfg must be valid.
| [in] | cfg | configuration |
| int16_t hw_gpadc_convert_to_millivolt | ( | const hw_gpadc_config_t * | cfg, |
| uint16_t | raw | ||
| ) |
Convert a GPADC raw measurement to voltage in mVolt. If no configuration is given, the current state of the GPADC control registers is used for the conversion parameters.
| [in] | cfg | configuration parameters for the conversion, NULL to use the current ADC settings |
| [in] | raw | the raw result of the ADC conversion |
| __STATIC_INLINE void hw_gpadc_disable | ( | void | ) |
Disable ADC.
Application should wait for conversion to be completed before disabling ADC. In case of continuous mode, application should disable continuous mode and then wait for conversion to be completed in order to have ADC in defined state.
| __STATIC_INLINE void hw_gpadc_enable | ( | void | ) |
Enable ADC.
Sampling is started after calling this function, to start conversion application should call hw_gpadc_start().
| __STATIC_INLINE uint16_t hw_gpadc_get_raw_value | ( | void | ) |
Get raw ADC value.
| uint16_t hw_gpadc_get_value | ( | void | ) |
Get conversion result value with gain compensation and over sampling.
Invalid bits are discarded from result, i.e. oversampling is taken into account when calculating value.
| int16_t hw_gpadc_get_voltage | ( | void | ) |
| __STATIC_INLINE bool hw_gpadc_in_progress | ( | void | ) |
Check if conversion is in progress.
| void hw_gpadc_init | ( | const hw_gpadc_config_t * | cfg, |
| bool | enable | ||
| ) |
Initialize ADC.
cfg can be NULL - no configuration is performed in such case.
| [in] | cfg | configuration |
| [in] | enable | enable the ADC LDO after the configuration is applied |
| __STATIC_INLINE bool hw_gpadc_is_enabled | ( | void | ) |
ADC enabled state.
| bool hw_gpadc_read | ( | uint32_t | nof_conv, |
| uint16_t * | out_buf, | ||
| hw_gpadc_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 making the user responsible for fetching the converted results from the GP_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_gpadc_register_interrupt | ( | hw_gpadc_interrupt_cb | cb | ) |
Register interrupt handler.
Additionally, interrupt is enabled after calling this function. Any pending interrupt is cleared before callback registration.
| [in] | cb | callback to be fired on interrupt |
| __STATIC_INLINE void hw_gpadc_start | ( | void | ) |
Start conversion.
Application should not call this function while conversion is still in progress.
| void hw_gpadc_unregister_interrupt | ( | void | ) |
Unregister interrupt handler.
Additionally, interrupt is disabled after calling this function. Any pending interrupt is cleared.
| void hw_gpadc_unregister_interrupt_no_clear | ( | void | ) |
Unregister interrupt handler without clearing the ADC engine interrupt. Only the NVIC interrupt is disabled and cleared.
1.8.16