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/13 06:15:50 UTC

[GitHub] [incubator-nuttx] adamkaliszan opened a new pull request, #6418: Eps32 Lilygo t5v2 BSP

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

   ## Summary
   BSP for Lilygo T5v2 board (e-paper display with SD card reader).
   ## Impact
   None
   ## Testing
   Yes, on Lilygo T5v2 board.
   


-- 
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 #6418: Eps32 Lilygo t5v2 BSP

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


##########
boards/xtensa/esp32/common/src/esp32_ssd1680.c:
##########
@@ -0,0 +1,189 @@
+/****************************************************************************
+ * boards/xtensa/esp32/common/src/esp32_ssd1680.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/ssd1680.h>
+#include <nuttx/spi/spi.h>
+
+#if defined(CONFIG_VIDEO_FB) && defined(CONFIG_LCD_FRAMEBUFFER)
+#  include <nuttx/video/fb.h>
+#endif
+
+#include "esp32_gpio.h"
+#include "esp32_spi.h"
+
+#ifdef CONFIG_LCD_SSD1680
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_PWR) && (CONFIG_SSD1680_GPIO_PIN_PWR>=0)
+static bool ssd1680_set_vcc(bool state)
+{
+  esp32_gpiowrite(CONFIG_SSD1680_GPIO_PIN_PWR, state);
+  return true;
+}
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_RST) && (CONFIG_SSD1680_GPIO_PIN_RST>=0)
+static bool ssd1680_set_rst(bool state)
+{
+  esp32_gpiowrite(CONFIG_SSD1680_GPIO_PIN_RST, state);
+  return true;
+}
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_BUSY) && (CONFIG_SSD1680_GPIO_PIN_BUSY>=0)
+static bool ssd1680_check_busy(void)
+{
+  return esp32_gpioread(CONFIG_SSD1680_GPIO_PIN_BUSY);
+}
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct lcd_dev_s    *g_lcddev;
+struct ssd1680_priv_s g_ssd1680_priv =
+{
+#if defined(CONFIG_SSD1680_GPIO_PIN_PWR) && (CONFIG_SSD1680_GPIO_PIN_PWR >= 0)
+  .set_vcc = ssd1680_set_vcc,
+#else
+  .set_vcc = NULL,
+#endif
+#if defined(CONFIG_SSD1680_GPIO_PIN_RST)  && (CONFIG_SSD1680_GPIO_PIN_RST >= 0)
+  .set_rst = ssd1680_set_rst,
+#else
+  .set_rst = NULL,
+#endif
+#if defined(CONFIG_SSD1680_GPIO_PIN_BUSY) && (CONFIG_SSD1680_GPIO_PIN_BUSY >= 0)
+  .check_busy = ssd1680_check_busy,
+#else
+  .check_busy = NULL,
+#endif
+};
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_lcd_initialize
+ ****************************************************************************/
+
+int board_lcd_initialize(void)
+{
+  struct spi_dev_s *spi;
+
+  /* Initialize additional I/O for e-ink display */
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_DTA_CMD) && \
+  (CONFIG_SSD1680_GPIO_PIN_DTA_CMD >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_DTA_CMD, OUTPUT);
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_PWR) && (CONFIG_SSD1680_GPIO_PIN_PWR >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_PWR, OUTPUT);
+  lcdinfo("Using pin %d as PWR control\n", CONFIG_SSD1680_GPIO_PIN_PWR);
+#else
+  lcdinfo("PWR control line is disabled\n");
+#endif
+#if defined(CONFIG_SSD1680_GPIO_PIN_RST) && (CONFIG_SSD1680_GPIO_PIN_RST >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_RST, OUTPUT);
+  lcdinfo("Using pin %d as RESET\n", CONFIG_SSD1680_GPIO_PIN_RST);
+#elif
+  lcdinfo("RESET line is disabled\n");
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_BUSY) && \
+  (CONFIG_SSD1680_GPIO_PIN_BUSY >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_BUSY, INPUT | PULLUP);
+  lcdinfo("Using pin %d for reading busy state\n",
+    CONFIG_SSD1680_GPIO_PIN_BUSY);
+#elif
+  lcdinfo("Read busy line is disabled\n");
+#endif
+
+  /* Initialize SPI */
+
+  spi = esp32_spibus_initialize(CONFIG_SSD1680_SPI_BUS);
+  if (!spi)
+    {
+      lcderr("ERROR: Failed to initialize SPI port %d\n",
+        CONFIG_SSD1680_SPI_BUS);
+      return -ENODEV;
+    }
+  else
+    {
+      lcdinfo("Using SPI bus %d. SPI is initialized\n",
+        CONFIG_SSD1680_SPI_BUS);

Review Comment:
   OK. I have applied suggestions. Thx. for Your remark.



##########
boards/xtensa/esp32/common/src/esp32_ssd1680.c:
##########
@@ -0,0 +1,189 @@
+/****************************************************************************
+ * boards/xtensa/esp32/common/src/esp32_ssd1680.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/ssd1680.h>
+#include <nuttx/spi/spi.h>
+
+#if defined(CONFIG_VIDEO_FB) && defined(CONFIG_LCD_FRAMEBUFFER)
+#  include <nuttx/video/fb.h>
+#endif
+
+#include "esp32_gpio.h"
+#include "esp32_spi.h"
+
+#ifdef CONFIG_LCD_SSD1680
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_PWR) && (CONFIG_SSD1680_GPIO_PIN_PWR>=0)
+static bool ssd1680_set_vcc(bool state)
+{
+  esp32_gpiowrite(CONFIG_SSD1680_GPIO_PIN_PWR, state);
+  return true;
+}
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_RST) && (CONFIG_SSD1680_GPIO_PIN_RST>=0)
+static bool ssd1680_set_rst(bool state)
+{
+  esp32_gpiowrite(CONFIG_SSD1680_GPIO_PIN_RST, state);
+  return true;
+}
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_BUSY) && (CONFIG_SSD1680_GPIO_PIN_BUSY>=0)
+static bool ssd1680_check_busy(void)
+{
+  return esp32_gpioread(CONFIG_SSD1680_GPIO_PIN_BUSY);
+}
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct lcd_dev_s    *g_lcddev;
+struct ssd1680_priv_s g_ssd1680_priv =
+{
+#if defined(CONFIG_SSD1680_GPIO_PIN_PWR) && (CONFIG_SSD1680_GPIO_PIN_PWR >= 0)
+  .set_vcc = ssd1680_set_vcc,
+#else
+  .set_vcc = NULL,
+#endif
+#if defined(CONFIG_SSD1680_GPIO_PIN_RST)  && (CONFIG_SSD1680_GPIO_PIN_RST >= 0)
+  .set_rst = ssd1680_set_rst,
+#else
+  .set_rst = NULL,
+#endif
+#if defined(CONFIG_SSD1680_GPIO_PIN_BUSY) && (CONFIG_SSD1680_GPIO_PIN_BUSY >= 0)
+  .check_busy = ssd1680_check_busy,
+#else
+  .check_busy = NULL,
+#endif
+};
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_lcd_initialize
+ ****************************************************************************/
+
+int board_lcd_initialize(void)
+{
+  struct spi_dev_s *spi;
+
+  /* Initialize additional I/O for e-ink display */
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_DTA_CMD) && \
+  (CONFIG_SSD1680_GPIO_PIN_DTA_CMD >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_DTA_CMD, OUTPUT);
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_PWR) && (CONFIG_SSD1680_GPIO_PIN_PWR >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_PWR, OUTPUT);
+  lcdinfo("Using pin %d as PWR control\n", CONFIG_SSD1680_GPIO_PIN_PWR);
+#else
+  lcdinfo("PWR control line is disabled\n");
+#endif
+#if defined(CONFIG_SSD1680_GPIO_PIN_RST) && (CONFIG_SSD1680_GPIO_PIN_RST >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_RST, OUTPUT);
+  lcdinfo("Using pin %d as RESET\n", CONFIG_SSD1680_GPIO_PIN_RST);
+#elif
+  lcdinfo("RESET line is disabled\n");
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_BUSY) && \
+  (CONFIG_SSD1680_GPIO_PIN_BUSY >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_BUSY, INPUT | PULLUP);
+  lcdinfo("Using pin %d for reading busy state\n",
+    CONFIG_SSD1680_GPIO_PIN_BUSY);
+#elif
+  lcdinfo("Read busy line is disabled\n");
+#endif
+
+  /* Initialize SPI */
+
+  spi = esp32_spibus_initialize(CONFIG_SSD1680_SPI_BUS);
+  if (!spi)
+    {
+      lcderr("ERROR: Failed to initialize SPI port %d\n",
+        CONFIG_SSD1680_SPI_BUS);

Review Comment:
   OK. I have applied suggestions. Thx. for Your remark.



-- 
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 #6418: Eps32 Lilygo t5v2 BSP

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


##########
boards/xtensa/esp32/ttgo_eink5_v2/src/esp32_bringup.c:
##########
@@ -0,0 +1,539 @@
+/****************************************************************************
+ * boards/xtensa/esp32/ttgo_eink5_v2/src/esp32_bringup.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 <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <syslog.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <syslog.h>
+#include <debug.h>
+#include <stdio.h>
+
+#include <errno.h>
+
+#if defined(CONFIG_VIDEO_FB) && defined(CONFIG_LCD_FRAMEBUFFER)
+#include <nuttx/video/fb.h>
+#endif
+
+#if defined(CONFIG_ESP32_EFUSE)
+#include <nuttx/efuse/efuse.h>
+#endif
+#include <nuttx/fs/fs.h>
+#include <nuttx/himem/himem.h>
+
+#if defined(CONFIG_ESP32_EFUSE)
+#include "esp32_efuse.h"

Review Comment:
   ```suggestion
   #  include "esp32_efuse.h"
   ```



##########
boards/xtensa/esp32/ttgo_eink5_v2/src/esp32_bringup.c:
##########
@@ -0,0 +1,539 @@
+/****************************************************************************
+ * boards/xtensa/esp32/ttgo_eink5_v2/src/esp32_bringup.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 <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <syslog.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <syslog.h>
+#include <debug.h>
+#include <stdio.h>
+
+#include <errno.h>
+
+#if defined(CONFIG_VIDEO_FB) && defined(CONFIG_LCD_FRAMEBUFFER)
+#include <nuttx/video/fb.h>
+#endif
+
+#if defined(CONFIG_ESP32_EFUSE)
+#include <nuttx/efuse/efuse.h>

Review Comment:
   can be merged to `#if defined(CONFIG_ESP32_EFUSE)` below



-- 
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 commented on a diff in pull request #6418: Eps32 Lilygo t5v2 BSP

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


##########
boards/xtensa/esp32/common/Kconfig:
##########
@@ -60,6 +60,35 @@ choice ESP32_SPIFLASH_FS
 
 endchoice
 
+if LCD_SSD1680
+config SSD1680_GPIO_PIN_RST
+	int "Pin that handles the reset line (output)"
+	default "12" if ARCH_BOARD_TTGO_T5V2_ESP32
+
+config SSD1680_GPIO_PIN_BUSY
+	int "Pin that handles the busy line (input)"
+	default "4" if ARCH_BOARD_TTGO_T5V2_ESP32
+
+config SSD1680_GPIO_PIN_PWR
+	int "Pin that handles the pwr on/off line (output)"
+	default "-1" if ARCH_BOARD_TTGO_T5V2_ESP32
+
+config SSD1680_GPIO_PIN_CS
+	int "Pin that select the chip on SPI bus"
+	default "5" if ARCH_BOARD_TTGO_T5V2_ESP32
+
+config SSD1680_GPIO_PIN_DTA_CMD
+	int "Pin that switch between command and data on 4-wire SPI bus"
+	default "19" if ARCH_BOARD_TTGO_T5V2_ESP32
+
+config SSD1680_SPI_BUS
+	int "Spi bus no"

Review Comment:
   I think you missed my comment from old PR



##########
boards/xtensa/esp32/common/Kconfig:
##########
@@ -60,6 +60,35 @@ choice ESP32_SPIFLASH_FS
 
 endchoice
 
+if LCD_SSD1680
+config SSD1680_GPIO_PIN_RST
+	int "Pin that handles the reset line (output)"
+	default "12" if ARCH_BOARD_TTGO_T5V2_ESP32
+
+config SSD1680_GPIO_PIN_BUSY
+	int "Pin that handles the busy line (input)"
+	default "4" if ARCH_BOARD_TTGO_T5V2_ESP32
+
+config SSD1680_GPIO_PIN_PWR
+	int "Pin that handles the pwr on/off line (output)"
+	default "-1" if ARCH_BOARD_TTGO_T5V2_ESP32
+
+config SSD1680_GPIO_PIN_CS
+	int "Pin that select the chip on SPI bus"
+	default "5" if ARCH_BOARD_TTGO_T5V2_ESP32
+
+config SSD1680_GPIO_PIN_DTA_CMD
+	int "Pin that switch between command and data on 4-wire SPI bus"
+	default "19" if ARCH_BOARD_TTGO_T5V2_ESP32
+
+config SSD1680_SPI_BUS
+	int "Spi bus no"

Review Comment:
   ```suggestion
   	int "SPI Bus Number"
   ```



-- 
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 #6418: Eps32 Lilygo t5v2 BSP

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


##########
boards/xtensa/esp32/common/include/esp32_ssd1680.h:
##########
@@ -0,0 +1,64 @@
+/****************************************************************************
+ * boards/xtensa/esp32/common/include/esp32_ssd1680.h
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_SSD1680_H
+#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_SSD1680_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_ssd1680_getdev
+ *
+ * Description:
+ *   Get the SSD1680 device driver instance
+ *
+ * Returned Value:
+ *   Pointer to the instance
+ *
+ ****************************************************************************/
+
+FAR struct lcd_dev_s *board_ssd1680_getdev(void);

Review Comment:
   ```suggestion
   struct lcd_dev_s *board_ssd1680_getdev(void);
   ```



##########
boards/xtensa/esp32/common/include/esp32_ssd1680.h:
##########
@@ -0,0 +1,64 @@
+/****************************************************************************
+ * boards/xtensa/esp32/common/include/esp32_ssd1680.h
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_SSD1680_H
+#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_SSD1680_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_ssd1680_getdev
+ *
+ * Description:
+ *   Get the SSD1680 device driver instance
+ *
+ * Returned Value:
+ *   Pointer to the instance
+ *
+ ****************************************************************************/
+
+FAR struct lcd_dev_s *board_ssd1680_getdev(void);
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_SSD1680_H */

Review Comment:
   ```suggestion
   #endif /* __BOARDS_XTENSA_ESP32_COMMON_INCLUDE_ESP32_SSD1680_H */
   ```



##########
boards/xtensa/esp32/common/include/esp32_ssd1680.h:
##########
@@ -0,0 +1,64 @@
+/****************************************************************************
+ * boards/xtensa/esp32/common/include/esp32_ssd1680.h
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_SSD1680_H
+#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_SSD1680_H

Review Comment:
   ```suggestion
   #ifndef __BOARDS_XTENSA_ESP32_COMMON_INCLUDE_ESP32_SSD1680_H
   #define __BOARDS_XTENSA_ESP32_COMMON_INCLUDE_ESP32_SSD1680_H
   ```



##########
boards/xtensa/esp32/ttgo_eink5_v2/src/esp32_boot.c:
##########
@@ -0,0 +1,96 @@
+/****************************************************************************
+ * boards/xtensa/esp32/ttgo_eink5_v2/src/esp32_boot.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/mm/mm.h>
+#include <arch/board/board.h>
+#include <arch/esp32/memory_layout.h>
+
+#include "ttgo_eink5_v2.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: esp32_board_initialize
+ *
+ * Description:
+ *   All ESP32 architectures must provide the following entry point.
+ *   This entry point is called early in the initialization -- after all
+ *   memory has been configured and mapped but before any devices have been
+ *   initialized.
+ *
+ ****************************************************************************/
+
+void esp32_board_initialize(void)
+{
+}
+
+/****************************************************************************
+ * Name: board_late_initialize
+ *
+ * Description:
+ *   If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
+ *   initialization call will be performed in the boot-up sequence to a
+ *   function called board_late_initialize().  board_late_initialize() will
+ *   be called immediately after up_initialize() is called and just before
+ *   the initial application is started.  This additional initialization
+ *   phase may be used, for example, to initialize board-specific device
+ *   drivers.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_BOARD_LATE_INITIALIZE
+void board_late_initialize(void)
+{
+  /* Perform board-specific initialization */
+
+  esp32_bringup();
+
+#ifdef CONFIG_SMP
+  /* To avoid corrupting the heap, this region of memory (~3KB) is not
+   * included until the APP CPU has started.
+   * So we can't add it with the rest of the regions at xtensa_add_region(),
+   * that function is called early from up_initialize().  We wait until the
+   * SMP bringup is complete.
+   */
+
+  umm_addregion((FAR void *)HEAP_REGION_ROMAPP_START,

Review Comment:
   ```suggestion
     umm_addregion((void *)HEAP_REGION_ROMAPP_START,
   ```



##########
boards/xtensa/esp32/ttgo_eink5_v2/src/esp32_gpio.c:
##########
@@ -0,0 +1,391 @@
+/****************************************************************************
+ * boards/xtensa/esp32/ttgo_eink5_v2/src/esp32_gpio.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 <sys/types.h>
+#include <nuttx/irq.h>
+#include <arch/irq.h>
+#include <assert.h>
+#include <debug.h>
+
+#include <nuttx/ioexpander/gpio.h>
+
+#include <arch/board/board.h>
+
+#include "ttgo_eink5_v2.h"
+#include "esp32_gpio.h"
+#include "hardware/esp32_gpio_sigmap.h"
+
+#if defined(CONFIG_DEV_GPIO) && !defined(CONFIG_GPIO_LOWER_HALF)
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if !defined(CONFIG_ESP32_GPIO_IRQ) && BOARD_NGPIOINT > 0
+#  error "NGPIOINT is > 0 and GPIO interrupts aren't enabled"
+#endif
+
+/* Output pins. GPIO15 is used as an example, any other outputs could be
+ * used.
+ */
+
+#define GPIO_OUT1    15
+
+/* Input pins. GPIO18 is used as an example, any other inputs could be
+ * used.
+ */
+
+#define GPIO_IN1     18
+
+/* Interrupt pins.  GPIO22 is used as an example, any other inputs could be
+ * used.
+ */
+
+#define GPIO_IRQPIN1  22
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+struct esp32gpio_dev_s
+{
+  struct gpio_dev_s gpio;
+  uint8_t id;
+};
+
+struct esp32gpint_dev_s
+{
+  struct esp32gpio_dev_s esp32gpio;
+  pin_interrupt_t callback;
+};
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+#if BOARD_NGPIOOUT > 0
+static int gpout_read(FAR struct gpio_dev_s *dev, FAR bool *value);

Review Comment:
   ramove `FAR` here and in other places in this file



##########
boards/xtensa/esp32/ttgo_eink5_v2/src/esp32_buttons.c:
##########
@@ -0,0 +1,168 @@
+/****************************************************************************
+ * boards/xtensa/esp32/ttgo_eink5_v2/src/esp32_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 <assert.h>
+#include <debug.h>
+#include <errno.h>
+#include <stdbool.h>
+#include <stdio.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/board.h>
+#include <nuttx/irq.h>
+#include <arch/irq.h>
+
+#include "esp32_gpio.h"
+
+#include "ttgo_eink5_v2.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)
+{
+  esp32_configgpio(BUTN1, INPUT_FUNCTION_3 | PULLUP);
+  esp32_configgpio(BUTN2, INPUT_FUNCTION_3 | PULLUP);
+  esp32_configgpio(BUTN3, INPUT_FUNCTION_3 | PULLUP);
+  return 1;
+}
+
+/****************************************************************************
+ * Name: board_buttons
+ *
+ * Description:
+ *   After board_button_initialize() has been called, board_buttons() may be
+ *   called to collect the state of all buttons.  board_buttons() returns an
+ *   8-bit bit set with each bit associated with a button.  See the
+ *   BUTTON_*_BIT  definitions in board.h for the meaning of each bit.
+ *
+ ****************************************************************************/
+
+uint32_t board_buttons(void)
+{
+  uint8_t ret = 0;
+  int i = 0;
+  int n = 0;
+
+  bool b0 = esp32_gpioread(BUTTON_BOOT);
+
+  for (i = 0; i < 10; i++)
+    {
+      up_mdelay(1); /* TODO */
+
+      bool b1 = esp32_gpioread(BUTTON_BOOT);
+
+      if (b0 == b1)
+        {
+          n++;
+        }
+      else
+        {
+          n = 0;
+        }
+
+      if (3 == n)
+        {
+          break;
+        }
+
+      b0 = b1;
+    }
+
+  iinfo("b=%d n=%d\n", b0, n);
+
+  /* Low value means that the button is pressed */
+
+  if (!b0)
+    {
+      ret = 0x1;
+    }
+
+  return ret;
+}
+
+/****************************************************************************
+ * Name: board_button_irq
+ *
+ * Description:
+ *   board_button_irq() may be called to register an interrupt handler that
+ *   will be called when a button is depressed or released.  The ID value is
+ *   a button enumeration value that uniquely identifies a button resource.
+ *   See the BUTTON_* definitions in board.h for the meaning of enumeration
+ *   value.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_IRQBUTTONS
+int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)

Review Comment:
   ```suggestion
   int board_button_irq(int id, xcpt_t irqhandler, void *arg)
   ```



-- 
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 #6418: Eps32 Lilygo t5v2 BSP

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


##########
boards/xtensa/esp32/common/src/esp32_ssd1680.c:
##########
@@ -0,0 +1,189 @@
+/****************************************************************************
+ * boards/xtensa/esp32/common/src/esp32_ssd1680.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/ssd1680.h>
+#include <nuttx/spi/spi.h>
+
+#if defined(CONFIG_VIDEO_FB) && defined(CONFIG_LCD_FRAMEBUFFER)
+#  include <nuttx/video/fb.h>
+#endif
+
+#include "esp32_gpio.h"
+#include "esp32_spi.h"
+
+#ifdef CONFIG_LCD_SSD1680
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_PWR) && (CONFIG_SSD1680_GPIO_PIN_PWR>=0)
+static bool ssd1680_set_vcc(bool state)
+{
+  esp32_gpiowrite(CONFIG_SSD1680_GPIO_PIN_PWR, state);
+  return true;
+}
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_RST) && (CONFIG_SSD1680_GPIO_PIN_RST>=0)
+static bool ssd1680_set_rst(bool state)
+{
+  esp32_gpiowrite(CONFIG_SSD1680_GPIO_PIN_RST, state);
+  return true;
+}
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_BUSY) && (CONFIG_SSD1680_GPIO_PIN_BUSY>=0)
+static bool ssd1680_check_busy(void)
+{
+  return esp32_gpioread(CONFIG_SSD1680_GPIO_PIN_BUSY);
+}
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct lcd_dev_s    *g_lcddev;
+struct ssd1680_priv_s g_ssd1680_priv =
+{
+#if defined(CONFIG_SSD1680_GPIO_PIN_PWR) && (CONFIG_SSD1680_GPIO_PIN_PWR >= 0)
+  .set_vcc = ssd1680_set_vcc,
+#else
+  .set_vcc = NULL,
+#endif
+#if defined(CONFIG_SSD1680_GPIO_PIN_RST)  && (CONFIG_SSD1680_GPIO_PIN_RST >= 0)
+  .set_rst = ssd1680_set_rst,
+#else
+  .set_rst = NULL,
+#endif
+#if defined(CONFIG_SSD1680_GPIO_PIN_BUSY) && (CONFIG_SSD1680_GPIO_PIN_BUSY >= 0)
+  .check_busy = ssd1680_check_busy,
+#else
+  .check_busy = NULL,
+#endif
+};
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_lcd_initialize
+ ****************************************************************************/
+
+int board_lcd_initialize(void)
+{
+  struct spi_dev_s *spi;
+
+  /* Initialize additional I/O for e-ink display */
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_DTA_CMD) && \
+  (CONFIG_SSD1680_GPIO_PIN_DTA_CMD >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_DTA_CMD, OUTPUT);
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_PWR) && (CONFIG_SSD1680_GPIO_PIN_PWR >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_PWR, OUTPUT);
+  lcdinfo("Using pin %d as PWR control\n", CONFIG_SSD1680_GPIO_PIN_PWR);
+#else
+  lcdinfo("PWR control line is disabled\n");
+#endif
+#if defined(CONFIG_SSD1680_GPIO_PIN_RST) && (CONFIG_SSD1680_GPIO_PIN_RST >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_RST, OUTPUT);
+  lcdinfo("Using pin %d as RESET\n", CONFIG_SSD1680_GPIO_PIN_RST);
+#elif
+  lcdinfo("RESET line is disabled\n");
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_BUSY) && \
+  (CONFIG_SSD1680_GPIO_PIN_BUSY >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_BUSY, INPUT | PULLUP);
+  lcdinfo("Using pin %d for reading busy state\n",
+    CONFIG_SSD1680_GPIO_PIN_BUSY);
+#elif
+  lcdinfo("Read busy line is disabled\n");
+#endif
+
+  /* Initialize SPI */
+
+  spi = esp32_spibus_initialize(CONFIG_SSD1680_SPI_BUS);
+  if (!spi)
+    {
+      lcderr("ERROR: Failed to initialize SPI port %d\n",
+        CONFIG_SSD1680_SPI_BUS);
+      return -ENODEV;
+    }
+  else
+    {
+      lcdinfo("Using SPI bus %d. SPI is initialized\n",
+        CONFIG_SSD1680_SPI_BUS);

Review Comment:
   ```suggestion
         lcdinfo("Using SPI bus %d. SPI is initialized\n",
                 CONFIG_SSD1680_SPI_BUS);
   ```



##########
boards/xtensa/esp32/common/src/esp32_ssd1680.c:
##########
@@ -0,0 +1,189 @@
+/****************************************************************************
+ * boards/xtensa/esp32/common/src/esp32_ssd1680.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/ssd1680.h>
+#include <nuttx/spi/spi.h>
+
+#if defined(CONFIG_VIDEO_FB) && defined(CONFIG_LCD_FRAMEBUFFER)
+#  include <nuttx/video/fb.h>
+#endif
+
+#include "esp32_gpio.h"
+#include "esp32_spi.h"
+
+#ifdef CONFIG_LCD_SSD1680
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_PWR) && (CONFIG_SSD1680_GPIO_PIN_PWR>=0)
+static bool ssd1680_set_vcc(bool state)
+{
+  esp32_gpiowrite(CONFIG_SSD1680_GPIO_PIN_PWR, state);
+  return true;
+}
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_RST) && (CONFIG_SSD1680_GPIO_PIN_RST>=0)
+static bool ssd1680_set_rst(bool state)
+{
+  esp32_gpiowrite(CONFIG_SSD1680_GPIO_PIN_RST, state);
+  return true;
+}
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_BUSY) && (CONFIG_SSD1680_GPIO_PIN_BUSY>=0)
+static bool ssd1680_check_busy(void)
+{
+  return esp32_gpioread(CONFIG_SSD1680_GPIO_PIN_BUSY);
+}
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct lcd_dev_s    *g_lcddev;
+struct ssd1680_priv_s g_ssd1680_priv =
+{
+#if defined(CONFIG_SSD1680_GPIO_PIN_PWR) && (CONFIG_SSD1680_GPIO_PIN_PWR >= 0)
+  .set_vcc = ssd1680_set_vcc,
+#else
+  .set_vcc = NULL,
+#endif
+#if defined(CONFIG_SSD1680_GPIO_PIN_RST)  && (CONFIG_SSD1680_GPIO_PIN_RST >= 0)
+  .set_rst = ssd1680_set_rst,
+#else
+  .set_rst = NULL,
+#endif
+#if defined(CONFIG_SSD1680_GPIO_PIN_BUSY) && (CONFIG_SSD1680_GPIO_PIN_BUSY >= 0)
+  .check_busy = ssd1680_check_busy,
+#else
+  .check_busy = NULL,
+#endif
+};
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_lcd_initialize
+ ****************************************************************************/
+
+int board_lcd_initialize(void)
+{
+  struct spi_dev_s *spi;
+
+  /* Initialize additional I/O for e-ink display */
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_DTA_CMD) && \
+  (CONFIG_SSD1680_GPIO_PIN_DTA_CMD >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_DTA_CMD, OUTPUT);
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_PWR) && (CONFIG_SSD1680_GPIO_PIN_PWR >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_PWR, OUTPUT);
+  lcdinfo("Using pin %d as PWR control\n", CONFIG_SSD1680_GPIO_PIN_PWR);
+#else
+  lcdinfo("PWR control line is disabled\n");
+#endif
+#if defined(CONFIG_SSD1680_GPIO_PIN_RST) && (CONFIG_SSD1680_GPIO_PIN_RST >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_RST, OUTPUT);
+  lcdinfo("Using pin %d as RESET\n", CONFIG_SSD1680_GPIO_PIN_RST);
+#elif
+  lcdinfo("RESET line is disabled\n");
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_BUSY) && \
+  (CONFIG_SSD1680_GPIO_PIN_BUSY >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_BUSY, INPUT | PULLUP);
+  lcdinfo("Using pin %d for reading busy state\n",
+    CONFIG_SSD1680_GPIO_PIN_BUSY);
+#elif
+  lcdinfo("Read busy line is disabled\n");
+#endif
+
+  /* Initialize SPI */
+
+  spi = esp32_spibus_initialize(CONFIG_SSD1680_SPI_BUS);
+  if (!spi)
+    {
+      lcderr("ERROR: Failed to initialize SPI port %d\n",
+        CONFIG_SSD1680_SPI_BUS);

Review Comment:
   ```suggestion
         lcderr("ERROR: Failed to initialize SPI port %d\n",
                CONFIG_SSD1680_SPI_BUS);
   ```



##########
boards/xtensa/esp32/common/src/esp32_ssd1680.c:
##########
@@ -0,0 +1,189 @@
+/****************************************************************************
+ * boards/xtensa/esp32/common/src/esp32_ssd1680.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/ssd1680.h>
+#include <nuttx/spi/spi.h>
+
+#if defined(CONFIG_VIDEO_FB) && defined(CONFIG_LCD_FRAMEBUFFER)
+#  include <nuttx/video/fb.h>
+#endif
+
+#include "esp32_gpio.h"
+#include "esp32_spi.h"
+
+#ifdef CONFIG_LCD_SSD1680
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_PWR) && (CONFIG_SSD1680_GPIO_PIN_PWR>=0)
+static bool ssd1680_set_vcc(bool state)
+{
+  esp32_gpiowrite(CONFIG_SSD1680_GPIO_PIN_PWR, state);
+  return true;
+}
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_RST) && (CONFIG_SSD1680_GPIO_PIN_RST>=0)
+static bool ssd1680_set_rst(bool state)
+{
+  esp32_gpiowrite(CONFIG_SSD1680_GPIO_PIN_RST, state);
+  return true;
+}
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_BUSY) && (CONFIG_SSD1680_GPIO_PIN_BUSY>=0)
+static bool ssd1680_check_busy(void)
+{
+  return esp32_gpioread(CONFIG_SSD1680_GPIO_PIN_BUSY);
+}
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct lcd_dev_s    *g_lcddev;
+struct ssd1680_priv_s g_ssd1680_priv =
+{
+#if defined(CONFIG_SSD1680_GPIO_PIN_PWR) && (CONFIG_SSD1680_GPIO_PIN_PWR >= 0)
+  .set_vcc = ssd1680_set_vcc,
+#else
+  .set_vcc = NULL,
+#endif
+#if defined(CONFIG_SSD1680_GPIO_PIN_RST)  && (CONFIG_SSD1680_GPIO_PIN_RST >= 0)
+  .set_rst = ssd1680_set_rst,
+#else
+  .set_rst = NULL,
+#endif
+#if defined(CONFIG_SSD1680_GPIO_PIN_BUSY) && (CONFIG_SSD1680_GPIO_PIN_BUSY >= 0)
+  .check_busy = ssd1680_check_busy,
+#else
+  .check_busy = NULL,
+#endif
+};
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_lcd_initialize
+ ****************************************************************************/
+
+int board_lcd_initialize(void)
+{
+  struct spi_dev_s *spi;
+
+  /* Initialize additional I/O for e-ink display */
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_DTA_CMD) && \
+  (CONFIG_SSD1680_GPIO_PIN_DTA_CMD >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_DTA_CMD, OUTPUT);
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_PWR) && (CONFIG_SSD1680_GPIO_PIN_PWR >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_PWR, OUTPUT);
+  lcdinfo("Using pin %d as PWR control\n", CONFIG_SSD1680_GPIO_PIN_PWR);
+#else
+  lcdinfo("PWR control line is disabled\n");
+#endif
+#if defined(CONFIG_SSD1680_GPIO_PIN_RST) && (CONFIG_SSD1680_GPIO_PIN_RST >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_RST, OUTPUT);
+  lcdinfo("Using pin %d as RESET\n", CONFIG_SSD1680_GPIO_PIN_RST);
+#elif
+  lcdinfo("RESET line is disabled\n");
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_BUSY) && \
+  (CONFIG_SSD1680_GPIO_PIN_BUSY >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_BUSY, INPUT | PULLUP);
+  lcdinfo("Using pin %d for reading busy state\n",
+    CONFIG_SSD1680_GPIO_PIN_BUSY);

Review Comment:
   ```suggestion
     lcdinfo("Using pin %d for reading busy state\n",
             CONFIG_SSD1680_GPIO_PIN_BUSY);
   ```



##########
boards/xtensa/esp32/ttgo_eink5_v2/src/ttgo_eink5_v2.h:
##########
@@ -0,0 +1,152 @@
+/****************************************************************************
+ * boards/xtensa/esp32/ttgo_eink5_v2/src/ttgo_eink5_v2.h
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+#ifndef __BOARDS_XTENSA_ESP32_TTGO_EINK5_V2_SRC_TTGO_EINK5_V2_SRC_H
+#define __BOARDS_XTENSA_ESP32_TTGO_EINK5_V2_SRC_TTGO_EINK5_V2_SRC_H

Review Comment:
   ```suggestion
   #ifndef __BOARDS_XTENSA_ESP32_TTGO_EINK5_V2_SRC_TTGO_EINK5_V2_H
   #define __BOARDS_XTENSA_ESP32_TTGO_EINK5_V2_SRC_TTGO_EINK5_V2_H
   ```



##########
boards/xtensa/esp32/ttgo_eink5_v2/src/ttgo_eink5_v2.h:
##########
@@ -0,0 +1,152 @@
+/****************************************************************************
+ * boards/xtensa/esp32/ttgo_eink5_v2/src/ttgo_eink5_v2.h
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+#ifndef __BOARDS_XTENSA_ESP32_TTGO_EINK5_V2_SRC_TTGO_EINK5_V2_SRC_H
+#define __BOARDS_XTENSA_ESP32_TTGO_EINK5_V2_SRC_TTGO_EINK5_V2_SRC_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+#include <stdint.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* ESP32-DevKitC GPIOs ******************************************************/
+
+/* BOOT Button */
+
+#define BUTN1  37
+#define BUTN2  38
+#define BUTN3  39
+
+/* Sound PWM Out */
+
+#define SND 25
+
+/* E-INK SSD1680 Out */
+
+/* LED
+ *
+ * This is an externally connected LED used for testing.
+ */
+
+#define GPIO_LED1             26
+
+/* MCP2515 Interrupt pin */
+
+#define GPIO_MCP2515_IRQ      22
+
+/* TIMERS */
+
+#define TIMER0 0
+#define TIMER1 1
+#define TIMER2 2
+#define TIMER3 3
+
+/* ONESHOT */
+
+#define ONESHOT_TIMER         1
+#define ONESHOT_RESOLUTION_US 1
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: esp32_bringup
+ *
+ * Description:
+ *   Perform architecture-specific initialization
+ *
+ *   CONFIG_BOARD_LATE_INITIALIZE=y :
+ *     Called from board_late_initialize().
+ *
+ *   CONFIG_BOARD_LATE_INITIALIZE=y && CONFIG_BOARDCTL=y :
+ *     Called from the NSH library via board_app_initialize()
+ *
+ ****************************************************************************/
+
+int esp32_bringup(void);
+
+/****************************************************************************
+ * Name: esp32_mmcsd_initialize
+ *
+ * Description:
+ *   Initialize SPI-based SD card and card detect thread.
+ ****************************************************************************/
+
+int esp32_mmcsd_initialize(int minor);
+
+/****************************************************************************
+ * Name: esp32_gpio_init
+ ****************************************************************************/
+
+#ifdef CONFIG_DEV_GPIO
+int esp32_gpio_init(void);
+#endif
+
+/****************************************************************************
+ * Name: esp32_ledc_setup
+ *
+ * Description:
+ *   Initialize LEDC PWM and register the PWM device.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ESP32_LEDC
+int esp32_pwm_setup(void);
+#endif
+
+/****************************************************************************
+ * Name: board_spidev_initialize
+ *
+ * Description:
+ *   Initialize SPI driver and register the /dev/spi device.
+ *
+ * Input Parameters:
+ *   bus - The SPI bus number, used to build the device path as /dev/spiN
+ *
+ * Returned Value:
+ *   Zero (OK) is returned on success; A negated errno value is returned
+ *   to indicate the nature of any failure.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_SPI_DRIVER
+int board_spidev_initialize(int bus);
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __BOARDS_XTENSA_ESP32_TTGO_EINK5_V2_SRC_TTGO_EINK5_V2_SRC_H*/

Review Comment:
   ```suggestion
   #endif /* __BOARDS_XTENSA_ESP32_TTGO_EINK5_V2_SRC_TTGO_EINK5_V2_H */
   ```



##########
boards/xtensa/esp32/common/src/esp32_ssd1680.c:
##########
@@ -0,0 +1,189 @@
+/****************************************************************************
+ * boards/xtensa/esp32/common/src/esp32_ssd1680.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/ssd1680.h>
+#include <nuttx/spi/spi.h>
+
+#if defined(CONFIG_VIDEO_FB) && defined(CONFIG_LCD_FRAMEBUFFER)
+#  include <nuttx/video/fb.h>
+#endif
+
+#include "esp32_gpio.h"
+#include "esp32_spi.h"
+
+#ifdef CONFIG_LCD_SSD1680
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_PWR) && (CONFIG_SSD1680_GPIO_PIN_PWR>=0)
+static bool ssd1680_set_vcc(bool state)
+{
+  esp32_gpiowrite(CONFIG_SSD1680_GPIO_PIN_PWR, state);
+  return true;
+}
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_RST) && (CONFIG_SSD1680_GPIO_PIN_RST>=0)
+static bool ssd1680_set_rst(bool state)
+{
+  esp32_gpiowrite(CONFIG_SSD1680_GPIO_PIN_RST, state);
+  return true;
+}
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_BUSY) && (CONFIG_SSD1680_GPIO_PIN_BUSY>=0)
+static bool ssd1680_check_busy(void)
+{
+  return esp32_gpioread(CONFIG_SSD1680_GPIO_PIN_BUSY);
+}
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct lcd_dev_s    *g_lcddev;
+struct ssd1680_priv_s g_ssd1680_priv =
+{
+#if defined(CONFIG_SSD1680_GPIO_PIN_PWR) && (CONFIG_SSD1680_GPIO_PIN_PWR >= 0)
+  .set_vcc = ssd1680_set_vcc,
+#else
+  .set_vcc = NULL,
+#endif
+#if defined(CONFIG_SSD1680_GPIO_PIN_RST)  && (CONFIG_SSD1680_GPIO_PIN_RST >= 0)
+  .set_rst = ssd1680_set_rst,
+#else
+  .set_rst = NULL,
+#endif
+#if defined(CONFIG_SSD1680_GPIO_PIN_BUSY) && (CONFIG_SSD1680_GPIO_PIN_BUSY >= 0)
+  .check_busy = ssd1680_check_busy,
+#else
+  .check_busy = NULL,
+#endif
+};
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_lcd_initialize
+ ****************************************************************************/
+
+int board_lcd_initialize(void)
+{
+  struct spi_dev_s *spi;
+
+  /* Initialize additional I/O for e-ink display */
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_DTA_CMD) && \
+  (CONFIG_SSD1680_GPIO_PIN_DTA_CMD >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_DTA_CMD, OUTPUT);
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_PWR) && (CONFIG_SSD1680_GPIO_PIN_PWR >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_PWR, OUTPUT);
+  lcdinfo("Using pin %d as PWR control\n", CONFIG_SSD1680_GPIO_PIN_PWR);
+#else
+  lcdinfo("PWR control line is disabled\n");
+#endif
+#if defined(CONFIG_SSD1680_GPIO_PIN_RST) && (CONFIG_SSD1680_GPIO_PIN_RST >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_RST, OUTPUT);
+  lcdinfo("Using pin %d as RESET\n", CONFIG_SSD1680_GPIO_PIN_RST);
+#elif
+  lcdinfo("RESET line is disabled\n");
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_BUSY) && \
+  (CONFIG_SSD1680_GPIO_PIN_BUSY >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_BUSY, INPUT | PULLUP);
+  lcdinfo("Using pin %d for reading busy state\n",
+    CONFIG_SSD1680_GPIO_PIN_BUSY);
+#elif
+  lcdinfo("Read busy line is disabled\n");
+#endif
+
+  /* Initialize SPI */
+
+  spi = esp32_spibus_initialize(CONFIG_SSD1680_SPI_BUS);
+  if (!spi)
+    {
+      lcderr("ERROR: Failed to initialize SPI port %d\n",
+        CONFIG_SSD1680_SPI_BUS);
+      return -ENODEV;
+    }
+  else
+    {
+      lcdinfo("Using SPI bus %d. SPI is initialized\n",
+        CONFIG_SSD1680_SPI_BUS);
+    }
+
+  /* Bind the SPI port to the E-PAPER display */
+
+  g_lcddev = ssd1680_initialize(spi, &g_ssd1680_priv);
+  if (!g_lcddev)
+    {
+      lcderr("ERROR: Failed to bind SPI port %d to E-paper display\n",
+          CONFIG_SSD1680_SPI_BUS);

Review Comment:
   ```suggestion
         lcderr("ERROR: Failed to bind SPI port %d to E-paper display\n",
                CONFIG_SSD1680_SPI_BUS);
   ```



-- 
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 #6418: Eps32 Lilygo t5v2 BSP

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


##########
boards/xtensa/esp32/ttgo_eink5_v2/scripts/Make.defs:
##########
@@ -0,0 +1,105 @@
+############################################################################
+# boards/xtensa/esp32/ttgo_eink5_v2/scripts/Make.defs
+#
+# 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.
+#
+############################################################################
+
+include $(TOPDIR)/.config
+include $(TOPDIR)/tools/Config.mk
+include $(TOPDIR)/tools/esp32/Config.mk
+include $(TOPDIR)/arch/xtensa/src/lx6/Toolchain.defs
+
+# This is the generated memory layout linker script.  It will always be
+# generated at the board level.
+
+ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_out.ld
+
+# Pick the linker scripts from the board level if they exist, if not
+# pick the common linker scripts.
+
+ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32.ld),)
+	ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32.ld
+else
+	ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y)
+		ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32_mcuboot.ld
+	else
+		ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32.ld
+	endif
+endif
+
+ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld),)
+	ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld
+else
+	ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld
+endif
+
+ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32.template.ld),)
+	LDSCRIPT_TEMPLATE = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32.template.ld
+else
+	LDSCRIPT_TEMPLATE = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32.template.ld
+endif
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+  ARCHOPTIMIZATION = -g
+endif
+
+ifeq ($(CONFIG_STACK_CANARIES),y)

Review Comment:
   OK. Id is done.



-- 
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 #6418: Eps32 Lilygo t5v2 BSP

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


##########
boards/xtensa/esp32/common/include/esp32_ssd1680.h:
##########
@@ -0,0 +1,64 @@
+/****************************************************************************
+ * boards/xtensa/esp32/common/include/esp32_ssd1680.h
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_SSD1680_H
+#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_SSD1680_H

Review Comment:
   Thx. shame on me... It is 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] xiaoxiang781216 commented on a diff in pull request #6418: Eps32 Lilygo t5v2 BSP

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


##########
boards/xtensa/esp32/ttgo_eink5_v2/scripts/Make.defs:
##########
@@ -0,0 +1,105 @@
+############################################################################
+# boards/xtensa/esp32/ttgo_eink5_v2/scripts/Make.defs
+#
+# 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.
+#
+############################################################################
+
+include $(TOPDIR)/.config
+include $(TOPDIR)/tools/Config.mk
+include $(TOPDIR)/tools/esp32/Config.mk
+include $(TOPDIR)/arch/xtensa/src/lx6/Toolchain.defs
+
+# This is the generated memory layout linker script.  It will always be
+# generated at the board level.
+
+ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_out.ld
+
+# Pick the linker scripts from the board level if they exist, if not
+# pick the common linker scripts.
+
+ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32.ld),)
+	ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32.ld
+else
+	ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y)
+		ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32_mcuboot.ld
+	else
+		ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32.ld
+	endif
+endif
+
+ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld),)
+	ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld
+else
+	ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld
+endif
+
+ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32.template.ld),)
+	LDSCRIPT_TEMPLATE = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32.template.ld
+else
+	LDSCRIPT_TEMPLATE = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32.template.ld
+endif
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+  ARCHOPTIMIZATION = -g
+endif
+
+ifeq ($(CONFIG_STACK_CANARIES),y)

Review Comment:
   many setting is moved to Toolchain.defs, so please update Make.defs by referencing other similar files on the master



-- 
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 merged pull request #6418: Eps32 Lilygo t5v2 BSP

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


-- 
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 #6418: Eps32 Lilygo t5v2 BSP

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


##########
boards/xtensa/esp32/common/src/esp32_ssd1680.c:
##########
@@ -0,0 +1,189 @@
+/****************************************************************************
+ * boards/xtensa/esp32/common/src/esp32_ssd1680.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/ssd1680.h>
+#include <nuttx/spi/spi.h>
+
+#if defined(CONFIG_VIDEO_FB) && defined(CONFIG_LCD_FRAMEBUFFER)
+#  include <nuttx/video/fb.h>
+#endif
+
+#include "esp32_gpio.h"
+#include "esp32_spi.h"
+
+#ifdef CONFIG_LCD_SSD1680
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_PWR) && (CONFIG_SSD1680_GPIO_PIN_PWR>=0)
+static bool ssd1680_set_vcc(bool state)
+{
+  esp32_gpiowrite(CONFIG_SSD1680_GPIO_PIN_PWR, state);
+  return true;
+}
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_RST) && (CONFIG_SSD1680_GPIO_PIN_RST>=0)
+static bool ssd1680_set_rst(bool state)
+{
+  esp32_gpiowrite(CONFIG_SSD1680_GPIO_PIN_RST, state);
+  return true;
+}
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_BUSY) && (CONFIG_SSD1680_GPIO_PIN_BUSY>=0)
+static bool ssd1680_check_busy(void)
+{
+  return esp32_gpioread(CONFIG_SSD1680_GPIO_PIN_BUSY);
+}
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct lcd_dev_s    *g_lcddev;
+struct ssd1680_priv_s g_ssd1680_priv =
+{
+#if defined(CONFIG_SSD1680_GPIO_PIN_PWR) && (CONFIG_SSD1680_GPIO_PIN_PWR >= 0)
+  .set_vcc = ssd1680_set_vcc,
+#else
+  .set_vcc = NULL,
+#endif
+#if defined(CONFIG_SSD1680_GPIO_PIN_RST)  && (CONFIG_SSD1680_GPIO_PIN_RST >= 0)
+  .set_rst = ssd1680_set_rst,
+#else
+  .set_rst = NULL,
+#endif
+#if defined(CONFIG_SSD1680_GPIO_PIN_BUSY) && (CONFIG_SSD1680_GPIO_PIN_BUSY >= 0)
+  .check_busy = ssd1680_check_busy,
+#else
+  .check_busy = NULL,
+#endif
+};
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_lcd_initialize
+ ****************************************************************************/
+
+int board_lcd_initialize(void)
+{
+  struct spi_dev_s *spi;
+
+  /* Initialize additional I/O for e-ink display */
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_DTA_CMD) && \
+  (CONFIG_SSD1680_GPIO_PIN_DTA_CMD >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_DTA_CMD, OUTPUT);
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_PWR) && (CONFIG_SSD1680_GPIO_PIN_PWR >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_PWR, OUTPUT);
+  lcdinfo("Using pin %d as PWR control\n", CONFIG_SSD1680_GPIO_PIN_PWR);
+#else
+  lcdinfo("PWR control line is disabled\n");
+#endif
+#if defined(CONFIG_SSD1680_GPIO_PIN_RST) && (CONFIG_SSD1680_GPIO_PIN_RST >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_RST, OUTPUT);
+  lcdinfo("Using pin %d as RESET\n", CONFIG_SSD1680_GPIO_PIN_RST);
+#elif
+  lcdinfo("RESET line is disabled\n");
+#endif
+
+#if defined(CONFIG_SSD1680_GPIO_PIN_BUSY) && \
+  (CONFIG_SSD1680_GPIO_PIN_BUSY >= 0)
+  esp32_configgpio(CONFIG_SSD1680_GPIO_PIN_BUSY, INPUT | PULLUP);
+  lcdinfo("Using pin %d for reading busy state\n",
+    CONFIG_SSD1680_GPIO_PIN_BUSY);

Review Comment:
   OK. I have applied suggestions. Thx. for Your remark.



##########
boards/xtensa/esp32/ttgo_eink5_v2/src/ttgo_eink5_v2.h:
##########
@@ -0,0 +1,152 @@
+/****************************************************************************
+ * boards/xtensa/esp32/ttgo_eink5_v2/src/ttgo_eink5_v2.h
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+#ifndef __BOARDS_XTENSA_ESP32_TTGO_EINK5_V2_SRC_TTGO_EINK5_V2_SRC_H
+#define __BOARDS_XTENSA_ESP32_TTGO_EINK5_V2_SRC_TTGO_EINK5_V2_SRC_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+#include <stdint.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* ESP32-DevKitC GPIOs ******************************************************/
+
+/* BOOT Button */
+
+#define BUTN1  37
+#define BUTN2  38
+#define BUTN3  39
+
+/* Sound PWM Out */
+
+#define SND 25
+
+/* E-INK SSD1680 Out */
+
+/* LED
+ *
+ * This is an externally connected LED used for testing.
+ */
+
+#define GPIO_LED1             26
+
+/* MCP2515 Interrupt pin */
+
+#define GPIO_MCP2515_IRQ      22
+
+/* TIMERS */
+
+#define TIMER0 0
+#define TIMER1 1
+#define TIMER2 2
+#define TIMER3 3
+
+/* ONESHOT */
+
+#define ONESHOT_TIMER         1
+#define ONESHOT_RESOLUTION_US 1
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: esp32_bringup
+ *
+ * Description:
+ *   Perform architecture-specific initialization
+ *
+ *   CONFIG_BOARD_LATE_INITIALIZE=y :
+ *     Called from board_late_initialize().
+ *
+ *   CONFIG_BOARD_LATE_INITIALIZE=y && CONFIG_BOARDCTL=y :
+ *     Called from the NSH library via board_app_initialize()
+ *
+ ****************************************************************************/
+
+int esp32_bringup(void);
+
+/****************************************************************************
+ * Name: esp32_mmcsd_initialize
+ *
+ * Description:
+ *   Initialize SPI-based SD card and card detect thread.
+ ****************************************************************************/
+
+int esp32_mmcsd_initialize(int minor);
+
+/****************************************************************************
+ * Name: esp32_gpio_init
+ ****************************************************************************/
+
+#ifdef CONFIG_DEV_GPIO
+int esp32_gpio_init(void);
+#endif
+
+/****************************************************************************
+ * Name: esp32_ledc_setup
+ *
+ * Description:
+ *   Initialize LEDC PWM and register the PWM device.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ESP32_LEDC
+int esp32_pwm_setup(void);
+#endif
+
+/****************************************************************************
+ * Name: board_spidev_initialize
+ *
+ * Description:
+ *   Initialize SPI driver and register the /dev/spi device.
+ *
+ * Input Parameters:
+ *   bus - The SPI bus number, used to build the device path as /dev/spiN
+ *
+ * Returned Value:
+ *   Zero (OK) is returned on success; A negated errno value is returned
+ *   to indicate the nature of any failure.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_SPI_DRIVER
+int board_spidev_initialize(int bus);
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __BOARDS_XTENSA_ESP32_TTGO_EINK5_V2_SRC_TTGO_EINK5_V2_SRC_H*/

Review Comment:
   OK. I have applied suggestions. Thx. for Your remark.



-- 
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 #6418: Eps32 Lilygo t5v2 BSP

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


##########
boards/xtensa/esp32/ttgo_eink5_v2/src/ttgo_eink5_v2.h:
##########
@@ -0,0 +1,152 @@
+/****************************************************************************
+ * boards/xtensa/esp32/ttgo_eink5_v2/src/ttgo_eink5_v2.h
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+#ifndef __BOARDS_XTENSA_ESP32_TTGO_EINK5_V2_SRC_TTGO_EINK5_V2_SRC_H
+#define __BOARDS_XTENSA_ESP32_TTGO_EINK5_V2_SRC_TTGO_EINK5_V2_SRC_H

Review Comment:
   OK. I have applied suggestions. Thx. for Your remark.



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