Synergy Software Package User's Manual

Driver for the Asynchronous General-Purpose Timer (AGT) with Input Capture. More...

Data Structures

struct  agt_input_capture_extend_t
 Extension configuration struct for AGT Input Capture. More...
 
struct  agt_input_capture_instance_ctrl_t
 

Enumerations

enum  agt_input_capture_count_source_t {
  AGT_INPUT_CAPTURE_CLOCK_PCLKB = 0U, AGT_INPUT_CAPTURE_CLOCK_PCLKB_DIV_8 = 1U, AGT_INPUT_CAPTURE_CLOCK_PCLKB_DIV_2 = 3U, AGT_INPUT_CAPTURE_CLOCK_LOCO = 4U,
  AGT_CLOCK_INPUT_CAPTURE_FSUB = 6U
}
 
enum  agt_input_capture_count_edges_t { INPUT_CAPTURE_SIGNAL_SINGLE_EDGE, INPUT_CAPTURE_SIGNAL_BOTH_EDGE }
 
enum  agt_input_capture_signal_filter_t { AGT_INPUT_CAPTURE_SIGNAL_FILTER_NONE, AGT_INPUT_CAPTURE_SIGNAL_FILTER_1, AGT_INPUT_CAPTURE_SIGNAL_FILTER_8, AGT_INPUT_CAPTURE_SIGNAL_FILTER_32 }
 
enum  agt_input_capture_clock_divider_t {
  AGT_INPUT_CAPTURE_CLOCK_DIVIDER_1, AGT_INPUT_CAPTURE_CLOCK_DIVIDER_2, AGT_INPUT_CAPTURE_CLOCK_DIVIDER_4, AGT_INPUT_CAPTURE_CLOCK_DIVIDER_8,
  AGT_INPUT_CAPTURE_CLOCK_DIVIDER_16, AGT_INPUT_CAPTURE_CLOCK_DIVIDER_32, AGT_INPUT_CAPTURE_CLOCK_DIVIDER_64, AGT_INPUT_CAPTURE_CLOCK_DIVIDER_128
}
 
enum  agt_input_capture_event_flag_t { AGT_INPUT_CAPTURE_ACTIVE_EDGE_FLAG = 16U, AGT_INPUT_CAPTURE_UNDERFLOW_FLAG = 32U, AGT_INPUT_CAPTURE_COMPARE_A_FLAG = 64U, AGT_INPUT_CAPTURE_COMPARE_B_FLAG = 128U }
 
enum  agt_input_capture_mode_t { AGT_INPUT_CAPTURE_MODE_PULSE_WIDTH = 3U, AGT_INPUT_CAPTURE_MODE_PERIOD = 4U, AGT_INPUT_CAPTURE_MODE_PULSE_COUNT = 2U }
 
enum  agt_input_capture_pin_select_t { AGT_INPUT_CAPTURE_PIN_AGTIO_A = 0U, AGT_INPUT_CAPTURE_PIN_AGTIO_B = 2U, AGT_INPUT_CAPTURE_PIN_AGTIO_C = 3U }
 

Functions

ssp_err_t R_AGT_InputCaptureOpen (input_capture_ctrl_t *const p_api_ctrl, input_capture_cfg_t const *const p_cfg)
 Open an AGT Timer for Input Capture. Implements input_capture_api_t::open. More...
 
ssp_err_t R_AGT_InputCaptureClose (input_capture_ctrl_t *const p_api_ctrl)
 Close a AGT Timer Channel for Input Capture. Implements input_capture_api_t::close. More...
 
ssp_err_t R_AGT_InputCaptureVersionGet (ssp_version_t *const p_version)
 Gets driver version based on compile time macros. Implements input_capture_api_t::versionGet. More...
 
ssp_err_t R_AGT_InputCaptureDisable (input_capture_ctrl_t const *const p_api_ctrl)
 Stops the Input capture and disables its interrupts for specified channel at NVIC. Implements input_capture_api_t::disable. More...
 
ssp_err_t R_AGT_InputCaptureEnable (input_capture_ctrl_t const *const p_api_ctrl)
 Enables its interrupts for specified channel at NVIC, and starts the Input capture. Implements input_capture_api_t::enable. More...
 
ssp_err_t R_AGT_InputCaptureInfoGet (input_capture_ctrl_t const *const p_api_ctrl, input_capture_info_t *const p_info)
 Gets status into provided p_info pointer. Implements input_capture_api_t::infoGet. More...
 
ssp_err_t R_AGT_InputCaptureLastCaptureGet (input_capture_ctrl_t const *const p_api_ctrl, input_capture_capture_t *const p_capture)
 Update the last captured value and overflow count, in provided p_capture pointer. Implements input_capture_api_t::lastCaptureGet. More...
 

Detailed Description

Driver for the Asynchronous General-Purpose Timer (AGT) with Input Capture.

Summary

Extends Input Capture Interface.

This module implements the Input Capture Interface for the Asynchronous General-Purpose Timer (AGT) peripherals.

Enumeration Type Documentation

◆ agt_input_capture_clock_divider_t

AGT Input capture AGT LOCO or AGT FSUB divider.

Enumerator
AGT_INPUT_CAPTURE_CLOCK_DIVIDER_1 

/ 1

AGT_INPUT_CAPTURE_CLOCK_DIVIDER_2 

/ 2

AGT_INPUT_CAPTURE_CLOCK_DIVIDER_4 

/ 4

AGT_INPUT_CAPTURE_CLOCK_DIVIDER_8 

/ 8

AGT_INPUT_CAPTURE_CLOCK_DIVIDER_16 

/ 16

AGT_INPUT_CAPTURE_CLOCK_DIVIDER_32 

/ 32

AGT_INPUT_CAPTURE_CLOCK_DIVIDER_64 

/ 64

AGT_INPUT_CAPTURE_CLOCK_DIVIDER_128 

/ 128

◆ agt_input_capture_count_edges_t

AGT Input capture signal edge polarity for event counter mode

Enumerator
INPUT_CAPTURE_SIGNAL_SINGLE_EDGE 

Counts only one edge of the pulse.

INPUT_CAPTURE_SIGNAL_BOTH_EDGE 

Counts both edges of the pulse.

◆ agt_input_capture_count_source_t

Count source

Enumerator
AGT_INPUT_CAPTURE_CLOCK_PCLKB 

Clock AGT_CLOCK_PCLKB.

AGT_INPUT_CAPTURE_CLOCK_PCLKB_DIV_8 

Superseded: See AGT_CLOCK_PCLKB.

AGT_INPUT_CAPTURE_CLOCK_PCLKB_DIV_2 

Superseded: See AGT_CLOCK_PCLKB.

AGT_INPUT_CAPTURE_CLOCK_LOCO 

Divided clock LOCO specified by bits CKS[2:0] in the AGTMR2 register.

AGT_CLOCK_INPUT_CAPTURE_FSUB 

Divided clock fSUB specified by bits CKS[2:0] in the AGTMR2 register.

◆ agt_input_capture_event_flag_t

AGT Input capture Event flags.

Enumerator
AGT_INPUT_CAPTURE_ACTIVE_EDGE_FLAG 

Measurement event flag.

AGT_INPUT_CAPTURE_UNDERFLOW_FLAG 

Underflow event flag.

AGT_INPUT_CAPTURE_COMPARE_A_FLAG 

Compare match A event flag.

AGT_INPUT_CAPTURE_COMPARE_B_FLAG 

Compare match B event flag.

◆ agt_input_capture_mode_t

AGT Input capture modes.

Enumerator
AGT_INPUT_CAPTURE_MODE_PULSE_WIDTH 

Measure a signal pulse width.

AGT_INPUT_CAPTURE_MODE_PERIOD 

Measure a signal cycle period.

AGT_INPUT_CAPTURE_MODE_PULSE_COUNT 

Measure a signal event count.

◆ agt_input_capture_pin_select_t

AGT Input capture AGTIO Pin Select.

Enumerator
AGT_INPUT_CAPTURE_PIN_AGTIO_A 

Selects the pin AGTIO_A for input capture.

AGT_INPUT_CAPTURE_PIN_AGTIO_B 

Selects the pin AGTIO_B for input capture.

AGT_INPUT_CAPTURE_PIN_AGTIO_C 

Selects the pin AGTIO_C for input capture.

◆ agt_input_capture_signal_filter_t

Input capture signal noise filter (debounce) setting. Only available for input signals in AGTIO pins. The noise filter samples the external signal at intervals of the PCLK divided by one of the values. When 3 consecutive samples are at the same level (high or low), then that level is passed on as the observed state of the signal. See "Noise Filter Function" in the hardware manual, AGT section.

Enumerator
AGT_INPUT_CAPTURE_SIGNAL_FILTER_NONE 

NO FILTER.

AGT_INPUT_CAPTURE_SIGNAL_FILTER_1 

PCLK/1.

AGT_INPUT_CAPTURE_SIGNAL_FILTER_8 

PCLK/8.

AGT_INPUT_CAPTURE_SIGNAL_FILTER_32 

PCLK/32.

Function Documentation

◆ R_AGT_InputCaptureClose()

ssp_err_t R_AGT_InputCaptureClose ( input_capture_ctrl_t *const  p_api_ctrl)

Close a AGT Timer Channel for Input Capture. Implements input_capture_api_t::close.

Clears Timer settings, disables interrupts, and clears internal driver data.

Return values
SSP_SUCCESSSuccessful close.
SSP_ERR_ASSERTIONThe parameter p_ctrl is NULL.
SSP_ERR_NOT_OPENThe channel is not opened.

Cleanup. Disable interrupts and stop measurements.

Unlock channel

Clear stored internal driver data

◆ R_AGT_InputCaptureDisable()

ssp_err_t R_AGT_InputCaptureDisable ( input_capture_ctrl_t const *const  p_api_ctrl)

Stops the Input capture and disables its interrupts for specified channel at NVIC. Implements input_capture_api_t::disable.

Return values
SSP_SUCCESSInterrupt disabled successfully.
SSP_ERR_ASSERTIONThe p_ctrl parameter was null.
SSP_ERR_NOT_OPENThe channel is not opened.

Disable interrupts

◆ R_AGT_InputCaptureEnable()

ssp_err_t R_AGT_InputCaptureEnable ( input_capture_ctrl_t const *const  p_api_ctrl)

Enables its interrupts for specified channel at NVIC, and starts the Input capture. Implements input_capture_api_t::enable.

Return values
SSP_SUCCESSInterrupt enabled successfully.
SSP_ERR_ASSERTIONThe p_ctrl parameter was null.
SSP_ERR_NOT_OPENThe channel is not opened.

Enabling the measurement overflow and compare match interrupt.

◆ R_AGT_InputCaptureInfoGet()

ssp_err_t R_AGT_InputCaptureInfoGet ( input_capture_ctrl_t const *const  p_api_ctrl,
input_capture_info_t *const  p_info 
)

Gets status into provided p_info pointer. Implements input_capture_api_t::infoGet.

Return values
SSP_SUCCESSSuccess.
SSP_ERR_ASSERTIONThe p_ctrl parameter was null.
SSP_ERR_NOT_OPENThe channel is not opened.

Gets the input capture status.

◆ R_AGT_InputCaptureLastCaptureGet()

ssp_err_t R_AGT_InputCaptureLastCaptureGet ( input_capture_ctrl_t const *const  p_api_ctrl,
input_capture_capture_t *const  p_capture 
)

Update the last captured value and overflow count, in provided p_capture pointer. Implements input_capture_api_t::lastCaptureGet.

Return values
SSP_SUCCESSPeriod value written successfully.
SSP_ERR_ASSERTIONThe p_ctrl or p_value parameter was null.
SSP_ERR_NOT_OPENThe channel is not opened.

Gets the captured value

◆ R_AGT_InputCaptureOpen()

ssp_err_t R_AGT_InputCaptureOpen ( input_capture_ctrl_t *const  p_api_ctrl,
input_capture_cfg_t const *const  p_cfg 
)

Open an AGT Timer for Input Capture. Implements input_capture_api_t::open.

The Open function configures a single AGT channel for input capture and provides a handle for use with the other Input Capture API functions. This function must be called once prior to calling any other Input Capture API function. After a channel is opened, the Open function should not be called again for the same channel without first calling the associated Close function.

Return values
SSP_SUCCESSInitialization was successful.
SSP_ERR_ASSERTIONOne of the parameters is NULL: p_cfg, p_ctrl, p_extend.
SSP_ERR_IRQ_BSP_DISABLEDA required interrupt does not exist in the vector table.
SSP_ERR_IN_USEThe channel specified has already been opened. No configurations were changed. Call the associated Close function or use associated Control commands to reconfigure the channel.
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls:
Note
This function is reentrant for different channels. It is not reentrant for the same channel.

Get fmi feature information for AGT.

If count source clock is not operational, return error.

Verify channel is not already used

Get fmi measurement and overflow event information for AGT.

Set measurement and overflow event interrupt priority and vector info.

Get fmi compare match event information for AGT.

Set compare match event interrupt priority and vector info.

Initialize control block.

Perform hardware initializations based on configuration.

Mark channel as open, by initializing it to R_AIC ASCII equivalent.

◆ R_AGT_InputCaptureVersionGet()

ssp_err_t R_AGT_InputCaptureVersionGet ( ssp_version_t *const  p_version)

Gets driver version based on compile time macros. Implements input_capture_api_t::versionGet.

Return values
SSP_SUCCESSSuccess.
SSP_ERR_ASSERTIONThe parameter p_version is NULL.