This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430FR2633: Is there any API for Finger release Event

Part Number: MSP430FR2633

hi,

the touch event is working, but every time when touch the sensor pad, it enter the callback function multi times for each touch,

this behavior is not allowable(it's like a button bounce), so I want to detect the finger release event, is there any API can do it?

(below is the callback function for what i mean above)

void my_keypad_callback(tSensor* pSensor)
{
    if(BTN00_E00.bTouch == true)
    {
        EUSCI_A_UART_transmitData(EUSCI_A0_BASE, 0x51);  // each press makes UART output 0x51 multi times
        VOL_UP_Press_Flag = TRUE;
        __no_operation();
    }

......................................................

  • Hi erik,

    The callback is called each time after the sensor has been scanned.

    It is possible to select a different action based on if the sensor is touched or not. For example here are few macros that I use for each of the 4 possible touch states.

    #define FIRST_TOUCH                     (pSensor->bSensorTouch == true) && (pSensor->bSensorPrevTouch == false)
    #define EXIT_TOUCH                      (pSensor->bSensorTouch == false) && (pSensor->bSensorPrevTouch == true)
    #define TOUCH                           (pSensor->bSensorTouch == true)
    #define NO_TOUCH                        (pSensor->bSensorTouch == false) && (pSensor->bSensorPrevTouch == false)

    Example how to use:

    void keypad_callback(tSensor* pSensor)
    {
        if (FIRST_TOUCH)
             funcA();
        else if (TOUCH)
             funcB();
        else if(EXIT_TOUCH)
             funcC();
        else if(NO_TOUCH)
              funcD();

    }
           

    Does this help?

  • Dennis,

    It works, but only "FIRST_TOUCH" & "TOUCH" has response, the "EXIT_TOUCH" and "NO_TOUCH" never active.

    picture below shows the free run behavior, actually, this is good enough to me, but if knowing why "EXIT_TOUCH" not works will be better, thank you.

  • Hi erik,

    Take a look at your logic.  You only process the "if" statements if your BTN00_E01.bTouch == true, so you will not process the EXIT_TOUCH or NO_TOUCH.  See below.

    Since it appears you have more than one element in your BTN00 sensor I'll assume this is a keypad.  In which case, typically only one button at a time is pressed. You us the state of the sensor (is it first touch?, is is touch? is it exit?, is it no touch?} then us the CAPT_getDominantButton(pSensor) function to determine which element or button it is and call the desired functions.

    For example:

    if(FIRST_SENSOR_TOUCH)
    {
        // first time determine which button is pressed
        ui8DominantButton = CAPT_getDominantButton(pSensor);
        
        // Now check if this is the button (E01)
        if(ui8DominantButton == 1)
            funcA();
    }
    else if(SENSOR_TOUCH)
    {
        if(ui8DominantButton == 1)
            funcB();
    }
    else if(EXIT_TOUCH)
    {
        if(ui8DominantButton == 1)
            funcC();
    }
    else if(NO_TOUCH)
    {
        funcD();
    }

  • Dennis,

    It's sorry for being sutpid of me, and thank you so much! 

**Attention** This is a public forum