Useful Configuration Query Functions

group group_sar_functions_helper

This set of functions is for useful configuration query.

Functions

bool Cy_SAR_IsChannelSigned(const SAR_Type *base, uint32_t chan)

Return true if channel result is configured for signed format, else false.

The formats for single-ended and differential channels are independent. This function will first check whether the channel is single-ended or differential.

    /* Query if channel 0 is signed. */
    bool isSigned;
    
    isSigned = Cy_SAR_IsChannelSigned(SAR, 0UL);
Return

If channel number is invalid, false is returned

Function Usage

Parameters
  • base: Pointer to structure describing registers

  • chan: The channel to check, between 0 and CY_SAR_INJ_CHANNEL

bool Cy_SAR_IsChannelSingleEnded(const SAR_Type *base, uint32_t chan)

Return true if channel is single ended, else false.

    /* Query if channel 0 is single ended. */
    bool isSingleEnded;
    
    isSingleEnded = Cy_SAR_IsChannelSingleEnded(SAR, 0UL);
Return

If channel number is invalid, false is returned

Function Usage

Parameters
  • base: Pointer to structure describing registers

  • chan: The channel to check, between 0 and CY_SAR_INJ_CHANNEL

__STATIC_INLINE bool Cy_SAR_IsChannelDifferential (const SAR_Type *base, uint32_t chan)

Return true of channel is differential, else false.

    /* Query if channel 0 is differential. */
    bool isDifferential;
    
    isDifferential = Cy_SAR_IsChannelDifferential(SAR, 0UL);
Return

A false is return if chan is invalid.

Function Usage

Parameters
  • base: Pointer to structure describing registers

  • chan: The channel to check, starting at 0.