You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2020/03/06 17:57:59 UTC

[GitHub] [mynewt-core] nkaje opened a new pull request #2231: Slinky use LEDs when available

nkaje opened a new pull request #2231: Slinky use LEDs when available
URL: https://github.com/apache/mynewt-core/pull/2231
 
 
   1. apps/slinky: use led when available
   2. slinky: enable console history

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] kasjer commented on a change in pull request #2231: Slinky: use LEDs when available

Posted by GitBox <gi...@apache.org>.
kasjer commented on a change in pull request #2231: Slinky: use LEDs when available
URL: https://github.com/apache/mynewt-core/pull/2231#discussion_r393499342
 
 

 ##########
 File path: apps/slinky/src/led.c
 ##########
 @@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+/* define LED routines if LED pins are defined for the target */
+#include <bsp/bsp.h>
+#ifdef LED_BLINK_PIN
+#include <stats/stats.h>
+#include <hal/hal_system.h>
+#include <hal/hal_gpio.h>
+#include <log/log.h>
+
+static int g_led_pin;
+
+STATS_SECT_START(gpio_stats)
+STATS_SECT_ENTRY(toggles)
+STATS_SECT_END
+
+static STATS_NAME_START(gpio_stats)
+STATS_NAME(gpio_stats, toggles)
+STATS_NAME_END(gpio_stats)
+
+static STATS_SECT_DECL(gpio_stats) g_stats_gpio_toggle;
+
+void
+init_led_stats()
 
 Review comment:
   missing void in ()

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] kasjer commented on a change in pull request #2231: Slinky: use LEDs when available

Posted by GitBox <gi...@apache.org>.
kasjer commented on a change in pull request #2231: Slinky: use LEDs when available
URL: https://github.com/apache/mynewt-core/pull/2231#discussion_r393499558
 
 

 ##########
 File path: apps/slinky/src/led.c
 ##########
 @@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+/* define LED routines if LED pins are defined for the target */
+#include <bsp/bsp.h>
+#ifdef LED_BLINK_PIN
+#include <stats/stats.h>
+#include <hal/hal_system.h>
+#include <hal/hal_gpio.h>
+#include <log/log.h>
+
+static int g_led_pin;
+
+STATS_SECT_START(gpio_stats)
+STATS_SECT_ENTRY(toggles)
+STATS_SECT_END
+
+static STATS_NAME_START(gpio_stats)
+STATS_NAME(gpio_stats, toggles)
+STATS_NAME_END(gpio_stats)
+
+static STATS_SECT_DECL(gpio_stats) g_stats_gpio_toggle;
+
+void
+init_led_stats()
+{
+    g_led_pin = LED_BLINK_PIN;
+    hal_gpio_init_out(g_led_pin, 1);
+
+    stats_init(STATS_HDR(g_stats_gpio_toggle),
+               STATS_SIZE_INIT_PARMS(g_stats_gpio_toggle, STATS_SIZE_32),
+               STATS_NAME_INIT_PARMS(gpio_stats));
+
+    stats_register("gpio_toggle", STATS_HDR(g_stats_gpio_toggle));
+}
+
+void
+toggle_led()
 
 Review comment:
   missing void in ()

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2231: Slinky: use LEDs when available

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on issue #2231: Slinky: use LEDs when available
URL: https://github.com/apache/mynewt-core/pull/2231#issuecomment-596499199
 
 
   
   <!-- style-bot -->
   
   ## Style check summary
   
   #### No suggestions at this time!
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] kasjer commented on a change in pull request #2231: Slinky: use LEDs when available

Posted by GitBox <gi...@apache.org>.
kasjer commented on a change in pull request #2231: Slinky: use LEDs when available
URL: https://github.com/apache/mynewt-core/pull/2231#discussion_r393504641
 
 

 ##########
 File path: apps/slinky/src/led.c
 ##########
 @@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+/* define LED routines if LED pins are defined for the target */
+#include <bsp/bsp.h>
+#ifdef LED_BLINK_PIN
+#include <stats/stats.h>
+#include <hal/hal_system.h>
+#include <hal/hal_gpio.h>
+#include <log/log.h>
+
+static int g_led_pin;
+
+STATS_SECT_START(gpio_stats)
+STATS_SECT_ENTRY(toggles)
+STATS_SECT_END
+
+static STATS_NAME_START(gpio_stats)
+STATS_NAME(gpio_stats, toggles)
+STATS_NAME_END(gpio_stats)
+
+static STATS_SECT_DECL(gpio_stats) g_stats_gpio_toggle;
+
+void
+init_led_stats()
+{
+    g_led_pin = LED_BLINK_PIN;
+    hal_gpio_init_out(g_led_pin, 1);
+
+    stats_init(STATS_HDR(g_stats_gpio_toggle),
+               STATS_SIZE_INIT_PARMS(g_stats_gpio_toggle, STATS_SIZE_32),
+               STATS_NAME_INIT_PARMS(gpio_stats));
+
+    stats_register("gpio_toggle", STATS_HDR(g_stats_gpio_toggle));
+}
+
+void
+toggle_led()
+{
+    static int prev_pin_state, curr_pin_state;
+
+    g_led_pin = LED_BLINK_PIN;
+    prev_pin_state = hal_gpio_read(g_led_pin);
+    curr_pin_state = hal_gpio_toggle(g_led_pin);
+    DFLT_LOG_INFO("GPIO toggle from %u to %u",
+                    prev_pin_state, curr_pin_state);
+    STATS_INC(g_stats_gpio_toggle, toggles);
+}
+
+#else
+void
+init_led_stats()
 
 Review comment:
    void missing in ()

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] kasjer commented on a change in pull request #2231: Slinky: use LEDs when available

Posted by GitBox <gi...@apache.org>.
kasjer commented on a change in pull request #2231: Slinky: use LEDs when available
URL: https://github.com/apache/mynewt-core/pull/2231#discussion_r393499936
 
 

 ##########
 File path: apps/slinky/src/led.c
 ##########
 @@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+/* define LED routines if LED pins are defined for the target */
+#include <bsp/bsp.h>
+#ifdef LED_BLINK_PIN
+#include <stats/stats.h>
+#include <hal/hal_system.h>
+#include <hal/hal_gpio.h>
+#include <log/log.h>
+
+static int g_led_pin;
+
+STATS_SECT_START(gpio_stats)
+STATS_SECT_ENTRY(toggles)
+STATS_SECT_END
+
+static STATS_NAME_START(gpio_stats)
+STATS_NAME(gpio_stats, toggles)
+STATS_NAME_END(gpio_stats)
+
+static STATS_SECT_DECL(gpio_stats) g_stats_gpio_toggle;
+
+void
+init_led_stats()
+{
+    g_led_pin = LED_BLINK_PIN;
+    hal_gpio_init_out(g_led_pin, 1);
+
+    stats_init(STATS_HDR(g_stats_gpio_toggle),
+               STATS_SIZE_INIT_PARMS(g_stats_gpio_toggle, STATS_SIZE_32),
+               STATS_NAME_INIT_PARMS(gpio_stats));
+
+    stats_register("gpio_toggle", STATS_HDR(g_stats_gpio_toggle));
+}
+
+void
+toggle_led()
+{
+    static int prev_pin_state, curr_pin_state;
+
+    g_led_pin = LED_BLINK_PIN;
+    prev_pin_state = hal_gpio_read(g_led_pin);
+    curr_pin_state = hal_gpio_toggle(g_led_pin);
+    DFLT_LOG_INFO("GPIO toggle from %u to %u",
+                    prev_pin_state, curr_pin_state);
+    STATS_INC(g_stats_gpio_toggle, toggles);
+}
+
+#else
+void
+init_led_stats()
+{
+    return;
 
 Review comment:
   return is not needed here

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on issue #2231: Slinky: use LEDs when available

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on issue #2231: Slinky: use LEDs when available
URL: https://github.com/apache/mynewt-core/pull/2231#issuecomment-595917004
 
 
   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### apps/slinky/src/led.c
   <details>
   
   ```diff
   @@ -38,7 +38,8 @@
    
    static STATS_SECT_DECL(gpio_stats) g_stats_gpio_toggle;
    
   -void init_led_stats()
   +void
   +init_led_stats()
    {
        g_led_pin = LED_BLINK_PIN;
        hal_gpio_init_out(g_led_pin, 1);
   @@ -50,7 +51,8 @@
        stats_register("gpio_toggle", STATS_HDR(g_stats_gpio_toggle));
    }
    
   -void toggle_led()
   +void
   +toggle_led()
    {
        static int prev_pin_state, curr_pin_state;
    
   @@ -63,13 +65,15 @@
    }
    
    #else
   -void init_led_stats()
   +void
   +init_led_stats()
    {
   -   return;
   +    return;
    }
    
   -void toggle_led()
   +void
   +toggle_led()
    {
   -   return;
   +    return;
    }
    #endif
   ```
   
   </details>

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] kasjer commented on a change in pull request #2231: Slinky: use LEDs when available

Posted by GitBox <gi...@apache.org>.
kasjer commented on a change in pull request #2231: Slinky: use LEDs when available
URL: https://github.com/apache/mynewt-core/pull/2231#discussion_r393508912
 
 

 ##########
 File path: apps/slinky/src/led.c
 ##########
 @@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+/* define LED routines if LED pins are defined for the target */
+#include <bsp/bsp.h>
+#ifdef LED_BLINK_PIN
+#include <stats/stats.h>
+#include <hal/hal_system.h>
+#include <hal/hal_gpio.h>
+#include <log/log.h>
+
+static int g_led_pin;
+
+STATS_SECT_START(gpio_stats)
+STATS_SECT_ENTRY(toggles)
+STATS_SECT_END
+
+static STATS_NAME_START(gpio_stats)
+STATS_NAME(gpio_stats, toggles)
+STATS_NAME_END(gpio_stats)
+
+static STATS_SECT_DECL(gpio_stats) g_stats_gpio_toggle;
+
+void
+init_led_stats()
+{
+    g_led_pin = LED_BLINK_PIN;
+    hal_gpio_init_out(g_led_pin, 1);
+
+    stats_init(STATS_HDR(g_stats_gpio_toggle),
+               STATS_SIZE_INIT_PARMS(g_stats_gpio_toggle, STATS_SIZE_32),
+               STATS_NAME_INIT_PARMS(gpio_stats));
+
+    stats_register("gpio_toggle", STATS_HDR(g_stats_gpio_toggle));
+}
+
+void
+toggle_led()
+{
+    static int prev_pin_state, curr_pin_state;
+
+    g_led_pin = LED_BLINK_PIN;
 
 Review comment:
   setting g_led_pin here does not seem needed here, it was already set in init_led_stats.
   In fact variable could be skipped altogether.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] kasjer commented on a change in pull request #2231: Slinky: use LEDs when available

Posted by GitBox <gi...@apache.org>.
kasjer commented on a change in pull request #2231: Slinky: use LEDs when available
URL: https://github.com/apache/mynewt-core/pull/2231#discussion_r393505309
 
 

 ##########
 File path: apps/slinky/src/led.c
 ##########
 @@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+/* define LED routines if LED pins are defined for the target */
+#include <bsp/bsp.h>
+#ifdef LED_BLINK_PIN
+#include <stats/stats.h>
+#include <hal/hal_system.h>
+#include <hal/hal_gpio.h>
+#include <log/log.h>
+
+static int g_led_pin;
+
+STATS_SECT_START(gpio_stats)
+STATS_SECT_ENTRY(toggles)
+STATS_SECT_END
+
+static STATS_NAME_START(gpio_stats)
+STATS_NAME(gpio_stats, toggles)
+STATS_NAME_END(gpio_stats)
+
+static STATS_SECT_DECL(gpio_stats) g_stats_gpio_toggle;
+
+void
+init_led_stats()
+{
+    g_led_pin = LED_BLINK_PIN;
+    hal_gpio_init_out(g_led_pin, 1);
+
+    stats_init(STATS_HDR(g_stats_gpio_toggle),
+               STATS_SIZE_INIT_PARMS(g_stats_gpio_toggle, STATS_SIZE_32),
+               STATS_NAME_INIT_PARMS(gpio_stats));
+
+    stats_register("gpio_toggle", STATS_HDR(g_stats_gpio_toggle));
+}
+
+void
+toggle_led()
+{
+    static int prev_pin_state, curr_pin_state;
 
 Review comment:
   static here does not add any value

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2231: Slinky: use LEDs when available

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on issue #2231: Slinky: use LEDs when available
URL: https://github.com/apache/mynewt-core/pull/2231#issuecomment-595917004
 
 
   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### apps/slinky/src/led.c
   <details>
   
   ```diff
   @@ -38,7 +38,8 @@
    
    static STATS_SECT_DECL(gpio_stats) g_stats_gpio_toggle;
    
   -void init_led_stats()
   +void
   +init_led_stats()
    {
        g_led_pin = LED_BLINK_PIN;
        hal_gpio_init_out(g_led_pin, 1);
   @@ -50,7 +51,8 @@
        stats_register("gpio_toggle", STATS_HDR(g_stats_gpio_toggle));
    }
    
   -void toggle_led()
   +void
   +toggle_led()
    {
        static int prev_pin_state, curr_pin_state;
    
   @@ -63,13 +65,15 @@
    }
    
    #else
   -void init_led_stats()
   +void
   +init_led_stats()
    {
   -   return;
   +    return;
    }
    
   -void toggle_led()
   +void
   +toggle_led()
    {
   -   return;
   +    return;
    }
    #endif
   ```
   
   </details>

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services