| M480 BSP V3.05.001 The Board Support Package for M480 Series

Macros | Functions
OPA Exported Functions
Standard Driver » OPA Driver

## Macros
#define | OPA_POWER_ON(opa, u32OpaNum)
| This macro is used to power on the OPA circuit. More...
#define | OPA_POWER_DOWN(opa, u32OpaNum)
| This macro is used to power down the OPA circuit. More...
#define | OPA_ENABLE_SCH_TRIGGER(opa, u32OpaNum)
| This macro is used to enable the OPA Schmitt trigger buffer. More...
#define | OPA_DISABLE_SCH_TRIGGER(opa, u32OpaNum)
| This macro is used to disable the OPA Schmitt trigger buffer. More...
#define | OPA_ENABLE_INT(opa, u32OpaNum)
| This macro is used to enable OPA Schmitt trigger digital output interrupt. More...
#define | OPA_DISABLE_INT(opa, u32OpaNum)
| This macro is used to disable OPA Schmitt trigger digital output interrupt. More...
#define | OPA_GET_DIGITAL_OUTPUT(opa, u32OpaNum)
| This macro is used to get OPA digital output state. More...
#define | OPA_GET_INT_FLAG(opa, u32OpaNum)
| This macro is used to get OPA interrupt flag. More...
#define | OPA_CLR_INT_FLAG(opa, u32OpaNum)
| This macro is used to clear OPA interrupt flag. More...
#define | OPA_Reset()
| This macro is used to generate asynchronous reset signals to OPA controller. More...

## Functions
__STATIC_INLINE int32_t | OPA_Calibration (OPA_T *opa, uint32_t u32OpaNum, uint32_t u32ClockSel, uint32_t u32RefVol)
| This function is used to configure and start OPA calibration. More...

## Detailed Description

## Macro Definition Documentation

## ◆ OPA_CLR_INT_FLAG

#define OPA_CLR_INT_FLAG | ( |  | opa,
|  |  | u32OpaNum
| ) |  |

This macro is used to clear OPA interrupt flag.

Parameters

  [in] | opa | The pointer of the specified OPA module
  [in] | u32OpaNum | The OPA number. 0 for OPA0; 1 for OPA1; 2 for OPA2.

Returns
  None

This macro will write 1 to OPDFx (x=0,1) bit of OPASR register to clear interrupt flag.

Definition at line 134 of file opa.h.

## ◆ OPA_DISABLE_INT

#define OPA_DISABLE_INT | ( |  | opa,
|  |  | u32OpaNum
| ) |  |

This macro is used to disable OPA Schmitt trigger digital output interrupt.

Parameters

  [in] | opa | The pointer of the specified OPA module
  [in] | u32OpaNum | The OPA number. 0 for OPA0; 1 for OPA1; 2 for OPA2.

Returns
  None

This macro will clear OPDIEx (x=0, 1) bit of OPACR register to disable the OPA Schmitt trigger digital output interrupt.

Definition at line 103 of file opa.h.

## ◆ OPA_DISABLE_SCH_TRIGGER

#define OPA_DISABLE_SCH_TRIGGER | ( |  | opa,
|  |  | u32OpaNum
| ) |  |

This macro is used to disable the OPA Schmitt trigger buffer.

Parameters

  [in] | opa | The pointer of the specified OPA module
  [in] | u32OpaNum | The OPA number. 0 for OPA0; 1 for OPA1; 2 for OPA2.

Returns
  None

This macro will clear OPSCHx_EN (x=0, 1) bit of OPACR register to disable the OPA Schmitt trigger buffer.

Definition at line 83 of file opa.h.

## ◆ OPA_ENABLE_INT

#define OPA_ENABLE_INT | ( |  | opa,
|  |  | u32OpaNum
| ) |  |

This macro is used to enable OPA Schmitt trigger digital output interrupt.

Parameters

  [in] | opa | The pointer of the specified OPA module
  [in] | u32OpaNum | The OPA number. 0 for OPA0; 1 for OPA1; 2 for OPA2.

Returns
  None

This macro will set OPDIEx (x=0, 1) bit of OPACR register to enable the OPA Schmitt trigger digital output interrupt.

Definition at line 93 of file opa.h.

## ◆ OPA_ENABLE_SCH_TRIGGER

#define OPA_ENABLE_SCH_TRIGGER | ( |  | opa,
|  |  | u32OpaNum
| ) |  |

This macro is used to enable the OPA Schmitt trigger buffer.

Parameters

  [in] | opa | The pointer of the specified OPA module
  [in] | u32OpaNum | The OPA number. 0 for OPA0; 1 for OPA1; 2 for OPA2.

Returns
  None

This macro will set OPSCHx_EN (x=0, 1) bit of OPACR register to enable the OPA Schmitt trigger buffer.

Definition at line 73 of file opa.h.

## ◆ OPA_GET_DIGITAL_OUTPUT

#define OPA_GET_DIGITAL_OUTPUT | ( |  | opa,
|  |  | u32OpaNum
| ) |  |

This macro is used to get OPA digital output state.

Parameters

  [in] | opa | The pointer of the specified OPA module
  [in] | u32OpaNum | The OPA number. 0 for OPA0; 1 for OPA1; 2 for OPA2.

Returns
  OPA digital output state

This macro will return the OPA digital output value.

Definition at line 113 of file opa.h.

## ◆ OPA_GET_INT_FLAG

#define OPA_GET_INT_FLAG | ( |  | opa,
|  |  | u32OpaNum
| ) |  |

This macro is used to get OPA interrupt flag.

Parameters

  [in] | opa | The pointer of the specified OPA module
  [in] | u32OpaNum | The OPA number. 0 for OPA0; 1 for OPA1; 2 for OPA2.

Return values

  0 | OPA interrupt does not occur.
  1 | OPA interrupt occurs.

This macro will return the ACMP interrupt flag.

Definition at line 124 of file opa.h.

## ◆ OPA_POWER_DOWN

#define OPA_POWER_DOWN | ( |  | opa,
|  |  | u32OpaNum
| ) |  |

This macro is used to power down the OPA circuit.

Parameters

  [in] | opa | The pointer of the specified OPA module
  [in] | u32OpaNum | The OPA number. 0 for OPA0; 1 for OPA1; 2 for OPA2.

Returns
  None

This macro will clear OPx_EN (x=0, 1) bit of OPACR register to power down the OPA circuit.

Definition at line 63 of file opa.h.

## ◆ OPA_POWER_ON

#define OPA_POWER_ON | ( |  | opa,
|  |  | u32OpaNum
| ) |  |

This macro is used to power on the OPA circuit.

Parameters

  [in] | opa | The pointer of the specified OPA module
  [in] | u32OpaNum | The OPA number. 0 for OPA0; 1 for OPA1; 2 for OPA2.

Returns
  None

This macro will set OPx_EN (x=0, 1) bit of OPACR register to power on the OPA circuit.

Note
  Remember to enable HIRC clock while power on the OPA circuit.

Definition at line 53 of file opa.h.

## ◆ OPA_Reset

#define OPA_Reset | ( |  | ) |

This macro is used to generate asynchronous reset signals to OPA controller.

Parameters

  None |

Returns
  None

Definition at line 191 of file opa.h.

## Function Documentation

## ◆ OPA_Calibration()

__STATIC_INLINE int32_t OPA_Calibration | ( | OPA_T * | opa,
|  | uint32_t | u32OpaNum,
|  | uint32_t | u32ClockSel,
|  | uint32_t | u32RefVol
| ) |  |

This function is used to configure and start OPA calibration.

Parameters

  [in] | opa | The pointer of the specified OPA module
  [in] | u32OpaNum | The OPA number. 0 for OPA0; 1 for OPA1; 2 for OPA2.
  [in] | u32ClockSel | Select OPA calibration clock OPA_CALIBRATION_CLK_1K
  [in] | u32RefVol | Select OPA reference voltage OPA_CALIBRATION_RV_1_2_AVDD OPA_CALIBRATION_RV_H_L_VCM

Return values

  0 | PMOS and NMOS calibration successfully.
  -1 | only PMOS calibration failed.
  -2 | only NMOS calibration failed.
  -3 | PMOS and NMOS calibration failed.

Definition at line 151 of file opa.h.