Digital to Analog Converter#

Modules#

sl_dac_version_t

sl_dac_clock_config_t

sl_dac_config_t

Enumerations#

enum
SL_DAC_FIFO_MODE
SL_DAC_STATIC_MODE
SL_DAC_OUTPUT_REF_VOLTAGE_FOR_ADC
SL_DAC_OPERATION_MODE_LAST
}

Enumeration for DAC operation mode.

enum
SL_DAC_FIFO_MODE_EVENT = 1
SL_DAC_STATIC_MODE_EVENT
}

Enumeration for DAC callback events.

enum
SL_DAC_ADC_CHANNEL_0
SL_DAC_ADC_CHANNEL_1
SL_DAC_ADC_CHANNEL_2
SL_DAC_ADC_CHANNEL_3
SL_DAC_ADC_CHANNEL_4
SL_DAC_ADC_CHANNEL_5
SL_DAC_ADC_CHANNEL_6
SL_DAC_ADC_CHANNEL_7
SL_DAC_ADC_CHANNEL_8
SL_DAC_ADC_CHANNEL_9
SL_DAC_ADC_CHANNEL_10
SL_DAC_ADC_CHANNEL_11
SL_DAC_ADC_CHANNEL_12
SL_DAC_ADC_CHANNEL_13
SL_DAC_ADC_CHANNEL_14
SL_DAC_ADC_CHANNEL_15
}

Enumeration for ADC channel this enum only used on Reference voltage for ADC mode of DAC.

Typedefs#

typedef void(*
sl_dac_callback_t)(uint8_t event)

Typedef for user supplied callback function which is called when a DAC samples completes.

Functions#

sl_status_t
sl_si91x_dac_init(sl_dac_clock_config_t *dac_clock)

Initialize the DAC.

sl_status_t
sl_si91x_dac_set_configuration(sl_dac_config_t dac_config, float vref_value)

Configure DAC control parameters.

sl_status_t
sl_si91x_dac_write_data(int16_t *data, uint16_t length)

Write digital input samples to DAC.

sl_status_t
sl_si91x_dac_read_data(uint16_t *dac_output_data)

Read DAC analog output data.

sl_status_t
sl_si91x_dac_get_achieved_sample_clock(uint32_t sample_rate, uint32_t *sample_clock)

Get the DAC sample clock.

sl_status_t
sl_si91x_dac_rewrite_data(int16_t *data, uint16_t length)

Rewrite the DAC sample data.

sl_status_t
sl_si91x_dac_register_event_callback(sl_dac_callback_t callback_event)

Register the user callback function.

sl_status_t

Unregister the user callback function.

sl_status_t

Start the DAC operation.

sl_status_t

Stop the DAC operation.

sl_status_t

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.


Definition at line 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.


Definition at line 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.


Definition at line 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.

Parameters
[in]event

DAC event for different interrupt.


Definition at line 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.

Parameters
[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


Definition at line 137 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.

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).

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


Definition at line 156 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.

Parameters
[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'.

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


Definition at line 173 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.

Parameters
[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.

Returns

  • Status 0 for successful execution (SL_STATUS_OK)


Definition at line 188 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.

Parameters
[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.

Returns

  • Status 0 if successful, else error code:

    • SL_STATUS_OK (0x0000) - Success

    • SL_STATUS_INVALID_RANGE (0x0028) - Mismatch Range


Definition at line 204 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.

Parameters
[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.

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


Definition at line 224 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.

Parameters
[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.

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


Definition at line 244 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.

Parameters
[in]

It is mandatory to call this function before registering the callback again.

Returns

  • Status 0 for successful execution (SL_STATUS_OK)


Definition at line 256 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.

Parameters
N/A

It will enable signal to DAC, enable path to DAC controller, enable the DAC FIFO config and enable dynamic.

Returns

  • Status 0 for successful execution (SL_STATUS_OK)


Definition at line 270 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.

Parameters
N/A

It will stop signal to DAC, disconnect path to DAC controller and disable the DAC FIFO config.

Returns

  • Status 0 for successful execution (SL_STATUS_OK)


Definition at line 285 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.

Parameters
N/A

It will shutdown/power_off the power of DAC.

Returns

  • Status 0 for successful execution (SL_STATUS_OK)


Definition at line 295 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.

Parameters
[in]

Returns the release, SQA, and dev versions of the DAC.

Returns


Definition at line 303 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_dac.h