Synergy Software Package User's Manual

Driver for the General PWM Timer (GPT) with Input Capture. More...

Data Structures

struct  gpt_input_capture_extend_t
 Extension configuration struct for TU Input Capture. More...
 
struct  gpt_input_capture_instance_ctrl_t
 

Macros

#define GPT_INPUT_CAPTURE_CODE_VERSION_MAJOR   (2U)
 
#define GPT_INPUT_CAPTURE_MAX_COUNT   (0xFFFFFFFFUL)
 Maximum value of GPT counter.
 

Enumerations

enum  gpt_input_capture_signal_t { GPT_INPUT_CAPTURE_SIGNAL_PIN_GTIOCA, GPT_INPUT_CAPTURE_SIGNAL_PIN_GTIOCB }
 
enum  gpt_input_capture_signal_filter_t { GPT_INPUT_CAPTURE_SIGNAL_FILTER_1, GPT_INPUT_CAPTURE_SIGNAL_FILTER_4, GPT_INPUT_CAPTURE_SIGNAL_FILTER_16, GPT_INPUT_CAPTURE_SIGNAL_FILTER_64 }
 
enum  gpt_input_capture_clock_divider_t {
  GPT_INPUT_CAPTURE_CLOCK_DIVIDER_1, GPT_INPUT_CAPTURE_CLOCK_DIVIDER_4, GPT_INPUT_CAPTURE_CLOCK_DIVIDER_16, GPT_INPUT_CAPTURE_CLOCK_DIVIDER_64,
  GPT_INPUT_CAPTURE_CLOCK_DIVIDER_256, GPT_INPUT_CAPTURE_CLOCK_DIVIDER_1024
}
 

Functions

ssp_err_t R_GPT_InputCaptureOpen (input_capture_ctrl_t *const p_api_ctrl, input_capture_cfg_t const *const p_cfg)
 Open a GPT Timer for Input Capture. Implements input_capture_api_t::open. More...
 
ssp_err_t R_GPT_InputCaptureClose (input_capture_ctrl_t *const p_api_ctrl)
 Close a GPT Timer Channel for Input Capture. Implements input_capture_api_t::close. More...
 
ssp_err_t R_GPT_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_GPT_InputCaptureDisable (input_capture_ctrl_t const *const p_api_ctrl)
 Disables GPT Input Capture RegA interrupt for specified channel at NVIC. Implements input_capture_api_t::disable. More...
 
ssp_err_t R_GPT_InputCaptureEnable (input_capture_ctrl_t const *const p_api_ctrl)
 Enables GPT Input Capture RegA interrupt for specified channel at NVIC. Implements input_capture_api_t::enable. More...
 
ssp_err_t R_GPT_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_GPT_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 General PWM Timer (GPT) with Input Capture.

Summary

Extends Input Capture Interface.

This module implements the Input Capture Interface for the General PWM Timer (GPT) peripherals GPT32EH, GPT32E, GPT32.

Macro Definition Documentation

◆ GPT_INPUT_CAPTURE_CODE_VERSION_MAJOR

#define GPT_INPUT_CAPTURE_CODE_VERSION_MAJOR   (2U)

Includes

Enumeration Type Documentation

◆ gpt_input_capture_clock_divider_t

Input capture PCLK divider. Used to scale the timer counter.

Enumerator
GPT_INPUT_CAPTURE_CLOCK_DIVIDER_1 

/ 1

GPT_INPUT_CAPTURE_CLOCK_DIVIDER_4 

/ 4

GPT_INPUT_CAPTURE_CLOCK_DIVIDER_16 

/ 16

GPT_INPUT_CAPTURE_CLOCK_DIVIDER_64 

/ 64

GPT_INPUT_CAPTURE_CLOCK_DIVIDER_256 

/ 256

GPT_INPUT_CAPTURE_CLOCK_DIVIDER_1024 

/ 1024

◆ gpt_input_capture_signal_filter_t

Input capture signal noise filter (debounce) setting. Only available for input signals GTIOCxA and GTIOCxB. 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, GPT section.

Enumerator
GPT_INPUT_CAPTURE_SIGNAL_FILTER_1 

PCLK/1 - fast sampling.

GPT_INPUT_CAPTURE_SIGNAL_FILTER_4 

PCLK/4.

GPT_INPUT_CAPTURE_SIGNAL_FILTER_16 

PCLK/16.

GPT_INPUT_CAPTURE_SIGNAL_FILTER_64 

PCLK/64 - slow sampling.

◆ gpt_input_capture_signal_t

Input capture signal selection

Enumerator
GPT_INPUT_CAPTURE_SIGNAL_PIN_GTIOCA 

GTIOCxA pin, where x is channel number.

GPT_INPUT_CAPTURE_SIGNAL_PIN_GTIOCB 

GTIOCxB pin, where x is channel number.

Function Documentation

◆ R_GPT_InputCaptureClose()

ssp_err_t R_GPT_InputCaptureClose ( input_capture_ctrl_t *const  p_api_ctrl)

Close a GPT 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_GPT_InputCaptureDisable()

ssp_err_t R_GPT_InputCaptureDisable ( input_capture_ctrl_t const *const  p_api_ctrl)

Disables GPT Input Capture RegA interrupt 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

Clearing the input capture source select registers.

◆ R_GPT_InputCaptureEnable()

ssp_err_t R_GPT_InputCaptureEnable ( input_capture_ctrl_t const *const  p_api_ctrl)

Enables GPT Input Capture RegA interrupt for specified channel at NVIC. 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.

Configuring the input capture source select registers.

Enabling the overflow and capture registers.

◆ R_GPT_InputCaptureInfoGet()

ssp_err_t R_GPT_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.

◆ R_GPT_InputCaptureLastCaptureGet()

ssp_err_t R_GPT_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.

Set capture value

◆ R_GPT_InputCaptureOpen()

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

Open a GPT Timer for Input Capture. Implements input_capture_api_t::open.

The Open function configures a single GPT 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.

Verify channel is not already used

◆ R_GPT_InputCaptureVersionGet()

ssp_err_t R_GPT_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.