![]() |
Synergy Software Package User's Manual
|
Driver for the Operational Amplifier (OPAMP). More...
Data Structures | |
| struct | opamp_on_opamp_cfg_t |
| struct | opamp_instance_ctrl_t |
Macros | |
| #define | OPAMP_CODE_VERSION_MAJOR (2U) |
| #define | OPAMP_ERROR_RETURN(a, err) SSP_ERROR_RETURN((a), (err), &g_module_name[0], &g_opamp_version) |
Enumerations | |
| enum | opamp_trigger_t { OPAMP_TRIGGER_SOFTWARE_START_SOFTWARE_STOP = 0, OPAMP_TRIGGER_AGT_START_SOFTWARE_STOP = 1, OPAMP_TRIGGER_AGT_START_ADC_STOP = 3 } |
| enum | opamp_agt_link_t { OPAMP_AGT_LINK_AGT1_OPAMP_0_2_AGT0_OPAMP_1_3 = 0, OPAMP_AGT_LINK_AGT1_OPAMP_0_1_AGT0_OPAMP_2_3 = 1, OPAMP_AGT_LINK_AGT1_OPAMP_0_1_2_3 = 3 } |
| enum | opamp_mode_t { OPAMP_MODE_LOW_POWER = 0, OPAMP_MODE_MIDDLE_SPEED = 1, OPAMP_MODE_HIGH_SPEED = 3 } |
| enum | opamp_priv_trim_state_t { OPAMP_PRIV_TRIM_STATE_INVALID = -1, OPAMP_PRIV_TRIM_STATE_END = 0, OPAMP_PRIV_TRIM_STATE_BIT_0 = 0, OPAMP_PRIV_TRIM_STATE_BIT_1 = 1, OPAMP_PRIV_TRIM_STATE_BIT_2 = 2, OPAMP_PRIV_TRIM_STATE_BIT_3 = 3, OPAMP_PRIV_TRIM_STATE_BIT_4 = 4, OPAMP_PRIV_TRIM_STATE_BEGIN = 5 } |
Functions | |
| ssp_err_t | R_OPAMP_Open (opamp_ctrl_t *const p_api_ctrl, opamp_cfg_t const *const p_cfg) |
| Applies power to the OPAMP and initializes the hardware based on the user configuration. Implements opamp_api_t::open(). More... | |
| ssp_err_t | R_OPAMP_InfoGet (opamp_ctrl_t *const p_api_ctrl, opamp_info_t *const p_info) |
| Provides the minimum stabilization wait time in microseconds. Implements opamp_api_t::infoGet(). More... | |
| ssp_err_t | R_OPAMP_Start (opamp_ctrl_t *const p_api_ctrl, uint32_t const channel_mask) |
| If the OPAMP is configured for hardware triggers, enables hardware triggers. Otherwise, starts the op-amp. Implements opamp_api_t::start(). More... | |
| ssp_err_t | R_OPAMP_Stop (opamp_ctrl_t *const p_api_ctrl, uint32_t const channel_mask) |
| Stops the op-amp. If the OPAMP is configured for hardware triggers, disables hardware triggers. Implements opamp_api_t::stop(). More... | |
| ssp_err_t | R_OPAMP_StatusGet (opamp_ctrl_t *const p_api_ctrl, opamp_status_t *const p_status) |
| Provides the operating status for each op-amp in a bitmask. This bit is set when operation begins, before the stabilization wait time has elapsed. Implements opamp_api_t::statusGet(). More... | |
| ssp_err_t | R_OPAMP_Trim (opamp_ctrl_t *const p_api_ctrl, opamp_trim_cmd_t const cmd, opamp_trim_args_t const *const p_args) |
| On MCUs that support trimming, the op-amp trim register is set to the factory default after open(). This function allows the application to trim the operational amplifier to a user setting, which overwrites the factory default factory trim values. More... | |
| ssp_err_t | R_OPAMP_Close (opamp_ctrl_t *const p_api_ctrl) |
| Stops the op-amps. Implements opamp_api_t::close(). More... | |
| ssp_err_t | R_OPAMP_VersionGet (ssp_version_t *const p_version) |
Variables | |
| const opamp_api_t | g_opamp_on_opamp |
Driver for the Operational Amplifier (OPAMP).
This module supports the OPAMP peripheral. It implements the following interfaces:
| #define OPAMP_CODE_VERSION_MAJOR (2U) |
Version of code that implements the API defined in this file
| #define OPAMP_ERROR_RETURN | ( | a, | |
| err | |||
| ) | SSP_ERROR_RETURN((a), (err), &g_module_name[0], &g_opamp_version) |
Macro for error logger.
| enum opamp_agt_link_t |
Which AGT timer starts the op-amp. Only applies to channels if OPAMP_TRIGGER_AGT_START_SOFTWARE_STOP or OPAMP_TRIGGER_AGT_START_ADC_STOP is selected for the channel. If OPAMP_TRIGGER_SOFTWARE_START_SOFTWARE_STOP is selected for a channel, then no AGT compare match event will start that op-amp channel.
| enum opamp_mode_t |
Op-amp trim state.
| enum opamp_trigger_t |
| ssp_err_t R_OPAMP_Close | ( | opamp_ctrl_t *const | p_api_ctrl | ) |
Stops the op-amps. Implements opamp_api_t::close().
| SSP_SUCCESS | Instance control block closed successfully. |
| SSP_ERR_ASSERTION | An input pointer was NULL. |
| SSP_ERR_NOT_OPEN | Instance control block is not open. |
Perform parameter checking
Set all OPAMP units and the reference current generator to be stopped.
Mark driver as closed
Enter the module-stop state.
Release the hardware lock
Return the error code
| ssp_err_t R_OPAMP_InfoGet | ( | opamp_ctrl_t *const | p_api_ctrl, |
| opamp_info_t *const | p_info | ||
| ) |
Provides the minimum stabilization wait time in microseconds. Implements opamp_api_t::infoGet().
| SSP_SUCCESS | Information stored in p_info. |
| SSP_ERR_ASSERTION | An input pointer was NULL. |
| SSP_ERR_NOT_OPEN | Instance control block is not open. |
Perform parameter checking
| ssp_err_t R_OPAMP_Open | ( | opamp_ctrl_t *const | p_api_ctrl, |
| opamp_cfg_t const *const | p_cfg | ||
| ) |
Applies power to the OPAMP and initializes the hardware based on the user configuration. Implements opamp_api_t::open().
The op-amp is not operational until the opamp_api_t::start() is called. If the op-amp is configured to start after AGT compare match, the op-amp is not operational until opamp_api_t::start() and the associated AGT compare match event occurs.
Some MCUs have switches that must be set before starting the op-amp. These switches must be set in the application code after opamp_api_t::open() and before opamp_api_t::start().
| SSP_SUCCESS | Configuration successful. |
| SSP_ERR_ASSERTION | An input pointer is NULL. |
| SSP_ERR_INVALID_ARGUMENT | An input argument is invalid. |
| SSP_ERR_IN_USE | Control block is already opened. |
Verify the control block has not already been initialized.
Confirm the OPAMP exists on this MCU.
Lock the OPAMP
Initialize the hardware based on the configuration.
Stop operation of all op-amps.
Initialize trim registers to factory trim values.
| ssp_err_t R_OPAMP_Start | ( | opamp_ctrl_t *const | p_api_ctrl, |
| uint32_t const | channel_mask | ||
| ) |
If the OPAMP is configured for hardware triggers, enables hardware triggers. Otherwise, starts the op-amp. Implements opamp_api_t::start().
Some MCUs have switches that must be set before starting the op-amp. These switches must be set in the application code after opamp_api_t::open() and before opamp_api_t::start().
| SSP_SUCCESS | Op-amp started or hardware triggers enabled successfully. |
| SSP_ERR_ASSERTION | An input pointer was NULL. |
| SSP_ERR_NOT_OPEN | Instance control block is not open. |
| SSP_ERR_INVALID_ARGUMENT | channel_mask includes a channel that does not exist on this MCU. |
Enable AGT start and ADC conversion end triggers or start the op-amp channel(s).
Return the error code
| ssp_err_t R_OPAMP_StatusGet | ( | opamp_ctrl_t *const | p_api_ctrl, |
| opamp_status_t *const | p_status | ||
| ) |
Provides the operating status for each op-amp in a bitmask. This bit is set when operation begins, before the stabilization wait time has elapsed. Implements opamp_api_t::statusGet().
| SSP_SUCCESS | Operating status of each op-amp provided in p_status. |
| SSP_ERR_ASSERTION | An input pointer was NULL. |
| SSP_ERR_NOT_OPEN | Instance control block is not open. |
Read the operating status of the op-amps.
| ssp_err_t R_OPAMP_Stop | ( | opamp_ctrl_t *const | p_api_ctrl, |
| uint32_t const | channel_mask | ||
| ) |
Stops the op-amp. If the OPAMP is configured for hardware triggers, disables hardware triggers. Implements opamp_api_t::stop().
| SSP_SUCCESS | Op-amp stopped or hardware triggers disabled successfully. |
| SSP_ERR_ASSERTION | An input pointer was NULL. |
| SSP_ERR_NOT_OPEN | Instance control block is not open. |
| SSP_ERR_INVALID_ARGUMENT | channel_mask includes a channel that does not exist on this MCU. |
Disable AGT start and ADC conversion end triggers and stop the op-amp channel(s).
Return the error code
| ssp_err_t R_OPAMP_Trim | ( | opamp_ctrl_t *const | p_api_ctrl, |
| opamp_trim_cmd_t const | cmd, | ||
| opamp_trim_args_t const *const | p_args | ||
| ) |
On MCUs that support trimming, the op-amp trim register is set to the factory default after open(). This function allows the application to trim the operational amplifier to a user setting, which overwrites the factory default factory trim values.
Not supported on all MCUs. See hardware manual for details. Not supported if configured for low power mode (OPAMP_MODE_LOW_POWER).
This function is not reentrant. Only one side of one op-amp can be trimmed at a time. Complete the procedure for one side of one channel before calling trim() with command OPAMP_TRIM_CMD_START again.
Implements opamp_api_t::trim().
The trim procedure works as follows:
| SSP_SUCCESS | Conversion result in p_data. |
| SSP_ERR_UNSUPPORTED | Trimming is not supported on this MCU. |
| SSP_ERR_INVALID_STATE | The command is not valid in the current state of the trim state machine. |
| SSP_ERR_INVALID_ARGUMENT | The requested channel is not operating or the trim procedure is not in progress for this channel/input combination. |
| SSP_ERR_INVALID_MODE | Trim is not allowed in low power mode. |
| SSP_ERR_ASSERTION | An input pointer was NULL. |
| SSP_ERR_NOT_OPEN | Instance control block is not open. |
Initialize the trim register to 0 during OPAMP_TRIM_CMD_START.
Set the next trim bit during OPAMP_TRIM_CMD_NEXT_STEP.
Clear the current trim bit during OPAMP_TRIM_CMD_CLEAR_BIT.
| ssp_err_t R_OPAMP_VersionGet | ( | ssp_version_t *const | p_version | ) |
Gets the API and code version. Implements opamp_api_t::versionGet().
| SSP_SUCCESS | Version information available in p_version. |
| SSP_ERR_ASSERTION | The parameter p_version is NULL. |
Return the version number
| const opamp_api_t g_opamp_on_opamp |
Name of module used by error logger macro OPAMP Implementation of OPAMP interface.