draw two point an uniline on lcd of stm32f429

hi all membres i want draw on the lcd of stm32f429Zit two point and after that i want draw a uniline between this two point i try with this code but i got only 1 point can anyone help me ?

void drawtwopoint()
{  TP_STATE* TP_State;

int i=0;
        int xx[2],yy[2] ;
  while (1)
  { TP_State = IOE_TP_GetState();
    if((!TP_State->TouchDetected) && ((TP_State->Y < 245) && (TP_State->Y >= 3)))
    {TP_State = IOE_TP_GetState();
      if((TP_State->X >= 237) || (TP_State->X < 3))
      {}
      else
      {
          while (i!=2)

          {
          xx[i]= TP_State->X;
        yy[i] = TP_State->Y;
        LCD_DrawFullCircle(xx[i] ,yy[i], 6);
                i=i+1;
        }
       LCD_DrawUniLine(xx[0] ,yy[0],xx[1],yy[1]);
         }
          }
    }
}

Parents
  • Of course you only get one point, when your while loop assigns the same coordinate to both index 0 and index 1 of the xx[] and yy[] array.

    Don't you think you should have two TP_State variables - one with the coordinate where you put started to touch the display, and one with the coordinate where you stopped touching the display? Or maybe consider how you use the "i" index?

    Debugging seldom hurts...

Reply
  • Of course you only get one point, when your while loop assigns the same coordinate to both index 0 and index 1 of the xx[] and yy[] array.

    Don't you think you should have two TP_State variables - one with the coordinate where you put started to touch the display, and one with the coordinate where you stopped touching the display? Or maybe consider how you use the "i" index?

    Debugging seldom hurts...

Children
More questions in this forum