Skip to content
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

Merged
merged 2 commits into from
Apr 21, 2022

Conversation

aabadie
Copy link
Contributor

@aabadie aabadie commented Apr 13, 2022

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

@github-actions github-actions bot added Area: boards Area: Board ports Area: drivers Area: Device drivers Area: sys Area: System Area: tests Area: tests and testing framework labels Apr 13, 2022
@aabadie aabadie added the State: waiting for other PR State: The PR requires another PR to be merged first label Apr 13, 2022
@aabadie aabadie force-pushed the pr/drivers/lcd_rotation_rework branch 2 times, most recently from 335921f to 81d36bf Compare April 15, 2022 10:58
aabadie added 2 commits April 19, 2022 16:22

Verified

This commit was signed with the committer’s verified signature.
aabadie Alexandre Abadie

Verified

This commit was signed with the committer’s verified signature.
aabadie Alexandre Abadie
@aabadie aabadie force-pushed the pr/drivers/lcd_rotation_rework branch from 81d36bf to d992a18 Compare April 19, 2022 14:22
@aabadie aabadie added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed State: waiting for other PR State: The PR requires another PR to be merged first labels Apr 19, 2022
@github-actions github-actions bot removed Area: sys Area: System Area: tests Area: tests and testing framework labels Apr 19, 2022
Copy link
Contributor

@fjmolinas fjmolinas left a 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

@aabadie
Copy link
Contributor Author

aabadie commented Apr 19, 2022

seems like the kind of fix that maybe only works on the py-badge, can you test on another st7735?

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

@aabadie
Copy link
Contributor Author

aabadie commented Apr 21, 2022

@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

Copy link
Contributor

@fjmolinas fjmolinas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

@aabadie aabadie merged commit 56359d6 into RIOT-OS:master Apr 21, 2022
@aabadie aabadie deleted the pr/drivers/lcd_rotation_rework branch April 21, 2022 12:31
@aabadie
Copy link
Contributor Author

aabadie commented Apr 21, 2022

Thanks @fjmolinas !

@chrysn chrysn added this to the Release 2022.07 milestone Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: boards Area: Board ports Area: drivers Area: Device drivers CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants