BRT Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the Bridgetek Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ Bridgetek Support

Please refer to our website for detailed information on all our products - Bridgetek - Bridging Technology

Author Topic: matrix orbital eve2-70A TPR resistive touchscreen not working.  (Read 6839 times)

madhusudan.jadhav

  • Newbie
  • *
  • Posts: 15
    • View Profile
matrix orbital eve2-70A TPR resistive touchscreen not working.
« on: February 29, 2020, 06:32:32 AM »

Hi, I am using xmc4500 relaxkit with matrix orbital eve2-70A TPR. I am using library An014 for application. I am using standard full-duplex SPI mode. I run the calibrate app and then slider button the button app runs. but the touch runs only once. if i touch outside of button and then touch the button then button never runs. Also for the touch, I have to put calibrate function every time how to store the touch value permanently.
« Last Edit: March 04, 2020, 12:22:02 AM by madhusudan.jadhav »
Logged

madhusudan.jadhav

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: matrix orbital eve2-70A TPR resistive touchscreen not working.
« Reply #1 on: August 07, 2020, 08:45:33 AM »

Hi there,
I tried following code but then also touch isnot worknig.
void Calibrate_Manual(uint16_t Width, uint16_t Height, uint16_t V_Offset, uint16_t H_Offset)
{
  uint32_t displayX[3], displayY[3];
  uint32_t touchX[3], touchY[3];
  uint32_t touchValue = 0, storedValue = 0;
  int32_t tmp, k;
  int32_t TransMatrix[6];
  uint8_t count = 0;
  uint32_t count1=0;
  uint8_t pressed = 0;
  char num[2];

  // These values determine where your calibration points will be drawn on your display
  displayX[0] = (uint32_t) (Width * 0.15) + H_Offset;
  displayY[0] = (uint32_t) (Height * 0.15) + V_Offset;

  displayX[1] = (uint32_t) (Width * 0.85) + H_Offset;
  displayY[1] = (uint32_t) (Height / 2) + V_Offset;

  displayX[2] = (uint32_t) (Width / 2) + H_Offset;
  displayY[2] = (uint32_t) (Height * 0.85) + V_Offset;

 while (count < 3)
 {   //  count =1;
     API_LIB_BeginCoProList();
     API_CMD_DLSTART();
     API_CLEAR_COLOR_RGB(0, 0, 0);
     API_CLEAR(1,1,1);

    // Draw Calibration Point on screen
    API_COLOR_RGB(255, 0, 0);
    API_POINT_SIZE(20 * 16);
    API_BEGIN(FTPOINTS);
    API_VERTEX2F((uint32_t)(displayX[count]) * 16, (uint32_t)((displayY[count])) * 16);
    //API_END();
    API_COLOR_RGB(255, 255, 255);
    API_CMD_TEXT((Width / 2) + H_Offset, (Height / 3) + V_Offset, 27, OPT_CENTER, "Calibrating");
    API_CMD_TEXT((Width / 2) + H_Offset, (Height / 2) + V_Offset, 27, OPT_CENTER, "Please tap the dots");
    num[0] = count + 0x31; num[1] = 0;                                            // null terminated string of one character
    API_CMD_TEXT(displayX[count], displayY[count], 27, OPT_CENTER, num);
      API_END();
    API_DISPLAY();                                                          // Tell EVE that this is end of list
            API_CMD_SWAP();
            API_LIB_EndCoProList();                                                             // Trigger the CoProcessor to start processing commands out of the FIFO
    API_LIB_AwaitCoProEmpty();  // wait here until the coprocessor has read and executed every pending command.
 // APP_Calibrate();
  //count++;
    MCU_Delay_500ms();

   while (pressed == count )
   {
      touchValue =EVE_MemRead32(REG_TOUCH_TAG_XY );  // Read for any new touch tag inputs
   //   SEGGER_RTT_printf(0, "%d\r\n", RTT_CTRL_BG_BRIGHT_RED,touchValue);
      if ((touchValue & 0x8000000)==0)
      {
         touchX[count] = (touchValue >> 16) & 0x03FF;                                  // Raw Touchscreen Y coordinate
         touchY[count] = touchValue & 0x03FF;                                        // Raw Touchscreen Y coordinate

                                                                  //Log("\ndisplay x[%d]: %ld display y[%d]: %ld\n", count, displayX[count], count, displayY[count]);
                                                                  //Log("touch x[%d]: %ld touch y[%d]: %ld\n", count, touchX[count], count, touchY[count]);

         count++;
      }
   }
   pressed = count;

 }

  k = ((touchX[0] - touchX[2])*(touchY[1] - touchY[2])) - ((touchX[1] - touchX[2])*(touchY[0] - touchY[2]));

  tmp = (((displayX[0] - displayX[2]) * (touchY[1] - touchY[2])) - ((displayX[1] - displayX[2])*(touchY[0] - touchY[2])));
  TransMatrix[0] = ((int64_t)tmp << 16) / k;

  tmp = (((touchX[0] - touchX[2]) * (displayX[1] - displayX[2])) - ((displayX[0] - displayX[2])*(touchX[1] - touchX[2])));
  TransMatrix[1] = ((int64_t)tmp << 16) / k;

  tmp = ((touchY[0] * (((touchX[2] * displayX[1]) - (touchX[1] * displayX[2])))) + (touchY[1] * (((touchX[0] * displayX[2]) - (touchX[2] * displayX[0])))) + (touchY[2] * (((touchX[1] * displayX[0]) - (touchX[0] * displayX[1])))));
  TransMatrix[2] = ((int64_t)tmp << 16) / k;

  tmp = (((displayY[0] - displayY[2]) * (touchY[1] - touchY[2])) - ((displayY[1] - displayY[2])*(touchY[0] - touchY[2])));
  TransMatrix[3] = ((int64_t)tmp << 16) / k;

  tmp = (((touchX[0] - touchX[2]) * (displayY[1] - displayY[2])) - ((displayY[0] - displayY[2])*(touchX[1] - touchX[2])));
  TransMatrix[4] = ((int64_t)tmp << 16) / k;

  tmp = ((touchY[0] * (((touchX[2] * displayY[1]) - (touchX[1] * displayY[2])))) + (touchY[1] * (((touchX[0] * displayY[2]) - (touchX[2] * displayY[0])))) + (touchY[2] * (((touchX[1] * displayY[0]) - (touchX[0] * displayY[1])))));
  TransMatrix[5] = ((int64_t)tmp << 16) / k;

  count = 0;
  do
  {
     EVE_MemWrite32(REG_TOUCH_TRANSFORM_A + RAM_REG + (count * 4), TransMatrix[count]);  // Write to Eve config registers

    uint16_t ValH = TransMatrix[count] >> 16;
   uint16_t ValL = TransMatrix[count] & 0xFFFF;
   //("TM%d: 0x%04x %04x\n", count, ValH, ValL);
   SEGGER_RTT_printf(0, "%d\r\n", RTT_CTRL_BG_BRIGHT_RED,ValL);
   SEGGER_RTT_printf(0, "%d\r\n", RTT_CTRL_BG_BRIGHT_BLUE,ValH);
    count++;
  }while(count < 6);
//count1=  EVE_MemRead32(REG_TOUCH_TRANSFORM_A);
//SEGGER_RTT_printf(0, "%d\r\n", RTT_CTRL_BG_BRIGHT_RED,ValL);
}
Logged