PSoC 6 Peripheral Driver Library
Sample Control Register Enums

General Description

This set of enumerations are used in configuring the SAR SAMPLE_CTRL register.

Enumerations

enum  cy_en_sar_sample_ctrl_result_align_t {
  CY_SAR_RIGHT_ALIGN = 0uL << SAR_SAMPLE_CTRL_LEFT_ALIGN_Pos,
  CY_SAR_LEFT_ALIGN = 1uL << SAR_SAMPLE_CTRL_LEFT_ALIGN_Pos
}
 Configure result alignment, either left or right aligned. More...
 
enum  cy_en_sar_sample_ctrl_single_ended_format_t {
  CY_SAR_SINGLE_ENDED_UNSIGNED = 0uL << SAR_SAMPLE_CTRL_SINGLE_ENDED_SIGNED_Pos,
  CY_SAR_SINGLE_ENDED_SIGNED = 1uL << SAR_SAMPLE_CTRL_SINGLE_ENDED_SIGNED_Pos
}
 Configure format, signed or unsigned, of single-ended channels. More...
 
enum  cy_en_sar_sample_ctrl_differential_format_t {
  CY_SAR_DIFFERENTIAL_UNSIGNED = 0uL << SAR_SAMPLE_CTRL_DIFFERENTIAL_SIGNED_Pos,
  CY_SAR_DIFFERENTIAL_SIGNED = 1uL << SAR_SAMPLE_CTRL_DIFFERENTIAL_SIGNED_Pos
}
 Configure format, signed or unsigned, of differential channels. More...
 
enum  cy_en_sar_sample_ctrl_avg_cnt_t {
  CY_SAR_AVG_CNT_2 = 0uL << SAR_SAMPLE_CTRL_AVG_CNT_Pos,
  CY_SAR_AVG_CNT_4 = 1uL << SAR_SAMPLE_CTRL_AVG_CNT_Pos,
  CY_SAR_AVG_CNT_8 = 2uL << SAR_SAMPLE_CTRL_AVG_CNT_Pos,
  CY_SAR_AVG_CNT_16 = 3uL << SAR_SAMPLE_CTRL_AVG_CNT_Pos,
  CY_SAR_AVG_CNT_32 = 4uL << SAR_SAMPLE_CTRL_AVG_CNT_Pos,
  CY_SAR_AVG_CNT_64 = 5uL << SAR_SAMPLE_CTRL_AVG_CNT_Pos,
  CY_SAR_AVG_CNT_128 = 6uL << SAR_SAMPLE_CTRL_AVG_CNT_Pos,
  CY_SAR_AVG_CNT_256 = 7uL << SAR_SAMPLE_CTRL_AVG_CNT_Pos
}
 Configure number of samples for averaging. More...
 
enum  cy_en_sar_sample_ctrl_avg_mode_t {
  CY_SAR_AVG_MODE_SEQUENTIAL_ACCUM = 0uL,
  CY_SAR_AVG_MODE_SEQUENTIAL_FIXED = SAR_SAMPLE_CTRL_AVG_SHIFT_Msk,
  CY_SAR_AVG_MODE_INTERLEAVED = SAR_SAMPLE_CTRL_AVG_MODE_Msk
}
 Configure the averaging mode. More...
 
enum  cy_en_sar_sample_ctrl_trigger_mode_t {
  CY_SAR_TRIGGER_MODE_FW_ONLY = 0uL,
  CY_SAR_TRIGGER_MODE_FW_AND_HWEDGE = SAR_SAMPLE_CTRL_DSI_TRIGGER_EN_Msk,
  CY_SAR_TRIGGER_MODE_FW_AND_HWLEVEL = SAR_SAMPLE_CTRL_DSI_TRIGGER_EN_Msk | SAR_SAMPLE_CTRL_DSI_TRIGGER_LEVEL_Msk
}
 Configure the trigger mode. More...
 

Enumeration Type Documentation

◆ cy_en_sar_sample_ctrl_result_align_t

Configure result alignment, either left or right aligned.

Note
Averaging always uses right alignment. If the CY_SAR_LEFT_ALIGN is selected with averaging enabled, it is ignored.
The voltage conversion functions (Cy_SAR_CountsTo_Volts, Cy_SAR_CountsTo_mVolts, Cy_SAR_CountsTo_uVolts) are only valid for right alignment.
Enumerator
CY_SAR_RIGHT_ALIGN 

Right align result data to bits [11:0] with sign extension to 16 bits if channel is signed.

CY_SAR_LEFT_ALIGN 

Left align result data to bits [15:4].

◆ cy_en_sar_sample_ctrl_single_ended_format_t

Configure format, signed or unsigned, of single-ended channels.

Enumerator
CY_SAR_SINGLE_ENDED_UNSIGNED 

Result data for single-ended channels is unsigned.

CY_SAR_SINGLE_ENDED_SIGNED 

Result data for single-ended channels is signed.

◆ cy_en_sar_sample_ctrl_differential_format_t

Configure format, signed or unsigned, of differential channels.

Enumerator
CY_SAR_DIFFERENTIAL_UNSIGNED 

Result data for differential channels is unsigned.

CY_SAR_DIFFERENTIAL_SIGNED 

Result data for differential channels is signed.

◆ cy_en_sar_sample_ctrl_avg_cnt_t

Configure number of samples for averaging.

This applies only to channels with averaging enabled.

Enumerator
CY_SAR_AVG_CNT_2 

Set samples averaged to 2.

CY_SAR_AVG_CNT_4 

Set samples averaged to 4.

CY_SAR_AVG_CNT_8 

Set samples averaged to 8.

CY_SAR_AVG_CNT_16 

Set samples averaged to 16.

CY_SAR_AVG_CNT_32 

Set samples averaged to 32.

CY_SAR_AVG_CNT_64 

Set samples averaged to 64.

CY_SAR_AVG_CNT_128 

Set samples averaged to 128.

CY_SAR_AVG_CNT_256 

Set samples averaged to 256.

◆ cy_en_sar_sample_ctrl_avg_mode_t

Configure the averaging mode.

  • Sequential accumulate and dump: a channel will be sampled back to back. The result is added to a running sum in a 20-bit register. At the end of the scan, the accumulated value is shifted right to fit into 16 bits and stored into the CHAN_RESULT register.
  • Sequential fixed: a channel will be sampled back to back. The result is added to a running sum in a 20-bit register. At the end of the scan, the accumulated value is shifted right to fit into 12 bits and stored into the CHAN_RESULT register.
  • Interleaved: a channel will be sampled once per scan. The result is added to a running sum in a 16-bit register. In the scan where the final averaging count is reached, the accumulated value is shifted right to fit into 12 bits and stored into the CHAN_RESULT register. In all other scans, the CHAN_RESULT will have an invalid result. In interleaved mode, make sure that the averaging count is low enough to ensure that the intermediate value does not exceed 16 bits, that is averaging count is 16 or less. Otherwise, the MSBs will be lost. In the special case that averaging is enabled for all enabled channels and interleaved mode is used, the interrupt frequency will be reduced by a factor of the number of samples averaged.
Enumerator
CY_SAR_AVG_MODE_SEQUENTIAL_ACCUM 

Set mode to sequential accumulate and dump.

CY_SAR_AVG_MODE_SEQUENTIAL_FIXED 

Set mode to sequential 12-bit fixed.

CY_SAR_AVG_MODE_INTERLEAVED 

Set mode to interleaved.

Number of samples per scan must be 16 or less.

◆ cy_en_sar_sample_ctrl_trigger_mode_t

Configure the trigger mode.

Firmware triggering is always enabled and can be single shot or continuous. Additionally, hardware triggering can be enabled with the option to be edge or level sensitive.

Enumerator
CY_SAR_TRIGGER_MODE_FW_ONLY 

Firmware trigger only, disable hardware trigger.

CY_SAR_TRIGGER_MODE_FW_AND_HWEDGE 

Enable edge sensitive hardware trigger.

Each rising edge will trigger a single scan.

CY_SAR_TRIGGER_MODE_FW_AND_HWLEVEL 

Enable level sensitive hardware trigger.

The SAR will continuously scan while the trigger signal is high.