Data Structures

group group_sar_data_structures
struct SAR_Type
#include <ip_type.h>

The struct type definition for the hardware register set contained in the block.

The address of a variable of this type can be used as the base hardware address for register access. A device may support more than one instance of a peripheral block.

Refer to a device-specific header file, e.g.

<PDL_DIR>/COMPONENT_CAT1A/include/cy8c637bzi_bld74.h for the list of block instances available on that device.

Refer to the device TRM for the block register descriptions.

struct cy_stc_sar_fifo_config_t
#include <cy_sar.h>

FIFO configuration structure.

Public Members

bool chanId

Enable the channel ID in the results.

bool chainToNext

Chain the FIFO to the next FIFO.

bool clrTrIntrOnRead

Enable the FIFO level trigger (and optional level interrupt) clearing on FIFO read.

uint32_t level

A trigger (and optional interrupt) event occurs when the number of FIFO entries overcomes the Level setting.

Range: 1..256

bool trOut

SAR output trigger is set by the ‘level’ condition.

struct cy_stc_sar_config_t
#include <cy_sar.h>

This structure is used to initialize the SAR ADC subsystem.

The SAR ADC subsystem is highly configurable with many options. When calling Cy_SAR_Init, provide a pointer to the structure containing this configuration data. A set of enumerations is provided in this driver to help with configuring this structure.

See the Initialization and Enable section for guidance.

Public Members

uint32_t ctrl

Control register settings (applies to all channels)

uint32_t sampleCtrl

Sample control register settings (applies to all channels)

uint32_t sampleTime01

Sample time in ADC clocks for Sample Time 0 and 1.

uint32_t sampleTime23

Sample time in ADC clocks for Sample Time 2 and 3.

uint32_t rangeThres

Range detect threshold register for all channels.

cy_en_sar_range_detect_condition_t rangeCond

Range detect condition (below, inside, output, or above) for all channels.

uint32_t chanEn

Enable bits for the channels.

uint32_t chanConfig[CY_SAR_NUM_CHANNELS]

Channel configuration.

uint32_t intrMask

Interrupt enable mask.

uint32_t satIntrMask

Saturation detection interrupt enable mask.

uint32_t rangeIntrMask

Range detection interrupt enable mask.

uint32_t muxSwitch

SARMUX firmware switches to connect analog signals to SAR.

uint32_t muxSwitchSqCtrl

Enable SARSEQ control of specific SARMUX switches.

bool configRouting

Configure or ignore routing related registers (muxSwitch, muxSwitchSqCtrl)

uint32_t vrefMvValue

Reference voltage in millivolts used in converting counts to volts.

cy_en_sar_clock_source_t clock

Clock source selection (enable/disable SAR operation in the Deep Sleep mode).

Ignored for PASS_ver1.

cy_stc_sar_fifo_config_t const *fifoCfgPtr

Pointer to the FIFO configuration structure cy_stc_sar_fifo_config_t, if NULL - the FIFO is not used.

Should be NULL for PASS_ver1.

bool trTimer

SAR is being triggered from the Timer Timer .

Ignored for PASS_ver1.

bool scanCnt

Enable the scanning counter, configured by Cy_SAR_CommonInit.

Ignored for PASS_ver1.

bool scanCntIntr

EOS interrupt on scanning counter event.

Ignored for PASS_ver1.

struct cy_stc_sar_common_config_t
#include <cy_sar.h>

SAR triggering configuration structure.

Public Members

uint32_t pwrUpDelay

Power up delay for SAR blocks in Deep Sleep Clock cycles.

Range 0..255.

uint32_t scanCount

Configures the number of samples SAR will take when triggered.

Range 1..256.

uint32_t simultControl

Configures the SAR ADCs for simultaneous control.

The value is a combined mask, created using following macros:

uint32_t simultTrigSource

Configures the trigger source for simultaneous SAR hardware trigger.

Use one of the following values:

cy_en_sar_simult_trig_event_sel_t simultTrigEvent

Configures simultaneous trigger signal event.

cy_en_sar_simult_trig_sync_sel_t simultTrigSync

Enables synchronization of trigger signal.

cy_en_sar_simult_trig_sample_sel_t simultSamplesPerTrigger

Configures scan sampling mode for each trigger event.

cy_en_sar_simult_trig_intr_sel_t simultEOSIntrSelect

Configures EOS interrupt condition.

struct cy_stc_sar_state_backup_t
#include <cy_sar.h>

This structure is used by the driver to backup the state of the SAR before entering sleep so that it can be re-enabled after waking up.

Public Members

uint32_t hwEnabled

SAR enabled state.

uint32_t continuous

State of the continuous bit.

struct cy_stc_sar_fifo_read_t
#include <cy_sar.h>

Structure to read the FIFO buffer.

Public Members

uint16_t value

SAR sample.

uint16_t channel

SAR channel.