This set of functions is for controlling/querying the SARMUX switches.
More...
This set of functions is for controlling/querying the SARMUX switches.
◆ Cy_SAR_SetAnalogSwitch()
void Cy_SAR_SetAnalogSwitch |
( |
SAR_Type * |
base, |
|
|
uint32_t |
switchMask, |
|
|
bool |
state |
|
) |
| |
Provide firmware control of the SARMUX switches for firmware sequencing.
Each call to this function can open or close a set of switches. Previously configured switches are untouched.
If the SARSEQ is enabled, there is no need to use this function.
- Parameters
-
base | Pointer to structure describing registers |
switchMask | The mask of the switches to either open or close. Select one or more values from the SARMUX Switch Control Register Masks and "OR" them together. |
state | Open or close the desired switches:
- true - open switch
- false - close switch.
|
- Note
- This is an advanced function used for the low-level hardware control of the switches. This function is not required for a typical SAR sequencer-based application.
- Function Usage
◆ Cy_SAR_GetAnalogSwitch()
uint32_t Cy_SAR_GetAnalogSwitch |
( |
const SAR_Type * |
base | ) |
|
Return the state (open or close) of SARMUX switches.
- Parameters
-
base | Pointer to structure describing registers |
- Returns
- Each bit corresponds to a single switch, where a bit value of 0 is open and 1 is closed. Compare this value to the switch masks in SARMUX Switch Control Register Masks.
- Note
- This is an advanced function used for the low-level hardware control of the switches. This function is not required for a typical SAR sequencer-based application.
◆ Cy_SAR_SetVssaVminusSwitch()
__STATIC_INLINE void Cy_SAR_SetVssaVminusSwitch |
( |
SAR_Type * |
base, |
|
|
bool |
state |
|
) |
| |
Open or close the switch between VSSA and Vminus of the SARADC through firmware.
This function calls Cy_SAR_SetAnalogSwitch with switchMask set to SAR_MUX_SWITCH0_MUX_FW_VSSA_VMINUS_Msk.
- Parameters
-
base | Pointer to structure describing registers |
state | true - open or false - close the switch. |
- Note
- This is an advanced function used for the low-level hardware control of the switches. This function is not required for a typical SAR sequencer-based application.
- Function Usage
◆ Cy_SAR_SetSwitchSarSeqCtrl()
void Cy_SAR_SetSwitchSarSeqCtrl |
( |
SAR_Type * |
base, |
|
|
uint32_t |
switchMask, |
|
|
bool |
ctrl |
|
) |
| |
Enable or disable SARSEQ control of one or more switches.
Previously configured switches are untouched.
- Parameters
-
base | Pointer to structure describing registers |
switchMask | The mask of the switches. Select one or more values from the cy_en_sar_mux_switch_sq_ctrl_t enum and "OR" them together. |
ctrl | true - enable, false - disable SARSEQ control. |
- Note
- This is an advanced function used for the low-level hardware control of the switches. This function is not required for a typical SAR sequencer-based application.
- Function Usage
◆ Cy_SAR_SetVssaSarSeqCtrl()
__STATIC_INLINE void Cy_SAR_SetVssaSarSeqCtrl |
( |
SAR_Type * |
base, |
|
|
bool |
ctrl |
|
) |
| |
Enable or disable SARSEQ control of the switch between VSSA and Vminus of the SARADC.
This function calls Cy_SAR_SetSwitchSarSeqCtrl with switchMask set to SAR_MUX_SWITCH_SQ_CTRL_MUX_SQ_CTRL_VSSA_Msk.
- Parameters
-
base | Pointer to structure describing registers |
ctrl | true - enable or false - disable control. |
- Note
- This is an advanced function used for the low-level hardware control of the switches. This function is not required for a typical SAR sequencer-based application.
- Function Usage
◆ Cy_SAR_SetDiagSwitch()
void Cy_SAR_SetDiagSwitch |
( |
const SAR_Type * |
base, |
|
|
uint32_t |
mask, |
|
|
bool |
setSwitch |
|
) |
| |
Firmware control for EXPMUX and DIAGMUX switches to connect analog signals to the SAR.
- Parameters
-
base | Pointer to structure describing registers |
mask | MUX_SWITCH2 mask value The mask to open or close switches. Select one or more values from the EXPMUX/DIAGMUX Switch Control Register Masks and "OR" them together. |
setSwitch | Mode (false: Clear mask pattern, true:Set mask pattern) |
- Returns
- None
- Note
- Applicable to PSOC4 HVMS/PA only.
◆ Cy_SAR_GetDiagSwitch()
uint32_t Cy_SAR_GetDiagSwitch |
( |
const SAR_Type * |
base | ) |
|
Get control state for EXPMUX and DIAGMUX switches.
- Parameters
-
base | Pointer to structure describing registers |
- Returns
- Mask which represent DiagSwitches return 0 if no valid switch2 present
- Note
- Applicable to PSOC4 HVMS/PA only.
◆ Cy_SAR_SetDiagHwCtrl()
void Cy_SAR_SetDiagHwCtrl |
( |
volatile SAR_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
Set MUX_SWITCH_HW_CTRL2 register value.
- Parameters
-
base | Pointer to structure describing registers |
mask | The mask of the MUX_SWITCH_HW_CTRL2 switches to allow SARSEQ control. Select one or more values from the EXPMUX/DIAGMUX Switch Control Register Masks and "OR" them together. |
- Returns
- None
- Note
- Applicable to PSOC4 HVMS/PA only.
◆ Cy_SAR_GetDiagHwCtrl()
uint32_t Cy_SAR_GetDiagHwCtrl |
( |
const SAR_Type * |
base | ) |
|
Get MUX_SWITCH_HW_CTRL2 register value.
- Parameters
-
base | Pointer to structure describing registers |
- Returns
- The mask which represents MUX_SWITCH_HW_CTRL2 Switches.
- Note
- Applicable to PSOC4 HVMS/PA only.