]>
cvs.zerfleddert.de Git - proxmark3-svn/blob - armsrc/example_lcd.c
1 unsigned char somestring
[25];
3 //*********************************************************************
4 //******************** SYSTERM HEARTBEAT @ 10 ms *********************
5 //*********************************************************************
8 //set functionalite to pins:
13 PIOA_PDR
= BIT11
| BIT12
| BIT13
| BIT14
;
14 PIOA_ASR
= BIT11
| BIT12
| BIT13
| BIT14
;
18 PMC_PCER
|= 1 << 5; // Enable SPI timer clock.
20 /**** Fixed mode ****/
21 SPI_CR
= 0x81; //SPI Enable, Sowtware reset
22 SPI_CR
= 0x01; //SPI Enable
26 SPI_MR
= 0x000E0011; //Master mode
27 SPI_CSR0
= 0x01010B11; //9 bit
31 //*********************************************************************
32 //*************************** Task 1 ********************************
33 //*********************************************************************
36 char beat
=0; // just flash the onboard LED for Heatbeat
51 ctl_timeout_wait(ctl_get_current_time()+ 150);
55 //*********************************************************************
56 //*************************** Task 2 ********************************
57 //*********************************************************************
62 unsigned char a
,b
,c
,d
,e
;
64 char seconds
,minutes
,hours
;
66 unsigned int nowold
,tenths
;
72 /******* Put smiley face up in 4096 color mode *******/
73 LCD_Fill(0,0,132,132,Black
);
75 LCD_Set_Resolution(HIGH_RES
); // set 4096 color mode
77 // ShowImage_4096(0,0,smiley);
78 LCD_Set_Resolution(LOW_RES
); // set 256 color mode
80 ctl_timeout_wait(ctl_get_current_time()+ 4000); // wait 4 seconds to view it
82 /******* Do some static on screen *******/
84 LCD_Fill(0,0,132,132,Black
);
88 while( (a
= rand()) > 132);
89 while( (b
= rand()) > 132);
94 /******* Do some lines on screen *******/
95 LCD_Fill(0,0,132,132,Black
);
99 while( (a
= rand()) > 132);
100 while( (b
= rand()) > 132);
101 while( (c
= rand()) > 132);
102 while( (d
= rand()) > 132);
103 e
= rand(); // pick color
106 ctl_timeout_wait(ctl_get_current_time()+ 10);
109 /******* Do some Boxes on screen *******/
110 LCD_Fill(0,0,132,132,Black
);
115 while( (a
= rand()) > 132);
116 while( (b
= rand()) > 132);
117 while( (c
= rand()) > 132);
118 while( (d
= rand()) > 132);
120 e
= rand(); // pick color
123 ctl_timeout_wait(ctl_get_current_time()+ 10);
125 /******* Do some Circles on screen *******/
126 LCD_Fill(0,0,132,132,Black
);
131 while( (a
= rand()) > 132);
132 while( (b
= rand()) > 132);
133 while( (c
= rand()) > 127); // diameter
135 d
= rand(); // pick color
138 ctl_timeout_wait(ctl_get_current_time()+ 10);
141 /******* Do some Thick Circles on screen *******/
142 LCD_Fill(0,0,132,132,Black
);
146 while( (a
= rand()) > 132);
147 while( (b
= rand()) > 132);
148 while( (c
= rand()) > 40); // diameter
149 while( (d
= rand()) > 10); // wall thicknes
150 e
= rand(); // pick color
151 LCD_Thick_Circle(a
,b
,c
,d
,e
);
153 ctl_timeout_wait(ctl_get_current_time()+ 1);
156 /******* Do something funky to wipe screen *******/
161 LCD_Line(a
,b
,65,65,0x62);
165 LCD_Line(a
,b
,65,65,0x62);
169 LCD_Line(a
,b
,65,65,0x62);
173 LCD_Line(a
,b
,65,65,0x62);
176 ctl_timeout_wait(ctl_get_current_time()+ 1000);
178 /******* Show Image scrolling *******/
179 LCD_Fill(0,0,132,132,Black
);
181 ShowImage(0,50,sparkfun
);
183 sprintf(somestring
,"Thanks SparkFun");
184 LCD_String(somestring
,&FONT8x8F
[0][0],5,10,LightGreen
,Black
);
186 ctl_timeout_wait(ctl_get_current_time()+ 2000); // hold sparkfun image for a bit
190 LCD_Line(0,y
-1,132,y
-1,Black
); // wipe the white line as it moves down
191 ShowImage(0,y
,sparkfun
); // move image to Y location
192 ctl_timeout_wait(ctl_get_current_time()+ 25); // wait a bit
195 /******* Run radar in loop with example fonts displayed *******/
196 LCD_Fill(0,0,132,132,Black
);
198 LCD_Thick_Circle(66,66,30,2,DarkBlue
);
204 LCD_Circle_Line(66,66,28,0,y
,LightGreen
);
206 ctl_timeout_wait(ctl_get_current_time()+ 1);
208 tenths
= ctl_current_time
/ 1000;
227 printf("a=%6lu - b=%6lu - c=%6lu - d=%6lu : Time=%lu\r\n",a
,b
,c
,d
,ctl_current_time
);
229 sprintf(somestring
,"%05lu",y
);
230 LCD_String(somestring
,&FONT6x8
[0][0],52,25,White
,Black
);
232 sprintf(somestring
,"Time:%02u:%02u:%02u",hours
,minutes
,seconds
);
233 LCD_String(somestring
,&FONT8x8F
[0][0],14,10,DarkRed
,Black
);
235 sprintf(somestring
,"Time:%02u:%02u:%02u",hours
,minutes
,seconds
);
236 LCD_String(somestring
,&FONT8x16
[0][0],14,115,LightGreen
,Black
);
238 LCD_Circle_Line(66,66,28,0,y
,Black
);
245 ctl_timeout_wait(ctl_get_current_time()+ 10);
250 /*************************************************************************
251 ********************* Main Module *************************
252 ********************* *************************
253 ********************* Initialize Program *************************
254 ********************* Sequences *************************
255 ********************* *************************
256 *************************************************************************/