RA Flexible Software Package Documentation  Release v5.2.0

 
Key Matrix Interface

Detailed Description

Interface for key matrix functions.

Summary

The KEYMATRIX interface provides standard Key Matrix functionality including event generation on a rising or falling edge for one or more channels at the same time. The generated event indicates all channels that are active in that instant via a bit mask. This allows the interface to be used with a matrix configuration or a one-to-one hardware implementation that is triggered on either a rising or a falling edge.

Data Structures

struct  keymatrix_callback_args_t
 
struct  keymatrix_cfg_t
 
struct  keymatrix_api_t
 
struct  keymatrix_instance_t
 

Typedefs

typedef void keymatrix_ctrl_t
 

Enumerations

enum  keymatrix_trigger_t
 

Data Structure Documentation

◆ keymatrix_callback_args_t

struct keymatrix_callback_args_t

Callback function parameter data

Data Fields
void const * p_context Holder for user data. Set in keymatrix_api_t::open function in keymatrix_cfg_t.
uint32_t channel_mask

Bit vector representing the physical hardware channel(s) that caused the interrupt.

◆ keymatrix_cfg_t

struct keymatrix_cfg_t

User configuration structure, used in open function

Data Fields

uint32_t channel_mask
 Key Input channel(s). Bit mask of channels to open.
 
keymatrix_trigger_t trigger
 Key Input trigger setting.
 
uint8_t ipl
 Interrupt priority level.
 
IRQn_Type irq
 NVIC IRQ number.
 
void(* p_callback )(keymatrix_callback_args_t *p_args)
 Callback for key interrupt ISR.
 
void const * p_context
 Holder for user data. Passed to callback in keymatrix_user_cb_data_t.
 
void const * p_extend
 Extension parameter for hardware specific settings.
 

◆ keymatrix_api_t

struct keymatrix_api_t

Key Matrix driver structure. Key Matrix functions implemented at the HAL layer will use this API.

Data Fields

fsp_err_t(* open )(keymatrix_ctrl_t *const p_ctrl, keymatrix_cfg_t const *const p_cfg)
 
fsp_err_t(* enable )(keymatrix_ctrl_t *const p_ctrl)
 
fsp_err_t(* disable )(keymatrix_ctrl_t *const p_ctrl)
 
fsp_err_t(* close )(keymatrix_ctrl_t *const p_ctrl)
 

Field Documentation

◆ open

fsp_err_t(* keymatrix_api_t::open) (keymatrix_ctrl_t *const p_ctrl, keymatrix_cfg_t const *const p_cfg)

Initial configuration.

Parameters
[out]p_ctrlPointer to control block. Must be declared by user. Value set in this function.
[in]p_cfgPointer to configuration structure. All elements of the structure must be set by user.

◆ enable

fsp_err_t(* keymatrix_api_t::enable) (keymatrix_ctrl_t *const p_ctrl)

Enable Key interrupt

Parameters
[in]p_ctrlControl block pointer set in Open call for this Key interrupt.

◆ disable

fsp_err_t(* keymatrix_api_t::disable) (keymatrix_ctrl_t *const p_ctrl)

Disable Key interrupt.

Parameters
[in]p_ctrlControl block pointer set in Open call for this Key interrupt.

◆ close

fsp_err_t(* keymatrix_api_t::close) (keymatrix_ctrl_t *const p_ctrl)

Allow driver to be reconfigured. May reduce power consumption.

Parameters
[in]p_ctrlControl block pointer set in Open call for this Key interrupt.

◆ keymatrix_instance_t

struct keymatrix_instance_t

This structure encompasses everything that is needed to use an instance of this interface.

Data Fields
keymatrix_ctrl_t * p_ctrl Pointer to the control structure for this instance.
keymatrix_cfg_t const * p_cfg Pointer to the configuration structure for this instance.
keymatrix_api_t const * p_api Pointer to the API structure for this instance.

Typedef Documentation

◆ keymatrix_ctrl_t

typedef void keymatrix_ctrl_t

Key matrix control block. Allocate an instance specific control block to pass into the key matrix API calls.

Enumeration Type Documentation

◆ keymatrix_trigger_t

Trigger type: rising edge, falling edge

Enumerator
KEYMATRIX_TRIG_FALLING 

Falling edge trigger.

KEYMATRIX_TRIG_RISING 

Rising edge trigger.