Loading ...
Sorry, an error occurred while loading the content.
 

Patch: LED revised patch for ZKit-ARM-1769

Expand Messages
  • rashid fatah
    Hi, This patch based on lincoln60 board allows the control of an LED through an application program. Thanks. -Raaashid
    Message 1 of 6 , Sep 22, 2013
      Hi,

      This patch based on lincoln60 board allows the control of an LED through an application program.
      Thanks.

      -Raaashid
    • spudarnia
      Hi, Rashid, The changes have been review and checked-in. Thanks! Greg --- In nuttx@yahoogroups.com, wrote: Hi, This patch based on
      Message 2 of 6 , Sep 23, 2013
        Hi, Rashid,

        The changes have been review and checked-in.  Thanks!

        Greg

         



        --- In nuttx@yahoogroups.com, <nuttx@yahoogroups.com> wrote:

        Hi,

        This patch based on lincoln60 board allows the control of an LED through an application program.
        Thanks.

        -Raaashid
      • rashid_1687
        Hi Greg, I m unable to control the led with lpc17_gpiowrite(ZKITARM_LED1, state). But works with lpc17_gpiowrite(lednum, state). I don t exactly understand why
        Message 3 of 6 , Sep 25, 2013

          Hi Greg,


          I'm unable to control the led with lpc17_gpiowrite(ZKITARM_LED1, state). But works with lpc17_gpiowrite(lednum, state).  I don't exactly understand why lpc17_gpiowrite(ZKITARM_LED1, state) doesn't work. Probably some compiler issues.


          Can you please make the following changes in up_leds.c?


           void lpc17_led(int lednum, int state)                              
           {                                                                  
          -  lpc17_gpiowrite(ZKITARM_LED1, state);  

          + lpc17_gpiowrite(lednum, state);                            
           } 


          Thanks.


          Regards,

          Raashid



          ---In nuttx@yahoogroups.com, <spudarnia@...> wrote:

          Hi, Rashid,

          The changes have been review and checked-in.  Thanks!

          Greg

           



          --- In nuttx@yahoogroups.com, <nuttx@yahoogroups.com> wrote:

          Hi,

          This patch based on lincoln60 board allows the control of an LED through an application program.
          Thanks.

          -Raaashid
        • Gregory Nutt
          Hi, Rashid, ... Certainly, I can.  And I did.  The change is in GIT now. However, your change does not make any since to me.  The way that the LED control
          Message 4 of 6 , Sep 25, 2013
            Hi, Rashid,


            > I'm unable to control the led with lpc17_gpiowrite(ZKITARM_LED1, state). But works with lpc17_gpiowrite(lednum, state).  I don't exactly understand why lpc17_gpiowrite(ZKITARM_LED1, state) doesn't work. Probably some compiler issues.
            >
            > Can you please make the following changes in up_leds.c?
            >
            >  void lpc17_led(int lednum, int state)                              
            >  {                                                                  
            > -  lpc17_gpiowrite(ZKITARM_LED1, state);  
            >
            > + lpc17_gpiowrite(lednum, state);                            
            > }


            Certainly, I can.  And I did.  The change is in GIT now.

            However, your change does not make any since to me.  The way that the LED control functions work is that you should pass one of the defined LED values in your include/board.h header file:

            #define BOARD_LED1                0
            #define BOARD_LED2                1


            The lpc17_gpiowrite() function know nothing about those LED numbers.  It expects the first argument to be a bit encoded configuration set like:

            #define ZKITARM_LED1 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN19)
            #define ZKITARM_LED2 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN21)


            So I have no idea what you are doing.  Perhaps you are calling lpc17_write in a non-standard way?

            Greg
          • rashid_1687
            Hi Greg, The problem was actually lpc17_led() function was being used in up_leds.c by other functions resulting in conflicts. So whenever
            Message 5 of 6 , Sep 26, 2013

              Hi Greg,


              The problem was actually lpc17_led() function was being used in up_leds.c by other functions resulting in conflicts. So whenever lpc17_led(ZKITARM_LED2, true) was called, LED1 would ON. Changing all instances of lpc17_led() to lpc17_gpiowrite() resolved the issue.  


              Now your first suggestion itself worked fine. Thanks for your support. Here is the diff:


                       }
               
              -      lpc17_led(ZKITARM_LED1, led1);
              -      lpc17_led(ZKITARM_LED2, led2);
              +      lpc17_gpiowrite(ZKITARM_LED1, led1);
              +      lpc17_gpiowrite(ZKITARM_LED2, led2);
                   }
               
                 /* We will always control the HB LED */
              @@ -187,7 +187,7 @@ void up_ledoff(int led)
               
                 if (g_nestcount <= 1)
                   {
              -      lpc17_led(ZKITARM_LED2, true);
              +      lpc17_gpiowrite(ZKITARM_LED2, true);
                     g_nestcount = 0;
                   }
                 else
              @@ -206,7 +206,7 @@ void up_ledoff(int led)
               
               void lpc17_led(int lednum, int state)
               {
              -  lpc17_gpiowrite(lednum, state);
              +  lpc17_gpiowrite(ZKITARM_LED1, state);
               }


              Attached diff.

              Regards,

              -Raashid




              ---In nuttx@yahoogroups.com, <spudarnia@...> wrote:

              Hi, Rashid,


              > I'm unable to control the led with lpc17_gpiowrite(ZKITARM_LED1, state). But works with lpc17_gpiowrite(lednum, state).  I don't exactly understand why lpc17_gpiowrite(ZKITARM_LED1, state) doesn't work. Probably some compiler issues.
              >
              > Can you please make the following changes in up_leds.c?
              >
              >  void lpc17_led(int lednum, int state)                              
              >  {                                                                  
              > -  lpc17_gpiowrite(ZKITARM_LED1, state);  
              >
              > + lpc17_gpiowrite(lednum, state);                            
              > }


              Certainly, I can.  And I did.  The change is in GIT now.

              However, your change does not make any since to me.  The way that the LED control functions work is that you should pass one of the defined LED values in your include/board.h header file:

              #define BOARD_LED1                0
              #define BOARD_LED2                1


              The lpc17_gpiowrite() function know nothing about those LED numbers.  It expects the first argument to be a bit encoded configuration set like:

              #define ZKITARM_LED1 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN19)
              #define ZKITARM_LED2 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN21)


              So I have no idea what you are doing.  Perhaps you are calling lpc17_write in a non-standard way?

              Greg

               



              ---In nuttx@yahoogroups.com, <spudarnia@...> wrote:

              Hi, Rashid,


              > I'm unable to control the led with lpc17_gpiowrite(ZKITARM_LED1, state). But works with lpc17_gpiowrite(lednum, state).  I don't exactly understand why lpc17_gpiowrite(ZKITARM_LED1, state) doesn't work. Probably some compiler issues.
              >
              > Can you please make the following changes in up_leds.c?
              >
              >  void lpc17_led(int lednum, int state)                              
              >  {                                                                  
              > -  lpc17_gpiowrite(ZKITARM_LED1, state);  
              >
              > + lpc17_gpiowrite(lednum, state);                            
              > }


              Certainly, I can.  And I did.  The change is in GIT now.

              However, your change does not make any since to me.  The way that the LED control functions work is that you should pass one of the defined LED values in your include/board.h header file:

              #define BOARD_LED1                0
              #define BOARD_LED2                1


              The lpc17_gpiowrite() function know nothing about those LED numbers.  It expects the first argument to be a bit encoded configuration set like:

              #define ZKITARM_LED1 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN19)
              #define ZKITARM_LED2 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN21)


              So I have no idea what you are doing.  Perhaps you are calling lpc17_write in a non-standard way?

              Greg

               



              ---In nuttx@yahoogroups.com, <spudarnia@...> wrote:

              Hi, Rashid,


              > I'm unable to control the led with lpc17_gpiowrite(ZKITARM_LED1, state). But works with lpc17_gpiowrite(lednum, state).  I don't exactly understand why lpc17_gpiowrite(ZKITARM_LED1, state) doesn't work. Probably some compiler issues.
              >
              > Can you please make the following changes in up_leds.c?
              >
              >  void lpc17_led(int lednum, int state)                              
              >  {                                                                  
              > -  lpc17_gpiowrite(ZKITARM_LED1, state);  
              >
              > + lpc17_gpiowrite(lednum, state);                            
              > }


              Certainly, I can.  And I did.  The change is in GIT now.

              However, your change does not make any since to me.  The way that the LED control functions work is that you should pass one of the defined LED values in your include/board.h header file:

              #define BOARD_LED1                0
              #define BOARD_LED2                1


              The lpc17_gpiowrite() function know nothing about those LED numbers.  It expects the first argument to be a bit encoded configuration set like:

              #define ZKITARM_LED1 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN19)
              #define ZKITARM_LED2 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN21)


              So I have no idea what you are doing.  Perhaps you are calling lpc17_write in a non-standard way?

              Greg
            • Gregory Nutt
              Hi, Rashid, ... That makes more sense.  Thanks.  I have checked the changes into GIT. Greg
              Message 6 of 6 , Sep 26, 2013
                Hi, Rashid,


                > The
                > problem was actually lpc17_led() function was being used in up_leds.c
                > by other functions resulting in conflicts. So whenever
                > lpc17_led(ZKITARM_LED2, true) was called, LED1 would ON. Changing all
                > instances of lpc17_led() to lpc17_gpiowrite() resolved the issue.  
                >
                > Now your first suggestion itself worked fine. Thanks for your support. Here is the diff:
                ... [snip]...

                > Attached diff.
                That makes more sense.  Thanks.  I have checked the changes into GIT.

                Greg
              Your message has been successfully submitted and would be delivered to recipients shortly.