MTB CAT1 Peripheral driver library
Offset and Slope Trim Functions

General Description

These are advanced functions for trimming the offset and slope of the opamps.

Most users do not need to call these functions and can use the factory trimmed values.

Functions

void Cy_CTB_OpampSetOffset (CTBM_Type *base, cy_en_ctb_opamp_sel_t opampNum, uint32_t trim)
 Override the CTB opamp offset factory trim. More...
 
uint32_t Cy_CTB_OpampGetOffset (const CTBM_Type *base, cy_en_ctb_opamp_sel_t opampNum)
 Return the current CTB opamp offset trim value. More...
 
void Cy_CTB_OpampSetSlope (CTBM_Type *base, cy_en_ctb_opamp_sel_t opampNum, uint32_t trim)
 Override the CTB opamp slope factory trim. More...
 
uint32_t Cy_CTB_OpampGetSlope (const CTBM_Type *base, cy_en_ctb_opamp_sel_t opampNum)
 Return the CTB opamp slope trim value. More...
 

Function Documentation

◆ Cy_CTB_OpampSetOffset()

void Cy_CTB_OpampSetOffset ( CTBM_Type base,
cy_en_ctb_opamp_sel_t  opampNum,
uint32_t  trim 
)

Override the CTB opamp offset factory trim.

The trim is a six bit value and the MSB is a direction bit.

Bit 5 Bits 4:0 Note
0 00000 Negative trim direction - minimum setting
0 11111 Negative trim direction - maximum setting
1 00000 Positive trim direction - minimum setting
1 11111 Positive trim direction - maximum setting
Parameters
basePointer to structure describing registers
opampNumCY_CTB_OPAMP_0, CY_CTB_OPAMP_1, or CY_CTB_OPAMP_BOTH
trimTrim value from 0 to 63
Returns
None
Function Usage
/* Scenario: Calibrate the offset trim by iterating through all the possible trim values. */
uint8_t trim;
for (trim = 0u; trim <= 0x3F; trim++)
{
Cy_CTB_OpampSetOffset(CTBM0, CY_CTB_OPAMP_0, trim);
/* Do something after changing the offset trim. */
}

◆ Cy_CTB_OpampGetOffset()

uint32_t Cy_CTB_OpampGetOffset ( const CTBM_Type base,
cy_en_ctb_opamp_sel_t  opampNum 
)

Return the current CTB opamp offset trim value.

Parameters
basePointer to structure describing registers
opampNumCY_CTB_OPAMP_0 or CY_CTB_OPAMP_1
Returns
Offset trim value
Function Usage
/* Scenario: Save the factory offset trim before changing it. */
uint32_t factoryOffset;
factoryOffset = Cy_CTB_OpampGetOffset(CTBM0, CY_CTB_OPAMP_0);

◆ Cy_CTB_OpampSetSlope()

void Cy_CTB_OpampSetSlope ( CTBM_Type base,
cy_en_ctb_opamp_sel_t  opampNum,
uint32_t  trim 
)

Override the CTB opamp slope factory trim.

The offset of the opamp will vary across temperature. This trim compensates for the slope of the offset across temperature. This compensation uses a bias current from the Analog Reference block. To disable it, set the trim to 0.

The trim is a six bit value and the MSB is a direction bit.

Bit 5 Bits 4:0 Note
0 00000 Negative trim direction - minimum setting
0 11111 Negative trim direction - maximum setting
1 00000 Positive trim direction - minimum setting
1 11111 Positive trim direction - maximum setting
Parameters
basePointer to structure describing registers
opampNumCY_CTB_OPAMP_0, CY_CTB_OPAMP_1, or CY_CTB_OPAMP_BOTH
trimTrim value from 0 to 63
Returns
None
Function Usage
/* Scenario: Calibrate the slope trim by iterating through all the possible trim values. */
uint8_t trim;
for (trim = 0u; trim <= 0x3F; trim++)
{
Cy_CTB_OpampSetSlope(CTBM0, CY_CTB_OPAMP_0, trim);
/* Do something after changing the slope trim. */
}

◆ Cy_CTB_OpampGetSlope()

uint32_t Cy_CTB_OpampGetSlope ( const CTBM_Type base,
cy_en_ctb_opamp_sel_t  opampNum 
)

Return the CTB opamp slope trim value.

Parameters
basePointer to structure describing registers
opampNumCY_CTB_OPAMP_0 or CY_CTB_OPAMP_1
Returns
Slope trim value
Function Usage
/* Scenario: Save the factory slope trim before changing it. */
uint32_t factorySlope;
factorySlope = Cy_CTB_OpampGetSlope(CTBM0, CY_CTB_OPAMP_0);