Mit diesem Demo-Projekt werden LED, Button, LCD, Text und Grafik 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 57 58 59 60 61 62 63 64 | //-------------------------------------------------------------- // File : main.c // Datum : 12.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_led.h" #include "stm32_ub_button.h" #include "stm32_ub_lcd_480x272.h" #include "stm32_ub_font.h" #include "stm32_ub_graphic2d.h" int main(void) { DMA2D_Koord pos; // init vom System UB_System_Init(); // init der LED UB_Led_Init(); // init vom Button UB_Button_Init(); // init vom LCD UB_LCD_Init(); UB_LCD_LayerInit_Fullscreen(); UB_LCD_SetLayer_2(); UB_LCD_FillLayer(RGB_COL_GREEN); // Texte UB_Font_DrawString(10,20,"F746 Demo-01 (12.07.2015 / UB)",&Arial_10x15,RGB_COL_RED,RGB_COL_BLACK); UB_Font_DrawString(80,120,"please press Button...",&Arial_10x15,RGB_COL_BLACK,RGB_COL_GREEN); // Grafik UB_Graphic2D_DrawFullRectDMA(10,40,100,50,RGB_COL_BLUE); while(1) { HAL_Delay(100); UB_Led_Toggle(LED_GREEN); if(UB_Button_OnPressed(BTN_USER)==true) { pos.dest_xp=0; pos.dest_yp=0; pos.source_h=breakingbad.height; pos.source_w=breakingbad.width; pos.source_xp=0; pos.source_yp=0; UB_Graphic2D_CopyImgDMA(&breakingbad,pos); } } } |
Hier der komplette OpenSTM32-Projektordner zum Download :