微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 嵌入式设计讨论 > MCU和单片机设计讨论 > STM32移植UCGUI,制作的一个小车调试界面,就差触屏部分了

STM32移植UCGUI,制作的一个小车调试界面,就差触屏部分了

时间:10-02 整理:3721RD 点击:

学习了UCGUI有几天了,自已做了一个界面,更种控件,关于小车调试的一些参数。由于接触时间短所以可能有错误的地方,请大家提出哈。整个文件太大了,上传不上来,所以只有主函数。主要是调用各种控件函数,很简单。
#include "stm32f10x.h"
#include "ili9320.h"
#include "WM.h"
#include "Widget.h"
#include "button_private.h"
#include "PROGBAR.h"
#include "checkbox.h"
#include "edit.h"
#include "listbox.h"
#include "slider.h"
#include "text.h"
#include "scrollbar.h"
#include "framewin_private.h"
#include "GUI.h"
void delay(unsigned long t)
{
   while(t--);
}
int main(void)
{
const char  FRAM[]={"Assistant  Of  The  Car"};
  const char  button[]={"START"};
  const char  button1[]={"STOP"};
  const char  button2[]={"RESET"};
  const char  button3[]={"SEND_MOD"};
  const char  button4[]={"RECE_MOD"};
  const char  button5[]={"-"};
  const char  button6[]={"+"};
  const char  Text[]={"AD1"};
  const char  Text1[]={"AD2"};
  const char  Text2[]={"AD3"};
  const char  Text3[]={"AD4"};
  const char  Text4[]={"duty ratio"};
  const char  Text5[]={"P"};
  const char  Text6[]={"I"};
  const char  Text7[]={"D"};
BUTTON_Handle    Button[11];//°′?¥???t
PROGBAR_Handle   ProgBar[4];//???èì????t
EDIT_Handle      Edit[10];//±à? ???t
TEXT_Handle      text[10];//??±????t
FRAMEWIN_Handle FramWin;
SLIDER_Handle    Slide[4];//???ˉ???t
GUI_Init();
  WM_Init();
GUI_SetBkColor(GUI_BLACK);
GUI_Clear();//???á
  FramWin=FRAMEWIN_Create(FRAM,0,WM_CF_SHOW,10,10,300,230);
  FRAMEWIN_SetActive(FramWin,1);//?¤???a???ò?ü
  //Text=TEXT_Create(60,60,80,80,4,WM_CF_SHOW,bb,TEXT_CF_LEFT);
  GUI_Exec();
  //WM_SetDesktopColor(GUI_BLACK);//éè??×à??μ???é?
  Button[0]=BUTTON_Create(20,30,40,20,1,WM_CF_SHOW);
  BUTTON_SetBkColor(Button[0],1,GUI_BLUE);//éè??°′?¥°′??ê±μ???é?
  BUTTON_SetText(Button[0],button);//°′?¥1
  Button[1]=BUTTON_Create(70,30,40,20,2,WM_CF_SHOW);
  BUTTON_SetBkColor(Button[1],1,GUI_BLUE);//éè??°′?¥°′??ê±μ???é?
  BUTTON_SetText(Button[1],button1);//°′?¥2
  Button[2]=BUTTON_Create(120,30,40,20,3,WM_CF_SHOW);
  BUTTON_SetBkColor(Button[2],1,GUI_BLUE);//éè??°′?¥°′??ê±μ???é?
  BUTTON_SetText(Button[2],button2);//°′?¥3
Button[3]=BUTTON_Create(170,30,60,20,4,WM_CF_SHOW);
  BUTTON_SetBkColor(Button[3],1,GUI_BLUE);//éè??°′?¥°′??ê±μ???é?
  BUTTON_SetText(Button[3],button3);//°′?¥3
Button[4]=BUTTON_Create(240,30,60,20,5,WM_CF_SHOW);
  BUTTON_SetBkColor(Button[4],1,GUI_BLUE);//éè??°′?¥°′??ê±μ???é?
  BUTTON_SetText(Button[4],button4);//°′?¥3
GUI_Exec();
text[0]=TEXT_Create(20,60,20,20,6,WM_CF_SHOW,Text,TEXT_CF_LEFT);
Edit[0]=EDIT_Create(40,60,35,20,7,4,WM_CF_SHOW);
EDIT_SetDecMode(Edit[0],0,0,5000,0,0);
text[1]=TEXT_Create(80,60,20,20,8,WM_CF_SHOW,Text1,TEXT_CF_LEFT);
Edit[1]=EDIT_Create(100,60,35,20,9,4,WM_CF_SHOW);
EDIT_SetDecMode(Edit[1],0,0,5000,0,0);
text[2]=TEXT_Create(140,60,20,20,10,WM_CF_SHOW,Text2,TEXT_CF_LEFT);
Edit[2]=EDIT_Create(160,60,35,20,11,4,WM_CF_SHOW);
EDIT_SetDecMode(Edit[2],0,0,5000,0,0);
text[3]=TEXT_Create(200,60,20,20,12,WM_CF_SHOW,Text3,TEXT_CF_LEFT);
Edit[3]=EDIT_Create(220,60,35,20,13,4,WM_CF_SHOW);
EDIT_SetDecMode(Edit[3],0,0,5000,0,0);
  GUI_Exec();
  text[4]=TEXT_Create(20,90,70,20,12,WM_CF_SHOW,Text4,TEXT_CF_LEFT);
Button[5]=BUTTON_Create(95,90,15,20,1,WM_CF_SHOW);
  BUTTON_SetBkColor(Button[5],1,GUI_BLUE);//éè??°′?¥°′??ê±μ???é?
  BUTTON_SetText(Button[5],button5);//°′?¥1
ProgBar[0]=PROGBAR_Create(115,90,150,20,WM_CF_SHOW);
PROGBAR_SetBarColor(ProgBar[0],0,GUI_BLUE);
PROGBAR_SetBarColor(ProgBar[0],1,GUI_RED);
PROGBAR_SetValue(ProgBar[0],10);
Button[6]=BUTTON_Create(270,90,15,20,1,WM_CF_SHOW);
BUTTON_SetText(Button[6],button6);//°′?¥1
  GUI_Exec();
text[5]=TEXT_Create(20,120,15,20,13,WM_CF_SHOW,Text5,TEXT_CF_LEFT);
  Button[7]=BUTTON_Create(40,120,20,20,1,WM_CF_SHOW);
  BUTTON_SetText(Button[7],button5);//°′?¥1
Slide[0]=SLIDER_Create(65,120,170,20,0,0,WM_CF_SHOW,0);//????×′ì?
SLIDER_SetRange(Slide[0],0,100);
SLIDER_SetValue(Slide[0],50);
SLIDER_SetWidth(Slide[0],5);
Button[8]=BUTTON_Create(240,120,20,20,1,WM_CF_SHOW);
BUTTON_SetText(Button[8],button6);
Edit[4]=EDIT_Create(265,120,35,20,15,3,WM_CF_SHOW);
EDIT_SetDecMode(Edit[4],0,0,100,0,0);//P

text[6]=TEXT_Create(20,150,15,20,13,WM_CF_SHOW,Text6,TEXT_CF_LEFT);
  Button[8]=BUTTON_Create(40,150,20,20,1,WM_CF_SHOW);
  BUTTON_SetText(Button[8],button5);//°′?¥1
Slide[1]=SLIDER_Create(65,150,170,20,0,0,WM_CF_SHOW,0);//????×′ì?
SLIDER_SetRange(Slide[1],0,100);
SLIDER_SetValue(Slide[1],50);
SLIDER_SetWidth(Slide[1],5);
Button[9]=BUTTON_Create(240,150,20,20,1,WM_CF_SHOW);
BUTTON_SetText(Button[9],button6);
Edit[5]=EDIT_Create(265,150,35,20,15,3,WM_CF_SHOW);
EDIT_SetDecMode(Edit[5],0,0,100,0,0);//I

text[7]=TEXT_Create(20,180,15,20,13,WM_CF_SHOW,Text7,TEXT_CF_LEFT);
  Button[9]=BUTTON_Create(40,180,20,20,1,WM_CF_SHOW);
  BUTTON_SetText(Button[9],button5);//°′?¥1
Slide[2]=SLIDER_Create(65,180,170,20,0,0,WM_CF_SHOW,0);//????×′ì?
SLIDER_SetRange(Slide[2],0,100);
SLIDER_SetValue(Slide[2],50);
SLIDER_SetWidth(Slide[2],5);
Button[10]=BUTTON_Create(240,180,20,20,1,WM_CF_SHOW);
BUTTON_SetText(Button[10],button6);
Edit[5]=EDIT_Create(265,180,35,20,15,3,WM_CF_SHOW);
EDIT_SetDecMode(Edit[5],0,0,100,0,0);//D
GUI_Exec();
while(1)
{
  
  
}
}




这个好!                        

加油哦!                                          

谢谢!

stm 32 。观望中。

顶一下
如果想透彻的学习下ucgui可以联系我 qq610095871 开水。论坛里搜索ucgui视频教程也可以

very good!very good!very good!

我知道开水,不过教程在淘宝上卖的很贵。只是在宣传

一点一点不停的学习,日积月累!

可以分享点资料吗?想移植到32上,加ucosiii

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top