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/05/13 12:29:08 UTC

[GitHub] [incubator-nuttx] adamkaliszan opened a new pull request, #6266: Nucleo f401 re oled

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

   ## Summary
   Nucleo F401RE board support for SSD1306 oled display with SPI interface
   ## Impact
   
   ## Testing
   Yes
   


-- 
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 commented on a diff in pull request #6266: Nucleo f401 re oled

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


##########
boards/arm/stm32/nucleo-f4x1re/src/stm32_spi.c:
##########
@@ -46,6 +46,10 @@
  * Public Data
  ****************************************************************************/
 
+#ifndef OK
+#  define OK 0
+#endif

Review Comment:
   Not remove yet?



-- 
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 #6266: Nucleo f401 re oled

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


##########
boards/arm/stm32/nucleo-f4x1re/configs/f401-fb/defconfig:
##########
@@ -0,0 +1,1894 @@
+#

Review Comment:
   Seems to be a renamed `.config`. Please use `make savedefconfig` and upload a `defconfig` file instead.



-- 
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 #6266: Nucleo f401 re oled

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


##########
boards/arm/stm32/nucleo-f4x1re/src/stm32_lcd_ssd1306.c:
##########
@@ -0,0 +1,91 @@
+/****************************************************************************
+ * boards/arm/stm32/nucleo-f4x1re/src/stm32_lcd_ssd1306.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 <debug.h>
+
+#include <nuttx/board.h>
+#include <nuttx/lcd/lcd.h>
+#include <nuttx/lcd/ssd1306.h>
+
+#include "stm32.h"
+#include "nucleo-f4x1re.h"
+
+#include "stm32_ssd1306.h"
+
+#define OLED_SPI_PORT 1
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+#ifndef OK
+#  define OK 0
+#endif

Review Comment:
   Is this really needed?



##########
boards/arm/stm32/nucleo-f4x1re/src/stm32_spi.c:
##########
@@ -128,6 +137,13 @@ void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid,
   spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" :
           "de-assert");
 
+#if defined(CONFIG_LCD_SSD1306_SPI)
+  if (devid == SPIDEV_DISPLAY(0))

Review Comment:
   Optional
   IMO this is exactly a right time to change `if`s to `switch`/`case` for `stm32_spi1select`.



##########
boards/arm/stm32/nucleo-f4x1re/src/stm32_ssd1306.c:
##########
@@ -0,0 +1,164 @@
+/****************************************************************************
+ * boards/arm/stm32/nucleo-f4x1re/src/stm32_ssd1306.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 <debug.h>
+
+#include <nuttx/board.h>
+#include <nuttx/lcd/lcd.h>
+#include <nuttx/lcd/ssd1306.h>
+#include <nuttx/i2c/i2c_master.h>
+#include <nuttx/spi/spi.h>
+
+#include "stm32_i2c.h"
+#include "stm32_spi.h"
+
+#ifndef OK
+#  define OK 0
+#endif
+
+#define OLED_SPI_PORT 1
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct lcd_dev_s    *g_lcddev;
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_ssd1306_initialize
+ *
+ * Description:
+ *   Initialize and register the device. I2C version.
+ *
+ * Input Parameters:
+ *   busno - The I2C bus number
+ *
+ * Returned Value:
+ *   Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+#ifdef CONFIG_LCD_SSD1306_I2C
+int board_ssd1306_initialize(int busno)
+{
+  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", busno);
+      return -ENODEV;
+    }
+
+  /* Bind the I2C port to the OLED */
+
+  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
+int board_ssd1306_initialize(int busno)
+{
+  struct spi_dev_s *spi;
+  const int devno = 0;
+
+  /* Initialize SPI */
+
+  spi = stm32_spibus_initialize(busno);
+  if (!spi)

Review Comment:
   Optional
   ```suggestion
     if (spi == NULL)
   ```



##########
boards/arm/stm32/nucleo-f4x1re/src/stm32_ssd1306.c:
##########
@@ -0,0 +1,164 @@
+/****************************************************************************
+ * boards/arm/stm32/nucleo-f4x1re/src/stm32_ssd1306.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 <debug.h>
+
+#include <nuttx/board.h>
+#include <nuttx/lcd/lcd.h>
+#include <nuttx/lcd/ssd1306.h>
+#include <nuttx/i2c/i2c_master.h>
+#include <nuttx/spi/spi.h>
+
+#include "stm32_i2c.h"
+#include "stm32_spi.h"
+
+#ifndef OK
+#  define OK 0
+#endif
+
+#define OLED_SPI_PORT 1
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct lcd_dev_s    *g_lcddev;
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_ssd1306_initialize
+ *
+ * Description:
+ *   Initialize and register the device. I2C version.
+ *
+ * Input Parameters:
+ *   busno - The I2C bus number
+ *
+ * Returned Value:
+ *   Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+#ifdef CONFIG_LCD_SSD1306_I2C
+int board_ssd1306_initialize(int busno)
+{
+  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", busno);
+      return -ENODEV;
+    }
+
+  /* Bind the I2C port to the OLED */
+
+  g_lcddev = ssd1306_initialize(i2c, NULL, devno);
+  if (!g_lcddev)

Review Comment:
   Optional
   ```suggestion
     if (g_lcddev == NULL)
   ```



##########
boards/arm/stm32/nucleo-f4x1re/src/stm32_spi.c:
##########
@@ -46,6 +46,10 @@
  * Public Data
  ****************************************************************************/
 
+#ifndef OK
+#  define OK 0
+#endif

Review Comment:
   Is this really needed?



##########
boards/arm/stm32/nucleo-f4x1re/src/stm32_ssd1306.c:
##########
@@ -0,0 +1,164 @@
+/****************************************************************************
+ * boards/arm/stm32/nucleo-f4x1re/src/stm32_ssd1306.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 <debug.h>
+
+#include <nuttx/board.h>
+#include <nuttx/lcd/lcd.h>
+#include <nuttx/lcd/ssd1306.h>
+#include <nuttx/i2c/i2c_master.h>
+#include <nuttx/spi/spi.h>
+
+#include "stm32_i2c.h"
+#include "stm32_spi.h"
+
+#ifndef OK
+#  define OK 0
+#endif

Review Comment:
   Is this really needed?



##########
boards/arm/stm32/nucleo-f4x1re/src/stm32_ssd1306.c:
##########
@@ -0,0 +1,164 @@
+/****************************************************************************
+ * boards/arm/stm32/nucleo-f4x1re/src/stm32_ssd1306.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 <debug.h>
+
+#include <nuttx/board.h>
+#include <nuttx/lcd/lcd.h>
+#include <nuttx/lcd/ssd1306.h>
+#include <nuttx/i2c/i2c_master.h>
+#include <nuttx/spi/spi.h>
+
+#include "stm32_i2c.h"
+#include "stm32_spi.h"
+
+#ifndef OK
+#  define OK 0
+#endif
+
+#define OLED_SPI_PORT 1
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct lcd_dev_s    *g_lcddev;

Review Comment:
   ```suggestion
   static struct lcd_dev_s *g_lcddev;
   ```



##########
boards/arm/stm32/nucleo-f4x1re/src/stm32_ssd1306.c:
##########
@@ -0,0 +1,164 @@
+/****************************************************************************
+ * boards/arm/stm32/nucleo-f4x1re/src/stm32_ssd1306.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 <debug.h>
+
+#include <nuttx/board.h>
+#include <nuttx/lcd/lcd.h>
+#include <nuttx/lcd/ssd1306.h>
+#include <nuttx/i2c/i2c_master.h>
+#include <nuttx/spi/spi.h>
+
+#include "stm32_i2c.h"
+#include "stm32_spi.h"
+
+#ifndef OK
+#  define OK 0
+#endif
+
+#define OLED_SPI_PORT 1
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct lcd_dev_s    *g_lcddev;
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_ssd1306_initialize
+ *
+ * Description:
+ *   Initialize and register the device. I2C version.
+ *
+ * Input Parameters:
+ *   busno - The I2C bus number
+ *
+ * Returned Value:
+ *   Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+#ifdef CONFIG_LCD_SSD1306_I2C
+int board_ssd1306_initialize(int busno)
+{
+  struct i2c_master_s *i2c;
+  const int devno = 0;
+
+  /* Initialize I2C */
+
+  i2c = stm32_i2cbus_initialize(busno);
+  if (!i2c)

Review Comment:
   Optional
   ```suggestion
     if (i2c == NULL)
   ```



##########
boards/arm/stm32/nucleo-f4x1re/src/stm32_ssd1306.c:
##########
@@ -0,0 +1,164 @@
+/****************************************************************************
+ * boards/arm/stm32/nucleo-f4x1re/src/stm32_ssd1306.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 <debug.h>
+
+#include <nuttx/board.h>
+#include <nuttx/lcd/lcd.h>
+#include <nuttx/lcd/ssd1306.h>
+#include <nuttx/i2c/i2c_master.h>
+#include <nuttx/spi/spi.h>
+
+#include "stm32_i2c.h"
+#include "stm32_spi.h"
+
+#ifndef OK
+#  define OK 0
+#endif
+
+#define OLED_SPI_PORT 1
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct lcd_dev_s    *g_lcddev;
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_ssd1306_initialize
+ *
+ * Description:
+ *   Initialize and register the device. I2C version.
+ *
+ * Input Parameters:
+ *   busno - The I2C bus number
+ *
+ * Returned Value:
+ *   Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+#ifdef CONFIG_LCD_SSD1306_I2C
+int board_ssd1306_initialize(int busno)
+{
+  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", busno);
+      return -ENODEV;
+    }
+
+  /* Bind the I2C port to the OLED */
+
+  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
+int board_ssd1306_initialize(int busno)
+{
+  struct spi_dev_s *spi;
+  const int devno = 0;
+
+  /* Initialize SPI */
+
+  spi = stm32_spibus_initialize(busno);
+  if (!spi)
+    {
+      lcderr("ERROR: Failed to initialize SPI port %d\n", busno);
+      return -ENODEV;
+    }
+
+  /* Bind the SPI port to the OLED */
+
+  g_lcddev = ssd1306_initialize(spi, NULL, devno);
+  if (!g_lcddev)

Review Comment:
   Optional
   ```suggestion
     if (g_lcddev == NULL)
   ```



##########
boards/arm/stm32/nucleo-f4x1re/src/stm32_ssd1306.c:
##########
@@ -0,0 +1,164 @@
+/****************************************************************************
+ * boards/arm/stm32/nucleo-f4x1re/src/stm32_ssd1306.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 <debug.h>
+
+#include <nuttx/board.h>
+#include <nuttx/lcd/lcd.h>
+#include <nuttx/lcd/ssd1306.h>
+#include <nuttx/i2c/i2c_master.h>
+#include <nuttx/spi/spi.h>
+
+#include "stm32_i2c.h"
+#include "stm32_spi.h"
+
+#ifndef OK
+#  define OK 0
+#endif
+
+#define OLED_SPI_PORT 1
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct lcd_dev_s    *g_lcddev;
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_ssd1306_initialize
+ *
+ * Description:
+ *   Initialize and register the device. I2C version.
+ *
+ * Input Parameters:
+ *   busno - The I2C bus number
+ *
+ * Returned Value:
+ *   Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+#ifdef CONFIG_LCD_SSD1306_I2C
+int board_ssd1306_initialize(int busno)
+{
+  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", busno);
+      return -ENODEV;
+    }
+
+  /* Bind the I2C port to the OLED */
+
+  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
+int board_ssd1306_initialize(int busno)
+{
+  struct spi_dev_s *spi;
+  const int devno = 0;
+
+  /* Initialize SPI */
+
+  spi = stm32_spibus_initialize(busno);
+  if (!spi)
+    {
+      lcderr("ERROR: Failed to initialize SPI port %d\n", busno);
+      return -ENODEV;
+    }
+
+  /* Bind the SPI port to the OLED */
+
+  g_lcddev = ssd1306_initialize(spi, NULL, devno);
+  if (!g_lcddev)
+    {
+      lcderr("ERROR: Failed to bind SPI port %d to OLED %d\n", busno, devno);
+      return -ENODEV;
+    }
+  else
+    {
+      lcdinfo("Bound SPI 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_getdev
+ *
+ * Description:
+ *   Get the SSD1306 device driver instance
+ *
+ * Returned Value:
+ *   Pointer to the instance
+ *
+ ****************************************************************************/
+
+struct lcd_dev_s *board_ssd1306_getdev(void)

Review Comment:
   Maybe registry can be done at caller level? I mean that `board_ssd1306_initialize` and `board_ssd1306_initialize` car return `struct lcd_dev_s *` or `NULL` and `board_lcd_initialize` can store the pointer to LCD device.



-- 
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 commented on pull request #6266: Nucleo f401 re oled

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

   @adamkaliszan please squash your patch like this:
   git rebase --interactive HEAD~4
   reorder your patch set in the editor and select squash as needed.


-- 
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] adamkaliszan commented on a diff in pull request #6266: Nucleo f401 re oled

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


##########
boards/arm/stm32/nucleo-f4x1re/configs/f401-fb/defconfig:
##########
@@ -0,0 +1,1894 @@
+#

Review Comment:
   Thx. Now there is a file generated by make savedefconfig.



-- 
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 commented on pull request #6266: Nucleo f401 re oled

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

   @adamkaliszan please run:
   ```
   ./checkpatch.sh -g HEAD~...HEAD
   ```
   and fix the reported warning.


-- 
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] adamkaliszan commented on a diff in pull request #6266: Nucleo f401 re oled

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


##########
boards/arm/stm32/nucleo-f4x1re/src/stm32_spi.c:
##########
@@ -46,6 +46,10 @@
  * Public Data
  ****************************************************************************/
 
+#ifndef OK
+#  define OK 0
+#endif

Review Comment:
   Sorry. Now is removed



-- 
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] acassis merged pull request #6266: Nucleo f401 re oled

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


-- 
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] adamkaliszan commented on a diff in pull request #6266: Nucleo f401 re oled

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


##########
boards/arm/stm32/nucleo-f4x1re/src/stm32_spi.c:
##########
@@ -46,6 +46,10 @@
  * Public Data
  ****************************************************************************/
 
+#ifndef OK
+#  define OK 0
+#endif

Review Comment:
   You are rhght. No it is removed



-- 
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 commented on pull request #6266: Nucleo f401 re oled

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

   still has one error:
   ```
   Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32/nucleo-f4x1re/src/stm32_spi.c:228:3: error: Right brace must be followed by a blank line
   ```


-- 
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 commented on pull request #6266: Nucleo f401 re oled

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

   @adamkaliszan it's better to fix the style issue in place instead creating a new patch.


-- 
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 commented on pull request #6266: Nucleo f401 re oled

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

   > I add one more comit and rebased: git rebase --interactive HEAD~5
   
   but your PR still contain file patch, please reorg your patch into the reasonable set.


-- 
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] adamkaliszan commented on pull request #6266: Nucleo f401 re oled

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

   I add one more comit and rebased: git rebase --interactive HEAD~5


-- 
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] adamkaliszan commented on a diff in pull request #6266: Nucleo f401 re oled

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


##########
boards/arm/stm32/nucleo-f4x1re/src/stm32_ssd1306.c:
##########
@@ -0,0 +1,164 @@
+/****************************************************************************
+ * boards/arm/stm32/nucleo-f4x1re/src/stm32_ssd1306.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 <debug.h>
+
+#include <nuttx/board.h>
+#include <nuttx/lcd/lcd.h>
+#include <nuttx/lcd/ssd1306.h>
+#include <nuttx/i2c/i2c_master.h>
+#include <nuttx/spi/spi.h>
+
+#include "stm32_i2c.h"
+#include "stm32_spi.h"
+
+#ifndef OK
+#  define OK 0
+#endif
+
+#define OLED_SPI_PORT 1
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct lcd_dev_s    *g_lcddev;
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_ssd1306_initialize
+ *
+ * Description:
+ *   Initialize and register the device. I2C version.
+ *
+ * Input Parameters:
+ *   busno - The I2C bus number
+ *
+ * Returned Value:
+ *   Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+#ifdef CONFIG_LCD_SSD1306_I2C
+int board_ssd1306_initialize(int busno)
+{
+  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", busno);
+      return -ENODEV;
+    }
+
+  /* Bind the I2C port to the OLED */
+
+  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
+int board_ssd1306_initialize(int busno)
+{
+  struct spi_dev_s *spi;
+  const int devno = 0;
+
+  /* Initialize SPI */
+
+  spi = stm32_spibus_initialize(busno);
+  if (!spi)
+    {
+      lcderr("ERROR: Failed to initialize SPI port %d\n", busno);
+      return -ENODEV;
+    }
+
+  /* Bind the SPI port to the OLED */
+
+  g_lcddev = ssd1306_initialize(spi, NULL, devno);
+  if (!g_lcddev)

Review Comment:
   I'm going to write driver for e-ink SSD1600. I will take into consideration Yours suggestions.



-- 
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] adamkaliszan commented on a diff in pull request #6266: Nucleo f401 re oled

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


##########
boards/arm/stm32/nucleo-f4x1re/src/stm32_ssd1306.c:
##########
@@ -0,0 +1,164 @@
+/****************************************************************************
+ * boards/arm/stm32/nucleo-f4x1re/src/stm32_ssd1306.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 <debug.h>
+
+#include <nuttx/board.h>
+#include <nuttx/lcd/lcd.h>
+#include <nuttx/lcd/ssd1306.h>
+#include <nuttx/i2c/i2c_master.h>
+#include <nuttx/spi/spi.h>
+
+#include "stm32_i2c.h"
+#include "stm32_spi.h"
+
+#ifndef OK
+#  define OK 0
+#endif
+
+#define OLED_SPI_PORT 1
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct lcd_dev_s    *g_lcddev;
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_ssd1306_initialize
+ *
+ * Description:
+ *   Initialize and register the device. I2C version.
+ *
+ * Input Parameters:
+ *   busno - The I2C bus number
+ *
+ * Returned Value:
+ *   Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+#ifdef CONFIG_LCD_SSD1306_I2C
+int board_ssd1306_initialize(int busno)
+{
+  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", busno);
+      return -ENODEV;
+    }
+
+  /* Bind the I2C port to the OLED */
+
+  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
+int board_ssd1306_initialize(int busno)
+{
+  struct spi_dev_s *spi;
+  const int devno = 0;
+
+  /* Initialize SPI */
+
+  spi = stm32_spibus_initialize(busno);
+  if (!spi)
+    {
+      lcderr("ERROR: Failed to initialize SPI port %d\n", busno);
+      return -ENODEV;
+    }
+
+  /* Bind the SPI port to the OLED */
+
+  g_lcddev = ssd1306_initialize(spi, NULL, devno);
+  if (!g_lcddev)
+    {
+      lcderr("ERROR: Failed to bind SPI port %d to OLED %d\n", busno, devno);
+      return -ENODEV;
+    }
+  else
+    {
+      lcdinfo("Bound SPI 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_getdev
+ *
+ * Description:
+ *   Get the SSD1306 device driver instance
+ *
+ * Returned Value:
+ *   Pointer to the instance
+ *
+ ****************************************************************************/
+
+struct lcd_dev_s *board_ssd1306_getdev(void)

Review Comment:
   The source of the problem is the fact, that I had to copy file stm32_ssd1306.c from directory board/arm/stm32/**common**/src to directory board/arm/stm32/**nucleo-f4x1re**/src in order to solve linker problem **undefined reference to `board_ssd1306_getdev`**. I will try to fix the linker problem without copying the file **stm32_ssd1306.c** to the board/src directory. In case of redundant file (stm32_ssd1306.c in board/src directory) registry could be done at caller level without major changes.



-- 
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] adamkaliszan commented on a diff in pull request #6266: Nucleo f401 re oled

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


##########
boards/arm/stm32/nucleo-f4x1re/src/stm32_ssd1306.c:
##########
@@ -0,0 +1,164 @@
+/****************************************************************************
+ * boards/arm/stm32/nucleo-f4x1re/src/stm32_ssd1306.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 <debug.h>
+
+#include <nuttx/board.h>
+#include <nuttx/lcd/lcd.h>
+#include <nuttx/lcd/ssd1306.h>
+#include <nuttx/i2c/i2c_master.h>
+#include <nuttx/spi/spi.h>
+
+#include "stm32_i2c.h"
+#include "stm32_spi.h"
+
+#ifndef OK
+#  define OK 0
+#endif
+
+#define OLED_SPI_PORT 1
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct lcd_dev_s    *g_lcddev;
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_ssd1306_initialize
+ *
+ * Description:
+ *   Initialize and register the device. I2C version.
+ *
+ * Input Parameters:
+ *   busno - The I2C bus number
+ *
+ * Returned Value:
+ *   Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+#ifdef CONFIG_LCD_SSD1306_I2C
+int board_ssd1306_initialize(int busno)
+{
+  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", busno);
+      return -ENODEV;
+    }
+
+  /* Bind the I2C port to the OLED */
+
+  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
+int board_ssd1306_initialize(int busno)
+{
+  struct spi_dev_s *spi;
+  const int devno = 0;
+
+  /* Initialize SPI */
+
+  spi = stm32_spibus_initialize(busno);
+  if (!spi)
+    {
+      lcderr("ERROR: Failed to initialize SPI port %d\n", busno);
+      return -ENODEV;
+    }
+
+  /* Bind the SPI port to the OLED */
+
+  g_lcddev = ssd1306_initialize(spi, NULL, devno);
+  if (!g_lcddev)
+    {
+      lcderr("ERROR: Failed to bind SPI port %d to OLED %d\n", busno, devno);
+      return -ENODEV;
+    }
+  else
+    {
+      lcdinfo("Bound SPI 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_getdev
+ *
+ * Description:
+ *   Get the SSD1306 device driver instance
+ *
+ * Returned Value:
+ *   Pointer to the instance
+ *
+ ****************************************************************************/
+
+struct lcd_dev_s *board_ssd1306_getdev(void)

Review Comment:
   The source of the problem is the fact, that I had to copy file stm32_ssd1306.c from directory board/arm/stm32/**common**/src to directory board/arm/stm32/**nucleo-f4x1re**/src in order to solve linker problem **undefined reference to `board_ssd1306_getdev**. I will try to fix the linker problem without copying the file **stm32_ssd1306.c** to the board/src directory. In case of redundant file (stm32_ssd1306.c in board/src directory) registry could be done at caller level without major changes.



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