BayEOS-Arduino  1.8.0_0.0.4
HW_CC3200.h
1 // *** Hardwarespecific functions ***
3 {
4 }
5 
6 void UTFT::LCD_Writ_Bus(char VH,char VL, byte mode)
7 {
8  switch (mode)
9  {
10  case 1:
11  if (display_serial_mode==SERIAL_4PIN)
12  {
13  if (VH==1)
14  sbi(P_SDA, B_SDA);
15  else
16  cbi(P_SDA, B_SDA);
17  pulse_low(P_SCL, B_SCL);
18  }
19  else
20  {
21  if (VH==1)
22  sbi(P_RS, B_RS);
23  else
24  cbi(P_RS, B_RS);
25  }
26 
27  if (VL & 0x80)
28  sbi(P_SDA, B_SDA);
29  else
30  cbi(P_SDA, B_SDA);
31  pulse_low(P_SCL, B_SCL);
32  if (VL & 0x40)
33  sbi(P_SDA, B_SDA);
34  else
35  cbi(P_SDA, B_SDA);
36  pulse_low(P_SCL, B_SCL);
37  if (VL & 0x20)
38  sbi(P_SDA, B_SDA);
39  else
40  cbi(P_SDA, B_SDA);
41  pulse_low(P_SCL, B_SCL);
42  if (VL & 0x10)
43  sbi(P_SDA, B_SDA);
44  else
45  cbi(P_SDA, B_SDA);
46  pulse_low(P_SCL, B_SCL);
47  if (VL & 0x08)
48  sbi(P_SDA, B_SDA);
49  else
50  cbi(P_SDA, B_SDA);
51  pulse_low(P_SCL, B_SCL);
52  if (VL & 0x04)
53  sbi(P_SDA, B_SDA);
54  else
55  cbi(P_SDA, B_SDA);
56  pulse_low(P_SCL, B_SCL);
57  if (VL & 0x02)
58  sbi(P_SDA, B_SDA);
59  else
60  cbi(P_SDA, B_SDA);
61  pulse_low(P_SCL, B_SCL);
62  if (VL & 0x01)
63  sbi(P_SDA, B_SDA);
64  else
65  cbi(P_SDA, B_SDA);
66  pulse_low(P_SCL, B_SCL);
67  break;
68  case 8:
69  HWREG(GPIOA0_BASE + 0x03FC) = VH;
70  pulse_low(P_WR, B_WR);
71  HWREG(GPIOA0_BASE + 0x03FC) = VL;
72  pulse_low(P_WR, B_WR);
73  break;
74  case 16:
75  HWREG(GPIOA0_BASE + 0x03FC) = VH;
76  HWREG(GPIOA1_BASE + 0x03FC) = VL;
77  pulse_low(P_WR, B_WR);
78  break;
79  case LATCHED_16:
80  asm("nop"); // Mode is unsupported
81  break;
82  }
83 }
84 
85 void UTFT::_set_direction_registers(byte mode)
86 {
87  if (mode!=LATCHED_16)
88  {
89  HWREG(GPIOA0_BASE + 0x0400) = 0xFF;
90  for (int i = 0xA0; i <= 0xBC; i+=4)
91  HWREG(0x4402E000 + i) = ((HWREG(0x4402E000 + i) & 0xFFFFFFF0) & ~(3<<10));
92  if (mode==16)
93  {
94  HWREG(GPIOA1_BASE + 0x0400) = 0xFF;
95  for (int i = 0xC0; i <= 0xDC; i+=4)
96  HWREG(0x4402E000 + i) = ((HWREG(0x4402E000 + i) & 0xFFFFFFF0) & ~(3<<10));
97  }
98  }
99  else
100  {
101  asm("nop"); // Mode is unsupported
102  }
103 }
104 
105 void UTFT::_fast_fill_16(int ch, int cl, long pix)
106 {
107  long blocks;
108 
109  HWREG(GPIOA0_BASE + 0x03FC) = ch;
110  HWREG(GPIOA1_BASE + 0x03FC) = cl;
111  blocks = pix/16;
112  for (int i=0; i<blocks; i++)
113  {
114  pulse_low(P_WR, B_WR);
115  pulse_low(P_WR, B_WR);
116  pulse_low(P_WR, B_WR);
117  pulse_low(P_WR, B_WR);
118  pulse_low(P_WR, B_WR);
119  pulse_low(P_WR, B_WR);
120  pulse_low(P_WR, B_WR);
121  pulse_low(P_WR, B_WR);
122  pulse_low(P_WR, B_WR);
123  pulse_low(P_WR, B_WR);
124  pulse_low(P_WR, B_WR);
125  pulse_low(P_WR, B_WR);
126  pulse_low(P_WR, B_WR);
127  pulse_low(P_WR, B_WR);
128  pulse_low(P_WR, B_WR);
129  pulse_low(P_WR, B_WR);
130  }
131  if ((pix % 16) != 0)
132  for (int i=0; i<(pix % 16)+1; i++)
133  {
134  pulse_low(P_WR, B_WR);
135  }
136 }
137 
138 void UTFT::_fast_fill_8(int ch, long pix)
139 {
140  long blocks;
141 
142  HWREG(GPIOA0_BASE + 0x03FC) = ch;
143  blocks = pix/16;
144  for (int i=0; i<blocks; i++)
145  {
146  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
147  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
148  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
149  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
150  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
151  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
152  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
153  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
154  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
155  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
156  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
157  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
158  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
159  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
160  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
161  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
162  }
163  if ((pix % 16) != 0)
164  for (int i=0; i<(pix % 16)+1; i++)
165  {
166  pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
167  }
168 }
169 
170 volatile uint32_t* UTFT::portOutputRegister(int value)
171 {
172  return portBASERegister(value);
173 }
void _hw_special_init()
Definition: HW_CC3200.h:2