├── .gitignore
├── README.md
├── STM32F103
├── .gitattributes
├── .gitignore
├── CORE
│ ├── core_cm3.c
│ ├── core_cm3.h
│ ├── startup_stm32f10x_cl.s
│ ├── startup_stm32f10x_hd.s
│ ├── startup_stm32f10x_hd_vl.s
│ ├── startup_stm32f10x_ld.s
│ ├── startup_stm32f10x_ld_vl.s
│ ├── startup_stm32f10x_md.s
│ ├── startup_stm32f10x_md_vl.s
│ └── startup_stm32f10x_xl.s
├── HARDWARE
│ ├── ADC
│ │ ├── adc.c
│ │ └── adc.h
│ ├── CAPTURE
│ │ ├── capture2.c
│ │ ├── capture2.h
│ │ ├── capture3.c
│ │ ├── capture3.h
│ │ ├── capture3re.c
│ │ ├── capture3re.h
│ │ └── ch2bak.zip
│ ├── DAC
│ │ ├── dac.c
│ │ └── dac.h
│ ├── DMA
│ │ ├── dma.c
│ │ └── dma.h
│ ├── GPIO
│ │ ├── gpio.c
│ │ └── gpio.h
│ ├── LCD
│ │ ├── ascii.h
│ │ ├── ili9325.c
│ │ └── ili9325.h
│ ├── LED
│ │ ├── led.c
│ │ └── led.h
│ ├── PWM
│ │ ├── pwm.c
│ │ └── pwm.h
│ └── TIMER
│ │ ├── timer.c
│ │ └── timer.h
├── STM32F10x_FWLib
│ ├── inc
│ │ ├── misc.h
│ │ ├── stm32f10x_adc.h
│ │ ├── stm32f10x_bkp.h
│ │ ├── stm32f10x_can.h
│ │ ├── stm32f10x_cec.h
│ │ ├── stm32f10x_crc.h
│ │ ├── stm32f10x_dac.h
│ │ ├── stm32f10x_dbgmcu.h
│ │ ├── stm32f10x_dma.h
│ │ ├── stm32f10x_exti.h
│ │ ├── stm32f10x_flash.h
│ │ ├── stm32f10x_fsmc.h
│ │ ├── stm32f10x_gpio.h
│ │ ├── stm32f10x_i2c.h
│ │ ├── stm32f10x_iwdg.h
│ │ ├── stm32f10x_pwr.h
│ │ ├── stm32f10x_rcc.h
│ │ ├── stm32f10x_rtc.h
│ │ ├── stm32f10x_sdio.h
│ │ ├── stm32f10x_spi.h
│ │ ├── stm32f10x_tim.h
│ │ ├── stm32f10x_usart.h
│ │ └── stm32f10x_wwdg.h
│ └── src
│ │ ├── misc.c
│ │ ├── stm32f10x_adc.c
│ │ ├── stm32f10x_bkp.c
│ │ ├── stm32f10x_can.c
│ │ ├── stm32f10x_cec.c
│ │ ├── stm32f10x_crc.c
│ │ ├── stm32f10x_dac.c
│ │ ├── stm32f10x_dbgmcu.c
│ │ ├── stm32f10x_dma.c
│ │ ├── stm32f10x_exti.c
│ │ ├── stm32f10x_flash.c
│ │ ├── stm32f10x_fsmc.c
│ │ ├── stm32f10x_gpio.c
│ │ ├── stm32f10x_i2c.c
│ │ ├── stm32f10x_iwdg.c
│ │ ├── stm32f10x_pwr.c
│ │ ├── stm32f10x_rcc.c
│ │ ├── stm32f10x_rtc.c
│ │ ├── stm32f10x_sdio.c
│ │ ├── stm32f10x_spi.c
│ │ ├── stm32f10x_tim.c
│ │ ├── stm32f10x_usart.c
│ │ └── stm32f10x_wwdg.c
├── SYSTEM
│ ├── delay
│ │ ├── delay.c
│ │ └── delay.h
│ ├── sys
│ │ ├── sys.c
│ │ └── sys.h
│ └── usart
│ │ ├── usart1.c
│ │ ├── usart1.h
│ │ ├── usart2.c
│ │ └── usart2.h
├── USER
│ ├── JLink Regs CM3.txt
│ ├── JLinkSettings.ini
│ ├── main.c
│ ├── stm32f10x.h
│ ├── stm32f10x_conf.h
│ ├── stm32f10x_it.c
│ ├── stm32f10x_it.h
│ ├── system_stm32f10x.c
│ ├── system_stm32f10x.h
│ ├── test01.uvgui.Administrator
│ ├── test01.uvgui.DevinZhang
│ ├── test01.uvproj
│ ├── var_space.c
│ └── var_space.h
├── keilkilll.bat
└── readme.txt
├── UI_0620
├── .zip
├── Makefile
├── Makefile.Debug
├── Makefile.Release
├── UI_65
├── UI_65.pro
├── UI_65.pro.user
├── UI_65.pro.user.62190a8.3.3-pre1
├── configpage.cpp
├── configpage.h
├── configpage.o
├── configpage.ui
├── configuration.txt
├── datastack.cpp
├── datastack.h
├── datastack.o
├── datestpage.cpp
├── datestpage.h
├── datestpage.o
├── datestpage.ui
├── drawpage.cpp
├── drawpage.h
├── drawpage.o
├── homepage.cpp
├── homepage.h
├── homepage.o
├── homepage.ui
├── keyboard.cpp
├── keyboard.h
├── keyboard.o
├── keyboard.ui
├── keybutton.cpp
├── keybutton.h
├── keybutton.o
├── logo.jpg
├── main.cpp
├── main.o
├── mainwindow.cpp
├── mainwindow.h
├── mainwindow.o
├── mainwindow.ui
├── moc_configpage.cpp
├── moc_configpage.o
├── moc_datestpage.cpp
├── moc_datestpage.o
├── moc_drawpage.cpp
├── moc_drawpage.o
├── moc_helpbutton.cpp
├── moc_helppage.cpp
├── moc_homepage.cpp
├── moc_homepage.o
├── moc_keyboard.cpp
├── moc_keyboard.o
├── moc_keybutton.cpp
├── moc_keybutton.o
├── moc_mainwindow.cpp
├── moc_mainwindow.o
├── moc_mybutton.cpp
├── moc_mybutton.o
├── moc_mycheckbox.cpp
├── moc_mycheckbox.o
├── moc_mycombobox.cpp
├── moc_mycombobox.o
├── moc_mylineedit.cpp
├── moc_mylineedit.o
├── moc_myspinbox.cpp
├── moc_myspinbox.o
├── moc_mywatch.cpp
├── moc_mywatch.o
├── moc_outputconfig.cpp
├── moc_outputconfig.o
├── moc_page_1.cpp
├── moc_page_1.o
├── moc_pdfheaderedit.cpp
├── moc_pdfheaderedit.o
├── moc_picture.cpp
├── moc_picture.o
├── moc_qextserialbase.cpp
├── moc_receiver_thread.cpp
├── moc_receiver_thread.o
├── moc_sender_thread.cpp
├── moc_serialport.cpp
├── moc_serialport.o
├── moc_uartthread.cpp
├── moc_uartthread.o
├── mybutton.cpp
├── mybutton.h
├── mybutton.o
├── mycheckbox.cpp
├── mycheckbox.h
├── mycheckbox.o
├── mycombobox.cpp
├── mycombobox.h
├── mycombobox.o
├── mylineedit.cpp
├── mylineedit.h
├── mylineedit.o
├── myspinbox.cpp
├── myspinbox.h
├── myspinbox.o
├── mywatch.cpp
├── mywatch.h
├── mywatch.o
├── outputconfig.cpp
├── outputconfig.h
├── outputconfig.o
├── outputconfig.ui
├── page_1.cpp
├── page_1.h
├── page_1.o
├── page_1.ui
├── pdfheaderedit.cpp
├── pdfheaderedit.h
├── pdfheaderedit.o
├── pdfheaderedit.ui
├── picture.cpp
├── picture.h
├── picture.o
├── picture.ui
├── qrc_rcf.cpp
├── qrc_rcf.o
├── rcf.qrc
├── receiver_thread.cpp
├── receiver_thread.h
├── receiver_thread.o
├── serialport.cpp
├── serialport.h
├── serialport.o
├── uartthread.cpp
├── uartthread.h
├── uartthread.o
├── ui_configpage.h
├── ui_datestpage.h
├── ui_helppage.h
├── ui_homepage.h
├── ui_keyboard.h
├── ui_mainwindow.h
├── ui_outputconfig.h
├── ui_page_1.h
├── ui_pdfheaderedit.h
└── ui_picture.h
├── UI_622_windows
├── UI_622_windows
│ ├── UI_622.pro
│ ├── UI_622.pro.user
│ ├── UI_622.pro.user.7d027ac
│ ├── configpage.cpp
│ ├── configpage.h
│ ├── configpage.ui
│ ├── configuration.txt
│ ├── datastack.cpp
│ ├── datastack.h
│ ├── datestpage.cpp
│ ├── datestpage.h
│ ├── datestpage.ui
│ ├── drawpage.cpp
│ ├── drawpage.h
│ ├── homepage.cpp
│ ├── homepage.h
│ ├── homepage.ui
│ ├── keyboard.cpp
│ ├── keyboard.h
│ ├── keyboard.ui
│ ├── keybutton.cpp
│ ├── keybutton.h
│ ├── logo.jpg
│ ├── main.cpp
│ ├── mainwindow.cpp
│ ├── mainwindow.h
│ ├── mainwindow.ui
│ ├── mybutton.cpp
│ ├── mybutton.h
│ ├── mycheckbox.cpp
│ ├── mycheckbox.h
│ ├── mycombobox.cpp
│ ├── mycombobox.h
│ ├── mylineedit.cpp
│ ├── mylineedit.h
│ ├── myspinbox.cpp
│ ├── myspinbox.h
│ ├── mywatch.cpp
│ ├── mywatch.h
│ ├── outputconfig.cpp
│ ├── outputconfig.h
│ ├── outputconfig.ui
│ ├── page_1.cpp
│ ├── page_1.h
│ ├── page_1.ui
│ ├── pdfheaderedit.cpp
│ ├── pdfheaderedit.h
│ ├── pdfheaderedit.ui
│ ├── picture.cpp
│ ├── picture.h
│ ├── picture.ui
│ ├── qrc_rcf.cpp
│ ├── rcf.qrc
│ ├── receiver_thread.cpp
│ ├── receiver_thread.h
│ ├── serialport.cpp
│ ├── serialport.h
│ ├── uartthread.cpp
│ └── uartthread.h
├── build-UI_622-Desktop_Qt_5_4_1_MinGW_32bit-Debug
│ ├── Makefile
│ ├── Makefile.Debug
│ ├── Makefile.Release
│ ├── configuration.txt
│ ├── datafiles
│ │ ├── data2.txt
│ │ ├── data3.txt
│ │ ├── data4.txt
│ │ ├── data5.txt
│ │ └── data6.txt
│ ├── debug
│ │ ├── UI_622.exe
│ │ ├── configpage.o
│ │ ├── datastack.o
│ │ ├── datestpage.o
│ │ ├── drawpage.o
│ │ ├── homepage.o
│ │ ├── keyboard.o
│ │ ├── keybutton.o
│ │ ├── main.o
│ │ ├── mainwindow.o
│ │ ├── moc_configpage.cpp
│ │ ├── moc_configpage.o
│ │ ├── moc_datestpage.cpp
│ │ ├── moc_datestpage.o
│ │ ├── moc_drawpage.cpp
│ │ ├── moc_drawpage.o
│ │ ├── moc_homepage.cpp
│ │ ├── moc_homepage.o
│ │ ├── moc_keyboard.cpp
│ │ ├── moc_keyboard.o
│ │ ├── moc_keybutton.cpp
│ │ ├── moc_keybutton.o
│ │ ├── moc_mainwindow.cpp
│ │ ├── moc_mainwindow.o
│ │ ├── moc_mybutton.cpp
│ │ ├── moc_mybutton.o
│ │ ├── moc_mycheckbox.cpp
│ │ ├── moc_mycheckbox.o
│ │ ├── moc_mycombobox.cpp
│ │ ├── moc_mycombobox.o
│ │ ├── moc_mylineedit.cpp
│ │ ├── moc_mylineedit.o
│ │ ├── moc_myspinbox.cpp
│ │ ├── moc_myspinbox.o
│ │ ├── moc_mywatch.cpp
│ │ ├── moc_mywatch.o
│ │ ├── moc_outputconfig.cpp
│ │ ├── moc_outputconfig.o
│ │ ├── moc_page_1.cpp
│ │ ├── moc_page_1.o
│ │ ├── moc_pdfheaderedit.cpp
│ │ ├── moc_pdfheaderedit.o
│ │ ├── moc_picture.cpp
│ │ ├── moc_picture.o
│ │ ├── moc_receiver_thread.cpp
│ │ ├── moc_receiver_thread.o
│ │ ├── moc_serialport.cpp
│ │ ├── moc_serialport.o
│ │ ├── moc_uartthread.cpp
│ │ ├── moc_uartthread.o
│ │ ├── mybutton.o
│ │ ├── mycheckbox.o
│ │ ├── mycombobox.o
│ │ ├── mylineedit.o
│ │ ├── myspinbox.o
│ │ ├── mywatch.o
│ │ ├── outputconfig.o
│ │ ├── page_1.o
│ │ ├── pdfheaderedit.o
│ │ ├── picture.o
│ │ ├── qrc_rcf.cpp
│ │ ├── qrc_rcf.o
│ │ ├── receiver_thread.o
│ │ ├── serialport.o
│ │ └── uartthread.o
│ ├── object_script.UI_622.Debug
│ ├── object_script.UI_622.Release
│ ├── ui_configpage.h
│ ├── ui_datestpage.h
│ ├── ui_homepage.h
│ ├── ui_keyboard.h
│ ├── ui_mainwindow.h
│ ├── ui_outputconfig.h
│ ├── ui_page_1.h
│ ├── ui_pdfheaderedit.h
│ └── ui_picture.h
├── build-UI_622-Desktop_Qt_5_5_0_MinGW_32bit-Debug
│ ├── Makefile
│ ├── Makefile.Debug
│ ├── Makefile.Release
│ ├── configuration.txt
│ ├── debug
│ │ ├── UI_622.exe
│ │ ├── configpage.o
│ │ ├── datastack.o
│ │ ├── datestpage.o
│ │ ├── drawpage.o
│ │ ├── homepage.o
│ │ ├── keyboard.o
│ │ ├── keybutton.o
│ │ ├── main.o
│ │ ├── mainwindow.o
│ │ ├── moc_configpage.cpp
│ │ ├── moc_configpage.o
│ │ ├── moc_datestpage.cpp
│ │ ├── moc_datestpage.o
│ │ ├── moc_drawpage.cpp
│ │ ├── moc_drawpage.o
│ │ ├── moc_homepage.cpp
│ │ ├── moc_homepage.o
│ │ ├── moc_keyboard.cpp
│ │ ├── moc_keyboard.o
│ │ ├── moc_keybutton.cpp
│ │ ├── moc_keybutton.o
│ │ ├── moc_mainwindow.cpp
│ │ ├── moc_mainwindow.o
│ │ ├── moc_mybutton.cpp
│ │ ├── moc_mybutton.o
│ │ ├── moc_mycheckbox.cpp
│ │ ├── moc_mycheckbox.o
│ │ ├── moc_mycombobox.cpp
│ │ ├── moc_mycombobox.o
│ │ ├── moc_mylineedit.cpp
│ │ ├── moc_mylineedit.o
│ │ ├── moc_myspinbox.cpp
│ │ ├── moc_myspinbox.o
│ │ ├── moc_mywatch.cpp
│ │ ├── moc_mywatch.o
│ │ ├── moc_outputconfig.cpp
│ │ ├── moc_outputconfig.o
│ │ ├── moc_page_1.cpp
│ │ ├── moc_page_1.o
│ │ ├── moc_pdfheaderedit.cpp
│ │ ├── moc_pdfheaderedit.o
│ │ ├── moc_picture.cpp
│ │ ├── moc_picture.o
│ │ ├── moc_receiver_thread.cpp
│ │ ├── moc_receiver_thread.o
│ │ ├── moc_serialport.cpp
│ │ ├── moc_serialport.o
│ │ ├── moc_uartthread.cpp
│ │ ├── moc_uartthread.o
│ │ ├── mybutton.o
│ │ ├── mycheckbox.o
│ │ ├── mycombobox.o
│ │ ├── mylineedit.o
│ │ ├── myspinbox.o
│ │ ├── mywatch.o
│ │ ├── outputconfig.o
│ │ ├── page_1.o
│ │ ├── pdfheaderedit.o
│ │ ├── picture.o
│ │ ├── qrc_rcf.cpp
│ │ ├── qrc_rcf.o
│ │ ├── receiver_thread.o
│ │ ├── serialport.o
│ │ └── uartthread.o
│ ├── object_script.UI_622.Debug
│ ├── object_script.UI_622.Release
│ ├── ui_configpage.h
│ ├── ui_datestpage.h
│ ├── ui_homepage.h
│ ├── ui_keyboard.h
│ ├── ui_mainwindow.h
│ ├── ui_outputconfig.h
│ ├── ui_page_1.h
│ ├── ui_pdfheaderedit.h
│ └── ui_picture.h
└── build-UI_622-unknown-Debug
│ ├── Makefile
│ ├── Makefile.Debug
│ ├── Makefile.Release
│ ├── object_script.UI_622.Debug
│ ├── object_script.UI_622.Release
│ ├── ui_configpage.h
│ ├── ui_datestpage.h
│ ├── ui_homepage.h
│ ├── ui_keyboard.h
│ ├── ui_mainwindow.h
│ ├── ui_outputconfig.h
│ ├── ui_page_1.h
│ ├── ui_pdfheaderedit.h
│ └── ui_picture.h
└── 底层硬件资料
├── 电机参数系统测试 (2016-5-21 21-23-54).zip
├── 电机参数系统测试.PcbDoc
└── 电机测试系统数据采集板(2).pdf
/.gitignore:
--------------------------------------------------------------------------------
1 | # Windows image file caches
2 | Thumbs.db
3 | ehthumbs.db
4 |
5 | # Folder config file
6 | Desktop.ini
7 |
8 | # Recycle Bin used on file shares
9 | $RECYCLE.BIN/
10 |
11 | # Windows Installer files
12 | *.cab
13 | *.msi
14 | *.msm
15 | *.msp
16 |
17 | # Windows shortcuts
18 | *.lnk
19 |
20 | # =========================
21 | # Operating System Files
22 | # =========================
23 |
24 | # OSX
25 | # =========================
26 |
27 | .DS_Store
28 | .AppleDouble
29 | .LSOverride
30 |
31 | # Thumbnails
32 | ._*
33 |
34 | # Files that might appear on external disk
35 | .Spotlight-V100
36 | .Trashes
37 |
38 | # Directories potentially created on remote AFP share
39 | .AppleDB
40 | .AppleDesktop
41 | Network Trash Folder
42 | Temporary Items
43 | .apdisk
44 |
45 | #
46 | /STM32F103/OBJ
47 | !/STM32F103/OBJ/test01.hex
48 | /STM32F103/USER/startup_stm32f10x_hd.lst
49 | /STM32F103/USER/test01.map
50 | /STM32F103/USER/test01_stm32f103_test.dep
51 | /STM32F103/USER/JLinkLog.txt
52 | /STM32F103/USER/test01.uvgui_123.bak
53 | /STM32F103/USER/test01_uvopt.bak
54 | /STM32F103/USER/test01_uvproj.bak
55 | /STM32F103/USER/test01.uvgui.123
56 | /STM32F103/USER/test01.uvopt
57 | /UI_0620_windows/build-UI_622-Desktop_Qt_5_4_1_MinGW_32bit-Debug
58 | /UI_0620_windows/build-UI_622-Desktop_Qt_5_5_0_MinGW_32bit-Debug
59 | /UI_0620_windows/build-UI_622-unknown-Debug
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # MotorMeasurement
2 | 电机转速转矩测量系统分两部分:1.基于STM32F103单片机的信号采集模块。2、用Qt编写的界面显示软件
3 | ##环境
4 | Keil uVision4
5 | J-Link ARM V4.50l驱动
6 |
7 | ##演示说明
8 | 打开MotorMeasurement\STM32F103\USER\test01.uvproj编译并下载程序到板子上
9 | 然后打开上位机QT程序,点击开始,打开电机,即可看到测量数据。
10 |
11 |
--------------------------------------------------------------------------------
/STM32F103/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
7 | # Standard to msysgit
8 | *.doc diff=astextplain
9 | *.DOC diff=astextplain
10 | *.docx diff=astextplain
11 | *.DOCX diff=astextplain
12 | *.dot diff=astextplain
13 | *.DOT diff=astextplain
14 | *.pdf diff=astextplain
15 | *.PDF diff=astextplain
16 | *.rtf diff=astextplain
17 | *.RTF diff=astextplain
18 |
--------------------------------------------------------------------------------
/STM32F103/.gitignore:
--------------------------------------------------------------------------------
1 | # Windows image file caches
2 | Thumbs.db
3 | ehthumbs.db
4 |
5 | # Folder config file
6 | Desktop.ini
7 |
8 | # Recycle Bin used on file shares
9 | $RECYCLE.BIN/
10 |
11 | # Windows Installer files
12 | *.cab
13 | *.msi
14 | *.msm
15 | *.msp
16 |
17 | # Windows shortcuts
18 | *.lnk
19 |
20 | # =========================
21 | # Operating System Files
22 | # =========================
23 |
24 | # OSX
25 | # =========================
26 |
27 | .DS_Store
28 | .AppleDouble
29 | .LSOverride
30 |
31 | # Thumbnails
32 | ._*
33 |
34 | # Files that might appear on external disk
35 | .Spotlight-V100
36 | .Trashes
37 |
38 | # Directories potentially created on remote AFP share
39 | .AppleDB
40 | .AppleDesktop
41 | Network Trash Folder
42 | Temporary Items
43 | .apdisk
44 |
45 | /USER/JLinkLog.txt
46 | /USER/startup_stm32f10x_hd.lst
47 | /USER/test01.map
48 | /USER/test01.uvgui_123.bak
49 | /USER/test01_uvopt.bak
50 | /USER/test01_uvproj.bak
51 |
52 |
--------------------------------------------------------------------------------
/STM32F103/HARDWARE/ADC/adc.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/HARDWARE/ADC/adc.c
--------------------------------------------------------------------------------
/STM32F103/HARDWARE/ADC/adc.h:
--------------------------------------------------------------------------------
1 | #ifndef __ADC_H
2 | #define __ADC_H
3 | #include "sys.h"
4 |
5 | void Adc_Init(void);
6 | u16 Get_Adc(u8 ch);
7 | u16 Get_Adc_Average(u8 ch,u8 times);
8 |
9 | #endif
10 |
--------------------------------------------------------------------------------
/STM32F103/HARDWARE/CAPTURE/capture2.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/HARDWARE/CAPTURE/capture2.c
--------------------------------------------------------------------------------
/STM32F103/HARDWARE/CAPTURE/capture2.h:
--------------------------------------------------------------------------------
1 | #ifndef __CAPTURE2_H
2 | #define __CAPTURE2_H
3 | #include "sys.h"
4 |
5 | void TIM2_Cap_Init(u16 arr,u16 psc);
6 |
7 | #endif
8 |
--------------------------------------------------------------------------------
/STM32F103/HARDWARE/CAPTURE/capture3.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/HARDWARE/CAPTURE/capture3.c
--------------------------------------------------------------------------------
/STM32F103/HARDWARE/CAPTURE/capture3.h:
--------------------------------------------------------------------------------
1 | #ifndef __CAPTURE3_H
2 | #define __CAPTURE3_H
3 | #include "sys.h"
4 |
5 | void TIM3_Cap_Init(u16 arr,u16 psc);
6 |
7 | #endif
8 |
--------------------------------------------------------------------------------
/STM32F103/HARDWARE/CAPTURE/capture3re.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/HARDWARE/CAPTURE/capture3re.c
--------------------------------------------------------------------------------
/STM32F103/HARDWARE/CAPTURE/capture3re.h:
--------------------------------------------------------------------------------
1 | #ifndef __CAPTURE3RE_H
2 | #define __CAPTURE3RE_H
3 | #include "sys.h"
4 |
5 | void TIM3RE_Cap_Init(u16 arr,u16 psc);
6 |
7 | #endif
8 |
--------------------------------------------------------------------------------
/STM32F103/HARDWARE/CAPTURE/ch2bak.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/HARDWARE/CAPTURE/ch2bak.zip
--------------------------------------------------------------------------------
/STM32F103/HARDWARE/DAC/dac.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/HARDWARE/DAC/dac.c
--------------------------------------------------------------------------------
/STM32F103/HARDWARE/DAC/dac.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/HARDWARE/DAC/dac.h
--------------------------------------------------------------------------------
/STM32F103/HARDWARE/DMA/dma.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/HARDWARE/DMA/dma.c
--------------------------------------------------------------------------------
/STM32F103/HARDWARE/DMA/dma.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/HARDWARE/DMA/dma.h
--------------------------------------------------------------------------------
/STM32F103/HARDWARE/GPIO/gpio.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/HARDWARE/GPIO/gpio.c
--------------------------------------------------------------------------------
/STM32F103/HARDWARE/GPIO/gpio.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/HARDWARE/GPIO/gpio.h
--------------------------------------------------------------------------------
/STM32F103/HARDWARE/LCD/ascii.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/HARDWARE/LCD/ascii.h
--------------------------------------------------------------------------------
/STM32F103/HARDWARE/LCD/ili9325.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/HARDWARE/LCD/ili9325.c
--------------------------------------------------------------------------------
/STM32F103/HARDWARE/LCD/ili9325.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/HARDWARE/LCD/ili9325.h
--------------------------------------------------------------------------------
/STM32F103/HARDWARE/LED/led.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/HARDWARE/LED/led.c
--------------------------------------------------------------------------------
/STM32F103/HARDWARE/LED/led.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/HARDWARE/LED/led.h
--------------------------------------------------------------------------------
/STM32F103/HARDWARE/PWM/pwm.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/HARDWARE/PWM/pwm.c
--------------------------------------------------------------------------------
/STM32F103/HARDWARE/PWM/pwm.h:
--------------------------------------------------------------------------------
1 | #ifndef __PWM_H
2 | #define __PWM_H
3 | #include "sys.h"
4 |
5 | void TIM1_PWM_Init(u16 arr,u16 psc);
6 |
7 | #endif
8 |
--------------------------------------------------------------------------------
/STM32F103/HARDWARE/TIMER/timer.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/HARDWARE/TIMER/timer.c
--------------------------------------------------------------------------------
/STM32F103/HARDWARE/TIMER/timer.h:
--------------------------------------------------------------------------------
1 | #ifndef __TIMER_H
2 | #define __TIMER_H
3 | #include "sys.h"
4 |
5 | void TIM4_Int_Init(u16 arr,u16 psc);
6 | void TIM5_Int_Init(u16 arr,u16 psc);
7 |
8 | #endif
9 |
--------------------------------------------------------------------------------
/STM32F103/STM32F10x_FWLib/inc/stm32f10x_crc.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f10x_crc.h
4 | * @author MCD Application Team
5 | * @version V3.4.0
6 | * @date 10/15/2010
7 | * @brief This file contains all the functions prototypes for the CRC firmware
8 | * library.
9 | ******************************************************************************
10 | * @copy
11 | *
12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18 | *
19 | *
© COPYRIGHT 2010 STMicroelectronics
20 | */
21 |
22 | /* Define to prevent recursive inclusion -------------------------------------*/
23 | #ifndef __STM32F10x_CRC_H
24 | #define __STM32F10x_CRC_H
25 |
26 | #ifdef __cplusplus
27 | extern "C" {
28 | #endif
29 |
30 | /* Includes ------------------------------------------------------------------*/
31 | #include "stm32f10x.h"
32 |
33 | /** @addtogroup STM32F10x_StdPeriph_Driver
34 | * @{
35 | */
36 |
37 | /** @addtogroup CRC
38 | * @{
39 | */
40 |
41 | /** @defgroup CRC_Exported_Types
42 | * @{
43 | */
44 |
45 | /**
46 | * @}
47 | */
48 |
49 | /** @defgroup CRC_Exported_Constants
50 | * @{
51 | */
52 |
53 | /**
54 | * @}
55 | */
56 |
57 | /** @defgroup CRC_Exported_Macros
58 | * @{
59 | */
60 |
61 | /**
62 | * @}
63 | */
64 |
65 | /** @defgroup CRC_Exported_Functions
66 | * @{
67 | */
68 |
69 | void CRC_ResetDR(void);
70 | uint32_t CRC_CalcCRC(uint32_t Data);
71 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength);
72 | uint32_t CRC_GetCRC(void);
73 | void CRC_SetIDRegister(uint8_t IDValue);
74 | uint8_t CRC_GetIDRegister(void);
75 |
76 | #ifdef __cplusplus
77 | }
78 | #endif
79 |
80 | #endif /* __STM32F10x_CRC_H */
81 | /**
82 | * @}
83 | */
84 |
85 | /**
86 | * @}
87 | */
88 |
89 | /**
90 | * @}
91 | */
92 |
93 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
94 |
--------------------------------------------------------------------------------
/STM32F103/STM32F10x_FWLib/inc/stm32f10x_fsmc.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/STM32F10x_FWLib/inc/stm32f10x_fsmc.h
--------------------------------------------------------------------------------
/STM32F103/STM32F10x_FWLib/src/stm32f10x_adc.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/STM32F10x_FWLib/src/stm32f10x_adc.c
--------------------------------------------------------------------------------
/STM32F103/STM32F10x_FWLib/src/stm32f10x_can.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/STM32F10x_FWLib/src/stm32f10x_can.c
--------------------------------------------------------------------------------
/STM32F103/STM32F10x_FWLib/src/stm32f10x_dac.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/STM32F10x_FWLib/src/stm32f10x_dac.c
--------------------------------------------------------------------------------
/STM32F103/STM32F10x_FWLib/src/stm32f10x_dma.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/STM32F10x_FWLib/src/stm32f10x_dma.c
--------------------------------------------------------------------------------
/STM32F103/STM32F10x_FWLib/src/stm32f10x_exti.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/STM32F10x_FWLib/src/stm32f10x_exti.c
--------------------------------------------------------------------------------
/STM32F103/STM32F10x_FWLib/src/stm32f10x_flash.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/STM32F10x_FWLib/src/stm32f10x_flash.c
--------------------------------------------------------------------------------
/STM32F103/STM32F10x_FWLib/src/stm32f10x_fsmc.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/STM32F10x_FWLib/src/stm32f10x_fsmc.c
--------------------------------------------------------------------------------
/STM32F103/STM32F10x_FWLib/src/stm32f10x_i2c.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/STM32F10x_FWLib/src/stm32f10x_i2c.c
--------------------------------------------------------------------------------
/STM32F103/STM32F10x_FWLib/src/stm32f10x_rcc.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/STM32F10x_FWLib/src/stm32f10x_rcc.c
--------------------------------------------------------------------------------
/STM32F103/STM32F10x_FWLib/src/stm32f10x_rtc.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/STM32F10x_FWLib/src/stm32f10x_rtc.c
--------------------------------------------------------------------------------
/STM32F103/STM32F10x_FWLib/src/stm32f10x_sdio.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/STM32F10x_FWLib/src/stm32f10x_sdio.c
--------------------------------------------------------------------------------
/STM32F103/STM32F10x_FWLib/src/stm32f10x_tim.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/STM32F10x_FWLib/src/stm32f10x_tim.c
--------------------------------------------------------------------------------
/STM32F103/STM32F10x_FWLib/src/stm32f10x_usart.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/STM32F10x_FWLib/src/stm32f10x_usart.c
--------------------------------------------------------------------------------
/STM32F103/SYSTEM/delay/delay.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/SYSTEM/delay/delay.c
--------------------------------------------------------------------------------
/STM32F103/SYSTEM/delay/delay.h:
--------------------------------------------------------------------------------
1 | #ifndef __DELAY_H
2 | #define __DELAY_H
3 | #include "sys.h"
4 |
5 | void delay_init(void);
6 | void delay_ms(u16 nms);
7 | void delay_us(u32 nus);
8 |
9 | #endif
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 |
--------------------------------------------------------------------------------
/STM32F103/SYSTEM/sys/sys.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/SYSTEM/sys/sys.c
--------------------------------------------------------------------------------
/STM32F103/SYSTEM/sys/sys.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/SYSTEM/sys/sys.h
--------------------------------------------------------------------------------
/STM32F103/SYSTEM/usart/usart1.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/SYSTEM/usart/usart1.c
--------------------------------------------------------------------------------
/STM32F103/SYSTEM/usart/usart1.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/SYSTEM/usart/usart1.h
--------------------------------------------------------------------------------
/STM32F103/SYSTEM/usart/usart2.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/SYSTEM/usart/usart2.c
--------------------------------------------------------------------------------
/STM32F103/SYSTEM/usart/usart2.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/SYSTEM/usart/usart2.h
--------------------------------------------------------------------------------
/STM32F103/USER/JLink Regs CM3.txt:
--------------------------------------------------------------------------------
1 | 0: R0: 0x00
2 | 1: R1: 0x01
3 | 2: R2: 0x02
4 | 3: R3: 0x03
5 | 4: R4: 0x04
6 | 5: R5: 0x05
7 | 6: R6: 0x06
8 | 7: R7: 0x07
9 | 8: R8: 0x08
10 | 9: R9: 0x09
11 | 10: R10: 0x0a
12 | 11: R11: 0x0b
13 | 12: R12: 0x0c
14 | 13: R13: 0x0d
15 | 14: R14: 0x0e
16 | 15: R15: 0x0f
17 | 16: XPSR: 0x10
18 | 17: MSP: 0x11
19 | 18: PSP: 0x12
20 | 19: RAZ: 0x13
21 | 20: CFBP: 0x14
22 | 21: APSR: 0x15
23 | 22: EPSR: 0x16
24 | 23: IPSR: 0x17
25 | 24: PRIMASK: 0x18
26 | 25: BASEPRI: 0x19
27 | 26: FAULTMASK: 0x1a
28 | 27: CONTROL: 0x1b
29 | 28: BASEPRI_MAX: 0x1c
30 | 29: IAPSR: 0x1d
31 | 30: EAPSR: 0x1e
32 | 31: IEPSR: 0x1f
33 |
--------------------------------------------------------------------------------
/STM32F103/USER/JLinkSettings.ini:
--------------------------------------------------------------------------------
1 | [BREAKPOINTS]
2 | ShowInfoWin = 1
3 | EnableFlashBP = 2
4 | BPDuringExecution = 0
5 | [CFI]
6 | CFISize = 0x00
7 | CFIAddr = 0x00
8 | [CPU]
9 | OverrideMemMap = 0
10 | AllowSimulation = 1
11 | ScriptFile=""
12 | [FLASH]
13 | MinNumBytesFlashDL = 0
14 | SkipProgOnCRCMatch = 1
15 | VerifyDownload = 1
16 | AllowCaching = 1
17 | EnableFlashDL = 2
18 | Override = 0
19 | Device="UNSPECIFIED"
20 | [GENERAL]
21 | WorkRAMSize = 0x00
22 | WorkRAMAddr = 0x00
23 | [SWO]
24 | SWOLogFile=""
25 | [MEM]
26 | RdOverrideOrMask = 0x00
27 | RdOverrideAndMask = 0xFFFFFFFF
28 | RdOverrideAddr = 0xFFFFFFFF
29 | WrOverrideOrMask = 0x00
30 | WrOverrideAndMask = 0xFFFFFFFF
31 | WrOverrideAddr = 0xFFFFFFFF
32 |
--------------------------------------------------------------------------------
/STM32F103/USER/main.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/USER/main.c
--------------------------------------------------------------------------------
/STM32F103/USER/stm32f10x_it.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file GPIO/IOToggle/stm32f10x_it.c
4 | * @author MCD Application Team
5 | * @version V3.5.0
6 | * @date 08-April-2011
7 | * @brief Main Interrupt Service Routines.
8 | * This file provides template for all exceptions handler and peripherals
9 | * interrupt service routine.
10 | ******************************************************************************
11 | * @attention
12 | *
13 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
14 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
15 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
16 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
17 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
18 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
19 | *
20 | * © COPYRIGHT 2011 STMicroelectronics
21 | ******************************************************************************
22 | */
23 |
24 | /* Includes ------------------------------------------------------------------*/
25 | #include "stm32f10x_it.h"
26 |
27 |
28 |
29 | void NMI_Handler(void)
30 | {
31 | }
32 |
33 | void HardFault_Handler(void)
34 | {
35 | /* Go to infinite loop when Hard Fault exception occurs */
36 | while (1)
37 | {
38 | }
39 | }
40 |
41 | void MemManage_Handler(void)
42 | {
43 | /* Go to infinite loop when Memory Manage exception occurs */
44 | while (1)
45 | {
46 | }
47 | }
48 |
49 |
50 | void BusFault_Handler(void)
51 | {
52 | /* Go to infinite loop when Bus Fault exception occurs */
53 | while (1)
54 | {
55 | }
56 | }
57 |
58 | void UsageFault_Handler(void)
59 | {
60 | /* Go to infinite loop when Usage Fault exception occurs */
61 | while (1)
62 | {
63 | }
64 | }
65 |
66 | void SVC_Handler(void)
67 | {
68 | }
69 |
70 | void DebugMon_Handler(void)
71 | {
72 | }
73 |
74 | void PendSV_Handler(void)
75 | {
76 | }
77 |
78 | void SysTick_Handler(void)
79 | {
80 | }
81 |
82 | /******************************************************************************/
83 | /* STM32F10x Peripherals Interrupt Handlers */
84 | /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
85 | /* available peripheral interrupt handler's name please refer to the startup */
86 | /* file (startup_stm32f10x_xx.s). */
87 | /******************************************************************************/
88 |
--------------------------------------------------------------------------------
/STM32F103/USER/stm32f10x_it.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file GPIO/IOToggle/stm32f10x_it.h
4 | * @author MCD Application Team
5 | * @version V3.5.0
6 | * @date 08-April-2011
7 | * @brief This file contains the headers of the interrupt handlers.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
17 | *
18 | * © COPYRIGHT 2011 STMicroelectronics
19 | ******************************************************************************
20 | */
21 |
22 | /* Define to prevent recursive inclusion -------------------------------------*/
23 | #ifndef __STM32F10x_IT_H
24 | #define __STM32F10x_IT_H
25 |
26 | /* Includes ------------------------------------------------------------------*/
27 | #include "stm32f10x.h"
28 |
29 | /* Exported types ------------------------------------------------------------*/
30 | /* Exported constants --------------------------------------------------------*/
31 | /* Exported macro ------------------------------------------------------------*/
32 | /* Exported functions ------------------------------------------------------- */
33 |
34 | void NMI_Handler(void);
35 | void HardFault_Handler(void);
36 | void MemManage_Handler(void);
37 | void BusFault_Handler(void);
38 | void UsageFault_Handler(void);
39 | void SVC_Handler(void);
40 | void DebugMon_Handler(void);
41 | void PendSV_Handler(void);
42 | void SysTick_Handler(void);
43 |
44 | #endif /* __STM32F10x_IT_H */
45 |
46 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
47 |
--------------------------------------------------------------------------------
/STM32F103/USER/system_stm32f10x.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file system_stm32f10x.h
4 | * @author MCD Application Team
5 | * @version V3.5.0
6 | * @date 11-March-2011
7 | * @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Header File.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
17 | *
18 | * © COPYRIGHT 2011 STMicroelectronics
19 | ******************************************************************************
20 | */
21 |
22 | /** @addtogroup CMSIS
23 | * @{
24 | */
25 |
26 | /** @addtogroup stm32f10x_system
27 | * @{
28 | */
29 |
30 | /**
31 | * @brief Define to prevent recursive inclusion
32 | */
33 | #ifndef __SYSTEM_STM32F10X_H
34 | #define __SYSTEM_STM32F10X_H
35 |
36 | #ifdef __cplusplus
37 | extern "C" {
38 | #endif
39 |
40 | /** @addtogroup STM32F10x_System_Includes
41 | * @{
42 | */
43 |
44 | /**
45 | * @}
46 | */
47 |
48 |
49 | /** @addtogroup STM32F10x_System_Exported_types
50 | * @{
51 | */
52 |
53 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
54 |
55 | /**
56 | * @}
57 | */
58 |
59 | /** @addtogroup STM32F10x_System_Exported_Constants
60 | * @{
61 | */
62 |
63 | /**
64 | * @}
65 | */
66 |
67 | /** @addtogroup STM32F10x_System_Exported_Macros
68 | * @{
69 | */
70 |
71 | /**
72 | * @}
73 | */
74 |
75 | /** @addtogroup STM32F10x_System_Exported_Functions
76 | * @{
77 | */
78 |
79 | extern void SystemInit(void);
80 | extern void SystemCoreClockUpdate(void);
81 | /**
82 | * @}
83 | */
84 |
85 | #ifdef __cplusplus
86 | }
87 | #endif
88 |
89 | #endif /*__SYSTEM_STM32F10X_H */
90 |
91 | /**
92 | * @}
93 | */
94 |
95 | /**
96 | * @}
97 | */
98 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
99 |
--------------------------------------------------------------------------------
/STM32F103/USER/var_space.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/USER/var_space.c
--------------------------------------------------------------------------------
/STM32F103/USER/var_space.h:
--------------------------------------------------------------------------------
1 | #ifndef __VAR_SPACE_H
2 | #define __VAR_SPACE_H
3 | #include "sys.h"
4 |
5 | uint8_t getDataLen(void);
6 | uint8_t getDacLen(void);
7 |
8 | void setSendState(uint8_t state);
9 | uint8_t getSendState(void);
10 |
11 | void setTxData(uint8_t data, uint8_t n);
12 | uint8_t getTxData(uint8_t n);
13 |
14 | void setTIM2Period(double capcnt);
15 | uint16_t getTIM2Period(void);
16 |
17 | void setTIM3Period(uint32_t capcnt);
18 | uint16_t getTIM3Period(void);
19 |
20 | void addTIM2Counter(void);
21 | uint16_t getTIM3Counter(void);
22 | void clearTIM2Counter(void);
23 | void setTIM2Frequency(uint16_t sumcnt);
24 | uint16_t getTIM2Frequency(void);
25 |
26 | void addTIM3Counter(void);
27 | uint16_t getTIM3Counter(void);
28 | void clearTIM3Counter(void);
29 | void setTIM3Frequency(uint16_t sumcnt);
30 | uint16_t getTIM3Frequency(void);
31 |
32 | #endif
33 |
--------------------------------------------------------------------------------
/STM32F103/keilkilll.bat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/keilkilll.bat
--------------------------------------------------------------------------------
/STM32F103/readme.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/STM32F103/readme.txt
--------------------------------------------------------------------------------
/UI_0620/.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/.zip
--------------------------------------------------------------------------------
/UI_0620/UI_65:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/UI_65
--------------------------------------------------------------------------------
/UI_0620/UI_65.pro:
--------------------------------------------------------------------------------
1 | ######################################################################
2 | # Automatically generated by qmake (2.01a) Sat Jun 6 13:19:46 2015
3 | ######################################################################
4 |
5 | TEMPLATE = app
6 | TARGET =
7 | DEPENDPATH += .
8 | INCLUDEPATH += .
9 |
10 | # Input
11 | HEADERS += configpage.h \
12 | datastack.h \
13 | datestpage.h \
14 | drawpage.h \
15 | homepage.h \
16 | keyboard.h \
17 | keybutton.h \
18 | mainwindow.h \
19 | mybutton.h \
20 | mycheckbox.h \
21 | mycombobox.h \
22 | mylineedit.h \
23 | myspinbox.h \
24 | mywatch.h \
25 | outputconfig.h \
26 | page_1.h \
27 | pdfheaderedit.h \
28 | picture.h \
29 | receiver_thread.h \
30 | serialport.h \
31 | uartthread.h \
32 | ui_helppage.h
33 | FORMS += configpage.ui \
34 | datestpage.ui \
35 | homepage.ui \
36 | keyboard.ui \
37 | mainwindow.ui \
38 | outputconfig.ui \
39 | page_1.ui \
40 | pdfheaderedit.ui \
41 | picture.ui
42 | SOURCES += configpage.cpp \
43 | datastack.cpp \
44 | datestpage.cpp \
45 | drawpage.cpp \
46 | homepage.cpp \
47 | keyboard.cpp \
48 | keybutton.cpp \
49 | main.cpp \
50 | mainwindow.cpp \
51 | mybutton.cpp \
52 | mycheckbox.cpp \
53 | mycombobox.cpp \
54 | mylineedit.cpp \
55 | myspinbox.cpp \
56 | mywatch.cpp \
57 | outputconfig.cpp \
58 | page_1.cpp \
59 | pdfheaderedit.cpp \
60 | picture.cpp \
61 | receiver_thread.cpp \
62 | serialport.cpp \
63 | uartthread.cpp
64 | RESOURCES += rcf.qrc
65 |
--------------------------------------------------------------------------------
/UI_0620/configpage.h:
--------------------------------------------------------------------------------
1 | #ifndef CONFIGPAGE_H
2 | #define CONFIGPAGE_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include "page_1.h"
12 |
13 | extern QStackedWidget *stack;
14 | namespace Ui {
15 | class ConfigPage;
16 | }
17 |
18 | class ConfigPage : public QWidget
19 | {
20 | Q_OBJECT
21 |
22 | public:
23 | explicit ConfigPage(QWidget *parent = 0);
24 | ~ConfigPage();
25 | Ui::ConfigPage *ui;
26 | Page_1 *p1;
27 | signals:
28 | void configureChanged(double torsion_max,double duration);
29 | public slots:
30 | void on_cancelButton_clicked();
31 | void on_okButton_clicked();
32 | void torsion2zero();
33 | private slots:
34 | void resizeEvent(QResizeEvent *);
35 |
36 |
37 | private:
38 | int x_init;
39 |
40 | protected:
41 | void mousePressEvent(QMouseEvent *event);
42 | void mouseReleaseEvent(QMouseEvent *event);
43 | };
44 |
45 | #endif // CONFIGPAGE_H
46 |
--------------------------------------------------------------------------------
/UI_0620/configpage.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/configpage.o
--------------------------------------------------------------------------------
/UI_0620/configuration.txt:
--------------------------------------------------------------------------------
1 | 0.5#60#0#0.005#
--------------------------------------------------------------------------------
/UI_0620/datastack.cpp:
--------------------------------------------------------------------------------
1 | #include "datastack.h"
2 |
3 | DataStack::DataStack()
4 | {
5 | }
6 |
--------------------------------------------------------------------------------
/UI_0620/datastack.h:
--------------------------------------------------------------------------------
1 | #ifndef DATASTACK_H
2 | #define DATASTACK_H
3 | #include
4 | #include
5 | #include
6 | typedef struct{
7 | double torsion_value;
8 | double torsion_max;
9 | double speed_value;
10 | double speed_max;
11 | double power_value;
12 | QDateTime time;
13 | }ItemType;
14 | class DataStack
15 | {
16 | public:
17 | DataStack();
18 | QStack stack;
19 | public slots:
20 | };
21 |
22 | #endif // DATASTACK_H
23 |
--------------------------------------------------------------------------------
/UI_0620/datastack.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/datastack.o
--------------------------------------------------------------------------------
/UI_0620/datestpage.h:
--------------------------------------------------------------------------------
1 | #ifndef DATESTPAGE_H
2 | #define DATESTPAGE_H
3 |
4 | #include
5 | #include "outputconfig.h"
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include "serialport.h"
11 | #include "page_1.h"
12 | #define PERIOD 1
13 | extern QStackedWidget *stack;
14 | namespace Ui {
15 | class DATestPage;
16 | }
17 |
18 | class DATestPage : public QWidget
19 | {
20 | Q_OBJECT
21 |
22 | public:
23 | explicit DATestPage(QWidget *parent = 0);
24 | ~DATestPage();
25 | QTimer *timer;
26 | int da_index;
27 | int msgq_id;
28 | int maxindex;
29 | int count;
30 | QList index_list;
31 | QList test_torsionlist;
32 | QList test_speedlist;
33 | SerialPort *port;
34 | private slots:
35 | void on_pushButton_clicked();
36 | void sendmsg();
37 | void paintEvent(QPaintEvent *);
38 | void resizeEvent(QResizeEvent *);
39 | void on_exportCharButton_clicked();
40 | char back_translate(unsigned char uc)
41 | {
42 | char c;
43 | if(uc>=0 && uc<=9)
44 | uc+=48;
45 | else if(uc>=10 && uc<=15)
46 | uc+=55;
47 | c=static_cast(uc);
48 | return c;
49 | }
50 |
51 | public slots:
52 | void appendData(double arg1,double arg2);
53 | private:
54 | Ui::DATestPage *ui;
55 | int x_init;
56 |
57 | protected:
58 | void mousePressEvent(QMouseEvent *event);
59 | void mouseReleaseEvent(QMouseEvent *event);
60 | };
61 |
62 | #endif // DATESTPAGE_H
63 |
--------------------------------------------------------------------------------
/UI_0620/datestpage.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/datestpage.o
--------------------------------------------------------------------------------
/UI_0620/datestpage.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | DATestPage
4 |
5 |
6 |
7 | 0
8 | 0
9 | 800
10 | 450
11 |
12 |
13 |
14 | Form
15 |
16 |
17 |
18 |
19 | 230
20 | 350
21 | 161
22 | 51
23 |
24 |
25 |
26 | Qt::TabFocus
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | 320
36 | 400
37 | 161
38 | 41
39 |
40 |
41 |
42 |
43 | 20
44 |
45 |
46 |
47 |
48 |
49 |
50 | Qt::AlignCenter
51 |
52 |
53 |
54 |
55 |
56 | 410
57 | 350
58 | 161
59 | 51
60 |
61 |
62 |
63 | Qt::TabFocus
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 | myButton
73 | QPushButton
74 |
75 |
76 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/UI_0620/drawpage.h:
--------------------------------------------------------------------------------
1 | #ifndef DRAWPAGE_H
2 | #define DRAWPAGE_H
3 |
4 | #include
5 | #include "picture.h"
6 | #include
7 | #include "mycombobox.h"
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include "datastack.h"
13 | #include "pdfheaderedit.h"
14 | #define KEY 1234
15 | extern DataStack datastack;
16 | typedef struct {
17 | long type;
18 | unsigned char datagram[8];
19 | }msg_buff;
20 | namespace Ui {
21 | class DrawPage;
22 | }
23 |
24 | class DrawPage : public QWidget
25 | {
26 | Q_OBJECT
27 |
28 | public:
29 | explicit DrawPage(QWidget *parent = 0);
30 | myComboBox * switchButton;
31 | Picture *speedpage,*Nmpage,*Kwpage;
32 | myButton *startButton;
33 | QTimer *timer;
34 | typedef enum {STARTED,STOPPED}Status;
35 | Status status;
36 | pdfHeaderEdit *pdf;
37 |
38 | private:
39 |
40 | public slots:
41 | void changPage(int arg);
42 | void getYmax(QList list);
43 |
44 | private slots:
45 | void resizeEvent(QResizeEvent *);
46 | void collectData();
47 | };
48 |
49 | #endif // DRAWPAGE_H
50 |
--------------------------------------------------------------------------------
/UI_0620/drawpage.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/drawpage.o
--------------------------------------------------------------------------------
/UI_0620/homepage.cpp:
--------------------------------------------------------------------------------
1 | #include "homepage.h"
2 | #include "ui_homepage.h"
3 |
4 | homePage::homePage(QWidget *parent) :
5 | QWidget(parent),
6 | ui(new Ui::homePage)
7 | {
8 | ui->setupUi(this);
9 | }
10 |
11 | homePage::~homePage()
12 | {
13 | delete ui;
14 | }
15 |
--------------------------------------------------------------------------------
/UI_0620/homepage.h:
--------------------------------------------------------------------------------
1 | #ifndef HOMEPAGE_H
2 | #define HOMEPAGE_H
3 |
4 | #include
5 |
6 | namespace Ui {
7 | class homePage;
8 | }
9 |
10 | class homePage : public QWidget
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | explicit homePage(QWidget *parent = 0);
16 | ~homePage();
17 |
18 | private:
19 | Ui::homePage *ui;
20 | };
21 |
22 | #endif // HOMEPAGE_H
23 |
--------------------------------------------------------------------------------
/UI_0620/homepage.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/homepage.o
--------------------------------------------------------------------------------
/UI_0620/homepage.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | homePage
4 |
5 |
6 |
7 | 0
8 | 0
9 | 800
10 | 450
11 |
12 |
13 |
14 | Form
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/UI_0620/keyboard.h:
--------------------------------------------------------------------------------
1 | #ifndef KEYBOARD_H
2 | #define KEYBOARD_H
3 |
4 | #include
5 | #include
6 |
7 |
8 | namespace Ui {
9 | class keyBoard;
10 | }
11 |
12 | class keyBoard : public QWidget
13 | {
14 | Q_OBJECT
15 |
16 | public:
17 | explicit keyBoard(QWidget *parent = 0);
18 | ~keyBoard();
19 | QWidget *inputWidget;
20 | bool islocked;
21 | public slots:
22 | void gainFocus();
23 |
24 | private slots:
25 | void on_lock_clicked();
26 |
27 | void resizeEvent(QResizeEvent *);
28 |
29 |
30 | private:
31 | Ui::keyBoard *ui;
32 | };
33 |
34 | #endif // KEYBOARD_H
35 |
--------------------------------------------------------------------------------
/UI_0620/keyboard.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/keyboard.o
--------------------------------------------------------------------------------
/UI_0620/keybutton.cpp:
--------------------------------------------------------------------------------
1 | #include "keybutton.h"
2 |
3 | keyButton::keyButton(QWidget *parent) :
4 | myButton(parent)
5 | {
6 | flag=0;
7 | board=(keyBoard*)this->parentWidget();
8 | QFont font(QString::fromUtf8("\u5B8B\u4F53"),width()/5);
9 | setFont(font);
10 | }
11 |
12 | void keyButton::resizeEvent(QResizeEvent *)
13 | {
14 | QFont font(QString::fromUtf8("\u5B8B\u4F53"),width()/5);
15 | setFont(font);
16 | setText(text());
17 | }
18 |
--------------------------------------------------------------------------------
/UI_0620/keybutton.h:
--------------------------------------------------------------------------------
1 | #ifndef KEYBUTTON_H
2 | #define KEYBUTTON_H
3 |
4 | #include "mybutton.h"
5 | #include
6 | #include
7 | #include "keybutton.h"
8 | #include "keyboard.h"
9 | #include "mylineedit.h"
10 |
11 | class keyButton : public myButton
12 | {
13 | Q_OBJECT
14 | public:
15 | explicit keyButton(QWidget *parent = 0);
16 | struct {
17 | myButton *upButton;
18 | myButton *downButton;
19 | myButton *leftButton;
20 | myButton *rightButton;
21 | }neighbor;
22 | myButton *nextButton;
23 | int flag;//0 输入键 1 功能键
24 | keyBoard *board;
25 | myLineEdit *edit;
26 |
27 | signals:
28 |
29 | public slots:
30 | void resizeEvent(QResizeEvent *);
31 | void keyPressEvent(QKeyEvent *k){
32 | switch (k->key()) {
33 | case Qt::Key_8:
34 | //if(neighbor.upButton!=0)
35 | nextButton=neighbor.upButton;
36 | if(nextButton!=0)
37 | nextButton->setFocus();
38 | break;
39 | case Qt::Key_2:
40 | nextButton=neighbor.downButton;
41 | if(nextButton!=0)
42 | nextButton->setFocus();
43 | break;
44 | case Qt::Key_4:
45 | nextButton=neighbor.leftButton;
46 | if(nextButton!=0)
47 | nextButton->setFocus();
48 | break;
49 | case Qt::Key_6:
50 | nextButton=neighbor.rightButton;
51 | if(nextButton!=0)
52 | nextButton->setFocus();
53 | break;
54 | case Qt::Key_Enter:
55 | if(flag==0)
56 | {
57 | char letter;
58 | letter=this->text().at(0).toAscii();
59 | if(!board->islocked && letter>=65 && letter<=90)
60 | letter=letter+32;
61 | edit=(myLineEdit*)board->inputWidget;
62 | edit->setText(edit->text()+letter);
63 | }
64 | else if(flag==1)
65 | {
66 | if(text()=="back")
67 | {
68 | edit=(myLineEdit*)board->inputWidget;
69 | edit->setText(edit->text().remove(edit->text().length()-1,1));
70 | }
71 | else
72 | click();
73 | }
74 | break;
75 | case Qt::Key_0:
76 | board->hide();
77 | break;
78 | }
79 | }
80 |
81 | };
82 |
83 | #endif // KEYBUTTON_H
84 |
--------------------------------------------------------------------------------
/UI_0620/keybutton.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/keybutton.o
--------------------------------------------------------------------------------
/UI_0620/logo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/logo.jpg
--------------------------------------------------------------------------------
/UI_0620/main.cpp:
--------------------------------------------------------------------------------
1 | #include "mainwindow.h"
2 | #include
3 | #include "keyboard.h"
4 | #include "receiver_thread.h"
5 | #include "uartthread.h"
6 | bool COLLECT_FLAG;
7 | unsigned char uart_torsion[2];
8 | unsigned char uart_speed[2];
9 | bool change_flag;
10 | UartThread *uart_ptr;
11 | int main(int argc, char *argv[])
12 | {
13 | QApplication a(argc, argv);
14 | //a.setOverrideCursor(Qt::BlankCursor);
15 | change_flag=false;
16 | MainWindow w;
17 | QFont font;
18 | font.setFamily("wenquanyi");
19 | a.setFont(font);
20 | w.show();
21 | // w.setWindowState(Qt::WindowFullScreen);
22 | UartThread ut;
23 | uart_ptr=&ut;
24 | ut.start();
25 | COLLECT_FLAG=false;
26 | receiver_thread *t=new receiver_thread;
27 | QObject::connect(t,SIGNAL(newDataReceived(double,double)),&w,SLOT(getData(double,double)));
28 | t->start();
29 | return a.exec();
30 | }
31 |
--------------------------------------------------------------------------------
/UI_0620/main.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/main.o
--------------------------------------------------------------------------------
/UI_0620/mainwindow.h:
--------------------------------------------------------------------------------
1 | #ifndef MAINWINDOW_H
2 | #define MAINWINDOW_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include "mybutton.h"
8 | #include
9 | #include
10 | #include "page_1.h"
11 | #include "configpage.h"
12 | #include "pdfheaderedit.h"
13 | #include "drawpage.h"
14 | #include
15 | #include
16 | #include "homepage.h"
17 | #include
18 | #include "keyboard.h"
19 | #include "mylineedit.h"
20 | #include "datastack.h"
21 | #include "outputconfig.h"
22 | #include "datestpage.h"
23 | namespace Ui {
24 | class MainWindow;
25 | }
26 |
27 | class MainWindow : public QMainWindow
28 | {
29 | Q_OBJECT
30 |
31 | signals:
32 | public:
33 | explicit MainWindow(QWidget *parent = 0);
34 | ~MainWindow();
35 | myButton *sysconfigbutton,*sysstatusbutton,*drawbutton,*pdfeditbutton,*outputbutton,*da_testbutton;
36 | // helpButton *helpbutton;
37 | QStackedWidget *widgets;
38 | QLabel *label2;
39 | Page_1 *page1;
40 | ConfigPage *configpage;
41 | DrawPage *drawpage;
42 | pdfHeaderEdit *pdfPage;
43 | QWidget * topWidget;
44 | QLabel *helpLabel,*timeLabel;
45 | // helpPage *helppage;
46 | homePage *home;
47 | QTimer *timer;
48 | keyBoard *keyboard;
49 | OutPutConfig *outputpage;
50 | DATestPage *da_testpage;
51 | public slots:
52 | void resizeEvent(QResizeEvent *);
53 |
54 | void drawButton_clicked();
55 |
56 | void statusButton_clicked();
57 |
58 | void configButton_clicked();
59 |
60 | void pdfEditButton_clicked();
61 |
62 | void showDAtestPage();
63 |
64 | void saveWorkerNum(QString arg1);
65 |
66 | void showHelp();
67 |
68 | void closeEvent(QCloseEvent *){
69 | qApp->exit();
70 | }
71 | void getData(double torsion,double speed);
72 |
73 | void changeLabel(int index);
74 |
75 | void updateTime();
76 |
77 | void showOutPutPage();
78 |
79 | private:
80 | Ui::MainWindow *ui;
81 | QLabel *label;
82 | };
83 |
84 | #endif // MAINWINDOW_H
85 |
--------------------------------------------------------------------------------
/UI_0620/mainwindow.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/mainwindow.o
--------------------------------------------------------------------------------
/UI_0620/mainwindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | MainWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 800
10 | 450
11 |
12 |
13 |
14 |
15 |
16 |
17 | background-color: rgb(255, 255, 255);
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/UI_0620/moc_configpage.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/moc_configpage.o
--------------------------------------------------------------------------------
/UI_0620/moc_datestpage.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/moc_datestpage.o
--------------------------------------------------------------------------------
/UI_0620/moc_drawpage.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/moc_drawpage.o
--------------------------------------------------------------------------------
/UI_0620/moc_homepage.cpp:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | ** Meta object code from reading C++ file 'homepage.h'
3 | **
4 | ** Created: Fri May 29 02:52:00 2015
5 | ** by: The Qt Meta Object Compiler version 63 (Qt 4.8.2)
6 | **
7 | ** WARNING! All changes made in this file will be lost!
8 | *****************************************************************************/
9 |
10 | #include "homepage.h"
11 | #if !defined(Q_MOC_OUTPUT_REVISION)
12 | #error "The header file 'homepage.h' doesn't include ."
13 | #elif Q_MOC_OUTPUT_REVISION != 63
14 | #error "This file was generated using the moc from 4.8.2. It"
15 | #error "cannot be used with the include files from this version of Qt."
16 | #error "(The moc has changed too much.)"
17 | #endif
18 |
19 | QT_BEGIN_MOC_NAMESPACE
20 | static const uint qt_meta_data_homePage[] = {
21 |
22 | // content:
23 | 6, // revision
24 | 0, // classname
25 | 0, 0, // classinfo
26 | 0, 0, // methods
27 | 0, 0, // properties
28 | 0, 0, // enums/sets
29 | 0, 0, // constructors
30 | 0, // flags
31 | 0, // signalCount
32 |
33 | 0 // eod
34 | };
35 |
36 | static const char qt_meta_stringdata_homePage[] = {
37 | "homePage\0"
38 | };
39 |
40 | void homePage::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
41 | {
42 | Q_UNUSED(_o);
43 | Q_UNUSED(_id);
44 | Q_UNUSED(_c);
45 | Q_UNUSED(_a);
46 | }
47 |
48 | const QMetaObjectExtraData homePage::staticMetaObjectExtraData = {
49 | 0, qt_static_metacall
50 | };
51 |
52 | const QMetaObject homePage::staticMetaObject = {
53 | { &QWidget::staticMetaObject, qt_meta_stringdata_homePage,
54 | qt_meta_data_homePage, &staticMetaObjectExtraData }
55 | };
56 |
57 | #ifdef Q_NO_DATA_RELOCATION
58 | const QMetaObject &homePage::getStaticMetaObject() { return staticMetaObject; }
59 | #endif //Q_NO_DATA_RELOCATION
60 |
61 | const QMetaObject *homePage::metaObject() const
62 | {
63 | return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
64 | }
65 |
66 | void *homePage::qt_metacast(const char *_clname)
67 | {
68 | if (!_clname) return 0;
69 | if (!strcmp(_clname, qt_meta_stringdata_homePage))
70 | return static_cast(const_cast< homePage*>(this));
71 | return QWidget::qt_metacast(_clname);
72 | }
73 |
74 | int homePage::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
75 | {
76 | _id = QWidget::qt_metacall(_c, _id, _a);
77 | if (_id < 0)
78 | return _id;
79 | return _id;
80 | }
81 | QT_END_MOC_NAMESPACE
82 |
--------------------------------------------------------------------------------
/UI_0620/moc_homepage.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/moc_homepage.o
--------------------------------------------------------------------------------
/UI_0620/moc_keyboard.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/moc_keyboard.o
--------------------------------------------------------------------------------
/UI_0620/moc_keybutton.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/moc_keybutton.o
--------------------------------------------------------------------------------
/UI_0620/moc_mainwindow.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/moc_mainwindow.o
--------------------------------------------------------------------------------
/UI_0620/moc_mybutton.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/moc_mybutton.o
--------------------------------------------------------------------------------
/UI_0620/moc_mycheckbox.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/moc_mycheckbox.o
--------------------------------------------------------------------------------
/UI_0620/moc_mycombobox.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/moc_mycombobox.o
--------------------------------------------------------------------------------
/UI_0620/moc_mylineedit.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/moc_mylineedit.o
--------------------------------------------------------------------------------
/UI_0620/moc_myspinbox.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/moc_myspinbox.o
--------------------------------------------------------------------------------
/UI_0620/moc_mywatch.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/moc_mywatch.o
--------------------------------------------------------------------------------
/UI_0620/moc_outputconfig.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/moc_outputconfig.o
--------------------------------------------------------------------------------
/UI_0620/moc_page_1.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/moc_page_1.o
--------------------------------------------------------------------------------
/UI_0620/moc_pdfheaderedit.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/moc_pdfheaderedit.o
--------------------------------------------------------------------------------
/UI_0620/moc_picture.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/moc_picture.o
--------------------------------------------------------------------------------
/UI_0620/moc_receiver_thread.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/moc_receiver_thread.o
--------------------------------------------------------------------------------
/UI_0620/moc_serialport.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/moc_serialport.o
--------------------------------------------------------------------------------
/UI_0620/moc_uartthread.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/moc_uartthread.o
--------------------------------------------------------------------------------
/UI_0620/mybutton.cpp:
--------------------------------------------------------------------------------
1 | #include "mybutton.h"
2 | #include
3 |
4 | extern QStackedWidget *stack;
5 | myButton::myButton(QWidget *parent) :
6 | QPushButton(parent)
7 | {
8 | QFont font;
9 | font.setFamily("wenquanyi");
10 | font.setPointSize(160);
11 | font.setBold(true);
12 | setFont(font);
13 | setFocusPolicy(Qt::TabFocus);
14 | setStyleSheet("border-style: inset; border-width: 3px;border-radius: 20px;border-color: rgb(46, 130, 255);padding:-99999;background-color:blue;color:black;");
15 | }
16 |
17 | void myButton::keyPressEvent(QKeyEvent *k)
18 | {
19 | if(k->key()==Qt::Key_Enter)
20 | {
21 | this->click();
22 | setStyleSheet("border-style: inset; border-width: 0px;border-radius: 20px;border-color:rgb(255, 20, 110);padding: -99999;background-color:red;color:black;");
23 | }
24 | switch (k->key()) {
25 | case Qt::Key_8:
26 | focusPreviousChild();
27 | break;
28 | case Qt::Key_2:
29 | focusNextChild();
30 | break;
31 | case Qt::Key_7:
32 | stack->setCurrentIndex(0);
33 | break;
34 | case Qt::Key_Minus:
35 | system("sudo halt");
36 | break;
37 | }
38 | }
39 |
40 | void myButton::keyReleaseEvent(QKeyEvent *k)
41 | {
42 | if(k->key()==Qt::Key_Enter)
43 | setStyleSheet("border-style: inset; border-width: 3px;border-radius: 20px;border-color:rgb(255, 20, 110);padding: -99999;background-color:red;color:black;");
44 | }
45 |
46 | void myButton::resizeEvent(QResizeEvent *)
47 | {
48 | QFont font(QString::fromUtf8("\u5B8B\u4F53"),width()/7);
49 | setFont(font);
50 | }
51 |
--------------------------------------------------------------------------------
/UI_0620/mybutton.h:
--------------------------------------------------------------------------------
1 | #ifndef MYBUTTON_H
2 | #define MYBUTTON_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | class myButton : public QPushButton
10 | {
11 | Q_OBJECT
12 | public:
13 | explicit myButton(QWidget *parent = 0);
14 | QString color;
15 |
16 | signals:
17 |
18 | public slots:
19 | void focusInEvent(QFocusEvent *){
20 | setStyleSheet("border-style: inset; border-width: 3px;border-radius: 20px;border-color:rgb(255, 20, 110);padding:-99999;background-color:red;color:black;");
21 | }
22 | void focusOutEvent(QFocusEvent *){
23 | setStyleSheet("border-style: inset; border-width: 3px;border-radius: 20px;border-color:rgb(46, 130, 255);padding:-99999;background-color:blue;color:black;");
24 | }
25 | void keyPressEvent(QKeyEvent *k);
26 | void keyReleaseEvent(QKeyEvent *k);
27 | void resizeEvent(QResizeEvent *);
28 |
29 | };
30 |
31 | #endif // MYBUTTON_H
32 |
--------------------------------------------------------------------------------
/UI_0620/mybutton.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/mybutton.o
--------------------------------------------------------------------------------
/UI_0620/mycheckbox.cpp:
--------------------------------------------------------------------------------
1 | #include "mycheckbox.h"
2 |
3 | myCheckBox::myCheckBox(QWidget *parent) :
4 | QCheckBox(parent)
5 | {
6 | }
7 |
--------------------------------------------------------------------------------
/UI_0620/mycheckbox.h:
--------------------------------------------------------------------------------
1 | #ifndef MYCHECKBOX_H
2 | #define MYCHECKBOX_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include "mybutton.h"
8 | #include
9 |
10 | extern QStackedWidget *stack;
11 | class myCheckBox : public QCheckBox
12 | {
13 | Q_OBJECT
14 | public:
15 | explicit myCheckBox(QWidget *parent = 0);
16 | //1:可取消勾选 0:不可取消
17 | int flag;
18 | signals:
19 |
20 | public slots:
21 | void keyPressEvent(QKeyEvent *k){
22 | if(k->key()==Qt::Key_Enter && !this->isChecked())
23 | this->setChecked(true);
24 | else if(k->key()==Qt::Key_Enter && this->isChecked() && this->flag==1)
25 | this->setChecked(false);
26 | switch (k->key()) {
27 | case Qt::Key_8:
28 | focusPreviousChild();
29 | break;
30 | case Qt::Key_2:
31 | focusNextChild();
32 | break;
33 | case Qt::Key_7:
34 | stack->setCurrentIndex(0);
35 | break;
36 | case Qt::Key_Minus:
37 | system("sudo halt");
38 | break;
39 |
40 | }
41 | }
42 | void focusInEvent(QFocusEvent *){
43 | // if(flag==1)
44 | // setStyleSheet("background-color:red");
45 | // else if(flag==0)
46 | setStyleSheet("background-color:red;");
47 | }
48 | void focusOutEvent(QFocusEvent *){
49 | // if(flag==1)
50 | // setStyleSheet("background-color:rgb(0,170,0)");
51 | // else if(flag==0)
52 | setStyleSheet("background-color:white");
53 | }
54 |
55 | };
56 |
57 | #endif // MYCHECKBOX_H
58 |
--------------------------------------------------------------------------------
/UI_0620/mycheckbox.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/mycheckbox.o
--------------------------------------------------------------------------------
/UI_0620/mycombobox.cpp:
--------------------------------------------------------------------------------
1 | #include "mycombobox.h"
2 |
3 | myComboBox::myComboBox(QWidget *parent) :
4 | QComboBox(parent)
5 | {
6 | setFocusPolicy(Qt::TabFocus);
7 | }
8 |
--------------------------------------------------------------------------------
/UI_0620/mycombobox.h:
--------------------------------------------------------------------------------
1 | #ifndef MYCOMBOBOX_H
2 | #define MYCOMBOBOX_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include "mybutton.h"
8 | #include
9 |
10 | extern QStackedWidget *stack;
11 | class myComboBox : public QComboBox
12 | {
13 | Q_OBJECT
14 | public:
15 | explicit myComboBox(QWidget *parent = 0);
16 |
17 | signals:
18 |
19 | public slots:
20 | void keyPressEvent(QKeyEvent *k)
21 | {
22 | int index=this->currentIndex();
23 | switch (k->key()) {
24 | case Qt::Key_4:
25 | index=index-1>-1?index-1:0;
26 | this->setCurrentIndex(index);
27 | break;
28 | case Qt::Key_6:
29 | index=index+1>this->count()-1?index:index+1;
30 | this->setCurrentIndex(index);
31 | break;
32 | case Qt::Key_8:
33 | focusPreviousChild();
34 | break;
35 | case Qt::Key_2:
36 | focusNextChild();
37 | break;
38 | case Qt::Key_7:
39 | stack->setCurrentIndex(0);
40 | break;
41 | case Qt::Key_Minus:
42 | system("sudo halt");
43 | break;
44 | }
45 | }
46 | void focusInEvent(QFocusEvent *){
47 | setStyleSheet("color:red");
48 | }
49 | void focusOutEvent(QFocusEvent *){
50 | setStyleSheet("color:black");
51 | }
52 | };
53 |
54 | #endif // MYCOMBOBOX_H
55 |
--------------------------------------------------------------------------------
/UI_0620/mycombobox.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/mycombobox.o
--------------------------------------------------------------------------------
/UI_0620/mylineedit.cpp:
--------------------------------------------------------------------------------
1 | #include "mylineedit.h"
2 |
3 | myLineEdit::myLineEdit(QWidget *parent) :
4 | QLineEdit(parent)
5 | {
6 | setFocusPolicy(Qt::TabFocus);
7 | focusMove=true;
8 | }
9 |
--------------------------------------------------------------------------------
/UI_0620/mylineedit.h:
--------------------------------------------------------------------------------
1 | #ifndef MYLINEEDIT_H
2 | #define MYLINEEDIT_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include "mybutton.h"
9 | #include
10 | #include "keyboard.h"
11 |
12 | extern QStackedWidget *stack;
13 | class myLineEdit : public QLineEdit
14 | {
15 | Q_OBJECT
16 | public:
17 | explicit myLineEdit(QWidget *parent = 0);
18 | bool focusMove;
19 | keyBoard *keyboard;
20 | WId wid;
21 | signals:
22 | void enterPushed(QString arg1);
23 |
24 | public slots:
25 | void keyPressEvent(QKeyEvent *k){
26 | switch (k->key()) {
27 | case Qt::Key_Minus:
28 | system("sudo halt");
29 | break;
30 |
31 | case Qt::Key_8:
32 | if(focusMove)
33 | focusPreviousChild();
34 | break;
35 | case Qt::Key_2:
36 | if(focusMove)
37 | focusNextChild();
38 | break;
39 | case Qt::Key_7:
40 | if(focusMove)
41 | stack->setCurrentIndex(0);
42 | break;
43 | case Qt::Key_Enter:
44 | emit enterPushed(text());
45 | break;
46 | case Qt::Key_0:
47 | keyboard=(keyBoard*)QWidget::find(wid);
48 | keyboard->show();
49 | keyboard->inputWidget=this;
50 | keyboard->gainFocus();
51 | break;
52 | }
53 | }
54 | void focusInEvent(QFocusEvent *){
55 | setStyleSheet("background-color:red");
56 | }
57 | void focusOutEvent(QFocusEvent *){
58 | setStyleSheet("background-color:white");
59 | }
60 |
61 | };
62 |
63 | #endif // MYLINEEDIT_H
64 |
--------------------------------------------------------------------------------
/UI_0620/mylineedit.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/mylineedit.o
--------------------------------------------------------------------------------
/UI_0620/myspinbox.cpp:
--------------------------------------------------------------------------------
1 | #include "myspinbox.h"
2 |
3 | mySpinBox::mySpinBox(QWidget *parent) :
4 | QDoubleSpinBox(parent)
5 | {
6 | setFocusPolicy(Qt::TabFocus);
7 | }
8 |
--------------------------------------------------------------------------------
/UI_0620/myspinbox.h:
--------------------------------------------------------------------------------
1 | #ifndef MYSPINBOX_H
2 | #define MYSPINBOX_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include "mybutton.h"
8 | #include
9 |
10 | extern QStackedWidget *stack;
11 | class mySpinBox : public QDoubleSpinBox
12 | {
13 | Q_OBJECT
14 | public:
15 | explicit mySpinBox(QWidget *parent = 0);
16 |
17 | signals:
18 |
19 | public slots:
20 | void keyPressEvent(QKeyEvent *k){
21 | switch (k->key()) {
22 | case Qt::Key_Minus:
23 | system("sudo halt");
24 | break;
25 |
26 | case Qt::Key_8:
27 | focusPreviousChild();
28 | break;
29 | case Qt::Key_2:
30 | focusNextChild();
31 | break;
32 | case Qt::Key_4:
33 | stepUp();
34 | break;
35 | case Qt::Key_6:
36 | stepDown();
37 | break;
38 | case Qt::Key_7:
39 | stack->setCurrentIndex(0);
40 | break;
41 | }
42 | }
43 | void focusInEvent(QFocusEvent *){
44 | setStyleSheet("color:red");
45 | }
46 | void focusOutEvent(QFocusEvent *){
47 | setStyleSheet("color:black");
48 | }
49 |
50 | };
51 |
52 | #endif // MYSPINBOX_H
53 |
--------------------------------------------------------------------------------
/UI_0620/myspinbox.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/myspinbox.o
--------------------------------------------------------------------------------
/UI_0620/mywatch.h:
--------------------------------------------------------------------------------
1 | #ifndef MYWATCH_H
2 | #define MYWATCH_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #define POINTER_STEP 20 //
12 | #define MAX_INCRE_SIZE 10 //
13 | extern double torsion_test_max;
14 | class myWatch;
15 | class myWatch : public QWidget
16 | {
17 | Q_OBJECT
18 | public:
19 | explicit myWatch(QWidget *parent = 0);
20 | qreal max;
21 | QString type;
22 | QString unit;
23 | QLabel *valueLabel;
24 | QTimer *timer;
25 | signals:
26 | void maxChanged(double);
27 | public slots:
28 | void paintEvent(QPaintEvent *);
29 | void paintPointer(QPainter &p);
30 | void resizeEvent(QResizeEvent *);
31 | void setValue(double arg){
32 | if(qAbs(arg)>max && isAutoAdjust())
33 | {
34 | while(qAbs(arg)>max)
35 | max=max*MAX_INCRE_SIZE;
36 | //repaint();
37 | emit maxChanged(max);
38 | }
39 | /*
40 | value_new=arg;
41 | if(value>max)
42 | value=max;//使当前值不超量程
43 | while(value!=value_new && value<=max+POINTER_STEP*max/50)
44 | {
45 | qreal dv=value_new-value;
46 | if(dv>0 && dv>=POINTER_STEP*max/50)
47 | value+=POINTER_STEP*max/50;
48 | else if(dv>0 && dv-POINTER_STEP*max/50)
53 | value+=dv;
54 | repaint();
55 | }
56 | */
57 | value=arg;
58 | //repaint();
59 | }
60 | void displayValue(double vu);
61 | bool isAutoAdjust()
62 | {
63 | return autoadjust;
64 | }
65 | void setAutoAdjust(bool t)
66 | {
67 | autoadjust=t;
68 | }
69 | void setMax(double m)
70 | {
71 | max=m;
72 | }
73 | double Max()
74 | {
75 | return max;
76 | }
77 |
78 | private:
79 | qreal value;
80 | qreal value_new;
81 | bool autoadjust;//
82 | private slots:
83 |
84 |
85 | };
86 |
87 | #endif // MYWATCH_H
88 |
--------------------------------------------------------------------------------
/UI_0620/mywatch.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/mywatch.o
--------------------------------------------------------------------------------
/UI_0620/outputconfig.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "outputconfig.h"
3 | #include "ui_outputconfig.h"
4 | #include
5 | #include
6 | #include "uartthread.h"
7 | extern UartThread *uart_ptr;
8 |
9 | #define COMMENT 0
10 |
11 |
12 | unsigned int ma_t[20]={0xcd,0x19a,0x266,0x333,0x400,0x4cd,0x59a,0x666,0x733,0x800,0x8cd,0x99a,0xa66,0xb33,0xc00,0xccd,0xd9a,0xe66,0xf33,0xfff};
13 | OutPutConfig::OutPutConfig(QWidget *parent) :
14 | QWidget(parent),
15 | ui(new Ui::OutPutConfig)
16 | {
17 | ui->setupUi(this);
18 | setFocusPolicy(Qt::NoFocus);
19 | ui->okbutton->setText(QString::fromUtf8("\u8bbe\u7f6e"));
20 | }
21 |
22 | OutPutConfig::~OutPutConfig()
23 | {
24 | delete ui;
25 | }
26 |
27 | void OutPutConfig::resizeEvent(QResizeEvent *)
28 | {
29 | ui->okbutton->setGeometry(QRect(330*width()/800, 310*height()/450, 151*width()/800, 61*height()/450));
30 | ui->output_1->setGeometry(QRect(110*width()/800, 80*height()/450, 401*width()/800, 71*height()/450));
31 | ui->output_2->setGeometry(QRect(110*width()/800, 180*height()/450, 401*width()/800, 71*height()/450));
32 | ui->label_2->setGeometry(QRect(520*width()/800, 180*height()/450, 181*width()/800, 71*height()/450));
33 | ui->label_1->setGeometry(QRect(520*width()/800, 80*height()/450, 181*width()/800, 71*height()/450));
34 | }
35 |
36 | void OutPutConfig::on_okbutton_clicked()
37 | {
38 | char data[2];
39 | memset(data,0,2);
40 | port=new SerialPort;
41 | if(!port->open("/dev/ttyAMA0",O_RDWR|O_NOCTTY|O_NDELAY))
42 | {
43 | qDebug()<<"open port false when set DAC";
44 | }
45 | port->set_opt('N',115200,8,'N',1);
46 | if(!port->setBlockMode())
47 | {
48 | printf("fcntl failed when set DAC\n");
49 | }
50 | data[0]=ui->output_1->currentIndex();
51 | data[1]=ui->output_2->currentIndex()+0x20;
52 | int n= port->write(&data[0],1);
53 | if(n==1)
54 | printf("%x\n",data[0]);
55 | usleep(100);
56 | n= port->write(&data[1],1);
57 | if(n==1)
58 | printf("%x\n",data[1]);
59 | port->close();
60 | delete port;
61 | }
62 |
63 | void OutPutConfig::mousePressEvent(QMouseEvent *event)
64 | {
65 | if(event->button()==Qt::LeftButton){
66 | x_init = event->x();
67 | }
68 | else if(event->button()==Qt::RightButton){
69 | }
70 | }
71 |
72 | void OutPutConfig::mouseReleaseEvent(QMouseEvent *event)
73 | {
74 | if(event->x() - x_init > 25){
75 | stack->setCurrentIndex(0);
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/UI_0620/outputconfig.h:
--------------------------------------------------------------------------------
1 | #ifndef OUTPUTCONFIG_H
2 | #define OUTPUTCONFIG_H
3 |
4 | #include
5 | #include
6 | #include "serialport.h"
7 | #include "page_1.h"
8 |
9 | namespace Ui {
10 | class OutPutConfig;
11 | }
12 |
13 | class OutPutConfig : public QWidget
14 | {
15 | Q_OBJECT
16 |
17 | public:
18 | explicit OutPutConfig(QWidget *parent = 0);
19 | ~OutPutConfig();
20 | private slots:
21 | void on_okbutton_clicked();
22 | void resizeEvent(QResizeEvent *);
23 | char back_translate(unsigned char uc)
24 | {
25 | char c;
26 | if(uc>=0 && uc<=9)
27 | uc+=48;
28 | else if(uc>=10 && uc<=15)
29 | uc+=55;
30 | c=static_cast(uc);
31 | return c;
32 | }
33 |
34 | private:
35 | Ui::OutPutConfig *ui;
36 | SerialPort *port;
37 | int x_init;
38 |
39 | protected:
40 | void mousePressEvent(QMouseEvent *event);
41 | void mouseReleaseEvent(QMouseEvent *event);
42 | };
43 |
44 | #endif // OUTPUTCONFIG_H
45 |
--------------------------------------------------------------------------------
/UI_0620/outputconfig.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/outputconfig.o
--------------------------------------------------------------------------------
/UI_0620/page_1.h:
--------------------------------------------------------------------------------
1 | #ifndef PAGE_1_H
2 | #define PAGE_1_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include "mywatch.h"
11 | #include "mybutton.h"
12 | #include
13 | #include "datastack.h"
14 | #include
15 | #include "myspinbox.h"
16 | #include
17 |
18 | extern DataStack datastack;
19 | extern QStackedWidget *stack;
20 | namespace Ui {
21 | class Page_1;
22 | }
23 |
24 | class Page_1 : public QWidget
25 | {
26 | Q_OBJECT
27 |
28 | public:
29 | explicit Page_1(QWidget *parent = 0);
30 | ~Page_1();
31 | Ui::Page_1 *ui;
32 | myWatch *speedWatch,*torsionWatch,*powerWatch;
33 | QStackedWidget *parentStack;
34 | QLabel *label;
35 | myButton *setZeroButton;
36 | typedef enum{StartedState,StoppedState}runningState;
37 | runningState state;
38 | int duration;
39 | QTimer *timer;
40 | public slots:
41 | void resizeEvent(QResizeEvent *);
42 | void keyPressEvent(QKeyEvent *k){
43 | switch (k->key()) {
44 | case Qt::Key_7:
45 | stack->setCurrentIndex(0);
46 | break;
47 | case Qt::Key_8:
48 | focusPreviousChild();
49 | break;
50 | case Qt::Key_2:
51 | focusNextChild();
52 | break;
53 | }
54 | }
55 | void setWatchValues(double torsion, double speed);
56 | void paintEvent(QPaintEvent *){
57 | QPainter painter(this);
58 | painter.setBrush(QBrush(Qt::black));
59 | painter.drawRect(0,0,width(),height());
60 | }
61 |
62 | void setTorsionMaxandPeriod(double torsion,double dur);
63 |
64 | void updateMax(double mmm);
65 |
66 | void startButton_clicked();
67 |
68 | void stopButton_clicked();
69 |
70 | void refreshUI();
71 | signals:
72 | void changeTorsion(double torion);
73 | void changeSpeed(double speed);
74 | void changePower(double power);
75 | void getTestData(double torsion,double speed);
76 |
77 | private slots:
78 | void resetAll();
79 |
80 | private:
81 | int x_init;
82 |
83 | protected:
84 | void mousePressEvent(QMouseEvent *event);
85 | void mouseReleaseEvent(QMouseEvent *event);
86 | };
87 |
88 | #endif // PAGE_1_H
89 |
--------------------------------------------------------------------------------
/UI_0620/page_1.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/page_1.o
--------------------------------------------------------------------------------
/UI_0620/page_1.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | Page_1
4 |
5 |
6 |
7 | 0
8 | 0
9 | 800
10 | 450
11 |
12 |
13 |
14 | Qt::TabFocus
15 |
16 |
17 | Form
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | 350
26 | 350
27 | 99
28 | 41
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | 350
39 | 300
40 | 99
41 | 41
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | myButton
52 | QPushButton
53 |
54 |
55 |
56 |
57 | startButton
58 | stopButton
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/UI_0620/pdfheaderedit.h:
--------------------------------------------------------------------------------
1 | #ifndef PDFHEADEREDIT_H
2 | #define PDFHEADEREDIT_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include "datastack.h"
12 | #include "page_1.h"
13 |
14 | namespace Ui {
15 | class pdfHeaderEdit;
16 | }
17 |
18 | class pdfHeaderEdit : public QWidget
19 | {
20 | Q_OBJECT
21 |
22 | public:
23 | explicit pdfHeaderEdit(QWidget *parent = 0);
24 | ~pdfHeaderEdit();
25 | QString employeeNo;
26 | Ui::pdfHeaderEdit *ui;
27 | DataStack data2print;
28 |
29 | public slots:
30 | void on_exportButton_clicked();
31 |
32 | void exportDataChart();
33 |
34 | bool exportDAtestChart(QPixmap p);
35 |
36 | void resizeEvent(QResizeEvent *);
37 |
38 | private:
39 | int x_init;
40 |
41 | protected:
42 | void mousePressEvent(QMouseEvent *event);
43 | void mouseReleaseEvent(QMouseEvent *event);
44 | };
45 |
46 | #endif // PDFHEADEREDIT_H
47 |
--------------------------------------------------------------------------------
/UI_0620/pdfheaderedit.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/pdfheaderedit.o
--------------------------------------------------------------------------------
/UI_0620/picture.h:
--------------------------------------------------------------------------------
1 | #ifndef PICTURE_H
2 | #define PICTURE_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include "page_1.h"
17 | namespace Ui {
18 | class Picture;
19 | }
20 |
21 | class Picture : public QWidget
22 | {
23 | Q_OBJECT
24 |
25 | public:
26 | explicit Picture(QWidget *parent = 0);
27 | ~Picture();
28 | Ui::Picture *ui;
29 | QList values;
30 | qreal yMax;
31 | QLabel *label;
32 | double xunit,yunit;
33 | signals:
34 | public slots:
35 | void paintEvent(QPaintEvent *);
36 |
37 |
38 | private slots:
39 |
40 | void on_xRange_currentIndexChanged(int);
41 |
42 | void on_y1Property_currentIndexChanged(int);
43 |
44 | void keyPressEvent(QKeyEvent *);
45 |
46 | void resizeEvent(QResizeEvent*);
47 |
48 | void drawDataLine(QPainter &p,double dx,double dy);
49 |
50 | private:
51 | int x_init;
52 |
53 | protected:
54 | void mousePressEvent(QMouseEvent *event);
55 | void mouseReleaseEvent(QMouseEvent *event);
56 |
57 | };
58 |
59 | #endif // PICTURE_H
60 |
--------------------------------------------------------------------------------
/UI_0620/picture.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/picture.o
--------------------------------------------------------------------------------
/UI_0620/picture.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | Picture
4 |
5 |
6 |
7 | 0
8 | 0
9 | 720
10 | 450
11 |
12 |
13 |
14 | Form
15 |
16 |
17 | background-color: rgb(255, 255, 255);
18 |
19 |
20 |
21 |
22 | 20
23 | 150
24 | 71
25 | 30
26 |
27 |
28 |
29 | Qt::TabFocus
30 |
31 |
32 |
33 |
34 |
35 | 20
36 | 300
37 | 71
38 | 30
39 |
40 |
41 | -
42 |
43 | 10
44 |
45 |
46 | -
47 |
48 | 20
49 |
50 |
51 | -
52 |
53 | 50
54 |
55 |
56 | -
57 |
58 | 100
59 |
60 |
61 | -
62 |
63 | 200
64 |
65 |
66 | -
67 |
68 | 500
69 |
70 |
71 | -
72 |
73 | 1000
74 |
75 |
76 | -
77 |
78 | 2000
79 |
80 |
81 | -
82 |
83 | 5000
84 |
85 |
86 | -
87 |
88 | 10000
89 |
90 |
91 |
92 |
93 |
94 |
95 | myComboBox
96 | QComboBox
97 |
98 |
99 |
100 |
101 | y1Property
102 | xRange
103 |
104 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/UI_0620/qrc_rcf.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/qrc_rcf.o
--------------------------------------------------------------------------------
/UI_0620/rcf.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | logo.jpg
4 |
5 |
6 |
--------------------------------------------------------------------------------
/UI_0620/receiver_thread.h:
--------------------------------------------------------------------------------
1 | #ifndef RECEIVER_THREAD_H
2 | #define RECEIVER_THREAD_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #define KEY 1234
10 | typedef struct {
11 | long type;
12 | unsigned char datagram[8];
13 | }msg_buf;
14 |
15 | class receiver_thread : public QThread
16 | {
17 | Q_OBJECT
18 | public:
19 | explicit receiver_thread(QObject *parent = 0);
20 | msg_buf * data;
21 | QList torsionlist;
22 | QList speedlist;
23 | QList torsion_ave_list;
24 | QList speed_ave_list;
25 | double torsion_old;
26 | double speed_old;
27 | QFile file,file0;
28 | QTextStream stream,stream0;
29 | int shmid;
30 | unsigned char *shmaddr;
31 |
32 | signals:
33 | void newDataReceived(double torsion,double speed);
34 | public slots:
35 | void run();
36 | int max(QList L) //return the index of the max data of the list
37 | {
38 | if(L.size()==0)
39 | return -1;
40 | int i=0,pos=0;
41 | double m=L.at(0);
42 | for(;i L) //return the index of the min data of the list
52 | {
53 | if(L.size()==0)
54 | return -1;
55 | int i=0,pos=0;
56 | double m=L.at(0);
57 | for(;iL.at(i))
59 | {
60 | m=L.at(i);
61 | pos=i;
62 | }
63 | return pos;
64 | }
65 | double getValue(QList L,double l,double r,double total)
66 | {
67 | double val[L.size()];
68 | double a;
69 | for(int i=0;ival[i+1])
74 | {
75 | a=val[i+1];
76 | val[i+1]=val[i];
77 | val[i]=a;
78 | }
79 | a=0;
80 | for(int i=total*l-1;i
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | class SerialPort : public QObject
13 | {
14 | Q_OBJECT
15 | public:
16 | explicit SerialPort(QObject *parent = 0);
17 |
18 | signals:
19 |
20 | public slots:
21 | int set_opt(char flow_ctrl, int nSpeed, int nBits, char nEvent, int nStop);
22 | bool open(QString _file,int _mode);
23 | void close();
24 | int read(void *_buf, int _size);
25 | int write(void *_buf, int _size);
26 | int Handle();
27 | bool setBlockMode(bool ok=true);
28 | private:
29 | int _fd;
30 | };
31 |
32 | #endif // SERIALPORT_H
33 |
--------------------------------------------------------------------------------
/UI_0620/serialport.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/serialport.o
--------------------------------------------------------------------------------
/UI_0620/uartthread.cpp:
--------------------------------------------------------------------------------
1 | #include "uartthread.h"
2 | #include
3 | #include
4 | #include
5 |
6 | #define COMMENT 0
7 | extern unsigned char uart_torsion[2];
8 | extern unsigned char uart_speed[2];
9 | extern bool change_flag;
10 |
11 | UartThread::UartThread(QObject *parent) :
12 | QThread(parent)
13 | {
14 | setTerminationEnabled(true);
15 | }
16 |
17 | int UartThread::translate(char c)
18 | {
19 | int data;
20 | data=static_cast(c);
21 | if(data>=48 && data <=57)
22 | data-=48;
23 | else if(data>=65 && data<=70)
24 | data-=55;
25 | else
26 | data=-1;
27 | return data;
28 | }
29 |
30 | void UartThread::run()
31 | {
32 | port=new SerialPort;
33 | if(!port->open("/dev/ttyAMA0",O_RDWR|O_NOCTTY|O_NDELAY))
34 | {
35 | qDebug()<<"uart open false when receive data";
36 | qApp->exit();
37 | }
38 | port->set_opt('N',115200,8,'N',1);
39 | if(!port->setBlockMode())
40 | {
41 | printf("fcntl failed when receive data\n");
42 | }
43 | char udata;
44 | char data[4];
45 | int cnt=0;
46 | memset(data,0,4);
47 | while(1)
48 | {
49 | port->read(&udata,1);
50 | if(udata=='Q')
51 | {
52 | // read(fd,data,4);
53 | while(cnt!=4)
54 | {
55 | port->read(&data[cnt],1);
56 | ++cnt;
57 | }
58 | cnt=0;
59 | uart_torsion[0]=translate(data[0])*16+translate(data[1]);
60 | uart_torsion[1]=translate(data[2])*16+translate(data[3]);
61 | }
62 | else if(udata=='P')
63 | {
64 | while(cnt!=4)
65 | {
66 | port->read(&data[cnt],1);
67 | ++cnt;
68 | }
69 | cnt=0;
70 | // read(fd,data,4);
71 | uart_speed[0]=translate(data[0])*16+translate(data[1]);
72 | uart_speed[1]=translate(data[2])*16+translate(data[3]);
73 | }
74 | else
75 | {
76 | printf("get :%c\n",udata);
77 | continue;
78 | }
79 | #if COMMENT
80 | printf("%c\n",udata);
81 | printf("%c\n",data[0]);
82 | printf("%c\n",data[1]);
83 | printf("%c\n",data[2]);
84 | printf("%c\n",data[3]);
85 | #endif
86 | memset(data,0,4);
87 | change_flag=true;
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/UI_0620/uartthread.h:
--------------------------------------------------------------------------------
1 | #ifndef UARTTHREAD_H
2 | #define UARTTHREAD_H
3 |
4 | #include
5 | #include
6 | #include "serialport.h"
7 |
8 | class UartThread : public QThread
9 | {
10 | Q_OBJECT
11 | public:
12 | explicit UartThread(QObject *parent = 0);
13 | SerialPort *port;
14 | signals:
15 | public slots:
16 | void run();
17 | int translate(char c);
18 | };
19 |
20 | #endif // UARTTHREAD_H
21 |
--------------------------------------------------------------------------------
/UI_0620/uartthread.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_0620/uartthread.o
--------------------------------------------------------------------------------
/UI_0620/ui_datestpage.h:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | ** Form generated from reading UI file 'datestpage.ui'
3 | **
4 | ** Created: Fri May 29 02:47:40 2015
5 | ** by: Qt User Interface Compiler version 4.8.2
6 | **
7 | ** WARNING! All changes made in this file will be lost when recompiling UI file!
8 | ********************************************************************************/
9 |
10 | #ifndef UI_DATESTPAGE_H
11 | #define UI_DATESTPAGE_H
12 |
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include "mybutton.h"
21 |
22 | QT_BEGIN_NAMESPACE
23 |
24 | class Ui_DATestPage
25 | {
26 | public:
27 | myButton *pushButton;
28 | QLabel *label;
29 | myButton *exportCharButton;
30 |
31 | void setupUi(QWidget *DATestPage)
32 | {
33 | if (DATestPage->objectName().isEmpty())
34 | DATestPage->setObjectName(QString::fromUtf8("DATestPage"));
35 | DATestPage->resize(800, 450);
36 | pushButton = new myButton(DATestPage);
37 | pushButton->setObjectName(QString::fromUtf8("pushButton"));
38 | pushButton->setGeometry(QRect(230, 350, 161, 51));
39 | pushButton->setFocusPolicy(Qt::TabFocus);
40 | label = new QLabel(DATestPage);
41 | label->setObjectName(QString::fromUtf8("label"));
42 | label->setGeometry(QRect(320, 400, 161, 41));
43 | QFont font;
44 | font.setPointSize(20);
45 | label->setFont(font);
46 | label->setAlignment(Qt::AlignCenter);
47 | exportCharButton = new myButton(DATestPage);
48 | exportCharButton->setObjectName(QString::fromUtf8("exportCharButton"));
49 | exportCharButton->setGeometry(QRect(410, 350, 161, 51));
50 | exportCharButton->setFocusPolicy(Qt::TabFocus);
51 |
52 | retranslateUi(DATestPage);
53 |
54 | QMetaObject::connectSlotsByName(DATestPage);
55 | } // setupUi
56 |
57 | void retranslateUi(QWidget *DATestPage)
58 | {
59 | DATestPage->setWindowTitle(QApplication::translate("DATestPage", "Form", 0, QApplication::UnicodeUTF8));
60 | pushButton->setText(QString());
61 | label->setText(QString());
62 | exportCharButton->setText(QString());
63 | } // retranslateUi
64 |
65 | };
66 |
67 | namespace Ui {
68 | class DATestPage: public Ui_DATestPage {};
69 | } // namespace Ui
70 |
71 | QT_END_NAMESPACE
72 |
73 | #endif // UI_DATESTPAGE_H
74 |
--------------------------------------------------------------------------------
/UI_0620/ui_helppage.h:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | ** Form generated from reading UI file 'helppage.ui'
3 | **
4 | ** Created: Fri May 29 02:47:40 2015
5 | ** by: Qt User Interface Compiler version 4.8.2
6 | **
7 | ** WARNING! All changes made in this file will be lost when recompiling UI file!
8 | ********************************************************************************/
9 |
10 | #ifndef UI_HELPPAGE_H
11 | #define UI_HELPPAGE_H
12 |
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 |
20 | QT_BEGIN_NAMESPACE
21 |
22 | class Ui_helpPage
23 | {
24 | public:
25 |
26 | void setupUi(QWidget *helpPage)
27 | {
28 | if (helpPage->objectName().isEmpty())
29 | helpPage->setObjectName(QString::fromUtf8("helpPage"));
30 | helpPage->resize(400, 300);
31 | helpPage->setFocusPolicy(Qt::TabFocus);
32 | helpPage->setStyleSheet(QString::fromUtf8("background-color: rgb(112, 198, 255);"));
33 |
34 | retranslateUi(helpPage);
35 |
36 | QMetaObject::connectSlotsByName(helpPage);
37 | } // setupUi
38 |
39 | void retranslateUi(QWidget *helpPage)
40 | {
41 | helpPage->setWindowTitle(QApplication::translate("helpPage", "Form", 0, QApplication::UnicodeUTF8));
42 | } // retranslateUi
43 |
44 | };
45 |
46 | namespace Ui {
47 | class helpPage: public Ui_helpPage {};
48 | } // namespace Ui
49 |
50 | QT_END_NAMESPACE
51 |
52 | #endif // UI_HELPPAGE_H
53 |
--------------------------------------------------------------------------------
/UI_0620/ui_homepage.h:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | ** Form generated from reading UI file 'homepage.ui'
3 | **
4 | ** Created: Fri May 29 02:47:40 2015
5 | ** by: Qt User Interface Compiler version 4.8.2
6 | **
7 | ** WARNING! All changes made in this file will be lost when recompiling UI file!
8 | ********************************************************************************/
9 |
10 | #ifndef UI_HOMEPAGE_H
11 | #define UI_HOMEPAGE_H
12 |
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 |
20 | QT_BEGIN_NAMESPACE
21 |
22 | class Ui_homePage
23 | {
24 | public:
25 |
26 | void setupUi(QWidget *homePage)
27 | {
28 | if (homePage->objectName().isEmpty())
29 | homePage->setObjectName(QString::fromUtf8("homePage"));
30 | homePage->resize(800, 450);
31 |
32 | retranslateUi(homePage);
33 |
34 | QMetaObject::connectSlotsByName(homePage);
35 | } // setupUi
36 |
37 | void retranslateUi(QWidget *homePage)
38 | {
39 | homePage->setWindowTitle(QApplication::translate("homePage", "Form", 0, QApplication::UnicodeUTF8));
40 | } // retranslateUi
41 |
42 | };
43 |
44 | namespace Ui {
45 | class homePage: public Ui_homePage {};
46 | } // namespace Ui
47 |
48 | QT_END_NAMESPACE
49 |
50 | #endif // UI_HOMEPAGE_H
51 |
--------------------------------------------------------------------------------
/UI_0620/ui_mainwindow.h:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | ** Form generated from reading UI file 'mainwindow.ui'
3 | **
4 | ** Created: Fri May 29 02:47:40 2015
5 | ** by: Qt User Interface Compiler version 4.8.2
6 | **
7 | ** WARNING! All changes made in this file will be lost when recompiling UI file!
8 | ********************************************************************************/
9 |
10 | #ifndef UI_MAINWINDOW_H
11 | #define UI_MAINWINDOW_H
12 |
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 |
21 | QT_BEGIN_NAMESPACE
22 |
23 | class Ui_MainWindow
24 | {
25 | public:
26 | QWidget *centralwidget;
27 |
28 | void setupUi(QMainWindow *MainWindow)
29 | {
30 | if (MainWindow->objectName().isEmpty())
31 | MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
32 | MainWindow->resize(800, 450);
33 | MainWindow->setStyleSheet(QString::fromUtf8("background-color: rgb(255, 255, 255);\n"
34 | ""));
35 | centralwidget = new QWidget(MainWindow);
36 | centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
37 | MainWindow->setCentralWidget(centralwidget);
38 |
39 | retranslateUi(MainWindow);
40 |
41 | QMetaObject::connectSlotsByName(MainWindow);
42 | } // setupUi
43 |
44 | void retranslateUi(QMainWindow *MainWindow)
45 | {
46 | MainWindow->setWindowTitle(QString());
47 | } // retranslateUi
48 |
49 | };
50 |
51 | namespace Ui {
52 | class MainWindow: public Ui_MainWindow {};
53 | } // namespace Ui
54 |
55 | QT_END_NAMESPACE
56 |
57 | #endif // UI_MAINWINDOW_H
58 |
--------------------------------------------------------------------------------
/UI_0620/ui_page_1.h:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | ** Form generated from reading UI file 'page_1.ui'
3 | **
4 | ** Created: Fri May 29 02:47:40 2015
5 | ** by: Qt User Interface Compiler version 4.8.2
6 | **
7 | ** WARNING! All changes made in this file will be lost when recompiling UI file!
8 | ********************************************************************************/
9 |
10 | #ifndef UI_PAGE_1_H
11 | #define UI_PAGE_1_H
12 |
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include "mybutton.h"
20 |
21 | QT_BEGIN_NAMESPACE
22 |
23 | class Ui_Page_1
24 | {
25 | public:
26 | myButton *stopButton;
27 | myButton *startButton;
28 |
29 | void setupUi(QWidget *Page_1)
30 | {
31 | if (Page_1->objectName().isEmpty())
32 | Page_1->setObjectName(QString::fromUtf8("Page_1"));
33 | Page_1->resize(800, 450);
34 | Page_1->setFocusPolicy(Qt::TabFocus);
35 | Page_1->setStyleSheet(QString::fromUtf8(""));
36 | stopButton = new myButton(Page_1);
37 | stopButton->setObjectName(QString::fromUtf8("stopButton"));
38 | stopButton->setGeometry(QRect(350, 350, 99, 41));
39 | startButton = new myButton(Page_1);
40 | startButton->setObjectName(QString::fromUtf8("startButton"));
41 | startButton->setGeometry(QRect(350, 300, 99, 41));
42 | QWidget::setTabOrder(startButton, stopButton);
43 |
44 | retranslateUi(Page_1);
45 |
46 | QMetaObject::connectSlotsByName(Page_1);
47 | } // setupUi
48 |
49 | void retranslateUi(QWidget *Page_1)
50 | {
51 | Page_1->setWindowTitle(QApplication::translate("Page_1", "Form", 0, QApplication::UnicodeUTF8));
52 | stopButton->setText(QString());
53 | startButton->setText(QString());
54 | } // retranslateUi
55 |
56 | };
57 |
58 | namespace Ui {
59 | class Page_1: public Ui_Page_1 {};
60 | } // namespace Ui
61 |
62 | QT_END_NAMESPACE
63 |
64 | #endif // UI_PAGE_1_H
65 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/UI_622.pro:
--------------------------------------------------------------------------------
1 | # #####################################################################
2 | # Automatically generated by qmake (2.01a) Tue Apr 21 07:56:52 2015
3 | # #####################################################################
4 | QT += core gui
5 | QT +=widgets
6 | QT += printsupport
7 | QT += serialport winextras
8 | TEMPLATE = app
9 | TARGET = UI_622
10 | DEPENDPATH += . \
11 | debug
12 | INCLUDEPATH += .
13 | # Input
14 | HEADERS += configpage.h \
15 | datastack.h \
16 | datestpage.h \
17 | drawpage.h \
18 | homepage.h \
19 | keyboard.h \
20 | keybutton.h \
21 | mainwindow.h \
22 | mybutton.h \
23 | mycheckbox.h \
24 | mycombobox.h \
25 | mylineedit.h \
26 | myspinbox.h \
27 | mywatch.h \
28 | outputconfig.h \
29 | page_1.h \
30 | pdfheaderedit.h \
31 | picture.h \
32 | receiver_thread.h \
33 | uartthread.h \
34 | serialport.h
35 | FORMS += configpage.ui \
36 | datestpage.ui \
37 | homepage.ui \
38 | keyboard.ui \
39 | mainwindow.ui \
40 | outputconfig.ui \
41 | page_1.ui \
42 | pdfheaderedit.ui \
43 | picture.ui
44 | SOURCES += configpage.cpp \
45 | datastack.cpp \
46 | datestpage.cpp \
47 | drawpage.cpp \
48 | homepage.cpp \
49 | keyboard.cpp \
50 | keybutton.cpp \
51 | main.cpp \
52 | mainwindow.cpp \
53 | mybutton.cpp \
54 | mycheckbox.cpp \
55 | mycombobox.cpp \
56 | mylineedit.cpp \
57 | myspinbox.cpp \
58 | mywatch.cpp \
59 | outputconfig.cpp \
60 | page_1.cpp \
61 | pdfheaderedit.cpp \
62 | picture.cpp \
63 | receiver_thread.cpp \
64 | uartthread.cpp \
65 | serialport.cpp
66 | RESOURCES += rcf.qrc
67 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/configpage.h:
--------------------------------------------------------------------------------
1 | #ifndef CONFIGPAGE_H
2 | #define CONFIGPAGE_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include "page_1.h"
12 |
13 | extern QStackedWidget *stack;
14 | namespace Ui {
15 | class ConfigPage;
16 | }
17 |
18 | class ConfigPage : public QWidget
19 | {
20 | Q_OBJECT
21 |
22 | public:
23 | explicit ConfigPage(QWidget *parent = 0);
24 | ~ConfigPage();
25 | Ui::ConfigPage *ui;
26 | Page_1 *p1;
27 | signals:
28 | void configureChanged(double torsion_max,double duration);
29 | public slots:
30 | void on_cancelButton_clicked();
31 | void on_okButton_clicked();
32 | void torsion2zero();
33 | private slots:
34 | void resizeEvent(QResizeEvent *);
35 |
36 |
37 | private:
38 |
39 | };
40 |
41 | #endif // CONFIGPAGE_H
42 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/configuration.txt:
--------------------------------------------------------------------------------
1 | 0.5#60#0#0.005#
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/datastack.cpp:
--------------------------------------------------------------------------------
1 | #include "datastack.h"
2 |
3 | DataStack::DataStack()
4 | {
5 | }
6 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/datastack.h:
--------------------------------------------------------------------------------
1 | #ifndef DATASTACK_H
2 | #define DATASTACK_H
3 | #include
4 | #include
5 | #include
6 | typedef struct{
7 | double torsion_value;
8 | double torsion_max;
9 | double speed_value;
10 | double speed_max;
11 | double power_value;
12 | QDateTime time;
13 | }ItemType;
14 | class DataStack
15 | {
16 | public:
17 | DataStack();
18 | QStack stack;
19 | public slots:
20 | };
21 |
22 | #endif // DATASTACK_H
23 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/datestpage.h:
--------------------------------------------------------------------------------
1 | #ifndef DATESTPAGE_H
2 | #define DATESTPAGE_H
3 |
4 | #include
5 | #include "outputconfig.h"
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include "serialport.h"
11 | #define PERIOD 1
12 | namespace Ui {
13 | class DATestPage;
14 | }
15 |
16 | class DATestPage : public QWidget
17 | {
18 | Q_OBJECT
19 |
20 | public:
21 | explicit DATestPage(QWidget *parent = 0);
22 | ~DATestPage();
23 | QTimer *timer;
24 | int da_index;
25 | int msgq_id;
26 | int maxindex;
27 | int count;
28 | QList index_list;
29 | QList test_torsionlist;
30 | QList test_speedlist;
31 | SerialPort *port;
32 | private slots:
33 | void on_pushButton_clicked();
34 | void sendmsg();
35 | void paintEvent(QPaintEvent *);
36 | void resizeEvent(QResizeEvent *);
37 | void on_exportCharButton_clicked();
38 | char back_translate(signed char uc)
39 | {
40 | char c;
41 | if(uc>=0 && uc<=9)
42 | uc+=48;
43 | else if(uc>=10 && uc<=15)
44 | uc+=55;
45 | c=static_cast(uc);
46 | return c;
47 | }
48 |
49 | public slots:
50 | void appendData(double arg1,double arg2);
51 | private:
52 | Ui::DATestPage *ui;
53 | double _current_speed;
54 | double _current_torsion;
55 | };
56 |
57 | #endif // DATESTPAGE_H
58 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/datestpage.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | DATestPage
4 |
5 |
6 |
7 | 0
8 | 0
9 | 800
10 | 450
11 |
12 |
13 |
14 | Form
15 |
16 |
17 |
18 |
19 | 230
20 | 350
21 | 161
22 | 51
23 |
24 |
25 |
26 | Qt::TabFocus
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | 320
36 | 400
37 | 161
38 | 41
39 |
40 |
41 |
42 |
43 | 20
44 |
45 |
46 |
47 |
48 |
49 |
50 | Qt::AlignCenter
51 |
52 |
53 |
54 |
55 |
56 | 410
57 | 350
58 | 161
59 | 51
60 |
61 |
62 |
63 | Qt::TabFocus
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 | myButton
73 | QPushButton
74 |
75 |
76 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/drawpage.h:
--------------------------------------------------------------------------------
1 | #ifndef DRAWPAGE_H
2 | #define DRAWPAGE_H
3 |
4 | #include
5 | #include "picture.h"
6 | #include
7 | #include "mycombobox.h"
8 | #include
9 | #include
10 | #include "datastack.h"
11 | #include "pdfheaderedit.h"
12 | #define KEY 1234
13 | extern DataStack datastack;
14 | namespace Ui {
15 | class DrawPage;
16 | }
17 |
18 | class DrawPage : public QWidget
19 | {
20 | Q_OBJECT
21 |
22 | public:
23 | explicit DrawPage(QWidget *parent = 0);
24 | myComboBox * switchButton;
25 | Picture *speedpage,*Nmpage,*Kwpage;
26 | myButton *startButton;
27 | QTimer *timer;
28 | typedef enum {STARTED,STOPPED}Status;
29 | Status status;
30 | pdfHeaderEdit *pdf;
31 |
32 | private:
33 |
34 | public slots:
35 | void changPage(int arg);
36 | void getYmax(QList list);
37 |
38 | private slots:
39 | void resizeEvent(QResizeEvent *);
40 | void collectData();
41 | };
42 |
43 | #endif // DRAWPAGE_H
44 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/homepage.cpp:
--------------------------------------------------------------------------------
1 | #include "homepage.h"
2 | #include "ui_homepage.h"
3 |
4 | homePage::homePage(QWidget *parent) :
5 | QWidget(parent),
6 | ui(new Ui::homePage)
7 | {
8 | ui->setupUi(this);
9 | }
10 |
11 | homePage::~homePage()
12 | {
13 | delete ui;
14 | }
15 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/homepage.h:
--------------------------------------------------------------------------------
1 | #ifndef HOMEPAGE_H
2 | #define HOMEPAGE_H
3 |
4 | #include
5 |
6 | namespace Ui {
7 | class homePage;
8 | }
9 |
10 | class homePage : public QWidget
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | explicit homePage(QWidget *parent = 0);
16 | ~homePage();
17 |
18 | private:
19 | Ui::homePage *ui;
20 | };
21 |
22 | #endif // HOMEPAGE_H
23 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/homepage.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | homePage
4 |
5 |
6 |
7 | 0
8 | 0
9 | 800
10 | 450
11 |
12 |
13 |
14 | Form
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/keyboard.h:
--------------------------------------------------------------------------------
1 | #ifndef KEYBOARD_H
2 | #define KEYBOARD_H
3 |
4 | #include
5 | #include
6 |
7 |
8 | namespace Ui {
9 | class keyBoard;
10 | }
11 |
12 | class keyBoard : public QWidget
13 | {
14 | Q_OBJECT
15 |
16 | public:
17 | explicit keyBoard(QWidget *parent = 0);
18 | ~keyBoard();
19 | QWidget *inputWidget;
20 | bool islocked;
21 | public slots:
22 | void gainFocus();
23 |
24 | private slots:
25 | void on_lock_clicked();
26 |
27 | void resizeEvent(QResizeEvent *);
28 |
29 |
30 | private:
31 | Ui::keyBoard *ui;
32 | };
33 |
34 | #endif // KEYBOARD_H
35 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/keybutton.cpp:
--------------------------------------------------------------------------------
1 | #include "keybutton.h"
2 |
3 | keyButton::keyButton(QWidget *parent) :
4 | myButton(parent)
5 | {
6 | flag=0;
7 | board=(keyBoard*)this->parentWidget();
8 | QFont font(QString::fromUtf8("\u5B8B\u4F53"),width()/5);
9 | setFont(font);
10 | }
11 |
12 | void keyButton::resizeEvent(QResizeEvent *)
13 | {
14 | QFont font(QString::fromUtf8("\u5B8B\u4F53"),width()/5);
15 | setFont(font);
16 | setText(text());
17 | }
18 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/keybutton.h:
--------------------------------------------------------------------------------
1 | #ifndef KEYBUTTON_H
2 | #define KEYBUTTON_H
3 |
4 | #include "mybutton.h"
5 | #include
6 | #include
7 | #include "keybutton.h"
8 | #include "keyboard.h"
9 | #include "mylineedit.h"
10 |
11 | class keyButton : public myButton
12 | {
13 | Q_OBJECT
14 | public:
15 | explicit keyButton(QWidget *parent = 0);
16 | struct {
17 | myButton *upButton;
18 | myButton *downButton;
19 | myButton *leftButton;
20 | myButton *rightButton;
21 | }neighbor;
22 | myButton *nextButton;
23 | int flag;//0 输入键 1 功能键
24 | keyBoard *board;
25 | myLineEdit *edit;
26 |
27 | signals:
28 |
29 | public slots:
30 | void resizeEvent(QResizeEvent *);
31 | void keyPressEvent(QKeyEvent *k){
32 | switch (k->key()) {
33 | case Qt::Key_8:
34 | //if(neighbor.upButton!=0)
35 | nextButton=neighbor.upButton;
36 | if(nextButton!=0)
37 | nextButton->setFocus();
38 | break;
39 | case Qt::Key_2:
40 | nextButton=neighbor.downButton;
41 | if(nextButton!=0)
42 | nextButton->setFocus();
43 | break;
44 | case Qt::Key_4:
45 | nextButton=neighbor.leftButton;
46 | if(nextButton!=0)
47 | nextButton->setFocus();
48 | break;
49 | case Qt::Key_6:
50 | nextButton=neighbor.rightButton;
51 | if(nextButton!=0)
52 | nextButton->setFocus();
53 | break;
54 | case Qt::Key_Enter:
55 | if(flag==0)
56 | {
57 | char letter;
58 | letter=this->text().at(0).toLatin1();
59 | if(!board->islocked && letter>=65 && letter<=90)
60 | letter=letter+32;
61 | edit=(myLineEdit*)board->inputWidget;
62 | edit->setText(edit->text()+letter);
63 | }
64 | else if(flag==1)
65 | {
66 | if(text()=="back")
67 | {
68 | edit=(myLineEdit*)board->inputWidget;
69 | edit->setText(edit->text().remove(edit->text().length()-1,1));
70 | }
71 | else
72 | click();
73 | }
74 | break;
75 | case Qt::Key_0:
76 | board->hide();
77 | break;
78 | }
79 | }
80 |
81 | };
82 |
83 | #endif // KEYBUTTON_H
84 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/logo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fengcanyue/MotorMeasurement/853a63b20996de42a0e3c46f8cede7c1a9401e56/UI_622_windows/UI_622_windows/logo.jpg
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/main.cpp:
--------------------------------------------------------------------------------
1 | #include "mainwindow.h"
2 | #include
3 | #include "keyboard.h"
4 | #include "receiver_thread.h"
5 | #include "uartthread.h"
6 |
7 | bool COLLECT_FLAG;
8 | unsigned char uart_torsion[2];//转矩数组
9 | unsigned char uart_speed[2];//转速数组
10 | bool change_flag;
11 | UartThread *uart_ptr;//串口进程
12 |
13 | int main(int argc, char *argv[])
14 | {
15 | QApplication a(argc, argv);
16 | //a.setOverrideCursor(Qt::BlankCursor);
17 | change_flag=false;
18 | MainWindow w;
19 | QFont font;
20 | font.setFamily("wenquanyi");//设定字体
21 | a.setFont(font);//设定生效
22 | w.show();
23 | // w.setWindowState(Qt::WindowFullScreen);
24 | UartThread ut;//串口进程
25 | uart_ptr=&ut;
26 | ut.start();
27 | COLLECT_FLAG=false;
28 | receiver_thread *t=new receiver_thread;
29 | QObject::connect(t,SIGNAL(newDataReceived(double,double)),&w,SLOT(getData(double,double)));
30 | t->start();
31 | return a.exec();
32 | }
33 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/mainwindow.h:
--------------------------------------------------------------------------------
1 | #ifndef MAINWINDOW_H
2 | #define MAINWINDOW_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include "mybutton.h"
8 | #include
9 | #include
10 | #include "page_1.h"
11 | #include "configpage.h"
12 | #include "pdfheaderedit.h"
13 | #include "drawpage.h"
14 | #include
15 | #include
16 | #include "homepage.h"
17 | #include
18 | #include "keyboard.h"
19 | #include "mylineedit.h"
20 | #include "datastack.h"
21 | #include "outputconfig.h"
22 | #include "datestpage.h"
23 | namespace Ui {
24 | class MainWindow;
25 | }
26 |
27 | class MainWindow : public QMainWindow
28 | {
29 | Q_OBJECT
30 |
31 | signals:
32 | public:
33 | explicit MainWindow(QWidget *parent = 0);
34 | ~MainWindow();
35 | myButton *sysconfigbutton,*sysstatusbutton,*drawbutton,*pdfeditbutton,*outputbutton,*da_testbutton;
36 | // helpButton *helpbutton;
37 | QStackedWidget *widgets;
38 | QLabel *label2;
39 | Page_1 *page1;
40 | ConfigPage *configpage;
41 | DrawPage *drawpage;
42 | pdfHeaderEdit *pdfPage;
43 | QWidget * topWidget;
44 | QLabel *helpLabel,*timeLabel;
45 | // helpPage *helppage;
46 | homePage *home;
47 | QTimer *timer;
48 | keyBoard *keyboard;
49 | OutPutConfig *outputpage;
50 | DATestPage *da_testpage;
51 | public slots:
52 | void resizeEvent(QResizeEvent *);
53 |
54 | void drawButton_clicked();
55 |
56 | void statusButton_clicked();
57 |
58 | void configButton_clicked();
59 |
60 | void pdfEditButton_clicked();
61 |
62 | void showDAtestPage();
63 |
64 | void saveWorkerNum(QString arg1);
65 |
66 | void showHelp();
67 |
68 | void closeEvent(QCloseEvent *){
69 | qApp->exit();
70 | }
71 | void getData(double torsion,double speed);
72 |
73 | void changeLabel(int index);
74 |
75 | void updateTime();
76 |
77 | void showOutPutPage();
78 |
79 | private:
80 | Ui::MainWindow *ui;
81 | QLabel *label;
82 | };
83 |
84 | #endif // MAINWINDOW_H
85 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/mainwindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | MainWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 800
10 | 450
11 |
12 |
13 |
14 |
15 |
16 |
17 | background-color: rgb(255, 255, 255);
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/mybutton.cpp:
--------------------------------------------------------------------------------
1 | #include "mybutton.h"
2 | #include
3 |
4 | extern QStackedWidget *stack;
5 | myButton::myButton(QWidget *parent) :
6 | QPushButton(parent)
7 | {
8 | QFont font;
9 | font.setFamily("wenquanyi");
10 | font.setPointSize(160);
11 | font.setBold(true);
12 | setFont(font);
13 | setFocusPolicy(Qt::TabFocus);
14 | setStyleSheet("border-style: inset; border-width: 3px;border-radius: 20px;border-color: rgb(46, 130, 255);padding:-99999;background-color:blue;color:black;");
15 | }
16 |
17 | void myButton::keyPressEvent(QKeyEvent *k)
18 | {
19 | if(k->key()==Qt::Key_Enter)
20 | {
21 | this->click();
22 | setStyleSheet("border-style: inset; border-width: 0px;border-radius: 20px;border-color:rgb(255, 20, 110);padding: -99999;background-color:red;color:black;");
23 | }
24 | switch (k->key()) {
25 | case Qt::Key_8:
26 | focusPreviousChild();
27 | break;
28 | case Qt::Key_2:
29 | focusNextChild();
30 | break;
31 | case Qt::Key_7:
32 | stack->setCurrentIndex(0);
33 | break;
34 | case Qt::Key_Minus:
35 | system("sudo halt");
36 | break;
37 | }
38 | }
39 |
40 | void myButton::keyReleaseEvent(QKeyEvent *k)
41 | {
42 | if(k->key()==Qt::Key_Enter)
43 | setStyleSheet("border-style: inset; border-width: 3px;border-radius: 20px;border-color:rgb(255, 20, 110);padding: -99999;background-color:red;color:black;");
44 | }
45 |
46 | void myButton::resizeEvent(QResizeEvent *)
47 | {
48 | QFont font(QString::fromUtf8("\u5B8B\u4F53"),width()/7);
49 | setFont(font);
50 | }
51 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/mybutton.h:
--------------------------------------------------------------------------------
1 | #ifndef MYBUTTON_H
2 | #define MYBUTTON_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | class myButton : public QPushButton
10 | {
11 | Q_OBJECT
12 | public:
13 | explicit myButton(QWidget *parent = 0);
14 | QString color;
15 |
16 | signals:
17 |
18 | public slots:
19 | void focusInEvent(QFocusEvent *){
20 | setStyleSheet("border-style: inset; border-width: 3px;border-radius: 20px;border-color:rgb(255, 20, 110);padding:-99999;background-color:red;color:black;");
21 | }
22 | void focusOutEvent(QFocusEvent *){
23 | setStyleSheet("border-style: inset; border-width: 3px;border-radius: 20px;border-color:rgb(46, 130, 255);padding:-99999;background-color:blue;color:black;");
24 | }
25 | void keyPressEvent(QKeyEvent *k);
26 | void keyReleaseEvent(QKeyEvent *k);
27 | void resizeEvent(QResizeEvent *);
28 |
29 | };
30 |
31 | #endif // MYBUTTON_H
32 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/mycheckbox.cpp:
--------------------------------------------------------------------------------
1 | #include "mycheckbox.h"
2 |
3 | myCheckBox::myCheckBox(QWidget *parent) :
4 | QCheckBox(parent)
5 | {
6 | }
7 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/mycheckbox.h:
--------------------------------------------------------------------------------
1 | #ifndef MYCHECKBOX_H
2 | #define MYCHECKBOX_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include "mybutton.h"
8 | #include
9 |
10 | extern QStackedWidget *stack;
11 | class myCheckBox : public QCheckBox
12 | {
13 | Q_OBJECT
14 | public:
15 | explicit myCheckBox(QWidget *parent = 0);
16 | //1:可取消勾选 0:不可取消
17 | int flag;
18 | signals:
19 |
20 | public slots:
21 | void keyPressEvent(QKeyEvent *k){
22 | if(k->key()==Qt::Key_Enter && !this->isChecked())
23 | this->setChecked(true);
24 | else if(k->key()==Qt::Key_Enter && this->isChecked() && this->flag==1)
25 | this->setChecked(false);
26 | switch (k->key()) {
27 | case Qt::Key_8:
28 | focusPreviousChild();
29 | break;
30 | case Qt::Key_2:
31 | focusNextChild();
32 | break;
33 | case Qt::Key_7:
34 | stack->setCurrentIndex(0);
35 | break;
36 | case Qt::Key_Minus:
37 | system("sudo halt");
38 | break;
39 |
40 | }
41 | }
42 | void focusInEvent(QFocusEvent *){
43 | // if(flag==1)
44 | // setStyleSheet("background-color:red");
45 | // else if(flag==0)
46 | setStyleSheet("background-color:red;");
47 | }
48 | void focusOutEvent(QFocusEvent *){
49 | // if(flag==1)
50 | // setStyleSheet("background-color:rgb(0,170,0)");
51 | // else if(flag==0)
52 | setStyleSheet("background-color:white");
53 | }
54 |
55 | };
56 |
57 | #endif // MYCHECKBOX_H
58 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/mycombobox.cpp:
--------------------------------------------------------------------------------
1 | #include "mycombobox.h"
2 |
3 | myComboBox::myComboBox(QWidget *parent) :
4 | QComboBox(parent)
5 | {
6 | setFocusPolicy(Qt::TabFocus);
7 | }
8 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/mycombobox.h:
--------------------------------------------------------------------------------
1 | #ifndef MYCOMBOBOX_H
2 | #define MYCOMBOBOX_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include "mybutton.h"
8 | #include
9 |
10 | extern QStackedWidget *stack;
11 | class myComboBox : public QComboBox
12 | {
13 | Q_OBJECT
14 | public:
15 | explicit myComboBox(QWidget *parent = 0);
16 |
17 | signals:
18 |
19 | public slots:
20 | void keyPressEvent(QKeyEvent *k)
21 | {
22 | int index=this->currentIndex();
23 | switch (k->key()) {
24 | case Qt::Key_4:
25 | index=index-1>-1?index-1:0;
26 | this->setCurrentIndex(index);
27 | break;
28 | case Qt::Key_6:
29 | index=index+1>this->count()-1?index:index+1;
30 | this->setCurrentIndex(index);
31 | break;
32 | case Qt::Key_8:
33 | focusPreviousChild();
34 | break;
35 | case Qt::Key_2:
36 | focusNextChild();
37 | break;
38 | case Qt::Key_7:
39 | stack->setCurrentIndex(0);
40 | break;
41 | case Qt::Key_Minus:
42 | system("sudo halt");
43 | break;
44 | }
45 | }
46 | void focusInEvent(QFocusEvent *){
47 | setStyleSheet("color:red");
48 | }
49 | void focusOutEvent(QFocusEvent *){
50 | setStyleSheet("color:black");
51 | }
52 | };
53 |
54 | #endif // MYCOMBOBOX_H
55 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/mylineedit.cpp:
--------------------------------------------------------------------------------
1 | #include "mylineedit.h"
2 |
3 | myLineEdit::myLineEdit(QWidget *parent) :
4 | QLineEdit(parent)
5 | {
6 | setFocusPolicy(Qt::TabFocus);
7 | focusMove=true;
8 | }
9 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/mylineedit.h:
--------------------------------------------------------------------------------
1 | #ifndef MYLINEEDIT_H
2 | #define MYLINEEDIT_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include "mybutton.h"
9 | #include
10 | #include "keyboard.h"
11 |
12 | extern QStackedWidget *stack;
13 | class myLineEdit : public QLineEdit
14 | {
15 | Q_OBJECT
16 | public:
17 | explicit myLineEdit(QWidget *parent = 0);
18 | bool focusMove;
19 | keyBoard *keyboard;
20 | WId wid;
21 | signals:
22 | void enterPushed(QString arg1);
23 |
24 | public slots:
25 | void keyPressEvent(QKeyEvent *k){
26 | switch (k->key()) {
27 | case Qt::Key_Minus:
28 | system("sudo halt");
29 | break;
30 |
31 | case Qt::Key_8:
32 | if(focusMove)
33 | focusPreviousChild();
34 | break;
35 | case Qt::Key_2:
36 | if(focusMove)
37 | focusNextChild();
38 | break;
39 | case Qt::Key_7:
40 | if(focusMove)
41 | stack->setCurrentIndex(0);
42 | break;
43 | case Qt::Key_Enter:
44 | emit enterPushed(text());
45 | break;
46 | case Qt::Key_0:
47 | keyboard=(keyBoard*)QWidget::find(wid);
48 | keyboard->show();
49 | keyboard->inputWidget=this;
50 | keyboard->gainFocus();
51 | break;
52 | }
53 | }
54 | void focusInEvent(QFocusEvent *){
55 | setStyleSheet("background-color:red");
56 | }
57 | void focusOutEvent(QFocusEvent *){
58 | setStyleSheet("background-color:white");
59 | }
60 |
61 | };
62 |
63 | #endif // MYLINEEDIT_H
64 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/myspinbox.cpp:
--------------------------------------------------------------------------------
1 | #include "myspinbox.h"
2 |
3 | mySpinBox::mySpinBox(QWidget *parent) :
4 | QDoubleSpinBox(parent)
5 | {
6 | setFocusPolicy(Qt::TabFocus);
7 | }
8 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/myspinbox.h:
--------------------------------------------------------------------------------
1 | #ifndef MYSPINBOX_H
2 | #define MYSPINBOX_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include "mybutton.h"
8 | #include
9 |
10 | extern QStackedWidget *stack;
11 | class mySpinBox : public QDoubleSpinBox
12 | {
13 | Q_OBJECT
14 | public:
15 | explicit mySpinBox(QWidget *parent = 0);
16 |
17 | signals:
18 |
19 | public slots:
20 | void keyPressEvent(QKeyEvent *k){
21 | switch (k->key()) {
22 | case Qt::Key_Minus:
23 | system("sudo halt");
24 | break;
25 |
26 | case Qt::Key_8:
27 | focusPreviousChild();
28 | break;
29 | case Qt::Key_2:
30 | focusNextChild();
31 | break;
32 | case Qt::Key_4:
33 | stepUp();
34 | break;
35 | case Qt::Key_6:
36 | stepDown();
37 | break;
38 | case Qt::Key_7:
39 | stack->setCurrentIndex(0);
40 | break;
41 | }
42 | }
43 | void focusInEvent(QFocusEvent *){
44 | setStyleSheet("color:red");
45 | }
46 | void focusOutEvent(QFocusEvent *){
47 | setStyleSheet("color:black");
48 | }
49 |
50 | };
51 |
52 | #endif // MYSPINBOX_H
53 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/mywatch.h:
--------------------------------------------------------------------------------
1 | #ifndef MYWATCH_H
2 | #define MYWATCH_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #define POINTER_STEP 20 //
12 | #define MAX_INCRE_SIZE 10 //
13 | extern double torsion_test_max;
14 | class myWatch;
15 | class myWatch : public QWidget
16 | {
17 | Q_OBJECT
18 | public:
19 | explicit myWatch(QWidget *parent = 0);
20 | qreal max;
21 | QString type;
22 | QString unit;
23 | QLabel *valueLabel;
24 | QTimer *timer;
25 | signals:
26 | void maxChanged(double);
27 | public slots:
28 | void paintEvent(QPaintEvent *);
29 | void paintPointer(QPainter &p);
30 | void resizeEvent(QResizeEvent *);
31 | void setValue(double arg){
32 | if(qAbs(arg)>max && isAutoAdjust())
33 | {
34 | while(qAbs(arg)>max)
35 | max=max*MAX_INCRE_SIZE;
36 | //repaint();
37 | emit maxChanged(max);
38 | }
39 | /*
40 | value_new=arg;
41 | if(value>max)
42 | value=max;//使当前值不超量程
43 | while(value!=value_new && value<=max+POINTER_STEP*max/50)
44 | {
45 | qreal dv=value_new-value;
46 | if(dv>0 && dv>=POINTER_STEP*max/50)
47 | value+=POINTER_STEP*max/50;
48 | else if(dv>0 && dv-POINTER_STEP*max/50)
53 | value+=dv;
54 | repaint();
55 | }
56 | */
57 | value=arg;
58 | //repaint();
59 | }
60 | void displayValue(double vu);
61 | bool isAutoAdjust()
62 | {
63 | return autoadjust;
64 | }
65 | void setAutoAdjust(bool t)
66 | {
67 | autoadjust=t;
68 | }
69 | void setMax(double m)
70 | {
71 | max=m;
72 | }
73 | double Max()
74 | {
75 | return max;
76 | }
77 |
78 | private:
79 | qreal value;
80 | qreal value_new;
81 | bool autoadjust;//
82 | private slots:
83 |
84 |
85 | };
86 |
87 | #endif // MYWATCH_H
88 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/outputconfig.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "outputconfig.h"
3 | #include "ui_outputconfig.h"
4 | #include
5 | #include
6 | #include "uartthread.h"
7 | extern UartThread *uart_ptr;
8 |
9 | #define COMMENT 0
10 |
11 |
12 | unsigned int ma_t[20]={0xcd,0x19a,0x266,0x333,0x400,0x4cd,0x59a,0x666,0x733,0x800,0x8cd,0x99a,0xa66,0xb33,0xc00,0xccd,0xd9a,0xe66,0xf33,0xfff};
13 | OutPutConfig::OutPutConfig(QWidget *parent) :
14 |
15 | QWidget(parent),
16 | ui(new Ui::OutPutConfig)
17 | {
18 | ui->setupUi(this);
19 | setFocusPolicy(Qt::NoFocus);
20 | ui->okbutton->setText(QString::fromUtf8("\u8bbe\u7f6e"));
21 | }
22 |
23 | OutPutConfig::~OutPutConfig()
24 | {
25 | delete ui;
26 | }
27 |
28 | void OutPutConfig::resizeEvent(QResizeEvent *)
29 | {
30 | ui->okbutton->setGeometry(QRect(330*width()/800, 310*height()/450, 151*width()/800, 61*height()/450));
31 | ui->output_1->setGeometry(QRect(110*width()/800, 80*height()/450, 401*width()/800, 71*height()/450));
32 | ui->output_2->setGeometry(QRect(110*width()/800, 180*height()/450, 401*width()/800, 71*height()/450));
33 | ui->label_2->setGeometry(QRect(520*width()/800, 180*height()/450, 181*width()/800, 71*height()/450));
34 | ui->label_1->setGeometry(QRect(520*width()/800, 80*height()/450, 181*width()/800, 71*height()/450));
35 | }
36 |
37 | void OutPutConfig::on_okbutton_clicked()
38 | {
39 | union{
40 | int int16;
41 | char char8[2];
42 | }data0,data1;
43 | //char data[2];
44 | memset(data0.char8,0,2);
45 | memset(data1.char8,0,2);
46 | port=new SerialPort;
47 | port->setPortName(DEVICE);
48 | if(!port->open(QIODevice::ReadWrite))
49 | {
50 | qDebug()<<"open port false when test DAC";
51 | }
52 | port->set_opt(QSerialPort::NoFlowControl,QSerialPort::Baud115200,QSerialPort::Data8,QSerialPort::NoParity,QSerialPort::OneStop);
53 | // if(!port->setBlockMode())
54 | // {
55 | // printf("fcntl failed when set DAC\n");
56 | // }
57 | //data[0]=ui->output_1->currentIndex();
58 | data0.int16=ui->output_1->currentIndex()*100;
59 | //data[1]=ui->output_2->currentIndex()+0x20;
60 | data1.int16=ui->output_1->currentIndex()*100+0x20*100;
61 | //int n= port->write(&data[0],1);
62 | int n= port->write(&data0.char8[0],2);
63 | if(n==1)
64 | printf("%x\n",data0.int16);
65 | usleep(100);
66 | //n= port->write(&data[1],1);
67 | n= port->write(&data1.char8[0],2);
68 | if(n==1)
69 | printf("%x\n",data1.int16);
70 | port->close();
71 | delete port;
72 | }
73 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/outputconfig.h:
--------------------------------------------------------------------------------
1 | #ifndef OUTPUTCONFIG_H
2 | #define OUTPUTCONFIG_H
3 |
4 | #include
5 | #include
6 | #include "serialport.h"
7 |
8 | namespace Ui {
9 | class OutPutConfig;
10 | }
11 |
12 | class OutPutConfig : public QWidget
13 | {
14 | Q_OBJECT
15 |
16 | public:
17 | explicit OutPutConfig(QWidget *parent = 0);
18 | ~OutPutConfig();
19 | private slots:
20 | void on_okbutton_clicked();
21 | void resizeEvent(QResizeEvent *);
22 | char back_translate(signed char uc)
23 | {
24 | char c;
25 | if(uc>=0 && uc<=9)
26 | uc+=48;
27 | else if(uc>=10 && uc<=15)
28 | uc+=55;
29 | c=static_cast(uc);
30 | return c;
31 | }
32 |
33 | private:
34 | Ui::OutPutConfig *ui;
35 | SerialPort *port;
36 | };
37 |
38 | #endif // OUTPUTCONFIG_H
39 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/page_1.h:
--------------------------------------------------------------------------------
1 | #ifndef PAGE_1_H
2 | #define PAGE_1_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include "mywatch.h"
11 | #include "mybutton.h"
12 | #include
13 | #include "datastack.h"
14 | #include
15 | #include "myspinbox.h"
16 | extern DataStack datastack;
17 | extern QStackedWidget *stack;
18 | namespace Ui {
19 | class Page_1;
20 | }
21 |
22 | class Page_1 : public QWidget
23 | {
24 | Q_OBJECT
25 |
26 | public:
27 | explicit Page_1(QWidget *parent = 0);
28 | ~Page_1();
29 | Ui::Page_1 *ui;
30 | myWatch *speedWatch,*torsionWatch,*powerWatch;
31 | QStackedWidget *parentStack;
32 | QLabel *label;
33 | myButton *setZeroButton;
34 | typedef enum{StartedState,StoppedState}runningState;
35 | runningState state;
36 | int duration;
37 | QTimer *timer;
38 | public slots:
39 | void resizeEvent(QResizeEvent *);
40 | void keyPressEvent(QKeyEvent *k){
41 | switch (k->key()) {
42 | case Qt::Key_7:
43 | stack->setCurrentIndex(0);
44 | break;
45 | case Qt::Key_8:
46 | focusPreviousChild();
47 | break;
48 | case Qt::Key_2:
49 | focusNextChild();
50 | break;
51 | }
52 | }
53 | void setWatchValues(double torsion, double speed);
54 | void paintEvent(QPaintEvent *){
55 | QPainter painter(this);
56 | painter.setBrush(QBrush(Qt::black));
57 | painter.drawRect(0,0,width(),height());
58 | }
59 |
60 | void setTorsionMaxandPeriod(double torsion,double dur);
61 |
62 | void updateMax(double mmm);
63 |
64 | void startButton_clicked();
65 |
66 | void stopButton_clicked();
67 |
68 | void refreshUI();
69 | signals:
70 | void changeTorsion(double torion);
71 | void changeSpeed(double speed);
72 | void changePower(double power);
73 | void getTestData(double torsion,double speed);
74 | private slots:
75 |
76 | void resetAll();
77 | };
78 |
79 | #endif // PAGE_1_H
80 |
--------------------------------------------------------------------------------
/UI_622_windows/UI_622_windows/page_1.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | Page_1
4 |
5 |
6 |