Cypress CSDADC Middleware Library 2.10
cy_stc_csdadc_context_t Struct Reference


The CSDADC context structure, which contains the internal driver data for the CSDADC MW.

The context structure should be allocated by the user and passed to all CSDADC MW functions.

Data Fields

cy_stc_csdadc_config_t cfgCopy
 Configuration structure copy.
cy_stc_csdadc_result_t adcResult [CY_CSDADC_MAX_CHAN_NUM]
 CSDADC result array.
cy_csdadc_callback_t ptrEOCCallback
 Pointer to a user's End Of Conversion callback function. More...
uint32_t chMask
 Active mask of channels to convert.
uint32_t counter
 Counter for CSDADC operations: More...
volatile uint16_t status
 Current CSDADC status: More...
uint16_t codeMax
 Max CSDADC code value.
uint16_t vMaxMv
 Max CSDADC input voltage in mV.
uint16_t tFull
 Calibration data.
uint16_t tVssa2Vref
 Calibration data.
uint16_t tVdda2Vref
 Calibration data.
uint16_t tRecover
 Calibration data.
uint16_t vddaMv
 Measured Vdda voltage in mV.
uint16_t vBusBMv
 Measured voltage of the analog muxbusB in mV.
uint16_t vRefMv
 Vref value in mV.
uint8_t vRefGain
 Vref gain.
uint8_t activeCh
 ID of the channel is being converted: More...
uint8_t snsClkDivider
 Divider of sense clock.
uint8_t acqCycles
 Acquisition time in Sns cycles.
uint8_t azCycles
 Auto-zero time in in Sns cycles.

Field Documentation

◆ ptrEOCCallback

cy_csdadc_callback_t cy_stc_csdadc_context_t::ptrEOCCallback

Pointer to a user's End Of Conversion callback function.

Refer to Callback section

◆ counter

uint32_t cy_stc_csdadc_context_t::counter

Counter for CSDADC operations:

  • bit [0:26] - current enabled channels cycle number:
    • In the continuous mode, sets to 0 with the conversion start and increments with every enabled channel cycle
    • In the single shot mode, is equal to 0
  • bits [27:31] - current channel number inside the current cycle

◆ status

volatile uint16_t cy_stc_csdadc_context_t::status

Current CSDADC status:

  • bit [0] - if set to 1, then CSDADC initialization is done
  • bit [1] - 0 single shot mode, 1 continuous mode
  • bit [2] - 0 CSDADC idle state, 1 CSDADC busy state
  • bit [3] - 0 ADC_RESULT did not overflow, 1 ADC_RESULT overflow
  • bit [4:7] - FSM status:
  • bit [9] - stop conversion mode
    • 0 - stop after current channel conversion
    • 1 - stop after all enabled channels in chMask

◆ activeCh

uint8_t cy_stc_csdadc_context_t::activeCh

ID of the channel is being converted:

  • bit [0:4] - ID of current measured channel;
  • CY_CSDADC_NO_CHANNEL - no active channel.