# Sample Control Register Enums¶

group group_sar_sample_ctrl_register_enums

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

Enums

enum cy_en_sar_sample_ctrl_result_align_t

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.

note

The voltage conversion functions (Cy_SAR_CountsTo_Volts, Cy_SAR_CountsTo_mVolts, Cy_SAR_CountsTo_uVolts) are only valid for right alignment.

Values:

enumerator CY_SAR_RIGHT_ALIGN

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

enumerator CY_SAR_LEFT_ALIGN

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

enum cy_en_sar_sample_ctrl_single_ended_format_t

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

Values:

enumerator CY_SAR_SINGLE_ENDED_UNSIGNED

Result data for single-ended channels is unsigned.

enumerator CY_SAR_SINGLE_ENDED_SIGNED

Result data for single-ended channels is signed.

enum cy_en_sar_sample_ctrl_differential_format_t

cy_en_sar_sample_ctrl_differential_format_t: Configure format, signed or unsigned, of differential channels.

Values:

enumerator CY_SAR_DIFFERENTIAL_UNSIGNED

Result data for differential channels is unsigned.

enumerator CY_SAR_DIFFERENTIAL_SIGNED

Result data for differential channels is signed.

enum cy_en_sar_sample_ctrl_avg_cnt_t

cy_en_sar_sample_ctrl_avg_cnt_t: Configure number of samples for averaging.

This applies only to channels with averaging enabled.

Values:

enumerator CY_SAR_AVG_CNT_2

Set samples averaged to 2.

enumerator CY_SAR_AVG_CNT_4

Set samples averaged to 4.

enumerator CY_SAR_AVG_CNT_8

Set samples averaged to 8.

enumerator CY_SAR_AVG_CNT_16

Set samples averaged to 16.

enumerator CY_SAR_AVG_CNT_32

Set samples averaged to 32.

enumerator CY_SAR_AVG_CNT_64

Set samples averaged to 64.

enumerator CY_SAR_AVG_CNT_128

Set samples averaged to 128.

enumerator CY_SAR_AVG_CNT_256

Set samples averaged to 256.

enum cy_en_sar_sample_ctrl_avg_mode_t

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.

Values:

enumerator CY_SAR_AVG_MODE_SEQUENTIAL_ACCUM

Set mode to sequential accumulate and dump.

enumerator CY_SAR_AVG_MODE_SEQUENTIAL_FIXED

Set mode to sequential 12-bit fixed.

enumerator CY_SAR_AVG_MODE_INTERLEAVED

Set mode to interleaved.

Number of samples per scan must be 16 or less.

enum cy_en_sar_sample_ctrl_trigger_mode_t

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.

Values:

enumerator CY_SAR_TRIGGER_MODE_FW_ONLY

Firmware trigger only, disable hardware trigger.

enumerator CY_SAR_TRIGGER_MODE_FW_AND_HWEDGE

Enable edge sensitive hardware trigger.

Each rising edge will trigger a single scan.

enumerator CY_SAR_TRIGGER_MODE_FW_AND_HWLEVEL

Enable level sensitive hardware trigger.

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