Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ 4 Forum Discussions

FrogOnWell
Level 1
First like given 5 sign-ins First reply posted
Level 1

使用CSD检测自电容的方式,可否实现滑动条多点(2点)触摸的检测?为什么?

应用:在一个滑动条上,2个手指距离一定间隙,能否检测到这两个手指各自的位置?

0 Likes
1 Solution
Vison_Zhang
Moderator
Moderator 10 likes given 500 replies posted 100 sign-ins
Moderator

Creator->Tools->Options->Design Entry-->Component Catalog>Enable Param Edit Views(使能), 然后双击 CapSense 组件,光标移动到 Advanced Tab 右击选择 show expression view,在高级配置界面下找到 NumCentroidsType 参数,将其配置成 2。

但是我们获取滑条坐标的 API 只支持单个坐标点的获取,所以你需要自己定义一个类似的 API 才可能获取两个坐标, 

uint32 Customize_CapSense_GetCentroidPos(uint32 widgetId)
{
uint32 result = CapSense_1_SLIDER_NO_TOUCH;
CapSense_1_RAM_WD_SLIDER_STRUCT *wdSlider;

if ((widgetId < CapSense_1_TOTAL_WIDGETS) &&
((CapSense_1_WD_LINEAR_SLIDER_E ==
(CapSense_1_WD_TYPE_ENUM)CapSense_1_dsFlash.wdgtArray[widgetId].wdgtType) ||
(CapSense_1_WD_RADIAL_SLIDER_E ==
(CapSense_1_WD_TYPE_ENUM)CapSense_1_dsFlash.wdgtArray[widgetId].wdgtType)))
{
wdSlider = CapSense_1_dsFlash.wdgtArray[widgetId].ptr2WdgtRam;
//result = (uint32)wdSlider->position[0u];

result = (uint32)( (wdSlider->position[1u]  << 16u) | (wdSlider->position[0u]));

}

return result;
}

View solution in original post

4 Replies
Qi_Colin
Moderator
Moderator First like given 25 solutions authored 100 replies posted
Moderator

Hi @FrogOnWell :

不能,滑条返回的位置状态是电容变化量最大的位置,即使多个手指有一定间隙,也是对比电容变化量,计算最大的手指位置,touchpad可以实现多手指位置的检测。

Best Regards,

Colin

0 Likes
FrogOnWell
Level 1
First like given 5 sign-ins First reply posted
Level 1

是否可以提供TouchPad相关的设计资料?或参考设计。

0 Likes
Vison_Zhang
Moderator
Moderator 10 likes given 500 replies posted 100 sign-ins
Moderator

Creator->Tools->Options->Design Entry-->Component Catalog>Enable Param Edit Views(使能), 然后双击 CapSense 组件,光标移动到 Advanced Tab 右击选择 show expression view,在高级配置界面下找到 NumCentroidsType 参数,将其配置成 2。

但是我们获取滑条坐标的 API 只支持单个坐标点的获取,所以你需要自己定义一个类似的 API 才可能获取两个坐标, 

uint32 Customize_CapSense_GetCentroidPos(uint32 widgetId)
{
uint32 result = CapSense_1_SLIDER_NO_TOUCH;
CapSense_1_RAM_WD_SLIDER_STRUCT *wdSlider;

if ((widgetId < CapSense_1_TOTAL_WIDGETS) &&
((CapSense_1_WD_LINEAR_SLIDER_E ==
(CapSense_1_WD_TYPE_ENUM)CapSense_1_dsFlash.wdgtArray[widgetId].wdgtType) ||
(CapSense_1_WD_RADIAL_SLIDER_E ==
(CapSense_1_WD_TYPE_ENUM)CapSense_1_dsFlash.wdgtArray[widgetId].wdgtType)))
{
wdSlider = CapSense_1_dsFlash.wdgtArray[widgetId].ptr2WdgtRam;
//result = (uint32)wdSlider->position[0u];

result = (uint32)( (wdSlider->position[1u]  << 16u) | (wdSlider->position[0u]));

}

return result;
}