-
Notifications
You must be signed in to change notification settings - Fork 769
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
Issue #370 fix #418
base: develop
Are you sure you want to change the base?
Issue #370 fix #418
Conversation
Fixes issue 370. Change #define SPI_POLARITY to 1 for displays that need it.
Fixes issue 370. Allows change to polarity.
pio/st7789_lcd/st7789_lcd.c
Outdated
@@ -90,7 +92,7 @@ int main() { | |||
PIO pio = pio0; | |||
uint sm = 0; | |||
uint offset = pio_add_program(pio, &st7789_lcd_program); | |||
st7789_lcd_program_init(pio, sm, offset, PIN_DIN, PIN_CLK, SERIAL_CLK_DIV); | |||
st7789_lcd_program_init(pio, sm, offset, SPI_POLARITY, PIN_DIN, PIN_CLK, SERIAL_CLK_DIV); |
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.
Might be tabs vs 4 spaces?
pio/st7789_lcd/st7789_lcd.pio
Outdated
@@ -33,6 +33,11 @@ static inline void st7789_lcd_program_init(PIO pio, uint sm, uint offset, uint d | |||
sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_TX); | |||
sm_config_set_clkdiv(&c, clk_div); | |||
sm_config_set_out_shift(&c, false, true, 8); | |||
|
|||
// The pin muxes can be configured to invert the output (among other things |
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.
Might be tabs vs 4 spaces?
pio/st7789_lcd/st7789_lcd.pio
Outdated
@@ -33,6 +33,11 @@ static inline void st7789_lcd_program_init(PIO pio, uint sm, uint offset, uint d | |||
sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_TX); | |||
sm_config_set_clkdiv(&c, clk_div); | |||
sm_config_set_out_shift(&c, false, true, 8); | |||
|
|||
// The pin muxes can be configured to invert the output (among other things | |||
// and this is a cheesy way to get CPOL=1 |
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.
The comment states CPOL=1
whereas that is actually CPOL=cpol
. Perhaps could change to
-and this is a cheesy way to get CPOL=1
+and this is a cheesy way to set CPOL
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.
True. But I took that comment directly from code already in the repo. I think it means that it's a cheesy way to get inverted polarity (i.e. CPOL=1, vs. CPOL=0).
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.
Fair
I made the changes. |
pio/st7789_lcd/st7789_lcd.pio
Outdated
@@ -33,6 +33,11 @@ static inline void st7789_lcd_program_init(PIO pio, uint sm, uint offset, uint d | |||
sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_TX); | |||
sm_config_set_clkdiv(&c, clk_div); | |||
sm_config_set_out_shift(&c, false, true, 8); | |||
|
|||
// The pin muxes can be configured to invert the output (among other things |
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.
It appears to me that the closing paren must've been omitted:
-// The pin muxes can be configured to invert the output (among other things
+// The pin muxes can be configured to invert the output (among other things),
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.
This was changed.
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.
Thanks for your help! I have no merging powers vested in me :) From my experience, the repo maintainers approved and merged after quite some time, before releasing the new SDK version.
Thanks for this fix. Wiring up the CS pin did not work for me but this did. |
Thanks for the fix. This worked for me as well. |
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.
Tested on my hardware and the fix solved the polarity problem.
I have a 240x240 display with a ST7789 driver with no CS pin, for which the current PIO example doesn't work. This PR with |
This fixes issue #370. Some displays will require changing #define SPI_POLARITY to 1.