Sigma Delta Analog-Digital Converter adapter.
More...
|
|
#define | HW_SDADC ((void *)SDADC_BASE) |
| | SDADC Id.
|
| |
|
| void | ad_sdadc_init (void) |
| | Initialize SDADC adapter and some required variables. More...
|
| |
| ad_sdadc_handle_t | ad_sdadc_open (const ad_sdadc_controller_conf_t *conf) |
| | Open SDADC controller. More...
|
| |
| int | ad_sdadc_reconfig (const ad_sdadc_handle_t handle, const ad_sdadc_driver_conf_t *drv) |
| | Reconfigure SDADC controller. More...
|
| |
| int | ad_sdadc_close (const ad_sdadc_handle_t handle, bool forced) |
| | Close SDADC controller. More...
|
| |
| int | ad_sdadc_io_config (const HW_SDADC_ID id, const ad_sdadc_io_conf_t *io, AD_IO_CONF_STATE state) |
| | Initialize controller pins to on / off io configuration. More...
|
| |
| int | ad_sdadc_read_async (const ad_sdadc_handle_t handle, uint32_t nof_conv, uint16_t *outbuf, ad_sdadc_user_cb read_async_cb, void *user_data) |
| | Read asynchronously nof_conv conversions from the selected source. More...
|
| |
| int | ad_sdadc_read (const ad_sdadc_handle_t handle, uint32_t nof_conv, uint16_t *outbuf) |
| | Read synchronously nof_conv conversions from the selected source. More...
|
| |
| __STATIC_FORCEINLINE int32_t | ad_sdadc_conv_to_mvolt (const ad_sdadc_controller_conf_t *conf, uint32_t raw_value) |
| | Convert raw value read from SDADC to voltage in mV. The same configuration which was used to obtain the adc_value is needed for the conversion. More...
|
| |
| __STATIC_FORCEINLINE void | ad_sdadc_store_ext_ref_calibration_values (int16_t gain, int16_t offset) |
| | Store external reference voltage calibration values. More...
|
| |
Sigma Delta Analog-Digital Converter adapter.
◆ ad_sdadc_controller_conf_t
SDADC controller configuration.
Configuration of SDADC controller
- Note
- There may be more than one controller configurations needed (e.g DMA)
◆ ad_sdadc_driver_conf_t
SDADC driver configuration.
Configuration of the SDADC low level driver
- Note
- There may be more than one driver configurations needed (e.g DMA)
◆ ad_sdadc_user_cb
| typedef void(* ad_sdadc_user_cb) (void *user_data, uint32_t conversions) |
Asynchronous callback function.
- Parameters
-
| [in] | user_data | pointer to user data |
| [in] | conversions | number of remaining conversions |
◆ AD_SDADC_ERROR
◆ ad_sdadc_close()
Close SDADC controller.
This function:
- Aborts ongoing transactions
- De-initializes the drivers associated with the controller
- Resets controller interface IOs (as specified in ad_xxx_open())
- If DMA configuration has changed returns error
- Releases the controller resources
- Parameters
-
| [in] | handle | handle returned from ad_sdadc_open() |
| [in] | forced | force adapter closing |
- See also
- ad_sdadc_open()
-
AD_SDADC_ERROR
- Returns
- 0: success, <0: error code
◆ ad_sdadc_conv_to_mvolt()
Convert raw value read from SDADC to voltage in mV. The same configuration which was used to obtain the adc_value is needed for the conversion.
- Parameters
-
| [in] | conf | controller configuration |
| [in] | raw_value | value returned from ad_sdadc_read()/ad_sdadc_read_async() |
- Returns
- voltage in mV
◆ ad_sdadc_init()
| void ad_sdadc_init |
( |
void |
| ) |
|
Initialize SDADC adapter and some required variables.
- Note
- : It should ONLY be called by the system.
◆ ad_sdadc_io_config()
Initialize controller pins to on / off io configuration.
This function should be called for setting pins to the correct level before external devices are powered up (e.g on system init). It does not need to be called before every ad_sdadc_open() call.
- Parameters
-
| [in] | id | controller instance |
| [in] | io | controller io configuration |
| [in] | state | on/off io configuration |
- See also
- AD_SDADC_ERROR
- Returns
- 0: success, <0: error code
◆ ad_sdadc_open()
Open SDADC controller.
This function:
- Acquires the resources needed for using the controller
- Configures the controller interface IOs
- Initializes the drivers associated with the controller
- Parameters
-
| [in] | conf | controller configuration |
- Returns
- >0: handle that should be used in subsequent API calls, NULL: error
- Note
- The function will block until it acquires all controller resources
◆ ad_sdadc_read()
| int ad_sdadc_read |
( |
const ad_sdadc_handle_t |
handle, |
|
|
uint32_t |
nof_conv, |
|
|
uint16_t * |
outbuf |
|
) |
| |
Read synchronously nof_conv conversions from the selected source.
This function starts synchronous measurement read. The caller task will block until the resource becomes available. Upon the resource acquisition, ΣΔ start conversion(s) using the interrupt mode.
- Parameters
-
| [in] | handle | handle to SDADC source |
| [in] | nof_conv | number of conversions to be delivered. Must be non-zero |
| [out] | outbuf | pointer to conversion results buffer. Output buffer contains raw values |
- See also
- ad_sdadc_open()
-
ad_sdadc_close()
- Returns
- 0 on success, negative value on error
◆ ad_sdadc_read_async()
Read asynchronously nof_conv conversions from the selected source.
This function starts asynchronous measurement read. Non blocking read operation
- Parameters
-
| [in] | handle | handle to SDADC source |
| [in] | nof_conv | number of conversions to be delivered. Must be non-zero |
| [out] | outbuf | pointer to conversion results buffer. Output buffer contains raw values |
| [in] | read_async_cb | user callback fired after read operation completes |
| [in] | user_data | pointer to user data passed to callback |
- See also
- ad_sdadc_open()
-
ad_sdadc_close()
- Returns
- 0 on success, negative value on error
◆ ad_sdadc_reconfig()
Reconfigure SDADC controller.
This function will apply a new SDADC driver configuration.
- Parameters
-
| [in] | handle | handle returned from ad_sdadc_open() |
| [in] | drv | new driver configuration |
- See also
- ad_sdadc_open()
-
AD_SDADC_ERROR
- Returns
- 0: success, <0: error code
◆ ad_sdadc_store_ext_ref_calibration_values()
| __STATIC_FORCEINLINE void ad_sdadc_store_ext_ref_calibration_values |
( |
int16_t |
gain, |
|
|
int16_t |
offset |
|
) |
| |
Store external reference voltage calibration values.
- Parameters
-
| [in] | gain | gain correction value |
| [in] | offset | offset correction value |
- Note
- In case of external VREF, this function must be called before ad_sdadc_open().