Skip to content

Commit f34d091

Browse files
committed
MADCTL readback/blinking display hack.
1 parent 9680ddb commit f34d091

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

hw/arm/prusa/parts/st7789v.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ do { fprintf(stderr, "st7789v: error: " fmt , ## __VA_ARGS__);} while (0)
5858
#define REMAP_SPLIT_COM 0x40
5959

6060
#define CMD_NOP 0x00
61+
#define CMD_READ_MADCTL 0x0B
6162
#define CMD_SLPOUT 0x11
6263
#define CMD_DISPON 0x29
6364
#define CMD_CASET 0x2A
@@ -96,6 +97,8 @@ struct st7789v_state {
9697
uint32_t mode;
9798
uint32_t framebuffer[DPY_ROWS * DPY_COLS];
9899

100+
uint32_t madctl;
101+
99102
script_handle handle;
100103
};
101104

@@ -129,6 +132,9 @@ static uint32_t st7789v_transfer(SSIPeripheral *dev, uint32_t data)
129132
break;
130133
case CMD_SLPOUT:
131134
break;
135+
case CMD_READ_MADCTL:
136+
return 0xF0; // HACK ALERT!!
137+
break;
132138
case CMD_CASET: /* Set column. */
133139
DATA(4);
134140
s->col = s->col_start = (s->cmd_data[0]<<8|s->cmd_data[1]) % DPY_COLS;
@@ -144,7 +150,8 @@ static uint32_t st7789v_transfer(SSIPeripheral *dev, uint32_t data)
144150
case CMD_MADCTL:
145151
DATA(1);
146152
printf("TODO: MADCTL: %02x\n",s->cmd_data[0]);
147-
break;
153+
s->madctl = s->cmd_data[0];
154+
break;
148155
case CMD_COLMOD:
149156
DATA(1);
150157
uint32_t value = s->cmd_data[0];

0 commit comments

Comments
 (0)