-
Notifications
You must be signed in to change notification settings - Fork 1
/
tft.v.bak
58 lines (47 loc) · 1.68 KB
/
tft.v.bak
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
module tft(
input clk,
input tft_sdo, output wire tft_sck, output wire tft_sdi,
output wire tft_dc, output reg tft_reset, output wire tft_cs,
input[15:0] framebufferData, output wire framebufferClk);
parameter INPUT_CLK_MHZ = 120;
reg[8:0] spiData;
reg spiDataSet = 1'b0;
wire spiIdle;
reg frameBufferLowNibble = 1'b1;
assign framebufferClk = !frameBufferLowNibble;
initial
tft_reset = 1'b1;
spi spi_inst (clk, spiData, spiDataSet, tft_sck, tft_sdi, tft_dc, tft_cs, spiIdle);
parameter INIT_SEQ_LEN = 52;
reg[5:0] initSeqCounter = 6'b0;
reg[8:0] INIT_SEQ [0:INIT_SEQ_LEN-1] = '{
// Turn off Display
{1'b0, 8'h28},
// Init (??)
{1'b0, 8'hCF}, {1'b1, 8'h00}, {1'b1, 8'h83}, {1'b1, 8'h30},
{1'b0, 8'hED}, {1'b1, 8'h64}, {1'b1, 8'h03}, {1'b1, 8'h12}, {1'b1, 8'h81},
{1'b0, 8'hE8}, {1'b1, 8'h85}, {1'b1, 8'h01}, {1'b1, 8'h79},
{1'b0, 8'hCB}, {1'b1, 8'h39}, {1'b1, 8'h2C}, {1'b1, 8'h00}, {1'b1, 8'h34}, {1'b1, 8'h02},
{1'b0, 8'hF7}, {1'b1, 8'h20},
{1'b0, 8'hEA}, {1'b1, 8'h00}, {1'b1, 8'h00},
// Power Control
{1'b0, 8'hC0}, {1'b1, 8'h26},
{1'b0, 8'hC1}, {1'b1, 8'h11},
// VCOM
{1'b0, 8'hC5}, {1'b1, 8'h35}, {1'b1, 8'h3E},
{1'b0, 8'hC7}, {1'b1, 8'hBE},
// Memory Access Control
{1'b0, 8'h3A}, {1'b1, 8'h55},
// Frame Rate
{1'b0, 8'hB1}, {1'b1, 8'h00}, {1'b1, 8'h1B},
// Gamma
{1'b0, 8'h26}, {1'b1, 8'h01},
// Brightness
{1'b0, 8'h51}, {1'b1, 8'hFF},
// Display
{1'b0, 8'hB7}, {1'b1, 8'h07},
{1'b0, 8'hB6}, {1'b1, 8'h0A}, {1'b1, 8'h82}, {1'b1, 8'h27}, {1'b1, 8'h00},
{1'b0, 8'h29}, // Enable Display
{1'b0, 8'h2C} // Start Memory-Write
};
endmodule