drivers: display: ili9340: move display function control to DT
Move display function control (DISCTRL) register settings to DT. Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
This commit is contained in:
parent
6a76ae82c0
commit
afc63664f2
5 changed files with 18 additions and 20 deletions
|
@ -38,6 +38,7 @@ struct ili9340_config {
|
|||
uint16_t rotation;
|
||||
uint8_t gamset[ILI9340_GAMSET_LEN];
|
||||
uint8_t frmctr1[ILI9340_FRMCTR1_LEN];
|
||||
uint8_t disctrl[ILI9340_DISCTRL_LEN];
|
||||
uint8_t pwctrl1[ILI9340_PWCTRL1_LEN];
|
||||
uint8_t pwctrl2[ILI9340_PWCTRL2_LEN];
|
||||
uint8_t vmctrl1[ILI9340_VMCTRL1_LEN];
|
||||
|
@ -385,6 +386,14 @@ static int ili9340_configure(const struct device *dev)
|
|||
return r;
|
||||
}
|
||||
|
||||
LOG_HEXDUMP_DBG(config->disctrl, ILI9340_DISCTRL_LEN, "DISCTRL");
|
||||
memcpy(tx_data, config->disctrl, ILI9340_DISCTRL_LEN);
|
||||
r = ili9340_transmit(dev, ILI9340_CMD_DISPLAY_FUNCTION_CTRL, tx_data,
|
||||
ILI9340_DISCTRL_LEN);
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
|
||||
LOG_HEXDUMP_DBG(config->pwctrl1, ILI9340_PWCTRL1_LEN, "PWCTRL1");
|
||||
memcpy(tx_data, config->pwctrl1, ILI9340_PWCTRL1_LEN);
|
||||
r = ili9340_transmit(dev, ILI9340_CMD_POWER_CTRL_1, tx_data,
|
||||
|
@ -553,6 +562,7 @@ static const struct display_driver_api ili9340_api = {
|
|||
.rotation = DT_INST_PROP(index, rotation), \
|
||||
.gamset = DT_INST_PROP(index, gamset), \
|
||||
.frmctr1 = DT_INST_PROP(index, frmctr1), \
|
||||
.disctrl = DT_INST_PROP(index, disctrl), \
|
||||
.pwctrl1 = DT_INST_PROP(index, pwctrl1), \
|
||||
.pwctrl2 = DT_INST_PROP(index, pwctrl2), \
|
||||
.vmctrl1 = DT_INST_PROP(index, vmctrl1), \
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
#define ILI9340_GAMSET_LEN 1U
|
||||
#define ILI9340_FRMCTR1_LEN 2U
|
||||
#define ILI9340_DISCTRL_LEN 3U
|
||||
#define ILI9340_PWCTRL1_LEN 2U
|
||||
#define ILI9340_PWCTRL2_LEN 1U
|
||||
#define ILI9340_VMCTRL1_LEN 2U
|
||||
|
|
|
@ -8,16 +8,5 @@
|
|||
|
||||
int ili9340_lcd_init(const struct device *dev)
|
||||
{
|
||||
int r;
|
||||
uint8_t tx_data[15];
|
||||
|
||||
tx_data[0] = 0x08;
|
||||
tx_data[1] = 0x82;
|
||||
tx_data[2] = 0x27;
|
||||
r = ili9340_transmit(dev, ILI9340_CMD_DISPLAY_FUNCTION_CTRL, tx_data, 3);
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -82,15 +82,6 @@ int ili9340_lcd_init(const struct device *dev)
|
|||
return r;
|
||||
}
|
||||
|
||||
/* Display Function Control */
|
||||
cmd = ILI9340_CMD_DISPLAY_FUNCTION_CTRL;
|
||||
data[0] = 0x0AU;
|
||||
data[1] = 0xA2U;
|
||||
r = ili9340_transmit(dev, cmd, data, 2);
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
|
||||
/* 3Gamma Function Disable */
|
||||
cmd = ILI9341_CMD_ENABLE_3G;
|
||||
data[0] = 0x00U;
|
||||
|
|
|
@ -60,6 +60,13 @@ properties:
|
|||
description:
|
||||
Frame rate control (in normal mode / full colors) (FRMCTR1) register value.
|
||||
|
||||
disctrl:
|
||||
type: uint8-array
|
||||
default: [0x0a, 0x82, 0x27]
|
||||
description:
|
||||
Display function control (DISCTRL) register value. Note that changing
|
||||
default SS bit value (0) may interfere with display rotation.
|
||||
|
||||
pwctrl1:
|
||||
type: uint8-array
|
||||
default: [0x26, 0x00]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue