cancel
Showing results for 
Search instead for 
Did you mean: 

is there a way to make a button click and double click?

hande
Associate II

I tried to make it use timers and counters but it didn't work well. please help

4 REPLIES 4
T J
Lead

use a timer interrupt to give a timebase or

I use the Systick,

just add something like this:

mSint = true;

in your foreground process;

if( mSint){

msint = false;

process_key_Detect();

}

here is a rough debouncer.

processKeyDetect(){
if (keydown)
{
 down ++
 up = 0;
}
 
if (keyup)
{
 up ++
 down = 0;
}
if(up >20) we have key release;  up =0;
if(down >20) we have keypress; down =0;
 
}

hande
Associate II

sorry,

I still don't understand. i use stm32cubemx, true studio and hal library.

T J
Lead

Yes, I use the Cube and Hal too..

I think you need to do some more examples..

hande
Associate II

thank you, maybe there are video suggestions or tutorial blogs that are like this case