<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>draw two point an uniline   on lcd of stm32f429</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/33450/draw-two-point-an-uniline-on-lcd-of-stm32f429</link><description> 
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</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: draw two point an uniline   on lcd of stm32f429</title><link>https://community.arm.com/thread/151598?ContentTypeID=1</link><pubDate>Wed, 22 Jul 2015 11:14:14 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:abae4b78-f8e8-4452-9b83-9f700c3ead6f</guid><dc:creator>edPer Westermark</dc:creator><description>&lt;p&gt;&lt;pre&gt;
int i=0;
int xx[2],yy[2];

while (i!=2) {
    TP_State = IOE_TP_GetState();

    if (TP_State-&amp;gt;TouchDetected) {
        xx[i]=TP_State-&amp;gt;X;
        yy[i]=TP_State-&amp;gt;Y;
        if ((TP_State-&amp;gt;X &amp;gt;= 237) || (TP_State-&amp;gt;X &amp;lt; 3)) {
        } else {
            LCD_DrawFullCircle(TP_State-&amp;gt;X, TP_State-&amp;gt;Y ,6);
            i=i+1;
        }
    }
    if (!TP_State-&amp;gt;TouchDetected)     &amp;lt;=== what use is this for?
        continue;
}
LCD_DrawUniLine(xx[0],yy[0],xx[1],yy[1]);
&lt;/pre&gt;

&lt;p&gt;
Notice that the part with the continue doesn&amp;#39;t do anything -
remove the two lines and the while statement will still repeat.&lt;/p&gt;

&lt;p&gt;
And why do you have your &amp;quot;negated&amp;quot; logic where the if statement
leads to a dummy empty block with the real code in the else
block?&lt;br /&gt;
Why check if x is too close to the border - why not instead if x is
&lt;b&gt;not&lt;/b&gt; too close to the border? Then the if block will do the job
and no else part will be needed.&lt;br /&gt;
If the goal is to test &amp;quot;should I draw&amp;quot;, then it&amp;#39;s obviously better to
test for that, instead of testing for &amp;quot;should I not draw&amp;quot;...&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: draw two point an uniline   on lcd of stm32f429</title><link>https://community.arm.com/thread/150909?ContentTypeID=1</link><pubDate>Wed, 22 Jul 2015 05:58:45 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7d23fc60-95e1-4108-813e-c563cca5d225</guid><dc:creator>helven kalin</dc:creator><description>&lt;p&gt;&lt;p&gt;
it is ok i will share the code to all membres&lt;/p&gt;

&lt;pre&gt;
int i=0;
  int xx[2],yy[2] ;
  while(i!=2)
  {

    TP_State = IOE_TP_GetState();

    if(TP_State-&amp;gt;TouchDetected)
    {  xx[i]=TP_State-&amp;gt;X;
            yy[i]=TP_State-&amp;gt;Y;
      if((TP_State-&amp;gt;X &amp;gt;= 237) || (TP_State-&amp;gt;X &amp;lt; 3))
      {}
      else
      {

        LCD_DrawFullCircle( TP_State-&amp;gt;X, TP_State-&amp;gt;Y ,6);
                         i=i+1;


         }
         }
                 if  (!TP_State-&amp;gt;TouchDetected)
           continue;



  }
   LCD_DrawUniLine( xx[0],yy[0] ,xx[1],yy[1]);


&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: draw two point an uniline   on lcd of stm32f429</title><link>https://community.arm.com/thread/150903?ContentTypeID=1</link><pubDate>Wed, 22 Jul 2015 05:47:41 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:19fc4f39-5e60-4e6e-9752-31c3132905ff</guid><dc:creator>edPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
So you still haven&amp;#39;t figured out how you can use variables to
store a coordinate pair while you wait for a second coordinate pair?
So that when you get that second coordinate pair you now have access
to two coordinate pairs and then have the ability to draw a line
between (x0,y0) and (x1,y1)?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: draw two point an uniline   on lcd of stm32f429</title><link>https://community.arm.com/thread/150442?ContentTypeID=1</link><pubDate>Wed, 22 Jul 2015 05:24:06 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c01fd685-079e-4914-b208-4ed38f11e91e</guid><dc:creator>helven kalin</dc:creator><description>&lt;p&gt;&lt;p&gt;
ok i ptut my mind and my eyes and my hair also this code work and
i get two different point but i want get the uniline between the two
point can u help me only in this step&lt;/p&gt;

&lt;pre&gt;
int i=0;
while(i!=2)
 {
        TP_State = IOE_TP_GetState();
   if(TP_State-&amp;gt;TouchDetected)

  {
       if((TP_State-&amp;gt;X &amp;gt;= 237) || (TP_State-&amp;gt;X &amp;lt; 3))

             {}

         else
     {
          LCD_DrawFullCircle( TP_State-&amp;gt;X, TP_State-&amp;gt;Y ,6);
         i=i+1;

 }
         }

if  (!TP_State-&amp;gt;TouchDetected)                continue;

}
&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: draw two point an uniline   on lcd of stm32f429</title><link>https://community.arm.com/thread/150031?ContentTypeID=1</link><pubDate>Wed, 22 Jul 2015 00:22:01 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:83dd18f0-1a54-4622-91b7-5af4f0e29bf1</guid><dc:creator>edPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
&amp;quot;Put your heart, mind, and soul into even your smallest acts. This
is the secret of success.&amp;quot;&lt;/p&gt;

&lt;p&gt;
Swami Sivananda&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: draw two point an uniline   on lcd of stm32f429</title><link>https://community.arm.com/thread/149543?ContentTypeID=1</link><pubDate>Tue, 21 Jul 2015 14:01:59 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:0930b3ea-0baf-49ca-87e1-8b82a408a738</guid><dc:creator>Westonsupermare Pier</dc:creator><description>&lt;p&gt;&lt;p&gt;
Why not buffer each touch as you get it. And then plot a line
between the last and current points?&lt;/p&gt;

&lt;p&gt;
Please try to use whole words, you&amp;#39;re not texting and there&amp;#39;s not
a per letter charge.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: draw two point an uniline   on lcd of stm32f429</title><link>https://community.arm.com/thread/137258?ContentTypeID=1</link><pubDate>Tue, 21 Jul 2015 13:00:17 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:34f85e47-4f0a-4a19-b00f-52ca1623f272</guid><dc:creator>helven kalin</dc:creator><description>&lt;p&gt;&lt;p&gt;
i only ask u the code of this two step&lt;br /&gt;
- then run a loop while you wait for touch no longer detected - use
the new coordinate as second coordinate and draw&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: draw two point an uniline   on lcd of stm32f429</title><link>https://community.arm.com/thread/128985?ContentTypeID=1</link><pubDate>Tue, 21 Jul 2015 11:34:54 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:81d5e68f-354b-4a40-85de-ff1af0b29466</guid><dc:creator>edPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Does it matter if &lt;i&gt;&lt;b&gt;I&lt;/b&gt;&lt;/i&gt; can write the code, when it&amp;#39;s
your task? You ask for help with your shoelaces too?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: draw two point an uniline   on lcd of stm32f429</title><link>https://community.arm.com/thread/117823?ContentTypeID=1</link><pubDate>Tue, 21 Jul 2015 11:05:34 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:bb4a17a4-a58b-4918-a974-747e8ca372cb</guid><dc:creator>helven kalin</dc:creator><description>&lt;p&gt;&lt;p&gt;
ok can u write the code for the second point plz&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: draw two point an uniline   on lcd of stm32f429</title><link>https://community.arm.com/thread/108340?ContentTypeID=1</link><pubDate>Tue, 21 Jul 2015 06:45:19 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:b0867659-2020-4c44-9db8-9cba3b546daa</guid><dc:creator>edPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Haven&amp;#39;t you spent some time thinking about this before you started
to code?&lt;/p&gt;

&lt;p&gt;
All you need is to use two different coordinates when you
draw.&lt;/p&gt;

&lt;p&gt;
So how do you get two different coordinates?&lt;/p&gt;

&lt;p&gt;
The simmplest way would be to&lt;br /&gt;
- get one coordinate from IOE_TP_GetState() when you see
&amp;quot;TouchDetected&amp;quot;.&lt;br /&gt;
- then continue to call IOE_TP_GetState() until you no longer see
TouchDetected.&lt;/p&gt;

&lt;p&gt;
That&amp;#39;s quite similar to tracking a mouse - getting the first
coordinate of the mouse when a mouse button is pressed and getting
the second coordinate when the mouse button is released.&lt;/p&gt;

&lt;p&gt;
You get a line from the point where you started touch to the point
where you removed the finger.&lt;/p&gt;

&lt;p&gt;
Or if you want to fill lots of lines on your display:&lt;br /&gt;
- get the first coordinate directly you see TouchDetected.&lt;br /&gt;
- then run a loop while you wait for touch no longer detected&lt;br /&gt;
- use the new coordinate as second coordinate and draw&lt;/p&gt;

&lt;p&gt;
You create a &amp;quot;star&amp;quot; of multiple lines from the original touch
point)&lt;/p&gt;

&lt;p&gt;
or&lt;br /&gt;
- get the first coordinate directly you see TouchDetected&lt;br /&gt;
- then run a loop where you get new coordinates as long as
TouchDetected.&lt;br /&gt;
- draw from coordinate 1 to coordinate 2&lt;br /&gt;
- copy coordinate 2 to coordinate 1&lt;br /&gt;
- repeat getting new coordinate 2 while touch detected&lt;/p&gt;

&lt;p&gt;
You get a long trace of multiple line segments as the drawn line
segments &amp;quot;hunts&amp;quot; you finger.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: draw two point an uniline   on lcd of stm32f429</title><link>https://community.arm.com/thread/82705?ContentTypeID=1</link><pubDate>Tue, 21 Jul 2015 06:28:58 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f344367e-2994-4b18-a855-9abc9de320bf</guid><dc:creator>helven kalin</dc:creator><description>&lt;p&gt;&lt;p&gt;
first thank u second how can i get two different point on the lcd
can u help me&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: draw two point an uniline   on lcd of stm32f429</title><link>https://community.arm.com/thread/69291?ContentTypeID=1</link><pubDate>Tue, 21 Jul 2015 05:42:03 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:714acb3d-1892-4857-aae1-5594d95c5153</guid><dc:creator>edPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
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.&lt;/p&gt;

&lt;p&gt;
Don&amp;#39;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 &amp;quot;i&amp;quot; index?&lt;/p&gt;

&lt;p&gt;
Debugging seldom hurts...&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>