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
65
68
69
72
73
76
77
80
81
82
85
86
89
92
93
96
97
98
99
100
103
104
107
108
111
112
113
116
117
118
119
120
121
122
123
126
127
128
131
132
135
136
137
140
141
144
145
148
149
150
151
152
155
156
159
160
164
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
198
199
200
206
207
208
209
210
211
212
213
214
215
216
219
220
223
224
225
226
227
228
229
230
231
232
233
234
237
242
248
249
250
251
252
253
254
260
261
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
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
362
363
364
365
367
368
369
370
371
372
375
382
383
390
391
392
393
394
395
401
402
403
404
405
406
407
408
409
410
411
412
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
441
445
446
450
454
455
459
463
464
468
472
473
474
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
512
516
517
518
519
520
521
522
523
524
525
538
539
545
551
552
557
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
587
593
594
598
603
604
608
612
613
617
621
622
626
630
631
635
639
640
644
648
649
653
657
658
664
665
666
667
668
673
678
685
690
691
692
693
694
698
703
704
708
709
710
711
712
713
714
715
716
717
718
719
720
727
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
779
780
781
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
806
810
811
817
818
819
820
821
822
823
824
825
826
827
828
834
835
836
837
838
839
840
841
842
843
844
845
852
853
854
855
856
857
858
859
860
861
862
863
864
868
873
874
875
879
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
914
915
916
917
918
919
926
927
928
929
930
931
932
933
934
935
936
937
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
975
980
981
982
983
984
989
990
991
992
993
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
1037
1038
1039
1040
1041
1042
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1074
1078
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
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1145
1146
1151
1155
1160
1161
1162
1163
1164
1165
1166
1167
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1187
1191
1192
1193
1197
1201
1202
1203
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
1260
1261
1262
1263
1264
1265
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1313
1314
1317
1321
1325
1326
1330
1334
1335
1336
1340
1344
1345
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
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
1415
1416
1420
1421
1422
1428
1433
1434
1435
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1465
1469
1470
1473
1474
1475
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1515
1520
1521
1522
1526
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1633
1634
1635
1638
1639
1642
1643
1646
1647
/* ... */
/* ... */
#include "stm32469i_discovery_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
/* ... */
/* ... */
/* ... */
/* ... */
static DSI_VidCfgTypeDef hdsivideo_handle;
/* ... */
/* ... */
/* ... */
/* ... */
#define ABS(X) ((X) > 0 ? (X) : -(X))
#define POLY_X(Z) ((int32_t)((Points + (Z))->X))
#define POLY_Y(Z) ((int32_t)((Points + (Z))->Y))
/* ... */
/* ... */
/* ... */
/* ... */
DMA2D_HandleTypeDef hdma2d_eval;
LTDC_HandleTypeDef hltdc_eval;
DSI_HandleTypeDef hdsi_eval;
uint32_t lcd_x_size = OTM8009A_800X480_WIDTH;
uint32_t lcd_y_size = OTM8009A_800X480_HEIGHT;
/* ... */
/* ... */
/* ... */
static uint32_t ActiveLayer = LTDC_ACTIVE_LAYER_BACKGROUND;
/* ... */
static LCD_DrawPropTypeDef DrawProp[LTDC_MAX_LAYER_NUMBER];
/* ... */
/* ... */
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);
/* ... */
/* ... */
/* ... */
uint8_t BSP_LCD_Init(void)
{
return (BSP_LCD_InitEx(LCD_ORIENTATION_LANDSCAPE));
}{ ... }
/* ... */
uint8_t BSP_LCD_InitEx(LCD_OrientationTypeDef orientation)
{
DSI_PLLInitTypeDef dsiPllInit;
DSI_PHY_TimerTypeDef PhyTimings;
static RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
uint32_t LcdClock = 27429;
uint32_t laneByteClk_kHz = 0;
uint32_t VSA;
uint32_t VBP;
uint32_t VFP;
uint32_t VACT;
uint32_t HSA;
uint32_t HBP;
uint32_t HFP;
uint32_t HACT;
/* ... */
BSP_LCD_Reset();
/* ... */
BSP_LCD_MspInit();
hdsi_eval.Instance = DSI;
HAL_DSI_DeInit(&(hdsi_eval));
#if !defined(USE_STM32469I_DISCO_REVA)
dsiPllInit.PLLNDIV = 125;
dsiPllInit.PLLIDF = DSI_PLL_IN_DIV2;
dsiPllInit.PLLODF = DSI_PLL_OUT_DIV1;/* ... */
#else
dsiPllInit.PLLNDIV = 100;
dsiPllInit.PLLIDF = DSI_PLL_IN_DIV5;
dsiPllInit.PLLODF = DSI_PLL_OUT_DIV1;/* ... */
#endif
laneByteClk_kHz = 62500;
hdsi_eval.Init.NumberOfLanes = DSI_TWO_DATA_LANES;
hdsi_eval.Init.TXEscapeCkdiv = laneByteClk_kHz/15620;
HAL_DSI_Init(&(hdsi_eval), &(dsiPllInit));
/* ... */
if(orientation == LCD_ORIENTATION_PORTRAIT)
{
lcd_x_size = OTM8009A_480X800_WIDTH;
lcd_y_size = OTM8009A_480X800_HEIGHT;
}if (orientation == LCD_ORIENTATION_PORTRAIT) { ... }
else
{
lcd_x_size = OTM8009A_800X480_WIDTH;
lcd_y_size = OTM8009A_800X480_HEIGHT;
}else { ... }
HACT = lcd_x_size;
VACT = lcd_y_size;
#if defined (USE_STM32469I_DISCO_REVC)
VSA = NT35510_480X800_VSYNC;
VBP = NT35510_480X800_VBP;
VFP = NT35510_480X800_VFP;
HSA = NT35510_480X800_HSYNC;
HBP = NT35510_480X800_HBP;
HFP = NT35510_480X800_HFP;/* ... */
#else
VSA = OTM8009A_480X800_VSYNC;
VBP = OTM8009A_480X800_VBP;
VFP = OTM8009A_480X800_VFP;
HSA = OTM8009A_480X800_HSYNC;
HBP = OTM8009A_480X800_HBP;
HFP = OTM8009A_480X800_HFP;/* ... */
#endif
hdsivideo_handle.VirtualChannelID = LCD_OTM8009A_ID;
hdsivideo_handle.ColorCoding = LCD_DSI_PIXEL_DATA_FMT_RBG888;
hdsivideo_handle.VSPolarity = DSI_VSYNC_ACTIVE_HIGH;
hdsivideo_handle.HSPolarity = DSI_HSYNC_ACTIVE_HIGH;
hdsivideo_handle.DEPolarity = DSI_DATA_ENABLE_ACTIVE_HIGH;
hdsivideo_handle.Mode = DSI_VID_MODE_BURST;
hdsivideo_handle.NullPacketSize = 0xFFF;
hdsivideo_handle.NumberOfChunks = 0;
hdsivideo_handle.PacketSize = HACT;
hdsivideo_handle.HorizontalSyncActive = (HSA * laneByteClk_kHz) / LcdClock;
hdsivideo_handle.HorizontalBackPorch = (HBP * laneByteClk_kHz) / LcdClock;
hdsivideo_handle.HorizontalLine = ((HACT + HSA + HBP + HFP) * laneByteClk_kHz) / LcdClock;
hdsivideo_handle.VerticalSyncActive = VSA;
hdsivideo_handle.VerticalBackPorch = VBP;
hdsivideo_handle.VerticalFrontPorch = VFP;
hdsivideo_handle.VerticalActive = VACT;
hdsivideo_handle.LPCommandEnable = DSI_LP_COMMAND_ENABLE;
hdsivideo_handle.LPLargestPacketSize = 16;
hdsivideo_handle.LPVACTLargestPacketSize = 0;
hdsivideo_handle.LPHorizontalFrontPorchEnable = DSI_LP_HFP_ENABLE;
hdsivideo_handle.LPHorizontalBackPorchEnable = DSI_LP_HBP_ENABLE;
hdsivideo_handle.LPVerticalActiveEnable = DSI_LP_VACT_ENABLE;
hdsivideo_handle.LPVerticalFrontPorchEnable = DSI_LP_VFP_ENABLE;
hdsivideo_handle.LPVerticalBackPorchEnable = DSI_LP_VBP_ENABLE;
hdsivideo_handle.LPVerticalSyncActiveEnable = DSI_LP_VSYNC_ENABLE;
HAL_DSI_ConfigVideoMode(&(hdsi_eval), &(hdsivideo_handle));
PhyTimings.ClockLaneHS2LPTime = 35;
PhyTimings.ClockLaneLP2HSTime = 35;
PhyTimings.DataLaneHS2LPTime = 35;
PhyTimings.DataLaneLP2HSTime = 35;
PhyTimings.DataLaneMaxReadTime = 0;
PhyTimings.StopWaitTime = 10;
HAL_DSI_ConfigPhyTimer(&hdsi_eval, &PhyTimings);
DSI Initialization
End DSI Initialization
hltdc_eval.Init.HorizontalSync = (HSA - 1);
hltdc_eval.Init.AccumulatedHBP = (HSA + HBP - 1);
hltdc_eval.Init.AccumulatedActiveW = (lcd_x_size + HSA + HBP - 1);
hltdc_eval.Init.TotalWidth = (lcd_x_size + HSA + HBP + HFP - 1);
hltdc_eval.LayerCfg->ImageWidth = lcd_x_size;
hltdc_eval.LayerCfg->ImageHeight = lcd_y_size;
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
PeriphClkInitStruct.PLLSAI.PLLSAIN = 384;
PeriphClkInitStruct.PLLSAI.PLLSAIR = 7;
PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2;
HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
hltdc_eval.Init.Backcolor.Blue = 0;
hltdc_eval.Init.Backcolor.Green = 0;
hltdc_eval.Init.Backcolor.Red = 0;
hltdc_eval.Init.PCPolarity = LTDC_PCPOLARITY_IPC;
hltdc_eval.Instance = LTDC;
HAL_LTDCEx_StructInitFromVideoConfig(&(hltdc_eval), &(hdsivideo_handle));
HAL_LTDC_Init(&hltdc_eval);
/* ... */
HAL_DSI_Start(&(hdsi_eval));
#if !defined(DATA_IN_ExtSDRAM)
BSP_SDRAM_Init();/* ... */
#endif
BSP_LCD_SetFont(&LCD_DEFAULT_FONT);
LTDC Initialization
#if defined(USE_STM32469I_DISCO_REVC)End LTDC Initialization
/* ... */
NT35510_Init(NT35510_FORMAT_RGB888, orientation);NT35510 Initialization
/* ... */
#else
/* ... */
OTM8009A_Init(OTM8009A_FORMAT_RGB888, orientation);OTM8009A Initialization
/* ... */
#endif
return LCD_OK;
}{ ... }
/* ... */
void BSP_LCD_Reset(void)
{
#if !defined(USE_STM32469I_DISCO_REVA)
GPIO_InitTypeDef gpio_init_structure;
__HAL_RCC_GPIOH_CLK_ENABLE();
gpio_init_structure.Pin = GPIO_PIN_7;
#if defined(USE_STM32469I_DISCO_REVC)
gpio_init_structure.Mode = GPIO_MODE_OUTPUT_PP;/* ... */
#else
gpio_init_structure.Mode = GPIO_MODE_OUTPUT_OD;
#endif
gpio_init_structure.Pull = GPIO_NOPULL;
gpio_init_structure.Speed = GPIO_SPEED_HIGH;
HAL_GPIO_Init(GPIOH, &gpio_init_structure);
HAL_GPIO_WritePin(GPIOH, GPIO_PIN_7, GPIO_PIN_RESET);
HAL_Delay(20);
HAL_GPIO_WritePin(GPIOH, GPIO_PIN_7, GPIO_PIN_SET);
HAL_Delay(20); /* ... */
#else
#endif
}{ ... }
/* ... */
uint32_t BSP_LCD_GetXSize(void)
{
return (lcd_x_size);
}{ ... }
/* ... */
uint32_t BSP_LCD_GetYSize(void)
{
return (lcd_y_size);
}{ ... }
/* ... */
void BSP_LCD_SetXSize(uint32_t imageWidthPixels)
{
hltdc_eval.LayerCfg[ActiveLayer].ImageWidth = imageWidthPixels;
}{ ... }
/* ... */
void BSP_LCD_SetYSize(uint32_t imageHeightPixels)
{
hltdc_eval.LayerCfg[ActiveLayer].ImageHeight = imageHeightPixels;
}{ ... }
/* ... */
void BSP_LCD_LayerDefaultInit(uint16_t LayerIndex, uint32_t FB_Address)
{
LCD_LayerCfgTypeDef Layercfg;
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;
}{ ... }
/* ... */
void BSP_LCD_SelectLayer(uint32_t LayerIndex)
{
ActiveLayer = LayerIndex;
}{ ... }
/* ... */
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_IMMEDIATE_CONFIG(&(hltdc_eval));
}{ ... }
/* ... */
void BSP_LCD_SetTransparency(uint32_t LayerIndex, uint8_t Transparency)
{
HAL_LTDC_SetAlpha(&(hltdc_eval), Transparency, LayerIndex);
}{ ... }
/* ... */
void BSP_LCD_SetLayerAddress(uint32_t LayerIndex, uint32_t Address)
{
HAL_LTDC_SetAddress(&(hltdc_eval), Address, LayerIndex);
}{ ... }
/* ... */
void BSP_LCD_SetLayerWindow(uint16_t LayerIndex, uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height)
{
HAL_LTDC_SetWindowSize(&(hltdc_eval), Width, Height, LayerIndex);
HAL_LTDC_SetWindowPosition(&(hltdc_eval), Xpos, Ypos, LayerIndex);
}{ ... }
/* ... */
void BSP_LCD_SetColorKeying(uint32_t LayerIndex, uint32_t RGBValue)
{
HAL_LTDC_ConfigColorKeying(&(hltdc_eval), RGBValue, LayerIndex);
HAL_LTDC_EnableColorKeying(&(hltdc_eval), LayerIndex);
}{ ... }
/* ... */
void BSP_LCD_ResetColorKeying(uint32_t LayerIndex)
{
HAL_LTDC_DisableColorKeying(&(hltdc_eval), LayerIndex);
}{ ... }
/* ... */
void BSP_LCD_SetTextColor(uint32_t Color)
{
DrawProp[ActiveLayer].TextColor = Color;
}{ ... }
/* ... */
uint32_t BSP_LCD_GetTextColor(void)
{
return DrawProp[ActiveLayer].TextColor;
}{ ... }
/* ... */
void BSP_LCD_SetBackColor(uint32_t Color)
{
DrawProp[ActiveLayer].BackColor = Color;
}{ ... }
/* ... */
uint32_t BSP_LCD_GetBackColor(void)
{
return DrawProp[ActiveLayer].BackColor;
}{ ... }
/* ... */
void BSP_LCD_SetFont(sFONT *fonts)
{
DrawProp[ActiveLayer].pFont = fonts;
}{ ... }
/* ... */
sFONT *BSP_LCD_GetFont(void)
{
return DrawProp[ActiveLayer].pFont;
}{ ... }
/* ... */
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)
{
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)
{
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))
{
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
{
ret = *(__IO uint8_t*) (hltdc_eval.LayerCfg[ActiveLayer].FBStartAdress + (2*(Ypos*BSP_LCD_GetXSize() + Xpos)));
}else { ... }
return ret;
}{ ... }
/* ... */
void BSP_LCD_Clear(uint32_t Color)
{
LL_FillBuffer(ActiveLayer, (uint32_t *)(hltdc_eval.LayerCfg[ActiveLayer].FBStartAdress), BSP_LCD_GetXSize(), BSP_LCD_GetYSize(), 0, Color);
}{ ... }
/* ... */
void BSP_LCD_ClearStringLine(uint32_t Line)
{
uint32_t color_backup = DrawProp[ActiveLayer].TextColor;
DrawProp[ActiveLayer].TextColor = DrawProp[ActiveLayer].BackColor;
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);
}{ ... }
/* ... */
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)]);
}{ ... }
/* ... */
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;
while (*ptr++) size ++ ;
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) { ... }
if ((refcolumn < 1) || (refcolumn >= 0x8000))
{
refcolumn = 1;
}if ((refcolumn < 1) || (refcolumn >= 0x8000)) { ... }
while ((*Text != 0) & (((BSP_LCD_GetXSize() - (i*DrawProp[ActiveLayer].pFont->Width)) & 0xFFFF) >= DrawProp[ActiveLayer].pFont->Width))
{
BSP_LCD_DisplayChar(refcolumn, Ypos, *Text);
refcolumn += DrawProp[ActiveLayer].pFont->Width;
Text++;
i++;
}while ((*Text != 0) & (((BSP_LCD_GetXSize() - (i*DrawProp[ActiveLayer].pFont->Width)) & 0xFFFF) >= DrawProp[ActiveLayer].pFont->Width)) { ... }
}{ ... }
/* ... */
void BSP_LCD_DisplayStringAtLine(uint16_t Line, uint8_t *ptr)
{
BSP_LCD_DisplayStringAt(0, LINE(Line), ptr, LEFT_MODE);
}{ ... }
/* ... */
void BSP_LCD_DrawHLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length)
{
uint32_t Xaddress = 0;
Xaddress = (hltdc_eval.LayerCfg[ActiveLayer].FBStartAdress) + 4*(BSP_LCD_GetXSize()*Ypos + Xpos);
LL_FillBuffer(ActiveLayer, (uint32_t *)Xaddress, Length, 1, 0, DrawProp[ActiveLayer].TextColor);
}{ ... }
/* ... */
void BSP_LCD_DrawVLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length)
{
uint32_t Xaddress = 0;
Xaddress = (hltdc_eval.LayerCfg[ActiveLayer].FBStartAdress) + 4*(BSP_LCD_GetXSize()*Ypos + Xpos);
LL_FillBuffer(ActiveLayer, (uint32_t *)Xaddress, 1, Length, (BSP_LCD_GetXSize() - 1), DrawProp[ActiveLayer].TextColor);
}{ ... }
/* ... */
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);
deltay = ABS(y2 - y1);
x = x1;
y = y1;
if (x2 >= x1)
{
xinc1 = 1;
xinc2 = 1;
...}
else
{
xinc1 = -1;
xinc2 = -1;
}else { ... }
if (y2 >= y1)
{
yinc1 = 1;
yinc2 = 1;
...}
else
{
yinc1 = -1;
yinc2 = -1;
}else { ... }
if (deltax >= deltay)
{
xinc1 = 0;
yinc2 = 0;
den = deltax;
num = deltax / 2;
numadd = deltay;
numpixels = deltax;
...}
else
{
xinc2 = 0;
yinc1 = 0;
den = deltay;
num = deltay / 2;
numadd = deltax;
numpixels = deltay;
}else { ... }
for (curpixel = 0; curpixel <= numpixels; curpixel++)
{
BSP_LCD_DrawPixel(x, y, DrawProp[ActiveLayer].TextColor);
num += numadd;
if (num >= den)
{
num -= den;
x += xinc1;
y += yinc1;
...}
x += xinc2;
y += yinc2;
}for (curpixel = 0; curpixel <= numpixels; curpixel++) { ... }
}{ ... }
/* ... */
void BSP_LCD_DrawRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height)
{
BSP_LCD_DrawHLine(Xpos, Ypos, Width);
BSP_LCD_DrawHLine(Xpos, (Ypos+ Height), Width);
BSP_LCD_DrawVLine(Xpos, Ypos, Height);
BSP_LCD_DrawVLine((Xpos + Width), Ypos, Height);
}{ ... }
/* ... */
void BSP_LCD_DrawCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius)
{
int32_t D;
uint32_t CurX;
uint32_t CurY;
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) { ... }
}{ ... }
/* ... */
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) { ... }
}{ ... }
/* ... */
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);
}{ ... }
/* ... */
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;
index = pbmp[10] + (pbmp[11] << 8) + (pbmp[12] << 16) + (pbmp[13] << 24);
width = pbmp[18] + (pbmp[19] << 8) + (pbmp[20] << 16) + (pbmp[21] << 24);
height = pbmp[22] + (pbmp[23] << 8) + (pbmp[24] << 16) + (pbmp[25] << 24);
bit_pixel = pbmp[28] + (pbmp[29] << 8);
Address = hltdc_eval.LayerCfg[ActiveLayer].FBStartAdress + (((BSP_LCD_GetXSize()*Ypos) + Xpos)*(4));
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 { ... }
pbmp += (index + (width * (height - 1) * (bit_pixel/8)));
for(index=0; index < height; index++)
{
LL_ConvertLineToARGB8888((uint32_t *)pbmp, (uint32_t *)Address, width, InputColorMode);
Address+= (BSP_LCD_GetXSize()*4);
pbmp -= width*(bit_pixel/8);
}for (index=0; index < height; index++) { ... }
}{ ... }
/* ... */
void BSP_LCD_FillRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height)
{
uint32_t Xaddress = 0;
BSP_LCD_SetTextColor(DrawProp[ActiveLayer].TextColor);
Xaddress = (hltdc_eval.LayerCfg[ActiveLayer].FBStartAdress) + 4*(BSP_LCD_GetXSize()*Ypos + Xpos);
LL_FillBuffer(ActiveLayer, (uint32_t *)Xaddress, Width, Height, (BSP_LCD_GetXSize() - Width), DrawProp[ActiveLayer].TextColor);
}{ ... }
/* ... */
void BSP_LCD_FillCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius)
{
int32_t D;
uint32_t CurX;
uint32_t CurY;
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);
}{ ... }
/* ... */
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);
}{ ... }
/* ... */
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);
}{ ... }
/* ... */
void BSP_LCD_DisplayOn(void)
{
HAL_DSI_ShortWrite(&(hdsi_eval),
hdsivideo_handle.VirtualChannelID,
DSI_DCS_SHORT_PKT_WRITE_P1,
OTM8009A_CMD_DISPON,
0x00);
}{ ... }
/* ... */
void BSP_LCD_DisplayOff(void)
{
HAL_DSI_ShortWrite(&(hdsi_eval),
hdsivideo_handle.VirtualChannelID,
DSI_DCS_SHORT_PKT_WRITE_P1,
OTM8009A_CMD_DISPOFF,
0x00);
}{ ... }
/* ... */
void DSI_IO_WriteCmd(uint32_t NbrParams, uint8_t *pParams)
{
if(NbrParams <= 1)
{
HAL_DSI_ShortWrite(&hdsi_eval, LCD_OTM8009A_ID, DSI_DCS_SHORT_PKT_WRITE_P1, pParams[0], pParams[1]);
}if (NbrParams <= 1) { ... }
else
{
HAL_DSI_LongWrite(&hdsi_eval, LCD_OTM8009A_ID, DSI_DCS_LONG_PKT_WRITE, NbrParams, pParams[NbrParams], pParams);
}else { ... }
}{ ... }
/* ... */
/* ... */
__weak void BSP_LCD_DMA2D_IRQHandler(void)
{
HAL_DMA2D_IRQHandler(&hdma2d_eval);
}{ ... }
/* ... */
__weak void BSP_LCD_DSI_IRQHandler(void)
{
HAL_DSI_IRQHandler(&(hdsi_eval));
}{ ... }
/* ... */
__weak void BSP_LCD_LTDC_IRQHandler(void)
{
HAL_LTDC_IRQHandler(&(hltdc_eval));
}{ ... }
/* ... */
__weak void BSP_LCD_MspDeInit(void)
{
HAL_NVIC_DisableIRQ(LTDC_IRQn);
HAL_NVIC_DisableIRQ(DMA2D_IRQn);
HAL_NVIC_DisableIRQ(DSI_IRQn);
__HAL_RCC_LTDC_FORCE_RESET();
__HAL_RCC_DMA2D_FORCE_RESET();
__HAL_RCC_DSI_FORCE_RESET();
__HAL_RCC_LTDC_CLK_DISABLE();
__HAL_RCC_DMA2D_CLK_DISABLE();
__HAL_RCC_DSI_CLK_DISABLE();
}{ ... }
/* ... */
__weak void BSP_LCD_MspInit(void)
{
__HAL_RCC_LTDC_CLK_ENABLE();
__HAL_RCC_LTDC_FORCE_RESET();
__HAL_RCC_LTDC_RELEASE_RESET();
__HAL_RCC_DMA2D_CLK_ENABLE();
__HAL_RCC_DMA2D_FORCE_RESET();
__HAL_RCC_DMA2D_RELEASE_RESET();
__HAL_RCC_DSI_CLK_ENABLE();
__HAL_RCC_DSI_FORCE_RESET();
__HAL_RCC_DSI_RELEASE_RESET();
HAL_NVIC_SetPriority(LTDC_IRQn, 3, 0);
HAL_NVIC_EnableIRQ(LTDC_IRQn);
HAL_NVIC_SetPriority(DMA2D_IRQn, 3, 0);
HAL_NVIC_EnableIRQ(DMA2D_IRQn);
HAL_NVIC_SetPriority(DSI_IRQn, 3, 0);
HAL_NVIC_EnableIRQ(DSI_IRQn);
}{ ... }
/* ... */
__weak void BSP_LCD_LTDC_ER_IRQHandler(void)
{
HAL_LTDC_IRQHandler(&(hltdc_eval));
}{ ... }
/* ... */
void BSP_LCD_DrawPixel(uint16_t Xpos, uint16_t Ypos, uint32_t RGB_Code)
{
*(__IO uint32_t*) (hltdc_eval.LayerCfg[ActiveLayer].FBStartAdress + (4*(Ypos*BSP_LCD_GetXSize() + Xpos))) = RGB_Code;
}{ ... }
/* ... */
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++) { ... }
}{ ... }
/* ... */
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);
deltay = ABS(y2 - y1);
x = x1;
y = y1;
if (x2 >= x1)
{
xinc1 = 1;
xinc2 = 1;
...}
else
{
xinc1 = -1;
xinc2 = -1;
}else { ... }
if (y2 >= y1)
{
yinc1 = 1;
yinc2 = 1;
...}
else
{
yinc1 = -1;
yinc2 = -1;
}else { ... }
if (deltax >= deltay)
{
xinc1 = 0;
yinc2 = 0;
den = deltax;
num = deltax / 2;
numadd = deltay;
numpixels = deltax;
...}
else
{
xinc2 = 0;
yinc1 = 0;
den = deltay;
num = deltay / 2;
numadd = deltax;
numpixels = deltay;
}else { ... }
for (curpixel = 0; curpixel <= numpixels; curpixel++)
{
BSP_LCD_DrawLine(x, y, x3, y3);
num += numadd;
if (num >= den)
{
num -= den;
x += xinc1;
y += yinc1;
...}
x += xinc2;
y += yinc2;
}for (curpixel = 0; curpixel <= numpixels; curpixel++) { ... }
}{ ... }
/* ... */
static void LL_FillBuffer(uint32_t LayerIndex, void *pDst, uint32_t xSize, uint32_t ySize, uint32_t OffLine, uint32_t ColorIndex)
{
hdma2d_eval.Init.Mode = DMA2D_R2M;
hdma2d_eval.Init.ColorMode = DMA2D_ARGB8888;
hdma2d_eval.Init.OutputOffset = OffLine;
hdma2d_eval.Instance = DMA2D;
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)
{
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) { ... }
}{ ... }
/* ... */
static void LL_ConvertLineToARGB8888(void *pSrc, void *pDst, uint32_t xSize, uint32_t ColorMode)
{
hdma2d_eval.Init.Mode = DMA2D_M2M_PFC;
hdma2d_eval.Init.ColorMode = DMA2D_ARGB8888;
hdma2d_eval.Init.OutputOffset = 0;
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;
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)
{
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) { ... }
}{ ... }
/* ... */
/* ... */
/* ... */
/* ... */