Skip to content

Commit e7f64fe

Browse files
[renesas/ra2l1-cpk] add Captouch板载触摸按键配置说明.md (#6227)
* [renesas/ra2l1-cpk] add Captouch板载触摸按键配置说明.md * Update Captouch板载触摸按键配置说明.md Co-authored-by: Man, Jianting (Meco) <[email protected]>
1 parent 218cdbc commit e7f64fe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+303
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import glob
2+
Import('RTT_ROOT')
3+
Import('rtconfig')
4+
from building import *
5+
6+
cwd = GetCurrentDir()
7+
src = []
8+
group = []
9+
CPPPATH = []
10+
11+
file = glob.glob('*.tifcfg')
12+
if len(file):
13+
if rtconfig.PLATFORM == 'iar':
14+
print("\nThe current project does not support iar build\n")
15+
Return('group')
16+
elif rtconfig.PLATFORM == 'gcc':
17+
src += ['qe_touch_config.c']
18+
src += ['qe_sample_rtthread.c']
19+
CPPPATH = [cwd, ]
20+
elif rtconfig.PLATFORM == 'armclang':
21+
src += ['qe_touch_config.c']
22+
src += ['qe_sample_rtthread.c']
23+
CPPPATH = [cwd, ]
24+
25+
CPPDEFINES = ['QE_TOUCH_CONFIGURATION']
26+
group = DefineGroup('QE-Touch', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
27+
28+
Return('group')
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#include "qe_touch_config.h"
2+
#include <rtthread.h>
3+
#include <rtdevice.h>
4+
#define TOUCH_SCAN_INTERVAL_EXAMPLE (20) /* milliseconds */
5+
6+
uint64_t button_status;
7+
#if (TOUCH_CFG_NUM_SLIDERS != 0)
8+
uint16_t slider_position[TOUCH_CFG_NUM_SLIDERS];
9+
#endif
10+
#if (TOUCH_CFG_NUM_WHEELS != 0)
11+
uint16_t wheel_position[TOUCH_CFG_NUM_WHEELS];
12+
#endif
13+
14+
void qe_touch_main(void *parameter)
15+
{
16+
fsp_err_t err;
17+
rt_uint32_t led_blu = rt_pin_get("P501");
18+
19+
/* Open Touch middleware */
20+
rt_kprintf("TOUCH Open\n");
21+
err = RM_TOUCH_Open(g_qe_touch_instance_config01.p_ctrl, g_qe_touch_instance_config01.p_cfg);
22+
if (FSP_SUCCESS != err)
23+
{
24+
rt_kprintf("RM_TOUCH_Open fail\n");
25+
return;
26+
}
27+
28+
rt_kprintf("TOUCH ScanStart\n");
29+
/* Main loop */
30+
while (true)
31+
{
32+
/* for [CONFIG01] configuration */
33+
err = RM_TOUCH_ScanStart(g_qe_touch_instance_config01.p_ctrl);
34+
if (FSP_SUCCESS != err)
35+
{
36+
rt_kprintf("RM_TOUCH_Open fail\n");
37+
return;
38+
}
39+
while (0 == g_qe_touch_flag) {}
40+
g_qe_touch_flag = 0;
41+
42+
err = RM_TOUCH_DataGet(g_qe_touch_instance_config01.p_ctrl, &button_status, NULL, NULL);
43+
if (FSP_SUCCESS == err)
44+
{
45+
if (button_status)
46+
{
47+
rt_pin_write(led_blu, PIN_HIGH);
48+
}
49+
else
50+
{
51+
rt_pin_write(led_blu, PIN_LOW);
52+
}
53+
}
54+
55+
/* FIXME: Since this is a temporary process, so re-create a waiting process yourself. */
56+
rt_thread_mdelay(TOUCH_SCAN_INTERVAL_EXAMPLE);
57+
}
58+
}
59+
60+
int touch_init(void)
61+
{
62+
rt_thread_t tid = rt_thread_create("touch", qe_touch_main, RT_NULL, 512, 10, 50);
63+
if (tid)
64+
{
65+
rt_thread_startup(tid);
66+
}
67+
return 0;
68+
}
69+
INIT_APP_EXPORT(touch_init);
70+
//MSH_CMD_EXPORT(touch_init, touch_init);
Lines changed: 205 additions & 0 deletions
31.3 KB
16.8 KB
13.9 KB
28 KB
11.7 KB
19 KB
14.2 KB

0 commit comments

Comments
 (0)