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
| 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); |
pio/st7789_lcd/st7789_lcd.pio
Outdated
| 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 |
pio/st7789_lcd/st7789_lcd.pio
Outdated
| 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.
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 CPOLThere was a problem hiding this comment.
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).
|
I made the changes. |
pio/st7789_lcd/st7789_lcd.pio
Outdated
| 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.
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.
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. |
marcoswada
left a comment
There was a problem hiding this comment.
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.