Renesas e2studio.24--capacitive touch configuration 1
- overview
- video teaching
- csdn course
- sample application
- Complete code download
- hardware preparation
- New Construction
- project template
- save project path
- chip configuration
- Project template selection
- clock configuration
- Add TOUCH driver
- Configure CapTouch
- Open the tuning interface
- Start CapTouch Tuning
- Light up the LED by capacitive touch
overview
This document will create a capacitive touch application example using e2 studio to integrate QE, and light up the LED by touching the button. Recently, I am taking courses of ST and Renesas RA. If you need samples, you can add a group application: 615061293.
video teaching
https://www.bilibili.com/video/BV1vc411P7pV/
Renesas e2studio(24)----capacitive touch configuration(1)
csdn course
The csdn course is more detailed.
https://edu.csdn.net/course/detail/36131
sample application
https://www.wjx.top/vm/wBbmSFp.aspx#
Complete code download
https://download.csdn.net/download/qq_24312945/87798507
hardware preparation
First, you need to prepare a development board. Here I am preparing a development board with chip model R7FA4M2AD3CFP:
New Construction
project template
save project path
chip configuration
In this article, R7FA4M2AD3CFP is used for demonstration.
Project template selection
clock configuration
The external high-speed crystal oscillator on the development board is 12M, and XTAL needs to be modified to 12M.
Add TOUCH driver
Add touch components by clicking New Stack->CapTouch->Touch.
Check the instructions to know that the DTC component is required.
Enable DTC enable.
The capacitive touch in the development board mainly has two pins, P415 and P708.
Configure these 2 pins for capacitive touch mode.
Click Add DTC Driver for Transmission, select New-> Transfer(r_dtc ), and add DTC driver transmission.
Click Add DTC Driver for Reception, select New > Transfer(r_dtc) to add the dtc driver.
Configure CapTouch
From the menu in e2 studio, select Renesas View > Renesas QE > CapTouch Workflow (QE) to open the main view for configuring capacitive touch.
After opening, you can see the specific configuration process.
In the CapTouch Workflow (QE) pane, you first need to select the capacitive touch item to be configured, as shown below.
Execute "Prepare Configuration" to create a new Touch configuration by using the drop-down menu and selecting Create a new configuration.
Capacitive touch buttons can be added through Button, the specific process is as follows.
1. Select the Button menu item from the right and move the mouse over the canvas.
2. Click the left mouse button to drop the button icon. There are 2 capacitive touch buttons on the development board, two buttons can be added.
3. After the two buttons are added, press the side to select the Button menu to exit the placement.
Double-click the button to configure specific capacitive touch button pins.
Open the tuning interface
Click Renesas View -> Renesas QE -> CapTouch Tuning Result, the configuration of the touch interface will be displayed in the main view pane.
Start CapTouch Tuning
To start the automatic tuning process, click the start tuning button.
Need to pay attention to link to the development board.
QE for capacitive touch auto-tuning starts now, please read the tuning dialog windows carefully as they will guide you through the tuning process. A sample screen is shown below.
After going through a few automated steps, you will arrive at the dialog box with the information shown below.
This is the touch sensitivity measurement step of the tuning process. Press normal touch pressure on the sensor shown in the dialog.
As you press, the bar will increase to the right and the touch count will go up numerically. While maintaining the pressure, press any key on the computer keyboard to accept the measurement.
Once done, you will see the picture shown below, which is the detection threshold used by the middleware to determine if a Touch event has occurred.
Click the "Continue the Tuning Process" button in the dialog. This will exit the tuning process and disconnect the debug session on the target.
After the tuning process is complete, the default view presented here will be the tuning results for the sensors in that configuration. This allows the user to quickly see the adjustment results.
Output tuning parameter file. Click the "Output Parameter Files" button.
Look in the Project Explorer window and you'll see the files added. These files contain the adjustment information needed to enable touch detection.
Light up the LED by capacitive touch
To implement the application code for the capacitive touch state, click the "Show Sample" button.
A new menu window will open showing the sample code in the text. Click the "Output to a File" button.
Created a new project file describing the sample code. In the Project Explorer window, you will see that the qe_touch_sample.c file has been added.
Open hal_entry.c, add qe_touch_main() function in the example main program.
Configure the pins for the LEDs.
Add the touch button to light the LED in qe_touch_sample.c.
/* TODO: Add your own code here. */
if(button_status & (0b1 |0b10) )
{
R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_03_PIN_01, BSP_IO_LEVEL_HIGH);
}
else
{
R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_03_PIN_01, BSP_IO_LEVEL_LOW);
}
You can also view the touch button value button_status.