Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: LCD_DISCO_F469NI TS_DISCO_F469NI BSP_DISCO_F469NI
main.cpp
00001 #include "mbed.h" 00002 #include "stm32469i_discovery.h" 00003 #include "TS_DISCO_F469NI.h" 00004 #include "LCD_DISCO_F469NI.h" 00005 #include "F469_GUI.hpp" 00006 00007 int main() 00008 { 00009 BSP_LED_Init(DISCO_LED_BLUE); 00010 00011 Label obj10(400, 2, "Dome: GUI parts, 2016/07/23, 12:24", Label::CENTER, Font16); 00012 Label obj11(400, 20, "Button, ButtonGroup, Label, NumericLabel, BlinkLabel,", 00013 Label::CENTER); 00014 Label obj12(400, 32, "SeekBar, SeekbarGroup", 00015 Label::CENTER); 00016 00017 Button button1(10, 300, 80, 60, "1"); 00018 Button button2(95, 300, 80, 60, "2"); 00019 00020 const int NUMBER_BUTTONS = 4; 00021 const string STR1[NUMBER_BUTTONS] = {"Button1", "Button2", "Button3", "Activate"}; 00022 ButtonGroup bGroup1(160, 54, 66, 40, NUMBER_BUTTONS, STR1, 5, 5, 3, 1, 00023 Font12, LCD_COLOR_WHITE, 0xFF003538, 0xFFB70068, 0xFFFF7FFF); 00024 NumericLabel<int> bTouch(240, 112, Label::LEFT, Font12, LCD_COLOR_MAGENTA); 00025 00026 // Control status of bGroup1 00027 ButtonGroup bGroup2(160, 150, 66, 40, 3, (string[]){"0", "1", "2"}, 5, 5, 3); 00028 bGroup2.InactivateAll(); 00029 00030 // Switching buttons to control barH active or inactive 00031 ButtonGroup bGroup3(10, 150, 66, 40, 2, (string[]){"ON", "OFF"}, 0, 0, 2); 00032 bGroup3.TouchedColor(0); 00033 00034 Button doNotTouch(250, 220, 120, 40, "Don't Touch", Font12, 00035 GuiBase::ENUM_TEXT, GuiBase::ENUM_BACK, 00036 LCD_COLOR_DARKGREEN, LCD_COLOR_RED); 00037 00038 // Using default value for argument (Horizontal) 00039 SeekBar barH(20, 250, 200, -5, 5, 0, "-5", "0", "5"); 00040 NumericLabel<float> numLabel1(80, 205, "%5.1f", barH.GetValue()); 00041 NumericLabel<int> numLabel2(130, 205, "%3d", (int)barH.GetValue()); 00042 NumericLabel<int> numLabel3(160, 205); 00043 00044 // SeekbarGroup (vertical) 00045 SeekbarGroup barV(410, 130, 121, 2, 45, -6, 6, 2, 00046 SeekBar::Vertical, 0xFFA0FFC0); 00047 NumericLabel<float> **numLabel4; 00048 numLabel4 = new NumericLabel<float> *[2]; 00049 for (int n=0; n<2; n++) numLabel4[n] = 00050 new NumericLabel<float>(410+n*45, 104, "%4.1f", barV.GetValue(n), Label::CENTER); 00051 NumericLabel<int> numLabel5(455, 92, "%1d", barV.GetIntValue(0), Label::CENTER); 00052 00053 // Test of left-, cenrer-, and right-justified 00054 Label leftJustified(420, 54, "ABC", Label::LEFT); 00055 Label centerJustified(420, 64, "ABC", Label::CENTER); 00056 Label rightJustified1(420, 74, "ABC", Label::RIGHT); 00057 unsigned char flag=0; 00058 unsigned tab [2]={0x0000FF,0x00FF00}; 00059 while (true) 00060 { 00061 if (button1.Touched()){ 00062 if(flag==0){ 00063 flag=1; 00064 }else{ 00065 button1.Draw(); 00066 flag=0; 00067 } 00068 } 00069 if (button2.Touched()){ 00070 unsigned int v= (unsigned)(((barH.GetValue()+5)*255)/10)<<24; 00071 button2.Draw((unsigned)(tab[flag]+v)); 00072 } 00073 00074 int num; 00075 if (bGroup1.GetTouchedNumber(num)) 00076 bTouch.Draw("Button%d touched", num+1); 00077 if (num == 3) 00078 bGroup2.ActivateAll(); 00079 00080 if (bGroup2.GetTouchedNumber(num)) 00081 switch (num) 00082 { 00083 case 0: button1.Activate(); 00084 bGroup1.Activate(1); 00085 BSP_LED_On(DISCO_LED_BLUE); 00086 bGroup1.DrawAll(); 00087 break; 00088 case 1: button1.Inactivate(); 00089 bGroup1.Inactivate(1); 00090 BSP_LED_Off(DISCO_LED_BLUE); 00091 break; 00092 case 2: bGroup1.EraseAll();//for (int n=0; n<4; n++) bGroup1.Erase(n); 00093 for (int n=0; n<2; n++) 00094 { 00095 barV.Draw(n, 0); // reset seekbar 00096 numLabel4[n]->Draw("%4.1f", barV.GetValue(n)); 00097 } 00098 break; 00099 } 00100 00101 if (barH.Slide()) 00102 { 00103 numLabel1.Draw("%5.1f", barH.GetValue()); 00104 int8_t x = (int8_t)barH.GetValue(); 00105 numLabel2.Draw("%3d", x); 00106 00107 numLabel3.Draw("%3d", barH.GetIntValue()); 00108 } 00109 00110 int sbNum; 00111 if (barV.GetSlidedNumber(sbNum)) 00112 { 00113 if (sbNum == 0) numLabel4[sbNum]->Draw("%4.1f", barV.GetValue(sbNum)); 00114 else numLabel4[sbNum]->Draw("%4.1f", barV.GetValue(sbNum)); 00115 if (sbNum == 1) numLabel5.Draw("%1d", barV.GetIntValue(sbNum)); 00116 } 00117 // If "doNotTouch" button touched, trapped into endless loop 00118 if (doNotTouch.Touched()) 00119 BlinkLabel warning(250, 200, "You must reset", Label::LEFT, Font16); 00120 00121 // SeekBar active inactive switching 00122 if (bGroup3.Touched(0)) 00123 { 00124 barH.Activate(); 00125 barV.ActivateAll(); 00126 } 00127 if (bGroup3.Touched(1)) 00128 { 00129 barH.Inactivate(); 00130 barV.InactivateAll(); 00131 } 00132 00133 wait(0.02f); 00134 } 00135 }
Generated on Thu Jul 14 2022 18:45:26 by
1.7.2