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 2021/03/05 18:02:07 UTC

[GitHub] [incubator-nuttx] acassis commented on a change in pull request #2986: arm/rp2040: Add SPI driver support

acassis commented on a change in pull request #2986:
URL: https://github.com/apache/incubator-nuttx/pull/2986#discussion_r588534325



##########
File path: arch/arm/src/rp2040/rp2040_gpio.h
##########
@@ -50,12 +66,44 @@ extern "C"
 #define EXTERN extern
 #endif
 
+/****************************************************************************
+ * Inline Functions
+ ****************************************************************************/
+
+static inline void rp2040_gpio_put(uint32_t gpio, int set)
+{
+  uint32_t value = 1 << gpio;
+
+  if (set)

Review comment:
       you missed
   {
   }
   It is required, like in the MISRA C

##########
File path: arch/arm/src/rp2040/rp2040_gpio.h
##########
@@ -50,12 +66,44 @@ extern "C"
 #define EXTERN extern
 #endif
 
+/****************************************************************************
+ * Inline Functions
+ ****************************************************************************/
+
+static inline void rp2040_gpio_put(uint32_t gpio, int set)
+{
+  uint32_t value = 1 << gpio;
+
+  if (set)
+    putreg32(value, RP2040_SIO_GPIO_OUT_SET);
+  else
+    putreg32(value, RP2040_SIO_GPIO_OUT_CLR);
+}
+
+static inline bool rp2040_gpio_get(uint32_t gpio)
+{
+  uint32_t value = 1 << gpio;
+
+  return (getreg32(RP2040_SIO_GPIO_IN) & value) != 0;
+}
+
+static inline void rp2040_gpio_setdir(uint32_t gpio, int out)
+{
+  uint32_t value = 1 << gpio;
+
+  if (out)
+    putreg32(value, RP2040_SIO_GPIO_OE_SET);
+  else
+    putreg32(value, RP2040_SIO_GPIO_OE_CLR);
+}

Review comment:
       Ditto




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