raiden00pl commented on a change in pull request #1662:
URL: https://github.com/apache/incubator-nuttx/pull/1662#discussion_r479742876



##########
File path: arch/arm/src/nrf52/nrf52_gpiote.c
##########
@@ -285,3 +275,61 @@ int nrf52_gpiote_init(void)
 
   return OK;
 }
+
+int nrf52_gpio_taskset(uint32_t pinset, int channel,
+                       bool output_high, bool set_task, bool clear_task,
+                       bool toggle_task)
+{
+  /* TODO: find if i conflicts with interrupt */
+
+  uint32_t regval;
+  int pin;
+
+  /* Select GPIOTE pin */
+
+  pin = (pinset & GPIO_PIN_MASK) >> GPIO_PIN_SHIFT;
+  regval = (pin << GPIOTE_CONFIG_PSEL_SHIFT);
+
+#ifdef CONFIG_ARCH_CHIP_NRF52840

Review comment:
       Same as above.

##########
File path: arch/arm/src/nrf52/nrf52_gpiote.h
##########
@@ -72,6 +57,10 @@
 int nrf52_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
                        bool event, xcpt_t func, FAR void *arg);
 
+int nrf52_gpio_taskset(uint32_t pinset, int channel,

Review comment:
       Let's stick to the naming convention that is already in use.
   ```suggestion
   int nrf52_gpiotaskset(uint32_t pinset, int channel,
   ```

##########
File path: arch/arm/src/nrf52/nrf52_gpiote.c
##########
@@ -183,7 +168,9 @@ int nrf52_gpiosetevent(uint32_t pinset, bool risingedge, 
bool fallingedge,
   int        ret    = OK;
   int        i      = 0;
   int        pin    = 0;
+#ifdef CONFIG_ARCH_CHIP_NRF52840

Review comment:
       It was completely intentional and should have stayed the way it was. 
There are more chips supporting more than 1 gpio port in the nrf52 family. 
Adding more chips to the #ifdef conditions will make the code unreadable. 
   The arch code should be as general as possible and avoid special cases for 
single chips as much as possible. Otherwise we'll end up with the spaghetti 
code as in some files in arch/stm32.




----------------------------------------------------------------
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:
[email protected]


Reply via email to