Implementation of the analog comparator (COMP) driver on top of the CTB opamps.
◆ _cyhal_comp_ctb_init()
Initialize the Comparator peripheral for a CTB-based comparator.
- Parameters
-
[out] | obj | Pointer to a Comparator object. The caller must allocate the memory for this object but the init function will initialize its contents. |
[in] | vin_p | Non-inverting input pin |
[in] | vin_m | Inverting input pin |
[in] | output | Comparator output pin. May be NC. |
[in] | cfg | Configuration structure |
- Returns
- The status of the init request
◆ _cyhal_comp_ctb_free()
Deinitialize the Comparator peripheral for a CTB-based comparator.
- Parameters
-
◆ _cyhal_comp_ctb_set_power()
Changes the current operating power level of the comparator for a CTB-based comparator.
If the power level is set to CYHAL_POWER_LEVEL_OFF, the comparator will be powered-off but it will retain its configuration, so it is not necessary to reconfigure it when changing the power level from CYHAL_POWER_LEVEL_OFF to any other value.
- Parameters
-
[in] | obj | Comparator object |
[in] | power | The power level to set |
- Returns
- The status of the set power request
◆ _cyhal_comp_ctb_configure()
Reconfigure the Comparator for a CTB-based comparator.
This retains the powered state of the comparator. Depending on the implementation, it may be necessary to temporarily deconfigure and/or power off the comparator in order to apply the new configuration. However, if the comparator is powered-off when this function is called, it will remain powered-off after it returns. Likewise, if the comparator is powered-on when this function is called, it will remain powered-on after it returns.
- Parameters
-
[in] | obj | Comparator object |
[in] | cfg | New configuration to apply |
- Returns
- The status of the configure request
◆ _cyhal_comp_ctb_read()
Reads the Comparator state for a CTB-based comparator.
- Parameters
-
- Returns
- The Comparator state. True if the non-inverting pin voltage is greater than the inverting pin voltage, false otherwise.
◆ _cyhal_comp_ctb_enable_event()
Enable or Disable a Comparator event for a CTB-based comparator.
When an enabled event occurs, the function specified by cyhal_comp_register_callback will be called.
- Parameters
-
[in] | obj | Comparator object |
[in] | event | Comparator event |
[in] | intr_priority | Priority for NVIC interrupt events |
[in] | enable | True to turn on event, False to turn off |