cancel
Showing results for 
Search instead for 
Did you mean: 

Stm8 TSL and double touch

dexter_khm
Associate II
Posted on December 17, 2013 at 14:31

Hello everyone. I am making Kitchen Clock on STM8S105C6 and STM8 touch sence library. I need 4 buttons and  i have configurate them as SCKEY. Now they works fine. My problem is that library catch only one button at once, i mean if you touch 2 buttons at same time library  gaves only one Detect flag for first of two buttons. But i need to enter in Time adjustment menu by pressing two buttons at once.     Can you give mi a suggest please.

#touch #stm8-tsl #stm8s-and-tsl #double
4 REPLIES 4
chen
Associate II
Posted on December 18, 2013 at 12:25

Hi

In the real world - it is very unlikely you will ever get both touch buttons pressed/sensed together. It is like real world push buttons - they never give you a clean off/on - you need to debounce them.

So for the touch sense, what does the STM8 touch sence library do when a second button is pressed when one is already pressed?

If the library does not return that another button is pressed - you need to modify the library so that it does.

If it does, Good.

Now your software has to look for a second button a short period (we are talking upto 50ms here) after the first.

Hint, if this only applies to one button, there is not need to do this code for all buttons.

dexter_khm
Associate II
Posted on December 18, 2013 at 15:36

Here is my variant i don't know is it looks fine but it is working.

if (sSCKeyInfo[2].Setting.b.DETECTED) /* KEY 3 touched */

    {

  GPIO_WriteReverse(LEDButtonPort, LED2Pin);// one button click

if (sSCKeyInfo[1].State.b.DETECTED)

{

GPIO_WriteReverse(LEDButtonPort, LED1Pin);// case of two button click

}

    }

if (sSCKeyInfo[1].Setting.b.DETECTED) /* KEY 4 touched */

{

GPIO_WriteReverse(LEDButtonPort, LED1Pin);// one button click

if (sSCKeyInfo[2].State.b.DETECTED)

{

GPIO_WriteReverse(LEDButtonPort, LED2Pin);// case of two button click

}

}
chen
Associate II
Posted on December 18, 2013 at 18:21

Hi

Good work. If it works - stick with it.

If there are problems - fix them.

kb_ipk
Associate
Posted on November 18, 2015 at 14:12

Unfortunately, this is not working.

If  first button is ''pressed'' -  second button not working.

Only individually.

Whether it is possible, using the  STM8S and TSL do this?