Analog Comparator#

Modules#

sl_analog_comparator_config_t

Enumerations#

enum
SL_COMPARATOR_1 = 1
SL_COMPARATOR_2
SL_COMPARATOR_LAST
}

Enumeration to represent the analog comparator number.

enum
SL_COMPARATOR_GPIO_INPUT_0
SL_COMPARATOR_GPIO_INPUT_1
SL_COMPARATOR_DAC_OUTPUT
SL_COMPARATOR_REFERRENCE_BUFFER_OUTPUT
SL_COMPARATOR_REFERRENCE_SCALER_OUTPUT
SL_COMPARATOR_RESISTOR_BANK_OUTPUT
SL_COMPARATOR_OPAMP1_OUTPUT
SL_COMPARATOR_OPAMP2_OUTPUT
SL_COMPARATOR_OPAMP3_OUTPUT
SL_COMPARATOR_INPUT_LAST
}

Enumeration to represent analog comparator inputs.

enum
SL_COMPARATOR_HYSTERSIS_VALUE_0
SL_COMPARATOR_HYSTERSIS_VALUE_1
SL_COMPARATOR_HYSTERSIS_VALUE_2
SL_COMPARATOR_HYSTERSIS_VALUE_3
SL_COMPARATOR_HYSTERSIS_VALUE_LAST
}

Enumeration to represent the hysteresis control values.

enum
SL_COMPARATOR_THRESHOLD_VALUE_FOR_2_33_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_2_27_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_2_21_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_2_15_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_2_10_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_2_05_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_2_00_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_95_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_91_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_86_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_82_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_79_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_75_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_71_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_68_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_64_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_61_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_58_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_55_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_53_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_50_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_47_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_45_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_42_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_40_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_38_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_35_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_33_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_31_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_29_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_27_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_25_VOLT
SL_COMPARATOR_THRESHOLD_VALUE_LAST
}

Enumeration to represent BOD threshold values for resistor bank output.

enum
SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_0_1_VOLT
SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_0_2_VOLT
SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_0_3_VOLT
SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_0_4_VOLT
SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_0_5_VOLT
SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_0_6_VOLT
SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_0_7_VOLT
SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_0_8_VOLT
SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_0_9_VOLT
SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_1_VOLT
SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_1_1_VOLT
SL_COMPARATOR_SCALE_FACTOR_VALUE_LAST
}

Enumeration to represent scale factor values for reference scaler output.

Typedefs#

typedef void(*

Typedef for the function pointer of the callback function.

Functions#

void

Initialize Analog Comparator.

sl_status_t
sl_si91x_analog_comparator_set_configurations(sl_analog_comparator_config_t *comparator_config_ptr)

Configure Analog Comparator.

sl_status_t
sl_si91x_analog_comparator_register_callback(sl_analog_comparator_number_t comparator_number, sl_analog_comparator_callback_t on_comparator_callback)

Register Analog Comparator interrupt callback.

sl_status_t
sl_si91x_analog_comparator_unregister_callback(sl_analog_comparator_number_t comp_number)

Unregister Analog Comparator interrupt callback.

sl_status_t
sl_si91x_analog_comparator_set_resistor_bank_threshold(sl_analog_comparator_threshold_values_t threshold_value)

Configure Analog Comparator resistor bank threshold.

sl_status_t
sl_si91x_analog_comparator_set_reference_scaler_output(sl_analog_comparator_scale_factor_values_t scale_factor_value)

Configure Analog Comparator reference scaler.

void

De-Initialize Analog Comparator.

Enumeration Documentation#

sl_analog_comparator_number_t#

sl_analog_comparator_number_t

Enumeration to represent the analog comparator number.

Enumerator
SL_COMPARATOR_1

Analog comparator 1.

SL_COMPARATOR_2

Analog comparator 2.

SL_COMPARATOR_LAST

Last member of enum for validation.


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

sl_analog_comparator_inputs_t#

sl_analog_comparator_inputs_t

Enumeration to represent analog comparator inputs.

Enumerator
SL_COMPARATOR_GPIO_INPUT_0

Select GPIO input for comparator non-inverting input.

SL_COMPARATOR_GPIO_INPUT_1

Select GPIO input for comparator non-inverting input.

SL_COMPARATOR_DAC_OUTPUT

Selects DAC output as comparator input.

SL_COMPARATOR_REFERRENCE_BUFFER_OUTPUT

Selects reference buffer output as comparator input.

SL_COMPARATOR_REFERRENCE_SCALER_OUTPUT

Selects reference scaler output as comparator input.

SL_COMPARATOR_RESISTOR_BANK_OUTPUT

Selects resistor bank output as comparator input.

SL_COMPARATOR_OPAMP1_OUTPUT

Selects OPAMP1 output as comparator input.

SL_COMPARATOR_OPAMP2_OUTPUT

Selects OPAMP2 output as comparator input.

SL_COMPARATOR_OPAMP3_OUTPUT

Selects OPAMP3 output as comparator input.

SL_COMPARATOR_INPUT_LAST

Last member of enum for validation.


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

sl_analog_comparator_hystersis_values_t#

sl_analog_comparator_hystersis_values_t

Enumeration to represent the hysteresis control values.

Enumerator
SL_COMPARATOR_HYSTERSIS_VALUE_0

For hysteresis control value 0.

SL_COMPARATOR_HYSTERSIS_VALUE_1

For hysteresis control value 1.

SL_COMPARATOR_HYSTERSIS_VALUE_2

For hysteresis control value 2.

SL_COMPARATOR_HYSTERSIS_VALUE_3

For hysteresis control value 3.

SL_COMPARATOR_HYSTERSIS_VALUE_LAST

Last member of enum for validation.


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

sl_analog_comparator_threshold_values_t#

sl_analog_comparator_threshold_values_t

Enumeration to represent BOD threshold values for resistor bank output.

Enumerator
SL_COMPARATOR_THRESHOLD_VALUE_FOR_2_33_VOLT

threshold value to get 2.33V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_2_27_VOLT

threshold value to get 2.27V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_2_21_VOLT

threshold value to get 2.21V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_2_15_VOLT

threshold value to get 2.15V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_2_10_VOLT

threshold value to get 2.10V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_2_05_VOLT

threshold value to get 2.05V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_2_00_VOLT

threshold value to get 2.0V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_95_VOLT

threshold value to get 1.95V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_91_VOLT

threshold value to get 1.91V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_86_VOLT

threshold value to get 1.86V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_82_VOLT

threshold value to get 1.82V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_79_VOLT

threshold value to get 1.79V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_75_VOLT

threshold value to get 1.75V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_71_VOLT

threshold value to get 1.71V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_68_VOLT

threshold value to get 1.68V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_64_VOLT

threshold value to get 1.64V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_61_VOLT

threshold value to get 1.61V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_58_VOLT

threshold value to get 1.58V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_55_VOLT

threshold value to get 1.55V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_53_VOLT

threshold value to get 1.53V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_50_VOLT

threshold value to get 1.50V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_47_VOLT

threshold value to get 1.47V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_45_VOLT

threshold value to get 1.45V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_42_VOLT

threshold value to get 1.42V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_40_VOLT

threshold value to get 1.40V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_38_VOLT

threshold value to get 1.38V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_35_VOLT

threshold value to get 1.35V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_33_VOLT

threshold value to get 1.33V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_31_VOLT

threshold value to get 1.31V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_29_VOLT

threshold value to get 1.29V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_27_VOLT

threshold value to get 1.27V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_25_VOLT

threshold value to get 1.25V as resistor bank output voltage

SL_COMPARATOR_THRESHOLD_VALUE_LAST

Last member of enum for validation.


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

sl_analog_comparator_scale_factor_values_t#

sl_analog_comparator_scale_factor_values_t

Enumeration to represent scale factor values for reference scaler output.

Enumerator
SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_0_1_VOLT

scale factor value to get 0.1V as reference scaler output voltage

SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_0_2_VOLT

scale factor value to get 0.2V as reference scaler output voltage

SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_0_3_VOLT

scale factor value to get 0.3V as reference scaler output voltage

SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_0_4_VOLT

scale factor value to get 0.4V as reference scaler output voltage

SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_0_5_VOLT

scale factor value to get 0.5V as reference scaler output voltage

SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_0_6_VOLT

scale factor value to get 0.6V as reference scaler output voltage

SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_0_7_VOLT

scale factor value to get 0.7V as reference scaler output voltage

SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_0_8_VOLT

scale factor value to get 0.8V as reference scaler output voltage

SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_0_9_VOLT

scale factor value to get 0.9V as reference scaler output voltage

SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_1_VOLT

scale factor value to get 1V as reference scaler output voltage

SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_1_1_VOLT

scale factor value to get 1.1V as reference scaler output voltage

SL_COMPARATOR_SCALE_FACTOR_VALUE_LAST

Last member of enum for validation.


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

Typedef Documentation#

sl_analog_comparator_callback_t#

typedef void(* sl_analog_comparator_callback_t) (void) )(void)

Typedef for the function pointer of the callback function.


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

Function Documentation#

sl_si91x_analog_comparator_init#

void sl_si91x_analog_comparator_init (void )

Initialize Analog Comparator.

Parameters
N/A

Enables system core clock and Auxiliary clock with 32MHZ RC clock. Configures reference LDO voltage as 2.8v

Returns

  • None


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

sl_si91x_analog_comparator_set_configurations#

sl_status_t sl_si91x_analog_comparator_set_configurations (sl_analog_comparator_config_t * comparator_config_ptr)

Configure Analog Comparator.

Parameters
[in]comparator_config_ptr

Pointer to analog comparator configuration structure sl_analog_comparator_config_t

Use this function to configure analog comparator number, select non-inverting and inverting inputs, enable or disable hysteresis, and enable or disable filter for comparator outputs. Also configure input pins.

Returns

  • Status 0 if successful, else error code:

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Analog comparator configuration structure member has invalid value.

    • SL_STATUS_OK (0x0000) - Success, analog comparator parameters configured properly.


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

sl_si91x_analog_comparator_register_callback#

sl_status_t sl_si91x_analog_comparator_register_callback (sl_analog_comparator_number_t comparator_number, sl_analog_comparator_callback_t on_comparator_callback)

Register Analog Comparator interrupt callback.

Parameters
[in]comparator_number

For comparator Number, see sl_analog_comparator_number_t for possible values.

[in]on_comparator_callback

Callback function pointer, to be invoked when a comparator interrupt occurs.

Enables its interrupts as per comparator number

Returns

  • Status 0 if successful, else error code:

    • SL_STATUS_NULL_POINTER (0x0022) - on_comparator_callback parameter is a null pointer.

    • SL_STATUS_BUSY (0x0004) - The callback is already registered, unregister previous callback before registering new one.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - comparator_number parameter has invalid value.

    • SL_STATUS_OK (0x0000) - Successfully registered timer timer-out callback.


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

sl_si91x_analog_comparator_unregister_callback#

sl_status_t sl_si91x_analog_comparator_unregister_callback (sl_analog_comparator_number_t comp_number)

Unregister Analog Comparator interrupt callback.

Parameters
[in]comp_number

For comparator Number, see sl_analog_comparator_number_t for possible values.

Disables its interrupts as per comparator number

Returns

  • Status 0 if successful, else error code:

    • SL_STATUS_INVALID_PARAMETER (0x0021) - comparator_number parameter has invalid value.

    • SL_STATUS_OK (0x0000) - Successfully registered timer timer-out callback.


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

sl_si91x_analog_comparator_set_resistor_bank_threshold#

sl_status_t sl_si91x_analog_comparator_set_resistor_bank_threshold (sl_analog_comparator_threshold_values_t threshold_value)

Configure Analog Comparator resistor bank threshold.

Parameters
[in]threshold_value

For comparator resistor bank, see sl_analog_comparator_threshold_values_t for possible values.

As per the threshold value, resistor bank output voltage will be configured. Use this API when any GPIO or external input needs to compare with internal input (resistor bank).

Returns

  • Status 0 if successful, else error code:

    • SL_STATUS_INVALID_PARAMETER (0x0021) - threshold_value parameter has invalid value.

    • SL_STATUS_OK (0x0000) - Successfully registered timer timer-out callback.


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

sl_si91x_analog_comparator_set_reference_scaler_output#

sl_status_t sl_si91x_analog_comparator_set_reference_scaler_output (sl_analog_comparator_scale_factor_values_t scale_factor_value)

Configure Analog Comparator reference scaler.

Parameters
[in]scale_factor_value

For comparator's reference scale, see sl_analog_comparator_scale_factor_values_t for possible values.

Sets the scale factor for the analog comparator module's reference scaler. As per this scale factor, reference scalar output voltage will be set. Use this API when any GPIO or external input needs to compare with internal input (reference scaler).

Returns

  • Status 0 if successful, else error code:

    • SL_STATUS_INVALID_PARAMETER (0x0021) - scale_factor_value parameter has invalid value.

    • SL_STATUS_OK (0x0000) - Successfully registered timer timer-out callback.


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

sl_si91x_analog_comparator_deinit#

void sl_si91x_analog_comparator_deinit (void )

De-Initialize Analog Comparator.

Parameters
N/A

Disables Peripheral clock and interrupts

Returns

  • None


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