MTB CAT1 Peripheral driver library

General Description

Enumerations

enum  cy_en_sar2_status_t {
  CY_SAR2_SUCCESS = 0x00U,
  CY_SAR2_BAD_PARAM = CY_SAR2_ID | CY_PDL_STATUS_ERROR | 0x01U
}
 SAR2 Driver error codes. More...
 
enum  cy_en_sar2_msb_stretch_mode_t {
  CY_SAR2_MSB_STRETCH_MODE_1CYCLE = 0U,
  CY_SAR2_MSB_STRETCH_MODE_2CYCLE = 1U
}
 When set uses 2 cycles for the Most Significant Bit (MSB). More...
 
enum  cy_en_sar2_diag_reference_select_t {
  CY_SAR2_DIAG_REFERENCE_SELECT_VREFL = 0U,
  CY_SAR2_DIAG_REFERENCE_SELECT_VREFH_1DIV8 = 1U,
  CY_SAR2_DIAG_REFERENCE_SELECT_VREFH_2DIV8 = 2U,
  CY_SAR2_DIAG_REFERENCE_SELECT_VREFH_3DIV8 = 3U,
  CY_SAR2_DIAG_REFERENCE_SELECT_VREFH_4DIV8 = 4U,
  CY_SAR2_DIAG_REFERENCE_SELECT_VREFH_5DIV8 = 5U,
  CY_SAR2_DIAG_REFERENCE_SELECT_VREFH_6DIV8 = 6U,
  CY_SAR2_DIAG_REFERENCE_SELECT_VREFH_7DIV8 = 7U,
  CY_SAR2_DIAG_REFERENCE_SELECT_VREFH = 8U,
  CY_SAR2_DIAG_REFERENCE_SELECT_VREFX = 9U,
  CY_SAR2_DIAG_REFERENCE_SELECT_VBG = 10U,
  CY_SAR2_DIAG_REFERENCE_SELECT_VIN1 = 11U,
  CY_SAR2_DIAG_REFERENCE_SELECT_VIN2 = 12U,
  CY_SAR2_DIAG_REFERENCE_SELECT_VIN3 = 13U,
  CY_SAR2_DIAG_REFERENCE_SELECT_I_SOURCE = 14U,
  CY_SAR2_DIAG_REFERENCE_SELECT_I_SINK = 15U
}
 The Diagnostic Reference function selection. More...
 
enum  cy_en_sar2_trigger_selection_t {
  CY_SAR2_TRIGGER_OFF = 0U,
  CY_SAR2_TRIGGER_TCPWM = 1U,
  CY_SAR2_TRIGGER_GENERIC0 = 2U,
  CY_SAR2_TRIGGER_GENERIC1 = 3U,
  CY_SAR2_TRIGGER_GENERIC2 = 4U,
  CY_SAR2_TRIGGER_GENERIC3 = 5U,
  CY_SAR2_TRIGGER_GENERIC4 = 6U,
  CY_SAR2_TRIGGER_CONTINUOUS = 7U
}
 The SAR2 trigger mode selection. More...
 
enum  cy_en_sar2_preemption_type_t {
  CY_SAR2_PREEMPTION_ABORT_CANCEL = 0U,
  CY_SAR2_PREEMPTION_ABORT_RESTART = 1U,
  CY_SAR2_PREEMPTION_ABORT_RESUME = 2U,
  CY_SAR2_PREEMPTION_FINISH_RESUME = 3U
}
 The SAR2 ADC preemption type selection. More...
 
enum  cy_en_sar2_done_level_t {
  CY_SAR2_DONE_LEVEL_PULSE = 0U,
  CY_SAR2_DONE_LEVEL_LEVEL = 1U
}
 Conversion done, trigger output selection. More...
 
enum  cy_en_sar2_pin_address_t {
  CY_SAR2_PIN_ADDRESS_AN0 = 0U,
  CY_SAR2_PIN_ADDRESS_AN1 = 1U,
  CY_SAR2_PIN_ADDRESS_AN2 = 2U,
  CY_SAR2_PIN_ADDRESS_AN3 = 3U,
  CY_SAR2_PIN_ADDRESS_AN4 = 4U,
  CY_SAR2_PIN_ADDRESS_AN5 = 5U,
  CY_SAR2_PIN_ADDRESS_AN6 = 6U,
  CY_SAR2_PIN_ADDRESS_AN7 = 7U,
  CY_SAR2_PIN_ADDRESS_AN8 = 8U,
  CY_SAR2_PIN_ADDRESS_AN9 = 9U,
  CY_SAR2_PIN_ADDRESS_AN10 = 10U,
  CY_SAR2_PIN_ADDRESS_AN11 = 11U,
  CY_SAR2_PIN_ADDRESS_AN12 = 12U,
  CY_SAR2_PIN_ADDRESS_AN13 = 13U,
  CY_SAR2_PIN_ADDRESS_AN14 = 14U,
  CY_SAR2_PIN_ADDRESS_AN15 = 15U,
  CY_SAR2_PIN_ADDRESS_AN16 = 16U,
  CY_SAR2_PIN_ADDRESS_AN17 = 17U,
  CY_SAR2_PIN_ADDRESS_AN18 = 18U,
  CY_SAR2_PIN_ADDRESS_AN19 = 19U,
  CY_SAR2_PIN_ADDRESS_AN20 = 20U,
  CY_SAR2_PIN_ADDRESS_AN21 = 21U,
  CY_SAR2_PIN_ADDRESS_AN22 = 22U,
  CY_SAR2_PIN_ADDRESS_AN23 = 23U,
  CY_SAR2_PIN_ADDRESS_AN24 = 24U,
  CY_SAR2_PIN_ADDRESS_AN25 = 25U,
  CY_SAR2_PIN_ADDRESS_AN26 = 26U,
  CY_SAR2_PIN_ADDRESS_AN27 = 27U,
  CY_SAR2_PIN_ADDRESS_AN28 = 28U,
  CY_SAR2_PIN_ADDRESS_AN29 = 29U,
  CY_SAR2_PIN_ADDRESS_AN30 = 30U,
  CY_SAR2_PIN_ADDRESS_AN31 = 31U,
  CY_SAR2_PIN_ADDRESS_VMOTOR = 32U,
  CY_SAR2_PIN_ADDRESS_VAUX = 33U,
  CY_SAR2_PIN_ADDRESS_AMUXBUS_A = 34U,
  CY_SAR2_PIN_ADDRESS_AMUXBUS_B = 35U,
  CY_SAR2_PIN_ADDRESS_VCCD = 36U,
  CY_SAR2_PIN_ADDRESS_VDDA = 37U,
  CY_SAR2_PIN_ADDRESS_VBG = 38U,
  CY_SAR2_PIN_ADDRESS_VTEMP = 39U,
  CY_SAR2_PIN_ADDRESS_VREF_L = 62U,
  CY_SAR2_PIN_ADDRESS_VREF_H = 63U
}
 The address of the analog signal (pin) to be sampled by a corresponding channel. More...
 
enum  cy_en_sar2_port_address_t {
  CY_SAR2_PORT_ADDRESS_SARMUX0 = 0U,
  CY_SAR2_PORT_ADDRESS_SARMUX1 = 1U,
  CY_SAR2_PORT_ADDRESS_SARMUX2 = 2U,
  CY_SAR2_PORT_ADDRESS_SARMUX3 = 3U
}
 The physical port. More...
 
enum  cy_en_sar2_precondition_mode_t {
  CY_SAR2_PRECONDITION_MODE_OFF = 0U,
  CY_SAR2_PRECONDITION_MODE_VREFL = 1U,
  CY_SAR2_PRECONDITION_MODE_VREFH = 2U,
  CY_SAR2_PRECONDITION_MODE_DIAG = 3U
}
 Preconditioning mode selection. More...
 
enum  cy_en_sar2_overlap_diag_mode_t {
  CY_SAR2_OVERLAP_DIAG_MODE_OFF = 0U,
  CY_SAR2_OVERLAP_DIAG_MODE_HALF = 1U,
  CY_SAR2_OVERLAP_DIAG_MODE_FULL = 2U,
  CY_SAR2_OVERLAP_DIAG_MODE_MUX_DIAG = 3U
}
 Overlap mode or SARMUX Diagnostics selection, in both cases only used when the Diagnostic reference is used. More...
 
enum  cy_en_sar2_calibration_value_select_t {
  CY_SAR2_CALIBRATION_VALUE_REGULAR = 0U,
  CY_SAR2_CALIBRATION_VALUE_ALTERNATE = 1U
}
 Calibration values selection. More...
 
enum  cy_en_sar2_post_processing_mode_t {
  CY_SAR2_POST_PROCESSING_MODE_NONE = 0U,
  CY_SAR2_POST_PROCESSING_MODE_AVG = 1U,
  CY_SAR2_POST_PROCESSING_MODE_AVG_RANGE = 2U,
  CY_SAR2_POST_PROCESSING_MODE_RANGE = 3U,
  CY_SAR2_POST_PROCESSING_MODE_RANGE_PULSE = 4U
}
 Post processing mode selection. More...
 
enum  cy_en_sar2_result_alignment_t {
  CY_SAR2_RESULT_ALIGNMENT_RIGHT = 0U,
  CY_SAR2_RESULT_ALIGNMENT_LEFT = 1U
}
 Result data alignment selection. More...
 
enum  cy_en_sar2_sign_extention_t {
  CY_SAR2_SIGN_EXTENTION_UNSIGNED = 0U,
  CY_SAR2_SIGN_EXTENTION_SIGNED = 1U
}
 Select whether result data is signed or unsigned. More...
 
enum  cy_en_sar2_range_detection_mode_t {
  CY_SAR2_RANGE_DETECTION_MODE_BELOW_LO = 0U,
  CY_SAR2_RANGE_DETECTION_MODE_INSIDE_RANGE = 1U,
  CY_SAR2_RANGE_DETECTION_MODE_ABOVE_HI = 2U,
  CY_SAR2_RANGE_DETECTION_MODE_OUTSIDE_RANGE = 3U
}
 Range detection mode selection. More...
 
enum  cy_en_sar2_ref_buf_mode_t {
  CY_SAR2_REF_BUF_MODE_OFF = 0U,
  CY_SAR2_REF_BUF_MODE_ON = 1U,
  CY_SAR2_REF_BUF_MODE_BYPASS = 3U
}
 Reference buffer mode selection. More...
 
enum  cy_en_sar2_vdda_range_t {
  CY_SAR2_VDDA_2_7V_TO_4_5V = 0U,
  CY_SAR2_VDDA_4_5V_TO_5_5V = 1U
}
 VDDA voltage range selection. More...
 

Enumeration Type Documentation

◆ cy_en_sar2_status_t

SAR2 Driver error codes.

Enumerator
CY_SAR2_SUCCESS 

Returned successful.

CY_SAR2_BAD_PARAM 

A bad parameter was passed.

◆ cy_en_sar2_msb_stretch_mode_t

When set uses 2 cycles for the Most Significant Bit (MSB).

Enumerator
CY_SAR2_MSB_STRETCH_MODE_1CYCLE 

Use 1 clock cycles per conversion.

CY_SAR2_MSB_STRETCH_MODE_2CYCLE 

Use 2 clock cycles per conversion.

◆ cy_en_sar2_diag_reference_select_t

The Diagnostic Reference function selection.

Enumerator
CY_SAR2_DIAG_REFERENCE_SELECT_VREFL 

DiagOut = VrefL.

CY_SAR2_DIAG_REFERENCE_SELECT_VREFH_1DIV8 

DiagOut = VrefH * 1/8.

CY_SAR2_DIAG_REFERENCE_SELECT_VREFH_2DIV8 

DiagOut = VrefH * 2/8.

CY_SAR2_DIAG_REFERENCE_SELECT_VREFH_3DIV8 

DiagOut = VrefH * 3/8.

CY_SAR2_DIAG_REFERENCE_SELECT_VREFH_4DIV8 

DiagOut = VrefH * 4/8.

CY_SAR2_DIAG_REFERENCE_SELECT_VREFH_5DIV8 

DiagOut = VrefH * 5/8.

CY_SAR2_DIAG_REFERENCE_SELECT_VREFH_6DIV8 

DiagOut = VrefH * 6/8.

CY_SAR2_DIAG_REFERENCE_SELECT_VREFH_7DIV8 

DiagOut = VrefH * 7/8.

CY_SAR2_DIAG_REFERENCE_SELECT_VREFH 

DiagOut = VrefH.

CY_SAR2_DIAG_REFERENCE_SELECT_VREFX 

DiagOut = VrefX = VrefH * 199/200.

CY_SAR2_DIAG_REFERENCE_SELECT_VBG 

DiagOut = Vbg from SRSS.

CY_SAR2_DIAG_REFERENCE_SELECT_VIN1 

DiagOut = Vin1.

CY_SAR2_DIAG_REFERENCE_SELECT_VIN2 

DiagOut = Vin2.

CY_SAR2_DIAG_REFERENCE_SELECT_VIN3 

DiagOut = Vin3.

CY_SAR2_DIAG_REFERENCE_SELECT_I_SOURCE 

DiagOut = Isource (10uA)

CY_SAR2_DIAG_REFERENCE_SELECT_I_SINK 

DiagOut = Isink (10uA)

◆ cy_en_sar2_trigger_selection_t

The SAR2 trigger mode selection.

Enumerator
CY_SAR2_TRIGGER_OFF 

Use for channels in group, except the first channel.

CY_SAR2_TRIGGER_TCPWM 

Trigger from corresponding TCPWM channel.

CY_SAR2_TRIGGER_GENERIC0 

Generic trigger input 0.

CY_SAR2_TRIGGER_GENERIC1 

Generic trigger input 1.

CY_SAR2_TRIGGER_GENERIC2 

Generic trigger input 2.

CY_SAR2_TRIGGER_GENERIC3 

Generic trigger input 3.

CY_SAR2_TRIGGER_GENERIC4 

Generic trigger input 4.

CY_SAR2_TRIGGER_CONTINUOUS 

Always triggered (also called idle), can only be used for at most 1 channel.

◆ cy_en_sar2_preemption_type_t

The SAR2 ADC preemption type selection.

Enumerator
CY_SAR2_PREEMPTION_ABORT_CANCEL 

Abort the ongoing acquisition, does not return.

CY_SAR2_PREEMPTION_ABORT_RESTART 

Abort ongoing acquisition, up on return Restart group from the first channel.

CY_SAR2_PREEMPTION_ABORT_RESUME 

Abort the ongoing acquisition, up on return Resume group from the aborted channel.

CY_SAR2_PREEMPTION_FINISH_RESUME 

Completed ongoing acquisition (including averaging), up on return Resume group from the next channel.

◆ cy_en_sar2_done_level_t

Conversion done, trigger output selection.

Enumerator
CY_SAR2_DONE_LEVEL_PULSE 

The conversion done signal for other IPs is a 2-cycle pulse (clk_sys), no need to read the result register.

Typically used for triggering another IPs other than DW.

CY_SAR2_DONE_LEVEL_LEVEL 

The conversion done signal for other IPs is the level output until the result register is read.

Typically used for DW and also overflowed? detection.

◆ cy_en_sar2_pin_address_t

The address of the analog signal (pin) to be sampled by a corresponding channel.

Enumerator
CY_SAR2_PIN_ADDRESS_AN0 

Vout = AN0, select the corresponding analog input.

CY_SAR2_PIN_ADDRESS_VMOTOR 

Vout = Vmotor, select the motor input.

CY_SAR2_PIN_ADDRESS_VAUX 

Vout = Vaux, select the auxiliarly input.

CY_SAR2_PIN_ADDRESS_AMUXBUS_A 

Vout = AmuxbusA.

CY_SAR2_PIN_ADDRESS_AMUXBUS_B 

Vout = AmuxbusB.

CY_SAR2_PIN_ADDRESS_VCCD 

Vout = Vccd.

CY_SAR2_PIN_ADDRESS_VDDA 

Vout = Vdda.

CY_SAR2_PIN_ADDRESS_VBG 

Vout = Vbg, Bandgap voltage from SRSS.

CY_SAR2_PIN_ADDRESS_VTEMP 

Vout = Vtemp, select the temperature sensor.

Ensure that only 1 ADC is allowed to use this.

CY_SAR2_PIN_ADDRESS_VREF_L 

Vout = VrefL (VrefL actually bypasses the SARMUX (XSL)).

CY_SAR2_PIN_ADDRESS_VREF_H 

Vout = VrefH (VrefH actually bypasses the SARMUX (XSH))

◆ cy_en_sar2_port_address_t

The physical port.

This field is only valid for the SAR2 ADC0 block.

Enumerator
CY_SAR2_PORT_ADDRESS_SARMUX0 

ADC uses its own SARMUX.

CY_SAR2_PORT_ADDRESS_SARMUX1 

ADC0 uses SARMUX1 (only valid for ADC0, undefined result if used for ADC1-3).

CY_SAR2_PORT_ADDRESS_SARMUX2 

ADC0 uses SARMUX2 (only valid for ADC0, undefined result if used for ADC1-3).

CY_SAR2_PORT_ADDRESS_SARMUX3 

ADC0 uses SARMUX3 (only valid for ADC0, undefined result if used for ADC1-3).

◆ cy_en_sar2_precondition_mode_t

Preconditioning mode selection.

Preconditioning charges or discharges the SAR sample capacitor to the selected reference voltage for precondition time (global) cycles, a break before a make cycle will be inserted before sampling starts the sample time. See also cy_stc_sar2_config_t

Enumerator
CY_SAR2_PRECONDITION_MODE_OFF 

No preconditioning.

CY_SAR2_PRECONDITION_MODE_VREFL 

Discharge to VREFL.

CY_SAR2_PRECONDITION_MODE_VREFH 

Charge to VREFH.

CY_SAR2_PRECONDITION_MODE_DIAG 

Connect the Diagnostic reference output during preconditioning.

Configure the Diagnostic reference to output the reference voltage.

◆ cy_en_sar2_overlap_diag_mode_t

Overlap mode or SARMUX Diagnostics selection, in both cases only used when the Diagnostic reference is used.

Enumerator
CY_SAR2_OVERLAP_DIAG_MODE_OFF 

No overlap or SARMUX Diagnostics.

CY_SAR2_OVERLAP_DIAG_MODE_HALF 

Sample the selected analog input for 2 sample time periods.

During the first period, use the overlap sampling, i.e. connect both the analog input and Diagnostic reference. During the second period only connect the analog input

CY_SAR2_OVERLAP_DIAG_MODE_FULL 

The selected analog input for a single sample time period is like a normal sample but use the overlap sampling, i.e.

connect both the analog input and Diagnostic reference.

CY_SAR2_OVERLAP_DIAG_MODE_MUX_DIAG 

Select Diagnostic reference instead of analog signal at the input of the SARMUX.

This enables a functional safety check of the SARMUX analog connections.

◆ cy_en_sar2_calibration_value_select_t

Calibration values selection.

Enumerator
CY_SAR2_CALIBRATION_VALUE_REGULAR 

Use regular calibration values.

CY_SAR2_CALIBRATION_VALUE_ALTERNATE 

Use alternate calibration values.

◆ cy_en_sar2_post_processing_mode_t

Post processing mode selection.

Enumerator
CY_SAR2_POST_PROCESSING_MODE_NONE 

No post processing.

CY_SAR2_POST_PROCESSING_MODE_AVG 

Averaging.

CY_SAR2_POST_PROCESSING_MODE_AVG_RANGE 

Averaging followed by Range detect.

CY_SAR2_POST_PROCESSING_MODE_RANGE 

Range detect.

CY_SAR2_POST_PROCESSING_MODE_RANGE_PULSE 

Range detect followed by pulse detect.

◆ cy_en_sar2_result_alignment_t

Result data alignment selection.

Enumerator
CY_SAR2_RESULT_ALIGNMENT_RIGHT 

The data is right aligned in result[11:0], with sign extension to 16 bits if enabled.

CY_SAR2_RESULT_ALIGNMENT_LEFT 

The data shifts left in result[15:4] with the lower nibble 0.

Caveat if the result is more than 12 bits (e.g. after averaging), then the bits above 12 will be discarded.

◆ cy_en_sar2_sign_extention_t

Select whether result data is signed or unsigned.

Enumerator
CY_SAR2_SIGN_EXTENTION_UNSIGNED 

Result data is unsigned (zero-extended if needed).

CY_SAR2_SIGN_EXTENTION_SIGNED 

Result data is signed (sign-extended if needed).

◆ cy_en_sar2_range_detection_mode_t

Range detection mode selection.

Enumerator
CY_SAR2_RANGE_DETECTION_MODE_BELOW_LO 

Below Low threshold (result < Lo)

CY_SAR2_RANGE_DETECTION_MODE_INSIDE_RANGE 

Inside range (Lo <= result < Hi)

CY_SAR2_RANGE_DETECTION_MODE_ABOVE_HI 

Above high threshold (Hi <= result)

CY_SAR2_RANGE_DETECTION_MODE_OUTSIDE_RANGE 

Outside range (result < Lo || Hi <= result)

◆ cy_en_sar2_ref_buf_mode_t

Reference buffer mode selection.

Enumerator
CY_SAR2_REF_BUF_MODE_OFF 

No reference mode selected.

CY_SAR2_REF_BUF_MODE_ON 

Reference buffered Vbg from SRSS.

CY_SAR2_REF_BUF_MODE_BYPASS 

Reference unbuffered Vbg from SRSS.

◆ cy_en_sar2_vdda_range_t

VDDA voltage range selection.

Enumerator
CY_SAR2_VDDA_2_7V_TO_4_5V 

The Vdda is in range from 2.7 to 4.5 V.

CY_SAR2_VDDA_4_5V_TO_5_5V 

The Vdda is in range from 4.5 to 5.5 V.