Key Matrix HAL Module Guide

Similar documents
SEGGER J-Link Lite for Renesas Synergy TM

PK-S5D9 v1.0 Out-of-Box Demonstration Programming Guidelines

1. Uses of Breakpoints... 2

Getting Started Guide for Heartbeat Kit

I²C Slave HAL Module Guide

Getting Started Guide for LED Toggle Kit

Customizing a SSP Module

1. RTC HAL Module Features RTC APIs Overview RTC HAL Module Operational Overview... 3

Introduction to Renesas Synergy SSP v.1.2.0

I/O Port HAL Module Guide

Getting Started with NetX Duo Web Server

External IRQ HAL Module Guide

1. DTC HAL Module Features DTC HAL Module APIs Overview DTC HAL Module Operational Overview... 3

USBX Mass Storage Class (Device)

Simple Audio Playback Example for DK-S124

1. Overview Board Specifications S3 Series Board System... 3

e² studio Pin Configurator Usage

Renesas Flash Programmer V

Block Media RAM Framework Module Guide

IAR Embedded Workbench for Renesas Synergy v8.21.1

Migrating Existing e 2 studio Projects to IAR Embedded Workbench for Renesas Synergy

Out-of-Box Demonstration for S1/S3/S5 Target Boards

JPEG Decode Framework Module Guide

R-IN, RZ/T1, TPS-1 Groups

Synergy Standalone Configurator (SSC) v Release Note. Renesas Synergy Platform Synergy Tools & Kits. Release Note

IWDT HAL Module Guide

ADC Periodic Framework Module Guide

1. CAC HAL Module Features CAC HAL Module APIs Overview CAC HAL Module Operational Overview... 4

Renesas Synergy Project Import Guide

USER S MANUAL. Features. Evaluation System Contents. JESD204B High Speed ADC. Evaluation Kit. AN1809 Rev 0.00 Dec 5, 2012

USBX CDC ACM (Device) for Target Boards

1. Kit Contents Features Device Components Programming to the SK-S7G2 Starter Kit... 15

USER S MANUAL ISL55110_11EVAL1Z, ISL55110_11EVAL2Z. Before Getting Started. BNC Connections. Scope Probe Connections. Power Down Feature

1. Overview Hardware Hardware Configuration Clock Settings Pin Settings... 6

Debugging Your Application with IAR C-SPY

RL78 Family Flash Self-Programming Library Type01 Ver.2.21 for the CC-RL compiler

Target Board S5D5 (TB-S5D5)

Thread Monitor Framework Module Guide

APPLICATION NOTE. Introduction. Copying the SPICE Netlist. Model Editor. From SPICE Netlist to Allegro Design Sub-Circuit. AN1613 Rev.0.

USBX TM Host Class Mass Storage Module Guide

1. Overview TPS-1 GUI Configuration Tool Procedure of configure TPS Error Code... 9

USER S MANUAL ISL2800XEVAL1Z. Introduction. Reference Documents. Evaluation Board Schematic. Power Supplies. Optional Transient Protection

APPLICATION NOTE. Basic SPI Bus Information. Bus Configuration and SPI Protocol of Multiple DCPs. SPI Protocol and Bus Configuration of Multiple DCPs

1. Installation Creating the Project Workspace Opening Sample Code and Source Files Source Code Functionality...

AP4 for RH850 V

USBX Device Class Mass Storage Module Guide

FIGURE 1. DIGITAL POT POWER TRENDS

USBX Host Class Hub Module Guide

1. Opening the sample code workspace Loading the selected sample code project Opening Sample Code and Source Files...

1. ADC HAL Module Features ADC HAL Module APIs Overview ADC HAL Module Operational Overview... 4

Capacitive Touch Button Framework Module Guide

R-IN32M3-EC, EC-1, RZ/T1

GUIX Studio v Release Note. Renesas Synergy Platform Synergy Software Express Logic GUIX Studio v

1. GPT HAL Module Features GPT HAL Module APIs Overview GPT HAL Module Operational Overview... 3

e² studio V7.0.1 Linux Host Public Beta for RZ

1. Installation Creating the Project Workspace Opening Sample Code and Source Files Source Code Functionality...

Bluetooth Low Energy on DK-S7G2 and DK S3A7

USBX Device Class HID Module Guide

PB0 25 PB1 26 PB2 27 PB3 28 PB4 29 PB5 30 PB6 31 PB7 32 VCC PC0 9 PC1 10 PC2 11 PC3 12 PC4 13 PC5 14 PC6 15 PC7 16

Target Board S1JA (TB-S1JA)

Capacitive Touch Slider Framework Module Guide

1. Overview of RX DSP Library System Requirements for the Sample Project... 2

USER S MANUAL ISL54206AEVAL1Z. Picture of Evaluation Board (Top View) Description. Board Architecture/Layout. Features.

USER S MANUAL. Key Board Features. Description. References. Specifications. Ordering Information ISL91110IIN-EVZ, ISL91110II2A-EVZ, ISL91110IIA-EVZ

Using ADC to Wake Up the MCU from Low Power Modes

APPLICATION NOTE. Introduction. Scope. Hardware Connections. Serial Port Operation. The X24C44 NOVRAM Teams up with 8051 Microcontrollers

PG-FP6 Gang Programmer V1.00 User s Manual

QE for USB: A Dedicated Tool for USB

APPLICATION NOTE. 16-Bit Data Bus Operation. Summary of 16-Bit Data Bus Performance. 80C286/80386 Hardware Comparison. AN112 Rev 1.

R20AN0311EJ0106 Rev.1.06 Interface conversion module for Ethernet Driver and Embedded system M3S-T4-Tiny Nov 30, 2016

Synergy Software Package Pin Configurator Usage

Renesas Starter Kit Sample Code for Cubesuite + Toolchain

1. Installation Creating the Project Workspace Adding Sample Code into DS Adding GNU Toolchain Support for DS-5...

Renesas Flash Programmer V

1. AGT HAL Module Features AGT HAL Module APIs Overview AGT HAL Module Operational Overview... 4

1. Overview BACnet Demo Software Architecture Programming and Debugging Building Sample Project... 5

USER S MANUAL. Description. Evaluation Board. Board Architecture/Layout. Features

Introduction Serial Programing... 2 Write Cycle... 2 Read Cycle... 2 Shared Timing Requirements Write Timing Diagram...

USER S MANUAL. Description. Key Features. References. Specifications. Ordering Information ISL9120IIA-EVZ. Evaluation Board User Guide

Development Kit S124 (DK-S124)

FileX Port Block Media Framework Module Guide

USBX Host Class HID Module Guide

NetX Telnet Client Module Guide

Development Kit S128 (DK-S128)

RX Family APPLICATION NOTE. DNS client using the embedded TCP/IP M3S-T4-Tiny Module Firmware Integration Technology. Introduction.

Audio Playback I2S Framework Module Guide

USER S MANUAL. ISL54059EVAL1Z Through ISL54064EVAL1Z. Description. Picture of Evaluation Board (Top View) Board Architecture/Layout.

Checking Analog Inputs in Sleep State in S3A7

Tools used Renesas R32C/100 Standard Toolchain version (compiler, assembler, linker): E8a in-circuit debugger.

Mutual Capacitive Touch Software Application Design with Synergy S124 and S3A7 MCUs

EX 6 XT 5 RESET 2 3 INT VCC FIGURE 1. TYPICAL HARDWARE CONNECTION FOR INTERFACING AN X24C44 TO A 6805 MICROCONTROLLER.

Audio Record ADC Framework Module Guide

Renesas Synergy APPLICATION NOTE. Project Migration Guide: SSP v1.0.0 to SSP v Introduction. Goals and Objectives.

APPLICATION NOTE. Hardware Implementation. Power-On-Reset (POR) Software Implementation. Low Voltage Reset (LVR) Watchdog Timer

COMMON INFORMATION. AC Power Faults. Introduction. Overview of Telecom and ESD Standards. Transients. Electrostatic Discharge (ESD) Lightning

Self-Capacitive Touch Software Application Design with Synergy S124 and S3A7 MCUs

NetX Port Ether Module Guide

PA3 PA4 PA5 PA6 PA7 PB0 PB1 PB2 PB3 PB4 PB5 PB6 PB7 PC0 PC1 PC2 PC3 PC4 PC5 PC6 PC7 VCC PD0 PD1 PD2 PD3 PD4 PD5 MODA MODB 27 AS 26 R/W 28

Thread Monitor Framework Module Guide

Contents. Chapter 1 Target Product Chapter 2 User's Manual Chapter 3 Revisions Chapter 4 Supported Tools... 3

Transcription:

Application Note Renesas Synergy Platform R11AN0123EU0101 Rev.1.01 Introduction This module guide will enable you to effectively use a module in your own design. Upon completion of this guide, you will be able to add this module to your own design, configure it correctly for the target application and write code, using the included application project code as a reference and efficient starting point. References to more detailed API descriptions and suggestions of other application projects that illustrate more advanced uses of the module are available in the Renesas Synergy Knowledge Base (as described in the References section at the end of this document), and should be valuable resources for creating more complex designs. The Key Matrix HAL module is a high-level API for Key Matrix HAL applications and is implemented on r_kint. The Key Matrix HAL module uses the key-interrupt function peripheral on the Synergy MCU. A user-defined callback can be created to inform the CPU of a key press event. Contents 1. Key Matrix HAL Module Features... 2 2. Key Matrix HAL Module APIs Overview... 2 3. HAL Module Operational Overview... 3 3.1 Key Matrix HAL Module Important Operational Notes and Limitations... 3 3.1.1 Key Matrix HAL Module Operational Notes... 3 3.1.2 Key Matrix HAL Module Limitations... 3 4. Including the Key Matrix HAL Module in an Application... 3 5. Configuring the Key Matrix HAL Module... 4 5.1 Key Matrix HAL Module Clock Configuration... 5 5.2 Key Matrix HAL Module Pin Configuration... 5 6. Using the Key Matrix HAL Module in an Application... 5 7. The Key Matrix HAL Module Application Project... 6 8. Customizing the Key Matrix HAL Module for a Target Application... 10 9. Running the Key Matrix HAL Module Application Project... 10 10. Key Matrix HAL Module Conclusion... 10 11. Key Matrix HAL Module Next Steps... 11 12. Key Matrix HAL Module Reference Information... 11 R11AN0123EU0101 Rev.1.01 Page 1 of 12

1. Key Matrix HAL Module Features This Key Matrix HAL module configures and controls the Key Interrupt (KINT) peripheral. It implements the following key functions: Supports both rising and falling edges on KINT channels Supports interrupt-based event notification Supports a bit-masking function to capture multiple events efficiently Supports a matrix keypad with edges on any two channels Figure 1 2. Key Matrix HAL Module APIs Overview Key Matrix HAL Module Block Diagram The Key Matrix HAL module defines APIs for opening, closing, enabling, and disabling key-interrupt functions. A complete list of the available APIs, an example API call and a short description of each can be found in the following table. A table of status return values follows the API summary table. Table 1 Key Matrix HAL Module API Summary Function Name Example API Call and Description.open g_keymatrix_on_kint.p_api->open(g_kint.p_ctrl, g_kint.p_cfg) Initial configuration..enable g_keymatrix_on_kint.p_api->enable(g_kint.p_ctrl) Enable Key interrupt..disable g_keymatrix_on_kint.p_api->disable(g_kint.p_ctrl) Disable Key interrupt..triggerset g_keymatrix_on_kint.p_api->triggerset(g_kint.p_ctrl, trigger) Set trigger for Key interrupt..close g_keymatrix_on_kint.p_api->close(g_kint.p_ctrl) Allow driver to be reconfigured. May reduce power consumption..versionget g_keymatrix_on_kint.p_api->versionget(&version) Get version and store it in provided pointer version. Note: For details on operation and definitions for the function data structures, typedefs, defines, API data, API structures and function variables, review the SSP User s Manual API References for the associated module. R11AN0123EU0101 Rev.1.01 Page 2 of 12

Table 2 Status Return Values Name Description SSP_SUCCESS Function successfully completed. SSP_ERR_ASSERTION Parameter has invalid value. SSP_ERR_INVALID_ARGUMENT Argument is invalid. SSP_ERR_HW_LOCKED The API has already been opened. It must be closed before it can be opened again. SSP_ERR_NOT_OPEN The peripheral is not opened. Note: Lower-level drivers may return common error codes. Refer to the SSP User s Manual API References for the associated module for a definition of all relevant status return values. 3. HAL Module Operational Overview The Key Matrix HAL module configures the Key Interrupt (KINT) peripheral to detect rising or falling edges on any of the KINT channels. When such an event is detected on any of the configured pins, the module generates an interrupt; the interrupt then calls the user callback ( p_callback) with the callback argument keymatrix_callback_args_t that specifies the channel(s) on which the edge was detected using a bitmask. Even though detection of an edge on any one channel generates the interrupt, the callback returns a bitmask keymatrix_channels_t of all the pins that were triggered at that time if any other pins also detected an edge. Thus, an interrupt is not necessarily generated for edge detection on each pin if an edge was also detected on another pin before the callback was called. If a new edge is detected after the callback was called, then the interrupt is triggered again, resulting in a new callback. This module can be used to implement a matrix keypad with edges on any two channels indicating the actual key that was pressed; alternatively, the module can be used as a single input to detect an edge on an input pin. 3.1 Key Matrix HAL Module Important Operational Notes and Limitations 3.1.1 Key Matrix HAL Module Operational Notes To trigger a transfer of data using the DMAC or DTC peripheral when a trigger edge is detected, configure the DMAC/DTC transfer with activation_source set to ELC_EVENT_KEY_INT. The KINT module can trigger the start of other peripherals available to the ELC. For details, see the ELC User s Guide in the SSP User s Manual. You must enable the KINT (INTKR) interrupt in the BSP for this module to operate, regardless of whether a callback is used in the open call. 3.1.2 Key Matrix HAL Module Limitations This module does not support polling-mode operation. Refer to the latest SSP Release Notes for any additional operational limitations for this module. 4. Including the Key Matrix HAL Module in an Application This section describes how to include the Key Matrix HAL module in an application using the SSP configurator. Note: It is assumed you are familiar with creating a project, adding threads, adding a stack to a thread and configuring a block within the stack. If you are unfamiliar with any of these items, refer to the first few chapters of the SSP User s Manual to learn how to manage each of these important steps in creating SSP-based applications. To add the Key Matrix Driver to an application, simply add it to a thread using the stacks selection sequence given in the following table. (The default name for the Key Matrix Driver is g_kint0. This name can be changed in the associated Properties window.) Table 3 Key Matrix HAL Module Selection Sequence Resource ISDE Tab Stacks Selection Sequence g_kint0 Key Matrix Driver on r_kint Threads New Stack> Driver> Input> Key Matrix Driver on r_kint R11AN0123EU0101 Rev.1.01 Page 3 of 12

When the Key Matrix Driver on r_kint is added to the thread stack as shown in the following figure, the configurator automatically adds any needed lower-level modules. Any drivers that need additional configuration information is box text highlighted in Red. Modules with a Gray band are individual modules that stand alone. Figure 2 5. Configuring the Key Matrix HAL Module Key Matrix HAL Module Stack The Key Matrix HAL module on r_kint must be configured by the user for the desired operation. The SSP configuration window automatically identifies (by highlighting the block in red) any required configuration selections, such as interrupts or operating modes, which must be configured for lower-level modules for successful operation. Only properties that can be changed without causing conflicts are available for modification. Other properties are locked and are not available for changes, and are identified with a lock icon for the locked property in the Properties window in the Integrated Solution Developer Environment (ISDE). This approach simplifies the configuration process and makes it much less error-prone than previous manual approaches to configuration. The available configuration settings and defaults for all the user-accessible properties are given in the properties tab within the SSP configurator, and are shown in the following tables for easy reference. One of the properties most often identified as requiring a change is the interrupt priority; this configuration setting is available within the Properties window of the associated module. Simply select the indicated module and then view the properties window; the interrupt settings are often toward the bottom of the properties list, so scroll down until they become available. Also note that the interrupt priorities listed in the Properties window in the ISDE includes an indication as to the validity of the setting based on the targeted MCU (CM4 or CM0+). This level of detail is not included in the following configuration properties tables, but is easily visible within the ISDE when configuring interrupt-priority levels. Note: You may want to open your ISDE, create the module and explore the property settings in parallel with looking over the following configuration table settings. This helps to orient you and can be a useful hands-on approach to learning the ins and outs of developing with SSP. Table 4 Configuration Settings for the Key Matrix HAL Module on r_kint ISDE Property Value Description Parameter BSP, Enabled, Disabled Enable or disable the parameter error checking. Checking (Default: BSP) Name g_kint0 Module name Keymatrix Channel Mask Select Channels Below This is a bit-mask with each bit specifying if that channel is to be enabled or not. Select the channels to be used. Channel 0:7 Unused, Used (Default: Unused) Channel 0:7 selection. Trigger Type Interrupt enabled after initialization Rising Edge, Falling Edge (Default: Rising Edge) True, False (Default: False) Specify if the enabled channels detect a rising edge or a falling edge. NOTE: either all channels detecting a rising edge or all channels detecting a falling edge. Specify if the module interrupts must be enabled as part of the open call. R11AN0123EU0101 Rev.1.01 Page 4 of 12

ISDE Property Value Description Callback NULL Callback selection. Interrupt Priority Priority 0 (highest), 1,2,3,4,5,6,7,8,9,10,11,12,13,1 4,15 (lowest, not valid if using Thread X), Disabled (Default: Disabled) Interrupt priority selection. Note: The example values and defaults are for a project using the Synergy S7G2 MCU Family. Other MCUs may have different default values and available configuration settings. 5.1 Key Matrix HAL Module Clock Configuration The Key Matrix HAL module does not require a specific clock configuration. 5.2 Key Matrix HAL Module Pin Configuration The KINT peripheral module uses pins on the MCU to communicate to external devices. I/O pins must be selected and configured as required by the external device. The following table illustrates the method for selecting the pins within the SSP configuration window and the subsequent table illustrates an example selection for the KINT pins. Table 5 Pin Selection for the Key Matrix HAL Module on r_kint Resource ISDE Tab Pin selection Sequence KINT Pins Select Peripherals > Input:KINT> KINT0 Note: The selection sequence assumes KINT0 is the desired hardware target for the driver. Table 6 Pin Configuration Settings for the Key Matrix HAL Module on r_kint Property Value Description Operation Mode Disabled, Custom Select Custom as the Operation Mode (Default: Disabled) KRM0:7 None, Pnn (Default: None) Key Interrupt Pin selection Note: The example values are for a project using the Synergy S7G2 MCU Family and the SK-S7G2 Kit. Other Synergy MCUs and Synergy Kits may have different available pin configuration settings. 6. Using the Key Matrix HAL Module in an Application The typical steps in using the Key Matrix HAL module in an application are: 1. Initialize the Key Matrix HAL module using the open API 2. If the autostart configuration setting is true, the module starts operation immediately 3. If the autostart is not set, use enable API to enable operation 4. Respond to key inputs 5. Disable operation using the disable API 6. To modify trigger edge after initialization, use the triggerset API 7. Close the module by using the close API The following figure illustrates these common steps are illustrated in a typical operational flow diagram: R11AN0123EU0101 Rev.1.01 Page 5 of 12

Figure 3 Flow Diagram of a Typical Key Matrix HAL Module Application 7. The Key Matrix HAL Module Application Project The application project associated with this module guide demonstrates the aforementioned steps in a full design. You may want to import and open the application project within the ISDE and view the configuration settings for the Key Matrix HAL module. You can also read over the code (in kint_hal.c) which is used to illustrate the Key Matrix HAL module APIs in a complete design. The application project demonstrates the typical use of the Key Matrix HAL module APIs in a typical application, which is interfacing to a key matrix keypad. The key matrix keypad is a 3 x 4 configuration, where three column lines are actively controlled by the user application and the four row lines are interfaced to the KINT peripheral. The application project initializes the Key Matrix HAL module and enables the key interrupt; additional modules are also initialized. The control of the three column control lines is performed every 100 ms. One of the AGT (Asynchronous General Purpose Timer) timers is used for this purpose and is configured to generate a periodic interrupt every 100 ms. When a key press is detected, a KINT interrupt is generated and the KINT callback is called with the parameter identifying which row of the key matrix has been pressed. Subsequent control determines which column of the key matrix has been pressed, as done by the KINT-callback function. As the application project is interrupt driven, once the Key Matrix HAL Module and AGT timer are active, the application enters an empty while(1) loop. To run this application project, a 3x4 keypad is recommended. The following figure shows how the 3 x 4 keypad is connected to the SK-S7G2 board. R11AN0123EU0101 Rev.1.01 Page 6 of 12

Figure 4 Connecting the Keypad to the SK-S7G2 board In absence of a keypad, user can verify their application by shorting the row and column lines using a wire. The shows how the keys are interfaced between rows and columns. Table 7: Key Matrix Column 1 [P3:12] Column 2[P3:11] Column 3[P3:10] Rows 1 P[1.7] 5 4 6 Rows 2 P[1.6] 8 7 9 Rows 3 P[1.5] 0 * # Rows 4 P[1.4] 2 1 3 Table 8: Software and Hardware Resources Used by the Application Project Resource Revision Description e 2 studio 5.3.1 or later Integrated Solution Development Environment SSP 1.2.0 or later Synergy Software Platform IAR EW for Synergy 7.71.2 or later IAR Embedded Workbench for Renesas Synergy SSC 5.3.1 or later Synergy Standalone Configurator SK-S7G2 v3.0 to v3.1 Starter Kit Keypad NA Standard 3x4 Keypad The following figures is a simple flow diagram of the application project: R11AN0123EU0101 Rev.1.01 Page 7 of 12

Figure 5 Key Matrix HAL Module Application Project Flow Diagram The kint_hal.c file is located in the project once it has been imported into the ISDE. You can open this file within the ISDE and follow along with the description provided to help identify key uses of APIs. The first section of kint_hal.c defines keys on the key matrix, time delays in milliseconds, and output column number enumerate variables. This section also prototypes the functions of the file and defines an array which represents whether a specific key is pressed or not. R11AN0123EU0101 Rev.1.01 Page 8 of 12

Following this is the entry point, kint_hal. The first section of the function initializes the graphics LCD controller; this part of the code can be enable or disabled via the #define SHOW_KEY_ON_TFT, which is set in the header file kint_hal.h. As previously mentioned, the column lines of the key matrix are controlled via three output pins. Even though the initial output state is defined in the Synergy Pin Configurator, and set as part of board support package (BSP) initialization; the application sets these pins to a known state using the IOPORT pinwrite API. In the next section, the AGT and KINT modules are opened. The AGT is used to generate a 100 ms interrupt, and the KINT is opened with its interrupt disabled. Once opened, the AGT is started and the KINT interrupt is enabled. It would be valid for the AGT open to start the timer automatically and for the KINT open to enable the interrupts; this method of discreet steps was chosen to demonstrate more API calls of the associated modules. As the application project is interrupt driven, the application now executes an empty while(1) loop. In the following section, the AGT interrupt callback function is called; this callback takes each of the column lines from low-to-high-to-low with a user-defined delay between the transitions by calling the user-defined function change_pin(). The last section is the KINT interrupt callback function, which determines which key has been pressed. The callback function has a parameter identifying which row of the key matrix has been pressed. By knowing which column line was high at the time of the KINT ISR and which KINT line is generating the interrupt, it is a simple process to determine which key was pressed. The specific element of the key array variable is set to true, which represents the key pressed. A few key properties are configured in this application project to support the required operations and the physical properties of the target board and MCU. The properties with the values set for this specific project are listed in the following tables. You can also open the application project and view these settings in the Properties window as a handson exercise. Table 9 Key Matrix HAL Module Configuration Settings for the Application Project ISDE Property Name Keymatrix Channel Mask Channel 0 Channel 1 Channel 2 Channel 3 Channel 4 Channel 5 Channel 6 Channel 7 Trigger type Interrupt enabled after initialization Callback Interrupt Priority Value Set g_kint Select Channels Below Unused Unused Unused Unused Used Used Used Used Rising edge False g_kint_callback Priority 4 (CM4: valid, CM0+: invalid) Table 10 AGT HAL Module Configuration Settings for the Application Project ISDE Property Value Set Name g_agt0 Channel 0 Mode Periodic Period Value 100 Period Unit Milliseconds Auto Start False Count Source LOCO AGT0 Output Enable False AGTIO Output Enable False Output Inverted False R11AN0123EU0101 Rev.1.01 Page 9 of 12

ISDE Property Callback Interrupt Priority Value Set g_agt0_callback Priority 8 (CM4: valid, CM0+: invalid) In addition, the application project requires the pin configuration as presented in the following table: Table 11 Pin Configuration Pin Selection Sequence Pin Configuration Property Setting Ports > P3 > P312 Mode Mode: Output mode (Initial Low) Ports > P3 > P311 Mode Mode: Output mode (Initial Low) Ports > P3 > P310 Mode Mode: Output mode (Initial Low) Peripherals > Input:KINT > KRM4 KRM4 P104 Peripherals > Input:KINT > KRM5 KRM5 P105 Peripherals > Input:KINT > KRM6 KRM6 P106 Peripherals > Input:KINT > KRM7 KRM7 P107 8. Customizing the Key Matrix HAL Module for a Target Application Some configuration settings are normally changed by the developer from those shown in the application project; for example, you can easily change the channels you want to use for input and the pins you want to use for output. You can also change the number of channels or outputs to meet the requirements of your own hardware. 9. Running the Key Matrix HAL Module Application Project To create and run the Key Matrix HAL module application project, simply follow these steps: 1. Create a new Renesas Synergy project for the SK-S7G2 called KINT_HAL_MG_AP. 2. Select the Threads tab. 3. Add the Key Matrix HAL module to HAL/Common and set its parameters. 4. Click on the Generate Project Content button. 5. Add the code from the supplied project files kint_hal.c and kint_hal.h. 6. Build the project. 7. Connect to the host PC with USB cable using DEBUG_USB (J19) socket. 8. Start to debug the application 9. If semi hosting is enabled, the output can be viewed on Renesas Debug Virtual Console as shown in Figure 7. Figure 6 10. Key Matrix HAL Module Conclusion Example Output from Key Matrix HAL Module Application Project This module guide has provided all the background information needed to select, add, configure and use the module in an example project. Many of these steps were time consuming and error-prone activities in previous generations of embedded systems. The Renesas Synergy Platform makes these steps much less time consuming and removes the common errors, like conflicting configuration settings or the incorrect selection of lower-level drivers. The use of high-level APIs (as demonstrated in the application project) illustrates the additional development time savings achieved by allowing work to begin at a high level; avoiding the time required in older development environments to use or, in some cases, create, lower-level drivers. R11AN0123EU0101 Rev.1.01 Page 10 of 12

11. Key Matrix HAL Module Next Steps After you have mastered a simple Key Matrix HAL module project, you may want to review a more complex example. You may find that the running a Key Matrix function in a separate thread is better for your application. You may then want to run the ThreadX RTOS to create a multi-thread design. 12. Key Matrix HAL Module Reference Information SSP User Manual: Available in html format in the SSP distribution package and as a pdf from the Synergy Gallery. Links to all the most up-to-date r_kint module reference materials and resources are available on the Synergy Knowledge Base: https://enus.knowledgebase.renesas.com/english_content/renesas_synergy%e2%84%a2_platform/renesas_synergy_knowle dge_base/r_kint_module_guide_resources. R11AN0123EU0101 Rev.1.01 Page 11 of 12

Website and Support Support: https://synergygallery.renesas.com/support Technical Contact Details: America: https://www.renesas.com/en-us/support/contact.html Europe: https://www.renesas.com/en-eu/support/contact.html Japan: https://www.renesas.com/ja-jp/support/contact.html All trademarks and registered trademarks are the property of their respective owners. R11AN0123EU0101 Rev.1.01 Page 12 of 12

Revision History Rev. Date Description Page Summary 1.00 Jun 16, 2017 Initial Release 1.01 7 Update to Hardware and Software Resources Table

Notice 1. Descriptions of circuits, software and other related information in this document are provided only to illustrate the operation of semiconductor products and application examples. You are fully responsible for the incorporation or any other use of the circuits, software, and information in the design of your product or system. Renesas Electronics disclaims any and all liability for any losses and damages incurred by you or third parties arising from the use of these circuits, software, or information. 2. Renesas Electronics hereby expressly disclaims any warranties against and liability for infringement or any other disputes involving patents, copyrights, or other intellectual property rights of third parties, by or arising from the use of Renesas Electronics products or technical information described in this document, including but not limited to, the product data, drawing, chart, program, algorithm, application examples. 3. No license, express, implied or otherwise, is granted hereby under any patents, copyrights or other intellectual property rights of Renesas Electronics or others. 4. You shall not alter, modify, copy, or otherwise misappropriate any Renesas Electronics product, whether in whole or in part. Renesas Electronics disclaims any and all liability for any losses or damages incurred by you or third parties arising from such alteration, modification, copy or otherwise misappropriation of Renesas Electronics products. 5. Renesas Electronics products are classified according to the following two quality grades: "Standard" and "High Quality". The intended applications for each Renesas Electronics product depends on the product s quality grade, as indicated below. "Standard": Computers; office equipment; communications equipment; test and measurement equipment; audio and visual equipment; home electronic appliances; machine tools; personal electronic equipment; and industrial robots etc. "High Quality": Transportation equipment (automobiles, trains, ships, etc.); traffic control (traffic lights); large-scale communication equipment; key financial terminal systems; safety control equipment; etc. Renesas Electronics products are neither intended nor authorized for use in products or systems that may pose a direct threat to human life or bodily injury (artificial life support devices or systems, surgical implantations etc.), or may cause serious property damages (space and undersea repeaters; nuclear power control systems; aircraft control systems; key plant systems; military equipment; etc.). Renesas Electronics disclaims any and all liability for any damages or losses incurred by you or third parties arising from the use of any Renesas Electronics product for which the product is not intended by Renesas Electronics. 6. When using the Renesas Electronics products, refer to the latest product information (data sheets, user s manuals, application notes, "General Notes for Handling and Using Semiconductor Devices" in the reliability handbook, etc.), and ensure that usage conditions are within the ranges specified by Renesas Electronics with respect to maximum ratings, operating power supply voltage range, heat radiation characteristics, installation, etc. Renesas Electronics disclaims any and all liability for any malfunctions or failure or accident arising out of the use of Renesas Electronics products beyond such specified ranges. 7. Although Renesas Electronics endeavors to improve the quality and reliability of Renesas Electronics products, semiconductor products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. Further, Renesas Electronics products are not subject to radiation resistance design. Please ensure to implement safety measures to guard them against the possibility of bodily injury, injury or damage caused by fire, and social damage in the event of failure or malfunction of Renesas Electronics products, such as safety design for hardware and software including but not limited to redundancy, fire control and malfunction prevention, appropriate treatment for aging degradation or any other appropriate measures by your own responsibility as warranty for your products/system. Because the evaluation of microcomputer software alone is very difficult and not practical, please evaluate the safety of the final products or systems manufactured by you. 8. Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental compatibility of each Renesas Electronics product. Please investigate applicable laws and regulations that regulate the inclusion or use of controlled substances, including without limitation, the EU RoHS Directive carefully and sufficiently and use Renesas Electronics products in compliance with all these applicable laws and regulations. Renesas Electronics disclaims any and all liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations. 9. Renesas Electronics products and technologies shall not be used for or incorporated into any products or systems whose manufacture, use, or sale is prohibited under any applicable domestic or foreign laws or regulations. You shall not use Renesas Electronics products or technologies for (1) any purpose relating to the development, design, manufacture, use, stockpiling, etc., of weapons of mass destruction, such as nuclear weapons, chemical weapons, or biological weapons, or missiles (including unmanned aerial vehicles (UAVs)) for delivering such weapons, (2) any purpose relating to the development, design, manufacture, or use of conventional weapons, or (3) any other purpose of disturbing international peace and security, and you shall not sell, export, lease, transfer, or release Renesas Electronics products or technologies to any third party whether directly or indirectly with knowledge or reason to know that the third party or any other party will engage in the activities described above. When exporting, selling, transferring, etc., Renesas Electronics products or technologies, you shall comply with any applicable export control laws and regulations promulgated and administered by the governments of the countries asserting jurisdiction over the parties or transactions. 10. Please acknowledge and agree that you shall bear all the losses and damages which are incurred from the misuse or violation of the terms and conditions described in this document, including this notice, and hold Renesas Electronics harmless, if such misuse or violation results from your resale or making Renesas Electronics products available any third party. 11. This document shall not be reprinted, reproduced or duplicated in any form, in whole or in part, without prior written consent of Renesas Electronics. 12. Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this document or Renesas Electronics products. (Note 1) "Renesas Electronics" as used in this document means Renesas Electronics Corporation and also includes its majority-owned subsidiaries. (Note 2) "Renesas Electronics product(s)" means any product developed or manufactured by or for Renesas Electronics. (Rev.3.0-1 November 2016) SALES OFFICES Refer to "http://www.renesas.com/" for the latest and detailed information. Renesas Electronics America Inc. 2801 Scott Boulevard Santa Clara, CA 95050-2549, U.S.A. Tel: +1-408-588-6000, Fax: +1-408-588-6130 Renesas Electronics Canada Limited 9251 Yonge Street, Suite 8309 Richmond Hill, Ontario Canada L4C 9T3 Tel: +1-905-237-2004 Renesas Electronics Europe Limited Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, U.K Tel: +44-1628-585-100, Fax: +44-1628-585-900 Renesas Electronics Europe GmbH Arcadiastrasse 10, 40472 Düsseldorf, Germany Tel: +49-211-6503-0, Fax: +49-211-6503-1327 Renesas Electronics (China) Co., Ltd. Room 1709, Quantum Plaza, No.27 ZhiChunLu Haidian District, Beijing 100191, P.R.China Tel: +86-10-8235-1155, Fax: +86-10-8235-7679 Renesas Electronics (Shanghai) Co., Ltd. Unit 301, Tower A, Central Towers, 555 Langao Road, Putuo District, Shanghai, P. R. China 200333 Tel: +86-21-2226-0888, Fax: +86-21-2226-0999 Renesas Electronics Hong Kong Limited Unit 1601-1611, 16/F., Tower 2, Grand Century Place, 193 Prince Edward Road West, Mongkok, Kowloon, Hong Kong Tel: +852-2265-6688, Fax: +852 2886-9022 Renesas Electronics Taiwan Co., Ltd. 13F, No. 363, Fu Shing North Road, Taipei 10543, Taiwan Tel: +886-2-8175-9600, Fax: +886 2-8175-9670 Renesas Electronics Singapore Pte. Ltd. 80 Bendemeer Road, Unit #06-02 Hyflux Innovation Centre, Singapore 339949 Tel: +65-6213-0200, Fax: +65-6213-0300 Renesas Electronics Malaysia Sdn.Bhd. Unit 1207, Block B, Menara Amcorp, Amcorp Trade Centre, No. 18, Jln Persiaran Barat, 46050 Petaling Jaya, Selangor Darul Ehsan, Malaysia Tel: +60-3-7955-9390, Fax: +60-3-7955-9510 Renesas Electronics India Pvt. Ltd. No.777C, 100 Feet Road, HAL II Stage, Indiranagar, Bangalore, India Tel: +91-80-67208700, Fax: +91-80-67208777 Renesas Electronics Korea Co., Ltd. 12F., 234 Teheran-ro, Gangnam-Gu, Seoul, 135-080, Korea Tel: +82-2-558-3737, Fax: +82-2-558-5141 http://www.renesas.com 2017 Renesas Electronics Corporation. All rights reserved. Colophon 6.0