BayEOS-Arduino  1.8.0_0.0.4
HW_MX20DX256.h
1 
15 // *** Hardware specific functions ***
17 {
18 }
19 
20 void UTFT::LCD_Writ_Bus(char VH,char VL, byte mode)
21 {
22  switch (mode)
23  {
24  case 1:
25  if (display_serial_mode==SERIAL_4PIN)
26  {
27  if (VH==1)
28  sbi(P_SDA, B_SDA);
29  else
30  cbi(P_SDA, B_SDA);
31  pulse_low(P_SCL, B_SCL);
32  }
33  else
34  {
35  if (VH==1)
36  sbi(P_RS, B_RS);
37  else
38  cbi(P_RS, B_RS);
39  }
40 
41  if (VL & 0x80)
42  sbi(P_SDA, B_SDA);
43  else
44  cbi(P_SDA, B_SDA);
45  pulse_low(P_SCL, B_SCL);
46  if (VL & 0x40)
47  sbi(P_SDA, B_SDA);
48  else
49  cbi(P_SDA, B_SDA);
50  pulse_low(P_SCL, B_SCL);
51  if (VL & 0x20)
52  sbi(P_SDA, B_SDA);
53  else
54  cbi(P_SDA, B_SDA);
55  pulse_low(P_SCL, B_SCL);
56  if (VL & 0x10)
57  sbi(P_SDA, B_SDA);
58  else
59  cbi(P_SDA, B_SDA);
60  pulse_low(P_SCL, B_SCL);
61  if (VL & 0x08)
62  sbi(P_SDA, B_SDA);
63  else
64  cbi(P_SDA, B_SDA);
65  pulse_low(P_SCL, B_SCL);
66  if (VL & 0x04)
67  sbi(P_SDA, B_SDA);
68  else
69  cbi(P_SDA, B_SDA);
70  pulse_low(P_SCL, B_SCL);
71  if (VL & 0x02)
72  sbi(P_SDA, B_SDA);
73  else
74  cbi(P_SDA, B_SDA);
75  pulse_low(P_SCL, B_SCL);
76  if (VL & 0x01)
77  sbi(P_SDA, B_SDA);
78  else
79  cbi(P_SDA, B_SDA);
80  pulse_low(P_SCL, B_SCL);
81  break;
82  case 8:
83  *(volatile uint8_t *)(&GPIOD_PDOR) = VH;
84  pulse_low(P_WR, B_WR);
85  *(volatile uint8_t *)(&GPIOD_PDOR) = VL;
86  pulse_low(P_WR, B_WR);
87  break;
88  case 16:
89  *(volatile uint8_t *)(&GPIOD_PDOR) = VH;
90  GPIOB_PCOR = 0x000F000F; // clear data lines B0-3,B16-19
91  GPIOB_PSOR = (0x0F & VL) | ((VL >> 4) << 16); // set data lines 0-3,16-19 if set in cl
92  pulse_low(P_WR, B_WR);
93  break;
94  }
95 }
96 
97 void UTFT::_set_direction_registers(byte mode)
98 {
99  GPIOD_PDDR |= 0xFF;
100  PORTD_PCR0 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1);
101  PORTD_PCR1 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1);
102  PORTD_PCR2 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1);
103  PORTD_PCR3 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1);
104  PORTD_PCR4 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1);
105  PORTD_PCR5 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1);
106  PORTD_PCR6 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1);
107  PORTD_PCR7 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1);
108 
109  if (mode == 16)
110  {
111  GPIOB_PDDR |= 0x000F000F;
112  PORTB_PCR0 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1);
113  PORTB_PCR1 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1);
114  PORTB_PCR2 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1);
115  PORTB_PCR3 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1);
116  PORTB_PCR16 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1);
117  PORTB_PCR17 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1);
118  PORTB_PCR18 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1);
119  PORTB_PCR19 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1);
120  }
121 }
122 void UTFT::_fast_fill_16(int ch, int cl, long pix)
123 {
124  long blocks;
125 
126  *(volatile uint8_t *)(&GPIOD_PDOR) = ch;
127  GPIOB_PCOR = 0x000F000F; // clear data lines B0-3,B16-19
128  GPIOB_PSOR = (0x0F & cl) | ((cl >> 4) << 16); // set data lines 0-3,16-19 if set in cl
129 
130  blocks = pix/16;
131  for (int i=0; i<blocks; i++)
132  {
133  pulse_low(P_WR, B_WR);
134  pulse_low(P_WR, B_WR);
135  pulse_low(P_WR, B_WR);
136  pulse_low(P_WR, B_WR);
137  pulse_low(P_WR, B_WR);
138  pulse_low(P_WR, B_WR);
139  pulse_low(P_WR, B_WR);
140  pulse_low(P_WR, B_WR);
141  pulse_low(P_WR, B_WR);
142  pulse_low(P_WR, B_WR);
143  pulse_low(P_WR, B_WR);
144  pulse_low(P_WR, B_WR);
145  pulse_low(P_WR, B_WR);
146  pulse_low(P_WR, B_WR);
147  pulse_low(P_WR, B_WR);
148  pulse_low(P_WR, B_WR);
149  }
150  if ((pix % 16) != 0)
151  for (int i=0; i<(pix % 16); i++)
152  {
153  pulse_low(P_WR, B_WR);
154  }
155 }
156 
157 void UTFT::_fast_fill_8(int ch, long pix)
158 {
159  long blocks;
160 
161  *(volatile uint8_t *)(&GPIOD_PDOR) = ch;
162 
163  blocks = pix/16;
164  for (int i=0; i<blocks; i++)
165  {
166  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
167  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
168  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
169  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
170  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
171  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
172  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
173  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
174  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
175  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
176  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
177  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
178  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
179  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
180  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
181  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
182  }
183  if ((pix % 16) != 0)
184  for (int i=0; i<(pix % 16); i++)
185  {
186  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
187  }
188 }
void _hw_special_init()
Definition: HW_CC3200.h:2