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 2020/10/23 13:12:03 UTC

[GitHub] [incubator-nuttx] juniskane opened a new pull request #2079: Stm32 oled fixes pr

juniskane opened a new pull request #2079:
URL: https://github.com/apache/incubator-nuttx/pull/2079


   ## Summary
   - Common stm32 board driver support used SSD1306 OLED for I2C only, without checking CONFIG_LCD_SSD1306_I2C. Furthermore, I2C initialization did not compile. Fixed and added support for having this device in SPI bus as well.
   - Fixed lcderr() wrong printf-style arguments for many boards
   ## Impact
   
   ## Testing
   
   


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



[GitHub] [incubator-nuttx] davids5 commented on a change in pull request #2079: Stm32 oled fixes pr

Posted by GitBox <gi...@apache.org>.
davids5 commented on a change in pull request #2079:
URL: https://github.com/apache/incubator-nuttx/pull/2079#discussion_r510882850



##########
File path: boards/arm/stm32/common/src/stm32_ssd1306.c
##########
@@ -77,38 +58,88 @@ FAR struct lcd_dev_s    *g_lcddev;
  *   Zero (OK) on success; a negated errno value on failure.
  *
  ****************************************************************************/
-
+#ifdef CONFIG_LCD_SSD1306_I2C
 int board_ssd1306_initialize(int busno)
 {
   FAR struct i2c_master_s *i2c;
+  const int devno = 0;
 
   /* Initialize I2C */
 
   i2c = stm32_i2cbus_initialize(busno);
   if (!i2c)
     {
-      lcderr("ERROR: Failed to initialize I2C port %d\n", OLED_I2C_PORT);
+      lcderr("ERROR: Failed to initialize I2C port %d\n", busno);
       return -ENODEV;
     }
 
   /* Bind the I2C port to the OLED */
 
-  g_lcddev = ssd1306_initialize(i2c, NULL, 0);
+  g_lcddev = ssd1306_initialize(i2c, NULL, devno);
+  if (!g_lcddev)
+    {
+      lcderr("ERROR: Failed to bind I2C port %d to OLED %d\n", busno, devno);
+      return -ENODEV;
+    }
+  else
+    {
+      lcdinfo("Bound I2C port %d to OLED %d\n", busno, devno);
+
+      /* And turn the OLED on */
+
+      g_lcddev->setpower(g_lcddev, CONFIG_LCD_MAXPOWER);
+      return OK;
+    }
+}
+#endif
+
+/****************************************************************************
+ * Name: board_ssd1306_initialize
+ *
+ * Description:
+ *   Initialize and register the device. SPI version.
+ *
+ * Input Parameters:
+ *   busno - The SPI bus number
+ *
+ * Returned Value:
+ *   Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+#ifdef CONFIG_LCD_SSD1306_SPI

Review comment:
       @juniskane - is there a Kconfig for this?




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



[GitHub] [incubator-nuttx] acassis merged pull request #2079: Stm32 oled fixes pr

Posted by GitBox <gi...@apache.org>.
acassis merged pull request #2079:
URL: https://github.com/apache/incubator-nuttx/pull/2079


   


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



[GitHub] [incubator-nuttx] davids5 commented on a change in pull request #2079: Stm32 oled fixes pr

Posted by GitBox <gi...@apache.org>.
davids5 commented on a change in pull request #2079:
URL: https://github.com/apache/incubator-nuttx/pull/2079#discussion_r510884091



##########
File path: boards/arm/stm32/common/src/stm32_ssd1306.c
##########
@@ -77,38 +58,88 @@ FAR struct lcd_dev_s    *g_lcddev;
  *   Zero (OK) on success; a negated errno value on failure.
  *
  ****************************************************************************/
-
+#ifdef CONFIG_LCD_SSD1306_I2C
 int board_ssd1306_initialize(int busno)
 {
   FAR struct i2c_master_s *i2c;
+  const int devno = 0;
 
   /* Initialize I2C */
 
   i2c = stm32_i2cbus_initialize(busno);
   if (!i2c)
     {
-      lcderr("ERROR: Failed to initialize I2C port %d\n", OLED_I2C_PORT);
+      lcderr("ERROR: Failed to initialize I2C port %d\n", busno);
       return -ENODEV;
     }
 
   /* Bind the I2C port to the OLED */
 
-  g_lcddev = ssd1306_initialize(i2c, NULL, 0);
+  g_lcddev = ssd1306_initialize(i2c, NULL, devno);
+  if (!g_lcddev)
+    {
+      lcderr("ERROR: Failed to bind I2C port %d to OLED %d\n", busno, devno);
+      return -ENODEV;
+    }
+  else
+    {
+      lcdinfo("Bound I2C port %d to OLED %d\n", busno, devno);
+
+      /* And turn the OLED on */
+
+      g_lcddev->setpower(g_lcddev, CONFIG_LCD_MAXPOWER);
+      return OK;
+    }
+}
+#endif
+
+/****************************************************************************
+ * Name: board_ssd1306_initialize
+ *
+ * Description:
+ *   Initialize and register the device. SPI version.
+ *
+ * Input Parameters:
+ *   busno - The SPI bus number
+ *
+ * Returned Value:
+ *   Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+#ifdef CONFIG_LCD_SSD1306_SPI

Review comment:
       My Bad I see it.




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