You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "SimonFilgis (via GitHub)" <gi...@apache.org> on 2023/02/01 13:48:56 UTC

[GitHub] [nuttx] SimonFilgis opened a new pull request, #8398: Dynamic adjustment of the orientation and offset to support orientati…

SimonFilgis opened a new pull request, #8398:
URL: https://github.com/apache/nuttx/pull/8398

   …on switch on the fly
   
   ## Summary
   
   ## Impact
   
   ## Testing
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] SimonFilgis commented on a diff in pull request #8398: Dynamic adjustment of the orientation and offset to support orientati…

Posted by "SimonFilgis (via GitHub)" <gi...@apache.org>.
SimonFilgis commented on code in PR #8398:
URL: https://github.com/apache/nuttx/pull/8398#discussion_r1093307791


##########
drivers/lcd/st7789.c:
##########
@@ -80,16 +80,20 @@
       defined(CONFIG_LCD_RPORTRAIT)
 #    error "Cannot define both portrait and any other orientations"
 #  endif
+#  define LCD_STDORIENTATION LCD_PORTRAIT
 #elif defined(CONFIG_LCD_RPORTRAIT)
 #  if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RLANDSCAPE)
 #    error "Cannot define both rportrait and any other orientations"
 #  endif
+#  define LCD_STDORIENTATION LCD_RPORTRAIT
 #elif defined(CONFIG_LCD_LANDSCAPE)
 #  ifdef CONFIG_LCD_RLANDSCAPE
 #    error "Cannot define both landscape and any other orientations"
 #  endif
+#  define LCD_STDORIENTATION LCD_LANDSCAPE
 #elif !defined(CONFIG_LCD_RLANDSCAPE)
 #  define CONFIG_LCD_LANDSCAPE 1
+#  define LCD_STDORIENTATION LCD_RLANDSCAPE

Review Comment:
   No



##########
drivers/lcd/st7789.c:
##########
@@ -80,16 +80,20 @@
       defined(CONFIG_LCD_RPORTRAIT)
 #    error "Cannot define both portrait and any other orientations"
 #  endif
+#  define LCD_STDORIENTATION LCD_PORTRAIT
 #elif defined(CONFIG_LCD_RPORTRAIT)
 #  if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RLANDSCAPE)
 #    error "Cannot define both rportrait and any other orientations"
 #  endif
+#  define LCD_STDORIENTATION LCD_RPORTRAIT
 #elif defined(CONFIG_LCD_LANDSCAPE)
 #  ifdef CONFIG_LCD_RLANDSCAPE
 #    error "Cannot define both landscape and any other orientations"
 #  endif
+#  define LCD_STDORIENTATION LCD_LANDSCAPE
 #elif !defined(CONFIG_LCD_RLANDSCAPE)
 #  define CONFIG_LCD_LANDSCAPE 1
+#  define LCD_STDORIENTATION LCD_RLANDSCAPE

Review Comment:
   not neccessary



-- 
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] [nuttx] acassis commented on a diff in pull request #8398: Dynamic adjustment of the orientation and offset to support orientati…

Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on code in PR #8398:
URL: https://github.com/apache/nuttx/pull/8398#discussion_r1093252300


##########
include/nuttx/lcd/st7789.h:
##########
@@ -63,7 +68,7 @@ extern "C"
  *
  ****************************************************************************/
 
-FAR struct lcd_dev_s *st7789_lcdinitialize(FAR struct spi_dev_s *spi);
+FAR struct lcd_dev_s *st7789_lcdinitialize(FAR struct spi_dev_s *spi, uint8_t orientation, uint16_t xoff, uint16_t yoff);

Review Comment:
   Please fix this Long 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] [nuttx] xiaoxiang781216 commented on a diff in pull request #8398: Dynamic adjustment of the orientation and offset to support orientati…

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #8398:
URL: https://github.com/apache/nuttx/pull/8398#discussion_r1103622370


##########
drivers/lcd/Kconfig:
##########
@@ -1104,6 +1104,13 @@ config LCD_RLANDSCAPE
 		refers one of two orientations where the display is wider than it is
 		tall (LCD_LANDSCAPE is the other).
 
+config LCD_DYN_ORIENTATION

Review Comment:
   But the porotype of st7789_lcdinitialize is changed in this patch, which is an incompatible change. So, I think it's a good chance to let's caller pass in all parameters(offset, resolution and oerientation) instead by Kconfig.
   If the compatibility is required, we can:
   ```
   #define st7789_lcdinitialize(spi) \
     st7789_lcdinitialize2(spi, \
                           CONFIG_LCD_ST7789_XRES, \
                           CONFIG_LCD_ST7789_YRES, \
                           CONFIG_LCD_ST7789_XOFFSET, \
                           CONFIG_LCD_ST7789_YOFFSET, \
                           CONFIG_ST7789_ORIENTATION)
   ```



-- 
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] [nuttx] SimonFilgis commented on a diff in pull request #8398: Dynamic adjustment of the orientation and offset to support orientati…

Posted by "SimonFilgis (via GitHub)" <gi...@apache.org>.
SimonFilgis commented on code in PR #8398:
URL: https://github.com/apache/nuttx/pull/8398#discussion_r1093314243


##########
drivers/lcd/st7789.c:
##########
@@ -781,7 +791,7 @@ static int st7789_setcontrast(FAR struct lcd_dev_s *dev,
  *
  ****************************************************************************/
 
-FAR struct lcd_dev_s *st7789_lcdinitialize(FAR struct spi_dev_s *spi)
+FAR struct lcd_dev_s *st7789_lcdinitialize(FAR struct spi_dev_s *spi, uint8_t orientation, uint16_t xoff, uint16_t yoff)

Review Comment:
   Ah, one moment



-- 
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] [nuttx] acassis commented on a diff in pull request #8398: Dynamic adjustment of the orientation and offset to support orientati…

Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on code in PR #8398:
URL: https://github.com/apache/nuttx/pull/8398#discussion_r1093254144


##########
drivers/lcd/st7789.c:
##########
@@ -781,7 +791,7 @@ static int st7789_setcontrast(FAR struct lcd_dev_s *dev,
  *
  ****************************************************************************/
 
-FAR struct lcd_dev_s *st7789_lcdinitialize(FAR struct spi_dev_s *spi)
+FAR struct lcd_dev_s *st7789_lcdinitialize(FAR struct spi_dev_s *spi, uint8_t orientation, uint16_t xoff, uint16_t yoff)

Review Comment:
   Ditto



##########
drivers/lcd/st7789.c:
##########
@@ -347,32 +354,35 @@ static void st7789_display(FAR struct st7789_dev_s *dev, bool on)
  *
  ****************************************************************************/
 
-static void st7789_setorientation(FAR struct st7789_dev_s *dev)
+static void st7789_setorientation(FAR struct st7789_dev_s *dev, uint8_t orientation)
 {
   /* No need to change the orientation in PORTRAIT mode */
 
-#if !defined(CONFIG_LCD_PORTRAIT)
-  st7789_sendcmd(dev, ST7789_MADCTL);
-  st7789_select(dev->spi, 8);
-
-#  if defined(CONFIG_LCD_RLANDSCAPE)
-  /* RLANDSCAPE : MY=1 MV=1 */
-
-  SPI_SEND(dev->spi, 0xa0);
+  if (orientation != LCD_PORTRAIT)
+    {
+      st7789_sendcmd(dev, ST7789_MADCTL);
+      st7789_select(dev->spi, 8);
+    }
 
-#  elif defined(CONFIG_LCD_LANDSCAPE)
-  /* LANDSCAPE : MX=1 MV=1 */
+  if (orientation == LCD_RLANDSCAPE)
+    {
+      /* RLANDSCAPE : MY=1 MV=1 */
 
-  SPI_SEND(dev->spi, 0x70);
+      SPI_SEND(dev->spi, 0xa0);
+    }
+  else if (orientation == LCD_LANDSCAPE)
+    {
+      /* LANDSCAPE : MX=1 MV=1 */
 
-#  elif defined(CONFIG_LCD_RPORTRAIT)
-  /* RPORTRAIT : MX=1 MY=1 */
+      SPI_SEND(dev->spi, 0x70);
+    }
+  else if (orientation == LCD_RPORTRAIT)
+    { /* RPORTRAIT : MX=1 MY=1 */

Review Comment:
   Move comment to the next line to avoid nxstyle reporting this error



-- 
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] [nuttx] acassis commented on pull request #8398: Dynamic adjustment of the orientation and offset to support orientati…

Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on PR #8398:
URL: https://github.com/apache/nuttx/pull/8398#issuecomment-1426320520

   @SimonFilgis could you please fix this issue:
   ```
   board/stm32_st7789.c: In function 'board_lcd_getdev':
   Error: board/stm32_st7789.c:101:11: error: too few arguments to function 'st7789_lcdinitialize'
     101 |   g_lcd = st7789_lcdinitialize(g_spidev);
         |           ^~~~~~~~~~~~~~~~~~~~
   In file included from board/stm32_st7789.c:36:
   /github/workspace/sources/nuttx/include/nuttx/lcd/st7789.h:71:23: note: declared here
      71 | FAR struct lcd_dev_s *st7789_lcdinitialize(FAR struct spi_dev_s *spi,
         |                       ^~~~~~~~~~~~~~~~~~~~
   make[2]: *** [/github/workspace/sources/nuttx/boards/Board.mk:83: stm32_st7789.o] Error 1
   make[2]: Target 'libboard.a' not remade because of errors.
   ```
   


-- 
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] [nuttx] SimonFilgis commented on a diff in pull request #8398: Dynamic adjustment of the orientation and offset to support orientati…

Posted by "SimonFilgis (via GitHub)" <gi...@apache.org>.
SimonFilgis commented on code in PR #8398:
URL: https://github.com/apache/nuttx/pull/8398#discussion_r1103620775


##########
drivers/lcd/Kconfig:
##########
@@ -1104,6 +1104,13 @@ config LCD_RLANDSCAPE
 		refers one of two orientations where the display is wider than it is
 		tall (LCD_LANDSCAPE is the other).
 
+config LCD_DYN_ORIENTATION

Review Comment:
   To stay compatible with old implementations, and to support better compile time optimization. Duplication is easy to oversee here.



-- 
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] [nuttx] SimonFilgis commented on a diff in pull request #8398: Dynamic adjustment of the orientation and offset to support orientati…

Posted by "SimonFilgis (via GitHub)" <gi...@apache.org>.
SimonFilgis commented on code in PR #8398:
URL: https://github.com/apache/nuttx/pull/8398#discussion_r1103642805


##########
drivers/lcd/Kconfig:
##########
@@ -1104,6 +1104,13 @@ config LCD_RLANDSCAPE
 		refers one of two orientations where the display is wider than it is
 		tall (LCD_LANDSCAPE is the other).
 
+config LCD_DYN_ORIENTATION

Review Comment:
   This define would need to be in the include file to be visible externally. The CONFIG_ST7789_ORIENTATION needs to be created.
   
   I tried to implement this way you suggested the last 20min and came to the conclusion that this is a more complicated less understandabel way.
   
   Nuttx inviolable:
   Sometimes Code Duplication is OK



-- 
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] [nuttx] xiaoxiang781216 commented on a diff in pull request #8398: Dynamic adjustment of the orientation and offset to support orientati…

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #8398:
URL: https://github.com/apache/nuttx/pull/8398#discussion_r1103622370


##########
drivers/lcd/Kconfig:
##########
@@ -1104,6 +1104,13 @@ config LCD_RLANDSCAPE
 		refers one of two orientations where the display is wider than it is
 		tall (LCD_LANDSCAPE is the other).
 
+config LCD_DYN_ORIENTATION

Review Comment:
   But the porotype of st7789_lcdinitialize is changed in this patch, which is an incompatible change. So, I think it's a good chance to let's caller pass in all parameters(offset, resolution and oerientation) instead by Kconfig.
   If the compatibility is required, we can:
   ```
   #define st7789_lcdinitialize(spi) \
     st7789_lcdinitialize2(spi, \
                                      CONFIG_LCD_ST7789_XRES, \
                                      CONFIG_LCD_ST7789_YRES, \
                                      CONFIG_LCD_ST7789_XOFFSET, \
                                      CONFIG_LCD_ST7789_YOFFSET, \
                                      CONFIG_ST7789_ORIENTATION)
   ```



-- 
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] [nuttx] acassis merged pull request #8398: Dynamic adjustment of the orientation, switch orientation on the fly

Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis merged PR #8398:
URL: https://github.com/apache/nuttx/pull/8398


-- 
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] [nuttx] xiaoxiang781216 commented on a diff in pull request #8398: Dynamic adjustment of the orientation and offset to support orientati…

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #8398:
URL: https://github.com/apache/nuttx/pull/8398#discussion_r1093252056


##########
drivers/lcd/st7789.c:
##########
@@ -80,16 +80,20 @@
       defined(CONFIG_LCD_RPORTRAIT)
 #    error "Cannot define both portrait and any other orientations"
 #  endif
+#  define LCD_STDORIENTATION LCD_PORTRAIT
 #elif defined(CONFIG_LCD_RPORTRAIT)
 #  if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RLANDSCAPE)
 #    error "Cannot define both rportrait and any other orientations"
 #  endif
+#  define LCD_STDORIENTATION LCD_RPORTRAIT
 #elif defined(CONFIG_LCD_LANDSCAPE)
 #  ifdef CONFIG_LCD_RLANDSCAPE
 #    error "Cannot define both landscape and any other orientations"
 #  endif
+#  define LCD_STDORIENTATION LCD_LANDSCAPE
 #elif !defined(CONFIG_LCD_RLANDSCAPE)
 #  define CONFIG_LCD_LANDSCAPE 1
+#  define LCD_STDORIENTATION LCD_RLANDSCAPE

Review Comment:
   If caller pass in orientation, why we keep LCD_STDORIENTATION?



-- 
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] [nuttx] xiaoxiang781216 commented on a diff in pull request #8398: Dynamic adjustment of the orientation and offset to support orientati…

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #8398:
URL: https://github.com/apache/nuttx/pull/8398#discussion_r1103622370


##########
drivers/lcd/Kconfig:
##########
@@ -1104,6 +1104,13 @@ config LCD_RLANDSCAPE
 		refers one of two orientations where the display is wider than it is
 		tall (LCD_LANDSCAPE is the other).
 
+config LCD_DYN_ORIENTATION

Review Comment:
   But the porotype of st7789_lcdinitialize is changed in this patch, which is an incompatible change. So, I think it's a good chance to let's caller pass in all parameters(offset, resolution and oerientation) instead by Kconfig.
   If the compatibility is required, we can:
   ```
   #define st7789_lcdinitialize(spi) st7789_lcdinitialize2(spi, CONFIG_LCD_ST7789_XRES, CONFIG_LCD_ST7789_YRES, CONFIG_LCD_ST7789_XOFFSET, CONFIG_LCD_ST7789_YOFFSET, CONFIG_ST7789_ORIENTATION)
   ```



-- 
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] [nuttx] xiaoxiang781216 commented on a diff in pull request #8398: Dynamic adjustment of the orientation and offset to support orientati…

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #8398:
URL: https://github.com/apache/nuttx/pull/8398#discussion_r1103620138


##########
drivers/lcd/Kconfig:
##########
@@ -1104,6 +1104,13 @@ config LCD_RLANDSCAPE
 		refers one of two orientations where the display is wider than it is
 		tall (LCD_LANDSCAPE is the other).
 
+config LCD_DYN_ORIENTATION

Review Comment:
   why not remove LCD_DYN_ORIENTATION and always support dynmaic orientation? Many duplicated code can be 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