-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers/lcd: rework rotation management and enable it for st7735 #17930
drivers/lcd: rework rotation management and enable it for st7735 #17930
Conversation
335921f
to
81d36bf
Compare
81d36bf
to
d992a18
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm seems like the kind of fix that maybe only works on the py-badge, can you test on another st7735? I know there I another one in the office
I have one with me, I may be able to test this tomorrow afternoon or on thursday. I tested several orientation on the pybadge and all were ok (assuming that the number of lines/rgb channels are adapted accordingly). |
@fjmolinas I tested this PR with the Adafruit ST7735 breakout board connected to a nucleo-l073rz. After tweaking a bit the default driver params (see the diff below), the display can be rotated using all options (horizontal, horizontal flipped, vertical and vertical flipped) and the display is as expected. With this breakout board, the width and height are both 132 so no need to flip them between horizontal and vertical orientation (unlike with the adafruit-pybadge). diff --git a/drivers/st7735/include/st7735_params.h b/drivers/st7735/include/st7735_params.h
index 3194896ddf..a98093d81c 100644
--- a/drivers/st7735/include/st7735_params.h
+++ b/drivers/st7735/include/st7735_params.h
@@ -40,13 +40,13 @@ extern "C" {
#define ST7735_PARAM_SPI_CLK SPI_CLK_5MHZ /**< SPI clock frequency */
#endif
#ifndef ST7735_PARAM_CS
-#define ST7735_PARAM_CS GPIO_PIN(2, 2) /**< Chip Select pin */
+#define ST7735_PARAM_CS GPIO_PIN(1, 6) /**< Chip Select pin */
#endif
#ifndef ST7735_PARAM_DCX
-#define ST7735_PARAM_DCX GPIO_PIN(3, 13) /**< DCX pin */
+#define ST7735_PARAM_DCX GPIO_PIN(0, 9) /**< DCX pin */
#endif
#ifndef ST7735_PARAM_RST
-#define ST7735_PARAM_RST GPIO_UNDEF /**< Reset pin */
+#define ST7735_PARAM_RST GPIO_PIN(2, 7) /**< Reset pin */
#endif
#ifndef ST7735_PARAM_SPI_MODE
#define ST7735_PARAM_SPI_MODE SPI_MODE_0 /**< SPI mode */
@@ -58,13 +58,13 @@ extern "C" {
#define ST7735_PARAM_INVERTED 0 /**< Inverted mode enable */
#endif
#ifndef ST7735_PARAM_NUM_LINES
-#define ST7735_PARAM_NUM_LINES 160U /**< Number of lines */
+#define ST7735_PARAM_NUM_LINES 132U /**< Number of lines */
#endif
#ifndef ST7735_PARAM_RGB_CHANNELS
-#define ST7735_PARAM_RGB_CHANNELS 128U /**< Number of RGB channels (e.g. columns) */
+#define ST7735_PARAM_RGB_CHANNELS 132U /**< Number of RGB channels (e.g. columns) */
#endif
#ifndef ST7735_PARAM_ROTATION
-#define ST7735_PARAM_ROTATION ST7735_ROTATION_HORZ /**< Rotation mode */
+#define ST7735_PARAM_ROTATION ST7735_ROTATION_HORZ_FLIP /**< Rotation mode */
#endif
#ifndef ST7735_PARAM_OFFSET_X
#define ST7735_PARAM_OFFSET_X 0 /**< Horizontal offset */ So I'd say this PR is good to go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK
Thanks @fjmolinas ! |
Contribution description
This PR is a follow-up of #17925 and is a rework of the rotation management. It also enables this feature for the st7735.
On ST7735, the
ST7735_ROTATION_VERT
mode doesn't work as expected: the image is mirrored and I couldn't the right configuration here (so I mode is broken out of 4). On ILI9341, all modes are working.Testing procedure
The display is correct on adafruit-pybadge (tested)
Issues/PRs references
Follow-up of #17925