Synergy Software Package User's Manual

Driver for the Key Interrupt Function. More...

Data Structures

struct  kint_instance_ctrl_t
 

Functions

ssp_err_t R_KINT_KEYMATRIX_Open (keymatrix_ctrl_t *const p_api_ctrl, keymatrix_cfg_t const *const p_cfg)
 Power on KINT, handle required initialization described in hardware manual. Implements keymatrix_api_t::open. More...
 
ssp_err_t R_KINT_KEYMATRIX_Close (keymatrix_ctrl_t *const p_api_ctrl)
 Disable KINT. Implements keymatrix_api_t::close. More...
 
ssp_err_t R_KINT_KEYMATRIX_Enable (keymatrix_ctrl_t *const p_api_ctrl)
 Enable external irq for all the specified channel by R_KINT_KEYMATRIX_Open. Implements keymatrix_api_t::enable. More...
 
ssp_err_t R_KINT_KEYMATRIX_Disable (keymatrix_ctrl_t *const p_api_ctrl)
 Disable external irq for all the specified channel by R_KINT_KEYMATRIX_Open. Implements keymatrix_api_t::disable. More...
 
ssp_err_t R_KINT_KEYMATRIX_TriggerSet (keymatrix_ctrl_t *const p_api_ctrl, keymatrix_trigger_t hw_trigger)
 Set trigger edge (falling or rising) provided. Implements keymatrix_api_t::triggerSet. More...
 
ssp_err_t R_KINT_VersionGet (ssp_version_t *const p_version)
 Set driver version based on compile time macros. More...
 

Detailed Description

Driver for the Key Interrupt Function.

The Key input driver can be used for one to eight channels or in a matrix format. This module implements the following interface: Key Matrix Interface.

Function Documentation

◆ R_KINT_KEYMATRIX_Close()

ssp_err_t R_KINT_KEYMATRIX_Close ( keymatrix_ctrl_t *const  p_api_ctrl)

Disable KINT. Implements keymatrix_api_t::close.

End of function R_KINT_KEYMATRIX_Open The Close function disables the interrupts in the peripheral and the NVIC and clears any pending interrupt requests. It also releases the hardware lock on the API.

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

Disable interrupt in ICU

Disable interrupts in the KINT peripheral

Clear any pending interrupt requests in the KINT peripheral

Clear the Interrupt Request bit

Clear stored internal driver data

Release the lock

◆ R_KINT_KEYMATRIX_Disable()

ssp_err_t R_KINT_KEYMATRIX_Disable ( keymatrix_ctrl_t *const  p_api_ctrl)

Disable external irq for all the specified channel by R_KINT_KEYMATRIX_Open. Implements keymatrix_api_t::disable.

This function disables interrupts for the KINT peripheral both at the interrupt level and in the NVIC. All the channels specified by R_KINT_KEYMATRIX_Open are disabled.

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

Disable interrupts in the KINT peripheral

Clear any pending interrupt requests in the KINT peripheral

Disable interrupt in the ICU

◆ R_KINT_KEYMATRIX_Enable()

ssp_err_t R_KINT_KEYMATRIX_Enable ( keymatrix_ctrl_t *const  p_api_ctrl)

Enable external irq for all the specified channel by R_KINT_KEYMATRIX_Open. Implements keymatrix_api_t::enable.

This function enables interrupts for the KINT peripheral both at the interrupt level and in the NVIC after clearing any pending requests in the KINT and ICU peripheral. All the channels specified by R_KINT_KEYMATRIX_Open are enabled.

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

Clear any pending interrupt requests in the KINT peripheral

Clear the Interrupt Request Flag in the ICU

Enable interrupt for the selected channels after casting since KRM is an 8 bit register

Enable interrupt

◆ R_KINT_KEYMATRIX_Open()

ssp_err_t R_KINT_KEYMATRIX_Open ( keymatrix_ctrl_t *const  p_api_ctrl,
keymatrix_cfg_t const *const  p_cfg 
)

Power on KINT, handle required initialization described in hardware manual. Implements keymatrix_api_t::open.

The Open function configures all the Key Input (KINT) channels and provides a handle for use with the rest of the KINT API functions. This function must be called at least once prior to calling any other KINT API functions. After the peripheral is initialized, the Open function should not be called again without first calling the Close function.

Return values
SSP_SUCCESSInitialization was successful.
SSP_ERR_ASSERTIONOne of the following parameters may be NULL: p_cfg, or p_ctrl or the callback.
SSP_ERR_INVALID_ARGUMENTOne of the following may be invalid:
  • p_cfg->channel: must be between 0 and KINT_MAX_NUM_CHANNELS
  • p_cfg->trigger not a valid value.
SSP_ERR_HW_LOCKEDThe API has already been opened. It must be closed before it can be opened again.
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls:
Note
This function is not reentrant.

Check to see that the arguments passed are not null pointers

Grab the hardware lock. If successful this indicates that the open was not previously called.

Disable interrupts in the KINT peripheral

Clear any pending interrupt requests in the KINT peripheral

Clear the Interrupt Request in the ICU

Configure the trigger edge. The trigger edge can be modified in the TriggerSet function later if desired

KEYMATRIX_TRIG_RISING condition

Configure the usage of key interrupt flags

Store the callback and context information

If interrupts are to be enabled now, set it up for the selected channels. The channels can be changed later in the enable function but to modify the callback and context, the API has to be closed and reopened with the new callback and context.

Note
The KINT hardware only supports a single interrupt for all channels

Enable interrupt for the selected channels after casting since KRM is an 8 bit register

Enable interrupt

Store number of channels for use to the control block to use it later

Mark driver as open by initializing it to "KINT" in its ASCII equivalent.

◆ R_KINT_KEYMATRIX_TriggerSet()

ssp_err_t R_KINT_KEYMATRIX_TriggerSet ( keymatrix_ctrl_t *const  p_api_ctrl,
keymatrix_trigger_t  hw_trigger 
)

Set trigger edge (falling or rising) provided. Implements keymatrix_api_t::triggerSet.

This function changes trigger sense at run-time. The change is applied to all the channels specified by R_KINT_KEYMATRIX_Open.

Return values
SSP_SUCCESSTrigger value written successfully.
SSP_ERR_ASSERTIONThe p_ctrl parameter was null.
SSP_ERR_INVALID_ARGUMENTTrigger input invalid. hw_trigger must be one of the options from button_trigger_t.
SSP_ERR_NOT_OPENThe channel is not opened.
Note
This function expects to be called when the driver is disabled (the driver state before R_KINT_KEYMATRIX_Enable is called if the driver is opened in the non-auto start mode, or after R_KINT_KEYMATRIX_Disable is called if the driver is opened in the auto start mode). The driver does not restrict to call this API when the driver is enabled but users need to make sure the edge detection sense is instantly changed by this API call.

Configure the trigger edge

KEYMATRIX_TRIG_RISING condition

Configure the usage of key interrupt flags

◆ R_KINT_VersionGet()

ssp_err_t R_KINT_VersionGet ( ssp_version_t *const  p_version)

Set driver version based on compile time macros.

Return values
SSP_SUCCESSSuccessful return.
SSP_ERR_ASSERTIONThe parameter p_version is NULL.