cancel
Showing results for 
Search instead for 
Did you mean: 

STM8S, how to active multiTouchs at the same time?

eengineerhe
Associate II
Posted on June 13, 2016 at 09:18

Dear All,

I use  <<STM8S_TouchSensing_Lib_V2.5.0_setup.exe>> to build one testing system of STM8S RC Touchsensing. it has four ''buttons'' and four LEDs. for every ''button'', it can works well for touching. once the hand touch the ''button'', the corresponding LED is on. once release hand, LED is off. this is good.

But, just one LED works for multi-Touching. I am thinking how to get multi-LEDs be ON at the same time. that's to say, how to make multi-Touches work at the same time? for example, when one button is touched, one LED is ON. when two buttons are touched, two LEDs are ON. when four buttons are touched, four LEDs are ON. how can I realize this function?

During my test, I found when the hand is touching button A, the LED A is ON. don't release hand and touch another button, LED A will keep ON until the hand release from button A. before releasing the hand, any touch for other buttons is useless.

Would you have any help for this confusion? Thanks,

-Miles

4 REPLIES 4
OlivierR
ST Employee
Posted on June 14, 2016 at 14:56

Hello Miles,

You must enable DxS feature: set DxSGroup with relevant values.

Setup can be done in ExtraCode_Init() level.

e.g: STM8S_TouchSensing_Lib_V2.5.0\Projects\Examples\STM8S207K6_Ex02\src\main.c:ExtraCode_Init()

...

void ExtraCode_Init(void)

{

...

#if NUMBER_OF_SINGLE_CHANNEL_KEYS > 0

...

    sSCKeyInfo[i].DxSGroup = 0x??; /* 0x00 = DxS disabled, other values = DxS enabled */

==> set DxSGroup with relevant value. See Examples

...

#endif

...

#if NUMBER_OF_MULTI_CHANNEL_KEYS > 0

...

    sMCKeyInfo[i].DxSGroup = 0x??; /* 0x00 = DxS disabled, other values = DxS enabled */

==> set DxSGroup with relevant value. See Examples

...

#endif

...

Details regarding DxSGroup field (Touch-Sensing Driver User Manual):

 

Detection exclusion System (DxS)

This feature is designed to authorize only one key to enter

the detected state within a group of keys.

The scheme to decide which key must be detected or rejected

is based on the timing of acquisition:

  The first key to be detected is authorized and the other keys

  of the same group cannot enter the detection state.

Each key can be a part of zero, one or several groups (with a maximum of 8 groups).

The group is held by the DxSGroup variable which is part of

the structures Single_Channel_Complete_Info_T,

Penta_Channel_Complete_Info_T and Octo_Channel_Complete_Info_T.

  The 8 bits of this variable represent the 8 different groups (from group 0 to group 7).

Examples:

 DxSGroup = 0x00: the key is not a member of a group (default value)

 DxSGroup = 0x01: the key is member of group 0

 DxSGroup = 0x81: the key is member of groups 0 and 7

 DxSGroup = 0xFF: the key is member of all groups

The DxS process is managed by the TSL_SCKey_DxS() function

(for the Single channel keys) and by the TSL_MCKey_DxS() function (for the Multi channels keys).

Shadock.

eengineerhe
Associate II
Posted on June 22, 2016 at 12:15

Hi Shadock,

Thanks for your detailed and professional information.

But I found when I set ''sSCKeyInfo[i].DESGroup = 0x00;'' in thevoid ExtraCode_Init(void), multikey can be touched at the same time. when I set''sSCKeyInfo[i].DESGroup = 0x01;'' or other value(for example, 0xFF), still just one key can be touched.

The attached picture is the screenshot of my code of void ExtraCode_Init(void).

-Miles

________________

Attachments :

2016-6-22_17-39-55.jpg : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtjI&d=%2Fa%2F0X0000000aWH%2Fwx6PREli6MgohapY3om1IAnGjouZ7TVBFlP3kuB8Xyw&asPdf=false
OlivierR
ST Employee
Posted on June 23, 2016 at 14:11

Hello Miles

Yes.

When you set one bit in DxSGroup, you switch-on DxS on the group.

When you reset DxSGroup, exclusive mode if OFF.

Seems you have only one group, and you change DxS by DES on driver. Seems relevant.

Shadock.

 

eengineerhe
Associate II
Posted on June 30, 2016 at 02:14

Hi Shadock,

My code has two groups. three touches are one group. another one is second group. I am looking for the solution. Thanks for your information.

-Miles