使用CSD方式实现滑动条,是否可以实现2点触摸?

公告

大中华汽车电子生态圈社区并入开发者社区- 更多资讯点击此

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

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

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

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

0 点赞
1 解答
Vison_Zhang
Moderator
Moderator
Moderator
First comment on KBA 750 replies posted 250 sign-ins

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;
}

在原帖中查看解决方案

4 回复数
Qi_Colin
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 5 questions asked

Hi @FrogOnWell :

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

Best Regards,

Colin

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

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

0 点赞
Qi_Colin
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 5 questions asked

Hi @FrogOnWell :

请参考PSoC™ 4 and PSoC™ 6 MCU CAPSENSE™ design guide中关于touchpad的描述。

Best Regards,

Colin

0 点赞
Vison_Zhang
Moderator
Moderator
Moderator
First comment on KBA 750 replies posted 250 sign-ins

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;
}