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/03/29 04:14:24 UTC

[GitHub] [incubator-nuttx] lupyuen commented on a change in pull request #5898: riscv/bl602: Implement SPI Cmd/Data

lupyuen commented on a change in pull request #5898:
URL: https://github.com/apache/incubator-nuttx/pull/5898#discussion_r837038194



##########
File path: arch/risc-v/src/bl602/bl602_spi.c
##########
@@ -695,10 +709,41 @@ static uint8_t bl602_spi_status(struct spi_dev_s *dev, uint32_t devid)
 static int bl602_spi_cmddata(struct spi_dev_s *dev,
                               uint32_t devid, bool cmd)
 {
+  spiinfo("devid: %" PRIu32 " CMD: %s\n", devid, cmd ? "command" :
+          "data");
+
+#if defined(CONFIG_LCD_ST7735) || defined(CONFIG_LCD_ST7789) || \
+    defined(CONFIG_LCD_GC9A01)

Review comment:
       Excellent suggestion. I copied this from ESP32-C3, I'm not sure what's the intention of the #if check?
   
   From [esp32c3_board_spi.c](https://github.com/lupyuen/incubator-nuttx/blob/st7789/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_board_spi.c#L58-L86)
   
   ```c
   #if defined(CONFIG_ESP32C3_SPI2) && defined(CONFIG_SPI_CMDDATA)
   
   int esp32c3_spi2_cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
   {
   #if defined(CONFIG_LCD_ST7735) || defined(CONFIG_LCD_ST7789) || \
       defined(CONFIG_LCD_GC9A01)
     if (devid == SPIDEV_DISPLAY(0))
       {
         /*  This is the Data/Command control pad which determines whether the
          *  data bits are data or a command.
          */
   
         esp32c3_gpiowrite(CONFIG_ESP32C3_SPI2_MISOPIN, !cmd);
   
         return OK;
       }
   
   #endif
     spiinfo("devid: %" PRIu32 " CMD: %s\n", devid, cmd ? "command" :
             "data");
   
     return -ENODEV;
   }
   
   #endif




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