├── .gitignore ├── .vscode └── settings.json ├── CH340驱动(USB串口驱动) ├── SETUP.EXE ├── readme.txt └── 安装失败解决办法 │ ├── WIN8-64 │ ├── serenum.sys │ └── serial.sys │ ├── Win7(XP共用)-32 │ ├── serenum.sys │ └── serial.sys │ ├── Win7-64 │ ├── serenum.sys │ └── serial.sys │ └── readme.txt ├── LICENSE ├── README.md ├── src ├── .vscode │ └── settings.json ├── Icon.ico ├── Resource │ ├── img.qrc │ └── img │ │ ├── Icon.svg │ │ ├── V.svg │ │ ├── clear.svg │ │ ├── close.svg │ │ ├── demo.svg │ │ ├── down.svg │ │ ├── help.svg │ │ ├── hideall.svg │ │ ├── little.svg │ │ ├── logo.png │ │ ├── open-off.svg │ │ ├── open-on.svg │ │ ├── output.svg │ │ ├── pic-src │ │ ├── hideall.svg │ │ ├── reset.svg │ │ ├── showall.svg │ │ ├── y-auto.svg │ │ └── y-manual.svg │ │ ├── reset.png │ │ ├── send.svg │ │ ├── setup.svg │ │ ├── showall.png │ │ ├── size-1.svg │ │ ├── size-2.svg │ │ ├── stop-off.svg │ │ ├── stop-on.svg │ │ ├── up.svg │ │ ├── y-auto.png │ │ └── y-manual.png ├── build │ └── Desktop_Qt_5_9_8_MinGW_32bit-Debug │ │ └── debug │ │ └── config.ini ├── cmdlist.cpp ├── cmdlist.h ├── cmdlist.ui ├── data │ ├── ringqueue.h │ ├── yframe.cpp │ └── yframe.h ├── install.ico ├── main.cpp ├── myscorllbar.cpp ├── myscorllbar.h ├── mytimer.cpp ├── mytimer.h ├── plot │ ├── drawplot.cpp │ ├── drawplot.h │ ├── mybuoy.cpp │ ├── mybuoy.h │ ├── plotdemo.cpp │ ├── plotdemo.h │ ├── qcustomplot.cpp │ ├── qcustomplot.h │ ├── verticalline.cpp │ └── verticalline.h ├── qframeless │ ├── qframeless.pri │ ├── qframelessdialog.cpp │ ├── qframelessdialog.h │ ├── qframelesshelper.cpp │ ├── qframelesshelper.h │ ├── qframelessmainwindow.cpp │ ├── qframelessmainwindow.h │ ├── qframelesswidget.cpp │ ├── qframelesswidget.h │ ├── qshadowhelper.cpp │ └── qshadowhelper.h ├── serialinfo.cpp ├── serialinfo.h ├── setupframe.cpp ├── setupframe.h ├── setupframe.ui ├── setupmanage.cpp ├── setupmanage.h ├── setupplot.cpp ├── setupplot.h ├── setupplot.ui ├── widget.cpp ├── widget.h ├── widget.ui └── yplot.pro └── 示例 ├── STM32F103RBT6 ├── CORE │ ├── core_cm3.c │ ├── core_cm3.h │ └── startup_stm32f10x_hd.s ├── HARDWARE │ └── LED │ │ ├── led.c │ │ └── led.h ├── OBJ │ └── LED.hex ├── 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 │ │ ├── usart.c │ │ └── usart.h ├── USER │ ├── DebugConfig │ │ ├── LED_STM32F103ZE_1.0.0.dbgconf │ │ └── temp_STM32F103RB_1.0.0.dbgconf │ ├── JLinkSettings.ini │ ├── LED.uvguix.hyuan │ ├── LED.uvguix.yuan │ ├── LED.uvoptx │ ├── LED.uvprojx │ ├── Objects │ │ └── temp.hex │ ├── main.c │ ├── stm32f10x.h │ ├── stm32f10x_conf.h │ ├── stm32f10x_it.c │ ├── stm32f10x_it.h │ ├── system_stm32f10x.c │ └── system_stm32f10x.h └── keilkilll.bat ├── STM32F103ZET6 ├── CORE │ ├── core_cm3.c │ ├── core_cm3.h │ └── startup_stm32f10x_hd.s ├── HARDWARE │ └── LED │ │ ├── led.c │ │ └── led.h ├── OBJ │ └── LED.hex ├── 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 │ │ ├── usart.c │ │ └── usart.h ├── USER │ ├── DebugConfig │ │ └── LED_STM32F103ZE_1.0.0.dbgconf │ ├── JLinkSettings.ini │ ├── LED.uvguix.20879 │ ├── LED.uvguix.hyuan │ ├── LED.uvguix.yuan │ ├── LED.uvoptx │ ├── LED.uvprojx │ ├── main.c │ ├── stm32f10x.h │ ├── stm32f10x_conf.h │ ├── stm32f10x_it.c │ ├── stm32f10x_it.h │ ├── system_stm32f10x.c │ └── system_stm32f10x.h └── keilkilll.bat └── STM32F407ZGT6 ├── CORE ├── core_cm4.h ├── core_cm4_simd.h ├── core_cmFunc.h ├── core_cmInstr.h └── startup_stm32f40_41xxx.s ├── FWLIB ├── inc │ ├── misc.h │ ├── stm32f4xx_adc.h │ ├── stm32f4xx_can.h │ ├── stm32f4xx_crc.h │ ├── stm32f4xx_cryp.h │ ├── stm32f4xx_dac.h │ ├── stm32f4xx_dbgmcu.h │ ├── stm32f4xx_dcmi.h │ ├── stm32f4xx_dma.h │ ├── stm32f4xx_dma2d.h │ ├── stm32f4xx_exti.h │ ├── stm32f4xx_flash.h │ ├── stm32f4xx_flash_ramfunc.h │ ├── stm32f4xx_fmc.h │ ├── stm32f4xx_fsmc.h │ ├── stm32f4xx_gpio.h │ ├── stm32f4xx_hash.h │ ├── stm32f4xx_i2c.h │ ├── stm32f4xx_iwdg.h │ ├── stm32f4xx_ltdc.h │ ├── stm32f4xx_pwr.h │ ├── stm32f4xx_rcc.h │ ├── stm32f4xx_rng.h │ ├── stm32f4xx_rtc.h │ ├── stm32f4xx_sai.h │ ├── stm32f4xx_sdio.h │ ├── stm32f4xx_spi.h │ ├── stm32f4xx_syscfg.h │ ├── stm32f4xx_tim.h │ ├── stm32f4xx_usart.h │ └── stm32f4xx_wwdg.h └── src │ ├── misc.c │ ├── stm32f4xx_adc.c │ ├── stm32f4xx_can.c │ ├── stm32f4xx_crc.c │ ├── stm32f4xx_cryp.c │ ├── stm32f4xx_cryp_aes.c │ ├── stm32f4xx_cryp_des.c │ ├── stm32f4xx_cryp_tdes.c │ ├── stm32f4xx_dac.c │ ├── stm32f4xx_dbgmcu.c │ ├── stm32f4xx_dcmi.c │ ├── stm32f4xx_dma.c │ ├── stm32f4xx_dma2d.c │ ├── stm32f4xx_exti.c │ ├── stm32f4xx_flash.c │ ├── stm32f4xx_flash_ramfunc.c │ ├── stm32f4xx_fmc.c │ ├── stm32f4xx_fsmc.c │ ├── stm32f4xx_gpio.c │ ├── stm32f4xx_hash.c │ ├── stm32f4xx_hash_md5.c │ ├── stm32f4xx_hash_sha1.c │ ├── stm32f4xx_i2c.c │ ├── stm32f4xx_iwdg.c │ ├── stm32f4xx_ltdc.c │ ├── stm32f4xx_pwr.c │ ├── stm32f4xx_rcc.c │ ├── stm32f4xx_rng.c │ ├── stm32f4xx_rtc.c │ ├── stm32f4xx_sai.c │ ├── stm32f4xx_sdio.c │ ├── stm32f4xx_spi.c │ ├── stm32f4xx_syscfg.c │ ├── stm32f4xx_tim.c │ ├── stm32f4xx_usart.c │ └── stm32f4xx_wwdg.c ├── HARDWARE └── LED │ ├── led.c │ └── led.h ├── OBJ └── LED.hex ├── SYSTEM ├── delay │ ├── delay.c │ └── delay.h ├── sys │ ├── sys.c │ └── sys.h └── usart │ ├── usart.c │ └── usart.h ├── USER ├── DebugConfig │ └── LED_STM32F407ZG.dbgconf ├── JLinkSettings.ini ├── LED.uvguix.Administrator ├── LED.uvguix.hyuan ├── LED.uvguix.yuan ├── LED.uvoptx ├── LED.uvprojx ├── main.c ├── stm32f4xx.h ├── stm32f4xx_conf.h ├── stm32f4xx_it.c ├── stm32f4xx_it.h ├── system_stm32f4xx.c └── system_stm32f4xx.h └── keilkilll.bat /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # C++ objects and libs 3 | *.slo 4 | *.lo 5 | *.o 6 | *.a 7 | *.la 8 | *.lai 9 | *.so 10 | *.so.* 11 | *.dll 12 | *.dylib 13 | 14 | # Qt-es 15 | object_script.*.Release 16 | object_script.*.Debug 17 | *_plugin_import.cpp 18 | /.qmake.cache 19 | /.qmake.stash 20 | *.pro.user 21 | *.pro.user.* 22 | *.qbs.user 23 | *.qbs.user.* 24 | *.moc 25 | moc_*.cpp 26 | moc_*.h 27 | qrc_*.cpp 28 | ui_*.h 29 | *.qmlc 30 | *.jsc 31 | Makefile* 32 | *build-* 33 | *.qm 34 | *.prl 35 | 36 | # Qt unit tests 37 | target_wrapper.* 38 | 39 | # QtCreator 40 | *.autosave 41 | 42 | # QtCreator Qml 43 | *.qmlproject.user 44 | *.qmlproject.user.* 45 | 46 | # QtCreator CMake 47 | CMakeLists.txt.user* 48 | 49 | # QtCreator 4.8< compilation database 50 | compile_commands.json 51 | 52 | # QtCreator local machine specific files for imported projects 53 | *creator.user* 54 | 55 | *_qmlcache.qrc 56 | 57 | 58 | # new 59 | *.idx 60 | *.stash 61 | *.exe 62 | *.rc 63 | 64 | src/build/* -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "*.c": "c", 4 | "iosfwd": "cpp", 5 | "xutility": "cpp" 6 | } 7 | } -------------------------------------------------------------------------------- /CH340驱动(USB串口驱动)/SETUP.EXE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/CH340驱动(USB串口驱动)/SETUP.EXE -------------------------------------------------------------------------------- /CH340驱动(USB串口驱动)/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/CH340驱动(USB串口驱动)/readme.txt -------------------------------------------------------------------------------- /CH340驱动(USB串口驱动)/安装失败解决办法/WIN8-64/serenum.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/CH340驱动(USB串口驱动)/安装失败解决办法/WIN8-64/serenum.sys -------------------------------------------------------------------------------- /CH340驱动(USB串口驱动)/安装失败解决办法/WIN8-64/serial.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/CH340驱动(USB串口驱动)/安装失败解决办法/WIN8-64/serial.sys -------------------------------------------------------------------------------- /CH340驱动(USB串口驱动)/安装失败解决办法/Win7(XP共用)-32/serenum.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/CH340驱动(USB串口驱动)/安装失败解决办法/Win7(XP共用)-32/serenum.sys -------------------------------------------------------------------------------- /CH340驱动(USB串口驱动)/安装失败解决办法/Win7(XP共用)-32/serial.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/CH340驱动(USB串口驱动)/安装失败解决办法/Win7(XP共用)-32/serial.sys -------------------------------------------------------------------------------- /CH340驱动(USB串口驱动)/安装失败解决办法/Win7-64/serenum.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/CH340驱动(USB串口驱动)/安装失败解决办法/Win7-64/serenum.sys -------------------------------------------------------------------------------- /CH340驱动(USB串口驱动)/安装失败解决办法/Win7-64/serial.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/CH340驱动(USB串口驱动)/安装失败解决办法/Win7-64/serial.sys -------------------------------------------------------------------------------- /CH340驱动(USB串口驱动)/安装失败解决办法/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/CH340驱动(USB串口驱动)/安装失败解决办法/readme.txt -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 syuan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "*.c": "c", 4 | "xutility": "cpp", 5 | "algorithm": "cpp" 6 | } 7 | } -------------------------------------------------------------------------------- /src/Icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/src/Icon.ico -------------------------------------------------------------------------------- /src/Resource/img.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | img/Icon.svg 4 | img/down.svg 5 | img/up.svg 6 | img/clear.svg 7 | img/V.svg 8 | img/close.svg 9 | img/help.svg 10 | img/little.svg 11 | img/open-off.svg 12 | img/open-on.svg 13 | img/output.svg 14 | img/send.svg 15 | img/setup.svg 16 | img/size-1.svg 17 | img/size-2.svg 18 | img/stop-off.svg 19 | img/stop-on.svg 20 | img/y-auto.png 21 | img/y-manual.png 22 | img/reset.png 23 | img/showall.png 24 | img/logo.png 25 | img/hideall.svg 26 | img/demo.svg 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/Resource/img/Icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/Resource/img/V.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Resource/img/clear.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/Resource/img/close.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Resource/img/demo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | Created with Pixso. 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Resource/img/down.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Resource/img/help.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Resource/img/hideall.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/Resource/img/little.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/Resource/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/src/Resource/img/logo.png -------------------------------------------------------------------------------- /src/Resource/img/open-off.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/Resource/img/open-on.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/Resource/img/output.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/Resource/img/pic-src/hideall.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/Resource/img/pic-src/reset.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/Resource/img/pic-src/showall.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/Resource/img/reset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/src/Resource/img/reset.png -------------------------------------------------------------------------------- /src/Resource/img/send.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/Resource/img/setup.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/Resource/img/showall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/src/Resource/img/showall.png -------------------------------------------------------------------------------- /src/Resource/img/size-1.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Resource/img/size-2.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Resource/img/stop-off.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Resource/img/stop-on.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Resource/img/up.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Resource/img/y-auto.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/src/Resource/img/y-auto.png -------------------------------------------------------------------------------- /src/Resource/img/y-manual.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/src/Resource/img/y-manual.png -------------------------------------------------------------------------------- /src/build/Desktop_Qt_5_9_8_MinGW_32bit-Debug/debug/config.ini: -------------------------------------------------------------------------------- 1 | [General] 2 | port=COM8 3 | buffsize=30010 4 | watchsize=1000 5 | baud=115200 6 | 7 | [key] 8 | 0=@Variant(\0\0\0\a\0\0) 9 | 1=@Variant(\0\0\0\a\0\0) 10 | 2=@Variant(\0\0\0\a\0\0) 11 | 3=@Variant(\0\0\0\a\0\0) 12 | 4=@Variant(\0\0\0\a\0\0) 13 | 5=@Variant(\0\0\0\a\0\0) 14 | 6=@Variant(\0\0\0\a\0\0) 15 | 7=@Variant(\0\0\0\a\0\0) 16 | 8=@Variant(\0\0\0\a\0\0) 17 | 9=@Variant(\0\0\0\a\0\0) 18 | 10=@Variant(\0\0\0\a\0\0) 19 | 11=@Variant(\0\0\0\a\0\0) 20 | 12=@Variant(\0\0\0\a\0\0) 21 | 13=@Variant(\0\0\0\a\0\0) 22 | 14=@Variant(\0\0\0\a\0\0) 23 | 15=@Variant(\0\0\0\a\0\0) 24 | 16=@Variant(\0\0\0\a\0\0) 25 | 17=@Variant(\0\0\0\a\0\0) 26 | 18=@Variant(\0\0\0\a\0\0) 27 | 19=@Variant(\0\0\0\a\0\0) 28 | 20=@Variant(\0\0\0\a\0\0) 29 | 21=@Variant(\0\0\0\a\0\0) 30 | 22=@Variant(\0\0\0\a\0\0) 31 | 23=@Variant(\0\0\0\a\0\0) 32 | 24=@Variant(\0\0\0\a\0\0) 33 | 25=@Variant(\0\0\0\a\0\0) 34 | 26=@Variant(\0\0\0\a\0\0) 35 | 27=@Variant(\0\0\0\a\0\0) 36 | 28=@Variant(\0\0\0\a\0\0) 37 | 29=@Variant(\0\0\0\a\0\0) 38 | 30=@Variant(\0\0\0\a\0\0) 39 | 31=@Variant(\0\0\0\a\0\0) 40 | 32=@Variant(\0\0\0\a\0\0) 41 | 33=@Variant(\0\0\0\a\0\0) 42 | 34=@Variant(\0\0\0\a\0\0) 43 | 35=@Variant(\0\0\0\a\0\0) 44 | 36=@Variant(\0\0\0\a\0\0) 45 | 37=@Variant(\0\0\0\a\0\0) 46 | 38=@Variant(\0\0\0\a\0\0) 47 | 39=@Variant(\0\0\0\a\0\0) 48 | 40=@Variant(\0\0\0\a\0\0) 49 | 41=@Variant(\0\0\0\a\0\0) 50 | 42=@Variant(\0\0\0\a\0\0) 51 | 43=@Variant(\0\0\0\a\0\0) 52 | 44=@Variant(\0\0\0\a\0\0) 53 | 45=@Variant(\0\0\0\a\0\0) 54 | 46=@Variant(\0\0\0\a\0\0) 55 | 47=@Variant(\0\0\0\a\0\0) 56 | 48=@Variant(\0\0\0\a\0\0) 57 | 49=@Variant(\0\0\0\a\0\0) 58 | 59 | [cmd] 60 | 0=asdad123123123123asd 61 | 1= 62 | 2=123123123123ddddd123 63 | 3= 64 | 4= 65 | 5= 66 | 6= 67 | 7= 68 | 8= 69 | 9= 70 | 10= 71 | 11= 72 | 12= 73 | 13= 74 | 14= 75 | 15= 76 | 16= 77 | 17= 78 | 18= 79 | 19= 80 | 20= 81 | 21= 82 | 22= 83 | 23= 84 | 24= 85 | 25= 86 | 26= 87 | 27= 88 | 28= 89 | 29= 90 | 30= 91 | 31= 92 | 32= 93 | 33= 94 | 34= 95 | 35= 96 | 36= 97 | 37= 98 | 38= 99 | 39= 100 | 40= 101 | 41= 102 | 42= 103 | 43= 104 | 44= 105 | 45= 106 | 46= 107 | 47= 108 | 48= 109 | 49= 110 | -------------------------------------------------------------------------------- /src/cmdlist.h: -------------------------------------------------------------------------------- 1 | #ifndef CMDLIST_H 2 | #define CMDLIST_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | //按键指令的listview中的单个item的widget 10 | 11 | namespace Ui { 12 | class CmdList; 13 | } 14 | 15 | class CmdListWidget : public QWidget 16 | { 17 | Q_OBJECT 18 | public: 19 | explicit CmdListWidget(QWidget *parent = nullptr,QString key = "*", QString cmd = ""); 20 | ~CmdListWidget(); 21 | 22 | QLineEdit *keyEdit; 23 | QLineEdit *cmdEdit; 24 | QPushButton *btn; 25 | public slots: 26 | //void keyEditFinish(); 27 | void cmdEditFinish(); 28 | void btnClicked(bool checked); 29 | 30 | signals: 31 | void readySend(QString cmd); 32 | 33 | 34 | private: 35 | 36 | }; 37 | 38 | 39 | 40 | class CmdList : public QWidget 41 | { 42 | Q_OBJECT 43 | 44 | public: 45 | explicit CmdList(QWidget *parent = nullptr); 46 | void loadCmd(QString settingFile); 47 | void saveCmd(); 48 | 49 | void clearCmd(); 50 | void clearKey(); 51 | 52 | ~CmdList(); 53 | 54 | void keyPressEvent(QKeyEvent *e); 55 | protected: 56 | //bool eventFilter(QObject *watched, QEvent *event); 57 | 58 | private slots: 59 | void onReadySend(QString cmd); 60 | 61 | signals: 62 | void readySend(QString cmd); 63 | private: 64 | Ui::CmdList *ui; 65 | QSettings *settings; 66 | }; 67 | 68 | #endif // CMDLIST_H 69 | -------------------------------------------------------------------------------- /src/cmdlist.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | CmdList 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/data/ringqueue.h: -------------------------------------------------------------------------------- 1 | #ifndef RINGQUEUE_H 2 | #define RINGQUEUE_H 3 | 4 | /** 5 | * @brief The RingQueue class 6 | * 1. 这是一个环形队列 7 | * 2. 该环形队列非线程安全 8 | * 3. 当队满时, push操作会被忽略 9 | * 4. 当队空时, pop操作会返回一个默认构造的T对象(具体内容由T的默认构造函数决定) 10 | */ 11 | template 12 | class RingQueue 13 | { 14 | public: 15 | explicit RingQueue(int size = 4096) 16 | : m_size{size} 17 | , m_head{0} 18 | , m_tail{0} 19 | , m_data{new T[size]} 20 | { 21 | 22 | } 23 | 24 | 25 | ~RingQueue() 26 | { 27 | delete[] m_data; 28 | } 29 | 30 | void push(const T &value) 31 | { 32 | if(isFull()) 33 | return; 34 | 35 | m_data[m_tail] = value; 36 | m_tail = (m_tail + 1) % m_size; 37 | } 38 | 39 | T pop() //出队 40 | { 41 | if(isEmpty()) 42 | return T{}; 43 | 44 | T value = m_data[m_head]; 45 | m_head = (m_head + 1) % m_size; 46 | return value; 47 | } 48 | 49 | int size() const 50 | { 51 | return (m_tail - m_head + m_size) % m_size; 52 | } 53 | 54 | 55 | bool isEmpty() const 56 | { 57 | return m_head == m_tail; 58 | } 59 | 60 | bool isFull() const 61 | { 62 | return (m_tail + 1) % m_size == m_head; 63 | } 64 | 65 | void clear() 66 | { 67 | m_head = m_tail = 0; 68 | } 69 | 70 | 71 | //查询相对head+offset处的字符是什么, nums表示要查询多少个 72 | bool query(int offset, T *buffer, int nums) const 73 | { 74 | if(nums <= 0 || offset < 0) 75 | return false; 76 | if(offset + nums > size()) 77 | return false; 78 | 79 | for(int i = 0; i < nums; ++i) 80 | { 81 | buffer[i] = m_data[(m_head + offset + i) % m_size]; 82 | } 83 | 84 | return true; 85 | } 86 | 87 | //从head+offset开始, 检索buffer处于队列中的位置, 返回的是相对head的位置 88 | int index(int offset, T *buffer, int nums) const 89 | { 90 | if(nums <= 0 || offset < 0) 91 | return -1; 92 | if(offset + nums > size()) 93 | return -1; 94 | 95 | //检索整个队列中 和buffer 完全一致的数据相对head的位置 96 | for(int i = m_head + offset; i < size(); ++i) //m_head + offset开始,检索到队列末尾 97 | { 98 | bool isMatch = true; 99 | for(int j = 0; j < nums; ++j) //连续检索buffer的数据, 长度为nums 100 | { 101 | if(m_data[(m_head + i + j) % m_size] != buffer[j]) 102 | { 103 | isMatch = false; 104 | break; 105 | } 106 | } 107 | if(isMatch) //找到了 108 | return i - m_head; //返回相对head的位置 109 | } 110 | return -1; 111 | } 112 | 113 | 114 | private: 115 | int m_size; 116 | int m_head; 117 | int m_tail; 118 | T *m_data; 119 | }; 120 | 121 | #endif // RINGQUEUE_H 122 | -------------------------------------------------------------------------------- /src/data/yframe.cpp: -------------------------------------------------------------------------------- 1 | #include "yframe.h" 2 | 3 | YFrame::YFrame(QObject *parent) 4 | : QObject{parent} 5 | { 6 | m_timer = new QTimer(this); 7 | connect(m_timer, &QTimer::timeout, this, &YFrame::parseDataWithSignal); 8 | } 9 | 10 | YFrame::~YFrame() 11 | { 12 | 13 | } 14 | 15 | void YFrame::startAutoParse(int interval_ms) 16 | { 17 | m_timer->start(interval_ms); 18 | } 19 | 20 | void YFrame::stopAutoParse() 21 | { 22 | m_timer->stop(); 23 | } 24 | 25 | void YFrame::clear() 26 | { 27 | m_queue.clear(); 28 | } 29 | 30 | void YFrame::receiveData(const QByteArray &data) 31 | { 32 | for(int i = 0; i < data.size(); i++) 33 | { 34 | m_queue.push(data.at(i)); 35 | } 36 | } 37 | 38 | 39 | QVector YFrame::parseData() 40 | { 41 | QVector fff{}; 42 | QByteArray ad123; 43 | ad123.resize(1024); 44 | while(m_queue.size() >= 4) 45 | { 46 | m_queue.query(0,(uint8_t*)ad123.data(),1024); 47 | uint8_t head = 0; 48 | m_queue.query(0,&head,1); 49 | if(head != 0xAA) 50 | { 51 | m_queue.pop(); 52 | continue; 53 | } 54 | uint16_t len = 0; 55 | m_queue.query(2, (uint8_t*)&len, 2); 56 | if(m_queue.size() < len + 4) 57 | break; 58 | 59 | YFrame_t frame; 60 | 61 | m_queue.pop(); //删除帧头 0x55 62 | frame.id = m_queue.pop(); //取出id 63 | frame.len = len; 64 | m_queue.pop(); //删除数据长度 65 | m_queue.pop(); //删除数据长度 66 | 67 | //取出数据 68 | for(int i = 0; i < len; i++) 69 | { 70 | frame.data.append(m_queue.pop()); 71 | } 72 | fff.append(frame); 73 | } 74 | return fff; 75 | } 76 | 77 | 78 | void YFrame::parseDataWithSignal() 79 | { 80 | QVector frames = parseData(); 81 | if(frames.size() > 0) 82 | emit frameReceived(frames); 83 | } 84 | 85 | QByteArray YFrame::packData(const YFrame_t &frame) 86 | { 87 | QByteArray data; 88 | data.append(0xAA); 89 | data.append(frame.id); 90 | data.append(frame.len & 0xFF); 91 | data.append((frame.len >> 8) & 0xFF); 92 | data.append(frame.data); 93 | return data; 94 | } 95 | 96 | QByteArray YFrame::packData(uint8_t id, const QByteArray &data) 97 | { 98 | YFrame_t frame; 99 | frame.id = id; 100 | frame.len = data.size(); 101 | frame.data = data; 102 | return packData(frame); 103 | } 104 | 105 | QByteArray YFrame::packData(uint8_t id, const QString &data) 106 | { 107 | YFrame_t frame; 108 | frame.id = id; 109 | frame.len = data.size(); 110 | frame.data = data.toUtf8(); 111 | return packData(frame); 112 | } 113 | 114 | QByteArray YFrame::packData(uint8_t id, uint8_t cmd) 115 | { 116 | QByteArray data; 117 | data.append(cmd); 118 | return packData(id, data); 119 | } 120 | 121 | QVector YFrame::byteArrayToFloat(const QByteArray &data) 122 | { 123 | QVector result; 124 | for(int i = 0; i < data.size(); i += 4) 125 | { 126 | float value; 127 | memcpy(&value, data.data() + i, 4); 128 | result.append(value); 129 | } 130 | return result; 131 | } 132 | 133 | QVector YFrame::byteArrayToQString(const QByteArray &data) 134 | { 135 | QVector result; 136 | QByteArrayList dataList = data.split(','); 137 | for(int i =0;i 5 | #include 6 | #include 7 | #include "data/ringqueue.h" 8 | 9 | 10 | enum{ 11 | YPLOT_ID_PLOTNAME = 0x01, ///< 向上位机发送plot的name 12 | YPLOT_ID_PLOT = 0x02, ///< 向上位机发送plot数据 13 | YPLOT_ID_INFO = 0x03, ///< 向上位机发送info信息 14 | YPLOT_ID_DEBUG = 0x04, ///< 向上位机发送debug信息 15 | YPLOT_ID_WARNING = 0x05, ///< 向上位机发送warning信息 16 | 17 | YPLOT_ID_SENDCMD = 0x10, /// < 接收上位机下发的命令 18 | }; 19 | 20 | typedef struct _YFrameType 21 | { 22 | uint8_t id; 23 | uint16_t len; 24 | QByteArray data; 25 | 26 | //构造函数 27 | _YFrameType() 28 | : id{0} 29 | , len{0} 30 | { 31 | 32 | } 33 | } YFrame_t; 34 | 35 | /** 36 | * @brief The YFrame class 数据格式为 37 | * 0x55 id(u8) len(u16) data[0] data[1] ... data[len-1] 38 | */ 39 | class YFrame : public QObject 40 | { 41 | Q_OBJECT 42 | public: 43 | 44 | 45 | explicit YFrame(QObject *parent = nullptr); 46 | ~YFrame(); 47 | void startAutoParse(int interval_ms = 10); 48 | void stopAutoParse(); 49 | 50 | void clear(); 51 | QVector parseData(); 52 | void parseDataWithSignal(); 53 | 54 | static QByteArray packData(const YFrame_t &frame); 55 | static QByteArray packData(uint8_t id, const QByteArray &data = {}); 56 | static QByteArray packData(uint8_t id, const QString &data = {}); 57 | static QByteArray packData(uint8_t id, uint8_t cmd); 58 | 59 | static QVector byteArrayToFloat(const QByteArray &data); 60 | //以,分割的字符串转换为QVector 61 | static QVector byteArrayToQString(const QByteArray &data); 62 | public slots: 63 | void receiveData(const QByteArray &data); 64 | 65 | signals: 66 | //不使用引用, 方便可以在不同线程中使用 67 | void frameReceived(QVector frame); 68 | 69 | private: 70 | QTimer *m_timer{nullptr}; 71 | RingQueue m_queue{1024*1024*10}; //10M缓存 72 | 73 | }; 74 | 75 | #endif // YFRAME_H 76 | -------------------------------------------------------------------------------- /src/install.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/src/install.ico -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "widget.h" 2 | #include 3 | 4 | #include "setupmanage.h" 5 | 6 | int main(int argc, char *argv[]) 7 | { 8 | QApplication a(argc, argv); 9 | Widget w; 10 | w.show(); 11 | w.move ((QApplication::desktop()->width() - w.width())/2 12 | ,(QApplication::desktop()->height() - w.height())/2); 13 | QFont f("楷体",12); 14 | a.setFont(f); 15 | 16 | SetupManage setup; 17 | setup.show(); 18 | 19 | 20 | return a.exec(); 21 | } 22 | -------------------------------------------------------------------------------- /src/myscorllbar.cpp: -------------------------------------------------------------------------------- 1 | #include "myscorllbar.h" 2 | #include 3 | 4 | MyScorllBar::MyScorllBar(QScrollBar *scrollbar, QObject *parent) 5 | : QObject{parent} 6 | , m_scrollBar{scrollbar} 7 | { 8 | connect(m_scrollBar, &QScrollBar::sliderMoved, this, &MyScorllBar::slot_sliderMoved); 9 | connect(m_scrollBar, &QScrollBar::sliderPressed,this, [this](){isPressed = true;}); 10 | connect(m_scrollBar, &QScrollBar::sliderReleased,this, [this](){isPressed = false;}); 11 | } 12 | 13 | void MyScorllBar::setPageRange(int min, int max) 14 | { 15 | if(isPressed) 16 | return; 17 | m_valueMin = min; 18 | m_valueMax = max; 19 | int w = 0; 20 | //占满 21 | if(m_valueMin <= m_rangeMin && m_valueMax >= m_rangeMax){ 22 | m_scrollBar->setRange(m_rangeMin,m_rangeMax); 23 | m_scrollBar->setPageStep(m_rangeMax - m_rangeMin); 24 | m_scrollBar->setValue(m_rangeMin); 25 | } else if(m_valueMin < m_rangeMin){ //左边超出边界 26 | if(m_valueMax < m_rangeMin){ 27 | w = (m_rangeMax - m_rangeMin) /10; 28 | m_scrollBar->setRange(m_rangeMin,m_rangeMax-w); 29 | m_scrollBar->setPageStep(w); 30 | }else{ 31 | w = m_valueMax - m_rangeMin; 32 | m_scrollBar->setRange(m_valueMin,m_rangeMax-w); 33 | m_scrollBar->setPageStep(w); 34 | } 35 | m_scrollBar->setValue(m_rangeMin); 36 | }else if(m_valueMax > m_rangeMax){ //右边超出边界 37 | if(m_valueMin > m_rangeMax){ 38 | w = (m_rangeMax - m_rangeMin) /10; 39 | m_scrollBar->setRange(m_rangeMin,m_rangeMax-w); 40 | m_scrollBar->setPageStep(w); 41 | }else{ 42 | w = m_rangeMax - m_valueMin; 43 | m_scrollBar->setRange(m_valueMin,m_rangeMax-w); 44 | m_scrollBar->setPageStep(w); 45 | } 46 | m_scrollBar->setValue(m_rangeMax-w); 47 | } 48 | //PageStep = 视窗宽度 49 | //value = 视窗lower 50 | //value+PageSetp = 视窗upper 51 | w = m_valueMax - m_valueMin; 52 | m_scrollBar->setRange(m_rangeMin, m_rangeMax - w); 53 | m_scrollBar->setPageStep(w); 54 | m_scrollBar->setValue(m_valueMin); 55 | } 56 | 57 | 58 | void MyScorllBar::setRange(int min, int max) 59 | { 60 | if(isPressed) 61 | return; 62 | int width = m_valueMax - m_valueMin; 63 | m_rangeMin = min; 64 | m_rangeMax = max; 65 | 66 | m_scrollBar->setRange(m_rangeMin, m_rangeMax - width); //真实范围是最大值减去page值 67 | } 68 | 69 | 70 | void MyScorllBar::slot_sliderMoved(int position) 71 | { 72 | Q_UNUSED(position); 73 | int value = m_scrollBar->value(); 74 | emit sliderMoved(value , value+m_scrollBar->pageStep()); 75 | } 76 | -------------------------------------------------------------------------------- /src/myscorllbar.h: -------------------------------------------------------------------------------- 1 | #ifndef MYSCORLLBAR_H 2 | #define MYSCORLLBAR_H 3 | 4 | #include 5 | #include 6 | 7 | class MyScorllBar : public QObject 8 | { 9 | Q_OBJECT 10 | public: 11 | explicit MyScorllBar(QScrollBar *scrollbar = nullptr,QObject *parent = nullptr); 12 | 13 | /** 14 | * @brief setPageRange 设置当前窗口显示的范围 15 | * @param min watch窗口的Lower 16 | * @param max watch窗口的Upper 17 | * @note 通过换算之后, 滑动条范围为 (0 , rangMax), value在这个范围中 18 | */ 19 | void setPageRange(int min, int max); 20 | 21 | /** 22 | * @brief setRange 设置滚动条的总范围 23 | * @param min 0 24 | * @param max bufferSize的大小 25 | */ 26 | void setRange(int min, int max); 27 | 28 | Q_SIGNALS: 29 | void sliderMoved(int min,int max); 30 | 31 | 32 | private Q_SLOTS: 33 | /** 34 | * @brief slot_sliderMoved 当滚动条的值发生改变时发出该信号. 35 | * @param value 36 | */ 37 | void slot_sliderMoved(int position); 38 | 39 | private: 40 | QScrollBar *m_scrollBar; 41 | int m_rangeMin = 0; 42 | int m_rangeMax = 100; 43 | 44 | int m_valueMin = 0; 45 | int m_valueMax = 50; 46 | 47 | bool isPressed = false; 48 | }; 49 | 50 | #endif // MYSCORLLBAR_H 51 | -------------------------------------------------------------------------------- /src/mytimer.cpp: -------------------------------------------------------------------------------- 1 | #include "mytimer.h" 2 | 3 | -------------------------------------------------------------------------------- /src/mytimer.h: -------------------------------------------------------------------------------- 1 | #ifndef MYTIMER_H 2 | #define MYTIMER_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class TimerThread : public QThread { 10 | Q_OBJECT 11 | 12 | public: 13 | TimerThread() { 14 | moveToThread(this); 15 | start(); 16 | } 17 | 18 | static TimerThread& instance() { 19 | static TimerThread instance; 20 | return instance; 21 | } 22 | 23 | protected: 24 | void run() override { 25 | exec(); 26 | } 27 | }; 28 | 29 | 30 | class MyTimer : public QObject 31 | { 32 | Q_OBJECT 33 | public: 34 | explicit MyTimer(QObject *parent = nullptr) 35 | : QObject(parent), 36 | isStart(false){ 37 | timer = new QTimer(this); 38 | connect(timer, &QTimer::timeout, this, &MyTimer::update); 39 | timer->moveToThread(&TimerThread::instance()); 40 | } 41 | 42 | ~MyTimer(){ 43 | timer->deleteLater(); 44 | } 45 | 46 | void start(int interval){ 47 | QMetaObject::invokeMethod(timer, "start", Qt::QueuedConnection, Q_ARG(int, interval)); 48 | isStart = true; 49 | } 50 | 51 | void stop(){ 52 | QMetaObject::invokeMethod(timer, "stop", Qt::QueuedConnection); 53 | isStart = false; 54 | } 55 | 56 | bool isActive(){ 57 | return isStart; 58 | } 59 | 60 | 61 | 62 | 63 | private slots: 64 | //定时器在子线程中触发timeout之后, 会在主线程调用update,然后再发出mytimer的timeout信号, 所以没有意义 65 | void update(){ 66 | qDebug() << "QTimer::update()" << QThread::currentThread(); 67 | emit timeout(); 68 | } 69 | 70 | signals: 71 | void timeout(); 72 | 73 | 74 | 75 | private: 76 | QTimer *timer; 77 | bool isStart; 78 | }; 79 | 80 | #endif // MYTIMER_H 81 | -------------------------------------------------------------------------------- /src/plot/drawplot.h: -------------------------------------------------------------------------------- 1 | #ifndef DRAWPLOT_H 2 | #define DRAWPLOT_H 3 | 4 | #include 5 | #include 6 | #include "qcustomplot.h" 7 | #include 8 | #include 9 | #include "mybuoy.h" 10 | 11 | 12 | class MouseDrag; 13 | 14 | class drawPlot: public QCustomPlot 15 | { 16 | Q_OBJECT 17 | public: 18 | drawPlot(QWidget *parent = 0); 19 | 20 | void initColor(int i); //i控制使用几号方案 21 | QColor getColor(int i); //获取颜色方案中的颜色值 22 | QString getName(int i); 23 | double getXIndex(); //获取当前x轴索引值 24 | double getHeadXIndex(); //获取显示的第一个点的X索引值 25 | double increaseXIndex(); //增加x轴索引值.并返回增加后的值 26 | void resetXIndex(); //复位x轴索引值 27 | 28 | void resetXRange(); 29 | void resetYRange(); 30 | void resetXYRange(); //复位视图 31 | 32 | void setAutoXRange(bool enable); //是否使能X轴自动调整 33 | void autoXRange(void); //自动调整X轴范围 34 | void setAutoYRange(bool enable); //是否使能Y轴自动调整 35 | void autoYRange(void); //自动调整Y轴范围 36 | void setXRange(int lower, int upper); //手动设置X的范围. 触发自动调整会覆盖手动设置的值. 37 | 38 | void setRefreshInterval(int interval_ms); //设置刷新间隔 39 | 40 | void adjustPlotNums(int chs); //调整Y轴数量 41 | 42 | void clearAllPlot(); //清除曲线并复位视图 43 | 44 | void addPoint(QVector> newdata); //添加数据点 45 | 46 | void setPlotName(QVector name); //设置曲线名称 47 | 48 | void setBuffSize(int t);//设置数据缓存区时间跨度 49 | void setWindSize(int t);//设置可视区域时间跨度 50 | int getBuffSize(){return m_buffSize;} //获取数据缓存区时间跨度 51 | int getWindSize(){return m_watchSize;} //获取可视区域时间跨度 52 | 53 | void setPlotWidth(int i);//设置曲线宽度 54 | 55 | void showAllPlot(); //显示所有曲线 56 | void hideAllPlot(); //隐藏所有曲线 57 | 58 | void moursePress(Qt::MouseButton but,QPoint point); 59 | void mouseDragStart(Qt::MouseButton but,QPoint point); 60 | void mouseDragMove(Qt::MouseButton but,QPoint point); 61 | void mouseDragEnd(Qt::MouseButton but,QPoint point); 62 | void mouseClick(Qt::MouseButton but,QPoint point); 63 | void mouseDoubleClick(Qt::MouseButton but,QPoint point); 64 | 65 | protected: 66 | void mousePressEvent(QMouseEvent *event) ; 67 | void mouseMoveEvent(QMouseEvent *event) ; 68 | void mouseReleaseEvent(QMouseEvent *event) ; 69 | void mouseDoubleClickEvent(QMouseEvent *event); 70 | void wheelEvent(QWheelEvent *event); 71 | 72 | private slots: 73 | 74 | void selectionChanged(); 75 | void onLegendClick (QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event); 76 | void onLegendDoubleClick (QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event); 77 | 78 | void onPlottableClick (QCPAbstractPlottable *plottable, int dataIndex, QMouseEvent *event); 79 | void onPlottableDoubleClick (QCPAbstractPlottable *plottable, int dataIndex, QMouseEvent *event); 80 | 81 | void refreshView(); 82 | 83 | signals: 84 | //x的可见范围在buffer中的位置出现变化 85 | void xVisibleRangeChanged(double lower, double upper); 86 | private: 87 | //x轴索引值记录 88 | double xIndexCount = 0; 89 | double xHeadIndexCount = 0; 90 | 91 | bool stopFlag = 0; 92 | int m_buffSize = 120; //数据缓存区时间跨度,单位 93 | int m_watchSize = 30; //可视区域时间跨度,单位 94 | 95 | QVectorm_plot; 96 | QVector m_name; 97 | QVector m_color; 98 | 99 | 100 | bool m_autoMoveX = false; //false ,不能自动动 101 | bool m_autoMoveY = false; //false 为不允许自动,允许手动 102 | 103 | MouseDrag *mouseDrag; 104 | bool m_isDrag = false; //x处于拖拽中 105 | bool m_isRoom = false; //是否处于放大缩小状态 106 | 107 | 108 | //刷新显示的定时器 109 | QTimer *refreshTimer; 110 | double lastXAxisLower = 0; 111 | double lastXAxisUpper = 0; 112 | 113 | MyBuoy *buoy = nullptr; 114 | 115 | }; 116 | 117 | 118 | 119 | 120 | 121 | //识别鼠标拖动事件 122 | class MouseDrag : public QObject 123 | { 124 | Q_OBJECT 125 | public: 126 | MouseDrag(QObject *parent = nullptr); 127 | ~MouseDrag(); 128 | void press(QMouseEvent *event); 129 | void move(QMouseEvent *event); 130 | void release(QMouseEvent *event); 131 | void doubleClick(QMouseEvent *event); 132 | 133 | signals: 134 | void pressed(Qt::MouseButton but, QPoint point); 135 | void clicked(Qt::MouseButton but, QPoint point); 136 | void startDrag(Qt::MouseButton but, QPoint point); 137 | void endDrag(Qt::MouseButton but, QPoint point); 138 | void drag(Qt::MouseButton but, QPoint point); 139 | void doubleClicked(Qt::MouseButton but, QPoint point); 140 | private: 141 | //左键 142 | bool isPress = false; 143 | bool isDrag = false; 144 | QPoint pressPoint; 145 | QPoint movePoint; 146 | QPoint releasePoint; 147 | 148 | //右键 149 | bool isPressR = false; 150 | bool isDragR = false; 151 | QPoint pressPointR; 152 | QPoint movePointR; 153 | QPoint releasePointR; 154 | 155 | 156 | 157 | const int checkDragDirectionPix = 5; 158 | }; 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | #endif // DRAWPLOT_H 167 | -------------------------------------------------------------------------------- /src/plot/mybuoy.cpp: -------------------------------------------------------------------------------- 1 | #include "mybuoy.h" 2 | 3 | MyBuoy::MyBuoy(QCustomPlot *plot) 4 | { 5 | 6 | qcp = plot; 7 | 8 | label = new QLabel(qcp); 9 | // 设置 QLabel 的背景为半透明的白色 10 | label->setStyleSheet("background-color: rgba(255, 255, 255, 255);border: 1px solid black;"); 11 | label->setFont(QFont("Helvetica",9)); 12 | // label->setMargin(-5); 13 | label->setVisible(false); 14 | label->setAttribute(Qt::WA_TransparentForMouseEvents); //鼠标事件传递 15 | 16 | keyLine = new VerticalLine(qcp); 17 | keyLine->setWidth(2); 18 | keyLine->setLineStyle(Qt::DotLine); 19 | keyLine->setVisible(true); 20 | keyLine->setVisible(false); 21 | keyLine->setAttribute(Qt::WA_TransparentForMouseEvents); //鼠标事件传递 22 | } 23 | 24 | MyBuoy::~MyBuoy() 25 | { 26 | 27 | } 28 | 29 | 30 | void MyBuoy::setEnable(QCPGraph *plot, bool en) 31 | { 32 | syncGraphNums(); 33 | for(int i = 0; i< qcp->graphCount();i++){ 34 | if(qcp->graph(i) == plot){ 35 | isShow.replace(i,en); 36 | return; 37 | } 38 | } 39 | } 40 | 41 | void MyBuoy::setAllEnable(bool en) 42 | { 43 | syncGraphNums(); 44 | for(int i = 0;igraphCount();i++){ 54 | if(qcp->graph(i) == plot){ 55 | return isShow.at(i); 56 | } 57 | } 58 | return false; 59 | } 60 | 61 | void MyBuoy::refresh() 62 | { 63 | if(enshow == false){ 64 | keyLine->setVisible(false); 65 | label->setVisible(false); 66 | return; 67 | } 68 | // 检测鼠标是否在当前窗口 69 | if (!qcp->underMouse()) { 70 | keyLine->setVisible(false); 71 | label->setVisible(false); 72 | return; 73 | } 74 | 75 | if(qcp->graphCount() < 1) 76 | return; 77 | 78 | syncGraphNums(); 79 | 80 | //设置显示内容 81 | clearText(); 82 | 83 | int showCount = 0; 84 | 85 | double xKey = qcp->axisRect(0)->axis(QCPAxis::atBottom,0)->pixelToCoord(pixelPos.x()); //X的值不是整数! 86 | qint64 intKey = qRound64(xKey); 87 | //qDebug()< 0) 91 | xIndex = qcp->graph(0)->findBegin(xKey,true); //遍历查找 = xKey的索引或者略小于xKey的索引. 如果没有等于或略小于xKey的值, 将会返回0 92 | else 93 | xIndex = qcp->graph(0)->findBegin(xKey,false); //遍历查找 = xKey的索引或者略大于xKey的索引. 如果没有等于或略大于xKey的值, 将会返回0 94 | // qDebug()<graphCount();i++){ 101 | if(isShow.at(i) == false) 102 | continue; 103 | showCount++; 104 | QString name = qcp->graph(i)->name(); 105 | 106 | int index = name.lastIndexOf(".", name.lastIndexOf(".") - 1); // get the index of the second last dot 107 | if (index != -1) { 108 | name.remove(index, name.length() - index); // remove everything after the second last dot 109 | } 110 | if(xIndex >= qcp->graph(i)->dataCount() -1){ 111 | xIndex = qcp->graph(i)->dataCount() -1; 112 | } 113 | if(xIndex <= 0){ 114 | xIndex = 0; 115 | } 116 | 117 | double value = qcp->graph(i)->data()->at(xIndex)->value; //这个value的问题. 118 | //qDebug()<<"xIndex = "<graph(i)->pen().color()); //添加值到label 121 | 122 | if(nameMax.size() < name.size()){ 123 | nameMax = name; 124 | } 125 | } 126 | QFontMetrics fontm(label->font()); 127 | nameMax += "xx"; //字符占位,增加宽度 128 | int wid = fontm.width(nameMax); 129 | int hig = int((fontm.height() + fontm.height()*0.5) * (showCount+0.5)); 130 | label->resize(wid,hig); 131 | 132 | QPoint pos = pixelPos.toPoint(); 133 | 134 | keyLine->setLength(qcp->rect().height()); 135 | keyLine->setPosition(pos.x(),0); 136 | 137 | label->move(pos.x() + 20,pos.y() + 20); 138 | 139 | keyLine->setVisible(true); 140 | label->setVisible(true); 141 | } 142 | 143 | void MyBuoy::syncGraphNums() 144 | { 145 | int nums = isShow.size() - qcp->graphCount(); 146 | if(isShow.size() != qcp->graphCount()){ 147 | // qDebug()<<"nums"<graphCount()); 149 | if(nums < 0){ 150 | for(int i =0;i< isShow.length();i++){ 151 | isShow[i] = true; 152 | // qDebug()< 5 | #include "qcustomplot.h" 6 | #include "verticalline.h" 7 | 8 | 9 | /** 10 | * @brief The Buoy class 11 | * 这个类应该是和RectAxis关联的,因为图元是绘制在这个窗口上面的. 12 | * 浮标类 13 | * 1. 添加删除内容,传递颜色和名称 14 | * 2. 传入xy的位置 15 | * 2. 输入QVector的数据组,来显示内容 16 | * 3. 设置显示位置 17 | * 4. 控制是否显示 18 | */ 19 | class MyBuoy 20 | { 21 | public: 22 | MyBuoy(QCustomPlot *plot); 23 | ~MyBuoy(); 24 | 25 | void setEnable(QCPGraph *plot,bool en); 26 | void setAllEnable(bool en); 27 | bool isEnable(QCPGraph *plot); 28 | 29 | void enableShow(bool en){enshow = en;} 30 | void setFont(QFont font){label->setFont(font);} 31 | /** 32 | * @brief setPixelPos 设置游标的位置 33 | * @param pixel 屏幕上的像素点 34 | */ 35 | void setPixelPos(QPointF pixel){pixelPos = pixel;} 36 | 37 | void refresh(); 38 | protected: 39 | void syncGraphNums(); 40 | 41 | void clearText(){ 42 | label->clear(); 43 | } 44 | void appendText(QString text,QColor color){ 45 | QString labelText = label->text(); 46 | labelText += QString("

%2

").arg(color.name()).arg(text); 47 | label->setText(labelText); 48 | } 49 | 50 | private: 51 | QCustomPlot *qcp; 52 | 53 | int lastAxisrect = 0; //当前所在矩形视窗 54 | VerticalLine *keyLine; 55 | QLabel *label; 56 | 57 | bool enshow = true; 58 | QPointF pixelPos = QPointF(0,0); 59 | 60 | 61 | QVector isShow; 62 | }; 63 | 64 | #endif // MYBUOY_H 65 | -------------------------------------------------------------------------------- /src/plot/plotdemo.cpp: -------------------------------------------------------------------------------- 1 | #include "plotdemo.h" 2 | #include 3 | #include "data/yframe.h" 4 | 5 | PlotDemo::PlotDemo(QObject *parent) 6 | : QObject(parent) 7 | { 8 | timer = new QTimer(this); 9 | connect(timer, &QTimer::timeout, this, &PlotDemo::update); 10 | } 11 | 12 | void PlotDemo::start(int interval_ms) 13 | { 14 | timer->start(interval_ms); 15 | } 16 | 17 | void PlotDemo::stop() 18 | { 19 | timer->stop(); 20 | } 21 | 22 | 23 | 24 | void PlotDemo::update() 25 | { 26 | m_count += 0.01; 27 | for(int i = 0;i<6;++i) 28 | { 29 | m_ch[i] = qSin(m_count + i*0.5) * 100; 30 | if(i % 2 == 0){ 31 | m_ch[i] = m_ch[i] * 3; 32 | } 33 | } 34 | QByteArray data; 35 | data.resize(24); 36 | //拷贝数据 37 | memcpy(data.data(), m_ch, 24); 38 | QByteArray sendbuff = YFrame::packData(YPLOT_ID_PLOT, data); 39 | emit readyRead(sendbuff); 40 | } 41 | -------------------------------------------------------------------------------- /src/plot/plotdemo.h: -------------------------------------------------------------------------------- 1 | #ifndef PLOTDEMO_H 2 | #define PLOTDEMO_H 3 | #include 4 | #include 5 | class PlotDemo: public QObject 6 | { 7 | Q_OBJECT 8 | public: 9 | PlotDemo(QObject *parent = nullptr); 10 | void start(int interval_ms = 3); 11 | void stop(); 12 | bool isStart() { return timer->isActive(); } 13 | 14 | private slots: 15 | void update(); 16 | signals: 17 | void readyRead(QByteArray data); 18 | private: 19 | QTimer *timer; 20 | 21 | float m_ch[6]; 22 | double m_count = 0; 23 | }; 24 | 25 | #endif // PLOTDEMO_H 26 | 27 | -------------------------------------------------------------------------------- /src/plot/verticalline.cpp: -------------------------------------------------------------------------------- 1 | // verticalline.cpp 2 | #include "verticalline.h" 3 | #include 4 | 5 | VerticalLine::VerticalLine(QWidget* parent) : QWidget(parent) { 6 | length = 100; 7 | width = 1; 8 | color = Qt::black; 9 | style = Qt::SolidLine; 10 | visible = true; 11 | } 12 | 13 | void VerticalLine::setLength(int newLength) { 14 | length = newLength; 15 | setFixedSize(width, length); 16 | update(); 17 | } 18 | 19 | void VerticalLine::setWidth(int newWidth) { 20 | width = newWidth; 21 | setFixedSize(width, length); 22 | update(); 23 | } 24 | 25 | void VerticalLine::setColor(QColor newColor) { 26 | color = newColor; 27 | update(); 28 | } 29 | 30 | void VerticalLine::setLineStyle(Qt::PenStyle newStyle) { 31 | style = newStyle; 32 | update(); 33 | } 34 | 35 | void VerticalLine::setPosition(int x, int y) { 36 | move(x, y); 37 | } 38 | 39 | void VerticalLine::paintEvent(QPaintEvent* event) { 40 | Q_UNUSED(event); 41 | if (visible) { 42 | QPainter painter(this); 43 | QPen pen; 44 | pen.setColor(color); 45 | pen.setWidth(width); 46 | pen.setStyle(style); 47 | painter.setPen(pen); 48 | painter.drawLine(QPoint(0, 0), QPoint(0, length)); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/plot/verticalline.h: -------------------------------------------------------------------------------- 1 | #ifndef VERTICALLINE_H 2 | #define VERTICALLINE_H 3 | 4 | #include 5 | 6 | // verticalline.h 7 | #include 8 | #include 9 | 10 | class VerticalLine : public QWidget { 11 | Q_OBJECT 12 | 13 | public: 14 | VerticalLine(QWidget* parent = nullptr); 15 | void setLength(int length); 16 | void setWidth(int width); 17 | void setColor(QColor color); 18 | void setLineStyle(Qt::PenStyle style); 19 | 20 | void setPosition(int x, int y); 21 | 22 | protected: 23 | void paintEvent(QPaintEvent* event) override; 24 | 25 | private: 26 | int length; 27 | int width; 28 | QColor color; 29 | Qt::PenStyle style; 30 | bool visible; 31 | }; 32 | 33 | 34 | 35 | 36 | #endif // VERTICALLINE_H 37 | -------------------------------------------------------------------------------- /src/qframeless/qframeless.pri: -------------------------------------------------------------------------------- 1 | HEADERS += \ 2 | $$PWD/qframelessdialog.h \ 3 | $$PWD/qframelesshelper.h \ 4 | $$PWD/qframelessmainwindow.h \ 5 | $$PWD/qframelesswidget.h \ 6 | $$PWD/qshadowhelper.h 7 | 8 | SOURCES += \ 9 | $$PWD/qframelessdialog.cpp \ 10 | $$PWD/qframelesshelper.cpp \ 11 | $$PWD/qframelessmainwindow.cpp \ 12 | $$PWD/qframelesswidget.cpp \ 13 | $$PWD/qshadowhelper.cpp 14 | -------------------------------------------------------------------------------- /src/qframeless/qframelessdialog.cpp: -------------------------------------------------------------------------------- 1 | #include "qframelessdialog.h" 2 | 3 | QFramelessDialog::QFramelessDialog(QWidget *parent, bool resizeEnable, bool shadowBorder, bool winNativeEvent) 4 | : QDialog(parent) 5 | , m_framelessHelper(0) 6 | { 7 | m_framelessHelper = new QFramelessHelper(this, resizeEnable, shadowBorder, winNativeEvent, this); 8 | } 9 | 10 | QFramelessHelper *QFramelessDialog::framelessHelper() 11 | { 12 | return m_framelessHelper; 13 | } 14 | 15 | void QFramelessDialog::paintEvent(QPaintEvent *e) 16 | { 17 | if (m_framelessHelper == 0) 18 | return; 19 | m_framelessHelper->paintEvent(e); 20 | } 21 | 22 | #if (QT_VERSION >= QT_VERSION_CHECK(6,0,0)) 23 | bool QFramelessDialog::nativeEvent(const QByteArray &eventType, void *message, qintptr *result) 24 | #else 25 | bool QFramelessDialog::nativeEvent(const QByteArray &eventType, void *message, long *result) 26 | #endif 27 | { 28 | if (m_framelessHelper == 0) 29 | return false; 30 | return m_framelessHelper->nativeEvent(eventType, message, result); 31 | } 32 | 33 | #if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) 34 | #ifdef Q_OS_WIN 35 | bool QFramelessDialog::winEvent(MSG *message, long *result) 36 | { 37 | return nativeEvent("windows_generic_MSG", message, result); 38 | } 39 | #endif 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /src/qframeless/qframelessdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef QFRAMELESSDIALOG_H 2 | #define QFRAMELESSDIALOG_H 3 | 4 | #include 5 | #include "qframelesshelper.h" 6 | 7 | class QFramelessHelper; 8 | class QFramelessDialog : public QDialog 9 | { 10 | Q_OBJECT 11 | public: 12 | explicit QFramelessDialog(QWidget *parent = 0, bool resizeEnable = false, bool shadowBorder = true, bool winNativeEvent = true); 13 | 14 | QFramelessHelper *framelessHelper(); 15 | 16 | protected: 17 | //拦截系统事件用于修复系统休眠后唤醒程序的BUG 18 | #if (QT_VERSION >= QT_VERSION_CHECK(6,0,0)) 19 | bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result); 20 | #else 21 | bool nativeEvent(const QByteArray &eventType, void *message, long *result); 22 | #endif 23 | 24 | //Qt4的写法 25 | #if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) 26 | #ifdef Q_OS_WIN 27 | bool winEvent(MSG *message, long *result); 28 | #endif 29 | #endif 30 | 31 | virtual void paintEvent(QPaintEvent *e); 32 | 33 | private: 34 | QFramelessHelper * m_framelessHelper; 35 | }; 36 | 37 | #endif // FRAMELESSDIALOG_H 38 | -------------------------------------------------------------------------------- /src/qframeless/qframelesshelper.h: -------------------------------------------------------------------------------- 1 | #ifndef QFRAMELESSHELPER_H 2 | #define QFRAMELESSHELPER_H 3 | 4 | #include 5 | #include 6 | 7 | class QDrawShadowHelper; 8 | class QFramelessHelper : public QObject 9 | { 10 | Q_OBJECT 11 | public: 12 | explicit QFramelessHelper(QWidget* w, bool resizeEnable, bool shadowBorder = true, bool winNativeEvent = true, QObject *parent = 0); 13 | 14 | protected: 15 | //窗体显示的时候触发 16 | void doShowEvent(QEvent *event); 17 | 18 | //事件过滤器识别拖动拉伸等 19 | void doWindowStateChange(QEvent *event); 20 | void doResizeEvent(QEvent *event); 21 | bool eventFilter(QObject *watched, QEvent *event); 22 | 23 | //更新自绘阴影边框显示状态 24 | void updateDrawShadowState(); 25 | public: 26 | //拦截系统事件用于修复系统休眠后唤醒程序的BUG 27 | #if (QT_VERSION >= QT_VERSION_CHECK(6,0,0)) 28 | bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result); 29 | #else 30 | bool nativeEvent(const QByteArray &eventType, void *message, long *result); 31 | #endif 32 | 33 | void paintEvent(QPaintEvent *e); 34 | 35 | private: 36 | QWidget *m_widget; 37 | //边距+可移动+可拉伸+阴影边框 38 | int m_padding; 39 | bool m_moveEnable; 40 | bool m_resizeEnable; 41 | bool m_shadowBorder; 42 | //通过边框进行resize 43 | bool m_borderResizeEnable; 44 | 45 | //标题栏控件 46 | QWidget *m_titleBar; 47 | 48 | //鼠标是否按下+按下坐标+按下时窗体区域 49 | bool m_mousePressed; 50 | QPoint m_mousePoint; 51 | QRect m_mouseRect; 52 | 53 | //鼠标是否按下某个区域+按下区域的大小 54 | //依次为 左侧+右侧+上侧+下侧+左上侧+右上侧+左下侧+右下侧 55 | QList m_pressedArea; 56 | QList m_pressedRect; 57 | 58 | //记录是否最小化 59 | bool m_isMin; 60 | //存储窗体默认的属性 61 | Qt::WindowFlags m_flags; 62 | 63 | //windows是否采用NativeEvent进行Resize、阴影边框,linux下该值为false 64 | bool m_winNativeEvent; 65 | 66 | //自绘制阴影边框 67 | QDrawShadowHelper* m_drawShadow; 68 | 69 | public: 70 | //设置边距+可拖动+可拉伸 71 | void setPadding(int padding); 72 | void setMoveEnable(bool moveEnable); 73 | void setResizeEnable(bool resizeEnable); 74 | 75 | //设置标题栏窗体 76 | void setTitleBar(QWidget *titleBar); 77 | 78 | bool isMaximized(); 79 | public slots: 80 | void showMinimized(); 81 | void showMaximized(); 82 | void showNormal(); 83 | void switchMaximizedNormal(); 84 | signals: 85 | void maximizedChanged(bool max); 86 | }; 87 | 88 | #endif // QFRAMELESSHELPER_H 89 | -------------------------------------------------------------------------------- /src/qframeless/qframelessmainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "qframelessmainwindow.h" 2 | 3 | QFramelessMainWindow::QFramelessMainWindow(QWidget *parent, bool resizeEnable, bool shadowBorder, bool winNativeEvent) 4 | : QMainWindow(parent) 5 | , m_framelessHelper(0) 6 | { 7 | m_framelessHelper = new QFramelessHelper(this, resizeEnable, shadowBorder, winNativeEvent, this); 8 | } 9 | 10 | QFramelessHelper *QFramelessMainWindow::framelessHelper() 11 | { 12 | return m_framelessHelper; 13 | } 14 | 15 | void QFramelessMainWindow::paintEvent(QPaintEvent *e) 16 | { 17 | if (m_framelessHelper == 0) 18 | return; 19 | m_framelessHelper->paintEvent(e); 20 | } 21 | 22 | #if (QT_VERSION >= QT_VERSION_CHECK(6,0,0)) 23 | bool QFramelessMainWindow::nativeEvent(const QByteArray &eventType, void *message, qintptr *result) 24 | #else 25 | bool QFramelessMainWindow::nativeEvent(const QByteArray &eventType, void *message, long *result) 26 | #endif 27 | { 28 | if (m_framelessHelper == 0) 29 | return false; 30 | return m_framelessHelper->nativeEvent(eventType, message, result); 31 | } 32 | 33 | #if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) 34 | #ifdef Q_OS_WIN 35 | bool QFramelessMainWindow::winEvent(MSG *message, long *result) 36 | { 37 | return nativeEvent("windows_generic_MSG", message, result); 38 | } 39 | #endif 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /src/qframeless/qframelessmainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef QFRAMELESSMAINWINDOW_H 2 | #define QFRAMELESSMAINWINDOW_H 3 | 4 | #include 5 | #include "qframelesshelper.h" 6 | 7 | class QFramelessHelper; 8 | class QFramelessMainWindow : public QMainWindow 9 | { 10 | Q_OBJECT 11 | public: 12 | explicit QFramelessMainWindow(QWidget *parent = 0, bool resizeEnable = true, bool shadowBorder = true, bool winNativeEvent = true); 13 | 14 | QFramelessHelper *framelessHelper(); 15 | 16 | protected: 17 | //拦截系统事件用于修复系统休眠后唤醒程序的BUG 18 | #if (QT_VERSION >= QT_VERSION_CHECK(6,0,0)) 19 | bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result); 20 | #else 21 | bool nativeEvent(const QByteArray &eventType, void *message, long *result); 22 | #endif 23 | 24 | //Qt4的写法 25 | #if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) 26 | #ifdef Q_OS_WIN 27 | bool winEvent(MSG *message, long *result); 28 | #endif 29 | #endif 30 | 31 | virtual void paintEvent(QPaintEvent *e); 32 | 33 | private: 34 | QFramelessHelper * m_framelessHelper; 35 | }; 36 | 37 | #endif // QFRAMELESSMAINWINDOW_H 38 | -------------------------------------------------------------------------------- /src/qframeless/qframelesswidget.cpp: -------------------------------------------------------------------------------- 1 | #include "qframelesswidget.h" 2 | #include 3 | QFramelessWidget::QFramelessWidget(QWidget *parent, bool resizeEnable, bool shadowBorder, bool winNativeEvent) 4 | : QWidget(parent) 5 | , m_framelessHelper(0) 6 | { 7 | m_framelessHelper = new QFramelessHelper(this, resizeEnable, shadowBorder, winNativeEvent, this); 8 | } 9 | 10 | QFramelessHelper *QFramelessWidget::framelessHelper() 11 | { 12 | return m_framelessHelper; 13 | } 14 | 15 | void QFramelessWidget::paintEvent(QPaintEvent *e) 16 | { 17 | if (m_framelessHelper == 0) 18 | return; 19 | m_framelessHelper->paintEvent(e); 20 | } 21 | 22 | #if (QT_VERSION >= QT_VERSION_CHECK(6,0,0)) 23 | bool QFramelessWidget::nativeEvent(const QByteArray &eventType, void *message, qintptr *result) 24 | #else 25 | bool QFramelessWidget::nativeEvent(const QByteArray &eventType, void *message, long *result) 26 | #endif 27 | { 28 | if (m_framelessHelper == 0) 29 | return false; 30 | return m_framelessHelper->nativeEvent(eventType, message, result); 31 | } 32 | 33 | #if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) 34 | #ifdef Q_OS_WIN 35 | bool QFramelessWidget::winEvent(MSG *message, long *result) 36 | { 37 | return nativeEvent("windows_generic_MSG", message, result); 38 | } 39 | #endif 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /src/qframeless/qframelesswidget.h: -------------------------------------------------------------------------------- 1 | #ifndef QFRAMELESSWIDGET_H 2 | #define QFRAMELESSWIDGET_H 3 | 4 | #include 5 | #include "qframelesshelper.h" 6 | 7 | class QFramelessHelper; 8 | class QFramelessWidget : public QWidget 9 | { 10 | Q_OBJECT 11 | public: 12 | explicit QFramelessWidget(QWidget *parent = 0, bool resizeEnable = false, bool shadowBorder = true, bool winNativeEvent = true); 13 | 14 | QFramelessHelper *framelessHelper(); 15 | 16 | protected: 17 | //拦截系统事件用于修复系统休眠后唤醒程序的BUG 18 | #if (QT_VERSION >= QT_VERSION_CHECK(6,0,0)) 19 | bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result); 20 | #else 21 | bool nativeEvent(const QByteArray &eventType, void *message, long *result); 22 | #endif 23 | 24 | //Qt4的写法 25 | #if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) 26 | #ifdef Q_OS_WIN 27 | bool winEvent(MSG *message, long *result); 28 | #endif 29 | #endif 30 | 31 | virtual void paintEvent(QPaintEvent *e); 32 | 33 | private: 34 | QFramelessHelper * m_framelessHelper; 35 | }; 36 | 37 | #endif // QFRAMELESSWIDGET_H 38 | -------------------------------------------------------------------------------- /src/qframeless/qshadowhelper.h: -------------------------------------------------------------------------------- 1 | #ifndef QSHADOWHELPER_H 2 | #define QSHADOWHELPER_H 3 | 4 | #include 5 | class QPainter; 6 | 7 | class QDrawShadowHelper : public QObject 8 | { 9 | Q_OBJECT 10 | 11 | //Q_PROPERTY(QColor clientBgColor READ getClientBgColor WRITE setClientBgColor) 12 | 13 | public: 14 | explicit QDrawShadowHelper(QWidget* w, int shadowSize = 10, QObject *parent = 0); 15 | ~QDrawShadowHelper(); 16 | void setShadowSize(int shadowSize); 17 | void paint(QPainter* p); 18 | int shadowSize(); 19 | 20 | // QColor getClientBgColor() const; 21 | // void setClientBgColor(const QColor &value); 22 | 23 | QColor getClientBorderColor() const; 24 | void setClientBorderColor(const QColor &value); 25 | 26 | public slots: 27 | void hide(); 28 | void show(); 29 | protected: 30 | QImage makeShadowImage(int shadowSize, bool activated); 31 | bool splitRect(const QRect &rcSrc, int shadowSize, QRect *parrayRect, int nArrayCount); 32 | private: 33 | int m_shadowSize; 34 | QImage m_img; 35 | QRect m_arrayImageGrid[9]; 36 | QColor m_clientBorderColor; 37 | QColor m_clientBgColor; 38 | QWidget *m_widget; 39 | bool m_show; 40 | }; 41 | 42 | #endif // QSHADOWHELPER_H 43 | -------------------------------------------------------------------------------- /src/serialinfo.cpp: -------------------------------------------------------------------------------- 1 | #include "serialinfo.h" 2 | 3 | 4 | SerialInfo::SerialInfo(QObject *parent) 5 | : QObject(parent) 6 | { 7 | findPortTimer = new QTimer(this); 8 | findPortTimer->setInterval(500); 9 | connect(findPortTimer, &QTimer::timeout, this, &SerialInfo::findPort); 10 | findPortTimer->start(); 11 | } 12 | 13 | SerialInfo::~SerialInfo() 14 | { 15 | 16 | } 17 | 18 | void SerialInfo::stopFindPort() 19 | { 20 | findPortTimer->stop(); 21 | } 22 | 23 | void SerialInfo::startFindPort() 24 | { 25 | findPortTimer->start(); 26 | } 27 | 28 | void SerialInfo::findPort() 29 | { 30 | QList list = QSerialPortInfo::availablePorts(); 31 | if(list.length() != portlist.length()){ 32 | portlist = list; 33 | emit portListChanged(portlist); 34 | return; 35 | } 36 | 37 | int count = 0; 38 | for(int i = 0;i< list.length();++i) 39 | { 40 | for(int j = 0;j< portlist.length();++j) 41 | { 42 | if(list[i].portName() == portlist[j].portName()) 43 | { 44 | count ++; 45 | break; 46 | } 47 | } 48 | } 49 | 50 | //出现改变 51 | if(count != list.length()) 52 | { 53 | portlist = list; 54 | emit portListChanged(portlist); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/serialinfo.h: -------------------------------------------------------------------------------- 1 | #ifndef SERIALINFO_H 2 | #define SERIALINFO_H 3 | #include 4 | #include 5 | #include 6 | 7 | class SerialInfo : public QObject 8 | { 9 | Q_OBJECT 10 | 11 | public: 12 | SerialInfo(QObject *parent = nullptr); 13 | ~SerialInfo(); 14 | 15 | void stopFindPort(); 16 | void startFindPort(); 17 | 18 | const QList &getPortList() const { return portlist; } 19 | 20 | private slots: 21 | void findPort(); 22 | 23 | signals: 24 | void portListChanged(const QList &portlist); 25 | private: 26 | QList portlist; 27 | 28 | QTimer *findPortTimer; // 定时器,用于定时搜索串口 29 | }; 30 | 31 | #endif // SERIALINFO_H 32 | -------------------------------------------------------------------------------- /src/setupframe.cpp: -------------------------------------------------------------------------------- 1 | #include "setupframe.h" 2 | #include "ui_setupframe.h" 3 | #include 4 | #include 5 | 6 | QSettings g_settings(QApplication::applicationDirPath(), QSettings::IniFormat); 7 | 8 | SetupFrame::SetupFrame(QWidget *parent) 9 | : QWidget(parent) 10 | , ui(new Ui::SetupFrame) 11 | { 12 | ui->setupUi(this); 13 | 14 | connect(ui->listWidget,&QListWidget::itemPressed,this,[=](QListWidgetItem *item){ 15 | QString pageName = item->text(); 16 | ui->stackedWidget->setCurrentWidget(pages[pageName]); 17 | ui->label->setText(pageName); 18 | }); 19 | } 20 | 21 | SetupFrame::~SetupFrame() 22 | { 23 | delete ui; 24 | } 25 | 26 | void SetupFrame::addPage(QString pageName, QWidget *setupPage) 27 | { 28 | setupPage->setParent(this); 29 | 30 | ui->stackedWidget->addWidget(setupPage); 31 | ui->listWidget->addItem(pageName); 32 | 33 | pages.insert(pageName,setupPage); 34 | } 35 | 36 | void SetupFrame::removePage(QString pageName) 37 | { 38 | QList items = ui->listWidget->findItems(pageName,Qt::MatchCaseSensitive); //区分大小写的 39 | if(items.size() != 1) 40 | return; 41 | 42 | ui->stackedWidget->removeWidget(pages[pageName]); 43 | ui->listWidget->removeItemWidget(items.at(0)); 44 | 45 | 46 | pages.remove(pageName); 47 | } 48 | 49 | void SetupFrame::showEvent(QShowEvent *event) 50 | { 51 | Q_UNUSED(event); 52 | if(pages.size() == 0) 53 | return; 54 | 55 | ui->stackedWidget->setCurrentWidget(pages.first()); 56 | ui->label->setText(pages.firstKey()); 57 | 58 | } 59 | 60 | void SetupFrame::on_ok_clicked() 61 | { 62 | g_settings.sync(); 63 | emit applySettings(); 64 | close(); 65 | } 66 | 67 | 68 | void SetupFrame::on_cancel_clicked() 69 | { 70 | close(); 71 | } 72 | 73 | 74 | void SetupFrame::on_apply_clicked() 75 | { 76 | g_settings.sync(); 77 | emit applySettings(); 78 | } 79 | 80 | -------------------------------------------------------------------------------- /src/setupframe.h: -------------------------------------------------------------------------------- 1 | #ifndef SETUPFRAME_H 2 | #define SETUPFRAME_H 3 | 4 | #include 5 | #include 6 | 7 | namespace Ui { 8 | class SetupFrame; 9 | } 10 | 11 | class SetupFrame : public QWidget 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | explicit SetupFrame(QWidget *parent = nullptr); 17 | ~SetupFrame(); 18 | void addPage(QString pageName,QWidget *setupPage); 19 | void removePage(QString pageName); 20 | protected: 21 | void showEvent(QShowEvent *event) override; 22 | 23 | private slots: 24 | void on_ok_clicked(); 25 | 26 | void on_cancel_clicked(); 27 | 28 | void on_apply_clicked(); 29 | 30 | signals: 31 | void applySettings(); 32 | private: 33 | Ui::SetupFrame *ui; 34 | QMap pages; 35 | }; 36 | 37 | #endif // SETUPFRAME_H 38 | -------------------------------------------------------------------------------- /src/setupframe.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | SetupFrame 4 | 5 | 6 | 7 | 0 8 | 0 9 | 801 10 | 728 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | TextLabel 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | Qt::Orientation::Horizontal 41 | 42 | 43 | 44 | 40 45 | 20 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 确定 54 | 55 | 56 | 57 | 58 | 59 | 60 | 取消 61 | 62 | 63 | 64 | 65 | 66 | 67 | 应用 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /src/setupmanage.cpp: -------------------------------------------------------------------------------- 1 | #include "setupmanage.h" 2 | #include "setupframe.h" 3 | #include "setupplot.h" 4 | 5 | 6 | SetupFrame *g_setupFrame = nullptr; 7 | 8 | SetupManage::SetupManage() 9 | { 10 | g_setupFrame = new SetupFrame(); 11 | g_setupFrame->addPage("Plot",new setupPlot(g_setupFrame)); 12 | 13 | g_setupFrame->addPage("Plot1",new setupPlot(g_setupFrame)); 14 | } 15 | 16 | SetupManage::~SetupManage() 17 | { 18 | delete g_setupFrame; 19 | } 20 | 21 | void SetupManage::show() 22 | { 23 | g_setupFrame->show(); 24 | } 25 | -------------------------------------------------------------------------------- /src/setupmanage.h: -------------------------------------------------------------------------------- 1 | #ifndef SETUPMANAGE_H 2 | #define SETUPMANAGE_H 3 | 4 | class SetupManage 5 | { 6 | public: 7 | SetupManage(); 8 | ~SetupManage(); 9 | 10 | void show(); 11 | }; 12 | 13 | #endif // SETUPMANAGE_H 14 | -------------------------------------------------------------------------------- /src/setupplot.cpp: -------------------------------------------------------------------------------- 1 | #include "setupplot.h" 2 | #include "ui_setupplot.h" 3 | #include "setupframe.h" 4 | 5 | setupPlot::setupPlot(QWidget *parent) 6 | : QWidget(parent) 7 | , ui(new Ui::setupPlot) 8 | { 9 | ui->setupUi(this); 10 | } 11 | 12 | setupPlot::~setupPlot() 13 | { 14 | delete ui; 15 | } 16 | -------------------------------------------------------------------------------- /src/setupplot.h: -------------------------------------------------------------------------------- 1 | #ifndef SETUPPLOT_H 2 | #define SETUPPLOT_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class setupPlot; 8 | } 9 | 10 | class setupPlot : public QWidget 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit setupPlot(QWidget *parent = nullptr); 16 | ~setupPlot(); 17 | 18 | private: 19 | Ui::setupPlot *ui; 20 | }; 21 | 22 | #endif // SETUPPLOT_H 23 | -------------------------------------------------------------------------------- /src/setupplot.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | setupPlot 4 | 5 | 6 | 7 | 0 8 | 0 9 | 543 10 | 426 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 19 | 40 20 | 150 21 | 69 22 | 19 23 | 24 | 25 | 26 | TextLabel 27 | 28 | 29 | 30 | 31 | 32 | 150 33 | 150 34 | 221 35 | 31 36 | 37 | 38 | 39 | 40 | 41 | 42 | 140 43 | 210 44 | 221 45 | 31 46 | 47 | 48 | 49 | 50 | 51 | 52 | 30 53 | 210 54 | 69 55 | 19 56 | 57 | 58 | 59 | TextLabel 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /src/widget.h: -------------------------------------------------------------------------------- 1 | #ifndef WIDGET_H 2 | #define WIDGET_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "qframelesswidget.h" 10 | #include "serialinfo.h" 11 | #include "qcustomplot.h" 12 | #include "drawplot.h" 13 | 14 | #include "data/yframe.h" 15 | #include "plotdemo.h" 16 | #include "myscorllbar.h" 17 | 18 | #include "cmdlist.h" 19 | 20 | namespace Ui { 21 | class Widget; 22 | } 23 | 24 | class Widget : public QFramelessWidget 25 | { 26 | Q_OBJECT 27 | 28 | public: 29 | explicit Widget(bool resizeEnable = true, 30 | bool shadowBorder = true, 31 | bool winNativeEvent = true, 32 | QWidget *parent = 0); 33 | ~Widget(); 34 | 35 | private: 36 | void initForm(); 37 | 38 | void keyPressEvent(QKeyEvent *e); //widget下的按键按下事件 39 | 40 | private slots: 41 | 42 | void maximizedChanged(bool max); 43 | 44 | void on_pushButton_close_clicked(); 45 | 46 | void on_pushButton_little_clicked(); 47 | 48 | void on_pushButton_size_clicked(); 49 | 50 | void on_checkBox_open_clicked(bool checked); 51 | 52 | void onReadyRead(); 53 | 54 | void on_checkBox_stop_clicked(bool checked); 55 | 56 | 57 | void on_pushButton_resetKey_clicked(); 58 | 59 | void on_pushButton_resetCmd_clicked(); 60 | 61 | void on_pushButton_clear_clicked(); 62 | 63 | void on_pushButton_output_clicked(); 64 | 65 | void on_pushButton_help_clicked(); 66 | 67 | void on_checkBox_auto_clicked(bool checked); 68 | 69 | void on_pushButton_reset_clicked(); 70 | 71 | 72 | void on_pushButton_showall_clicked(); 73 | 74 | void on_spinBox_buff_editingFinished(); 75 | void on_spinBox_wind_editingFinished(); 76 | 77 | void slot_plotviewXRangeChanged(double low,double up); 78 | 79 | 80 | 81 | void slot_scrollBarMove(int min, int max); 82 | 83 | 84 | 85 | void on_pushButton_hideall_clicked(); 86 | 87 | //串口列表出现改变 88 | void portListChanged(const QList &portlist); 89 | //接收解析的帧数据 90 | void onFrameReceived(QVector frame); 91 | void on_pushButton_demo_clicked(); 92 | 93 | void onReadySend(QString cmd); 94 | 95 | private: 96 | Ui::Widget *ui; 97 | bool m_stopReceivePlotData = false; 98 | 99 | QSerialPort *serialport;//串口对象 100 | SerialInfo *serialInfo;//串口信息对象 101 | 102 | PlotDemo *plotdemo; 103 | //数据 104 | YFrame *yframe;//数据解析对象 105 | //参数 106 | QSettings *settings; 107 | 108 | MyScorllBar *scrollBar; 109 | 110 | CmdList *cmdList; 111 | }; 112 | 113 | #endif // WIDGET_H 114 | -------------------------------------------------------------------------------- /src/yplot.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2021-11-01T20:44:37 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui serialport printsupport 8 | 9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 10 | TARGET = yplot 11 | TEMPLATE = app 12 | 13 | RC_ICONS = Icon.ico 14 | 15 | # The following define makes your compiler emit warnings if you use 16 | # any feature of Qt which has been marked as deprecated (the exact warnings 17 | # depend on your compiler). Please consult the documentation of the 18 | # deprecated API in order to know how to port your code away from it. 19 | DEFINES += QT_DEPRECATED_WARNINGS 20 | 21 | # You can also make your code fail to compile if you use deprecated APIs. 22 | # In order to do so, uncomment the following line. 23 | # You can also select to disable deprecated APIs only up to a certain version of Qt. 24 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 25 | 26 | CONFIG += c++11 27 | 28 | SOURCES += \ 29 | cmdlist.cpp \ 30 | data/yframe.cpp \ 31 | main.cpp \ 32 | myscorllbar.cpp \ 33 | mytimer.cpp \ 34 | plot/mybuoy.cpp \ 35 | plot/plotdemo.cpp \ 36 | serialinfo.cpp \ 37 | setupframe.cpp \ 38 | setupmanage.cpp \ 39 | setupplot.cpp \ 40 | widget.cpp \ 41 | plot/qcustomplot.cpp \ 42 | plot/drawplot.cpp\ 43 | plot/verticalline.cpp 44 | 45 | HEADERS += \ 46 | cmdlist.h \ 47 | data/ringqueue.h \ 48 | data/yframe.h \ 49 | myscorllbar.h \ 50 | mytimer.h \ 51 | plot/mybuoy.h \ 52 | plot/plotdemo.h \ 53 | serialinfo.h \ 54 | setupframe.h \ 55 | setupmanage.h \ 56 | setupplot.h \ 57 | widget.h \ 58 | plot/qcustomplot.h \ 59 | plot/drawplot.h\ 60 | plot/verticalline.h 61 | 62 | FORMS += \ 63 | cmdlist.ui \ 64 | setupframe.ui \ 65 | setupplot.ui \ 66 | widget.ui \ 67 | 68 | # Default rules for deployment. 69 | qnx: target.path = /tmp/$${TARGET}/bin 70 | else: unix:!android: target.path = /opt/$${TARGET}/bin 71 | !isEmpty(target.path): INSTALLS += target 72 | 73 | 74 | 75 | 76 | INCLUDEPATH += $$PWD/qframeless \ 77 | $$PWD/plot \ 78 | $$PWD/data 79 | include ($$PWD/qframeless/qframeless.pri) 80 | 81 | DISTFILES += \ 82 | img/output.svg \ 83 | img/send.svg \ 84 | img/setup.svg \ 85 | img/size-1.svg \ 86 | img/size-2.svg \ 87 | img/stop-off.svg \ 88 | img/stop-on.svg 89 | 90 | RESOURCES += \ 91 | Resource/img.qrc 92 | 93 | 94 | -------------------------------------------------------------------------------- /示例/STM32F103RBT6/HARDWARE/LED/led.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F103RBT6/HARDWARE/LED/led.c -------------------------------------------------------------------------------- /示例/STM32F103RBT6/HARDWARE/LED/led.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F103RBT6/HARDWARE/LED/led.h -------------------------------------------------------------------------------- /示例/STM32F103RBT6/STM32F10x_FWLib/inc/stm32f10x_crc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_crc.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the CRC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 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 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_CRC_H 25 | #define __STM32F10x_CRC_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup CRC 39 | * @{ 40 | */ 41 | 42 | /** @defgroup CRC_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup CRC_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | /** 55 | * @} 56 | */ 57 | 58 | /** @defgroup CRC_Exported_Macros 59 | * @{ 60 | */ 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @defgroup CRC_Exported_Functions 67 | * @{ 68 | */ 69 | 70 | void CRC_ResetDR(void); 71 | uint32_t CRC_CalcCRC(uint32_t Data); 72 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength); 73 | uint32_t CRC_GetCRC(void); 74 | void CRC_SetIDRegister(uint8_t IDValue); 75 | uint8_t CRC_GetIDRegister(void); 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | 81 | #endif /* __STM32F10x_CRC_H */ 82 | /** 83 | * @} 84 | */ 85 | 86 | /** 87 | * @} 88 | */ 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 95 | -------------------------------------------------------------------------------- /示例/STM32F103RBT6/STM32F10x_FWLib/inc/stm32f10x_dbgmcu.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_dbgmcu.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the DBGMCU 8 | * firmware library. 9 | ****************************************************************************** 10 | * @attention 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 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_DBGMCU_H 25 | #define __STM32F10x_DBGMCU_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup DBGMCU 39 | * @{ 40 | */ 41 | 42 | /** @defgroup DBGMCU_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup DBGMCU_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | #define DBGMCU_SLEEP ((uint32_t)0x00000001) 55 | #define DBGMCU_STOP ((uint32_t)0x00000002) 56 | #define DBGMCU_STANDBY ((uint32_t)0x00000004) 57 | #define DBGMCU_IWDG_STOP ((uint32_t)0x00000100) 58 | #define DBGMCU_WWDG_STOP ((uint32_t)0x00000200) 59 | #define DBGMCU_TIM1_STOP ((uint32_t)0x00000400) 60 | #define DBGMCU_TIM2_STOP ((uint32_t)0x00000800) 61 | #define DBGMCU_TIM3_STOP ((uint32_t)0x00001000) 62 | #define DBGMCU_TIM4_STOP ((uint32_t)0x00002000) 63 | #define DBGMCU_CAN1_STOP ((uint32_t)0x00004000) 64 | #define DBGMCU_I2C1_SMBUS_TIMEOUT ((uint32_t)0x00008000) 65 | #define DBGMCU_I2C2_SMBUS_TIMEOUT ((uint32_t)0x00010000) 66 | #define DBGMCU_TIM8_STOP ((uint32_t)0x00020000) 67 | #define DBGMCU_TIM5_STOP ((uint32_t)0x00040000) 68 | #define DBGMCU_TIM6_STOP ((uint32_t)0x00080000) 69 | #define DBGMCU_TIM7_STOP ((uint32_t)0x00100000) 70 | #define DBGMCU_CAN2_STOP ((uint32_t)0x00200000) 71 | #define DBGMCU_TIM15_STOP ((uint32_t)0x00400000) 72 | #define DBGMCU_TIM16_STOP ((uint32_t)0x00800000) 73 | #define DBGMCU_TIM17_STOP ((uint32_t)0x01000000) 74 | #define DBGMCU_TIM12_STOP ((uint32_t)0x02000000) 75 | #define DBGMCU_TIM13_STOP ((uint32_t)0x04000000) 76 | #define DBGMCU_TIM14_STOP ((uint32_t)0x08000000) 77 | #define DBGMCU_TIM9_STOP ((uint32_t)0x10000000) 78 | #define DBGMCU_TIM10_STOP ((uint32_t)0x20000000) 79 | #define DBGMCU_TIM11_STOP ((uint32_t)0x40000000) 80 | 81 | #define IS_DBGMCU_PERIPH(PERIPH) ((((PERIPH) & 0x800000F8) == 0x00) && ((PERIPH) != 0x00)) 82 | /** 83 | * @} 84 | */ 85 | 86 | /** @defgroup DBGMCU_Exported_Macros 87 | * @{ 88 | */ 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /** @defgroup DBGMCU_Exported_Functions 95 | * @{ 96 | */ 97 | 98 | uint32_t DBGMCU_GetREVID(void); 99 | uint32_t DBGMCU_GetDEVID(void); 100 | void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState); 101 | 102 | #ifdef __cplusplus 103 | } 104 | #endif 105 | 106 | #endif /* __STM32F10x_DBGMCU_H */ 107 | /** 108 | * @} 109 | */ 110 | 111 | /** 112 | * @} 113 | */ 114 | 115 | /** 116 | * @} 117 | */ 118 | 119 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 120 | -------------------------------------------------------------------------------- /示例/STM32F103RBT6/STM32F10x_FWLib/inc/stm32f10x_iwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_iwdg.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the IWDG 8 | * firmware library. 9 | ****************************************************************************** 10 | * @attention 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 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_IWDG_H 25 | #define __STM32F10x_IWDG_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup IWDG 39 | * @{ 40 | */ 41 | 42 | /** @defgroup IWDG_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup IWDG_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | /** @defgroup IWDG_WriteAccess 55 | * @{ 56 | */ 57 | 58 | #define IWDG_WriteAccess_Enable ((uint16_t)0x5555) 59 | #define IWDG_WriteAccess_Disable ((uint16_t)0x0000) 60 | #define IS_IWDG_WRITE_ACCESS(ACCESS) (((ACCESS) == IWDG_WriteAccess_Enable) || \ 61 | ((ACCESS) == IWDG_WriteAccess_Disable)) 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @defgroup IWDG_prescaler 67 | * @{ 68 | */ 69 | 70 | #define IWDG_Prescaler_4 ((uint8_t)0x00) 71 | #define IWDG_Prescaler_8 ((uint8_t)0x01) 72 | #define IWDG_Prescaler_16 ((uint8_t)0x02) 73 | #define IWDG_Prescaler_32 ((uint8_t)0x03) 74 | #define IWDG_Prescaler_64 ((uint8_t)0x04) 75 | #define IWDG_Prescaler_128 ((uint8_t)0x05) 76 | #define IWDG_Prescaler_256 ((uint8_t)0x06) 77 | #define IS_IWDG_PRESCALER(PRESCALER) (((PRESCALER) == IWDG_Prescaler_4) || \ 78 | ((PRESCALER) == IWDG_Prescaler_8) || \ 79 | ((PRESCALER) == IWDG_Prescaler_16) || \ 80 | ((PRESCALER) == IWDG_Prescaler_32) || \ 81 | ((PRESCALER) == IWDG_Prescaler_64) || \ 82 | ((PRESCALER) == IWDG_Prescaler_128)|| \ 83 | ((PRESCALER) == IWDG_Prescaler_256)) 84 | /** 85 | * @} 86 | */ 87 | 88 | /** @defgroup IWDG_Flag 89 | * @{ 90 | */ 91 | 92 | #define IWDG_FLAG_PVU ((uint16_t)0x0001) 93 | #define IWDG_FLAG_RVU ((uint16_t)0x0002) 94 | #define IS_IWDG_FLAG(FLAG) (((FLAG) == IWDG_FLAG_PVU) || ((FLAG) == IWDG_FLAG_RVU)) 95 | #define IS_IWDG_RELOAD(RELOAD) ((RELOAD) <= 0xFFF) 96 | /** 97 | * @} 98 | */ 99 | 100 | /** 101 | * @} 102 | */ 103 | 104 | /** @defgroup IWDG_Exported_Macros 105 | * @{ 106 | */ 107 | 108 | /** 109 | * @} 110 | */ 111 | 112 | /** @defgroup IWDG_Exported_Functions 113 | * @{ 114 | */ 115 | 116 | void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess); 117 | void IWDG_SetPrescaler(uint8_t IWDG_Prescaler); 118 | void IWDG_SetReload(uint16_t Reload); 119 | void IWDG_ReloadCounter(void); 120 | void IWDG_Enable(void); 121 | FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG); 122 | 123 | #ifdef __cplusplus 124 | } 125 | #endif 126 | 127 | #endif /* __STM32F10x_IWDG_H */ 128 | /** 129 | * @} 130 | */ 131 | 132 | /** 133 | * @} 134 | */ 135 | 136 | /** 137 | * @} 138 | */ 139 | 140 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 141 | -------------------------------------------------------------------------------- /示例/STM32F103RBT6/STM32F10x_FWLib/inc/stm32f10x_rtc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_rtc.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the RTC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 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 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_RTC_H 25 | #define __STM32F10x_RTC_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup RTC 39 | * @{ 40 | */ 41 | 42 | /** @defgroup RTC_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup RTC_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | /** @defgroup RTC_interrupts_define 55 | * @{ 56 | */ 57 | 58 | #define RTC_IT_OW ((uint16_t)0x0004) /*!< Overflow interrupt */ 59 | #define RTC_IT_ALR ((uint16_t)0x0002) /*!< Alarm interrupt */ 60 | #define RTC_IT_SEC ((uint16_t)0x0001) /*!< Second interrupt */ 61 | #define IS_RTC_IT(IT) ((((IT) & (uint16_t)0xFFF8) == 0x00) && ((IT) != 0x00)) 62 | #define IS_RTC_GET_IT(IT) (((IT) == RTC_IT_OW) || ((IT) == RTC_IT_ALR) || \ 63 | ((IT) == RTC_IT_SEC)) 64 | /** 65 | * @} 66 | */ 67 | 68 | /** @defgroup RTC_interrupts_flags 69 | * @{ 70 | */ 71 | 72 | #define RTC_FLAG_RTOFF ((uint16_t)0x0020) /*!< RTC Operation OFF flag */ 73 | #define RTC_FLAG_RSF ((uint16_t)0x0008) /*!< Registers Synchronized flag */ 74 | #define RTC_FLAG_OW ((uint16_t)0x0004) /*!< Overflow flag */ 75 | #define RTC_FLAG_ALR ((uint16_t)0x0002) /*!< Alarm flag */ 76 | #define RTC_FLAG_SEC ((uint16_t)0x0001) /*!< Second flag */ 77 | #define IS_RTC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint16_t)0xFFF0) == 0x00) && ((FLAG) != 0x00)) 78 | #define IS_RTC_GET_FLAG(FLAG) (((FLAG) == RTC_FLAG_RTOFF) || ((FLAG) == RTC_FLAG_RSF) || \ 79 | ((FLAG) == RTC_FLAG_OW) || ((FLAG) == RTC_FLAG_ALR) || \ 80 | ((FLAG) == RTC_FLAG_SEC)) 81 | #define IS_RTC_PRESCALER(PRESCALER) ((PRESCALER) <= 0xFFFFF) 82 | 83 | /** 84 | * @} 85 | */ 86 | 87 | /** 88 | * @} 89 | */ 90 | 91 | /** @defgroup RTC_Exported_Macros 92 | * @{ 93 | */ 94 | 95 | /** 96 | * @} 97 | */ 98 | 99 | /** @defgroup RTC_Exported_Functions 100 | * @{ 101 | */ 102 | 103 | void RTC_ITConfig(uint16_t RTC_IT, FunctionalState NewState); 104 | void RTC_EnterConfigMode(void); 105 | void RTC_ExitConfigMode(void); 106 | uint32_t RTC_GetCounter(void); 107 | void RTC_SetCounter(uint32_t CounterValue); 108 | void RTC_SetPrescaler(uint32_t PrescalerValue); 109 | void RTC_SetAlarm(uint32_t AlarmValue); 110 | uint32_t RTC_GetDivider(void); 111 | void RTC_WaitForLastTask(void); 112 | void RTC_WaitForSynchro(void); 113 | FlagStatus RTC_GetFlagStatus(uint16_t RTC_FLAG); 114 | void RTC_ClearFlag(uint16_t RTC_FLAG); 115 | ITStatus RTC_GetITStatus(uint16_t RTC_IT); 116 | void RTC_ClearITPendingBit(uint16_t RTC_IT); 117 | 118 | #ifdef __cplusplus 119 | } 120 | #endif 121 | 122 | #endif /* __STM32F10x_RTC_H */ 123 | /** 124 | * @} 125 | */ 126 | 127 | /** 128 | * @} 129 | */ 130 | 131 | /** 132 | * @} 133 | */ 134 | 135 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 136 | -------------------------------------------------------------------------------- /示例/STM32F103RBT6/STM32F10x_FWLib/inc/stm32f10x_wwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_wwdg.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the WWDG firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 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 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_WWDG_H 25 | #define __STM32F10x_WWDG_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup WWDG 39 | * @{ 40 | */ 41 | 42 | /** @defgroup WWDG_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup WWDG_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | /** @defgroup WWDG_Prescaler 55 | * @{ 56 | */ 57 | 58 | #define WWDG_Prescaler_1 ((uint32_t)0x00000000) 59 | #define WWDG_Prescaler_2 ((uint32_t)0x00000080) 60 | #define WWDG_Prescaler_4 ((uint32_t)0x00000100) 61 | #define WWDG_Prescaler_8 ((uint32_t)0x00000180) 62 | #define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_Prescaler_1) || \ 63 | ((PRESCALER) == WWDG_Prescaler_2) || \ 64 | ((PRESCALER) == WWDG_Prescaler_4) || \ 65 | ((PRESCALER) == WWDG_Prescaler_8)) 66 | #define IS_WWDG_WINDOW_VALUE(VALUE) ((VALUE) <= 0x7F) 67 | #define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F)) 68 | 69 | /** 70 | * @} 71 | */ 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | /** @defgroup WWDG_Exported_Macros 78 | * @{ 79 | */ 80 | /** 81 | * @} 82 | */ 83 | 84 | /** @defgroup WWDG_Exported_Functions 85 | * @{ 86 | */ 87 | 88 | void WWDG_DeInit(void); 89 | void WWDG_SetPrescaler(uint32_t WWDG_Prescaler); 90 | void WWDG_SetWindowValue(uint8_t WindowValue); 91 | void WWDG_EnableIT(void); 92 | void WWDG_SetCounter(uint8_t Counter); 93 | void WWDG_Enable(uint8_t Counter); 94 | FlagStatus WWDG_GetFlagStatus(void); 95 | void WWDG_ClearFlag(void); 96 | 97 | #ifdef __cplusplus 98 | } 99 | #endif 100 | 101 | #endif /* __STM32F10x_WWDG_H */ 102 | 103 | /** 104 | * @} 105 | */ 106 | 107 | /** 108 | * @} 109 | */ 110 | 111 | /** 112 | * @} 113 | */ 114 | 115 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 116 | -------------------------------------------------------------------------------- /示例/STM32F103RBT6/STM32F10x_FWLib/src/stm32f10x_crc.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_crc.c 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file provides all the CRC firmware functions. 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 | /* Includes ------------------------------------------------------------------*/ 23 | #include "stm32f10x_crc.h" 24 | 25 | /** @addtogroup STM32F10x_StdPeriph_Driver 26 | * @{ 27 | */ 28 | 29 | /** @defgroup CRC 30 | * @brief CRC driver modules 31 | * @{ 32 | */ 33 | 34 | /** @defgroup CRC_Private_TypesDefinitions 35 | * @{ 36 | */ 37 | 38 | /** 39 | * @} 40 | */ 41 | 42 | /** @defgroup CRC_Private_Defines 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup CRC_Private_Macros 51 | * @{ 52 | */ 53 | 54 | /** 55 | * @} 56 | */ 57 | 58 | /** @defgroup CRC_Private_Variables 59 | * @{ 60 | */ 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @defgroup CRC_Private_FunctionPrototypes 67 | * @{ 68 | */ 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @defgroup CRC_Private_Functions 75 | * @{ 76 | */ 77 | 78 | /** 79 | * @brief Resets the CRC Data register (DR). 80 | * @param None 81 | * @retval None 82 | */ 83 | void CRC_ResetDR(void) 84 | { 85 | /* Reset CRC generator */ 86 | CRC->CR = CRC_CR_RESET; 87 | } 88 | 89 | /** 90 | * @brief Computes the 32-bit CRC of a given data word(32-bit). 91 | * @param Data: data word(32-bit) to compute its CRC 92 | * @retval 32-bit CRC 93 | */ 94 | uint32_t CRC_CalcCRC(uint32_t Data) 95 | { 96 | CRC->DR = Data; 97 | 98 | return (CRC->DR); 99 | } 100 | 101 | /** 102 | * @brief Computes the 32-bit CRC of a given buffer of data word(32-bit). 103 | * @param pBuffer: pointer to the buffer containing the data to be computed 104 | * @param BufferLength: length of the buffer to be computed 105 | * @retval 32-bit CRC 106 | */ 107 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength) 108 | { 109 | uint32_t index = 0; 110 | 111 | for(index = 0; index < BufferLength; index++) 112 | { 113 | CRC->DR = pBuffer[index]; 114 | } 115 | return (CRC->DR); 116 | } 117 | 118 | /** 119 | * @brief Returns the current CRC value. 120 | * @param None 121 | * @retval 32-bit CRC 122 | */ 123 | uint32_t CRC_GetCRC(void) 124 | { 125 | return (CRC->DR); 126 | } 127 | 128 | /** 129 | * @brief Stores a 8-bit data in the Independent Data(ID) register. 130 | * @param IDValue: 8-bit value to be stored in the ID register 131 | * @retval None 132 | */ 133 | void CRC_SetIDRegister(uint8_t IDValue) 134 | { 135 | CRC->IDR = IDValue; 136 | } 137 | 138 | /** 139 | * @brief Returns the 8-bit data stored in the Independent Data(ID) register 140 | * @param None 141 | * @retval 8-bit value of the ID register 142 | */ 143 | uint8_t CRC_GetIDRegister(void) 144 | { 145 | return (CRC->IDR); 146 | } 147 | 148 | /** 149 | * @} 150 | */ 151 | 152 | /** 153 | * @} 154 | */ 155 | 156 | /** 157 | * @} 158 | */ 159 | 160 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 161 | -------------------------------------------------------------------------------- /示例/STM32F103RBT6/STM32F10x_FWLib/src/stm32f10x_flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F103RBT6/STM32F10x_FWLib/src/stm32f10x_flash.c -------------------------------------------------------------------------------- /示例/STM32F103RBT6/STM32F10x_FWLib/src/stm32f10x_i2c.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F103RBT6/STM32F10x_FWLib/src/stm32f10x_i2c.c -------------------------------------------------------------------------------- /示例/STM32F103RBT6/STM32F10x_FWLib/src/stm32f10x_usart.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F103RBT6/STM32F10x_FWLib/src/stm32f10x_usart.c -------------------------------------------------------------------------------- /示例/STM32F103RBT6/SYSTEM/delay/delay.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F103RBT6/SYSTEM/delay/delay.c -------------------------------------------------------------------------------- /示例/STM32F103RBT6/SYSTEM/delay/delay.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F103RBT6/SYSTEM/delay/delay.h -------------------------------------------------------------------------------- /示例/STM32F103RBT6/SYSTEM/sys/sys.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F103RBT6/SYSTEM/sys/sys.c -------------------------------------------------------------------------------- /示例/STM32F103RBT6/SYSTEM/sys/sys.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F103RBT6/SYSTEM/sys/sys.h -------------------------------------------------------------------------------- /示例/STM32F103RBT6/SYSTEM/usart/usart.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F103RBT6/SYSTEM/usart/usart.c -------------------------------------------------------------------------------- /示例/STM32F103RBT6/SYSTEM/usart/usart.h: -------------------------------------------------------------------------------- 1 | #ifndef __USART_H 2 | #define __USART_H 3 | #include "stdio.h" 4 | #include "sys.h" 5 | 6 | void usart_init(u32 bound); 7 | u8 usart_get_data(char *cmd,float *d1,float *d2,float *d3); 8 | void usart_senddatas(USART_TypeDef* USARTx,u8* addr,int size); 9 | #endif 10 | 11 | 12 | -------------------------------------------------------------------------------- /示例/STM32F103RBT6/USER/DebugConfig/LED_STM32F103ZE_1.0.0.dbgconf: -------------------------------------------------------------------------------- 1 | // File: STM32F101_102_103_105_107.dbgconf 2 | // Version: 1.0.0 3 | // Note: refer to STM32F101xx STM32F102xx STM32F103xx STM32F105xx STM32F107xx Reference manual (RM0008) 4 | // STM32F101xx STM32F102xx STM32F103xx STM32F105xx STM32F107xx datasheets 5 | 6 | // <<< Use Configuration Wizard in Context Menu >>> 7 | 8 | // Debug MCU configuration register (DBGMCU_CR) 9 | // Reserved bits must be kept at reset value 10 | // DBG_TIM11_STOP TIM11 counter stopped when core is halted 11 | // DBG_TIM10_STOP TIM10 counter stopped when core is halted 12 | // DBG_TIM9_STOP TIM9 counter stopped when core is halted 13 | // DBG_TIM14_STOP TIM14 counter stopped when core is halted 14 | // DBG_TIM13_STOP TIM13 counter stopped when core is halted 15 | // DBG_TIM12_STOP TIM12 counter stopped when core is halted 16 | // DBG_CAN2_STOP Debug CAN2 stopped when core is halted 17 | // DBG_TIM7_STOP TIM7 counter stopped when core is halted 18 | // DBG_TIM6_STOP TIM6 counter stopped when core is halted 19 | // DBG_TIM5_STOP TIM5 counter stopped when core is halted 20 | // DBG_TIM8_STOP TIM8 counter stopped when core is halted 21 | // DBG_I2C2_SMBUS_TIMEOUT SMBUS timeout mode stopped when core is halted 22 | // DBG_I2C1_SMBUS_TIMEOUT SMBUS timeout mode stopped when core is halted 23 | // DBG_CAN1_STOP Debug CAN1 stopped when Core is halted 24 | // DBG_TIM4_STOP TIM4 counter stopped when core is halted 25 | // DBG_TIM3_STOP TIM3 counter stopped when core is halted 26 | // DBG_TIM2_STOP TIM2 counter stopped when core is halted 27 | // DBG_TIM1_STOP TIM1 counter stopped when core is halted 28 | // DBG_WWDG_STOP Debug window watchdog stopped when core is halted 29 | // DBG_IWDG_STOP Debug independent watchdog stopped when core is halted 30 | // DBG_STANDBY Debug standby mode 31 | // DBG_STOP Debug stop mode 32 | // DBG_SLEEP Debug sleep mode 33 | // 34 | DbgMCU_CR = 0x00000007; 35 | 36 | // <<< end of configuration section >>> 37 | -------------------------------------------------------------------------------- /示例/STM32F103RBT6/USER/DebugConfig/temp_STM32F103RB_1.0.0.dbgconf: -------------------------------------------------------------------------------- 1 | // File: STM32F101_102_103_105_107.dbgconf 2 | // Version: 1.0.0 3 | // Note: refer to STM32F101xx STM32F102xx STM32F103xx STM32F105xx STM32F107xx Reference manual (RM0008) 4 | // STM32F101xx STM32F102xx STM32F103xx STM32F105xx STM32F107xx datasheets 5 | 6 | // <<< Use Configuration Wizard in Context Menu >>> 7 | 8 | // Debug MCU configuration register (DBGMCU_CR) 9 | // Reserved bits must be kept at reset value 10 | // DBG_TIM11_STOP TIM11 counter stopped when core is halted 11 | // DBG_TIM10_STOP TIM10 counter stopped when core is halted 12 | // DBG_TIM9_STOP TIM9 counter stopped when core is halted 13 | // DBG_TIM14_STOP TIM14 counter stopped when core is halted 14 | // DBG_TIM13_STOP TIM13 counter stopped when core is halted 15 | // DBG_TIM12_STOP TIM12 counter stopped when core is halted 16 | // DBG_CAN2_STOP Debug CAN2 stopped when core is halted 17 | // DBG_TIM7_STOP TIM7 counter stopped when core is halted 18 | // DBG_TIM6_STOP TIM6 counter stopped when core is halted 19 | // DBG_TIM5_STOP TIM5 counter stopped when core is halted 20 | // DBG_TIM8_STOP TIM8 counter stopped when core is halted 21 | // DBG_I2C2_SMBUS_TIMEOUT SMBUS timeout mode stopped when core is halted 22 | // DBG_I2C1_SMBUS_TIMEOUT SMBUS timeout mode stopped when core is halted 23 | // DBG_CAN1_STOP Debug CAN1 stopped when Core is halted 24 | // DBG_TIM4_STOP TIM4 counter stopped when core is halted 25 | // DBG_TIM3_STOP TIM3 counter stopped when core is halted 26 | // DBG_TIM2_STOP TIM2 counter stopped when core is halted 27 | // DBG_TIM1_STOP TIM1 counter stopped when core is halted 28 | // DBG_WWDG_STOP Debug window watchdog stopped when core is halted 29 | // DBG_IWDG_STOP Debug independent watchdog stopped when core is halted 30 | // DBG_STANDBY Debug standby mode 31 | // DBG_STOP Debug stop mode 32 | // DBG_SLEEP Debug sleep mode 33 | // 34 | DbgMCU_CR = 0x00000007; 35 | 36 | // <<< end of configuration section >>> 37 | -------------------------------------------------------------------------------- /示例/STM32F103RBT6/USER/JLinkSettings.ini: -------------------------------------------------------------------------------- 1 | [BREAKPOINTS] 2 | ForceImpTypeAny = 0 3 | ShowInfoWin = 1 4 | EnableFlashBP = 2 5 | BPDuringExecution = 0 6 | [CFI] 7 | CFISize = 0x00 8 | CFIAddr = 0x00 9 | [CPU] 10 | OverrideMemMap = 0 11 | AllowSimulation = 1 12 | ScriptFile="" 13 | [FLASH] 14 | CacheExcludeSize = 0x00 15 | CacheExcludeAddr = 0x00 16 | MinNumBytesFlashDL = 0 17 | SkipProgOnCRCMatch = 1 18 | VerifyDownload = 1 19 | AllowCaching = 1 20 | EnableFlashDL = 2 21 | Override = 0 22 | Device="UNSPECIFIED" 23 | [GENERAL] 24 | WorkRAMSize = 0x00 25 | WorkRAMAddr = 0x00 26 | RAMUsageLimit = 0x00 27 | [SWO] 28 | SWOLogFile="" 29 | [MEM] 30 | RdOverrideOrMask = 0x00 31 | RdOverrideAndMask = 0xFFFFFFFF 32 | RdOverrideAddr = 0xFFFFFFFF 33 | WrOverrideOrMask = 0x00 34 | WrOverrideAndMask = 0xFFFFFFFF 35 | WrOverrideAddr = 0xFFFFFFFF 36 | -------------------------------------------------------------------------------- /示例/STM32F103RBT6/USER/main.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F103RBT6/USER/main.c -------------------------------------------------------------------------------- /示例/STM32F103RBT6/USER/stm32f10x.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F103RBT6/USER/stm32f10x.h -------------------------------------------------------------------------------- /示例/STM32F103RBT6/USER/stm32f10x_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file GPIO/IOToggle/stm32f10x_conf.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 08-April-2011 7 | * @brief Library configuration 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 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F10x_CONF_H 24 | #define __STM32F10x_CONF_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | /* Uncomment/Comment the line below to enable/disable peripheral header file inclusion */ 28 | #include "stm32f10x_adc.h" 29 | #include "stm32f10x_bkp.h" 30 | #include "stm32f10x_can.h" 31 | #include "stm32f10x_cec.h" 32 | #include "stm32f10x_crc.h" 33 | #include "stm32f10x_dac.h" 34 | #include "stm32f10x_dbgmcu.h" 35 | #include "stm32f10x_dma.h" 36 | #include "stm32f10x_exti.h" 37 | #include "stm32f10x_flash.h" 38 | #include "stm32f10x_fsmc.h" 39 | #include "stm32f10x_gpio.h" 40 | #include "stm32f10x_i2c.h" 41 | #include "stm32f10x_iwdg.h" 42 | #include "stm32f10x_pwr.h" 43 | #include "stm32f10x_rcc.h" 44 | #include "stm32f10x_rtc.h" 45 | #include "stm32f10x_sdio.h" 46 | #include "stm32f10x_spi.h" 47 | #include "stm32f10x_tim.h" 48 | #include "stm32f10x_usart.h" 49 | #include "stm32f10x_wwdg.h" 50 | #include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ 51 | 52 | /* Exported types ------------------------------------------------------------*/ 53 | /* Exported constants --------------------------------------------------------*/ 54 | /* Uncomment the line below to expanse the "assert_param" macro in the 55 | Standard Peripheral Library drivers code */ 56 | /* #define USE_FULL_ASSERT 1 */ 57 | 58 | /* Exported macro ------------------------------------------------------------*/ 59 | #ifdef USE_FULL_ASSERT 60 | 61 | /** 62 | * @brief The assert_param macro is used for function's parameters check. 63 | * @param expr: If expr is false, it calls assert_failed function which reports 64 | * the name of the source file and the source line number of the call 65 | * that failed. If expr is true, it returns no value. 66 | * @retval None 67 | */ 68 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 69 | /* Exported functions ------------------------------------------------------- */ 70 | void assert_failed(uint8_t* file, uint32_t line); 71 | #else 72 | #define assert_param(expr) ((void)0) 73 | #endif /* USE_FULL_ASSERT */ 74 | 75 | #endif /* __STM32F10x_CONF_H */ 76 | 77 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 78 | -------------------------------------------------------------------------------- /示例/STM32F103RBT6/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 | -------------------------------------------------------------------------------- /示例/STM32F103RBT6/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 | -------------------------------------------------------------------------------- /示例/STM32F103RBT6/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 | -------------------------------------------------------------------------------- /示例/STM32F103RBT6/keilkilll.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F103RBT6/keilkilll.bat -------------------------------------------------------------------------------- /示例/STM32F103ZET6/HARDWARE/LED/led.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F103ZET6/HARDWARE/LED/led.c -------------------------------------------------------------------------------- /示例/STM32F103ZET6/HARDWARE/LED/led.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F103ZET6/HARDWARE/LED/led.h -------------------------------------------------------------------------------- /示例/STM32F103ZET6/STM32F10x_FWLib/inc/stm32f10x_crc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_crc.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the CRC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 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 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_CRC_H 25 | #define __STM32F10x_CRC_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup CRC 39 | * @{ 40 | */ 41 | 42 | /** @defgroup CRC_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup CRC_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | /** 55 | * @} 56 | */ 57 | 58 | /** @defgroup CRC_Exported_Macros 59 | * @{ 60 | */ 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @defgroup CRC_Exported_Functions 67 | * @{ 68 | */ 69 | 70 | void CRC_ResetDR(void); 71 | uint32_t CRC_CalcCRC(uint32_t Data); 72 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength); 73 | uint32_t CRC_GetCRC(void); 74 | void CRC_SetIDRegister(uint8_t IDValue); 75 | uint8_t CRC_GetIDRegister(void); 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | 81 | #endif /* __STM32F10x_CRC_H */ 82 | /** 83 | * @} 84 | */ 85 | 86 | /** 87 | * @} 88 | */ 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 95 | -------------------------------------------------------------------------------- /示例/STM32F103ZET6/STM32F10x_FWLib/inc/stm32f10x_dbgmcu.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_dbgmcu.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the DBGMCU 8 | * firmware library. 9 | ****************************************************************************** 10 | * @attention 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 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_DBGMCU_H 25 | #define __STM32F10x_DBGMCU_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup DBGMCU 39 | * @{ 40 | */ 41 | 42 | /** @defgroup DBGMCU_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup DBGMCU_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | #define DBGMCU_SLEEP ((uint32_t)0x00000001) 55 | #define DBGMCU_STOP ((uint32_t)0x00000002) 56 | #define DBGMCU_STANDBY ((uint32_t)0x00000004) 57 | #define DBGMCU_IWDG_STOP ((uint32_t)0x00000100) 58 | #define DBGMCU_WWDG_STOP ((uint32_t)0x00000200) 59 | #define DBGMCU_TIM1_STOP ((uint32_t)0x00000400) 60 | #define DBGMCU_TIM2_STOP ((uint32_t)0x00000800) 61 | #define DBGMCU_TIM3_STOP ((uint32_t)0x00001000) 62 | #define DBGMCU_TIM4_STOP ((uint32_t)0x00002000) 63 | #define DBGMCU_CAN1_STOP ((uint32_t)0x00004000) 64 | #define DBGMCU_I2C1_SMBUS_TIMEOUT ((uint32_t)0x00008000) 65 | #define DBGMCU_I2C2_SMBUS_TIMEOUT ((uint32_t)0x00010000) 66 | #define DBGMCU_TIM8_STOP ((uint32_t)0x00020000) 67 | #define DBGMCU_TIM5_STOP ((uint32_t)0x00040000) 68 | #define DBGMCU_TIM6_STOP ((uint32_t)0x00080000) 69 | #define DBGMCU_TIM7_STOP ((uint32_t)0x00100000) 70 | #define DBGMCU_CAN2_STOP ((uint32_t)0x00200000) 71 | #define DBGMCU_TIM15_STOP ((uint32_t)0x00400000) 72 | #define DBGMCU_TIM16_STOP ((uint32_t)0x00800000) 73 | #define DBGMCU_TIM17_STOP ((uint32_t)0x01000000) 74 | #define DBGMCU_TIM12_STOP ((uint32_t)0x02000000) 75 | #define DBGMCU_TIM13_STOP ((uint32_t)0x04000000) 76 | #define DBGMCU_TIM14_STOP ((uint32_t)0x08000000) 77 | #define DBGMCU_TIM9_STOP ((uint32_t)0x10000000) 78 | #define DBGMCU_TIM10_STOP ((uint32_t)0x20000000) 79 | #define DBGMCU_TIM11_STOP ((uint32_t)0x40000000) 80 | 81 | #define IS_DBGMCU_PERIPH(PERIPH) ((((PERIPH) & 0x800000F8) == 0x00) && ((PERIPH) != 0x00)) 82 | /** 83 | * @} 84 | */ 85 | 86 | /** @defgroup DBGMCU_Exported_Macros 87 | * @{ 88 | */ 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /** @defgroup DBGMCU_Exported_Functions 95 | * @{ 96 | */ 97 | 98 | uint32_t DBGMCU_GetREVID(void); 99 | uint32_t DBGMCU_GetDEVID(void); 100 | void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState); 101 | 102 | #ifdef __cplusplus 103 | } 104 | #endif 105 | 106 | #endif /* __STM32F10x_DBGMCU_H */ 107 | /** 108 | * @} 109 | */ 110 | 111 | /** 112 | * @} 113 | */ 114 | 115 | /** 116 | * @} 117 | */ 118 | 119 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 120 | -------------------------------------------------------------------------------- /示例/STM32F103ZET6/STM32F10x_FWLib/inc/stm32f10x_iwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_iwdg.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the IWDG 8 | * firmware library. 9 | ****************************************************************************** 10 | * @attention 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 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_IWDG_H 25 | #define __STM32F10x_IWDG_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup IWDG 39 | * @{ 40 | */ 41 | 42 | /** @defgroup IWDG_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup IWDG_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | /** @defgroup IWDG_WriteAccess 55 | * @{ 56 | */ 57 | 58 | #define IWDG_WriteAccess_Enable ((uint16_t)0x5555) 59 | #define IWDG_WriteAccess_Disable ((uint16_t)0x0000) 60 | #define IS_IWDG_WRITE_ACCESS(ACCESS) (((ACCESS) == IWDG_WriteAccess_Enable) || \ 61 | ((ACCESS) == IWDG_WriteAccess_Disable)) 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @defgroup IWDG_prescaler 67 | * @{ 68 | */ 69 | 70 | #define IWDG_Prescaler_4 ((uint8_t)0x00) 71 | #define IWDG_Prescaler_8 ((uint8_t)0x01) 72 | #define IWDG_Prescaler_16 ((uint8_t)0x02) 73 | #define IWDG_Prescaler_32 ((uint8_t)0x03) 74 | #define IWDG_Prescaler_64 ((uint8_t)0x04) 75 | #define IWDG_Prescaler_128 ((uint8_t)0x05) 76 | #define IWDG_Prescaler_256 ((uint8_t)0x06) 77 | #define IS_IWDG_PRESCALER(PRESCALER) (((PRESCALER) == IWDG_Prescaler_4) || \ 78 | ((PRESCALER) == IWDG_Prescaler_8) || \ 79 | ((PRESCALER) == IWDG_Prescaler_16) || \ 80 | ((PRESCALER) == IWDG_Prescaler_32) || \ 81 | ((PRESCALER) == IWDG_Prescaler_64) || \ 82 | ((PRESCALER) == IWDG_Prescaler_128)|| \ 83 | ((PRESCALER) == IWDG_Prescaler_256)) 84 | /** 85 | * @} 86 | */ 87 | 88 | /** @defgroup IWDG_Flag 89 | * @{ 90 | */ 91 | 92 | #define IWDG_FLAG_PVU ((uint16_t)0x0001) 93 | #define IWDG_FLAG_RVU ((uint16_t)0x0002) 94 | #define IS_IWDG_FLAG(FLAG) (((FLAG) == IWDG_FLAG_PVU) || ((FLAG) == IWDG_FLAG_RVU)) 95 | #define IS_IWDG_RELOAD(RELOAD) ((RELOAD) <= 0xFFF) 96 | /** 97 | * @} 98 | */ 99 | 100 | /** 101 | * @} 102 | */ 103 | 104 | /** @defgroup IWDG_Exported_Macros 105 | * @{ 106 | */ 107 | 108 | /** 109 | * @} 110 | */ 111 | 112 | /** @defgroup IWDG_Exported_Functions 113 | * @{ 114 | */ 115 | 116 | void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess); 117 | void IWDG_SetPrescaler(uint8_t IWDG_Prescaler); 118 | void IWDG_SetReload(uint16_t Reload); 119 | void IWDG_ReloadCounter(void); 120 | void IWDG_Enable(void); 121 | FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG); 122 | 123 | #ifdef __cplusplus 124 | } 125 | #endif 126 | 127 | #endif /* __STM32F10x_IWDG_H */ 128 | /** 129 | * @} 130 | */ 131 | 132 | /** 133 | * @} 134 | */ 135 | 136 | /** 137 | * @} 138 | */ 139 | 140 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 141 | -------------------------------------------------------------------------------- /示例/STM32F103ZET6/STM32F10x_FWLib/inc/stm32f10x_rtc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_rtc.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the RTC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 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 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_RTC_H 25 | #define __STM32F10x_RTC_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup RTC 39 | * @{ 40 | */ 41 | 42 | /** @defgroup RTC_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup RTC_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | /** @defgroup RTC_interrupts_define 55 | * @{ 56 | */ 57 | 58 | #define RTC_IT_OW ((uint16_t)0x0004) /*!< Overflow interrupt */ 59 | #define RTC_IT_ALR ((uint16_t)0x0002) /*!< Alarm interrupt */ 60 | #define RTC_IT_SEC ((uint16_t)0x0001) /*!< Second interrupt */ 61 | #define IS_RTC_IT(IT) ((((IT) & (uint16_t)0xFFF8) == 0x00) && ((IT) != 0x00)) 62 | #define IS_RTC_GET_IT(IT) (((IT) == RTC_IT_OW) || ((IT) == RTC_IT_ALR) || \ 63 | ((IT) == RTC_IT_SEC)) 64 | /** 65 | * @} 66 | */ 67 | 68 | /** @defgroup RTC_interrupts_flags 69 | * @{ 70 | */ 71 | 72 | #define RTC_FLAG_RTOFF ((uint16_t)0x0020) /*!< RTC Operation OFF flag */ 73 | #define RTC_FLAG_RSF ((uint16_t)0x0008) /*!< Registers Synchronized flag */ 74 | #define RTC_FLAG_OW ((uint16_t)0x0004) /*!< Overflow flag */ 75 | #define RTC_FLAG_ALR ((uint16_t)0x0002) /*!< Alarm flag */ 76 | #define RTC_FLAG_SEC ((uint16_t)0x0001) /*!< Second flag */ 77 | #define IS_RTC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint16_t)0xFFF0) == 0x00) && ((FLAG) != 0x00)) 78 | #define IS_RTC_GET_FLAG(FLAG) (((FLAG) == RTC_FLAG_RTOFF) || ((FLAG) == RTC_FLAG_RSF) || \ 79 | ((FLAG) == RTC_FLAG_OW) || ((FLAG) == RTC_FLAG_ALR) || \ 80 | ((FLAG) == RTC_FLAG_SEC)) 81 | #define IS_RTC_PRESCALER(PRESCALER) ((PRESCALER) <= 0xFFFFF) 82 | 83 | /** 84 | * @} 85 | */ 86 | 87 | /** 88 | * @} 89 | */ 90 | 91 | /** @defgroup RTC_Exported_Macros 92 | * @{ 93 | */ 94 | 95 | /** 96 | * @} 97 | */ 98 | 99 | /** @defgroup RTC_Exported_Functions 100 | * @{ 101 | */ 102 | 103 | void RTC_ITConfig(uint16_t RTC_IT, FunctionalState NewState); 104 | void RTC_EnterConfigMode(void); 105 | void RTC_ExitConfigMode(void); 106 | uint32_t RTC_GetCounter(void); 107 | void RTC_SetCounter(uint32_t CounterValue); 108 | void RTC_SetPrescaler(uint32_t PrescalerValue); 109 | void RTC_SetAlarm(uint32_t AlarmValue); 110 | uint32_t RTC_GetDivider(void); 111 | void RTC_WaitForLastTask(void); 112 | void RTC_WaitForSynchro(void); 113 | FlagStatus RTC_GetFlagStatus(uint16_t RTC_FLAG); 114 | void RTC_ClearFlag(uint16_t RTC_FLAG); 115 | ITStatus RTC_GetITStatus(uint16_t RTC_IT); 116 | void RTC_ClearITPendingBit(uint16_t RTC_IT); 117 | 118 | #ifdef __cplusplus 119 | } 120 | #endif 121 | 122 | #endif /* __STM32F10x_RTC_H */ 123 | /** 124 | * @} 125 | */ 126 | 127 | /** 128 | * @} 129 | */ 130 | 131 | /** 132 | * @} 133 | */ 134 | 135 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 136 | -------------------------------------------------------------------------------- /示例/STM32F103ZET6/STM32F10x_FWLib/inc/stm32f10x_wwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_wwdg.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the WWDG firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 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 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_WWDG_H 25 | #define __STM32F10x_WWDG_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup WWDG 39 | * @{ 40 | */ 41 | 42 | /** @defgroup WWDG_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup WWDG_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | /** @defgroup WWDG_Prescaler 55 | * @{ 56 | */ 57 | 58 | #define WWDG_Prescaler_1 ((uint32_t)0x00000000) 59 | #define WWDG_Prescaler_2 ((uint32_t)0x00000080) 60 | #define WWDG_Prescaler_4 ((uint32_t)0x00000100) 61 | #define WWDG_Prescaler_8 ((uint32_t)0x00000180) 62 | #define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_Prescaler_1) || \ 63 | ((PRESCALER) == WWDG_Prescaler_2) || \ 64 | ((PRESCALER) == WWDG_Prescaler_4) || \ 65 | ((PRESCALER) == WWDG_Prescaler_8)) 66 | #define IS_WWDG_WINDOW_VALUE(VALUE) ((VALUE) <= 0x7F) 67 | #define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F)) 68 | 69 | /** 70 | * @} 71 | */ 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | /** @defgroup WWDG_Exported_Macros 78 | * @{ 79 | */ 80 | /** 81 | * @} 82 | */ 83 | 84 | /** @defgroup WWDG_Exported_Functions 85 | * @{ 86 | */ 87 | 88 | void WWDG_DeInit(void); 89 | void WWDG_SetPrescaler(uint32_t WWDG_Prescaler); 90 | void WWDG_SetWindowValue(uint8_t WindowValue); 91 | void WWDG_EnableIT(void); 92 | void WWDG_SetCounter(uint8_t Counter); 93 | void WWDG_Enable(uint8_t Counter); 94 | FlagStatus WWDG_GetFlagStatus(void); 95 | void WWDG_ClearFlag(void); 96 | 97 | #ifdef __cplusplus 98 | } 99 | #endif 100 | 101 | #endif /* __STM32F10x_WWDG_H */ 102 | 103 | /** 104 | * @} 105 | */ 106 | 107 | /** 108 | * @} 109 | */ 110 | 111 | /** 112 | * @} 113 | */ 114 | 115 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 116 | -------------------------------------------------------------------------------- /示例/STM32F103ZET6/STM32F10x_FWLib/src/stm32f10x_crc.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_crc.c 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file provides all the CRC firmware functions. 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 | /* Includes ------------------------------------------------------------------*/ 23 | #include "stm32f10x_crc.h" 24 | 25 | /** @addtogroup STM32F10x_StdPeriph_Driver 26 | * @{ 27 | */ 28 | 29 | /** @defgroup CRC 30 | * @brief CRC driver modules 31 | * @{ 32 | */ 33 | 34 | /** @defgroup CRC_Private_TypesDefinitions 35 | * @{ 36 | */ 37 | 38 | /** 39 | * @} 40 | */ 41 | 42 | /** @defgroup CRC_Private_Defines 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup CRC_Private_Macros 51 | * @{ 52 | */ 53 | 54 | /** 55 | * @} 56 | */ 57 | 58 | /** @defgroup CRC_Private_Variables 59 | * @{ 60 | */ 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @defgroup CRC_Private_FunctionPrototypes 67 | * @{ 68 | */ 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @defgroup CRC_Private_Functions 75 | * @{ 76 | */ 77 | 78 | /** 79 | * @brief Resets the CRC Data register (DR). 80 | * @param None 81 | * @retval None 82 | */ 83 | void CRC_ResetDR(void) 84 | { 85 | /* Reset CRC generator */ 86 | CRC->CR = CRC_CR_RESET; 87 | } 88 | 89 | /** 90 | * @brief Computes the 32-bit CRC of a given data word(32-bit). 91 | * @param Data: data word(32-bit) to compute its CRC 92 | * @retval 32-bit CRC 93 | */ 94 | uint32_t CRC_CalcCRC(uint32_t Data) 95 | { 96 | CRC->DR = Data; 97 | 98 | return (CRC->DR); 99 | } 100 | 101 | /** 102 | * @brief Computes the 32-bit CRC of a given buffer of data word(32-bit). 103 | * @param pBuffer: pointer to the buffer containing the data to be computed 104 | * @param BufferLength: length of the buffer to be computed 105 | * @retval 32-bit CRC 106 | */ 107 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength) 108 | { 109 | uint32_t index = 0; 110 | 111 | for(index = 0; index < BufferLength; index++) 112 | { 113 | CRC->DR = pBuffer[index]; 114 | } 115 | return (CRC->DR); 116 | } 117 | 118 | /** 119 | * @brief Returns the current CRC value. 120 | * @param None 121 | * @retval 32-bit CRC 122 | */ 123 | uint32_t CRC_GetCRC(void) 124 | { 125 | return (CRC->DR); 126 | } 127 | 128 | /** 129 | * @brief Stores a 8-bit data in the Independent Data(ID) register. 130 | * @param IDValue: 8-bit value to be stored in the ID register 131 | * @retval None 132 | */ 133 | void CRC_SetIDRegister(uint8_t IDValue) 134 | { 135 | CRC->IDR = IDValue; 136 | } 137 | 138 | /** 139 | * @brief Returns the 8-bit data stored in the Independent Data(ID) register 140 | * @param None 141 | * @retval 8-bit value of the ID register 142 | */ 143 | uint8_t CRC_GetIDRegister(void) 144 | { 145 | return (CRC->IDR); 146 | } 147 | 148 | /** 149 | * @} 150 | */ 151 | 152 | /** 153 | * @} 154 | */ 155 | 156 | /** 157 | * @} 158 | */ 159 | 160 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 161 | -------------------------------------------------------------------------------- /示例/STM32F103ZET6/STM32F10x_FWLib/src/stm32f10x_flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F103ZET6/STM32F10x_FWLib/src/stm32f10x_flash.c -------------------------------------------------------------------------------- /示例/STM32F103ZET6/STM32F10x_FWLib/src/stm32f10x_i2c.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F103ZET6/STM32F10x_FWLib/src/stm32f10x_i2c.c -------------------------------------------------------------------------------- /示例/STM32F103ZET6/STM32F10x_FWLib/src/stm32f10x_usart.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F103ZET6/STM32F10x_FWLib/src/stm32f10x_usart.c -------------------------------------------------------------------------------- /示例/STM32F103ZET6/SYSTEM/delay/delay.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F103ZET6/SYSTEM/delay/delay.c -------------------------------------------------------------------------------- /示例/STM32F103ZET6/SYSTEM/delay/delay.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F103ZET6/SYSTEM/delay/delay.h -------------------------------------------------------------------------------- /示例/STM32F103ZET6/SYSTEM/sys/sys.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F103ZET6/SYSTEM/sys/sys.c -------------------------------------------------------------------------------- /示例/STM32F103ZET6/SYSTEM/sys/sys.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F103ZET6/SYSTEM/sys/sys.h -------------------------------------------------------------------------------- /示例/STM32F103ZET6/SYSTEM/usart/usart.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F103ZET6/SYSTEM/usart/usart.c -------------------------------------------------------------------------------- /示例/STM32F103ZET6/SYSTEM/usart/usart.h: -------------------------------------------------------------------------------- 1 | #ifndef __USART_H 2 | #define __USART_H 3 | #include "stdio.h" 4 | #include "sys.h" 5 | 6 | void usart_init(u32 bound); 7 | u8 usart_get_data(char *cmd,float *d1,float *d2,float *d3); 8 | void usart_senddatas(USART_TypeDef* USARTx,u8* addr,int size); 9 | #endif 10 | 11 | 12 | -------------------------------------------------------------------------------- /示例/STM32F103ZET6/USER/DebugConfig/LED_STM32F103ZE_1.0.0.dbgconf: -------------------------------------------------------------------------------- 1 | // File: STM32F101_102_103_105_107.dbgconf 2 | // Version: 1.0.0 3 | // Note: refer to STM32F101xx STM32F102xx STM32F103xx STM32F105xx STM32F107xx Reference manual (RM0008) 4 | // STM32F101xx STM32F102xx STM32F103xx STM32F105xx STM32F107xx datasheets 5 | 6 | // <<< Use Configuration Wizard in Context Menu >>> 7 | 8 | // Debug MCU configuration register (DBGMCU_CR) 9 | // Reserved bits must be kept at reset value 10 | // DBG_TIM11_STOP TIM11 counter stopped when core is halted 11 | // DBG_TIM10_STOP TIM10 counter stopped when core is halted 12 | // DBG_TIM9_STOP TIM9 counter stopped when core is halted 13 | // DBG_TIM14_STOP TIM14 counter stopped when core is halted 14 | // DBG_TIM13_STOP TIM13 counter stopped when core is halted 15 | // DBG_TIM12_STOP TIM12 counter stopped when core is halted 16 | // DBG_CAN2_STOP Debug CAN2 stopped when core is halted 17 | // DBG_TIM7_STOP TIM7 counter stopped when core is halted 18 | // DBG_TIM6_STOP TIM6 counter stopped when core is halted 19 | // DBG_TIM5_STOP TIM5 counter stopped when core is halted 20 | // DBG_TIM8_STOP TIM8 counter stopped when core is halted 21 | // DBG_I2C2_SMBUS_TIMEOUT SMBUS timeout mode stopped when core is halted 22 | // DBG_I2C1_SMBUS_TIMEOUT SMBUS timeout mode stopped when core is halted 23 | // DBG_CAN1_STOP Debug CAN1 stopped when Core is halted 24 | // DBG_TIM4_STOP TIM4 counter stopped when core is halted 25 | // DBG_TIM3_STOP TIM3 counter stopped when core is halted 26 | // DBG_TIM2_STOP TIM2 counter stopped when core is halted 27 | // DBG_TIM1_STOP TIM1 counter stopped when core is halted 28 | // DBG_WWDG_STOP Debug window watchdog stopped when core is halted 29 | // DBG_IWDG_STOP Debug independent watchdog stopped when core is halted 30 | // DBG_STANDBY Debug standby mode 31 | // DBG_STOP Debug stop mode 32 | // DBG_SLEEP Debug sleep mode 33 | // 34 | DbgMCU_CR = 0x00000007; 35 | 36 | // <<< end of configuration section >>> 37 | -------------------------------------------------------------------------------- /示例/STM32F103ZET6/USER/JLinkSettings.ini: -------------------------------------------------------------------------------- 1 | [BREAKPOINTS] 2 | ForceImpTypeAny = 0 3 | ShowInfoWin = 1 4 | EnableFlashBP = 2 5 | BPDuringExecution = 0 6 | [CFI] 7 | CFISize = 0x00 8 | CFIAddr = 0x00 9 | [CPU] 10 | OverrideMemMap = 0 11 | AllowSimulation = 1 12 | ScriptFile="" 13 | [FLASH] 14 | CacheExcludeSize = 0x00 15 | CacheExcludeAddr = 0x00 16 | MinNumBytesFlashDL = 0 17 | SkipProgOnCRCMatch = 1 18 | VerifyDownload = 1 19 | AllowCaching = 1 20 | EnableFlashDL = 2 21 | Override = 0 22 | Device="UNSPECIFIED" 23 | [GENERAL] 24 | WorkRAMSize = 0x00 25 | WorkRAMAddr = 0x00 26 | RAMUsageLimit = 0x00 27 | [SWO] 28 | SWOLogFile="" 29 | [MEM] 30 | RdOverrideOrMask = 0x00 31 | RdOverrideAndMask = 0xFFFFFFFF 32 | RdOverrideAddr = 0xFFFFFFFF 33 | WrOverrideOrMask = 0x00 34 | WrOverrideAndMask = 0xFFFFFFFF 35 | WrOverrideAddr = 0xFFFFFFFF 36 | -------------------------------------------------------------------------------- /示例/STM32F103ZET6/USER/main.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F103ZET6/USER/main.c -------------------------------------------------------------------------------- /示例/STM32F103ZET6/USER/stm32f10x.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F103ZET6/USER/stm32f10x.h -------------------------------------------------------------------------------- /示例/STM32F103ZET6/USER/stm32f10x_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file GPIO/IOToggle/stm32f10x_conf.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 08-April-2011 7 | * @brief Library configuration 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 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F10x_CONF_H 24 | #define __STM32F10x_CONF_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | /* Uncomment/Comment the line below to enable/disable peripheral header file inclusion */ 28 | #include "stm32f10x_adc.h" 29 | #include "stm32f10x_bkp.h" 30 | #include "stm32f10x_can.h" 31 | #include "stm32f10x_cec.h" 32 | #include "stm32f10x_crc.h" 33 | #include "stm32f10x_dac.h" 34 | #include "stm32f10x_dbgmcu.h" 35 | #include "stm32f10x_dma.h" 36 | #include "stm32f10x_exti.h" 37 | #include "stm32f10x_flash.h" 38 | #include "stm32f10x_fsmc.h" 39 | #include "stm32f10x_gpio.h" 40 | #include "stm32f10x_i2c.h" 41 | #include "stm32f10x_iwdg.h" 42 | #include "stm32f10x_pwr.h" 43 | #include "stm32f10x_rcc.h" 44 | #include "stm32f10x_rtc.h" 45 | #include "stm32f10x_sdio.h" 46 | #include "stm32f10x_spi.h" 47 | #include "stm32f10x_tim.h" 48 | #include "stm32f10x_usart.h" 49 | #include "stm32f10x_wwdg.h" 50 | #include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ 51 | 52 | /* Exported types ------------------------------------------------------------*/ 53 | /* Exported constants --------------------------------------------------------*/ 54 | /* Uncomment the line below to expanse the "assert_param" macro in the 55 | Standard Peripheral Library drivers code */ 56 | /* #define USE_FULL_ASSERT 1 */ 57 | 58 | /* Exported macro ------------------------------------------------------------*/ 59 | #ifdef USE_FULL_ASSERT 60 | 61 | /** 62 | * @brief The assert_param macro is used for function's parameters check. 63 | * @param expr: If expr is false, it calls assert_failed function which reports 64 | * the name of the source file and the source line number of the call 65 | * that failed. If expr is true, it returns no value. 66 | * @retval None 67 | */ 68 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 69 | /* Exported functions ------------------------------------------------------- */ 70 | void assert_failed(uint8_t* file, uint32_t line); 71 | #else 72 | #define assert_param(expr) ((void)0) 73 | #endif /* USE_FULL_ASSERT */ 74 | 75 | #endif /* __STM32F10x_CONF_H */ 76 | 77 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 78 | -------------------------------------------------------------------------------- /示例/STM32F103ZET6/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 | -------------------------------------------------------------------------------- /示例/STM32F103ZET6/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 | -------------------------------------------------------------------------------- /示例/STM32F103ZET6/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 | -------------------------------------------------------------------------------- /示例/STM32F103ZET6/keilkilll.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F103ZET6/keilkilll.bat -------------------------------------------------------------------------------- /示例/STM32F407ZGT6/FWLIB/inc/stm32f4xx_crc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_crc.h 4 | * @author MCD Application Team 5 | * @version V1.4.0 6 | * @date 04-August-2014 7 | * @brief This file contains all the functions prototypes for the CRC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2014 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F4xx_CRC_H 31 | #define __STM32F4xx_CRC_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f4xx.h" 39 | 40 | /** @addtogroup STM32F4xx_StdPeriph_Driver 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup CRC 45 | * @{ 46 | */ 47 | 48 | /* Exported types ------------------------------------------------------------*/ 49 | /* Exported constants --------------------------------------------------------*/ 50 | 51 | /** @defgroup CRC_Exported_Constants 52 | * @{ 53 | */ 54 | 55 | /** 56 | * @} 57 | */ 58 | 59 | /* Exported macro ------------------------------------------------------------*/ 60 | /* Exported functions --------------------------------------------------------*/ 61 | 62 | void CRC_ResetDR(void); 63 | uint32_t CRC_CalcCRC(uint32_t Data); 64 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength); 65 | uint32_t CRC_GetCRC(void); 66 | void CRC_SetIDRegister(uint8_t IDValue); 67 | uint8_t CRC_GetIDRegister(void); 68 | 69 | #ifdef __cplusplus 70 | } 71 | #endif 72 | 73 | #endif /* __STM32F4xx_CRC_H */ 74 | 75 | /** 76 | * @} 77 | */ 78 | 79 | /** 80 | * @} 81 | */ 82 | 83 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 84 | -------------------------------------------------------------------------------- /示例/STM32F407ZGT6/FWLIB/inc/stm32f4xx_dbgmcu.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_dbgmcu.h 4 | * @author MCD Application Team 5 | * @version V1.4.0 6 | * @date 04-August-2014 7 | * @brief This file contains all the functions prototypes for the DBGMCU firmware library. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2014 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __STM32F4xx_DBGMCU_H 30 | #define __STM32F4xx_DBGMCU_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | /* Includes ------------------------------------------------------------------*/ 37 | #include "stm32f4xx.h" 38 | 39 | /** @addtogroup STM32F4xx_StdPeriph_Driver 40 | * @{ 41 | */ 42 | 43 | /** @addtogroup DBGMCU 44 | * @{ 45 | */ 46 | 47 | /* Exported types ------------------------------------------------------------*/ 48 | /* Exported constants --------------------------------------------------------*/ 49 | 50 | /** @defgroup DBGMCU_Exported_Constants 51 | * @{ 52 | */ 53 | #define DBGMCU_SLEEP ((uint32_t)0x00000001) 54 | #define DBGMCU_STOP ((uint32_t)0x00000002) 55 | #define DBGMCU_STANDBY ((uint32_t)0x00000004) 56 | #define IS_DBGMCU_PERIPH(PERIPH) ((((PERIPH) & 0xFFFFFFF8) == 0x00) && ((PERIPH) != 0x00)) 57 | 58 | #define DBGMCU_TIM2_STOP ((uint32_t)0x00000001) 59 | #define DBGMCU_TIM3_STOP ((uint32_t)0x00000002) 60 | #define DBGMCU_TIM4_STOP ((uint32_t)0x00000004) 61 | #define DBGMCU_TIM5_STOP ((uint32_t)0x00000008) 62 | #define DBGMCU_TIM6_STOP ((uint32_t)0x00000010) 63 | #define DBGMCU_TIM7_STOP ((uint32_t)0x00000020) 64 | #define DBGMCU_TIM12_STOP ((uint32_t)0x00000040) 65 | #define DBGMCU_TIM13_STOP ((uint32_t)0x00000080) 66 | #define DBGMCU_TIM14_STOP ((uint32_t)0x00000100) 67 | #define DBGMCU_RTC_STOP ((uint32_t)0x00000400) 68 | #define DBGMCU_WWDG_STOP ((uint32_t)0x00000800) 69 | #define DBGMCU_IWDG_STOP ((uint32_t)0x00001000) 70 | #define DBGMCU_I2C1_SMBUS_TIMEOUT ((uint32_t)0x00200000) 71 | #define DBGMCU_I2C2_SMBUS_TIMEOUT ((uint32_t)0x00400000) 72 | #define DBGMCU_I2C3_SMBUS_TIMEOUT ((uint32_t)0x00800000) 73 | #define DBGMCU_CAN1_STOP ((uint32_t)0x02000000) 74 | #define DBGMCU_CAN2_STOP ((uint32_t)0x04000000) 75 | #define IS_DBGMCU_APB1PERIPH(PERIPH) ((((PERIPH) & 0xF91FE200) == 0x00) && ((PERIPH) != 0x00)) 76 | 77 | #define DBGMCU_TIM1_STOP ((uint32_t)0x00000001) 78 | #define DBGMCU_TIM8_STOP ((uint32_t)0x00000002) 79 | #define DBGMCU_TIM9_STOP ((uint32_t)0x00010000) 80 | #define DBGMCU_TIM10_STOP ((uint32_t)0x00020000) 81 | #define DBGMCU_TIM11_STOP ((uint32_t)0x00040000) 82 | #define IS_DBGMCU_APB2PERIPH(PERIPH) ((((PERIPH) & 0xFFF8FFFC) == 0x00) && ((PERIPH) != 0x00)) 83 | /** 84 | * @} 85 | */ 86 | 87 | /* Exported macro ------------------------------------------------------------*/ 88 | /* Exported functions --------------------------------------------------------*/ 89 | uint32_t DBGMCU_GetREVID(void); 90 | uint32_t DBGMCU_GetDEVID(void); 91 | void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState); 92 | void DBGMCU_APB1PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState); 93 | void DBGMCU_APB2PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState); 94 | 95 | #ifdef __cplusplus 96 | } 97 | #endif 98 | 99 | #endif /* __STM32F4xx_DBGMCU_H */ 100 | 101 | /** 102 | * @} 103 | */ 104 | 105 | /** 106 | * @} 107 | */ 108 | 109 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 110 | -------------------------------------------------------------------------------- /示例/STM32F407ZGT6/FWLIB/inc/stm32f4xx_flash_ramfunc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_flash_ramfunc.h 4 | * @author MCD Application Team 5 | * @version V1.4.0 6 | * @date 04-August-2014 7 | * @brief Header file of FLASH RAMFUNC driver. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2014 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F4xx_FLASH_RAMFUNC_H 31 | #define __STM32F4xx_FLASH_RAMFUNC_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f4xx.h" 39 | 40 | /** @addtogroup STM32F4xx_StdPeriph_Driver 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup FLASH RAMFUNC 45 | * @{ 46 | */ 47 | 48 | /* Exported types ------------------------------------------------------------*/ 49 | /* Private define ------------------------------------------------------------*/ 50 | /** 51 | * @brief __RAM_FUNC definition 52 | */ 53 | #if defined ( __CC_ARM ) 54 | /* ARM Compiler 55 | ------------ 56 | RAM functions are defined using the toolchain options. 57 | Functions that are executed in RAM should reside in a separate source module. 58 | Using the 'Options for File' dialog you can simply change the 'Code / Const' 59 | area of a module to a memory space in physical RAM. 60 | Available memory areas are declared in the 'Target' tab of the 'Options for Target' 61 | dialog. 62 | */ 63 | #define __RAM_FUNC void 64 | 65 | #elif defined ( __ICCARM__ ) 66 | /* ICCARM Compiler 67 | --------------- 68 | RAM functions are defined using a specific toolchain keyword "__ramfunc". 69 | */ 70 | #define __RAM_FUNC __ramfunc void 71 | 72 | #elif defined ( __GNUC__ ) 73 | /* GNU Compiler 74 | ------------ 75 | RAM functions are defined using a specific toolchain attribute 76 | "__attribute__((section(".RamFunc")))". 77 | */ 78 | #define __RAM_FUNC void __attribute__((section(".RamFunc"))) 79 | 80 | #endif 81 | /* Exported constants --------------------------------------------------------*/ 82 | /* Exported macro ------------------------------------------------------------*/ 83 | /* Exported functions --------------------------------------------------------*/ 84 | __RAM_FUNC FLASH_FlashInterfaceCmd(FunctionalState NewState); 85 | __RAM_FUNC FLASH_FlashSleepModeCmd(FunctionalState NewState); 86 | 87 | 88 | #ifdef __cplusplus 89 | } 90 | #endif 91 | 92 | #endif /* __STM32F4xx_FLASH_RAMFUNC_H */ 93 | 94 | /** 95 | * @} 96 | */ 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 103 | 104 | -------------------------------------------------------------------------------- /示例/STM32F407ZGT6/FWLIB/inc/stm32f4xx_iwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_iwdg.h 4 | * @author MCD Application Team 5 | * @version V1.4.0 6 | * @date 04-August-2014 7 | * @brief This file contains all the functions prototypes for the IWDG 8 | * firmware library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2014 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F4xx_IWDG_H 31 | #define __STM32F4xx_IWDG_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f4xx.h" 39 | 40 | /** @addtogroup STM32F4xx_StdPeriph_Driver 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup IWDG 45 | * @{ 46 | */ 47 | 48 | /* Exported types ------------------------------------------------------------*/ 49 | /* Exported constants --------------------------------------------------------*/ 50 | 51 | /** @defgroup IWDG_Exported_Constants 52 | * @{ 53 | */ 54 | 55 | /** @defgroup IWDG_WriteAccess 56 | * @{ 57 | */ 58 | #define IWDG_WriteAccess_Enable ((uint16_t)0x5555) 59 | #define IWDG_WriteAccess_Disable ((uint16_t)0x0000) 60 | #define IS_IWDG_WRITE_ACCESS(ACCESS) (((ACCESS) == IWDG_WriteAccess_Enable) || \ 61 | ((ACCESS) == IWDG_WriteAccess_Disable)) 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @defgroup IWDG_prescaler 67 | * @{ 68 | */ 69 | #define IWDG_Prescaler_4 ((uint8_t)0x00) 70 | #define IWDG_Prescaler_8 ((uint8_t)0x01) 71 | #define IWDG_Prescaler_16 ((uint8_t)0x02) 72 | #define IWDG_Prescaler_32 ((uint8_t)0x03) 73 | #define IWDG_Prescaler_64 ((uint8_t)0x04) 74 | #define IWDG_Prescaler_128 ((uint8_t)0x05) 75 | #define IWDG_Prescaler_256 ((uint8_t)0x06) 76 | #define IS_IWDG_PRESCALER(PRESCALER) (((PRESCALER) == IWDG_Prescaler_4) || \ 77 | ((PRESCALER) == IWDG_Prescaler_8) || \ 78 | ((PRESCALER) == IWDG_Prescaler_16) || \ 79 | ((PRESCALER) == IWDG_Prescaler_32) || \ 80 | ((PRESCALER) == IWDG_Prescaler_64) || \ 81 | ((PRESCALER) == IWDG_Prescaler_128)|| \ 82 | ((PRESCALER) == IWDG_Prescaler_256)) 83 | /** 84 | * @} 85 | */ 86 | 87 | /** @defgroup IWDG_Flag 88 | * @{ 89 | */ 90 | #define IWDG_FLAG_PVU ((uint16_t)0x0001) 91 | #define IWDG_FLAG_RVU ((uint16_t)0x0002) 92 | #define IS_IWDG_FLAG(FLAG) (((FLAG) == IWDG_FLAG_PVU) || ((FLAG) == IWDG_FLAG_RVU)) 93 | #define IS_IWDG_RELOAD(RELOAD) ((RELOAD) <= 0xFFF) 94 | /** 95 | * @} 96 | */ 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | /* Exported macro ------------------------------------------------------------*/ 103 | /* Exported functions --------------------------------------------------------*/ 104 | 105 | /* Prescaler and Counter configuration functions ******************************/ 106 | void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess); 107 | void IWDG_SetPrescaler(uint8_t IWDG_Prescaler); 108 | void IWDG_SetReload(uint16_t Reload); 109 | void IWDG_ReloadCounter(void); 110 | 111 | /* IWDG activation function ***************************************************/ 112 | void IWDG_Enable(void); 113 | 114 | /* Flag management function ***************************************************/ 115 | FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG); 116 | 117 | #ifdef __cplusplus 118 | } 119 | #endif 120 | 121 | #endif /* __STM32F4xx_IWDG_H */ 122 | 123 | /** 124 | * @} 125 | */ 126 | 127 | /** 128 | * @} 129 | */ 130 | 131 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 132 | -------------------------------------------------------------------------------- /示例/STM32F407ZGT6/FWLIB/inc/stm32f4xx_rng.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_rng.h 4 | * @author MCD Application Team 5 | * @version V1.4.0 6 | * @date 04-August-2014 7 | * @brief This file contains all the functions prototypes for the Random 8 | * Number Generator(RNG) firmware library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2014 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F4xx_RNG_H 31 | #define __STM32F4xx_RNG_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f4xx.h" 39 | 40 | /** @addtogroup STM32F4xx_StdPeriph_Driver 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup RNG 45 | * @{ 46 | */ 47 | 48 | /* Exported types ------------------------------------------------------------*/ 49 | /* Exported constants --------------------------------------------------------*/ 50 | 51 | /** @defgroup RNG_Exported_Constants 52 | * @{ 53 | */ 54 | 55 | /** @defgroup RNG_flags_definition 56 | * @{ 57 | */ 58 | #define RNG_FLAG_DRDY ((uint8_t)0x0001) /*!< Data ready */ 59 | #define RNG_FLAG_CECS ((uint8_t)0x0002) /*!< Clock error current status */ 60 | #define RNG_FLAG_SECS ((uint8_t)0x0004) /*!< Seed error current status */ 61 | 62 | #define IS_RNG_GET_FLAG(RNG_FLAG) (((RNG_FLAG) == RNG_FLAG_DRDY) || \ 63 | ((RNG_FLAG) == RNG_FLAG_CECS) || \ 64 | ((RNG_FLAG) == RNG_FLAG_SECS)) 65 | #define IS_RNG_CLEAR_FLAG(RNG_FLAG) (((RNG_FLAG) == RNG_FLAG_CECS) || \ 66 | ((RNG_FLAG) == RNG_FLAG_SECS)) 67 | /** 68 | * @} 69 | */ 70 | 71 | /** @defgroup RNG_interrupts_definition 72 | * @{ 73 | */ 74 | #define RNG_IT_CEI ((uint8_t)0x20) /*!< Clock error interrupt */ 75 | #define RNG_IT_SEI ((uint8_t)0x40) /*!< Seed error interrupt */ 76 | 77 | #define IS_RNG_IT(IT) ((((IT) & (uint8_t)0x9F) == 0x00) && ((IT) != 0x00)) 78 | #define IS_RNG_GET_IT(RNG_IT) (((RNG_IT) == RNG_IT_CEI) || ((RNG_IT) == RNG_IT_SEI)) 79 | /** 80 | * @} 81 | */ 82 | 83 | /** 84 | * @} 85 | */ 86 | 87 | /* Exported macro ------------------------------------------------------------*/ 88 | /* Exported functions --------------------------------------------------------*/ 89 | 90 | /* Function used to set the RNG configuration to the default reset state *****/ 91 | void RNG_DeInit(void); 92 | 93 | /* Configuration function *****************************************************/ 94 | void RNG_Cmd(FunctionalState NewState); 95 | 96 | /* Get 32 bit Random number function ******************************************/ 97 | uint32_t RNG_GetRandomNumber(void); 98 | 99 | /* Interrupts and flags management functions **********************************/ 100 | void RNG_ITConfig(FunctionalState NewState); 101 | FlagStatus RNG_GetFlagStatus(uint8_t RNG_FLAG); 102 | void RNG_ClearFlag(uint8_t RNG_FLAG); 103 | ITStatus RNG_GetITStatus(uint8_t RNG_IT); 104 | void RNG_ClearITPendingBit(uint8_t RNG_IT); 105 | 106 | #ifdef __cplusplus 107 | } 108 | #endif 109 | 110 | #endif /*__STM32F4xx_RNG_H */ 111 | 112 | /** 113 | * @} 114 | */ 115 | 116 | /** 117 | * @} 118 | */ 119 | 120 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 121 | -------------------------------------------------------------------------------- /示例/STM32F407ZGT6/FWLIB/inc/stm32f4xx_wwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_wwdg.h 4 | * @author MCD Application Team 5 | * @version V1.4.0 6 | * @date 04-August-2014 7 | * @brief This file contains all the functions prototypes for the WWDG firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2014 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F4xx_WWDG_H 31 | #define __STM32F4xx_WWDG_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f4xx.h" 39 | 40 | /** @addtogroup STM32F4xx_StdPeriph_Driver 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup WWDG 45 | * @{ 46 | */ 47 | 48 | /* Exported types ------------------------------------------------------------*/ 49 | /* Exported constants --------------------------------------------------------*/ 50 | 51 | /** @defgroup WWDG_Exported_Constants 52 | * @{ 53 | */ 54 | 55 | /** @defgroup WWDG_Prescaler 56 | * @{ 57 | */ 58 | 59 | #define WWDG_Prescaler_1 ((uint32_t)0x00000000) 60 | #define WWDG_Prescaler_2 ((uint32_t)0x00000080) 61 | #define WWDG_Prescaler_4 ((uint32_t)0x00000100) 62 | #define WWDG_Prescaler_8 ((uint32_t)0x00000180) 63 | #define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_Prescaler_1) || \ 64 | ((PRESCALER) == WWDG_Prescaler_2) || \ 65 | ((PRESCALER) == WWDG_Prescaler_4) || \ 66 | ((PRESCALER) == WWDG_Prescaler_8)) 67 | #define IS_WWDG_WINDOW_VALUE(VALUE) ((VALUE) <= 0x7F) 68 | #define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F)) 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | /** 75 | * @} 76 | */ 77 | 78 | /* Exported macro ------------------------------------------------------------*/ 79 | /* Exported functions --------------------------------------------------------*/ 80 | 81 | /* Function used to set the WWDG configuration to the default reset state ****/ 82 | void WWDG_DeInit(void); 83 | 84 | /* Prescaler, Refresh window and Counter configuration functions **************/ 85 | void WWDG_SetPrescaler(uint32_t WWDG_Prescaler); 86 | void WWDG_SetWindowValue(uint8_t WindowValue); 87 | void WWDG_EnableIT(void); 88 | void WWDG_SetCounter(uint8_t Counter); 89 | 90 | /* WWDG activation function ***************************************************/ 91 | void WWDG_Enable(uint8_t Counter); 92 | 93 | /* Interrupts and flags management functions **********************************/ 94 | FlagStatus WWDG_GetFlagStatus(void); 95 | void WWDG_ClearFlag(void); 96 | 97 | #ifdef __cplusplus 98 | } 99 | #endif 100 | 101 | #endif /* __STM32F4xx_WWDG_H */ 102 | 103 | /** 104 | * @} 105 | */ 106 | 107 | /** 108 | * @} 109 | */ 110 | 111 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 112 | -------------------------------------------------------------------------------- /示例/STM32F407ZGT6/FWLIB/src/stm32f4xx_crc.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_crc.c 4 | * @author MCD Application Team 5 | * @version V1.4.0 6 | * @date 04-August-2014 7 | * @brief This file provides all the CRC firmware functions. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2014 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "stm32f4xx_crc.h" 30 | 31 | /** @addtogroup STM32F4xx_StdPeriph_Driver 32 | * @{ 33 | */ 34 | 35 | /** @defgroup CRC 36 | * @brief CRC driver modules 37 | * @{ 38 | */ 39 | 40 | /* Private typedef -----------------------------------------------------------*/ 41 | /* Private define ------------------------------------------------------------*/ 42 | /* Private macro -------------------------------------------------------------*/ 43 | /* Private variables ---------------------------------------------------------*/ 44 | /* Private function prototypes -----------------------------------------------*/ 45 | /* Private functions ---------------------------------------------------------*/ 46 | 47 | /** @defgroup CRC_Private_Functions 48 | * @{ 49 | */ 50 | 51 | /** 52 | * @brief Resets the CRC Data register (DR). 53 | * @param None 54 | * @retval None 55 | */ 56 | void CRC_ResetDR(void) 57 | { 58 | /* Reset CRC generator */ 59 | CRC->CR = CRC_CR_RESET; 60 | } 61 | 62 | /** 63 | * @brief Computes the 32-bit CRC of a given data word(32-bit). 64 | * @param Data: data word(32-bit) to compute its CRC 65 | * @retval 32-bit CRC 66 | */ 67 | uint32_t CRC_CalcCRC(uint32_t Data) 68 | { 69 | CRC->DR = Data; 70 | 71 | return (CRC->DR); 72 | } 73 | 74 | /** 75 | * @brief Computes the 32-bit CRC of a given buffer of data word(32-bit). 76 | * @param pBuffer: pointer to the buffer containing the data to be computed 77 | * @param BufferLength: length of the buffer to be computed 78 | * @retval 32-bit CRC 79 | */ 80 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength) 81 | { 82 | uint32_t index = 0; 83 | 84 | for(index = 0; index < BufferLength; index++) 85 | { 86 | CRC->DR = pBuffer[index]; 87 | } 88 | return (CRC->DR); 89 | } 90 | 91 | /** 92 | * @brief Returns the current CRC value. 93 | * @param None 94 | * @retval 32-bit CRC 95 | */ 96 | uint32_t CRC_GetCRC(void) 97 | { 98 | return (CRC->DR); 99 | } 100 | 101 | /** 102 | * @brief Stores a 8-bit data in the Independent Data(ID) register. 103 | * @param IDValue: 8-bit value to be stored in the ID register 104 | * @retval None 105 | */ 106 | void CRC_SetIDRegister(uint8_t IDValue) 107 | { 108 | CRC->IDR = IDValue; 109 | } 110 | 111 | /** 112 | * @brief Returns the 8-bit data stored in the Independent Data(ID) register 113 | * @param None 114 | * @retval 8-bit value of the ID register 115 | */ 116 | uint8_t CRC_GetIDRegister(void) 117 | { 118 | return (CRC->IDR); 119 | } 120 | 121 | /** 122 | * @} 123 | */ 124 | 125 | /** 126 | * @} 127 | */ 128 | 129 | /** 130 | * @} 131 | */ 132 | 133 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 134 | -------------------------------------------------------------------------------- /示例/STM32F407ZGT6/HARDWARE/LED/led.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F407ZGT6/HARDWARE/LED/led.c -------------------------------------------------------------------------------- /示例/STM32F407ZGT6/HARDWARE/LED/led.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F407ZGT6/HARDWARE/LED/led.h -------------------------------------------------------------------------------- /示例/STM32F407ZGT6/SYSTEM/delay/delay.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F407ZGT6/SYSTEM/delay/delay.c -------------------------------------------------------------------------------- /示例/STM32F407ZGT6/SYSTEM/delay/delay.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F407ZGT6/SYSTEM/delay/delay.h -------------------------------------------------------------------------------- /示例/STM32F407ZGT6/SYSTEM/sys/sys.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F407ZGT6/SYSTEM/sys/sys.c -------------------------------------------------------------------------------- /示例/STM32F407ZGT6/SYSTEM/sys/sys.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F407ZGT6/SYSTEM/sys/sys.h -------------------------------------------------------------------------------- /示例/STM32F407ZGT6/SYSTEM/usart/usart.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F407ZGT6/SYSTEM/usart/usart.c -------------------------------------------------------------------------------- /示例/STM32F407ZGT6/SYSTEM/usart/usart.h: -------------------------------------------------------------------------------- 1 | #ifndef __USART_H 2 | #define __USART_H 3 | #include "stdio.h" 4 | #include "stm32f4xx_conf.h" 5 | #include "sys.h" 6 | 7 | 8 | void usart_init(u32 bound); 9 | u8 usart_get_data(char *cmd,float *d1,float *d2,float *d3); 10 | void usart_senddatas(USART_TypeDef* USARTx,u8* addr,int size); 11 | #endif 12 | 13 | 14 | -------------------------------------------------------------------------------- /示例/STM32F407ZGT6/USER/DebugConfig/LED_STM32F407ZG.dbgconf: -------------------------------------------------------------------------------- 1 | // File: STM32F405_415_407_417_427_437_429_439.dbgconf 2 | // Version: 1.0.0 3 | // Note: refer to STM32F405/415 STM32F407/417 STM32F427/437 STM32F429/439 reference manual (RM0090) 4 | // refer to STM32F40x STM32F41x datasheets 5 | // refer to STM32F42x STM32F43x datasheets 6 | 7 | // <<< Use Configuration Wizard in Context Menu >>> 8 | 9 | // Debug MCU configuration register (DBGMCU_CR) 10 | // DBG_STANDBY Debug Standby Mode 11 | // DBG_STOP Debug Stop Mode 12 | // DBG_SLEEP Debug Sleep Mode 13 | // 14 | DbgMCU_CR = 0x00000007; 15 | 16 | // Debug MCU APB1 freeze register (DBGMCU_APB1_FZ) 17 | // Reserved bits must be kept at reset value 18 | // DBG_CAN2_STOP CAN2 stopped when core is halted 19 | // DBG_CAN1_STOP CAN2 stopped when core is halted 20 | // DBG_I2C3_SMBUS_TIMEOUT I2C3 SMBUS timeout mode stopped when core is halted 21 | // DBG_I2C2_SMBUS_TIMEOUT I2C2 SMBUS timeout mode stopped when core is halted 22 | // DBG_I2C1_SMBUS_TIMEOUT I2C1 SMBUS timeout mode stopped when core is halted 23 | // DBG_IWDG_STOP Independent watchdog stopped when core is halted 24 | // DBG_WWDG_STOP Window watchdog stopped when core is halted 25 | // DBG_RTC_STOP RTC stopped when core is halted 26 | // DBG_TIM14_STOP TIM14 counter stopped when core is halted 27 | // DBG_TIM13_STOP TIM13 counter stopped when core is halted 28 | // DBG_TIM12_STOP TIM12 counter stopped when core is halted 29 | // DBG_TIM7_STOP TIM7 counter stopped when core is halted 30 | // DBG_TIM6_STOP TIM6 counter stopped when core is halted 31 | // DBG_TIM5_STOP TIM5 counter stopped when core is halted 32 | // DBG_TIM4_STOP TIM4 counter stopped when core is halted 33 | // DBG_TIM3_STOP TIM3 counter stopped when core is halted 34 | // DBG_TIM2_STOP TIM2 counter stopped when core is halted 35 | // 36 | DbgMCU_APB1_Fz = 0x00000000; 37 | 38 | // Debug MCU APB2 freeze register (DBGMCU_APB2_FZ) 39 | // Reserved bits must be kept at reset value 40 | // DBG_TIM11_STOP TIM11 counter stopped when core is halted 41 | // DBG_TIM10_STOP TIM10 counter stopped when core is halted 42 | // DBG_TIM9_STOP TIM9 counter stopped when core is halted 43 | // DBG_TIM8_STOP TIM8 counter stopped when core is halted 44 | // DBG_TIM1_STOP TIM1 counter stopped when core is halted 45 | // 46 | DbgMCU_APB2_Fz = 0x00000000; 47 | 48 | // <<< end of configuration section >>> -------------------------------------------------------------------------------- /示例/STM32F407ZGT6/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 | CacheExcludeSize = 0x00 14 | CacheExcludeAddr = 0x00 15 | MinNumBytesFlashDL = 0 16 | SkipProgOnCRCMatch = 1 17 | VerifyDownload = 1 18 | AllowCaching = 1 19 | EnableFlashDL = 2 20 | Override = 0 21 | Device="UNSPECIFIED" 22 | [GENERAL] 23 | WorkRAMSize = 0x00 24 | WorkRAMAddr = 0x00 25 | RAMUsageLimit = 0x00 26 | [SWO] 27 | SWOLogFile="" 28 | [MEM] 29 | RdOverrideOrMask = 0x00 30 | RdOverrideAndMask = 0xFFFFFFFF 31 | RdOverrideAddr = 0xFFFFFFFF 32 | WrOverrideOrMask = 0x00 33 | WrOverrideAndMask = 0xFFFFFFFF 34 | WrOverrideAddr = 0xFFFFFFFF 35 | -------------------------------------------------------------------------------- /示例/STM32F407ZGT6/USER/main.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F407ZGT6/USER/main.c -------------------------------------------------------------------------------- /示例/STM32F407ZGT6/USER/stm32f4xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F407ZGT6/USER/stm32f4xx.h -------------------------------------------------------------------------------- /示例/STM32F407ZGT6/USER/stm32f4xx_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Project/STM32F4xx_StdPeriph_Templates/stm32f4xx_it.h 4 | * @author MCD Application Team 5 | * @version V1.4.0 6 | * @date 04-August-2014 7 | * @brief This file contains the headers of the interrupt handlers. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2014 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __STM32F4xx_IT_H 30 | #define __STM32F4xx_IT_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | /* Includes ------------------------------------------------------------------*/ 37 | #include "stm32f4xx.h" 38 | 39 | /* Exported types ------------------------------------------------------------*/ 40 | /* Exported constants --------------------------------------------------------*/ 41 | /* Exported macro ------------------------------------------------------------*/ 42 | /* Exported functions ------------------------------------------------------- */ 43 | 44 | void NMI_Handler(void); 45 | void HardFault_Handler(void); 46 | void MemManage_Handler(void); 47 | void BusFault_Handler(void); 48 | void UsageFault_Handler(void); 49 | void SVC_Handler(void); 50 | void DebugMon_Handler(void); 51 | void PendSV_Handler(void); 52 | void SysTick_Handler(void); 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif /* __STM32F4xx_IT_H */ 59 | 60 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 61 | -------------------------------------------------------------------------------- /示例/STM32F407ZGT6/USER/system_stm32f4xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f4xx.h 4 | * @author MCD Application Team 5 | * @version V1.4.0 6 | * @date 04-August-2014 7 | * @brief CMSIS Cortex-M4 Device System Source File for STM32F4xx devices. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2014 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /** @addtogroup CMSIS 29 | * @{ 30 | */ 31 | 32 | /** @addtogroup stm32f4xx_system 33 | * @{ 34 | */ 35 | 36 | /** 37 | * @brief Define to prevent recursive inclusion 38 | */ 39 | #ifndef __SYSTEM_STM32F4XX_H 40 | #define __SYSTEM_STM32F4XX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /** @addtogroup STM32F4xx_System_Includes 47 | * @{ 48 | */ 49 | 50 | /** 51 | * @} 52 | */ 53 | 54 | 55 | /** @addtogroup STM32F4xx_System_Exported_types 56 | * @{ 57 | */ 58 | 59 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 60 | 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @addtogroup STM32F4xx_System_Exported_Constants 67 | * @{ 68 | */ 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @addtogroup STM32F4xx_System_Exported_Macros 75 | * @{ 76 | */ 77 | 78 | /** 79 | * @} 80 | */ 81 | 82 | /** @addtogroup STM32F4xx_System_Exported_Functions 83 | * @{ 84 | */ 85 | 86 | extern void SystemInit(void); 87 | extern void SystemCoreClockUpdate(void); 88 | /** 89 | * @} 90 | */ 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | #endif /*__SYSTEM_STM32F4XX_H */ 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | /** 103 | * @} 104 | */ 105 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 106 | -------------------------------------------------------------------------------- /示例/STM32F407ZGT6/keilkilll.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiayuanzhang/yPlot/b45faf97aaa7ca9bac480251a556d441edcba4aa/示例/STM32F407ZGT6/keilkilll.bat --------------------------------------------------------------------------------