Mit diesem Demo-Projekt wird die Multi-Touch-Funktion des STM32F746-Discovery-Board getestet.
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 | //-------------------------------------------------------------- // File : main.c // Datum : 14.07.2015 // Version : 1.0 // Autor : UB // EMail : mc-4u(@)t-online.de // Web : www.mikrocontroller-4u.de // CPU : STM32F746 // Board : STM32F746-Discovery-Board // IDE : OpenSTM32 // GCC : 4.9 2015q2 // Module : CubeHAL // Funktion : Hauptprogramm //-------------------------------------------------------------- #include "stm32_ub_system.h" #include "stm32_ub_lcd_480x272.h" #include "stm32_ub_graphic2d.h" #include "stm32_ub_touch_480x272.h" int main(void) { // init vom System UB_System_Init(); // init vom LCD UB_LCD_Init(); UB_LCD_LayerInit_Fullscreen(); UB_LCD_SetLayer_2(); UB_LCD_FillLayer(RGB_COL_WHITE); // init vom touch UB_Touch_Init(); while(1) { if(UB_Touch_Read()==SUCCESS) { if(MultiTouch_Data.cnt>0) { UB_Graphic2D_DrawFullCircleDMA(MultiTouch_Data.p[0].xp, MultiTouch_Data.p[0].yp, 3, RGB_COL_RED); } if(MultiTouch_Data.cnt>1) { UB_Graphic2D_DrawFullCircleDMA(MultiTouch_Data.p[1].xp, MultiTouch_Data.p[1].yp, 3, RGB_COL_GREEN); } if(MultiTouch_Data.cnt>2) { UB_Graphic2D_DrawFullCircleDMA(MultiTouch_Data.p[2].xp, MultiTouch_Data.p[2].yp, 3, RGB_COL_BLUE); } if(MultiTouch_Data.cnt>3) { UB_Graphic2D_DrawFullCircleDMA(MultiTouch_Data.p[3].xp, MultiTouch_Data.p[3].yp, 3, RGB_COL_MAGENTA); } if(MultiTouch_Data.cnt>4) { UB_Graphic2D_DrawFullCircleDMA(MultiTouch_Data.p[4].xp, MultiTouch_Data.p[4].yp, 3, RGB_COL_CYAN); } } } } |
Hier der komplette OpenSTM32-Projektordner zum Download :