Digital to Analog Converter#
Modules#
Enumerations#
Enumeration for DAC operation mode.
Enumeration for DAC callback events.
Enumeration for ADC channel this enum only used on Reference voltage for ADC mode of DAC.
Typedefs#
Typedef for user supplied callback function which is called when a DAC samples completes.
Functions#
Initialize the DAC.
Configure DAC control parameters.
Write digital input samples to DAC.
Read DAC analog output data.
Get the DAC sample clock.
Rewrite the DAC sample data.
Register the user callback function.
Unregister the user callback function.
Start the DAC operation.
Stop the DAC operation.
De-initialize the DAC.
Get the DAC version.
Enumeration Documentation#
sl_dac_operation_mode_t#
sl_dac_operation_mode_t
Enumeration for DAC operation mode.
Enumerator | |
---|---|
SL_DAC_FIFO_MODE | operation mode as fifo mode |
SL_DAC_STATIC_MODE | operation mode as static mode |
SL_DAC_OUTPUT_REF_VOLTAGE_FOR_ADC | operation mode as dac output reference voltage for ADC |
SL_DAC_OPERATION_MODE_LAST | Last member of enum for validation. |
60
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_dac.h
sl_dac_callback_event_t#
sl_dac_callback_event_t
Enumeration for DAC callback events.
Enumerator | |
---|---|
SL_DAC_FIFO_MODE_EVENT | Callback event for FIFO mode. |
SL_DAC_STATIC_MODE_EVENT | Callback event for Static mode. |
68
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_dac.h
sl_channel_id_for_adc_t#
sl_channel_id_for_adc_t
Enumeration for ADC channel this enum only used on Reference voltage for ADC mode of DAC.
Enumerator | |
---|---|
SL_DAC_ADC_CHANNEL_0 | ADC channel 0. |
SL_DAC_ADC_CHANNEL_1 | ADC channel 1. |
SL_DAC_ADC_CHANNEL_2 | ADC channel 2. |
SL_DAC_ADC_CHANNEL_3 | ADC channel 3. |
SL_DAC_ADC_CHANNEL_4 | ADC channel 4. |
SL_DAC_ADC_CHANNEL_5 | ADC channel 5. |
SL_DAC_ADC_CHANNEL_6 | ADC channel 6. |
SL_DAC_ADC_CHANNEL_7 | ADC channel 7. |
SL_DAC_ADC_CHANNEL_8 | ADC channel 8. |
SL_DAC_ADC_CHANNEL_9 | ADC channel 9. |
SL_DAC_ADC_CHANNEL_10 | ADC channel 10. |
SL_DAC_ADC_CHANNEL_11 | ADC channel 11. |
SL_DAC_ADC_CHANNEL_12 | ADC channel 12. |
SL_DAC_ADC_CHANNEL_13 | ADC channel 13. |
SL_DAC_ADC_CHANNEL_14 | ADC channel 14. |
SL_DAC_ADC_CHANNEL_15 | ADC channel 15. |
74
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_dac.h
Typedef Documentation#
sl_dac_callback_t#
typedef void(* sl_dac_callback_t) (uint8_t event) )(uint8_t event)
Typedef for user supplied callback function which is called when a DAC samples completes.
[in] | event | DAC event for different interrupt. |
54
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_dac.h
Function Documentation#
sl_si91x_dac_init#
sl_status_t sl_si91x_dac_init (sl_dac_clock_config_t * dac_clock)
Initialize the DAC.
[in] | dac_clock | clock structure variables ( sl_dac_clock_config_t) |
This API will power_ON to DAC peripheral and set the clock for DAC controller.
The DAC clock configurations are listed below:
soc_pll_clock (Frequency range from 1 MHZ to 180 MHz)
soc_pll_reference_clock (Frequency range from 15MHZ to 65 MHz)
division_factor (0 to 63). Default value is recommended for DAC clock configurations.
Returns
Status 0 if successful, else error code:
SL_STATUS_OK (0x0000) - Success
SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer
SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid
SL_STATUS_FAIL (0x0001) - The function failed
SL_STATUS_NOT_INITIALIZED (0x0011) - Clock is not initialized
135
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_dac.h
sl_si91x_dac_set_configuration#
sl_status_t sl_si91x_dac_set_configuration (sl_dac_config_t dac_config, float vref_value)
Configure DAC control parameters.
[in] | dac_config | DAC configuration structure variable ( sl_dac_config_t) |
[in] | vref_value | Reference voltage. |
The configurations are listed below:
Operation mode (Static/FIFO/Reference voltage for ADC)
Sample rate (16sps to 5 Msps)
DAC FIFO Threshold value(0 to 7).
Pre-conditions:
Returns
Status 0 if successful, else error code:
SL_STATUS_OK (0x0000) - Success
SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid
SL_STATUS_INVALID_RANGE (0x0028) - Mismatch Range
154
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_dac.h
sl_si91x_dac_write_data#
sl_status_t sl_si91x_dac_write_data (int16_t * data, uint16_t length)
Write digital input samples to DAC.
[in] | data | Input samples buffer pointer. |
[in] | length | Number of samples to play in DAC |
This API will write digital sample to both dynamic and static mode of DAC. For static mode sample length is '1'.
Pre-conditions:
Returns
Status 0 if successful, else error code:
SL_STATUS_OK (0x0000) - Success
SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid
SL_STATUS_INVALID_RANGE (0x0028) - Mismatch Range
171
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_dac.h
sl_si91x_dac_read_data#
sl_status_t sl_si91x_dac_read_data (uint16_t * dac_output_data)
Read DAC analog output data.
[out] | dac_output_data | DAC data will be read from DR and store in dac_output_data variable. |
Reads the analog output data of the DAC in dynamic and static mode, returning the last data played on DAC.
Pre-conditions:
Returns
Status 0 for successful execution (SL_STATUS_OK)
186
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_dac.h
sl_si91x_dac_get_achieved_sample_clock#
sl_status_t sl_si91x_dac_get_achieved_sample_clock (uint32_t sample_rate, uint32_t * sample_clock)
Get the DAC sample clock.
[in] | sample_rate | Sample rate to sample input data per sec. |
[out] | sample_clock | Sample frequency value will return in this variable. |
This API will return the DAC sample clock.
Pre-conditions:
Returns
Status 0 if successful, else error code:
SL_STATUS_OK (0x0000) - Success
SL_STATUS_INVALID_RANGE (0x0028) - Mismatch Range
202
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_dac.h
sl_si91x_dac_rewrite_data#
sl_status_t sl_si91x_dac_rewrite_data (int16_t * data, uint16_t length)
Rewrite the DAC sample data.
[in] | data | Input samples buffer pointer. |
[in] | length | Number of samples to play in DAC. |
Rewrites the input sample data in DAC FIFO operating mode. The rewrite is only applicable for FIFO mode, it will rewrite the sample data in DAC continuously.
Pre-conditions:
Returns
Status 0 if successful, else error code:
SL_STATUS_OK (0x0000) - Success
SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer
SL_STATUS_INVALID_RANGE (0x0028) - Mismatch Range
222
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_dac.h
sl_si91x_dac_register_event_callback#
sl_status_t sl_si91x_dac_register_event_callback (sl_dac_callback_t callback_event)
Register the user callback function.
[in] | callback_event | Pointer to the function which needs to be called at the time of interrupt ( sl_dac_callback_t) |
At the time of events, the function passed in the parameter is called with the respective event as the parameter. Before calling this function again, it is mandatory to call the sl_si91x_dac_unregister_event_callback function to unregister the callback, otherwise it returns SL_STATUS_BUSY error code.
Pre-conditions:
Returns
Status 0 if successful, else error code:
SL_STATUS_OK (0x0000) - Success
SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer
SL_STATUS_BUSY (0x0004) - Driver is busy
242
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_dac.h
sl_si91x_dac_unregister_event_callback#
sl_status_t sl_si91x_dac_unregister_event_callback (void )
Unregister the user callback function.
[in] |
It is mandatory to call this function before registering the callback again.
Pre-condition:
Returns
Status 0 for successful execution (SL_STATUS_OK)
254
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_dac.h
sl_si91x_dac_start#
sl_status_t sl_si91x_dac_start (void )
Start the DAC operation.
N/A |
It will enable signal to DAC, enable path to DAC controller, enable the DAC FIFO config and enable dynamic.
Pre-conditions:
Returns
Status 0 for successful execution (SL_STATUS_OK)
268
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_dac.h
sl_si91x_dac_stop#
sl_status_t sl_si91x_dac_stop (void )
Stop the DAC operation.
N/A |
It will stop signal to DAC, disconnect path to DAC controller and disable the DAC FIFO config.
Pre-conditions:
Returns
Status 0 for successful execution (SL_STATUS_OK)
283
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_dac.h
sl_si91x_dac_deinit#
sl_status_t sl_si91x_dac_deinit (void )
De-initialize the DAC.
N/A |
It will shutdown/power_off the power of DAC.
Pre-condition:
Returns
Status 0 for successful execution (SL_STATUS_OK)
293
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_dac.h
sl_si91x_dac_get_version#
sl_dac_version_t sl_si91x_dac_get_version (void )
Get the DAC version.
[in] |
Returns the release, SQA, and dev versions of the DAC.
Returns
(sl_dac_version_t) type structure
301
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_dac.h