You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/06/12 12:32:42 UTC

[GitHub] [incubator-nuttx] mlyszczek opened a new pull request, #6413: Stm32wl5 exti

mlyszczek opened a new pull request, #6413:
URL: https://github.com/apache/incubator-nuttx/pull/6413

   ## Summary
   These patches add
   - support for GPIO EXTI for stm32wl5 chip.
   - support for buttons in nucleo board.
   
   - Please, also read commit message for each commit for explanations.
   
   ## Impact
   No, it's a new code
   
   ## Testing
   Compilation + working leds and buttons examples.
   
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6413: stm32wl5: add gpio exti support

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6413:
URL: https://github.com/apache/incubator-nuttx/pull/6413#discussion_r895328006


##########
arch/arm/src/stm32wl5/stm32wl5_exti_gpio.c:
##########
@@ -121,9 +253,60 @@ static int stm32wl5_exti0_15_isr(int irq, void *context, FAR void *arg)
 int stm32wl5_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
                          bool event, xcpt_t func, void *arg)
 {
+  struct gpio_callback_s *shared_cbs;
   uint32_t pin = pinset & GPIO_PIN_MASK;
-  uint32_t exti = 1 << pin;
-  int      irq = STM32WL5_IRQ_EXTI0 + pin;
+  uint32_t exti = (1 << pin);

Review Comment:
   Minor
   
   ```suggestion
     uint32_t exti = 1 << pin;
   ```
   



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] mlyszczek commented on a diff in pull request #6413: stm32wl5: add gpio exti support

Posted by GitBox <gi...@apache.org>.
mlyszczek commented on code in PR #6413:
URL: https://github.com/apache/incubator-nuttx/pull/6413#discussion_r895404698


##########
arch/arm/src/stm32wl5/stm32wl5_exti_gpio.c:
##########
@@ -121,9 +253,60 @@ static int stm32wl5_exti0_15_isr(int irq, void *context, FAR void *arg)
 int stm32wl5_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
                          bool event, xcpt_t func, void *arg)
 {
+  struct gpio_callback_s *shared_cbs;
   uint32_t pin = pinset & GPIO_PIN_MASK;
-  uint32_t exti = 1 << pin;
-  int      irq = STM32WL5_IRQ_EXTI0 + pin;
+  uint32_t exti = (1 << pin);

Review Comment:
   Minor or no minor, if we leave these minor stylish things in code, it will look inconsistent like it came from a big corporation:)



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #6413: stm32wl5: add gpio exti support

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged PR #6413:
URL: https://github.com/apache/incubator-nuttx/pull/6413


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] mlyszczek commented on a diff in pull request #6413: stm32wl5: add gpio exti support

Posted by GitBox <gi...@apache.org>.
mlyszczek commented on code in PR #6413:
URL: https://github.com/apache/incubator-nuttx/pull/6413#discussion_r895377305


##########
arch/arm/src/stm32wl5/stm32wl5_exti_gpio.c:
##########
@@ -121,9 +253,60 @@ static int stm32wl5_exti0_15_isr(int irq, void *context, FAR void *arg)
 int stm32wl5_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
                          bool event, xcpt_t func, void *arg)
 {
+  struct gpio_callback_s *shared_cbs;
   uint32_t pin = pinset & GPIO_PIN_MASK;
-  uint32_t exti = 1 << pin;
-  int      irq = STM32WL5_IRQ_EXTI0 + pin;
+  uint32_t exti = (1 << pin);

Review Comment:
   Ahh, right, I've changed the another "1 << pin" to "(1 << pin)" instead the other way around xD



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] mlyszczek commented on pull request #6413: stm32wl5: add gpio exti support

Posted by GitBox <gi...@apache.org>.
mlyszczek commented on PR #6413:
URL: https://github.com/apache/incubator-nuttx/pull/6413#issuecomment-1153271192

   Thanks for the review Petro, and your keen eye:) All issues should be fixed now.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6413: stm32wl5: add gpio exti support

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6413:
URL: https://github.com/apache/incubator-nuttx/pull/6413#discussion_r895217928


##########
arch/arm/src/stm32wl5/hardware/stm32wl5_exti.h:
##########
@@ -103,4 +108,84 @@
 #define EXTI2_RADIOBSY     (1 << 14)  /* EXTI line 45: Radio busy wakeup */
 #define EXTI2_CDBGPWRUPREQ (1 << 15)  /* EXTI line 46: Debug power-up request wakup */
 
+/* Rising Trigger selection register */
+
+#define EXTI_RTSR1_BIT(n)  (1 << n)   /* 1=Rising trigger enabled (for Event and Interrupt) for input line */

Review Comment:
   ```suggestion
   #define EXTI_RTSR1_BIT(n)  (1 << (n))   /* 1=Rising trigger enabled (for Event and Interrupt) for input line */
   ```
   here and similar palces



##########
arch/arm/src/stm32wl5/stm32wl5_exti_gpio.c:
##########
@@ -62,35 +61,168 @@ static struct gpio_callback_s g_gpio_handlers[16];
  ****************************************************************************/
 
 /****************************************************************************
- * Interrupt Service Routine - Dispatcher
+ * Interrupt Service Routines - Dispatchers
  ****************************************************************************/
 
-static int stm32wl5_exti0_15_isr(int irq, void *context, FAR void *arg)
+static int stm32wl5_exti0_isr(int irq, void *context, void *arg)
 {
   int ret = OK;
-  int exti;
-  (void)arg;
 
-  exti = irq - STM32WL5_IRQ_EXTI0;
-  DEBUGASSERT((exti >= 0) && (exti <= 15));
+  /* Clear the pending interrupt */
 
-  /* Clear the pending interrupt for both rising and falling edges. */
+  putreg32(0x0001, STM32WL5_EXTI_PR1);
 
-  putreg32(0x0001 << exti, STM32WL5_EXTI_PR1);
+  /* And dispatch the interrupt to the handler */
+
+  if (g_gpio_handlers[0].callback != NULL)
+    {
+      xcpt_t callback = g_gpio_handlers[0].callback;
+      void  *cbarg    = g_gpio_handlers[0].arg;
+
+      ret = callback(irq, context, cbarg);
+    }
+
+  return ret;
+}
+
+static int stm32wl5_exti1_isr(int irq, void *context, void *arg)
+{
+  int ret = OK;
+
+  /* Clear the pending interrupt */
+
+  putreg32(0x0002, STM32WL5_EXTI_PR1);
 
   /* And dispatch the interrupt to the handler */
 
-  if (g_gpio_handlers[exti].callback != NULL)
+  if (g_gpio_handlers[1].callback != NULL)
     {
-      xcpt_t callback = g_gpio_handlers[exti].callback;
-      void  *cbarg    = g_gpio_handlers[exti].arg;
+      xcpt_t callback = g_gpio_handlers[1].callback;
+      void  *cbarg    = g_gpio_handlers[1].arg;
 
       ret = callback(irq, context, cbarg);
     }
 
   return ret;
 }
 
+static int stm32wl5_exti2_isr(int irq, void *context, void *arg)
+{
+  int ret = OK;
+
+  /* Clear the pending interrupt */
+
+  putreg32(0x0004, STM32WL5_EXTI_PR1);
+
+  /* And dispatch the interrupt to the handler */
+
+  if (g_gpio_handlers[2].callback != NULL)
+    {
+      xcpt_t callback = g_gpio_handlers[2].callback;
+      void  *cbarg    = g_gpio_handlers[2].arg;
+
+      ret = callback(irq, context, cbarg);
+    }
+
+  return ret;
+}
+
+static int stm32wl5_exti3_isr(int irq, void *context, void *arg)
+{
+  int ret = OK;
+
+  /* Clear the pending interrupt */
+
+  putreg32(0x0008, STM32WL5_EXTI_PR1);
+
+  /* And dispatch the interrupt to the handler */
+
+  if (g_gpio_handlers[3].callback != NULL)
+    {
+      xcpt_t callback = g_gpio_handlers[3].callback;
+      void  *cbarg    = g_gpio_handlers[3].arg;
+
+      ret = callback(irq, context, cbarg);
+    }
+
+  return ret;
+}
+
+static int stm32wl5_exti4_isr(int irq, void *context, void *arg)
+{
+  int ret = OK;
+
+  /* Clear the pending interrupt */
+
+  putreg32(0x0010, STM32WL5_EXTI_PR1);
+
+  /* And dispatch the interrupt to the handler */
+
+  if (g_gpio_handlers[4].callback != NULL)
+    {
+      xcpt_t callback = g_gpio_handlers[4].callback;
+      void  *cbarg    = g_gpio_handlers[4].arg;
+
+      ret = callback(irq, context, cbarg);
+    }
+
+  return ret;
+}
+
+static int stm32wl5_exti_multiisr(int irq, void *context, void *arg,
+                                 int first, int last)
+{
+  uint32_t pr;
+  int pin;
+  int ret = OK;
+
+  /* Examine the state of each pin in the group */
+
+  pr = getreg32(STM32WL5_EXTI_PR1);
+
+  /* And dispatch the interrupt to the handler */
+
+  for (pin = first; pin <= last; pin++)
+    {
+      /* Is an interrupt pending on this pin? */
+
+      uint32_t mask = (1 << pin);

Review Comment:
   minor
   ```suggestion
         uint32_t mask = 1 << pin;
   ```



##########
boards/arm/stm32wl5/nucleo-wl55jc/src/stm32_buttons.c:
##########
@@ -0,0 +1,150 @@
+/****************************************************************************
+ * boards/arm/stm32wl5/nucleo-wl55jc/src/stm32_buttons.c
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <errno.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/board.h>
+#include <arch/board/board.h>
+
+#include "nucleo-wl55jc.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_button_initialize
+ *
+ * Description:
+ *   board_button_initialize() must be called to initialize button resources.
+ *   After that, board_buttons() may be called to collect the current state
+ *   of all buttons or board_button_irq() may be called to register button
+ *   interrupt handlers.
+ *
+ ****************************************************************************/
+
+uint32_t board_button_initialize(void)
+{
+  /* Configure the single button as an input.  NOTE that EXTI interrupts are
+   * also configured for the pin.
+   */
+
+  stm32wl5_configgpio(GPIO_BUTTON1);
+  stm32wl5_configgpio(GPIO_BUTTON2);
+#ifndef CONFIG_ARCH_BOARD_NUCLEO_WL55JC_DEMO_LED_IRQ
+  stm32wl5_configgpio(GPIO_BUTTON3);
+  return 3; /* number of buttons */
+#else
+  return 2; /* number of buttons */
+#endif
+}
+
+/****************************************************************************
+ * Name: board_buttons
+ ****************************************************************************/
+
+uint32_t board_buttons(void)
+{
+  uint32_t state;
+
+  /* Check that state of each USER button.
+   * A LOW value means that the key is pressed.
+   */
+
+  state = 0;
+
+  if (stm32wl5_gpioread(GPIO_BUTTON1) == 0)
+    {
+      state |= 1 << 0;

Review Comment:
   ```suggestion
         state |= BUTTON1_BIT;
   ```



##########
boards/arm/stm32wl5/nucleo-wl55jc/src/stm32_buttons.c:
##########
@@ -0,0 +1,150 @@
+/****************************************************************************
+ * boards/arm/stm32wl5/nucleo-wl55jc/src/stm32_buttons.c
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <errno.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/board.h>
+#include <arch/board/board.h>
+
+#include "nucleo-wl55jc.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_button_initialize
+ *
+ * Description:
+ *   board_button_initialize() must be called to initialize button resources.
+ *   After that, board_buttons() may be called to collect the current state
+ *   of all buttons or board_button_irq() may be called to register button
+ *   interrupt handlers.
+ *
+ ****************************************************************************/
+
+uint32_t board_button_initialize(void)
+{
+  /* Configure the single button as an input.  NOTE that EXTI interrupts are
+   * also configured for the pin.
+   */
+
+  stm32wl5_configgpio(GPIO_BUTTON1);
+  stm32wl5_configgpio(GPIO_BUTTON2);
+#ifndef CONFIG_ARCH_BOARD_NUCLEO_WL55JC_DEMO_LED_IRQ
+  stm32wl5_configgpio(GPIO_BUTTON3);
+  return 3; /* number of buttons */
+#else
+  return 2; /* number of buttons */
+#endif
+}
+
+/****************************************************************************
+ * Name: board_buttons
+ ****************************************************************************/
+
+uint32_t board_buttons(void)
+{
+  uint32_t state;
+
+  /* Check that state of each USER button.
+   * A LOW value means that the key is pressed.
+   */
+
+  state = 0;
+
+  if (stm32wl5_gpioread(GPIO_BUTTON1) == 0)
+    {
+      state |= 1 << 0;
+    }
+
+  if (stm32wl5_gpioread(GPIO_BUTTON2) == 0)
+    {
+      state |= 1 << 1;

Review Comment:
   ```suggestion
         state |= BUTTON2_BIT;
   ```



##########
boards/arm/stm32wl5/nucleo-wl55jc/src/stm32_buttons.c:
##########
@@ -0,0 +1,150 @@
+/****************************************************************************
+ * boards/arm/stm32wl5/nucleo-wl55jc/src/stm32_buttons.c
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <errno.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/board.h>
+#include <arch/board/board.h>
+
+#include "nucleo-wl55jc.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_button_initialize
+ *
+ * Description:
+ *   board_button_initialize() must be called to initialize button resources.
+ *   After that, board_buttons() may be called to collect the current state
+ *   of all buttons or board_button_irq() may be called to register button
+ *   interrupt handlers.
+ *
+ ****************************************************************************/
+
+uint32_t board_button_initialize(void)
+{
+  /* Configure the single button as an input.  NOTE that EXTI interrupts are
+   * also configured for the pin.
+   */
+
+  stm32wl5_configgpio(GPIO_BUTTON1);
+  stm32wl5_configgpio(GPIO_BUTTON2);
+#ifndef CONFIG_ARCH_BOARD_NUCLEO_WL55JC_DEMO_LED_IRQ
+  stm32wl5_configgpio(GPIO_BUTTON3);
+  return 3; /* number of buttons */
+#else
+  return 2; /* number of buttons */
+#endif
+}
+
+/****************************************************************************
+ * Name: board_buttons
+ ****************************************************************************/
+
+uint32_t board_buttons(void)
+{
+  uint32_t state;
+
+  /* Check that state of each USER button.
+   * A LOW value means that the key is pressed.
+   */
+
+  state = 0;
+
+  if (stm32wl5_gpioread(GPIO_BUTTON1) == 0)
+    {
+      state |= 1 << 0;
+    }
+
+  if (stm32wl5_gpioread(GPIO_BUTTON2) == 0)
+    {
+      state |= 1 << 1;
+    }
+
+#ifndef CONFIG_ARCH_BOARD_NUCLEO_WL55JC_DEMO_LED_IRQ
+  if (stm32wl5_gpioread(GPIO_BUTTON3) == 0)
+    {
+      state |= 1 << 2;

Review Comment:
   ```suggestion
         state |= BUTTON3_BIT;
   ```



##########
arch/arm/src/stm32wl5/stm32wl5_exti_gpio.c:
##########
@@ -62,35 +61,168 @@ static struct gpio_callback_s g_gpio_handlers[16];
  ****************************************************************************/
 
 /****************************************************************************
- * Interrupt Service Routine - Dispatcher
+ * Interrupt Service Routines - Dispatchers
  ****************************************************************************/
 
-static int stm32wl5_exti0_15_isr(int irq, void *context, FAR void *arg)
+static int stm32wl5_exti0_isr(int irq, void *context, void *arg)
 {
   int ret = OK;
-  int exti;
-  (void)arg;
 
-  exti = irq - STM32WL5_IRQ_EXTI0;
-  DEBUGASSERT((exti >= 0) && (exti <= 15));
+  /* Clear the pending interrupt */
 
-  /* Clear the pending interrupt for both rising and falling edges. */
+  putreg32(0x0001, STM32WL5_EXTI_PR1);
 
-  putreg32(0x0001 << exti, STM32WL5_EXTI_PR1);
+  /* And dispatch the interrupt to the handler */
+
+  if (g_gpio_handlers[0].callback != NULL)
+    {
+      xcpt_t callback = g_gpio_handlers[0].callback;
+      void  *cbarg    = g_gpio_handlers[0].arg;
+
+      ret = callback(irq, context, cbarg);
+    }
+
+  return ret;
+}
+
+static int stm32wl5_exti1_isr(int irq, void *context, void *arg)
+{
+  int ret = OK;
+
+  /* Clear the pending interrupt */
+
+  putreg32(0x0002, STM32WL5_EXTI_PR1);
 
   /* And dispatch the interrupt to the handler */
 
-  if (g_gpio_handlers[exti].callback != NULL)
+  if (g_gpio_handlers[1].callback != NULL)
     {
-      xcpt_t callback = g_gpio_handlers[exti].callback;
-      void  *cbarg    = g_gpio_handlers[exti].arg;
+      xcpt_t callback = g_gpio_handlers[1].callback;
+      void  *cbarg    = g_gpio_handlers[1].arg;
 
       ret = callback(irq, context, cbarg);
     }
 
   return ret;
 }
 
+static int stm32wl5_exti2_isr(int irq, void *context, void *arg)
+{
+  int ret = OK;
+
+  /* Clear the pending interrupt */
+
+  putreg32(0x0004, STM32WL5_EXTI_PR1);
+
+  /* And dispatch the interrupt to the handler */
+
+  if (g_gpio_handlers[2].callback != NULL)
+    {
+      xcpt_t callback = g_gpio_handlers[2].callback;
+      void  *cbarg    = g_gpio_handlers[2].arg;
+
+      ret = callback(irq, context, cbarg);
+    }
+
+  return ret;
+}
+
+static int stm32wl5_exti3_isr(int irq, void *context, void *arg)
+{
+  int ret = OK;
+
+  /* Clear the pending interrupt */
+
+  putreg32(0x0008, STM32WL5_EXTI_PR1);
+
+  /* And dispatch the interrupt to the handler */
+
+  if (g_gpio_handlers[3].callback != NULL)
+    {
+      xcpt_t callback = g_gpio_handlers[3].callback;
+      void  *cbarg    = g_gpio_handlers[3].arg;
+
+      ret = callback(irq, context, cbarg);
+    }
+
+  return ret;
+}
+
+static int stm32wl5_exti4_isr(int irq, void *context, void *arg)
+{
+  int ret = OK;
+
+  /* Clear the pending interrupt */
+
+  putreg32(0x0010, STM32WL5_EXTI_PR1);
+
+  /* And dispatch the interrupt to the handler */
+
+  if (g_gpio_handlers[4].callback != NULL)
+    {
+      xcpt_t callback = g_gpio_handlers[4].callback;
+      void  *cbarg    = g_gpio_handlers[4].arg;
+
+      ret = callback(irq, context, cbarg);
+    }
+
+  return ret;
+}
+
+static int stm32wl5_exti_multiisr(int irq, void *context, void *arg,
+                                 int first, int last)
+{
+  uint32_t pr;
+  int pin;
+  int ret = OK;
+
+  /* Examine the state of each pin in the group */
+
+  pr = getreg32(STM32WL5_EXTI_PR1);
+
+  /* And dispatch the interrupt to the handler */
+
+  for (pin = first; pin <= last; pin++)
+    {
+      /* Is an interrupt pending on this pin? */
+
+      uint32_t mask = (1 << pin);
+      if ((pr & mask) != 0)
+        {
+          /* Clear the pending interrupt */
+
+          putreg32(mask, STM32WL5_EXTI_PR1);
+
+          /* And dispatch the interrupt to the handler */
+
+          if (g_gpio_handlers[pin].callback != NULL)
+            {
+              xcpt_t callback = g_gpio_handlers[pin].callback;
+              void  *cbarg    = g_gpio_handlers[pin].arg;
+              int tmp;

Review Comment:
   ```suggestion
                 xcpt_t callback = g_gpio_handlers[pin].callback;
                 void  *cbarg    = g_gpio_handlers[pin].arg;
                 int    tmp;
   ```



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6413: stm32wl5: add gpio exti support

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6413:
URL: https://github.com/apache/incubator-nuttx/pull/6413#discussion_r895379389


##########
arch/arm/src/stm32wl5/stm32wl5_exti_gpio.c:
##########
@@ -121,9 +253,60 @@ static int stm32wl5_exti0_15_isr(int irq, void *context, FAR void *arg)
 int stm32wl5_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
                          bool event, xcpt_t func, void *arg)
 {
+  struct gpio_callback_s *shared_cbs;
   uint32_t pin = pinset & GPIO_PIN_MASK;
-  uint32_t exti = 1 << pin;
-  int      irq = STM32WL5_IRQ_EXTI0 + pin;
+  uint32_t exti = (1 << pin);

Review Comment:
   Anyway that was minor, so I approved anyway



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] mlyszczek commented on a diff in pull request #6413: stm32wl5: add gpio exti support

Posted by GitBox <gi...@apache.org>.
mlyszczek commented on code in PR #6413:
URL: https://github.com/apache/incubator-nuttx/pull/6413#discussion_r895377305


##########
arch/arm/src/stm32wl5/stm32wl5_exti_gpio.c:
##########
@@ -121,9 +253,60 @@ static int stm32wl5_exti0_15_isr(int irq, void *context, FAR void *arg)
 int stm32wl5_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
                          bool event, xcpt_t func, void *arg)
 {
+  struct gpio_callback_s *shared_cbs;
   uint32_t pin = pinset & GPIO_PIN_MASK;
-  uint32_t exti = 1 << pin;
-  int      irq = STM32WL5_IRQ_EXTI0 + pin;
+  uint32_t exti = (1 << pin);

Review Comment:
   Ahh, right, I've changed the another "1 << pin" to "(1 << pin)" instead the other way around xD Resolved.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6413: stm32wl5: add gpio exti support

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6413:
URL: https://github.com/apache/incubator-nuttx/pull/6413#discussion_r895495289


##########
boards/arm/stm32wl5/nucleo-wl55jc/src/stm32_leds.c:
##########
@@ -188,7 +215,13 @@ void board_autoled_off(int state)
 
 uint32_t board_userled_initialize(void)
 {
-  /* Already initialized by stm32_led_initialize. */
+  /* Leds are already initialized by stm32_led_initialize. */
+
+#ifdef CONFIG_ARCH_BOARD_NUCLEO_WL55JC_DEMO_LED_IRQ
+  /* Configure B3 button to fire an interrupt on falling edge (on press)  */
+
+  stm32wl5_gpiosetevent(GPIO_BUTTON3, 0, 1, 0, button3_led, NULL);

Review Comment:
   Let's change here as well
   ```suggestion
     stm32wl5_gpiosetevent(GPIO_BUTTON3, false, true, false, button3_led, NULL);
   ```



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org