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.

MSP430FR2676: MSP430 Captivate - Multi-Touch & Touch-Hold support

Part Number: MSP430FR2676

I'm using an MSP430FR2676 on my project and I have two buttons available on my board. I would like to add a third functionality either by pressing and holding one of the buttons, or by detecting a multi-touch between the two buttons.

I recall seeing in the captivate design guide that Multi-Touch is supported, but I have not been able to find any more documentation on how to implement it.

I thought I saw something about built in touch-hold support, but now I'm not so sure as I cannot find any information about it.

I would greatly appreciate it if someone could point me in the right direction.

Thanks!

  • Hallo Nichlas,

    please check the Technology Guide, section "Access Element State Data" I think that is what you need.

    You can use one of the options for the implementation.

    e.g.         if((BTN00.pCycle[0]->pElements[0]->bTouch == true) && (BTN00.pCycle[0]->pElements[1]->bTouch == true))

    You can just add the application code right after the CAPT_appHandler();
    or a good way is to use callback function see here.

    Let me know if that helps

    Regards

    Kostas

  • Thanks, I tried that as you described, and I cannot trigger a multi touch event. it simply reads one button or the other, like I'm touching one slightly before the other. I also tried this with the same result:

    if((pSensor->bSensorTouch == true) && (pSensor->bSensorPrevTouch == false))
        {
            //touch detected
     
            if(BTN00.pCycle[0]->pElements[0]->bTouch == true){                          // if button 0 is pressed...
                __delay_cycles(100);                                                                 
                if(BTN00.pCycle[0]->pElements[1]->bTouch == false){                    // and button 1 isn't...
                    Update_MSR(MSR_UP_BTN, 1);                                                // ...up button Press
                } else if (BTN00.pCycle[0]->pElements[1]->bTouch == true){          // but if button 1 is pressed...
                    Update_MSR(MSR_TARE, 1);                                                    // …multi touch function
                }
            } else if(BTN00.pCycle[0]->pElements[1]->bTouch == true){              // if button 1 is pressed...
                __delay_cycles(100);
                if(BTN00.pCycle[0]->pElements[0]->bTouch == false){                  // and button 0 isn't...
                    Update_MSR(MSR_RGT_BTN, 1);                                            // ...right button press
                } else if (BTN00.pCycle[0]->pElements[0]->bTouch == true){        // but if button 0 is pressed...
                    Update_MSR(MSR_TARE, 1);                                                   // … multi touch function
                }
            }
  • Hallo Nichlas,

    right it can not work as you intended, because the following lines check for ANY touch on the sensor.

    if((pSensor->bSensorTouch == true) && (pSensor->bSensorPrevTouch == false))

    That means if a touch in any of the buttons of the sensor is detected and the previous scan was no touch, than in will go into the the loop and activate the LED based upon which button has been detected

    BTN00.pCycle[0]->pElements[0]->bTouch == true

    Try that one and let me know:

    	    if((BTN00.pCycle[0]->pElements[0]->bTouch == true) && (BTN00.pCycle[0]->pElements[1]->bTouch == true))
    	    {
    	        LED2_TOGGLE;    // toggle LED2  or just change to LED2_ON
    	        LED1_TOGGLE;    // toggle LED1
    	    }
    	    else if ((BTN00.pCycle[0]->pElements[0]->bTouch == true) && (BTN00.pCycle[0]->pElements[1]->bTouch == false))
    	    {
    	      LED2_OFF;
    	      LED1_ON;
    	    }
    	    else if ((BTN00.pCycle[0]->pElements[0]->bTouch == false) && (BTN00.pCycle[0]->pElements[1]->bTouch == true))
    	    {
    	          LED2_ON;
    	          LED1_OFF;
    	    }
    	    else
    	    {
                LED1_OFF;
                LED2_OFF;
    	    }
    
    

    Regards

    Kostas

  • Ok, it appears to be able to see a multi-touch state now, but I'm running into some pretty severe debounce issues. That's why I have the touch and previous touch statement above.

    Here is my callback function currently:

    void keypadCallback(tSensor* pSensor)
    {
            if ((BTN00.pCycle[0]->pElements[0]->bTouch == true) && (BTN00.pCycle[0]->pElements[1]->bTouch == false)){             // if up button is pressed...
                    Update_MSR(MSR_UP_BTN, 1);  
            } else if ((BTN00.pCycle[0]->pElements[1]->bTouch == true) && (BTN00.pCycle[0]->pElements[0]->bTouch == false)){   // if right button is pressed...
                    Update_MSR(MSR_RGT_BTN, 1);
            } else if ((BTN00.pCycle[0]->pElements[0]->bTouch == true) && (BTN00.pCycle[0]->pElements[1]->bTouch == true)){    // if both buttons are pressed...
                    Update_MSR(MSR_TARE, 1);
            }
            tWake_ON;               //set tWake pin high - 4000 should = 4msec but on scope double (8msec)
            __delay_cycles(10);     //waste some time - delay is based on MCLK which is 1Mhz by default (and for our design)
            tWake_OFF;              //set tWake pin low
    }
    Thank you for the help,
  • Hi,

    sorry to hear hat. Let's try to find a way to solve that.

    Can you send me the UserConfig.c and .h files?

    Have used the GUI to generate the code? any additional modification done on the settings?

    What is the issue you see.

    Thanks

    Regards

    Kostas

**Attention** This is a public forum