drivers: display: st7796s: respect rgb_is_inverted in 8080 8 bit mode
Update ST7796s display driver to respect the setting of rgb_is_inverted in 8080 8 bit mode, as it was previously not applied for this mode. Also, simplify the logic check for 16 bit mode- the new check is functionally equivalent, but no longer inverts both boolean values. Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
This commit is contained in:
parent
3604aba75b
commit
04726a22cb
|
@ -118,7 +118,13 @@ static int st7796s_get_pixelfmt(const struct device *dev)
|
|||
* and vice versa.
|
||||
*/
|
||||
if (config->dbi_config.mode == MIPI_DBI_MODE_8080_BUS_8_BIT) {
|
||||
if (config->madctl & ST7796S_MADCTL_BGR) {
|
||||
/*
|
||||
* Similar to the handling for other interface modes,
|
||||
* invert the reported pixel format if "rgb_is_inverted"
|
||||
* is enabled
|
||||
*/
|
||||
if (((bool)(config->madctl & ST7796S_MADCTL_BGR)) !=
|
||||
config->rgb_is_inverted) {
|
||||
return PIXEL_FORMAT_RGB_565;
|
||||
} else {
|
||||
return PIXEL_FORMAT_BGR_565;
|
||||
|
@ -133,7 +139,8 @@ static int st7796s_get_pixelfmt(const struct device *dev)
|
|||
* if rgb_is_inverted is enabled.
|
||||
* It is a workaround for supporting buggy modules that display RGB as BGR.
|
||||
*/
|
||||
if (!(config->madctl & ST7796S_MADCTL_BGR) != !config->rgb_is_inverted) {
|
||||
if (((bool)(config->madctl & ST7796S_MADCTL_BGR)) !=
|
||||
config->rgb_is_inverted) {
|
||||
return PIXEL_FORMAT_BGR_565;
|
||||
} else {
|
||||
return PIXEL_FORMAT_RGB_565;
|
||||
|
|
Loading…
Reference in New Issue