Select one of the symbols to view example projects that use it.
 
Outline
#include "stm324x9i_eval_lcd.h"
#include "../../../Utilities/Fonts/fonts.h"
#include "../../../Utilities/Fonts/font24.c"
#include "../../../Utilities/Fonts/font20.c"
#include "../../../Utilities/Fonts/font16.c"
#include "../../../Utilities/Fonts/font12.c"
#include "../../../Utilities/Fonts/font8.c"
#define POLY_X
#define POLY_Y
#define ABS
hltdc_eval
hdma2d_eval
PCLK_profile
ActiveLayer
DrawProp
BSP_LCD_Init()
BSP_LCD_InitEx(uint32_t)
BSP_LCD_GetXSize()
BSP_LCD_GetYSize()
BSP_LCD_LayerDefaultInit(uint16_t, uint32_t)
BSP_LCD_SelectLayer(uint32_t)
BSP_LCD_SetLayerVisible(uint32_t, FunctionalState)
BSP_LCD_SetLayerVisible_NoReload(uint32_t, FunctionalState)
BSP_LCD_SetTransparency(uint32_t, uint8_t)
BSP_LCD_SetTransparency_NoReload(uint32_t, uint8_t)
BSP_LCD_SetLayerAddress(uint32_t, uint32_t)
BSP_LCD_SetLayerAddress_NoReload(uint32_t, uint32_t)
BSP_LCD_SetLayerWindow(uint16_t, uint16_t, uint16_t, uint16_t, uint16_t)
BSP_LCD_SetLayerWindow_NoReload(uint16_t, uint16_t, uint16_t, uint16_t, uint16_t)
BSP_LCD_SetColorKeying(uint32_t, uint32_t)
BSP_LCD_SetColorKeying_NoReload(uint32_t, uint32_t)
BSP_LCD_ResetColorKeying(uint32_t)
BSP_LCD_ResetColorKeying_NoReload(uint32_t)
BSP_LCD_Relaod(uint32_t)
BSP_LCD_SetTextColor(uint32_t)
BSP_LCD_GetTextColor()
BSP_LCD_SetBackColor(uint32_t)
BSP_LCD_GetBackColor()
BSP_LCD_SetFont(sFONT *)
BSP_LCD_GetFont()
BSP_LCD_ReadPixel(uint16_t, uint16_t)
BSP_LCD_Clear(uint32_t)
BSP_LCD_ClearStringLine(uint32_t)
BSP_LCD_DisplayChar(uint16_t, uint16_t, uint8_t)
BSP_LCD_DisplayStringAt(uint16_t, uint16_t, uint8_t *, Text_AlignModeTypdef)
BSP_LCD_DisplayStringAtLine(uint16_t, uint8_t *)
BSP_LCD_DrawHLine(uint16_t, uint16_t, uint16_t)
BSP_LCD_DrawVLine(uint16_t, uint16_t, uint16_t)
BSP_LCD_DrawLine(uint16_t, uint16_t, uint16_t, uint16_t)
BSP_LCD_DrawRect(uint16_t, uint16_t, uint16_t, uint16_t)
BSP_LCD_DrawCircle(uint16_t, uint16_t, uint16_t)
BSP_LCD_DrawPolygon(pPoint, uint16_t)
BSP_LCD_DrawEllipse(int, int, int, int)
BSP_LCD_DrawBitmap(uint32_t, uint32_t, uint8_t *)
BSP_LCD_FillRect(uint16_t, uint16_t, uint16_t, uint16_t)
BSP_LCD_FillCircle(uint16_t, uint16_t, uint16_t)
BSP_LCD_FillPolygon(pPoint, uint16_t)
BSP_LCD_FillEllipse(int, int, int, int)
BSP_LCD_DisplayOn()
BSP_LCD_DisplayOff()
MspInit()
BSP_LCD_ClockConfig(LTDC_HandleTypeDef *, void *)
BSP_LCD_DrawPixel(uint16_t, uint16_t, uint32_t)
DrawChar(uint16_t, uint16_t, const uint8_t *)
FillTriangle(uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t)
LL_FillBuffer(uint32_t, void *, uint32_t, uint32_t, uint32_t, uint32_t)
LL_ConvertLineToARGB8888(void *, void *, uint32_t, uint32_t)
Files
loading...
SourceVuSTM32 Libraries and SamplesSTM324x9I_EVALstm324x9i_eval_lcd.c
 
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/** ****************************************************************************** * @file stm324x9i_eval_lcd.c * @author MCD Application Team * @brief This file includes the driver for Liquid Crystal Display (LCD) module * mounted on STM324x9I-EVAL evaluation board. ****************************************************************************** * @attention * * Copyright (c) 2017 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** *//* ... */ /* File Info: ------------------------------------------------------------------ User NOTES 1. How To use this driver: -------------------------- - This driver is used to drive directly an LCD TFT using the LTDC controller. - This driver selects dynamically the mounted LCD, AMPIRE 640x480 LCD mounted on MB1063 or AMPIRE 480x272 LCD mounted on MB1046 daughter board, and uses the adequate timing and setting for the specified LCD using device ID of the STMPE811 mounted on MB1046 daughter board. 2. Driver description: --------------------- + Initialization steps: o Initialize the LCD using the BSP_LCD_Init() function. o Apply the Layer configuration using the BSP_LCD_LayerDefaultInit() function. o Select the LCD layer to be used using the BSP_LCD_SelectLayer() function. o Enable the LCD display using the BSP_LCD_DisplayOn() function. + Options o Configure and enable the color keying functionality using the BSP_LCD_SetColorKeying() function. o Modify in the fly the transparency and/or the frame buffer address using the following functions: - BSP_LCD_SetTransparency() - BSP_LCD_SetLayerAddress() + Display on LCD o Clear the hole LCD using BSP_LCD_Clear() function or only one specified string line using the BSP_LCD_ClearStringLine() function. o Display a character on the specified line and column using the BSP_LCD_DisplayChar() function or a complete string line using the BSP_LCD_DisplayStringAtLine() function. o Display a string line on the specified position (x,y in pixel) and align mode using the BSP_LCD_DisplayStringAtLine() function. o Draw and fill a basic shapes (dot, line, rectangle, circle, ellipse, .. bitmap) on LCD using the available set of functions. ------------------------------------------------------------------------------*//* ... */ /* Includes ------------------------------------------------------------------*/ #include "stm324x9i_eval_lcd.h" #include "../../../Utilities/Fonts/fonts.h" #include "../../../Utilities/Fonts/font24.c" #include "../../../Utilities/Fonts/font20.c" #include "../../../Utilities/Fonts/font16.c" #include "../../../Utilities/Fonts/font12.c" #include "../../../Utilities/Fonts/font8.c" 7 includes /** @addtogroup BSP * @{ *//* ... */ /** @addtogroup STM324x9I_EVAL * @{ *//* ... */ /** @defgroup STM324x9I_EVAL_LCD STM324x9I EVAL LCD * @{ *//* ... */ /** @defgroup STM324x9I_EVAL_LCD_Private_Macros STM324x9I EVAL LCD Private Macros * @{ *//* ... */ #define POLY_X(Z) ((int32_t)((Points + Z)->X)) #define POLY_Y(Z) ((int32_t)((Points + Z)->Y)) #define ABS(X) ((X) > 0 ? (X) : -(X)) /** * @} *//* ... */ /** @defgroup STM324x9I_EVAL_LCD_Private_Variables STM324x9I EVAL LCD Private Variables * @{ *//* ... */ LTDC_HandleTypeDef hltdc_eval; static DMA2D_HandleTypeDef hdma2d_eval; static uint32_t PCLK_profile = LCD_MAX_PCLK; /* Default LCD configuration with LCD Layer 1 */ static uint32_t ActiveLayer = 0; static LCD_DrawPropTypeDef DrawProp[MAX_LAYER_NUMBER]; /** * @} *//* ... */ /** @defgroup STM324x9I_EVAL_LCD_Private_FunctionPrototypes STM324x9I EVAL LCD Private FunctionPrototypes * @{ *//* ... */ static void MspInit(void); static void DrawChar(uint16_t Xpos, uint16_t Ypos, const uint8_t *c); static void FillTriangle(uint16_t x1, uint16_t x2, uint16_t x3, uint16_t y1, uint16_t y2, uint16_t y3); static void LL_FillBuffer(uint32_t LayerIndex, void *pDst, uint32_t xSize, uint32_t ySize, uint32_t OffLine, uint32_t ColorIndex); static void LL_ConvertLineToARGB8888(void * pSrc, void *pDst, uint32_t xSize, uint32_t ColorMode); /** * @} *//* ... */ /** @defgroup STM324x9I_EVAL_LCD_Private_Functions STM324x9I EVAL LCD Private Functions * @{ *//* ... */ /** * @brief Initializes the LCD. * @retval LCD state *//* ... */ uint8_t BSP_LCD_Init(void) { return (BSP_LCD_InitEx(LCD_MAX_PCLK)); }{ ... } /** * @brief Initializes the LCD. * @param PclkConfig : pixel clock profile * @retval LCD state *//* ... */ uint8_t BSP_LCD_InitEx(uint32_t PclkConfig) { PCLK_profile = PclkConfig; /* Select the used LCD */ /* The AMPIRE 480x272 does not contain an ID register then we check the availability of AMPIRE 480x640 LCD using device ID of the STMPE811 mounted on MB1046 daughter board *//* ... */ if(stmpe811_ts_drv.ReadID(TS_I2C_ADDRESS) == STMPE811_ID) { /* The AMPIRE LCD 480x272 is selected */ /* Timing Configuration */ hltdc_eval.Init.HorizontalSync = (AMPIRE480272_HSYNC - 1); hltdc_eval.Init.VerticalSync = (AMPIRE480272_VSYNC - 1); hltdc_eval.Init.AccumulatedHBP = (AMPIRE480272_HSYNC + AMPIRE480272_HBP - 1); hltdc_eval.Init.AccumulatedVBP = (AMPIRE480272_VSYNC + AMPIRE480272_VBP - 1); hltdc_eval.Init.AccumulatedActiveH = (AMPIRE480272_HEIGHT + AMPIRE480272_VSYNC + AMPIRE480272_VBP - 1); hltdc_eval.Init.AccumulatedActiveW = (AMPIRE480272_WIDTH + AMPIRE480272_HSYNC + AMPIRE480272_HBP - 1); hltdc_eval.Init.TotalHeigh = (AMPIRE480272_HEIGHT + AMPIRE480272_VSYNC + AMPIRE480272_VBP + AMPIRE480272_VFP - 1); hltdc_eval.Init.TotalWidth = (AMPIRE480272_WIDTH + AMPIRE480272_HSYNC + AMPIRE480272_HBP + AMPIRE480272_HFP - 1); /* Initialize the LCD pixel width and pixel height */ hltdc_eval.LayerCfg->ImageWidth = AMPIRE480272_WIDTH; hltdc_eval.LayerCfg->ImageHeight = AMPIRE480272_HEIGHT; }if (stmpe811_ts_drv.ReadID(TS_I2C_ADDRESS) == STMPE811_ID) { ... } else { /* The LCD AMPIRE 640x480 is selected */ /* Timing configuration */ hltdc_eval.Init.HorizontalSync = (AMPIRE640480_HSYNC - 1); hltdc_eval.Init.VerticalSync = (AMPIRE640480_VSYNC - 1); hltdc_eval.Init.AccumulatedHBP = (AMPIRE640480_HSYNC + AMPIRE640480_HBP - 1); hltdc_eval.Init.AccumulatedVBP = (AMPIRE640480_VSYNC + AMPIRE640480_VBP - 1); hltdc_eval.Init.AccumulatedActiveH = (AMPIRE640480_HEIGHT + AMPIRE640480_VSYNC + AMPIRE640480_VBP - 1); hltdc_eval.Init.AccumulatedActiveW = (AMPIRE640480_WIDTH + AMPIRE640480_HSYNC + AMPIRE640480_HBP - 1); hltdc_eval.Init.TotalHeigh = (AMPIRE640480_HEIGHT + AMPIRE640480_VSYNC + AMPIRE640480_VBP + AMPIRE640480_VFP - 1); hltdc_eval.Init.TotalWidth = (AMPIRE640480_WIDTH + AMPIRE640480_HSYNC + AMPIRE640480_HBP + AMPIRE640480_HFP - 1); /* Initialize the LCD pixel width and pixel height */ hltdc_eval.LayerCfg->ImageWidth = AMPIRE640480_WIDTH; hltdc_eval.LayerCfg->ImageHeight = AMPIRE640480_HEIGHT; }else { ... } /* Background value */ hltdc_eval.Init.Backcolor.Blue = 0; hltdc_eval.Init.Backcolor.Green = 0; hltdc_eval.Init.Backcolor.Red = 0; /* Polarity */ hltdc_eval.Init.HSPolarity = LTDC_HSPOLARITY_AL; hltdc_eval.Init.VSPolarity = LTDC_VSPOLARITY_AL; hltdc_eval.Init.DEPolarity = LTDC_DEPOLARITY_AL; hltdc_eval.Init.PCPolarity = LTDC_PCPOLARITY_IPC; hltdc_eval.Instance = LTDC; /* LCD clock configuration */ BSP_LCD_ClockConfig(&hltdc_eval, &PCLK_profile); MspInit(); HAL_LTDC_Init(&hltdc_eval); #if !defined(DATA_IN_ExtSDRAM) /* Initialize the SDRAM */ BSP_SDRAM_Init();/* ... */ #endif /* DATA_IN_ExtSDRAM */ /* Initialize the font */ BSP_LCD_SetFont(&LCD_DEFAULT_FONT); return LCD_OK; }{ ... } /** * @brief Gets the LCD X size. * @retval Used LCD X size *//* ... */ uint32_t BSP_LCD_GetXSize(void) { return hltdc_eval.LayerCfg[ActiveLayer].ImageWidth; }{ ... } /** * @brief Gets the LCD Y size. * @retval Used LCD Y size *//* ... */ uint32_t BSP_LCD_GetYSize(void) { return hltdc_eval.LayerCfg[ActiveLayer].ImageHeight; }{ ... } /** * @brief Initializes the LCD layers. * @param LayerIndex: Layer foreground or background * @param FB_Address: Layer frame buffer *//* ... */ void BSP_LCD_LayerDefaultInit(uint16_t LayerIndex, uint32_t FB_Address) { LCD_LayerCfgTypeDef Layercfg; /* Layer Init */ Layercfg.WindowX0 = 0; Layercfg.WindowX1 = BSP_LCD_GetXSize(); Layercfg.WindowY0 = 0; Layercfg.WindowY1 = BSP_LCD_GetYSize(); Layercfg.PixelFormat = LTDC_PIXEL_FORMAT_ARGB8888; Layercfg.FBStartAdress = FB_Address; Layercfg.Alpha = 255; Layercfg.Alpha0 = 0; Layercfg.Backcolor.Blue = 0; Layercfg.Backcolor.Green = 0; Layercfg.Backcolor.Red = 0; Layercfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_PAxCA; Layercfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_PAxCA; Layercfg.ImageWidth = BSP_LCD_GetXSize(); Layercfg.ImageHeight = BSP_LCD_GetYSize(); HAL_LTDC_ConfigLayer(&hltdc_eval, &Layercfg, LayerIndex); DrawProp[LayerIndex].BackColor = LCD_COLOR_WHITE; DrawProp[LayerIndex].pFont = &Font24; DrawProp[LayerIndex].TextColor = LCD_COLOR_BLACK; }{ ... } /** * @brief Selects the LCD Layer. * @param LayerIndex: Layer foreground or background *//* ... */ void BSP_LCD_SelectLayer(uint32_t LayerIndex) { ActiveLayer = LayerIndex; }{ ... } /** * @brief Sets an LCD Layer visible * @param LayerIndex: Visible Layer * @param State: New state of the specified layer * This parameter can be one of the following values: * @arg ENABLE * @arg DISABLE *//* ... */ void BSP_LCD_SetLayerVisible(uint32_t LayerIndex, FunctionalState State) { if(State == ENABLE) { __HAL_LTDC_LAYER_ENABLE(&hltdc_eval, LayerIndex); }if (State == ENABLE) { ... } else { __HAL_LTDC_LAYER_DISABLE(&hltdc_eval, LayerIndex); }else { ... } __HAL_LTDC_RELOAD_CONFIG(&hltdc_eval); }{ ... } /** * @brief Sets an LCD Layer visible without reloading. * @param LayerIndex: Visible Layer * @param State: New state of the specified layer * This parameter can be one of the following values: * @arg ENABLE * @arg DISABLE * @retval None *//* ... */ void BSP_LCD_SetLayerVisible_NoReload(uint32_t LayerIndex, FunctionalState State) { if(State == ENABLE) { __HAL_LTDC_LAYER_ENABLE(&hltdc_eval, LayerIndex); }if (State == ENABLE) { ... } else { __HAL_LTDC_LAYER_DISABLE(&hltdc_eval, LayerIndex); }else { ... } /* Do not Sets the Reload */ }{ ... } /** * @brief Configures the transparency. * @param LayerIndex: Layer foreground or background. * @param Transparency: Transparency * This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF *//* ... */ void BSP_LCD_SetTransparency(uint32_t LayerIndex, uint8_t Transparency) { HAL_LTDC_SetAlpha(&hltdc_eval, Transparency, LayerIndex); }{ ... } /** * @brief Configures the transparency without reloading. * @param LayerIndex: Layer foreground or background. * @param Transparency: Transparency * This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF * @retval None *//* ... */ void BSP_LCD_SetTransparency_NoReload(uint32_t LayerIndex, uint8_t Transparency) { HAL_LTDC_SetAlpha_NoReload(&hltdc_eval, Transparency, LayerIndex); }{ ... } /** * @brief Sets an LCD layer frame buffer address. * @param LayerIndex: Layer foreground or background * @param Address: New LCD frame buffer value *//* ... */ void BSP_LCD_SetLayerAddress(uint32_t LayerIndex, uint32_t Address) { HAL_LTDC_SetAddress(&hltdc_eval, Address, LayerIndex); }{ ... } /** * @brief Sets an LCD layer frame buffer address without reloading. * @param LayerIndex: Layer foreground or background * @param Address: New LCD frame buffer value * @retval None *//* ... */ void BSP_LCD_SetLayerAddress_NoReload(uint32_t LayerIndex, uint32_t Address) { HAL_LTDC_SetAddress_NoReload(&hltdc_eval, Address, LayerIndex); }{ ... } /** * @brief Sets display window. * @param LayerIndex: Layer index * @param Xpos: LCD X position * @param Ypos: LCD Y position * @param Width: LCD window width * @param Height: LCD window height *//* ... */ void BSP_LCD_SetLayerWindow(uint16_t LayerIndex, uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height) { /* Reconfigure the layer size */ HAL_LTDC_SetWindowSize(&hltdc_eval, Width, Height, LayerIndex); /* Reconfigure the layer position */ HAL_LTDC_SetWindowPosition(&hltdc_eval, Xpos, Ypos, LayerIndex); }{ ... } /** * @brief Sets display window without reloading. * @param LayerIndex: Layer index * @param Xpos: LCD X position * @param Ypos: LCD Y position * @param Width: LCD window width * @param Height: LCD window height * @retval None *//* ... */ void BSP_LCD_SetLayerWindow_NoReload(uint16_t LayerIndex, uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height) { /* Reconfigure the layer size */ HAL_LTDC_SetWindowSize_NoReload(&hltdc_eval, Width, Height, LayerIndex); /* Reconfigure the layer position */ HAL_LTDC_SetWindowPosition_NoReload(&hltdc_eval, Xpos, Ypos, LayerIndex); }{ ... } /** * @brief Configures and sets the color keying. * @param LayerIndex: Layer foreground or background * @param RGBValue: Color reference *//* ... */ void BSP_LCD_SetColorKeying(uint32_t LayerIndex, uint32_t RGBValue) { /* Configure and Enable the color Keying for LCD Layer */ HAL_LTDC_ConfigColorKeying(&hltdc_eval, RGBValue, LayerIndex); HAL_LTDC_EnableColorKeying(&hltdc_eval, LayerIndex); }{ ... } /** * @brief Configures and sets the color keying without reloading. * @param LayerIndex: Layer foreground or background * @param RGBValue: Color reference * @retval None *//* ... */ void BSP_LCD_SetColorKeying_NoReload(uint32_t LayerIndex, uint32_t RGBValue) { /* Configure and Enable the color Keying for LCD Layer */ HAL_LTDC_ConfigColorKeying_NoReload(&hltdc_eval, RGBValue, LayerIndex); HAL_LTDC_EnableColorKeying_NoReload(&hltdc_eval, LayerIndex); }{ ... } /** * @brief Disables the color keying. * @param LayerIndex: Layer foreground or background *//* ... */ void BSP_LCD_ResetColorKeying(uint32_t LayerIndex) { /* Disable the color Keying for LCD Layer */ HAL_LTDC_DisableColorKeying(&hltdc_eval, LayerIndex); }{ ... } /** * @brief Disables the color keying without reloading. * @param LayerIndex: Layer foreground or background * @retval None *//* ... */ void BSP_LCD_ResetColorKeying_NoReload(uint32_t LayerIndex) { /* Disable the color Keying for LCD Layer */ HAL_LTDC_DisableColorKeying_NoReload(&hltdc_eval, LayerIndex); }{ ... } /** * @brief Disables the color keying without reloading. * @param ReloadType: can be one of the following values * - LCD_RELOAD_IMMEDIATE * - LCD_RELOAD_VERTICAL_BLANKING * @retval None *//* ... */ void BSP_LCD_Relaod(uint32_t ReloadType) { HAL_LTDC_Relaod (&hltdc_eval, ReloadType); }{ ... } /** * @brief Sets the LCD text color. * @param Color: Text color code ARGB(8-8-8-8) *//* ... */ void BSP_LCD_SetTextColor(uint32_t Color) { DrawProp[ActiveLayer].TextColor = Color; }{ ... } /** * @brief Gets the LCD text color. * @retval Used text color. *//* ... */ uint32_t BSP_LCD_GetTextColor(void) { return DrawProp[ActiveLayer].TextColor; }{ ... } /** * @brief Sets the LCD background color. * @param Color: Layer background color code ARGB(8-8-8-8) *//* ... */ void BSP_LCD_SetBackColor(uint32_t Color) { DrawProp[ActiveLayer].BackColor = Color; }{ ... } /** * @brief Gets the LCD background color. * @retval Used background color *//* ... */ uint32_t BSP_LCD_GetBackColor(void) { return DrawProp[ActiveLayer].BackColor; }{ ... } /** * @brief Sets the LCD text font. * @param fonts: Layer font to be used *//* ... */ void BSP_LCD_SetFont(sFONT *fonts) { DrawProp[ActiveLayer].pFont = fonts; }{ ... } /** * @brief Gets the LCD text font. * @retval Used layer font *//* ... */ sFONT *BSP_LCD_GetFont(void) { return DrawProp[ActiveLayer].pFont; }{ ... } /** * @brief Reads an LCD pixel. * @param Xpos: X position * @param Ypos: Y position * @retval RGB pixel color *//* ... */ uint32_t BSP_LCD_ReadPixel(uint16_t Xpos, uint16_t Ypos) { uint32_t ret = 0; if(hltdc_eval.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_ARGB8888) { /* Read data value from SDRAM memory */ ret = *(__IO uint32_t*) (hltdc_eval.LayerCfg[ActiveLayer].FBStartAdress + (4*(Ypos*BSP_LCD_GetXSize() + Xpos))); }if (hltdc_eval.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_ARGB8888) { ... } else if(hltdc_eval.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_RGB888) { /* Read data value from SDRAM memory */ ret = (*(__IO uint32_t*) (hltdc_eval.LayerCfg[ActiveLayer].FBStartAdress + (4*(Ypos*BSP_LCD_GetXSize() + Xpos))) & 0x00FFFFFF); }else if (hltdc_eval.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_RGB888) { ... } else if((hltdc_eval.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_RGB565) || \ (hltdc_eval.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_ARGB4444) || \ (hltdc_eval.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_AL88)) { /* Read data value from SDRAM memory */ ret = *(__IO uint16_t*) (hltdc_eval.LayerCfg[ActiveLayer].FBStartAdress + (2*(Ypos*BSP_LCD_GetXSize() + Xpos))); }else if ((hltdc_eval.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_RGB565) || \ (hltdc_eval.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_ARGB4444) || \ (hltdc_eval.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_AL88)) { ... } else { /* Read data value from SDRAM memory */ ret = *(__IO uint8_t*) (hltdc_eval.LayerCfg[ActiveLayer].FBStartAdress + (2*(Ypos*BSP_LCD_GetXSize() + Xpos))); }else { ... } return ret; }{ ... } /** * @brief Clears the hole LCD. * @param Color: Color of the background *//* ... */ void BSP_LCD_Clear(uint32_t Color) { /* Clear the LCD */ LL_FillBuffer(ActiveLayer, (uint32_t *)(hltdc_eval.LayerCfg[ActiveLayer].FBStartAdress), BSP_LCD_GetXSize(), BSP_LCD_GetYSize(), 0, Color); }{ ... } /** * @brief Clears the selected line. * @param Line: Line to be cleared *//* ... */ void BSP_LCD_ClearStringLine(uint32_t Line) { uint32_t color_backup = DrawProp[ActiveLayer].TextColor; DrawProp[ActiveLayer].TextColor = DrawProp[ActiveLayer].BackColor; /* Draw rectangle with background color */ BSP_LCD_FillRect(0, (Line * DrawProp[ActiveLayer].pFont->Height), BSP_LCD_GetXSize(), DrawProp[ActiveLayer].pFont->Height); DrawProp[ActiveLayer].TextColor = color_backup; BSP_LCD_SetTextColor(DrawProp[ActiveLayer].TextColor); }{ ... } /** * @brief Displays one character. * @param Xpos: Start column address * @param Ypos: Line where to display the character shape. * @param Ascii: Character ascii code * This parameter must be a number between Min_Data = 0x20 and Max_Data = 0x7E *//* ... */ void BSP_LCD_DisplayChar(uint16_t Xpos, uint16_t Ypos, uint8_t Ascii) { DrawChar(Xpos, Ypos, &DrawProp[ActiveLayer].pFont->table[(Ascii-' ') *\ DrawProp[ActiveLayer].pFont->Height * ((DrawProp[ActiveLayer].pFont->Width + 7) / 8)]); }{ ... } /** * @brief Displays characters on the LCD. * @param Xpos: X position (in pixel) * @param Ypos: Y position (in pixel) * @param Text: Pointer to string to display on LCD * @param Mode: Display mode * This parameter can be one of the following values: * @arg CENTER_MODE * @arg RIGHT_MODE * @arg LEFT_MODE *//* ... */ void BSP_LCD_DisplayStringAt(uint16_t Xpos, uint16_t Ypos, uint8_t *Text, Text_AlignModeTypdef Mode) { uint16_t refcolumn = 1, i = 0; uint32_t size = 0, xsize = 0; uint8_t *ptr = Text; /* Get the text size */ while (*ptr++) size ++ ; /* Characters number per line */ xsize = (BSP_LCD_GetXSize()/DrawProp[ActiveLayer].pFont->Width); switch (Mode) { case CENTER_MODE: { refcolumn = Xpos + ((xsize - size)* DrawProp[ActiveLayer].pFont->Width) / 2; break; ...}case CENTER_MODE: case LEFT_MODE: { refcolumn = Xpos; break; ...}case LEFT_MODE: case RIGHT_MODE: { refcolumn = - Xpos + ((xsize - size)*DrawProp[ActiveLayer].pFont->Width); break; ...} case RIGHT_MODE: default: { refcolumn = Xpos; break; ...}default }switch (Mode) { ... } /* Send the string character by character on LCD */ while ((*Text != 0) & (((BSP_LCD_GetXSize() - (i*DrawProp[ActiveLayer].pFont->Width)) & 0xFFFF) >= DrawProp[ActiveLayer].pFont->Width)) { /* Display one character on LCD */ BSP_LCD_DisplayChar(refcolumn, Ypos, *Text); /* Decrement the column position by 16 */ refcolumn += DrawProp[ActiveLayer].pFont->Width; /* Point on the next character */ Text++; i++; }while ((*Text != 0) & (((BSP_LCD_GetXSize() - (i*DrawProp[ActiveLayer].pFont->Width)) & 0xFFFF) >= DrawProp[ActiveLayer].pFont->Width)) { ... } }{ ... } /** * @brief Displays a maximum of 60 characters on the LCD. * @param Line: Line where to display the character shape * @param ptr: Pointer to string to display on LCD *//* ... */ void BSP_LCD_DisplayStringAtLine(uint16_t Line, uint8_t *ptr) { BSP_LCD_DisplayStringAt(0, LINE(Line), ptr, LEFT_MODE); }{ ... } /** * @brief Draws an horizontal line. * @param Xpos: X position * @param Ypos: Y position * @param Length: Line length *//* ... */ void BSP_LCD_DrawHLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length) { uint32_t Xaddress = 0; /* Get the line address */ Xaddress = (hltdc_eval.LayerCfg[ActiveLayer].FBStartAdress) + 4*(BSP_LCD_GetXSize()*Ypos + Xpos); /* Write line */ LL_FillBuffer(ActiveLayer, (uint32_t *)Xaddress, Length, 1, 0, DrawProp[ActiveLayer].TextColor); }{ ... } /** * @brief Draws a vertical line. * @param Xpos: X position * @param Ypos: Y position * @param Length: Line length *//* ... */ void BSP_LCD_DrawVLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length) { uint32_t Xaddress = 0; /* Get the line address */ Xaddress = (hltdc_eval.LayerCfg[ActiveLayer].FBStartAdress) + 4*(BSP_LCD_GetXSize()*Ypos + Xpos); /* Write line */ LL_FillBuffer(ActiveLayer, (uint32_t *)Xaddress, 1, Length, (BSP_LCD_GetXSize() - 1), DrawProp[ActiveLayer].TextColor); }{ ... } /** * @brief Draws an uni-line (between two points). * @param x1: Point 1 X position * @param y1: Point 1 Y position * @param x2: Point 2 X position * @param y2: Point 2 Y position *//* ... */ void BSP_LCD_DrawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) { int16_t deltax = 0, deltay = 0, x = 0, y = 0, xinc1 = 0, xinc2 = 0, yinc1 = 0, yinc2 = 0, den = 0, num = 0, numadd = 0, numpixels = 0, curpixel = 0; deltax = ABS(x2 - x1); /* The difference between the x's */ deltay = ABS(y2 - y1); /* The difference between the y's */ x = x1; /* Start x off at the first pixel */ y = y1; /* Start y off at the first pixel */ if (x2 >= x1) /* The x-values are increasing */ { xinc1 = 1; xinc2 = 1; ...} else /* The x-values are decreasing */ { xinc1 = -1; xinc2 = -1; }else { ... } if (y2 >= y1) /* The y-values are increasing */ { yinc1 = 1; yinc2 = 1; ...} else /* The y-values are decreasing */ { yinc1 = -1; yinc2 = -1; }else { ... } if (deltax >= deltay) /* There is at least one x-value for every y-value */ { xinc1 = 0; /* Don't change the x when numerator >= denominator */ yinc2 = 0; /* Don't change the y for every iteration */ den = deltax; num = deltax / 2; numadd = deltay; numpixels = deltax; /* There are more x-values than y-values */ ...} else /* There is at least one y-value for every x-value */ { xinc2 = 0; /* Don't change the x for every iteration */ yinc1 = 0; /* Don't change the y when numerator >= denominator */ den = deltay; num = deltay / 2; numadd = deltax; numpixels = deltay; /* There are more y-values than x-values */ }else { ... } for (curpixel = 0; curpixel <= numpixels; curpixel++) { BSP_LCD_DrawPixel(x, y, DrawProp[ActiveLayer].TextColor); /* Draw the current pixel */ num += numadd; /* Increase the numerator by the top of the fraction */ if (num >= den) /* Check if numerator >= denominator */ { num -= den; /* Calculate the new numerator value */ x += xinc1; /* Change the x as appropriate */ y += yinc1; /* Change the y as appropriate */ ...} x += xinc2; /* Change the x as appropriate */ y += yinc2; /* Change the y as appropriate */ }for (curpixel = 0; curpixel <= numpixels; curpixel++) { ... } }{ ... } /** * @brief Draws a rectangle. * @param Xpos: X position * @param Ypos: Y position * @param Width: Rectangle width * @param Height: Rectangle height *//* ... */ void BSP_LCD_DrawRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height) { /* Draw horizontal lines */ BSP_LCD_DrawHLine(Xpos, Ypos, Width); BSP_LCD_DrawHLine(Xpos, (Ypos+ Height), Width); /* Draw vertical lines */ BSP_LCD_DrawVLine(Xpos, Ypos, Height); BSP_LCD_DrawVLine((Xpos + Width), Ypos, Height); }{ ... } /** * @brief Draws a circle. * @param Xpos: X position * @param Ypos: Y position * @param Radius: Circle radius *//* ... */ void BSP_LCD_DrawCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius) { int32_t D; /* Decision Variable */ uint32_t CurX; /* Current X Value */ uint32_t CurY; /* Current Y Value */ D = 3 - (Radius << 1); CurX = 0; CurY = Radius; while (CurX <= CurY) { BSP_LCD_DrawPixel((Xpos + CurX), (Ypos - CurY), DrawProp[ActiveLayer].TextColor); BSP_LCD_DrawPixel((Xpos - CurX), (Ypos - CurY), DrawProp[ActiveLayer].TextColor); BSP_LCD_DrawPixel((Xpos + CurY), (Ypos - CurX), DrawProp[ActiveLayer].TextColor); BSP_LCD_DrawPixel((Xpos - CurY), (Ypos - CurX), DrawProp[ActiveLayer].TextColor); BSP_LCD_DrawPixel((Xpos + CurX), (Ypos + CurY), DrawProp[ActiveLayer].TextColor); BSP_LCD_DrawPixel((Xpos - CurX), (Ypos + CurY), DrawProp[ActiveLayer].TextColor); BSP_LCD_DrawPixel((Xpos + CurY), (Ypos + CurX), DrawProp[ActiveLayer].TextColor); BSP_LCD_DrawPixel((Xpos - CurY), (Ypos + CurX), DrawProp[ActiveLayer].TextColor); if (D < 0) { D += (CurX << 2) + 6; }if (D < 0) { ... } else { D += ((CurX - CurY) << 2) + 10; CurY--; }else { ... } CurX++; }while (CurX <= CurY) { ... } }{ ... } /** * @brief Draws an poly-line (between many points). * @param Points: Pointer to the points array * @param PointCount: Number of points *//* ... */ void BSP_LCD_DrawPolygon(pPoint Points, uint16_t PointCount) { int16_t X = 0, Y = 0; if(PointCount < 2) { return; }if (PointCount < 2) { ... } BSP_LCD_DrawLine(Points->X, Points->Y, (Points+PointCount-1)->X, (Points+PointCount-1)->Y); while(--PointCount) { X = Points->X; Y = Points->Y; Points++; BSP_LCD_DrawLine(X, Y, Points->X, Points->Y); }while (--PointCount) { ... } }{ ... } /** * @brief Draws an ellipse on LCD. * @param Xpos: X position * @param Ypos: Y position * @param XRadius: Ellipse X radius * @param YRadius: Ellipse Y radius *//* ... */ void BSP_LCD_DrawEllipse(int Xpos, int Ypos, int XRadius, int YRadius) { int x = 0, y = -YRadius, err = 2-2*XRadius, e2; float K = 0, rad1 = 0, rad2 = 0; rad1 = XRadius; rad2 = YRadius; K = (float)(rad2/rad1); do { BSP_LCD_DrawPixel((Xpos-(uint16_t)(x/K)), (Ypos+y), DrawProp[ActiveLayer].TextColor); BSP_LCD_DrawPixel((Xpos+(uint16_t)(x/K)), (Ypos+y), DrawProp[ActiveLayer].TextColor); BSP_LCD_DrawPixel((Xpos+(uint16_t)(x/K)), (Ypos-y), DrawProp[ActiveLayer].TextColor); BSP_LCD_DrawPixel((Xpos-(uint16_t)(x/K)), (Ypos-y), DrawProp[ActiveLayer].TextColor); e2 = err; if (e2 <= x) { err += ++x*2+1; if (-y == x && e2 <= y) e2 = 0; }if (e2 <= x) { ... } if (e2 > y) err += ++y*2+1; ...} while (y <= 0); }{ ... } /** * @brief Draws a bitmap picture loaded in the internal Flash (32 bpp). * @param Xpos: Bmp X position in the LCD * @param Ypos: Bmp Y position in the LCD * @param pbmp: Pointer to Bmp picture address in the internal Flash *//* ... */ void BSP_LCD_DrawBitmap(uint32_t Xpos, uint32_t Ypos, uint8_t *pbmp) { uint32_t index = 0, width = 0, height = 0, bit_pixel = 0; uint32_t Address; uint32_t InputColorMode = 0; /* Get bitmap data address offset */ index = pbmp[10] + (pbmp[11] << 8) + (pbmp[12] << 16) + (pbmp[13] << 24); /* Read bitmap width */ width = pbmp[18] + (pbmp[19] << 8) + (pbmp[20] << 16) + (pbmp[21] << 24); /* Read bitmap height */ height = pbmp[22] + (pbmp[23] << 8) + (pbmp[24] << 16) + (pbmp[25] << 24); /* Read bit/pixel */ bit_pixel = pbmp[28] + (pbmp[29] << 8); /* Set the address */ Address = hltdc_eval.LayerCfg[ActiveLayer].FBStartAdress + (((BSP_LCD_GetXSize()*Ypos) + Xpos)*(4)); /* Get the layer pixel format */ if ((bit_pixel/8) == 4) { InputColorMode = CM_ARGB8888; }if ((bit_pixel/8) == 4) { ... } else if ((bit_pixel/8) == 2) { InputColorMode = CM_RGB565; }else if ((bit_pixel/8) == 2) { ... } else { InputColorMode = CM_RGB888; }else { ... } /* Bypass the bitmap header */ pbmp += (index + (width * (height - 1) * (bit_pixel/8))); /* Convert picture to ARGB8888 pixel format */ for(index=0; index < height; index++) { /* Pixel format conversion */ LL_ConvertLineToARGB8888((uint32_t *)pbmp, (uint32_t *)Address, width, InputColorMode); /* Increment the source and destination buffers */ Address+= (BSP_LCD_GetXSize()*4); pbmp -= width*(bit_pixel/8); }for (index=0; index < height; index++) { ... } }{ ... } /** * @brief Draws a full rectangle. * @param Xpos: X position * @param Ypos: Y position * @param Width: Rectangle width * @param Height: Rectangle height *//* ... */ void BSP_LCD_FillRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height) { uint32_t Xaddress = 0; /* Set the text color */ BSP_LCD_SetTextColor(DrawProp[ActiveLayer].TextColor); /* Get the rectangle start address */ Xaddress = (hltdc_eval.LayerCfg[ActiveLayer].FBStartAdress) + 4*(BSP_LCD_GetXSize()*Ypos + Xpos); /* Fill the rectangle */ LL_FillBuffer(ActiveLayer, (uint32_t *)Xaddress, Width, Height, (BSP_LCD_GetXSize() - Width), DrawProp[ActiveLayer].TextColor); }{ ... } /** * @brief Draws a full circle. * @param Xpos: X position * @param Ypos: Y position * @param Radius: Circle radius *//* ... */ void BSP_LCD_FillCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius) { int32_t D; /* Decision Variable */ uint32_t CurX; /* Current X Value */ uint32_t CurY; /* Current Y Value */ D = 3 - (Radius << 1); CurX = 0; CurY = Radius; BSP_LCD_SetTextColor(DrawProp[ActiveLayer].TextColor); while (CurX <= CurY) { if(CurY > 0) { BSP_LCD_DrawHLine(Xpos - CurY, Ypos + CurX, 2*CurY); BSP_LCD_DrawHLine(Xpos - CurY, Ypos - CurX, 2*CurY); }if (CurY > 0) { ... } if(CurX > 0) { BSP_LCD_DrawHLine(Xpos - CurX, Ypos - CurY, 2*CurX); BSP_LCD_DrawHLine(Xpos - CurX, Ypos + CurY, 2*CurX); }if (CurX > 0) { ... } if (D < 0) { D += (CurX << 2) + 6; }if (D < 0) { ... } else { D += ((CurX - CurY) << 2) + 10; CurY--; }else { ... } CurX++; }while (CurX <= CurY) { ... } BSP_LCD_SetTextColor(DrawProp[ActiveLayer].TextColor); BSP_LCD_DrawCircle(Xpos, Ypos, Radius); }{ ... } /** * @brief Draws a full poly-line (between many points). * @param Points: Pointer to the points array * @param PointCount: Number of points *//* ... */ void BSP_LCD_FillPolygon(pPoint Points, uint16_t PointCount) { int16_t X = 0, Y = 0, X2 = 0, Y2 = 0, X_center = 0, Y_center = 0, X_first = 0, Y_first = 0, pixelX = 0, pixelY = 0, counter = 0; uint16_t IMAGE_LEFT = 0, IMAGE_RIGHT = 0, IMAGE_TOP = 0, IMAGE_BOTTOM = 0; IMAGE_LEFT = IMAGE_RIGHT = Points->X; IMAGE_TOP= IMAGE_BOTTOM = Points->Y; for(counter = 1; counter < PointCount; counter++) { pixelX = POLY_X(counter); if(pixelX < IMAGE_LEFT) { IMAGE_LEFT = pixelX; }if (pixelX < IMAGE_LEFT) { ... } if(pixelX > IMAGE_RIGHT) { IMAGE_RIGHT = pixelX; }if (pixelX > IMAGE_RIGHT) { ... } pixelY = POLY_Y(counter); if(pixelY < IMAGE_TOP) { IMAGE_TOP = pixelY; }if (pixelY < IMAGE_TOP) { ... } if(pixelY > IMAGE_BOTTOM) { IMAGE_BOTTOM = pixelY; }if (pixelY > IMAGE_BOTTOM) { ... } }for (counter = 1; counter < PointCount; counter++) { ... } if(PointCount < 2) { return; }if (PointCount < 2) { ... } X_center = (IMAGE_LEFT + IMAGE_RIGHT)/2; Y_center = (IMAGE_BOTTOM + IMAGE_TOP)/2; X_first = Points->X; Y_first = Points->Y; while(--PointCount) { X = Points->X; Y = Points->Y; Points++; X2 = Points->X; Y2 = Points->Y; FillTriangle(X, X2, X_center, Y, Y2, Y_center); FillTriangle(X, X_center, X2, Y, Y_center, Y2); FillTriangle(X_center, X2, X, Y_center, Y2, Y); }while (--PointCount) { ... } FillTriangle(X_first, X2, X_center, Y_first, Y2, Y_center); FillTriangle(X_first, X_center, X2, Y_first, Y_center, Y2); FillTriangle(X_center, X2, X_first, Y_center, Y2, Y_first); }{ ... } /** * @brief Draws a full ellipse. * @param Xpos: X position * @param Ypos: Y position * @param XRadius: Ellipse X radius * @param YRadius: Ellipse Y radius *//* ... */ void BSP_LCD_FillEllipse(int Xpos, int Ypos, int XRadius, int YRadius) { int x = 0, y = -YRadius, err = 2-2*XRadius, e2; float K = 0, rad1 = 0, rad2 = 0; rad1 = XRadius; rad2 = YRadius; K = (float)(rad2/rad1); do { BSP_LCD_DrawHLine((Xpos-(uint16_t)(x/K)), (Ypos+y), (2*(uint16_t)(x/K) + 1)); BSP_LCD_DrawHLine((Xpos-(uint16_t)(x/K)), (Ypos-y), (2*(uint16_t)(x/K) + 1)); e2 = err; if (e2 <= x) { err += ++x*2+1; if (-y == x && e2 <= y) e2 = 0; }if (e2 <= x) { ... } if (e2 > y) err += ++y*2+1; ...} while (y <= 0); }{ ... } /** * @brief Enables the display. *//* ... */ void BSP_LCD_DisplayOn(void) { /* Display On */ __HAL_LTDC_ENABLE(&hltdc_eval); }{ ... } /** * @brief Disables the display. *//* ... */ void BSP_LCD_DisplayOff(void) { /* Display Off */ __HAL_LTDC_DISABLE(&hltdc_eval); }{ ... } /******************************************************************************* LTDC and DMA2D BSP Routines *******************************************************************************//* ... */ /** * @brief Initializes the LTDC MSP. *//* ... */ static void MspInit(void) { GPIO_InitTypeDef GPIO_Init_Structure; /* Enable the LTDC and DMA2D clocks */ __HAL_RCC_LTDC_CLK_ENABLE(); __HAL_RCC_DMA2D_CLK_ENABLE(); /* Enable GPIOs clock */ __HAL_RCC_GPIOI_CLK_ENABLE(); __HAL_RCC_GPIOJ_CLK_ENABLE(); __HAL_RCC_GPIOK_CLK_ENABLE(); /*** LTDC Pins configuration ***/ /* GPIOI configuration */ GPIO_Init_Structure.Pin = GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15; GPIO_Init_Structure.Mode = GPIO_MODE_AF_PP; GPIO_Init_Structure.Pull = GPIO_NOPULL; GPIO_Init_Structure.Speed = GPIO_SPEED_FAST; GPIO_Init_Structure.Alternate = GPIO_AF14_LTDC; HAL_GPIO_Init(GPIOI, &GPIO_Init_Structure); /* GPIOJ configuration */ GPIO_Init_Structure.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | \ GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7 | \ GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | \ GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15; GPIO_Init_Structure.Mode = GPIO_MODE_AF_PP; GPIO_Init_Structure.Pull = GPIO_NOPULL; GPIO_Init_Structure.Speed = GPIO_SPEED_FAST; GPIO_Init_Structure.Alternate = GPIO_AF14_LTDC; HAL_GPIO_Init(GPIOJ, &GPIO_Init_Structure); /* GPIOK configuration */ GPIO_Init_Structure.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | \ GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7; GPIO_Init_Structure.Mode = GPIO_MODE_AF_PP; GPIO_Init_Structure.Pull = GPIO_NOPULL; GPIO_Init_Structure.Speed = GPIO_SPEED_FAST; GPIO_Init_Structure.Alternate = GPIO_AF14_LTDC; HAL_GPIO_Init(GPIOK, &GPIO_Init_Structure); }{ ... } /** * @brief Clock Config. * @param hltdc: LTDC handle * @param Params: LTDC pixel clock * @note This API is called by BSP_LCD_Init() * Being __weak it can be overwritten by the application *//* ... */ __weak void BSP_LCD_ClockConfig(LTDC_HandleTypeDef *hltdc, void *Params) { static RCC_PeriphCLKInitTypeDef periph_clk_init_struct; if(stmpe811_ts_drv.ReadID(TS_I2C_ADDRESS) == STMPE811_ID) { /* AMPIRE480272 LCD clock configuration */ /* PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz */ /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN = 192 Mhz */ /* PLLLCDCLK = PLLSAI_VCO Output/PLLSAIR = 192/5 = 38.4 Mhz */ /* LTDC clock frequency = PLLLCDCLK / LTDC_PLLSAI_DIVR_4 = 38.4/4 = 9.6Mhz */ periph_clk_init_struct.PeriphClockSelection = RCC_PERIPHCLK_LTDC; periph_clk_init_struct.PLLSAI.PLLSAIN = 192; periph_clk_init_struct.PLLSAI.PLLSAIR = AMPIRE480272_FREQUENCY_DIVIDER; periph_clk_init_struct.PLLSAIDivR = RCC_PLLSAIDIVR_4; HAL_RCCEx_PeriphCLKConfig(&periph_clk_init_struct); }if (stmpe811_ts_drv.ReadID(TS_I2C_ADDRESS) == STMPE811_ID) { ... } else { /* The programmed LTDC pixel clock depends on the vertical refresh rate of the panel 60Hz => 25.16MHz and the LCD/SDRAM bandwidth affected by the several access on the bus and the number of used layers. *//* ... */ if(*(uint32_t *)Params == LCD_MAX_PCLK) { /* In case of single layer the bandwidth is around 160MBytesPerSec ==> theoretical PCLK of 40MHz */ /* AMPIRE640480 typical PCLK is 25.16 MHz so the PLLSAI is configured to provide this clock */ /* AMPIRE640480 LCD clock configuration */ /* PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz */ /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN = 151 Mhz */ /* PLLLCDCLK = PLLSAI_VCO Output/PLLSAIR = 151/3 = 50.3 Mhz */ /* LTDC clock frequency = PLLLCDCLK / LTDC_PLLSAI_DIVR_2 = 50.3/2 = 25.16 Mhz */ periph_clk_init_struct.PLLSAI.PLLSAIN = 151; }if (*(uint32_t *)Params == LCD_MAX_PCLK) { ... } else { /* In case of double layers the bandwidth is around 72MBytesPerSec => 18MHz (<25,16MHz) */ /* so the PLLSAI is configured to provide this clock */ /* AMPIRE640480 LCD clock configuration */ /* PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz */ /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN = 108 Mhz */ /* PLLLCDCLK = PLLSAI_VCO Output/PLLSAIR = 108/3 = 36 Mhz */ /* LTDC clock frequency = PLLLCDCLK / LTDC_PLLSAI_DIVR_2 = 36/2 = 18 Mhz */ periph_clk_init_struct.PLLSAI.PLLSAIN = 108; }else { ... } periph_clk_init_struct.PeriphClockSelection = RCC_PERIPHCLK_LTDC; periph_clk_init_struct.PLLSAI.PLLSAIR = 3; periph_clk_init_struct.PLLSAIDivR = RCC_PLLSAIDIVR_2; HAL_RCCEx_PeriphCLKConfig(&periph_clk_init_struct); }else { ... } }{ ... } /******************************************************************************* Static Functions *******************************************************************************//* ... */ /** * @brief Draws a pixel on LCD. * @param Xpos: X position * @param Ypos: Y position * @param RGB_Code: Pixel color in ARGB mode (8-8-8-8) *//* ... */ void BSP_LCD_DrawPixel(uint16_t Xpos, uint16_t Ypos, uint32_t RGB_Code) { /* Write data value to all SDRAM memory */ *(__IO uint32_t*) (hltdc_eval.LayerCfg[ActiveLayer].FBStartAdress + (4*(Ypos*BSP_LCD_GetXSize() + Xpos))) = RGB_Code; }{ ... } /** * @brief Draws a character on LCD. * @param Xpos: Line where to display the character shape * @param Ypos: Start column address * @param c: Pointer to the character data *//* ... */ static void DrawChar(uint16_t Xpos, uint16_t Ypos, const uint8_t *c) { uint32_t i = 0, j = 0; uint16_t height, width; uint8_t offset; uint8_t *pchar; uint32_t line; height = DrawProp[ActiveLayer].pFont->Height; width = DrawProp[ActiveLayer].pFont->Width; offset = 8 *((width + 7)/8) - width ; for(i = 0; i < height; i++) { pchar = ((uint8_t *)c + (width + 7)/8 * i); switch(((width + 7)/8)) { case 1: line = pchar[0]; break; case 1: case 2: line = (pchar[0]<< 8) | pchar[1]; break; case 2: case 3: default: line = (pchar[0]<< 16) | (pchar[1]<< 8) | pchar[2]; break;default }switch (((width + 7)/8)) { ... } for (j = 0; j < width; j++) { if(line & (1 << (width- j + offset- 1))) { BSP_LCD_DrawPixel((Xpos + j), Ypos, DrawProp[ActiveLayer].TextColor); }if (line & (1 << (width- j + offset- 1))) { ... } else { BSP_LCD_DrawPixel((Xpos + j), Ypos, DrawProp[ActiveLayer].BackColor); }else { ... } }for (j = 0; j < width; j++) { ... } Ypos++; }for (i = 0; i < height; i++) { ... } }{ ... } /** * @brief Fills a triangle (between 3 points). * @param x1: Point 1 X position * @param y1: Point 1 Y position * @param x2: Point 2 X position * @param y2: Point 2 Y position * @param x3: Point 3 X position * @param y3: Point 3 Y position *//* ... */ static void FillTriangle(uint16_t x1, uint16_t x2, uint16_t x3, uint16_t y1, uint16_t y2, uint16_t y3) { int16_t deltax = 0, deltay = 0, x = 0, y = 0, xinc1 = 0, xinc2 = 0, yinc1 = 0, yinc2 = 0, den = 0, num = 0, numadd = 0, numpixels = 0, curpixel = 0; deltax = ABS(x2 - x1); /* The difference between the x's */ deltay = ABS(y2 - y1); /* The difference between the y's */ x = x1; /* Start x off at the first pixel */ y = y1; /* Start y off at the first pixel */ if (x2 >= x1) /* The x-values are increasing */ { xinc1 = 1; xinc2 = 1; ...} else /* The x-values are decreasing */ { xinc1 = -1; xinc2 = -1; }else { ... } if (y2 >= y1) /* The y-values are increasing */ { yinc1 = 1; yinc2 = 1; ...} else /* The y-values are decreasing */ { yinc1 = -1; yinc2 = -1; }else { ... } if (deltax >= deltay) /* There is at least one x-value for every y-value */ { xinc1 = 0; /* Don't change the x when numerator >= denominator */ yinc2 = 0; /* Don't change the y for every iteration */ den = deltax; num = deltax / 2; numadd = deltay; numpixels = deltax; /* There are more x-values than y-values */ ...} else /* There is at least one y-value for every x-value */ { xinc2 = 0; /* Don't change the x for every iteration */ yinc1 = 0; /* Don't change the y when numerator >= denominator */ den = deltay; num = deltay / 2; numadd = deltax; numpixels = deltay; /* There are more y-values than x-values */ }else { ... } for (curpixel = 0; curpixel <= numpixels; curpixel++) { BSP_LCD_DrawLine(x, y, x3, y3); num += numadd; /* Increase the numerator by the top of the fraction */ if (num >= den) /* Check if numerator >= denominator */ { num -= den; /* Calculate the new numerator value */ x += xinc1; /* Change the x as appropriate */ y += yinc1; /* Change the y as appropriate */ ...} x += xinc2; /* Change the x as appropriate */ y += yinc2; /* Change the y as appropriate */ }for (curpixel = 0; curpixel <= numpixels; curpixel++) { ... } }{ ... } /** * @brief Fills a buffer. * @param LayerIndex: Layer index * @param pDst: Pointer to destination buffer * @param xSize: Buffer width * @param ySize: Buffer height * @param OffLine: Offset * @param ColorIndex: Color index *//* ... */ static void LL_FillBuffer(uint32_t LayerIndex, void *pDst, uint32_t xSize, uint32_t ySize, uint32_t OffLine, uint32_t ColorIndex) { /* Register to memory mode with ARGB8888 as color Mode */ hdma2d_eval.Init.Mode = DMA2D_R2M; hdma2d_eval.Init.ColorMode = DMA2D_ARGB8888; hdma2d_eval.Init.OutputOffset = OffLine; hdma2d_eval.Instance = DMA2D; /* DMA2D Initialization */ if(HAL_DMA2D_Init(&hdma2d_eval) == HAL_OK) { if(HAL_DMA2D_ConfigLayer(&hdma2d_eval, LayerIndex) == HAL_OK) { if (HAL_DMA2D_Start(&hdma2d_eval, ColorIndex, (uint32_t)pDst, xSize, ySize) == HAL_OK) { /* Polling For DMA transfer */ HAL_DMA2D_PollForTransfer(&hdma2d_eval, 10); }if (HAL_DMA2D_Start(&hdma2d_eval, ColorIndex, (uint32_t)pDst, xSize, ySize) == HAL_OK) { ... } }if (HAL_DMA2D_ConfigLayer(&hdma2d_eval, LayerIndex) == HAL_OK) { ... } }if (HAL_DMA2D_Init(&hdma2d_eval) == HAL_OK) { ... } }{ ... } /** * @brief Converts a line to an ARGB8888 pixel format. * @param pSrc: Pointer to source buffer * @param pDst: Output color * @param xSize: Buffer width * @param ColorMode: Input color mode *//* ... */ static void LL_ConvertLineToARGB8888(void *pSrc, void *pDst, uint32_t xSize, uint32_t ColorMode) { /* Configure the DMA2D Mode, Color Mode and output offset */ hdma2d_eval.Init.Mode = DMA2D_M2M_PFC; hdma2d_eval.Init.ColorMode = DMA2D_ARGB8888; hdma2d_eval.Init.OutputOffset = 0; /* Foreground Configuration */ hdma2d_eval.LayerCfg[1].AlphaMode = DMA2D_NO_MODIF_ALPHA; hdma2d_eval.LayerCfg[1].InputAlpha = 0xFF; hdma2d_eval.LayerCfg[1].InputColorMode = ColorMode; hdma2d_eval.LayerCfg[1].InputOffset = 0; hdma2d_eval.Instance = DMA2D; /* DMA2D Initialization */ if(HAL_DMA2D_Init(&hdma2d_eval) == HAL_OK) { if(HAL_DMA2D_ConfigLayer(&hdma2d_eval, 1) == HAL_OK) { if (HAL_DMA2D_Start(&hdma2d_eval, (uint32_t)pSrc, (uint32_t)pDst, xSize, 1) == HAL_OK) { /* Polling For DMA transfer */ HAL_DMA2D_PollForTransfer(&hdma2d_eval, 10); }if (HAL_DMA2D_Start(&hdma2d_eval, (uint32_t)pSrc, (uint32_t)pDst, xSize, 1) == HAL_OK) { ... } }if (HAL_DMA2D_ConfigLayer(&hdma2d_eval, 1) == HAL_OK) { ... } }if (HAL_DMA2D_Init(&hdma2d_eval) == HAL_OK) { ... } }{ ... } /** * @} *//* ... */ /** * @} *//* ... */ /** * @} *//* ... */ /** * @} *//* ... */
Details
Show:
from
Types: Columns:
This file uses the notable symbols shown below. Click anywhere in the file to view more details.