drivers: display: st7789v: Add support to disable inversion mode
For historical reasons, inversion mode is enabled by default in the current implementation. This commit introduces an `inversion-off` boolean DTS property, allowing it to be disabled if necessary. Signed-off-by: Chen Xingyu <hi@xingrz.me>
This commit is contained in:
parent
28a69a8e80
commit
979cd1dfe8
2 changed files with 11 additions and 1 deletions
|
@ -37,6 +37,7 @@ struct st7789v_config {
|
||||||
uint8_t gamma;
|
uint8_t gamma;
|
||||||
uint8_t colmod;
|
uint8_t colmod;
|
||||||
uint8_t lcm;
|
uint8_t lcm;
|
||||||
|
bool inversion_on;
|
||||||
uint8_t porch_param[5];
|
uint8_t porch_param[5];
|
||||||
uint8_t cmd2en_param[4];
|
uint8_t cmd2en_param[4];
|
||||||
uint8_t pwctrl1_param[2];
|
uint8_t pwctrl1_param[2];
|
||||||
|
@ -298,7 +299,11 @@ static void st7789v_lcd_init(const struct device *dev)
|
||||||
tmp = config->gamma;
|
tmp = config->gamma;
|
||||||
st7789v_transmit(dev, ST7789V_CMD_GAMSET, &tmp, 1);
|
st7789v_transmit(dev, ST7789V_CMD_GAMSET, &tmp, 1);
|
||||||
|
|
||||||
st7789v_transmit(dev, ST7789V_CMD_INV_ON, NULL, 0);
|
if (config->inversion_on) {
|
||||||
|
st7789v_transmit(dev, ST7789V_CMD_INV_ON, NULL, 0);
|
||||||
|
} else {
|
||||||
|
st7789v_transmit(dev, ST7789V_CMD_INV_OFF, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
st7789v_transmit(dev, ST7789V_CMD_PVGAMCTRL,
|
st7789v_transmit(dev, ST7789V_CMD_PVGAMCTRL,
|
||||||
(uint8_t *)config->pvgam_param,
|
(uint8_t *)config->pvgam_param,
|
||||||
|
@ -411,6 +416,7 @@ static const struct display_driver_api st7789v_api = {
|
||||||
.gamma = DT_INST_PROP(inst, gamma), \
|
.gamma = DT_INST_PROP(inst, gamma), \
|
||||||
.colmod = DT_INST_PROP(inst, colmod), \
|
.colmod = DT_INST_PROP(inst, colmod), \
|
||||||
.lcm = DT_INST_PROP(inst, lcm), \
|
.lcm = DT_INST_PROP(inst, lcm), \
|
||||||
|
.inversion_on = !DT_INST_PROP(inst, inversion_off), \
|
||||||
.porch_param = DT_INST_PROP(inst, porch_param), \
|
.porch_param = DT_INST_PROP(inst, porch_param), \
|
||||||
.cmd2en_param = DT_INST_PROP(inst, cmd2en_param), \
|
.cmd2en_param = DT_INST_PROP(inst, cmd2en_param), \
|
||||||
.pwctrl1_param = DT_INST_PROP(inst, pwctrl1_param), \
|
.pwctrl1_param = DT_INST_PROP(inst, pwctrl1_param), \
|
||||||
|
|
|
@ -77,6 +77,10 @@ properties:
|
||||||
required: true
|
required: true
|
||||||
description: Gamma Setting
|
description: Gamma Setting
|
||||||
|
|
||||||
|
inversion-off:
|
||||||
|
type: boolean
|
||||||
|
description: Inversion Off
|
||||||
|
|
||||||
porch-param:
|
porch-param:
|
||||||
type: uint8-array
|
type: uint8-array
|
||||||
required: true
|
required: true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue