Analog Comparator#

Introduction#

The Analog Comparator is a peripheral that compares two analog input voltages and triggers an interrupt when non-inverting is higher than inverting. It typically has two input pins for comparing analog voltages.

Analog comparators are often used in:

  • Battery Monitoring: Detecting low battery conditions.

  • Threshold Detection: Triggering events when signals exceed predefined thresholds.

  • Sensor Interface: Comparing sensor outputs to reference voltages.

  • Wake-up Signals: Bringing the micro-controller out of low-power modes.

Key Features:

  • Both comparators can take inputs from GPIOs.

  • Each comparator has nine different input sources, two of which are external GPIO pin inputs.

  • Multiple comparison scenarios:

    • Compare external pin inputs.

    • Compare external pin input to internal voltages.

    • Compare internal voltages.

  • The inputs of the two comparators can be independently programmed.

  • Shared resources: The reference buffer, scaler, and resistor bank are shared between the comparators and can only be enabled when at least one comparator is active.

Configuration#

The Analog Comparator can be configured using several parameters, including:

  • Non-Inverting Input Source: Select the positive input for the comparator.

  • Inverting Input Source: Select the negative input for the comparator.

  • Hysteresis: Enable or disable hysteresis to prevent noise from causing rapid toggling of the output.

  • Filter Enable/Disable: Control noise filtering on the input signal.

These configurations are encapsulated in the sl_analog_comparator_config_t structure and initialized using the sl_si91x_analog_comparator_set_configurations API.

For more details on configuration parameters, see the respective peripheral example readme document.

Usage#

After defining the Analog Comparator configuration structures and passing an instance of sl_analog_comparator_config_t, the following functions can be used to initiate and configure the ACMP module. The typical flow for implementation is as follows:

  1. Initialize the ACMP driver: sl_si91x_analog_comparator_init

  2. Set comparator configurations: sl_si91x_analog_comparator_set_configurations

  3. Set reference scaler output (if using a reference scaler): sl_si91x_analog_comparator_set_reference_scaler_output

  4. Set resistor bank threshold (if using a resistor bank): sl_si91x_analog_comparator_set_resistor_bank_threshold

  5. Register a callback for comparator events: sl_si91x_analog_comparator_register_callback

  6. Deinitialize the ACMP driver: sl_si91x_analog_comparator_deinit

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_EXTERNAL_GPIO_INPUT_0
SL_COMPARATOR_GPIO_INPUT_1 = SL_COMPARATOR_EXTERNAL_GPIO_INPUT_1
SL_COMPARATOR_DAC_OUTPUT = SL_COMPARATOR_INPUT_FROM_DAC_OUTPUT
SL_COMPARATOR_REFERENCE_BUFFER_OUTPUT = SL_COMPARATOR_INPUT_FROM_REF_BUFFER_OUTPUT
SL_COMPARATOR_REFERENCE_SCALER_OUTPUT = SL_COMPARATOR_INPUT_FROM_REF_SCALER_OUTPUT
SL_COMPARATOR_RESISTOR_BANK_OUTPUT = SL_COMPARATOR_INPUT_FROM_RES_BANK_OUTPUT
SL_COMPARATOR_OPAMP1_OUTPUT = SL_COMPARATOR_INPUT_FROM_OPAMP1_OUTPUT
SL_COMPARATOR_OPAMP2_OUTPUT = SL_COMPARATOR_INPUT_FROM_OPAMP2_OUTPUT
SL_COMPARATOR_OPAMP3_OUTPUT = SL_COMPARATOR_INPUT_FROM_OPAMP3_OUTPUT
SL_COMPARATOR_INPUT_LAST
}

Enumeration to represent the types of 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_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

To initialize the Analog Comparator and configure the necessary clocks and reference voltage.

sl_status_t
sl_si91x_analog_comparator_set_configurations(sl_analog_comparator_config_t *comparator_config_ptr)

To configure the analog comparator settings and initialize the selected 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)

To register the Analog Comparator interrupt callback and enable its interrupts as per comparator number.

sl_status_t
sl_si91x_analog_comparator_unregister_callback(sl_analog_comparator_number_t comp_number)

To unregister the Analog Comparator interrupt callback and disable its interrupts as per comparator number.

sl_status_t
sl_si91x_analog_comparator_set_resistor_bank_threshold(sl_analog_comparator_threshold_values_t threshold_value)

To configure the 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)

To configure the reference scaler for the Analog Comparator and set the scale factor.

void

To de-initialize the Analog Comparator.

Macros#

#define

External GPIO input 0.

#define

External GPIO input 1.

#define

Input from DAC output.

#define

Input from reference buffer output.

#define

Input from reference scaler output.

#define

Input from resistor bank output.

#define

Input from OPAMP1 output.

#define

Input from OPAMP2 output.

#define

Input from OPAMP3 output.

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 75 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 the types of 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_REFERENCE_BUFFER_OUTPUT

Selects reference buffer output as comparator input.

SL_COMPARATOR_REFERENCE_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 84 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

Hysteresis control value 0.

SL_COMPARATOR_HYSTERSIS_VALUE_1

Hysteresis control value 1.

SL_COMPARATOR_HYSTERSIS_VALUE_2

Hysteresis control value 2.

SL_COMPARATOR_HYSTERSIS_VALUE_3

Hysteresis control value 3.

SL_COMPARATOR_HYSTERSIS_VALUE_LAST

Last member of enum for validation.


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

Note

  • Values of the enumerator are calculated using VBAT = 3.5066 V and these values vary from board to board.

Enumerator
SL_COMPARATOR_THRESHOLD_VALUE_FOR_2_27_VOLT

Threshold value to get 2.27 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_2_21_VOLT

Threshold value to get 2.21 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_2_15_VOLT

Threshold value to get 2.1 5V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_2_10_VOLT

Threshold value to get 2.10 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_2_05_VOLT

Threshold value to get 2.05 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_2_00_VOLT

Threshold value to get 2.00 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_95_VOLT

Threshold value to get 1.95 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_91_VOLT

Threshold value to get 1.91 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_86_VOLT

Threshold value to get 1.86 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_82_VOLT

Threshold value to get 1.82 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_79_VOLT

Threshold value to get 1.79 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_75_VOLT

Threshold value to get 1.75 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_71_VOLT

Threshold value to get 1.71 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_68_VOLT

Threshold value to get 1.68 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_64_VOLT

Threshold value to get 1.64 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_61_VOLT

Threshold value to get 1.61 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_58_VOLT

Threshold value to get 1.58 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_55_VOLT

Threshold value to get 1.55 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_53_VOLT

Threshold value to get 1.53 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_50_VOLT

Threshold value to get 1.50 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_47_VOLT

Threshold value to get 1.47 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_45_VOLT

Threshold value to get 1.45 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_42_VOLT

Threshold value to get 1.42 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_40_VOLT

Threshold value to get 1.40 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_38_VOLT

Threshold value to get 1.38 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_35_VOLT

Threshold value to get 1.35 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_33_VOLT

Threshold value to get 1.33 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_31_VOLT

Threshold value to get 1.31 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_29_VOLT

Threshold value to get 1.29 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_27_VOLT

Threshold value to get 1.27 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_FOR_1_25_VOLT

Threshold value to get 1.25 V as resistor bank output voltage.

SL_COMPARATOR_THRESHOLD_VALUE_LAST

Last member of enum for validation.


Definition at line 119 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.1 V as reference scaler output voltage.

SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_0_2_VOLT

Scale factor value to get 0.2 V as reference scaler output voltage.

SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_0_3_VOLT

Scale factor value to get 0.3 V as reference scaler output voltage.

SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_0_4_VOLT

Scale factor value to get 0.4 V as reference scaler output voltage.

SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_0_5_VOLT

Scale factor value to get 0.5 V as reference scaler output voltage.

SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_0_6_VOLT

Scale factor value to get 0.6 V as reference scaler output voltage.

SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_0_7_VOLT

Scale factor value to get 0.7 V as reference scaler output voltage.

SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_0_8_VOLT

Scale factor value to get 0.8 V as reference scaler output voltage.

SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_0_9_VOLT

Scale factor value to get 0.9 V as reference scaler output voltage.

SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_1_VOLT

Scale factor value to get 1 V as reference scaler output voltage.

SL_COMPARATOR_SCALE_FACTOR_VALUE_FOR_1_1_VOLT

Scale factor value to get 1.1 V 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 70 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 )

To initialize the Analog Comparator and configure the necessary clocks and reference voltage.

Parameters
N/A

This API enables the system core clock and auxiliary clock with a MHz RC clock. It also configures the reference LDO voltage to 3.3 V.

Note

  • This function must be called before using any other analog comparator functions.

  • The system core clock must be properly configured.


Definition at line 198 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)

To configure the analog comparator settings and initialize the selected comparator.

Parameters
[in]comparator_config_ptr

Pointer to analog comparator configuration structure sl_analog_comparator_config_t

This API configures the analog comparator by selecting the comparator number, non-inverting and inverting inputs, enabling or disabling hysteresis, and enabling or disabling the filter for comparator outputs. It also configures the input pins.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Success, analog comparator parameters configured properly.

    • SL_STATUS_INVALID_PARAMETER - Analog comparator configuration structure member has an invalid value.

For more information on the status documentation, see SL STATUS DOCUMENTATION.


Definition at line 219 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)

To register the Analog Comparator interrupt callback and enable its interrupts as per comparator number.

Parameters
[in]comparator_number

For comparator number, see sl_analog_comparator_number_t for possible values.

[in]on_comparator_callback

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

This API registers a callback function to be invoked when a comparator interrupt occurs and enables the interrupts for the specified comparator number.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Successfully registered comparator interrupt callback.

    • SL_STATUS_BUSY - The callback is already registered. Unregister the existing callback before registering a new one.

    • SL_STATUS_INVALID_PARAMETER - sl_analog_comparator_callback_t comparator_number parameter has an invalid value.

    • SL_STATUS_NULL_POINTER - sl_analog_comparator_callback_t on_comparator_callback parameter is a null pointer.

For more information on the status documentation, see SL STATUS DOCUMENTATION.


Definition at line 243 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)

To unregister the Analog Comparator interrupt callback and disable its interrupts as per comparator number.

Parameters
[in]comp_number

For comparator number, see sl_analog_comparator_number_t for possible values.

This API disables the interrupts for the specified comparator number and unregisters the callback function.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Successfully unregistered comparator interrupt callback.

    • SL_STATUS_INVALID_PARAMETER - comparator_number parameter has an invalid value.

For more information on the status documentation, see SL STATUS DOCUMENTATION.


Definition at line 265 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)

To configure the Analog Comparator resistor bank threshold.

Parameters
[in]threshold_value

For comparator resistor bank, see sl_analog_comparator_threshold_values_t for possible values.

This API configures the resistor bank output voltage based on the specified threshold value. Use this input when one of the comparator inputs is the resistor bank output.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Successfully configured the resistor bank threshold.

    • SL_STATUS_INVALID_PARAMETER - threshold_value parameter has an invalid value.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 288 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)

To configure the reference scaler for the Analog Comparator and set the scale factor.

Parameters
[in]scale_factor_value

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

This API sets the scale factor for the analog comparator module's reference scaler. As per this scale factor, the reference scaler output voltage will be set. Use this input when one of the comparator inputs is the reference scaler output.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Successfully configured the reference scaler output. For more information on the status documentation, see SL STATUS DOCUMENTATION.

    • SL_STATUS_INVALID_PARAMETER - scale_factor_value parameter has an invalid value. For more information on the status documentation, see SL STATUS DOCUMENTATION.


Definition at line 312 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 )

To de-initialize the Analog Comparator.

Parameters
N/A

This API de-initializes the analog comparator by disabling the peripheral clock & comparator interrupts.


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

Macro Definition Documentation#

SL_COMPARATOR_EXTERNAL_GPIO_INPUT_0#

#define SL_COMPARATOR_EXTERNAL_GPIO_INPUT_0
Value:
0

External GPIO input 0.


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

SL_COMPARATOR_EXTERNAL_GPIO_INPUT_1#

#define SL_COMPARATOR_EXTERNAL_GPIO_INPUT_1
Value:
1

External GPIO input 1.


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

SL_COMPARATOR_INPUT_FROM_DAC_OUTPUT#

#define SL_COMPARATOR_INPUT_FROM_DAC_OUTPUT
Value:
2

Input from DAC output.


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

SL_COMPARATOR_INPUT_FROM_REF_BUFFER_OUTPUT#

#define SL_COMPARATOR_INPUT_FROM_REF_BUFFER_OUTPUT
Value:
3

Input from reference buffer output.


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

SL_COMPARATOR_INPUT_FROM_REF_SCALER_OUTPUT#

#define SL_COMPARATOR_INPUT_FROM_REF_SCALER_OUTPUT
Value:
4

Input from reference scaler output.


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

SL_COMPARATOR_INPUT_FROM_RES_BANK_OUTPUT#

#define SL_COMPARATOR_INPUT_FROM_RES_BANK_OUTPUT
Value:
5

Input from resistor bank output.


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

SL_COMPARATOR_INPUT_FROM_OPAMP1_OUTPUT#

#define SL_COMPARATOR_INPUT_FROM_OPAMP1_OUTPUT
Value:
6

Input from OPAMP1 output.


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

SL_COMPARATOR_INPUT_FROM_OPAMP2_OUTPUT#

#define SL_COMPARATOR_INPUT_FROM_OPAMP2_OUTPUT
Value:
7

Input from OPAMP2 output.


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

SL_COMPARATOR_INPUT_FROM_OPAMP3_OUTPUT#

#define SL_COMPARATOR_INPUT_FROM_OPAMP3_OUTPUT
Value:
8

Input from OPAMP3 output.


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