Switch Control Functions

group group_ctdac_functions_switches

This set of functions is for controlling the two CTDAC analog switches, CVD, and CO6.

These are advanced functions. The switches will be managed by the reference source and output mode selections when initializing the hardware.

Functions

void Cy_CTDAC_SetAnalogSwitch(CTDAC_Type *base, uint32_t switchMask, cy_en_ctdac_switch_state_t state)

Provide firmware control of the CTDAC switches.

Each call to this function can open a set of switches or close a set of switches.

note

The switches are configured by the reference source and output mode selections during initialization.

    /* Scenario: In addition to buffering the DAC output through Opamp0 of the connecting
     * CTB, route the DAC output to a dedicated device pin by closing the CO6 switch. */
    
    Cy_CTDAC_SetAnalogSwitch(CTDAC0, (uint32_t) CY_CTDAC_SWITCH_CO6_MASK, CY_CTDAC_SWITCH_CLOSE);
Return

None

Function Usage

Parameters
  • base: Pointer to structure describing registers

  • switchMask: The mask of the switches to either open or close. Select one or more values from cy_en_ctdac_switches_t and “OR” them together.

  • state: Open or close the switch(es). Select a value from cy_en_ctdac_switch_state_t.

__STATIC_INLINE uint32_t Cy_CTDAC_GetAnalogSwitch (const CTDAC_Type *base)

Return the state (open or close) of the CTDAC switches.

note

The switches will be managed by the reference source and output mode selections when initializing the hardware.

Return

Switch state. Compare this value to the masks found in cy_en_ctdac_switches_t.

Parameters
  • base: Pointer to structure describing registers

__STATIC_INLINE void Cy_CTDAC_SetSwitchCO6 (CTDAC_Type *base, cy_en_ctdac_switch_state_t state)

Open or close switch CO6 that controls whether the output gets routed directly to a pin or through Opamp0 of the CTB.

This function calls Cy_CTDAC_SetAnalogSwitch with the switchMask set to CY_CTDAC_SWITCH_CO6_MASK.

note

The switches is configured by the output mode selections during initialization.

note

This switch will temporarily be opened for deglitching if the deglitch mode is CY_CTDAC_DEGLITCHMODE_UNBUFFERED or CY_CTDAC_DEGLITCHMODE_BOTH.

    /* Scenario: In addition to buffering the DAC output through Opamp0 of the connecting
     * CTB, route the DAC output to a dedicated device pin by closing the CO6 switch. */
    
    Cy_CTDAC_SetSwitchCO6(CTDAC0, CY_CTDAC_SWITCH_CLOSE);
Return

None

Function Usage

Parameters
  • base: Pointer to structure describing registers

  • state: State of the switch, open or close.

__STATIC_INLINE void Cy_CTDAC_OpenAllSwitches (CTDAC_Type *base)

Open all switches in the CTDAC (CO6 and CVD).

    /* Scenario: Reset all the switches to destroy all previous connections. */
    
    Cy_CTDAC_OpenAllSwitches(CTDAC0);
Return

None

Function Usage

Parameters
  • base: Pointer to structure describing registers