initial upload
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +232 -0
- Engineering/project0/1.png +0 -0
- Engineering/project0/includes.h +46 -0
- Engineering/project0/main.c +108 -0
- Engineering/project0/程序说明.txt +59 -0
- Engineering/project1/基于物联网户外环境监测装置.pdf +3 -0
- Engineering/project1/基于物联网的户外环境监测系统设计.pdf +3 -0
- Engineering/project2/1.png +3 -0
- Engineering/project2/3.png +3 -0
- Engineering/project2/MB1167_01.png +3 -0
- Engineering/project2/MB1167_02.png +3 -0
- Engineering/project2/MB1167_03.png +3 -0
- Engineering/project2/MB1167_04.png +3 -0
- Engineering/project2/MB1167_05.png +3 -0
- Engineering/project2/MB1167_06.png +3 -0
- Engineering/project2/MB1167_07.png +3 -0
- Engineering/project2/MB1167_08.png +3 -0
- Engineering/project2/MB1167_09.png +3 -0
- Engineering/project2/MB1167_10.png +3 -0
- Engineering/project2/MB1167_11.png +3 -0
- Engineering/project2/MB1167_12.png +3 -0
- Engineering/project2/MB1167_13.png +3 -0
- Engineering/project2/MB1167_14.png +3 -0
- Engineering/project2/MB1167_15.png +3 -0
- Engineering/project2/MB1167_16.png +3 -0
- Engineering/project2/MB1167_17.png +3 -0
- Engineering/project2/VID_20160729_162911.mp4 +3 -0
- Engineering/project2/采用M7开发板开发调试工具.pdf +3 -0
- Engineering/project3/1.png +0 -0
- Engineering/project3/2.png +0 -0
- Engineering/project3/3.png +0 -0
- Engineering/project3/4.png +0 -0
- Engineering/project3/main.c +148 -0
- Engineering/project3/自动跟踪调速风扇.pdf +3 -0
- Engineering/project4/基于STM32F4的四轴飞行器控制系统.pdf +3 -0
- Engineering/project5/Task.c +210 -0
- Engineering/project5/main.c +532 -0
- Engineering/project5/stm32f0xx_hal_msp.c +191 -0
- Engineering/project5/stm32f0xx_it.c +65 -0
- Engineering/project6/1.png +0 -0
- Engineering/project6/2.png +0 -0
- Engineering/project6/3.png +3 -0
- Engineering/project6/main.c +939 -0
- Engineering/project6/具波形显示功能的数据采集系统.pdf +3 -0
- Engineering/project6/具波形显示功能的数据采集系统PCB反面.jpg +3 -0
- Engineering/project6/具波形显示功能的数据采集系统PCB正面.jpg +3 -0
- Engineering/project6/具波形显示功能的数据采集系统pcb图.jpg +3 -0
- Engineering/project6/具波形显示功能的数据采集系统sch图.jpg +3 -0
- Engineering/project6/具波形显示功能的数据采集系统效果图.jpg +3 -0
- Engineering/project7/1.png +3 -0
.gitattributes
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Engineering/project1/基于物联网户外环境监测装置.pdf filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
Engineering/project1/基于物联网的户外环境监测系统设计.pdf filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
Engineering/project2/1.png filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
Engineering/project2/3.png filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
Engineering/project2/MB1167_01.png filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
Engineering/project2/MB1167_02.png filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
Engineering/project2/MB1167_03.png filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
Engineering/project2/MB1167_04.png filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
Engineering/project2/MB1167_05.png filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
Engineering/project2/MB1167_06.png filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
Engineering/project2/MB1167_07.png filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
Engineering/project2/MB1167_08.png filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
Engineering/project2/MB1167_09.png filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
Engineering/project2/MB1167_10.png filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
Engineering/project2/MB1167_11.png filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
Engineering/project2/MB1167_12.png filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
Engineering/project2/MB1167_13.png filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
Engineering/project2/MB1167_14.png filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
Engineering/project2/MB1167_15.png filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
Engineering/project2/MB1167_16.png filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
Engineering/project2/MB1167_17.png filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
Engineering/project2/VID_20160729_162911.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
Engineering/project2/采用M7开发板开发调试工具.pdf filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
Engineering/project3/自动跟踪调速风扇.pdf filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
Engineering/project4/基于STM32F4的四轴飞行器控制系统.pdf filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
Engineering/project6/3.png filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
Engineering/project6/具波形显示功能的数据采集系统.pdf filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
Engineering/project6/具波形显示功能的数据采集系统PCB反面.jpg filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
Engineering/project6/具波形显示功能的数据采集系统PCB正面.jpg filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
Engineering/project6/具波形显示功能的数据采集系统pcb图.jpg filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
Engineering/project6/具波形显示功能的数据采集系统sch图.jpg filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
Engineering/project6/具波形显示功能的数据采集系统效果图.jpg filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
Engineering/project7/1.png filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
Engineering/project7/10.png filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
Engineering/project7/11.png filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
Engineering/project7/2.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
Engineering/project7/4.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
Engineering/project7/6.png filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
Engineering/project7/7.png filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
Engineering/project7/8.png filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
Engineering/project7/基于STM32处理器的武警报警信息系统终端.pdf filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
Engineering/project8/5_电源管理模块.pdf filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
Engineering/project8/6_电机驱动模块.pdf filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
Engineering/project8/7_蓝牙通信模块.pdf filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
Engineering/project8/8_android蓝牙控制客户端.pdf filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
Engineering/project8/9_主控板程序.pdf filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
Engineering/project8/基于stm32f4的蓝牙控制小车.pdf filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
Mathematics/project/paper_a2200289.pdf filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
Mathematics/project/question_a.pdf filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
Mathematics/project1/paper_a2207343.pdf filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
Mathematics/project1/question_a.pdf filter=lfs diff=lfs merge=lfs -text
|
| 52 |
+
Mathematics/project10/paper_b2211922.pdf filter=lfs diff=lfs merge=lfs -text
|
| 53 |
+
Mathematics/project10/question_b.pdf filter=lfs diff=lfs merge=lfs -text
|
| 54 |
+
Mathematics/project11/paper_b2213970.pdf filter=lfs diff=lfs merge=lfs -text
|
| 55 |
+
Mathematics/project11/question_b.pdf filter=lfs diff=lfs merge=lfs -text
|
| 56 |
+
Mathematics/project12/paper_b2228168.pdf filter=lfs diff=lfs merge=lfs -text
|
| 57 |
+
Mathematics/project12/question_b.pdf filter=lfs diff=lfs merge=lfs -text
|
| 58 |
+
Mathematics/project13/paper_c2200401.pdf filter=lfs diff=lfs merge=lfs -text
|
| 59 |
+
Mathematics/project13/question_c.pdf filter=lfs diff=lfs merge=lfs -text
|
| 60 |
+
Mathematics/project14/paper_c2200688.pdf filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
Mathematics/project14/question_c.pdf filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
Mathematics/project15/paper_c2203120.pdf filter=lfs diff=lfs merge=lfs -text
|
| 63 |
+
Mathematics/project15/question_c.pdf filter=lfs diff=lfs merge=lfs -text
|
| 64 |
+
Mathematics/project16/paper_c2204883.pdf filter=lfs diff=lfs merge=lfs -text
|
| 65 |
+
Mathematics/project16/question_c.pdf filter=lfs diff=lfs merge=lfs -text
|
| 66 |
+
Mathematics/project17/paper_c2208834.pdf filter=lfs diff=lfs merge=lfs -text
|
| 67 |
+
Mathematics/project17/question_c.pdf filter=lfs diff=lfs merge=lfs -text
|
| 68 |
+
Mathematics/project18/paper_c2212336.pdf filter=lfs diff=lfs merge=lfs -text
|
| 69 |
+
Mathematics/project18/question_c.pdf filter=lfs diff=lfs merge=lfs -text
|
| 70 |
+
Mathematics/project19/paper_c2218743.pdf filter=lfs diff=lfs merge=lfs -text
|
| 71 |
+
Mathematics/project19/question_c.pdf filter=lfs diff=lfs merge=lfs -text
|
| 72 |
+
Mathematics/project20/paper_c2218931.pdf filter=lfs diff=lfs merge=lfs -text
|
| 73 |
+
Mathematics/project20/question_c.pdf filter=lfs diff=lfs merge=lfs -text
|
| 74 |
+
Mathematics/project21/paper_c2224507.pdf filter=lfs diff=lfs merge=lfs -text
|
| 75 |
+
Mathematics/project21/question_c.pdf filter=lfs diff=lfs merge=lfs -text
|
| 76 |
+
Mathematics/project22/paper_c2229059.pdf filter=lfs diff=lfs merge=lfs -text
|
| 77 |
+
Mathematics/project22/question_c.pdf filter=lfs diff=lfs merge=lfs -text
|
| 78 |
+
Mathematics/project23/paper_d2208928.pdf filter=lfs diff=lfs merge=lfs -text
|
| 79 |
+
Mathematics/project23/question_d.pdf filter=lfs diff=lfs merge=lfs -text
|
| 80 |
+
Mathematics/project24/paper_d2215444.pdf filter=lfs diff=lfs merge=lfs -text
|
| 81 |
+
Mathematics/project24/question_d.pdf filter=lfs diff=lfs merge=lfs -text
|
| 82 |
+
Mathematics/project26/paper_d2224178.pdf filter=lfs diff=lfs merge=lfs -text
|
| 83 |
+
Mathematics/project26/question_d.pdf filter=lfs diff=lfs merge=lfs -text
|
| 84 |
+
Mathematics/project27/paper_e2202171.pdf filter=lfs diff=lfs merge=lfs -text
|
| 85 |
+
Mathematics/project27/question_e.pdf filter=lfs diff=lfs merge=lfs -text
|
| 86 |
+
Mathematics/project28/paper_e2202666.pdf filter=lfs diff=lfs merge=lfs -text
|
| 87 |
+
Mathematics/project28/question_e.pdf filter=lfs diff=lfs merge=lfs -text
|
| 88 |
+
Mathematics/project30/paper_e2203489.pdf filter=lfs diff=lfs merge=lfs -text
|
| 89 |
+
Mathematics/project30/question_e.pdf filter=lfs diff=lfs merge=lfs -text
|
| 90 |
+
Mathematics/project31/paper_e2209336.pdf filter=lfs diff=lfs merge=lfs -text
|
| 91 |
+
Mathematics/project31/question_e.pdf filter=lfs diff=lfs merge=lfs -text
|
| 92 |
+
Mathematics/project32/paper_e2216618.pdf filter=lfs diff=lfs merge=lfs -text
|
| 93 |
+
Mathematics/project32/question_e.pdf filter=lfs diff=lfs merge=lfs -text
|
| 94 |
+
Mathematics/project33/paper_e2218144.pdf filter=lfs diff=lfs merge=lfs -text
|
| 95 |
+
Mathematics/project33/question_e.pdf filter=lfs diff=lfs merge=lfs -text
|
| 96 |
+
Mathematics/project34/paper_e2220714.pdf filter=lfs diff=lfs merge=lfs -text
|
| 97 |
+
Mathematics/project34/question_e.pdf filter=lfs diff=lfs merge=lfs -text
|
| 98 |
+
Mathematics/project35/paper_e2223269.pdf filter=lfs diff=lfs merge=lfs -text
|
| 99 |
+
Mathematics/project35/question_e.pdf filter=lfs diff=lfs merge=lfs -text
|
| 100 |
+
Mathematics/project37/paper_f2204803.pdf filter=lfs diff=lfs merge=lfs -text
|
| 101 |
+
Mathematics/project37/question_f.pdf filter=lfs diff=lfs merge=lfs -text
|
| 102 |
+
Mathematics/project38/paper_f2208238.pdf filter=lfs diff=lfs merge=lfs -text
|
| 103 |
+
Mathematics/project38/question_f.pdf filter=lfs diff=lfs merge=lfs -text
|
| 104 |
+
Mathematics/project39/paper_f2209952.pdf filter=lfs diff=lfs merge=lfs -text
|
| 105 |
+
Mathematics/project39/question_f.pdf filter=lfs diff=lfs merge=lfs -text
|
| 106 |
+
Mathematics/project4/paper_a2210307.pdf filter=lfs diff=lfs merge=lfs -text
|
| 107 |
+
Mathematics/project4/question_a.pdf filter=lfs diff=lfs merge=lfs -text
|
| 108 |
+
Mathematics/project40/paper_f2211240.pdf filter=lfs diff=lfs merge=lfs -text
|
| 109 |
+
Mathematics/project40/question_f.pdf filter=lfs diff=lfs merge=lfs -text
|
| 110 |
+
Mathematics/project41/paper_f2218577.pdf filter=lfs diff=lfs merge=lfs -text
|
| 111 |
+
Mathematics/project41/question_f.pdf filter=lfs diff=lfs merge=lfs -text
|
| 112 |
+
Mathematics/project42/paper_f2220722.pdf filter=lfs diff=lfs merge=lfs -text
|
| 113 |
+
Mathematics/project42/question_f.pdf filter=lfs diff=lfs merge=lfs -text
|
| 114 |
+
Mathematics/project43/paper_f2224021.pdf filter=lfs diff=lfs merge=lfs -text
|
| 115 |
+
Mathematics/project43/question_f.pdf filter=lfs diff=lfs merge=lfs -text
|
| 116 |
+
Mathematics/project5/paper_a2212245.pdf filter=lfs diff=lfs merge=lfs -text
|
| 117 |
+
Mathematics/project5/question_a.pdf filter=lfs diff=lfs merge=lfs -text
|
| 118 |
+
Mathematics/project6/paper_a2216547.pdf filter=lfs diff=lfs merge=lfs -text
|
| 119 |
+
Mathematics/project6/question_a.pdf filter=lfs diff=lfs merge=lfs -text
|
| 120 |
+
Mathematics/project7/paper_b2200084.pdf filter=lfs diff=lfs merge=lfs -text
|
| 121 |
+
Mathematics/project7/question_b.pdf filter=lfs diff=lfs merge=lfs -text
|
| 122 |
+
Mathematics/project8/paper_b2202748.pdf filter=lfs diff=lfs merge=lfs -text
|
| 123 |
+
Mathematics/project8/question_b.pdf filter=lfs diff=lfs merge=lfs -text
|
| 124 |
+
Mathematics/project9/paper_b2207864.pdf filter=lfs diff=lfs merge=lfs -text
|
| 125 |
+
Mathematics/project9/question_b.pdf filter=lfs diff=lfs merge=lfs -text
|
| 126 |
+
Science/project1/0b2edyacmaaaoqanyljibnsfahwdeypaajqa.f10002.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 127 |
+
Science/project1/厨余物的高光时刻从厨余垃圾到碳量子点的居家制备及应用探究[[:space:]].pdf filter=lfs diff=lfs merge=lfs -text
|
| 128 |
+
Science/project2/0bc3riaciaaa6yak5eysgzsfbcwdesfaajaa.f10102.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 129 |
+
Science/project2/物理化学实验Belouso反应的新设计.pdf filter=lfs diff=lfs merge=lfs -text
|
| 130 |
+
Science/project3/0bc3gmadeaaaqqakscbfajsfam6dgizqamqa.f10004.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 131 |
+
Science/project3/一种聚集诱导发光铜碘簇合物的合成及其在构筑长余辉发光材料中的应用.pdf filter=lfs diff=lfs merge=lfs -text
|
| 132 |
+
Science/project4/13390501998191824.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 133 |
+
Science/project4/键断裂重组策略构建新的有机膦.pdf filter=lfs diff=lfs merge=lfs -text
|
| 134 |
+
Science/project5/13390502900924505.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 135 |
+
Science/project5/化说国漆普漆中化学传漆艺非遗.pdf filter=lfs diff=lfs merge=lfs -text
|
| 136 |
+
Technology/project/question.pdf filter=lfs diff=lfs merge=lfs -text
|
| 137 |
+
Technology/project/slide.pdf filter=lfs diff=lfs merge=lfs -text
|
| 138 |
+
Technology/project-2/slide.pdf filter=lfs diff=lfs merge=lfs -text
|
| 139 |
+
Technology/project-3/slide.pdf filter=lfs diff=lfs merge=lfs -text
|
| 140 |
+
Technology/project-4/slide_03.png filter=lfs diff=lfs merge=lfs -text
|
| 141 |
+
Technology/project-4/slide_05.png filter=lfs diff=lfs merge=lfs -text
|
| 142 |
+
Technology/project-4/slide_06.png filter=lfs diff=lfs merge=lfs -text
|
| 143 |
+
Technology/project-4/slide_07.png filter=lfs diff=lfs merge=lfs -text
|
| 144 |
+
Technology/project-4/slide_08.png filter=lfs diff=lfs merge=lfs -text
|
| 145 |
+
Technology/project-4/slide_17.png filter=lfs diff=lfs merge=lfs -text
|
| 146 |
+
Technology/project-4/slide_19.png filter=lfs diff=lfs merge=lfs -text
|
| 147 |
+
Technology/project-4/slide_20.png filter=lfs diff=lfs merge=lfs -text
|
| 148 |
+
Technology/project1/question.pdf filter=lfs diff=lfs merge=lfs -text
|
| 149 |
+
Technology/project1/slide.pdf filter=lfs diff=lfs merge=lfs -text
|
| 150 |
+
Technology/project1-2/slide.pdf filter=lfs diff=lfs merge=lfs -text
|
| 151 |
+
Technology/project1-3/slide.pdf filter=lfs diff=lfs merge=lfs -text
|
| 152 |
+
Technology/project1-4/slide_01.png filter=lfs diff=lfs merge=lfs -text
|
| 153 |
+
Technology/project1-4/slide_02.png filter=lfs diff=lfs merge=lfs -text
|
| 154 |
+
Technology/project1-4/slide_03.png filter=lfs diff=lfs merge=lfs -text
|
| 155 |
+
Technology/project1-4/slide_04.png filter=lfs diff=lfs merge=lfs -text
|
| 156 |
+
Technology/project1-4/slide_05.png filter=lfs diff=lfs merge=lfs -text
|
| 157 |
+
Technology/project1-4/slide_06.png filter=lfs diff=lfs merge=lfs -text
|
| 158 |
+
Technology/project1-4/slide_07.png filter=lfs diff=lfs merge=lfs -text
|
| 159 |
+
Technology/project1-4/slide_08.png filter=lfs diff=lfs merge=lfs -text
|
| 160 |
+
Technology/project1-4/slide_09.png filter=lfs diff=lfs merge=lfs -text
|
| 161 |
+
Technology/project1-4/slide_10.png filter=lfs diff=lfs merge=lfs -text
|
| 162 |
+
Technology/project1-4/slide_11.png filter=lfs diff=lfs merge=lfs -text
|
| 163 |
+
Technology/project1-4/slide_12.png filter=lfs diff=lfs merge=lfs -text
|
| 164 |
+
Technology/project1-4/slide_13.png filter=lfs diff=lfs merge=lfs -text
|
| 165 |
+
Technology/project1-4/slide_14.png filter=lfs diff=lfs merge=lfs -text
|
| 166 |
+
Technology/project2-2/slide.pdf filter=lfs diff=lfs merge=lfs -text
|
| 167 |
+
Technology/project2-3/slide.pdf filter=lfs diff=lfs merge=lfs -text
|
| 168 |
+
Technology/project2-4/slide_01.png filter=lfs diff=lfs merge=lfs -text
|
| 169 |
+
Technology/project2-4/slide_02.png filter=lfs diff=lfs merge=lfs -text
|
| 170 |
+
Technology/project2-4/slide_03.png filter=lfs diff=lfs merge=lfs -text
|
| 171 |
+
Technology/project2-4/slide_04.png filter=lfs diff=lfs merge=lfs -text
|
| 172 |
+
Technology/project2-4/slide_05.png filter=lfs diff=lfs merge=lfs -text
|
| 173 |
+
Technology/project2-4/slide_06.png filter=lfs diff=lfs merge=lfs -text
|
| 174 |
+
Technology/project2-4/slide_07.png filter=lfs diff=lfs merge=lfs -text
|
| 175 |
+
Technology/project2-4/slide_08.png filter=lfs diff=lfs merge=lfs -text
|
| 176 |
+
Technology/project2-4/slide_09.png filter=lfs diff=lfs merge=lfs -text
|
| 177 |
+
Technology/project2-4/slide_10.png filter=lfs diff=lfs merge=lfs -text
|
| 178 |
+
Technology/project2-4/slide_11.png filter=lfs diff=lfs merge=lfs -text
|
| 179 |
+
Technology/project2-4/slide_12.png filter=lfs diff=lfs merge=lfs -text
|
| 180 |
+
Technology/project2-4/slide_13.png filter=lfs diff=lfs merge=lfs -text
|
| 181 |
+
Technology/project2-4/slide_14.png filter=lfs diff=lfs merge=lfs -text
|
| 182 |
+
Technology/project2-4/slide_15.png filter=lfs diff=lfs merge=lfs -text
|
| 183 |
+
Technology/project2-4/slide_16.png filter=lfs diff=lfs merge=lfs -text
|
| 184 |
+
Technology/project2-4/slide_17.png filter=lfs diff=lfs merge=lfs -text
|
| 185 |
+
Technology/project2-4/slide_18.png filter=lfs diff=lfs merge=lfs -text
|
| 186 |
+
Technology/project2-4/slide_19.png filter=lfs diff=lfs merge=lfs -text
|
| 187 |
+
Technology/project2-4/slide_20.png filter=lfs diff=lfs merge=lfs -text
|
| 188 |
+
Technology/project3/question.pdf filter=lfs diff=lfs merge=lfs -text
|
| 189 |
+
Technology/project3/slide.pdf filter=lfs diff=lfs merge=lfs -text
|
| 190 |
+
Technology/project3-2/slide.pdf filter=lfs diff=lfs merge=lfs -text
|
| 191 |
+
Technology/project3-3/slide.pdf filter=lfs diff=lfs merge=lfs -text
|
| 192 |
+
Technology/project3-4/slide_01.png filter=lfs diff=lfs merge=lfs -text
|
| 193 |
+
Technology/project3-4/slide_04.png filter=lfs diff=lfs merge=lfs -text
|
| 194 |
+
Technology/project3-4/slide_06.png filter=lfs diff=lfs merge=lfs -text
|
| 195 |
+
Technology/project3-4/slide_12.png filter=lfs diff=lfs merge=lfs -text
|
| 196 |
+
Technology/project3-4/slide_13.png filter=lfs diff=lfs merge=lfs -text
|
| 197 |
+
Technology/project3-4/slide_15.png filter=lfs diff=lfs merge=lfs -text
|
| 198 |
+
Technology/project3-4/slide_16.png filter=lfs diff=lfs merge=lfs -text
|
| 199 |
+
Technology/project3-4/slide_17.png filter=lfs diff=lfs merge=lfs -text
|
| 200 |
+
Technology/project3-4/slide_18.png filter=lfs diff=lfs merge=lfs -text
|
| 201 |
+
Technology/project3-4/slide_19.png filter=lfs diff=lfs merge=lfs -text
|
| 202 |
+
Technology/project3-4/slide_20.png filter=lfs diff=lfs merge=lfs -text
|
| 203 |
+
Technology/project3-4/slide_21.png filter=lfs diff=lfs merge=lfs -text
|
| 204 |
+
Technology/project3-4/slide_23.png filter=lfs diff=lfs merge=lfs -text
|
| 205 |
+
Technology/project3-4/slide_25.png filter=lfs diff=lfs merge=lfs -text
|
| 206 |
+
Technology/project3-4/slide_27.png filter=lfs diff=lfs merge=lfs -text
|
| 207 |
+
Technology/project4/question.pdf filter=lfs diff=lfs merge=lfs -text
|
| 208 |
+
Technology/project4/slide.pdf filter=lfs diff=lfs merge=lfs -text
|
| 209 |
+
Technology/project4-2/slide.pdf filter=lfs diff=lfs merge=lfs -text
|
| 210 |
+
Technology/project4-3/slide.pdf filter=lfs diff=lfs merge=lfs -text
|
| 211 |
+
Technology/project4-4/slide_1.png filter=lfs diff=lfs merge=lfs -text
|
| 212 |
+
Technology/project4-4/slide_3.png filter=lfs diff=lfs merge=lfs -text
|
| 213 |
+
Technology/project4-4/slide_4.png filter=lfs diff=lfs merge=lfs -text
|
| 214 |
+
Technology/project4-4/slide_5.png filter=lfs diff=lfs merge=lfs -text
|
| 215 |
+
Technology/project5/question.pdf filter=lfs diff=lfs merge=lfs -text
|
| 216 |
+
Technology/project5/slide.pdf filter=lfs diff=lfs merge=lfs -text
|
| 217 |
+
Technology/project5-2/slide.pdf filter=lfs diff=lfs merge=lfs -text
|
| 218 |
+
Technology/project5-3/slide.pdf filter=lfs diff=lfs merge=lfs -text
|
| 219 |
+
Technology/project5-4/slide_01.png filter=lfs diff=lfs merge=lfs -text
|
| 220 |
+
Technology/project5-4/slide_02.png filter=lfs diff=lfs merge=lfs -text
|
| 221 |
+
Technology/project5-4/slide_03.png filter=lfs diff=lfs merge=lfs -text
|
| 222 |
+
Technology/project5-4/slide_05.png filter=lfs diff=lfs merge=lfs -text
|
| 223 |
+
Technology/project5-4/slide_06.png filter=lfs diff=lfs merge=lfs -text
|
| 224 |
+
Technology/project5-4/slide_09.png filter=lfs diff=lfs merge=lfs -text
|
| 225 |
+
Technology/project5-4/slide_14.png filter=lfs diff=lfs merge=lfs -text
|
| 226 |
+
Technology/project5-4/slide_15.png filter=lfs diff=lfs merge=lfs -text
|
| 227 |
+
Technology/project5-4/slide_17.png filter=lfs diff=lfs merge=lfs -text
|
| 228 |
+
Technology/project5-4/slide_18.png filter=lfs diff=lfs merge=lfs -text
|
| 229 |
+
Technology/project5-4/slide_19.png filter=lfs diff=lfs merge=lfs -text
|
| 230 |
+
Technology/project5-4/slide_22.png filter=lfs diff=lfs merge=lfs -text
|
| 231 |
+
Technology/project7-2/slide.pdf filter=lfs diff=lfs merge=lfs -text
|
| 232 |
+
Technology/project8-2/slide.pdf filter=lfs diff=lfs merge=lfs -text
|
Engineering/project0/1.png
ADDED
|
Engineering/project0/includes.h
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*********************************Copyright (c)*********************************
|
| 2 |
+
*
|
| 3 |
+
******************************************************************************
|
| 4 |
+
* �ļ����ƣ�includes.h
|
| 5 |
+
* �� ����
|
| 6 |
+
* �� �� ��:
|
| 7 |
+
* ��������:
|
| 8 |
+
* �� �� ��:
|
| 9 |
+
* ������:
|
| 10 |
+
* �� ��:
|
| 11 |
+
******************************************************************************
|
| 12 |
+
* attention
|
| 13 |
+
*
|
| 14 |
+
******************************************************************************
|
| 15 |
+
*/
|
| 16 |
+
#ifndef __INCLUDES_H__
|
| 17 |
+
#define __INCLUDES_H__
|
| 18 |
+
|
| 19 |
+
/*Includes --------------------------------------------------------------------*/
|
| 20 |
+
#include "stm32f0xx.h"
|
| 21 |
+
#include "stm32f0xx_conf.h"
|
| 22 |
+
#include "stm32f0xx_it.h "
|
| 23 |
+
#include "system_stm32f0xx.h"
|
| 24 |
+
//#include "stm32f0xx_nucleo.h"
|
| 25 |
+
|
| 26 |
+
#include <stdio.h>
|
| 27 |
+
#include <string.h>
|
| 28 |
+
|
| 29 |
+
#include "LED.H"
|
| 30 |
+
#include "NVIC.H"
|
| 31 |
+
#include "KEY.H"
|
| 32 |
+
#include "PWM.H"
|
| 33 |
+
//============================================================================//
|
| 34 |
+
|
| 35 |
+
/* ���Ͷ��� typedef------------------------------------------------------------*/
|
| 36 |
+
/* Ԥ�����ַ�------------------------------------------------------------------*/
|
| 37 |
+
/* �궨��----------------------------------------------------------------------*/
|
| 38 |
+
/* ��������--------------------------------------------------------------------*/
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
/* �Ӻ�������--------------------------------------------------------------------*/
|
| 42 |
+
extern int main(void);
|
| 43 |
+
|
| 44 |
+
#endif
|
| 45 |
+
|
| 46 |
+
|
Engineering/project0/main.c
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*********************************Copyright (c)*********************************
|
| 2 |
+
|
| 3 |
+
******************************************************************************
|
| 4 |
+
* �ļ����ƣ�main.C
|
| 5 |
+
* �� ����
|
| 6 |
+
* �� �� ��:
|
| 7 |
+
* ��������:
|
| 8 |
+
* �� �� ��:
|
| 9 |
+
* ������:
|
| 10 |
+
* �� ��:
|
| 11 |
+
******************************************************************************
|
| 12 |
+
* attention
|
| 13 |
+
*
|
| 14 |
+
******************************************************************************
|
| 15 |
+
*/
|
| 16 |
+
/*Includes --------------------------------------------------------------------*/
|
| 17 |
+
#include "includes.h"
|
| 18 |
+
|
| 19 |
+
/* ���Ͷ��� typedef------------------------------------------------------------*/
|
| 20 |
+
/* Ԥ�����ַ�------------------------------------------------------------------*/
|
| 21 |
+
/* �궨��----------------------------------------------------------------------*/
|
| 22 |
+
/* ��������--------------------------------------------------------------------*/
|
| 23 |
+
unsigned short int systick_num=0x00; //systick����������
|
| 24 |
+
unsigned short int key_num=0x00; //��������������
|
| 25 |
+
unsigned char Uart_buf[2]={0x00,0x00}; //������ջ�����
|
| 26 |
+
unsigned char flag=0;
|
| 27 |
+
|
| 28 |
+
void delay_ms(unsigned char a)
|
| 29 |
+
{
|
| 30 |
+
unsigned int i,j;
|
| 31 |
+
|
| 32 |
+
while(a--)
|
| 33 |
+
{
|
| 34 |
+
for(i=0;i<100;i++)
|
| 35 |
+
for(j=0;j<95;j++);
|
| 36 |
+
}
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
void sleep_mode(void)
|
| 40 |
+
{
|
| 41 |
+
RCC_APB1PeriphClockCmd( RCC_APB1Periph_PWR , ENABLE);
|
| 42 |
+
PWR_EnterSleepMode(PWR_SLEEPEntry_WFI);
|
| 43 |
+
//PWR_EnterSTOPMode( PWR_Regulator_LowPower , PWR_STOPEntry_WFI);
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
/********************************************************************************
|
| 47 |
+
��������: main()
|
| 48 |
+
�� ��: ���������
|
| 49 |
+
�� ��: ��
|
| 50 |
+
�� �� ֵ: ��
|
| 51 |
+
*********************************************************************************/
|
| 52 |
+
int main(void)
|
| 53 |
+
{
|
| 54 |
+
SystemInit(); //ϵͳʱ�����ú�����ѡ���ⲿ8M����
|
| 55 |
+
Nvic_Init();
|
| 56 |
+
LED_Init();
|
| 57 |
+
Key_Init();
|
| 58 |
+
sleep_mode();
|
| 59 |
+
//Timer1_Init(488,5); //16526hz
|
| 60 |
+
//Timer1_Init(503,5); //15870hz ����
|
| 61 |
+
//Timer1_Init(511,5); //15617hz
|
| 62 |
+
//Timer1_Init(483,3); //165260hz �л�����ͷ
|
| 63 |
+
while(1)
|
| 64 |
+
{
|
| 65 |
+
GPIO_SetBits(LED_PORT ,GPIO_Pin_6);
|
| 66 |
+
delay_ms(250);
|
| 67 |
+
GPIO_ResetBits(LED_PORT ,GPIO_Pin_6);
|
| 68 |
+
delay_ms(250);
|
| 69 |
+
if(flag)
|
| 70 |
+
{
|
| 71 |
+
flag = 0;
|
| 72 |
+
PWR_EnterSleepMode(PWR_SLEEPEntry_WFI);
|
| 73 |
+
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
#ifdef USE_FULL_ASSERT
|
| 81 |
+
|
| 82 |
+
/**
|
| 83 |
+
* @brief Reports the name of the source file and the source line number
|
| 84 |
+
* where the assert_param error has occurred.
|
| 85 |
+
* @param file: pointer to the source file name
|
| 86 |
+
* @param line: assert_param error line source number
|
| 87 |
+
* @retval None
|
| 88 |
+
*/
|
| 89 |
+
void assert_failed(uint8_t* file, uint32_t line)
|
| 90 |
+
{
|
| 91 |
+
/* User can add his own implementation to report the file name and line number,
|
| 92 |
+
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
|
| 93 |
+
|
| 94 |
+
/* Infinite loop */
|
| 95 |
+
while (1)
|
| 96 |
+
{
|
| 97 |
+
}
|
| 98 |
+
}
|
| 99 |
+
#endif
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
/**
|
| 105 |
+
* @}
|
| 106 |
+
*/
|
| 107 |
+
|
| 108 |
+
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
Engineering/project0/程序说明.txt
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*********************************Copyright (c)*********************************
|
| 2 |
+
*
|
| 3 |
+
******************************************************************************
|
| 4 |
+
* �ļ����ƣ�����˵��
|
| 5 |
+
* �� ����LED����ļ�
|
| 6 |
+
* �� �� ��:
|
| 7 |
+
* ��������:
|
| 8 |
+
* �� �� ��:
|
| 9 |
+
* ������:
|
| 10 |
+
* �� ��:
|
| 11 |
+
******************************************************************************
|
| 12 |
+
* attention
|
| 13 |
+
*
|
| 14 |
+
******************************************************************************
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
//=============================================================================//
|
| 18 |
+
|
| 19 |
+
�������
|
| 20 |
+
|
| 21 |
+
1--driver �Լ���д������λ��
|
| 22 |
+
2--lib/src STM32F0�����̼���C�ļ�
|
| 23 |
+
--lib/inc STM32F0�����̼���H�ļ�
|
| 24 |
+
3--mdk ��Ŀ�����ļ�
|
| 25 |
+
4--startup �����ļ�--�˴����STM32F072RB
|
| 26 |
+
5--stm32f072rbt6
|
| 27 |
+
�ں��ļ����ƣ�
|
| 28 |
+
core_cm0.h
|
| 29 |
+
stm32f0xx.h
|
| 30 |
+
stm32f0xx_conf.h
|
| 31 |
+
stm32f0xx_it.c
|
| 32 |
+
stm32f0xx_it.h
|
| 33 |
+
system_stm32f0xx.c
|
| 34 |
+
system_stm32f0xx.h
|
| 35 |
+
stm32f0xx_nucleo.c
|
| 36 |
+
stm32f0xx_nucleo.h
|
| 37 |
+
6--user �û���C�ļ�
|
| 38 |
+
includes.h Ԥ�����ļ�
|
| 39 |
+
|
| 40 |
+
//=============================================================================//
|
| 41 |
+
1--driver ����������LED.C�ļ�
|
| 42 |
+
2--driver ����������USAT.C�ļ�
|
| 43 |
+
3--driver ����������KEY.C�ļ�
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
//=============================================================================//
|
| 47 |
+
|
| 48 |
+
1
|
| 49 |
+
2
|
| 50 |
+
3��ʵ�ֹ���
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
|
Engineering/project1/基于物联网户外环境监测装置.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ad563ce5886c3d130b2420922008dd2998b4a787d3c87487edb43bd2782b29a2
|
| 3 |
+
size 4627915
|
Engineering/project1/基于物联网的户外环境监测系统设计.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c64d2a9099d85b1ddc99c3d2b8b3d0c73dee5f7060baceae8a31d4872ea1acd2
|
| 3 |
+
size 4183723
|
Engineering/project2/1.png
ADDED
|
Git LFS Details
|
Engineering/project2/3.png
ADDED
|
Git LFS Details
|
Engineering/project2/MB1167_01.png
ADDED
|
Git LFS Details
|
Engineering/project2/MB1167_02.png
ADDED
|
Git LFS Details
|
Engineering/project2/MB1167_03.png
ADDED
|
Git LFS Details
|
Engineering/project2/MB1167_04.png
ADDED
|
Git LFS Details
|
Engineering/project2/MB1167_05.png
ADDED
|
Git LFS Details
|
Engineering/project2/MB1167_06.png
ADDED
|
Git LFS Details
|
Engineering/project2/MB1167_07.png
ADDED
|
Git LFS Details
|
Engineering/project2/MB1167_08.png
ADDED
|
Git LFS Details
|
Engineering/project2/MB1167_09.png
ADDED
|
Git LFS Details
|
Engineering/project2/MB1167_10.png
ADDED
|
Git LFS Details
|
Engineering/project2/MB1167_11.png
ADDED
|
Git LFS Details
|
Engineering/project2/MB1167_12.png
ADDED
|
Git LFS Details
|
Engineering/project2/MB1167_13.png
ADDED
|
Git LFS Details
|
Engineering/project2/MB1167_14.png
ADDED
|
Git LFS Details
|
Engineering/project2/MB1167_15.png
ADDED
|
Git LFS Details
|
Engineering/project2/MB1167_16.png
ADDED
|
Git LFS Details
|
Engineering/project2/MB1167_17.png
ADDED
|
Git LFS Details
|
Engineering/project2/VID_20160729_162911.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7677d22599c129f595f0b5ab69875127ad98d90554cdf638facf1b3dcc71f576
|
| 3 |
+
size 10029531
|
Engineering/project2/采用M7开发板开发调试工具.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:80412775c24d03a33ef3d55fe74065a1a75b402e7ebe8484d539773eb6ec85f4
|
| 3 |
+
size 2444727
|
Engineering/project3/1.png
ADDED
|
Engineering/project3/2.png
ADDED
|
Engineering/project3/3.png
ADDED
|
Engineering/project3/4.png
ADDED
|
Engineering/project3/main.c
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/******************** (C) COPYRIGHT 2011 Ұ��Ƕ��ʽ���������� ********************
|
| 2 |
+
* ��� ��main.c
|
| 3 |
+
* ���� ��LCD����ʵ�飬������У����Ļ������ͨ��������ȡɫ��
|
| 4 |
+
* ʵ��ƽ̨��Ұ��STM32������
|
| 5 |
+
* ��汾 ��ST3.0.0
|
| 6 |
+
*
|
| 7 |
+
* ���� ��fire QQ: 313303034
|
| 8 |
+
* ���� ��firestm32.blog.chinaunix.net
|
| 9 |
+
**********************************************************************************/
|
| 10 |
+
#include "stm32f10x.h"
|
| 11 |
+
#include "lcd.h"
|
| 12 |
+
#include "sd_fs_app.h"
|
| 13 |
+
#include "SPI_Flash.h"
|
| 14 |
+
#include "systick.h"
|
| 15 |
+
#include "usart1.h"
|
| 16 |
+
#include "Touch.h"
|
| 17 |
+
#include "led.h"
|
| 18 |
+
#include "24l01.h"
|
| 19 |
+
void RCC_Configuration(void);
|
| 20 |
+
extern volatile unsigned char touch_flag;
|
| 21 |
+
extern unsigned int flagflag,flagflag1,flagflag2;
|
| 22 |
+
extern unsigned int flagflag3,flagflag4,flagflag5,flagflag6;
|
| 23 |
+
extern unsigned char emission[5];
|
| 24 |
+
extern unsigned char emission1[4];
|
| 25 |
+
extern unsigned char emission2[5];
|
| 26 |
+
extern unsigned char emission3[3];
|
| 27 |
+
/*
|
| 28 |
+
* ��������main
|
| 29 |
+
* ���� ��������
|
| 30 |
+
* ���� ����
|
| 31 |
+
* ��� ����
|
| 32 |
+
*/
|
| 33 |
+
int main(void)
|
| 34 |
+
{
|
| 35 |
+
unsigned char five=0;
|
| 36 |
+
RCC_Configuration(); /*ʱ������*/
|
| 37 |
+
LCD_Init(); /*LCD��ʼ��*/
|
| 38 |
+
Touch_init(); /*������ʼ��*/
|
| 39 |
+
while(Touchl_Calibrate() !=0); /*�ȴ�������У���*/
|
| 40 |
+
/*******************************��ʼ����**************************************************/
|
| 41 |
+
while (1)
|
| 42 |
+
{
|
| 43 |
+
Init_Menu();
|
| 44 |
+
//������ʼ�˵�
|
| 45 |
+
while(flagflag==0)
|
| 46 |
+
{
|
| 47 |
+
if((touch_flag==1)&&(flagflag3==1))
|
| 48 |
+
{
|
| 49 |
+
{
|
| 50 |
+
if(Get_touch_point(&display, Read_2046_2(), &touch_para ) !=DISABLE)
|
| 51 |
+
{ if((display.y>90)&&(display.y<140)||((240-display.x)>110)&&((240-display.x)<190) )
|
| 52 |
+
{
|
| 53 |
+
#ifdef HX8347 //
|
| 54 |
+
LCD_draw_rectangle(0,0,240,320,BLACK); /*�����*/ //
|
| 55 |
+
#else //
|
| 56 |
+
LCD_draw_rectangle(0,0,240,320,BLACK); /*�����*/ //
|
| 57 |
+
#endif
|
| 58 |
+
Init_Menu1();
|
| 59 |
+
LED_GPIO_Config();
|
| 60 |
+
NRF24L01Int1();
|
| 61 |
+
while(five<=20)
|
| 62 |
+
{
|
| 63 |
+
five++;
|
| 64 |
+
NRFSetTxMode1(emission);//�����¶�
|
| 65 |
+
while(CheckACK1()); //����Ƿ������
|
| 66 |
+
GPIO_SetBits(GPIOC,GPIO_Pin_0);NRFDelay(1000);
|
| 67 |
+
GPIO_ResetBits(GPIOC,GPIO_Pin_0);NRFDelay(1000);
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
five=0;
|
| 71 |
+
flagflag3=0;
|
| 72 |
+
delay_ms(500);
|
| 73 |
+
Init_Menu();
|
| 74 |
+
/*************��������5����Ϣ����emission*******************/
|
| 75 |
+
LCD_Show_8x16_String(180,10,1,emission1); //
|
| 76 |
+
LCD_Show_8x16_String(180,33,1,emission2); //
|
| 77 |
+
LCD_Show_8x16_String(180,56,1,emission3); //
|
| 78 |
+
}
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
//
|
| 83 |
+
if(touch_flag == 1) /*������ʰ�����*/ //����ľ����ж�������
|
| 84 |
+
{
|
| 85 |
+
if(Get_touch_point(&display, Read_2046_2(), &touch_para ) !=DISABLE)
|
| 86 |
+
{
|
| 87 |
+
Palette_draw_point(display.x,display.y);
|
| 88 |
+
}
|
| 89 |
+
}
|
| 90 |
+
} //��������˵�
|
| 91 |
+
while(flagflag1==1)
|
| 92 |
+
{
|
| 93 |
+
flagflag2=1;
|
| 94 |
+
if(touch_flag == 1)
|
| 95 |
+
{
|
| 96 |
+
if(Get_touch_point(&display, Read_2046_2(), &touch_para ) !=DISABLE)
|
| 97 |
+
{
|
| 98 |
+
Palette_draw_point(display.x,display.y);
|
| 99 |
+
}
|
| 100 |
+
}
|
| 101 |
+
}
|
| 102 |
+
}
|
| 103 |
+
}
|
| 104 |
+
/*****************************��֤����ͨ��**********************************************************/
|
| 105 |
+
/*int main(void)
|
| 106 |
+
{
|
| 107 |
+
uint i;
|
| 108 |
+
unsigned char yanzheng[5]={0};
|
| 109 |
+
SystemInit();
|
| 110 |
+
LED_GPIO_Config();
|
| 111 |
+
NRF24L01Int();
|
| 112 |
+
while(1)
|
| 113 |
+
{
|
| 114 |
+
NRFSetRXMode();//����Ϊ����ģʽ
|
| 115 |
+
GetDate(); //��ʼ������
|
| 116 |
+
|
| 117 |
+
for(i=0;i<5;i++)
|
| 118 |
+
{
|
| 119 |
+
yanzheng[i]=RevTempDate0[i]; //A��
|
| 120 |
+
if(yanzheng[i]!=0)
|
| 121 |
+
{
|
| 122 |
+
// GPIO_ResetBits(GPIOC,GPIO_Pin_0);NRFDelay(9900000);
|
| 123 |
+
// GPIO_SetBits(GPIOC,GPIO_Pin_0);NRFDelay(9900000);
|
| 124 |
+
|
| 125 |
+
}
|
| 126 |
+
}
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
}*/
|
| 130 |
+
//int main()
|
| 131 |
+
//{
|
| 132 |
+
// SystemInit();
|
| 133 |
+
// LED_GPIO_Config();
|
| 134 |
+
// NRF24L01Int1();
|
| 135 |
+
// emission[0]=0x01;
|
| 136 |
+
// while(1)
|
| 137 |
+
// {
|
| 138 |
+
// NRFSetTxMode1(emission);//�����¶�
|
| 139 |
+
// while(CheckACK1()); //����Ƿ������
|
| 140 |
+
// GPIO_SetBits(GPIOC,GPIO_Pin_0);NRFDelay(1000);
|
| 141 |
+
// GPIO_ResetBits(GPIOC,GPIO_Pin_0);NRFDelay(1000);
|
| 142 |
+
// }
|
| 143 |
+
//}
|
| 144 |
+
/* config the sysclock to 72M */
|
| 145 |
+
void RCC_Configuration(void)
|
| 146 |
+
{
|
| 147 |
+
SystemInit();
|
| 148 |
+
}
|
Engineering/project3/自动跟踪调速风扇.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3ab661163bd488cb0a037c272df89bdc5339a5d9519bb817654aab19491ac9dc
|
| 3 |
+
size 1955987
|
Engineering/project4/基于STM32F4的四轴飞行器控制系统.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:65c26d1451f4375fb0464565b56985cb5acdadb63befe0ccb49592570e643ae6
|
| 3 |
+
size 4057311
|
Engineering/project5/Task.c
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/******************************************************************************
|
| 2 |
+
* FILE NAME: Scheduler.c
|
| 3 |
+
* DESCRIPTION:
|
| 4 |
+
*
|
| 5 |
+
* DATE BEGUN:
|
| 6 |
+
* BY:
|
| 7 |
+
* PRODUCT NAME:
|
| 8 |
+
* APPLICATION:
|
| 9 |
+
* TARGET H/W:
|
| 10 |
+
* DOC REF:
|
| 11 |
+
*****************************************************************************
|
| 12 |
+
*/
|
| 13 |
+
|
| 14 |
+
/*****************************************************************************
|
| 15 |
+
** #include
|
| 16 |
+
*****************************************************************************/
|
| 17 |
+
#include "stdint.h"
|
| 18 |
+
#include "stdbool.h"
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
//! \name finit state machine state
|
| 22 |
+
//! @{
|
| 23 |
+
typedef enum {
|
| 24 |
+
fsm_rt_err = -1, //!< fsm error, error code can be get from other interface
|
| 25 |
+
fsm_rt_cpl = 0, //!< fsm complete
|
| 26 |
+
fsm_rt_on_going = 1, //!< fsm on-going
|
| 27 |
+
} fsm_rt_t;
|
| 28 |
+
//! @}
|
| 29 |
+
|
| 30 |
+
static fsm_rt_t task_print(void);
|
| 31 |
+
static fsm_rt_t task_delay(void);
|
| 32 |
+
static fsm_rt_t print(void);
|
| 33 |
+
static fsm_rt_t delay(void);
|
| 34 |
+
static bool s_bFlag = false;
|
| 35 |
+
/****************************************************************************/
|
| 36 |
+
/**
|
| 37 |
+
* Function Name: void scheduler( void )
|
| 38 |
+
* Description: none
|
| 39 |
+
*
|
| 40 |
+
* Param: none
|
| 41 |
+
* Return: none
|
| 42 |
+
* Author:
|
| 43 |
+
****************************************************************************/
|
| 44 |
+
void scheduler( void )
|
| 45 |
+
{
|
| 46 |
+
while(!serial_out('z'));
|
| 47 |
+
while(!serial_out('t'));
|
| 48 |
+
while(!serial_out('2'));
|
| 49 |
+
while(!serial_out('0'));
|
| 50 |
+
while(!serial_out('1'));
|
| 51 |
+
while(!serial_out('2'));
|
| 52 |
+
while(!serial_out('\r'));
|
| 53 |
+
while(!serial_out('\n'));
|
| 54 |
+
|
| 55 |
+
/* loop here forever */
|
| 56 |
+
while(1){
|
| 57 |
+
task_print();
|
| 58 |
+
task_delay();
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
#define TASK_PRINT_RESET_FSM() \
|
| 64 |
+
do{ \
|
| 65 |
+
s_tTaskPrintState = TASK_PRINT_START; \
|
| 66 |
+
}while(0)
|
| 67 |
+
static fsm_rt_t task_print(void)
|
| 68 |
+
{
|
| 69 |
+
static enum{
|
| 70 |
+
TASK_PRINT_START=0,
|
| 71 |
+
TASK_PRINT_ING
|
| 72 |
+
}s_tTaskPrintState = TASK_PRINT_START;
|
| 73 |
+
switch (s_tTaskPrintState){
|
| 74 |
+
case TASK_PRINT_START:
|
| 75 |
+
if(s_bFlag){
|
| 76 |
+
s_tTaskPrintState = TASK_PRINT_ING;
|
| 77 |
+
}
|
| 78 |
+
break;
|
| 79 |
+
|
| 80 |
+
case TASK_PRINT_ING:
|
| 81 |
+
if(fsm_rt_cpl == print()){
|
| 82 |
+
TASK_PRINT_RESET_FSM();
|
| 83 |
+
return fsm_rt_cpl;
|
| 84 |
+
}
|
| 85 |
+
break;
|
| 86 |
+
}
|
| 87 |
+
return fsm_rt_on_going;
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
#define TASK_DELAY_RESET_FSM() \
|
| 91 |
+
do{ \
|
| 92 |
+
s_tTaskDelayState = TASK_DELAY_START; \
|
| 93 |
+
}while(0)
|
| 94 |
+
static fsm_rt_t task_delay(void)
|
| 95 |
+
{
|
| 96 |
+
static enum{
|
| 97 |
+
TASK_DELAY_START=0,
|
| 98 |
+
TASK_DELAY_ING
|
| 99 |
+
}s_tTaskDelayState = TASK_DELAY_START;
|
| 100 |
+
switch(s_tTaskDelayState){
|
| 101 |
+
case TASK_DELAY_START:
|
| 102 |
+
s_bFlag = false;
|
| 103 |
+
|
| 104 |
+
case TASK_DELAY_ING:
|
| 105 |
+
if(fsm_rt_cpl == delay()){
|
| 106 |
+
s_bFlag = true;
|
| 107 |
+
TASK_DELAY_RESET_FSM();
|
| 108 |
+
return fsm_rt_on_going;
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
return fsm_rt_on_going;
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
#define PRINT_RESET_FSM() \
|
| 115 |
+
do{ \
|
| 116 |
+
s_tPrintState = PRINT_START; \
|
| 117 |
+
}while(0)
|
| 118 |
+
|
| 119 |
+
static fsm_rt_t print(void)
|
| 120 |
+
{
|
| 121 |
+
static enum{
|
| 122 |
+
PRINT_START = 0,
|
| 123 |
+
PRINT_OUT_H,
|
| 124 |
+
PRINT_OUT_E,
|
| 125 |
+
PRINT_OUT_L1,
|
| 126 |
+
PRINT_OUT_L2,
|
| 127 |
+
PRINT_OUT_O,
|
| 128 |
+
PRINT_OUT_R,
|
| 129 |
+
PRINT_OUT_N
|
| 130 |
+
}s_tPrintState = PRINT_START;
|
| 131 |
+
switch(s_tPrintState){
|
| 132 |
+
case PRINT_START:
|
| 133 |
+
s_tPrintState = PRINT_OUT_H;
|
| 134 |
+
|
| 135 |
+
case PRINT_OUT_H:
|
| 136 |
+
if(serial_out('h')){
|
| 137 |
+
s_tPrintState = PRINT_OUT_E;
|
| 138 |
+
}
|
| 139 |
+
break;
|
| 140 |
+
case PRINT_OUT_E:
|
| 141 |
+
if(serial_out('e')){
|
| 142 |
+
s_tPrintState = PRINT_OUT_L1;
|
| 143 |
+
}
|
| 144 |
+
break;
|
| 145 |
+
case PRINT_OUT_L1:
|
| 146 |
+
if(serial_out('l')){
|
| 147 |
+
s_tPrintState = PRINT_OUT_L2;
|
| 148 |
+
}
|
| 149 |
+
break;
|
| 150 |
+
case PRINT_OUT_L2:
|
| 151 |
+
if(serial_out('l')){
|
| 152 |
+
s_tPrintState = PRINT_OUT_O;
|
| 153 |
+
}
|
| 154 |
+
break;
|
| 155 |
+
case PRINT_OUT_O:
|
| 156 |
+
if(serial_out('o')){
|
| 157 |
+
s_tPrintState = PRINT_OUT_R;
|
| 158 |
+
}
|
| 159 |
+
break;
|
| 160 |
+
case PRINT_OUT_R:
|
| 161 |
+
if(serial_out('\r')){
|
| 162 |
+
s_tPrintState = PRINT_OUT_N;
|
| 163 |
+
}
|
| 164 |
+
break;
|
| 165 |
+
case PRINT_OUT_N:
|
| 166 |
+
if(serial_out('\n')){
|
| 167 |
+
PRINT_RESET_FSM();
|
| 168 |
+
return fsm_rt_cpl;
|
| 169 |
+
}
|
| 170 |
+
break;
|
| 171 |
+
}
|
| 172 |
+
return fsm_rt_on_going;
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
#define DELAY_RESET_FSM() \
|
| 176 |
+
do{ \
|
| 177 |
+
s_tDelaytState = DELAY_START; \
|
| 178 |
+
}while(0)
|
| 179 |
+
#define DEALY_TIME (0x2ffff)
|
| 180 |
+
|
| 181 |
+
static fsm_rt_t delay(void)
|
| 182 |
+
{
|
| 183 |
+
static enum{
|
| 184 |
+
DELAY_START = 0,
|
| 185 |
+
DELAY
|
| 186 |
+
}s_tDelaytState = DELAY_START;
|
| 187 |
+
static uint32_t s_wDelayCounter = 0;
|
| 188 |
+
switch(s_tDelaytState){
|
| 189 |
+
case DELAY_START:
|
| 190 |
+
s_wDelayCounter = 0;
|
| 191 |
+
s_tDelaytState = DELAY;
|
| 192 |
+
|
| 193 |
+
case DELAY:
|
| 194 |
+
s_wDelayCounter ++;
|
| 195 |
+
if(s_wDelayCounter > DEALY_TIME){
|
| 196 |
+
s_wDelayCounter = 0;
|
| 197 |
+
DELAY_RESET_FSM();
|
| 198 |
+
return fsm_rt_cpl;
|
| 199 |
+
}
|
| 200 |
+
break;
|
| 201 |
+
}
|
| 202 |
+
return fsm_rt_on_going;
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
/*****************************************************************************
|
| 206 |
+
** End File
|
| 207 |
+
*****************************************************************************/
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
|
Engineering/project5/main.c
ADDED
|
@@ -0,0 +1,532 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
******************************************************************************
|
| 3 |
+
* File Name : main.c
|
| 4 |
+
* Date : 17/12/2014 19:03:19
|
| 5 |
+
* Description : Main program body
|
| 6 |
+
******************************************************************************
|
| 7 |
+
*
|
| 8 |
+
* COPYRIGHT(c) 2014 STMicroelectronics
|
| 9 |
+
*
|
| 10 |
+
* Redistribution and use in source and binary forms, with or without modification,
|
| 11 |
+
* are permitted provided that the following conditions are met:
|
| 12 |
+
* 1. Redistributions of source code must retain the above copyright notice,
|
| 13 |
+
* this list of conditions and the following disclaimer.
|
| 14 |
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
| 15 |
+
* this list of conditions and the following disclaimer in the documentation
|
| 16 |
+
* and/or other materials provided with the distribution.
|
| 17 |
+
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
| 18 |
+
* may be used to endorse or promote products derived from this software
|
| 19 |
+
* without specific prior written permission.
|
| 20 |
+
*
|
| 21 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 22 |
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 23 |
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
| 24 |
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
| 25 |
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
| 26 |
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
| 27 |
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
| 28 |
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
| 29 |
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 30 |
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 31 |
+
*
|
| 32 |
+
******************************************************************************
|
| 33 |
+
*/
|
| 34 |
+
|
| 35 |
+
/* Includes ------------------------------------------------------------------*/
|
| 36 |
+
#include "stm32f0xx_hal.h"
|
| 37 |
+
#include "stdbool.h"
|
| 38 |
+
#include "string.h"
|
| 39 |
+
|
| 40 |
+
/* USER CODE BEGIN Includes */
|
| 41 |
+
|
| 42 |
+
/* USER CODE END Includes */
|
| 43 |
+
|
| 44 |
+
/* Private variables ---------------------------------------------------------*/
|
| 45 |
+
TIM_HandleTypeDef htim2;
|
| 46 |
+
|
| 47 |
+
UART_HandleTypeDef huart2;
|
| 48 |
+
|
| 49 |
+
/* USER CODE BEGIN PV */
|
| 50 |
+
|
| 51 |
+
/* USER CODE END PV */
|
| 52 |
+
|
| 53 |
+
/* Private function prototypes -----------------------------------------------*/
|
| 54 |
+
void SystemClock_Config(void);
|
| 55 |
+
static void MX_GPIO_Init(void);
|
| 56 |
+
static void MX_TIM2_Init(void);
|
| 57 |
+
static void MX_USART2_UART_Init(void);
|
| 58 |
+
|
| 59 |
+
/* USER CODE BEGIN PFP */
|
| 60 |
+
void scheduler( void );
|
| 61 |
+
bool serial2_in(uint8_t *pchByte);
|
| 62 |
+
bool serial2_out(uint8_t chByte) ;
|
| 63 |
+
|
| 64 |
+
/* USER CODE END PFP */
|
| 65 |
+
|
| 66 |
+
/* USER CODE BEGIN 0 */
|
| 67 |
+
|
| 68 |
+
/* USER CODE END 0 */
|
| 69 |
+
|
| 70 |
+
int main(void)
|
| 71 |
+
{
|
| 72 |
+
|
| 73 |
+
/* USER CODE BEGIN 1 */
|
| 74 |
+
|
| 75 |
+
/* USER CODE END 1 */
|
| 76 |
+
|
| 77 |
+
/* MCU Configuration----------------------------------------------------------*/
|
| 78 |
+
|
| 79 |
+
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
|
| 80 |
+
HAL_Init();
|
| 81 |
+
|
| 82 |
+
/* Configure the system clock */
|
| 83 |
+
SystemClock_Config();
|
| 84 |
+
|
| 85 |
+
/* Initialize all configured peripherals */
|
| 86 |
+
MX_GPIO_Init();
|
| 87 |
+
MX_TIM2_Init();
|
| 88 |
+
MX_USART2_UART_Init();
|
| 89 |
+
|
| 90 |
+
/* USER CODE BEGIN 2 */
|
| 91 |
+
HAL_TIM_PWM_Start(&htim2,TIM_CHANNEL_1);
|
| 92 |
+
HAL_TIM_PWM_Start(&htim2,TIM_CHANNEL_2);
|
| 93 |
+
HAL_TIM_PWM_Start(&htim2,TIM_CHANNEL_3);
|
| 94 |
+
/* USER CODE END 2 */
|
| 95 |
+
|
| 96 |
+
/* USER CODE BEGIN 3 */
|
| 97 |
+
/* Infinite loop */
|
| 98 |
+
while (1)
|
| 99 |
+
{
|
| 100 |
+
scheduler();
|
| 101 |
+
}
|
| 102 |
+
/* USER CODE END 3 */
|
| 103 |
+
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
/** System Clock Configuration
|
| 107 |
+
*/
|
| 108 |
+
void SystemClock_Config(void)
|
| 109 |
+
{
|
| 110 |
+
|
| 111 |
+
RCC_OscInitTypeDef RCC_OscInitStruct;
|
| 112 |
+
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
| 113 |
+
RCC_PeriphCLKInitTypeDef PeriphClkInit;
|
| 114 |
+
|
| 115 |
+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
| 116 |
+
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
| 117 |
+
RCC_OscInitStruct.HSICalibrationValue = 16;
|
| 118 |
+
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
| 119 |
+
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
|
| 120 |
+
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL12;
|
| 121 |
+
RCC_OscInitStruct.PLL.PREDIV = RCC_PREDIV_DIV2;
|
| 122 |
+
HAL_RCC_OscConfig(&RCC_OscInitStruct);
|
| 123 |
+
|
| 124 |
+
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
| 125 |
+
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
| 126 |
+
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
| 127 |
+
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
|
| 128 |
+
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1);
|
| 129 |
+
|
| 130 |
+
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART2;
|
| 131 |
+
PeriphClkInit.Usart2ClockSelection = RCC_USART2CLKSOURCE_HSI;
|
| 132 |
+
HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit);
|
| 133 |
+
|
| 134 |
+
__SYSCFG_CLK_ENABLE();
|
| 135 |
+
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
/* TIM2 init function */
|
| 139 |
+
void MX_TIM2_Init(void)
|
| 140 |
+
{
|
| 141 |
+
|
| 142 |
+
TIM_MasterConfigTypeDef sMasterConfig;
|
| 143 |
+
TIM_OC_InitTypeDef sConfigOC;
|
| 144 |
+
|
| 145 |
+
htim2.Instance = TIM2;
|
| 146 |
+
htim2.Init.Prescaler = 1875;
|
| 147 |
+
htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
|
| 148 |
+
htim2.Init.Period = 256;
|
| 149 |
+
htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
| 150 |
+
HAL_TIM_PWM_Init(&htim2);
|
| 151 |
+
|
| 152 |
+
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
|
| 153 |
+
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
|
| 154 |
+
HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig);
|
| 155 |
+
|
| 156 |
+
sConfigOC.OCMode = TIM_OCMODE_PWM1;
|
| 157 |
+
sConfigOC.Pulse = 80;
|
| 158 |
+
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
|
| 159 |
+
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
|
| 160 |
+
HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_1);
|
| 161 |
+
|
| 162 |
+
sConfigOC.Pulse = 160;
|
| 163 |
+
HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_2);
|
| 164 |
+
|
| 165 |
+
sConfigOC.Pulse = 240;
|
| 166 |
+
HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_3);
|
| 167 |
+
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
/* USART2 init function */
|
| 171 |
+
void MX_USART2_UART_Init(void)
|
| 172 |
+
{
|
| 173 |
+
|
| 174 |
+
huart2.Instance = USART2;
|
| 175 |
+
huart2.Init.BaudRate = 9600;//38400;
|
| 176 |
+
huart2.Init.WordLength = UART_WORDLENGTH_8B;
|
| 177 |
+
huart2.Init.StopBits = UART_STOPBITS_1;
|
| 178 |
+
huart2.Init.Parity = UART_PARITY_NONE;
|
| 179 |
+
huart2.Init.Mode = UART_MODE_TX_RX;
|
| 180 |
+
huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
| 181 |
+
huart2.Init.OverSampling = UART_OVERSAMPLING_16;
|
| 182 |
+
huart2.Init.OneBitSampling = UART_ONEBIT_SAMPLING_DISABLED ;
|
| 183 |
+
huart2.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
|
| 184 |
+
HAL_UART_Init(&huart2);
|
| 185 |
+
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
/** Configure pins as
|
| 189 |
+
* Analog
|
| 190 |
+
* Input
|
| 191 |
+
* Output
|
| 192 |
+
* EVENT_OUT
|
| 193 |
+
* EXTI
|
| 194 |
+
*/
|
| 195 |
+
void MX_GPIO_Init(void)
|
| 196 |
+
{
|
| 197 |
+
|
| 198 |
+
GPIO_InitTypeDef GPIO_InitStruct;
|
| 199 |
+
|
| 200 |
+
/* GPIO Ports Clock Enable */
|
| 201 |
+
__GPIOC_CLK_ENABLE();
|
| 202 |
+
__GPIOF_CLK_ENABLE();
|
| 203 |
+
__GPIOA_CLK_ENABLE();
|
| 204 |
+
__GPIOB_CLK_ENABLE();
|
| 205 |
+
|
| 206 |
+
/*Configure GPIO pin : PC13 */
|
| 207 |
+
GPIO_InitStruct.Pin = GPIO_PIN_13;
|
| 208 |
+
GPIO_InitStruct.Mode = GPIO_MODE_EVT_RISING;
|
| 209 |
+
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
| 210 |
+
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
| 211 |
+
|
| 212 |
+
/*Configure GPIO pin : PA5 */
|
| 213 |
+
GPIO_InitStruct.Pin = GPIO_PIN_5;
|
| 214 |
+
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
| 215 |
+
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
| 216 |
+
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
|
| 217 |
+
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
/* USER CODE BEGIN 4 */
|
| 221 |
+
|
| 222 |
+
//! \name finit state machine state
|
| 223 |
+
//! @{
|
| 224 |
+
typedef enum {
|
| 225 |
+
fsm_rt_err = -1, //!< fsm error, error code can be get from other interface
|
| 226 |
+
fsm_rt_cpl = 0, //!< fsm complete
|
| 227 |
+
fsm_rt_on_going = 1, //!< fsm on-going
|
| 228 |
+
} fsm_rt_t;
|
| 229 |
+
//! @}
|
| 230 |
+
|
| 231 |
+
static uint8_t analysis_val(uint8_t chValH, uint8_t chValL);
|
| 232 |
+
static void adjust(void);
|
| 233 |
+
static fsm_rt_t task_receive(void);
|
| 234 |
+
static fsm_rt_t task_adjust(void);
|
| 235 |
+
static fsm_rt_t task_delay(void);
|
| 236 |
+
static fsm_rt_t delay(void);
|
| 237 |
+
static bool s_bFlag = false;
|
| 238 |
+
static bool s_bRgbUpdataFlag = false;
|
| 239 |
+
|
| 240 |
+
static uint8_t s_chRVal = 0;
|
| 241 |
+
static uint8_t s_chGVal = 0;
|
| 242 |
+
static uint8_t s_chBVal = 0;
|
| 243 |
+
/****************************************************************************/
|
| 244 |
+
/**
|
| 245 |
+
* Function Name: void scheduler( void )
|
| 246 |
+
* Description: none
|
| 247 |
+
*
|
| 248 |
+
* Param: none
|
| 249 |
+
* Return: none
|
| 250 |
+
* Author:
|
| 251 |
+
****************************************************************************/
|
| 252 |
+
void scheduler( void )
|
| 253 |
+
{
|
| 254 |
+
uint8_t chByte;
|
| 255 |
+
while(!serial2_out('S'));
|
| 256 |
+
while(!serial2_out('m'));
|
| 257 |
+
while(!serial2_out('a'));
|
| 258 |
+
while(!serial2_out('r'));
|
| 259 |
+
while(!serial2_out('t'));
|
| 260 |
+
while(!serial2_out('L'));
|
| 261 |
+
while(!serial2_out('E'));
|
| 262 |
+
while(!serial2_out('D'));
|
| 263 |
+
while(!serial2_out('\r'));
|
| 264 |
+
while(!serial2_out('\n'));
|
| 265 |
+
|
| 266 |
+
/* loop here forever */
|
| 267 |
+
while(1){
|
| 268 |
+
// if (serial2_in(&chByte)) {
|
| 269 |
+
// serial2_out(chByte);
|
| 270 |
+
// }
|
| 271 |
+
task_receive();
|
| 272 |
+
task_adjust();
|
| 273 |
+
//task_delay();
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
#define TASK_RECEIVE_RESET_FSM() \
|
| 279 |
+
do{ \
|
| 280 |
+
s_tState = START;\
|
| 281 |
+
}while(0)
|
| 282 |
+
static fsm_rt_t task_receive(void)
|
| 283 |
+
{
|
| 284 |
+
static uint8_t s_chLedVal[8];
|
| 285 |
+
static uint8_t s_chLedInd = 0;
|
| 286 |
+
static uint32_t s_wReceiveCounter = 0x2ffff;
|
| 287 |
+
static enum{
|
| 288 |
+
START=0,
|
| 289 |
+
IDLE,
|
| 290 |
+
RECEIVE,
|
| 291 |
+
ANALYSIS
|
| 292 |
+
}s_tState = START;
|
| 293 |
+
switch (s_tState){
|
| 294 |
+
case START:
|
| 295 |
+
s_chLedVal[0] = 0x00;
|
| 296 |
+
s_chLedVal[1] = 0x00;
|
| 297 |
+
s_chLedVal[2] = 0x00;
|
| 298 |
+
s_chLedVal[3] = 0x00;
|
| 299 |
+
s_chLedVal[4] = 0x00;
|
| 300 |
+
s_chLedVal[5] = 0x00;
|
| 301 |
+
s_chLedVal[6] = 0x00;
|
| 302 |
+
s_chLedVal[7] = 0x00;
|
| 303 |
+
|
| 304 |
+
s_chLedInd = 0;
|
| 305 |
+
s_wReceiveCounter = 0x2ffff;
|
| 306 |
+
s_tState = IDLE;
|
| 307 |
+
|
| 308 |
+
case IDLE:
|
| 309 |
+
if(serial2_in(&s_chLedVal[s_chLedInd])){
|
| 310 |
+
if('*'==s_chLedVal[s_chLedInd]){/*'*' is start mark*/
|
| 311 |
+
s_chLedInd++;
|
| 312 |
+
s_tState = RECEIVE;
|
| 313 |
+
}else{
|
| 314 |
+
s_tState = IDLE;
|
| 315 |
+
}
|
| 316 |
+
}
|
| 317 |
+
break;
|
| 318 |
+
|
| 319 |
+
case RECEIVE:
|
| 320 |
+
if(serial2_in(&s_chLedVal[s_chLedInd])){
|
| 321 |
+
if('#'==s_chLedVal[s_chLedInd]){/*'#' is end mark*/
|
| 322 |
+
if(7 == s_chLedInd){/*verify length */
|
| 323 |
+
s_tState = ANALYSIS;
|
| 324 |
+
}else{
|
| 325 |
+
s_tState = START;
|
| 326 |
+
}
|
| 327 |
+
}
|
| 328 |
+
s_chLedInd++;
|
| 329 |
+
}
|
| 330 |
+
/*time out*/
|
| 331 |
+
s_wReceiveCounter--;
|
| 332 |
+
if(0 == s_wReceiveCounter){
|
| 333 |
+
TASK_RECEIVE_RESET_FSM();
|
| 334 |
+
}
|
| 335 |
+
break;
|
| 336 |
+
|
| 337 |
+
case ANALYSIS:
|
| 338 |
+
s_chRVal = analysis_val(s_chLedVal[1],s_chLedVal[2]);
|
| 339 |
+
s_chGVal = analysis_val(s_chLedVal[3],s_chLedVal[4]);
|
| 340 |
+
s_chBVal = analysis_val(s_chLedVal[5],s_chLedVal[6]);
|
| 341 |
+
s_bRgbUpdataFlag = true;
|
| 342 |
+
TASK_RECEIVE_RESET_FSM();
|
| 343 |
+
return fsm_rt_cpl;
|
| 344 |
+
}
|
| 345 |
+
return fsm_rt_on_going;
|
| 346 |
+
}
|
| 347 |
+
|
| 348 |
+
static uint8_t analysis_val(uint8_t chValH, uint8_t chValL)
|
| 349 |
+
{
|
| 350 |
+
uint8_t chVal = 0;
|
| 351 |
+
if((chValH >= 48) && (chValH <= 57)){/*'0'~'9'*/
|
| 352 |
+
chVal = (chValH-48)<<4;
|
| 353 |
+
}else if((chValH >= 65) && (chValH <= 70)){/*'A'~'F'*/
|
| 354 |
+
chVal = (chValH-55)<<4;
|
| 355 |
+
}
|
| 356 |
+
|
| 357 |
+
if((chValL >= 48) && (chValL <= 57)){/*'0'~'9'*/
|
| 358 |
+
chVal |= chValL-48;
|
| 359 |
+
}else if((chValH >= 65) && (chValH <= 70)){/*'A'~'F'*/
|
| 360 |
+
chVal |= chValL-55;
|
| 361 |
+
}
|
| 362 |
+
|
| 363 |
+
return chVal;
|
| 364 |
+
}
|
| 365 |
+
|
| 366 |
+
#define TASK_ADJUST_RESET_FSM() \
|
| 367 |
+
do{ \
|
| 368 |
+
s_tState = START;\
|
| 369 |
+
}while(0)
|
| 370 |
+
static fsm_rt_t task_adjust(void)
|
| 371 |
+
{
|
| 372 |
+
static enum{
|
| 373 |
+
START=0,
|
| 374 |
+
IDLE,
|
| 375 |
+
ADJUST
|
| 376 |
+
}s_tState = START;
|
| 377 |
+
switch(s_tState){
|
| 378 |
+
case START:
|
| 379 |
+
s_tState = IDLE;
|
| 380 |
+
|
| 381 |
+
case IDLE:
|
| 382 |
+
if(s_bRgbUpdataFlag){
|
| 383 |
+
s_bRgbUpdataFlag = false;
|
| 384 |
+
s_tState = ADJUST;
|
| 385 |
+
}
|
| 386 |
+
break;
|
| 387 |
+
|
| 388 |
+
case ADJUST:
|
| 389 |
+
adjust();
|
| 390 |
+
while(!serial2_out('O'));
|
| 391 |
+
while(!serial2_out('K'));
|
| 392 |
+
while(!serial2_out('\r'));
|
| 393 |
+
while(!serial2_out('\n'));
|
| 394 |
+
TASK_ADJUST_RESET_FSM();
|
| 395 |
+
return fsm_rt_cpl;
|
| 396 |
+
}
|
| 397 |
+
|
| 398 |
+
return fsm_rt_on_going;
|
| 399 |
+
}
|
| 400 |
+
|
| 401 |
+
static void adjust(void)
|
| 402 |
+
{
|
| 403 |
+
TIM_OC_InitTypeDef sConfigOC;
|
| 404 |
+
|
| 405 |
+
sConfigOC.OCMode = TIM_OCMODE_PWM1;
|
| 406 |
+
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
|
| 407 |
+
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
|
| 408 |
+
|
| 409 |
+
sConfigOC.Pulse = s_chRVal;
|
| 410 |
+
HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_1);
|
| 411 |
+
|
| 412 |
+
sConfigOC.Pulse = s_chGVal;
|
| 413 |
+
HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_2);
|
| 414 |
+
|
| 415 |
+
sConfigOC.Pulse = s_chBVal;
|
| 416 |
+
HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_3);
|
| 417 |
+
|
| 418 |
+
HAL_TIM_PWM_Start(&htim2,TIM_CHANNEL_1);
|
| 419 |
+
HAL_TIM_PWM_Start(&htim2,TIM_CHANNEL_2);
|
| 420 |
+
HAL_TIM_PWM_Start(&htim2,TIM_CHANNEL_3);
|
| 421 |
+
}
|
| 422 |
+
|
| 423 |
+
#define TASK_DELAY_RESET_FSM() \
|
| 424 |
+
do{ \
|
| 425 |
+
s_tTaskDelayState = TASK_DELAY_START; \
|
| 426 |
+
}while(0)
|
| 427 |
+
static fsm_rt_t task_delay(void)
|
| 428 |
+
{
|
| 429 |
+
static enum{
|
| 430 |
+
TASK_DELAY_START=0,
|
| 431 |
+
TASK_DELAY_ING
|
| 432 |
+
}s_tTaskDelayState = TASK_DELAY_START;
|
| 433 |
+
switch(s_tTaskDelayState){
|
| 434 |
+
case TASK_DELAY_START:
|
| 435 |
+
s_bFlag = false;
|
| 436 |
+
|
| 437 |
+
case TASK_DELAY_ING:
|
| 438 |
+
if(fsm_rt_cpl == delay()){
|
| 439 |
+
s_bFlag = true;
|
| 440 |
+
TASK_DELAY_RESET_FSM();
|
| 441 |
+
return fsm_rt_on_going;
|
| 442 |
+
}
|
| 443 |
+
}
|
| 444 |
+
return fsm_rt_on_going;
|
| 445 |
+
}
|
| 446 |
+
|
| 447 |
+
#define DELAY_RESET_FSM() \
|
| 448 |
+
do{ \
|
| 449 |
+
s_tDelaytState = DELAY_START; \
|
| 450 |
+
}while(0)
|
| 451 |
+
#define DEALY_TIME (0xff)
|
| 452 |
+
|
| 453 |
+
static fsm_rt_t delay(void)
|
| 454 |
+
{
|
| 455 |
+
static enum{
|
| 456 |
+
DELAY_START = 0,
|
| 457 |
+
DELAY
|
| 458 |
+
}s_tDelaytState = DELAY_START;
|
| 459 |
+
static uint32_t s_wDelayCounter = 0;
|
| 460 |
+
switch(s_tDelaytState){
|
| 461 |
+
case DELAY_START:
|
| 462 |
+
s_wDelayCounter = 0;
|
| 463 |
+
s_tDelaytState = DELAY;
|
| 464 |
+
|
| 465 |
+
case DELAY:
|
| 466 |
+
s_wDelayCounter ++;
|
| 467 |
+
if(s_wDelayCounter > DEALY_TIME){
|
| 468 |
+
s_wDelayCounter = 0;
|
| 469 |
+
DELAY_RESET_FSM();
|
| 470 |
+
return fsm_rt_cpl;
|
| 471 |
+
}
|
| 472 |
+
break;
|
| 473 |
+
}
|
| 474 |
+
return fsm_rt_on_going;
|
| 475 |
+
}
|
| 476 |
+
|
| 477 |
+
bool serial2_out(uint8_t chByte)
|
| 478 |
+
{
|
| 479 |
+
bool bUartState;
|
| 480 |
+
if(HAL_UART_Transmit(&huart2,&chByte,1,10) == HAL_OK){
|
| 481 |
+
bUartState = true;
|
| 482 |
+
}else{
|
| 483 |
+
bUartState = false;
|
| 484 |
+
}
|
| 485 |
+
return bUartState;
|
| 486 |
+
}
|
| 487 |
+
|
| 488 |
+
bool serial2_in(uint8_t *pchByte)
|
| 489 |
+
{
|
| 490 |
+
bool bUartState;
|
| 491 |
+
if(0 == pchByte){
|
| 492 |
+
bUartState = false;
|
| 493 |
+
}else{
|
| 494 |
+
if(HAL_UART_Receive(&huart2,pchByte,1,0x1fffff) == HAL_OK){
|
| 495 |
+
bUartState = true;
|
| 496 |
+
}else{
|
| 497 |
+
bUartState = false;
|
| 498 |
+
}
|
| 499 |
+
}
|
| 500 |
+
return bUartState;
|
| 501 |
+
}
|
| 502 |
+
/* USER CODE END 4 */
|
| 503 |
+
|
| 504 |
+
#ifdef USE_FULL_ASSERT
|
| 505 |
+
|
| 506 |
+
/**
|
| 507 |
+
* @brief Reports the name of the source file and the source line number
|
| 508 |
+
* where the assert_param error has occurred.
|
| 509 |
+
* @param file: pointer to the source file name
|
| 510 |
+
* @param line: assert_param error line source number
|
| 511 |
+
* @retval None
|
| 512 |
+
*/
|
| 513 |
+
void assert_failed(uint8_t* file, uint32_t line)
|
| 514 |
+
{
|
| 515 |
+
/* USER CODE BEGIN 6 */
|
| 516 |
+
/* User can add his own implementation to report the file name and line number,
|
| 517 |
+
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
|
| 518 |
+
/* USER CODE END 6 */
|
| 519 |
+
|
| 520 |
+
}
|
| 521 |
+
|
| 522 |
+
#endif
|
| 523 |
+
|
| 524 |
+
/**
|
| 525 |
+
* @}
|
| 526 |
+
*/
|
| 527 |
+
|
| 528 |
+
/**
|
| 529 |
+
* @}
|
| 530 |
+
*/
|
| 531 |
+
|
| 532 |
+
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
Engineering/project5/stm32f0xx_hal_msp.c
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
******************************************************************************
|
| 3 |
+
* File Name : stm32f0xx_hal_msp.c
|
| 4 |
+
* Date : 17/12/2014 19:03:19
|
| 5 |
+
* Description : This file provides code for the MSP Initialization
|
| 6 |
+
* and de-Initialization codes.
|
| 7 |
+
******************************************************************************
|
| 8 |
+
*
|
| 9 |
+
* COPYRIGHT(c) 2014 STMicroelectronics
|
| 10 |
+
*
|
| 11 |
+
* Redistribution and use in source and binary forms, with or without modification,
|
| 12 |
+
* are permitted provided that the following conditions are met:
|
| 13 |
+
* 1. Redistributions of source code must retain the above copyright notice,
|
| 14 |
+
* this list of conditions and the following disclaimer.
|
| 15 |
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
| 16 |
+
* this list of conditions and the following disclaimer in the documentation
|
| 17 |
+
* and/or other materials provided with the distribution.
|
| 18 |
+
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
| 19 |
+
* may be used to endorse or promote products derived from this software
|
| 20 |
+
* without specific prior written permission.
|
| 21 |
+
*
|
| 22 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 23 |
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 24 |
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
| 25 |
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
| 26 |
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
| 27 |
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
| 28 |
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
| 29 |
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
| 30 |
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 31 |
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 32 |
+
*
|
| 33 |
+
******************************************************************************
|
| 34 |
+
*/
|
| 35 |
+
/* Includes ------------------------------------------------------------------*/
|
| 36 |
+
#include "stm32f0xx_hal.h"
|
| 37 |
+
|
| 38 |
+
/* USER CODE BEGIN 0 */
|
| 39 |
+
|
| 40 |
+
/* USER CODE END 0 */
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* Initializes the Global MSP.
|
| 44 |
+
*/
|
| 45 |
+
void HAL_MspInit(void)
|
| 46 |
+
{
|
| 47 |
+
/* USER CODE BEGIN MspInit 0 */
|
| 48 |
+
|
| 49 |
+
/* USER CODE END MspInit 0 */
|
| 50 |
+
|
| 51 |
+
/* System interrupt init*/
|
| 52 |
+
/* SysTick_IRQn interrupt configuration */
|
| 53 |
+
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
|
| 54 |
+
|
| 55 |
+
/* USER CODE BEGIN MspInit 1 */
|
| 56 |
+
|
| 57 |
+
/* USER CODE END MspInit 1 */
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef* htim_pwm)
|
| 61 |
+
{
|
| 62 |
+
|
| 63 |
+
GPIO_InitTypeDef GPIO_InitStruct;
|
| 64 |
+
if(htim_pwm->Instance==TIM2)
|
| 65 |
+
{
|
| 66 |
+
/* USER CODE BEGIN TIM2_MspInit 0 */
|
| 67 |
+
|
| 68 |
+
/* USER CODE END TIM2_MspInit 0 */
|
| 69 |
+
/* Peripheral clock enable */
|
| 70 |
+
__TIM2_CLK_ENABLE();
|
| 71 |
+
|
| 72 |
+
/**TIM2 GPIO Configuration
|
| 73 |
+
PA0 ------> TIM2_CH1
|
| 74 |
+
PA1 ------> TIM2_CH2
|
| 75 |
+
PB10 ------> TIM2_CH3
|
| 76 |
+
*/
|
| 77 |
+
GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1;
|
| 78 |
+
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
| 79 |
+
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
| 80 |
+
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
|
| 81 |
+
GPIO_InitStruct.Alternate = GPIO_AF2_TIM2;
|
| 82 |
+
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
| 83 |
+
|
| 84 |
+
GPIO_InitStruct.Pin = GPIO_PIN_10;
|
| 85 |
+
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
| 86 |
+
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
| 87 |
+
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
|
| 88 |
+
GPIO_InitStruct.Alternate = GPIO_AF2_TIM2;
|
| 89 |
+
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
| 90 |
+
|
| 91 |
+
/* USER CODE BEGIN TIM2_MspInit 1 */
|
| 92 |
+
|
| 93 |
+
/* USER CODE END TIM2_MspInit 1 */
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef* htim_pwm)
|
| 99 |
+
{
|
| 100 |
+
|
| 101 |
+
if(htim_pwm->Instance==TIM2)
|
| 102 |
+
{
|
| 103 |
+
/* USER CODE BEGIN TIM2_MspDeInit 0 */
|
| 104 |
+
|
| 105 |
+
/* USER CODE END TIM2_MspDeInit 0 */
|
| 106 |
+
/* Peripheral clock disable */
|
| 107 |
+
__TIM2_CLK_DISABLE();
|
| 108 |
+
|
| 109 |
+
/**TIM2 GPIO Configuration
|
| 110 |
+
PA0 ------> TIM2_CH1
|
| 111 |
+
PA1 ------> TIM2_CH2
|
| 112 |
+
PB10 ------> TIM2_CH3
|
| 113 |
+
*/
|
| 114 |
+
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_0|GPIO_PIN_1);
|
| 115 |
+
|
| 116 |
+
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_10);
|
| 117 |
+
|
| 118 |
+
/* USER CODE BEGIN TIM2_MspDeInit 1 */
|
| 119 |
+
|
| 120 |
+
/* USER CODE END TIM2_MspDeInit 1 */
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
void HAL_UART_MspInit(UART_HandleTypeDef* huart)
|
| 126 |
+
{
|
| 127 |
+
|
| 128 |
+
GPIO_InitTypeDef GPIO_InitStruct;
|
| 129 |
+
if(huart->Instance==USART2)
|
| 130 |
+
{
|
| 131 |
+
/* USER CODE BEGIN USART2_MspInit 0 */
|
| 132 |
+
|
| 133 |
+
/* USER CODE END USART2_MspInit 0 */
|
| 134 |
+
/* Peripheral clock enable */
|
| 135 |
+
__USART2_CLK_ENABLE();
|
| 136 |
+
|
| 137 |
+
/**USART2 GPIO Configuration
|
| 138 |
+
PA2 ------> USART2_TX
|
| 139 |
+
PA3 ------> USART2_RX
|
| 140 |
+
*/
|
| 141 |
+
GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3;
|
| 142 |
+
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
| 143 |
+
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
| 144 |
+
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
|
| 145 |
+
GPIO_InitStruct.Alternate = GPIO_AF1_USART2;
|
| 146 |
+
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
| 147 |
+
|
| 148 |
+
/* USER CODE BEGIN USART2_MspInit 1 */
|
| 149 |
+
|
| 150 |
+
/* USER CODE END USART2_MspInit 1 */
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
|
| 156 |
+
{
|
| 157 |
+
|
| 158 |
+
if(huart->Instance==USART2)
|
| 159 |
+
{
|
| 160 |
+
/* USER CODE BEGIN USART2_MspDeInit 0 */
|
| 161 |
+
|
| 162 |
+
/* USER CODE END USART2_MspDeInit 0 */
|
| 163 |
+
/* Peripheral clock disable */
|
| 164 |
+
__USART2_CLK_DISABLE();
|
| 165 |
+
|
| 166 |
+
/**USART2 GPIO Configuration
|
| 167 |
+
PA2 ------> USART2_TX
|
| 168 |
+
PA3 ------> USART2_RX
|
| 169 |
+
*/
|
| 170 |
+
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2|GPIO_PIN_3);
|
| 171 |
+
|
| 172 |
+
/* USER CODE BEGIN USART2_MspDeInit 1 */
|
| 173 |
+
|
| 174 |
+
/* USER CODE END USART2_MspDeInit 1 */
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
/* USER CODE BEGIN 1 */
|
| 180 |
+
|
| 181 |
+
/* USER CODE END 1 */
|
| 182 |
+
|
| 183 |
+
/**
|
| 184 |
+
* @}
|
| 185 |
+
*/
|
| 186 |
+
|
| 187 |
+
/**
|
| 188 |
+
* @}
|
| 189 |
+
*/
|
| 190 |
+
|
| 191 |
+
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
Engineering/project5/stm32f0xx_it.c
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
******************************************************************************
|
| 3 |
+
* @file stm32f0xx_it.c
|
| 4 |
+
* @date 17/12/2014 19:03:19
|
| 5 |
+
* @brief Interrupt Service Routines.
|
| 6 |
+
******************************************************************************
|
| 7 |
+
*
|
| 8 |
+
* COPYRIGHT(c) 2014 STMicroelectronics
|
| 9 |
+
*
|
| 10 |
+
* Redistribution and use in source and binary forms, with or without modification,
|
| 11 |
+
* are permitted provided that the following conditions are met:
|
| 12 |
+
* 1. Redistributions of source code must retain the above copyright notice,
|
| 13 |
+
* this list of conditions and the following disclaimer.
|
| 14 |
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
| 15 |
+
* this list of conditions and the following disclaimer in the documentation
|
| 16 |
+
* and/or other materials provided with the distribution.
|
| 17 |
+
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
| 18 |
+
* may be used to endorse or promote products derived from this software
|
| 19 |
+
* without specific prior written permission.
|
| 20 |
+
*
|
| 21 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 22 |
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 23 |
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
| 24 |
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
| 25 |
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
| 26 |
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
| 27 |
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
| 28 |
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
| 29 |
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 30 |
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 31 |
+
*
|
| 32 |
+
******************************************************************************
|
| 33 |
+
*/
|
| 34 |
+
/* Includes ------------------------------------------------------------------*/
|
| 35 |
+
#include "stm32f0xx_hal.h"
|
| 36 |
+
#include "stm32f0xx.h"
|
| 37 |
+
#include "stm32f0xx_it.h"
|
| 38 |
+
/* USER CODE BEGIN 0 */
|
| 39 |
+
|
| 40 |
+
/* USER CODE END 0 */
|
| 41 |
+
/* External variables --------------------------------------------------------*/
|
| 42 |
+
|
| 43 |
+
/******************************************************************************/
|
| 44 |
+
/* Cortex-M0 Processor Interruption and Exception Handlers */
|
| 45 |
+
/******************************************************************************/
|
| 46 |
+
|
| 47 |
+
/**
|
| 48 |
+
* @brief This function handles System tick timer.
|
| 49 |
+
*/
|
| 50 |
+
void SysTick_Handler(void)
|
| 51 |
+
{
|
| 52 |
+
/* USER CODE BEGIN SysTick_IRQn 0 */
|
| 53 |
+
|
| 54 |
+
/* USER CODE END SysTick_IRQn 0 */
|
| 55 |
+
HAL_IncTick();
|
| 56 |
+
HAL_SYSTICK_IRQHandler();
|
| 57 |
+
/* USER CODE BEGIN SysTick_IRQn 1 */
|
| 58 |
+
|
| 59 |
+
/* USER CODE END SysTick_IRQn 1 */
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
/* USER CODE BEGIN 1 */
|
| 63 |
+
|
| 64 |
+
/* USER CODE END 1 */
|
| 65 |
+
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
Engineering/project6/1.png
ADDED
|
Engineering/project6/2.png
ADDED
|
Engineering/project6/3.png
ADDED
|
Git LFS Details
|
Engineering/project6/main.c
ADDED
|
@@ -0,0 +1,939 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Includes ------------------------------------------------------------------*/
|
| 2 |
+
#include "stm32f4xx_hal.h"
|
| 3 |
+
#include "font.h"
|
| 4 |
+
|
| 5 |
+
/* USER CODE BEGIN Includes */
|
| 6 |
+
#include "stdio.h"
|
| 7 |
+
/* USER CODE END Includes */
|
| 8 |
+
|
| 9 |
+
/* Private variables ---------------------------------------------------------*/
|
| 10 |
+
ADC_HandleTypeDef hadc1;
|
| 11 |
+
|
| 12 |
+
TIM_HandleTypeDef htim3;
|
| 13 |
+
|
| 14 |
+
UART_HandleTypeDef huart2;
|
| 15 |
+
|
| 16 |
+
/* USER CODE BEGIN PV */
|
| 17 |
+
// these variables are volatile because they are used during the interrupt service routine!
|
| 18 |
+
//CS --PB.4
|
| 19 |
+
//SCK --PB.3
|
| 20 |
+
//SDI --PB.5
|
| 21 |
+
//DC --PB.1
|
| 22 |
+
//REST --PB.0
|
| 23 |
+
|
| 24 |
+
#define LCD_W 240
|
| 25 |
+
#define LCD_H 320
|
| 26 |
+
#define LCD_CS_High() { HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, GPIO_PIN_SET);}
|
| 27 |
+
#define LCD_CS_Low() { HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, GPIO_PIN_RESET);}
|
| 28 |
+
|
| 29 |
+
#define LCD_SCK_High() { HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_SET);}
|
| 30 |
+
#define LCD_SCK_Low() { HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_RESET);}
|
| 31 |
+
|
| 32 |
+
#define LCD_SDI_High() { HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5, GPIO_PIN_SET);}
|
| 33 |
+
#define LCD_SDI_Low() { HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5, GPIO_PIN_RESET);}
|
| 34 |
+
|
| 35 |
+
#define LCD_DC_High() { HAL_GPIO_WritePin(GPIOB, GPIO_PIN_1, GPIO_PIN_SET);}
|
| 36 |
+
#define LCD_DC_Low() { HAL_GPIO_WritePin(GPIOB, GPIO_PIN_1, GPIO_PIN_RESET);}
|
| 37 |
+
|
| 38 |
+
#define LCD_REST_High() { HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, GPIO_PIN_SET);}
|
| 39 |
+
#define LCD_REST_Low() { HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, GPIO_PIN_RESET);}
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
#define WHITE 0xFFFF
|
| 43 |
+
#define BLACK 0x0000
|
| 44 |
+
#define BLUE 0x001F
|
| 45 |
+
#define BRED 0XF81F
|
| 46 |
+
#define GRED 0XFFE0
|
| 47 |
+
#define GBLUE 0X07FF
|
| 48 |
+
#define RED 0xF800
|
| 49 |
+
#define MAGENTA 0xF81F
|
| 50 |
+
#define GREEN 0x07E0
|
| 51 |
+
#define CYAN 0x7FFF
|
| 52 |
+
#define YELLOW 0xFFE0
|
| 53 |
+
#define BROWN 0XBC40
|
| 54 |
+
#define BRRED 0XFC07
|
| 55 |
+
#define GRAY 0X8430
|
| 56 |
+
|
| 57 |
+
#define true 1
|
| 58 |
+
#define false 0
|
| 59 |
+
int BPM; // used to hold the pulse rate
|
| 60 |
+
int Signal; // holds the incoming raw data
|
| 61 |
+
int IBI = 600; // holds the time between beats, must be seeded!
|
| 62 |
+
unsigned char Pulse = false; // true when pulse wave is high, false when it's low
|
| 63 |
+
unsigned char QS = false; // becomes true when Arduoino finds a beat.
|
| 64 |
+
int rate[10]; // array to hold last ten IBI values
|
| 65 |
+
unsigned long sampleCounter = 0; // used to determine pulse timing
|
| 66 |
+
unsigned long lastBeatTime = 0; // used to find IBI
|
| 67 |
+
int P =512; // used to find peak in pulse wave, seeded
|
| 68 |
+
int T = 512; // used to find trough in pulse wave, seeded
|
| 69 |
+
int thresh = 512; // used to find instant moment of heart beat, seeded
|
| 70 |
+
int amp = 100; // used to hold amplitude of pulse waveform, seeded
|
| 71 |
+
int Num;
|
| 72 |
+
unsigned char firstBeat = true; // used to seed rate array so we startup with reasonable BPM
|
| 73 |
+
unsigned char secondBeat = false; // used to seed rate array so we startup with reasonable BPM
|
| 74 |
+
/* USER CODE END PV */
|
| 75 |
+
|
| 76 |
+
/* Private function prototypes -----------------------------------------------*/
|
| 77 |
+
void SystemClock_Config(void);
|
| 78 |
+
static void MX_GPIO_Init(void);
|
| 79 |
+
static void MX_ADC1_Init(void);
|
| 80 |
+
static void MX_TIM3_Init(void);
|
| 81 |
+
static void MX_USART2_UART_Init(void);
|
| 82 |
+
|
| 83 |
+
/* USER CODE BEGIN PFP */
|
| 84 |
+
/* Private function prototypes -----------------------------------------------*/
|
| 85 |
+
void sendDataToProcessing(char symbol, int dat );
|
| 86 |
+
#ifdef __GNUC__
|
| 87 |
+
/* With GCC/RAISONANCE, small printf (option LD Linker->Libraries->Small printf
|
| 88 |
+
set to 'Yes') calls __io_putchar() */
|
| 89 |
+
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
|
| 90 |
+
#else
|
| 91 |
+
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
|
| 92 |
+
#endif /* __GNUC__ */
|
| 93 |
+
|
| 94 |
+
uint16_t BACK_COLOR,POINT_COLOR;
|
| 95 |
+
|
| 96 |
+
long int delay_1us(void)
|
| 97 |
+
{
|
| 98 |
+
long int count=2;
|
| 99 |
+
while(count--);
|
| 100 |
+
return 0;
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
void delay_ms(uint16_t nms)
|
| 104 |
+
{
|
| 105 |
+
uint16_t n,m;
|
| 106 |
+
n=nms;
|
| 107 |
+
while(n)
|
| 108 |
+
{
|
| 109 |
+
for(m=0;m<1000;m++) delay_1us();
|
| 110 |
+
n--;
|
| 111 |
+
}
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
void Delay(uint32_t count)
|
| 116 |
+
{
|
| 117 |
+
while(count--);
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
void LCD_Writ_Bus(unsigned char com)
|
| 121 |
+
{
|
| 122 |
+
unsigned char uci;
|
| 123 |
+
|
| 124 |
+
for(uci=0;uci<8;uci++)
|
| 125 |
+
{
|
| 126 |
+
if(com & 0x80)
|
| 127 |
+
{
|
| 128 |
+
LCD_SDI_High();
|
| 129 |
+
}
|
| 130 |
+
else
|
| 131 |
+
{
|
| 132 |
+
LCD_SDI_Low();
|
| 133 |
+
}
|
| 134 |
+
com = com << 1;
|
| 135 |
+
|
| 136 |
+
LCD_SCK_Low();
|
| 137 |
+
LCD_SCK_High();
|
| 138 |
+
}
|
| 139 |
+
}
|
| 140 |
+
void LCD_WR_DATA8(char da)
|
| 141 |
+
{
|
| 142 |
+
LCD_DC_High();
|
| 143 |
+
LCD_Writ_Bus(da);
|
| 144 |
+
}
|
| 145 |
+
void LCD_WR_DATA(int da)
|
| 146 |
+
{
|
| 147 |
+
LCD_DC_High();
|
| 148 |
+
LCD_Writ_Bus(da>>8);
|
| 149 |
+
LCD_Writ_Bus(da);
|
| 150 |
+
}
|
| 151 |
+
void LCD_WR_REG(char da)
|
| 152 |
+
{
|
| 153 |
+
LCD_DC_Low();
|
| 154 |
+
LCD_Writ_Bus(da);
|
| 155 |
+
}
|
| 156 |
+
void LCD_WR_REG_DATA(int reg,int da)
|
| 157 |
+
{
|
| 158 |
+
LCD_WR_REG(reg);
|
| 159 |
+
LCD_WR_DATA(da);
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
void Address_set(unsigned int x1,unsigned int y1,unsigned int x2,unsigned int y2)
|
| 163 |
+
{
|
| 164 |
+
LCD_WR_REG(0x2a);
|
| 165 |
+
LCD_WR_DATA8(x1>>8);
|
| 166 |
+
LCD_WR_DATA8(x1);
|
| 167 |
+
LCD_WR_DATA8(x2>>8);
|
| 168 |
+
LCD_WR_DATA8(x2);
|
| 169 |
+
|
| 170 |
+
LCD_WR_REG(0x2b);
|
| 171 |
+
LCD_WR_DATA8(y1>>8);
|
| 172 |
+
LCD_WR_DATA8(y1);
|
| 173 |
+
LCD_WR_DATA8(y2>>8);
|
| 174 |
+
LCD_WR_DATA8(y2);
|
| 175 |
+
|
| 176 |
+
LCD_WR_REG(0x2C);
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
static GPIO_InitTypeDef GPIO_InitStruct;
|
| 180 |
+
void GPIO_Configuration(void)
|
| 181 |
+
{
|
| 182 |
+
__HAL_RCC_GPIOB_CLK_ENABLE();
|
| 183 |
+
GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_3|GPIO_PIN_5|GPIO_PIN_1|GPIO_PIN_0;
|
| 184 |
+
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; //GPIO_SPEED_FREQ_VERY_HIGH
|
| 185 |
+
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
| 186 |
+
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
| 187 |
+
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
| 188 |
+
|
| 189 |
+
}
|
| 190 |
+
void Lcd_Init(void)
|
| 191 |
+
{
|
| 192 |
+
LCD_REST_Low();
|
| 193 |
+
delay_ms(20);
|
| 194 |
+
LCD_REST_High();
|
| 195 |
+
delay_ms(20);
|
| 196 |
+
LCD_CS_Low();
|
| 197 |
+
|
| 198 |
+
LCD_WR_REG(0xCB);
|
| 199 |
+
LCD_WR_DATA8(0x39);
|
| 200 |
+
LCD_WR_DATA8(0x2C);
|
| 201 |
+
LCD_WR_DATA8(0x00);
|
| 202 |
+
LCD_WR_DATA8(0x34);
|
| 203 |
+
LCD_WR_DATA8(0x02);
|
| 204 |
+
|
| 205 |
+
LCD_WR_REG(0xCF);
|
| 206 |
+
LCD_WR_DATA8(0x00);
|
| 207 |
+
LCD_WR_DATA8(0XC1);
|
| 208 |
+
LCD_WR_DATA8(0X30);
|
| 209 |
+
|
| 210 |
+
LCD_WR_REG(0xE8);
|
| 211 |
+
LCD_WR_DATA8(0x85);
|
| 212 |
+
LCD_WR_DATA8(0x00);
|
| 213 |
+
LCD_WR_DATA8(0x78);
|
| 214 |
+
|
| 215 |
+
LCD_WR_REG(0xEA);
|
| 216 |
+
LCD_WR_DATA8(0x00);
|
| 217 |
+
LCD_WR_DATA8(0x00);
|
| 218 |
+
|
| 219 |
+
LCD_WR_REG(0xED);
|
| 220 |
+
LCD_WR_DATA8(0x64);
|
| 221 |
+
LCD_WR_DATA8(0x03);
|
| 222 |
+
LCD_WR_DATA8(0X12);
|
| 223 |
+
LCD_WR_DATA8(0X81);
|
| 224 |
+
|
| 225 |
+
LCD_WR_REG(0xF7);
|
| 226 |
+
LCD_WR_DATA8(0x20);
|
| 227 |
+
|
| 228 |
+
LCD_WR_REG(0xC0); //Power control
|
| 229 |
+
LCD_WR_DATA8(0x23); //VRH[5:0]
|
| 230 |
+
|
| 231 |
+
LCD_WR_REG(0xC1); //Power control
|
| 232 |
+
LCD_WR_DATA8(0x10); //SAP[2:0];BT[3:0]
|
| 233 |
+
|
| 234 |
+
LCD_WR_REG(0xC5); //VCM control
|
| 235 |
+
LCD_WR_DATA8(0x3e); //?????
|
| 236 |
+
LCD_WR_DATA8(0x28);
|
| 237 |
+
|
| 238 |
+
LCD_WR_REG(0xC7); //VCM control2
|
| 239 |
+
LCD_WR_DATA8(0x86); //--
|
| 240 |
+
|
| 241 |
+
LCD_WR_REG(0x36); // Memory Access Control
|
| 242 |
+
LCD_WR_DATA8(0x48); //C8 //48 68??//28 E8 ??
|
| 243 |
+
|
| 244 |
+
LCD_WR_REG(0x3A);
|
| 245 |
+
LCD_WR_DATA8(0x55);
|
| 246 |
+
|
| 247 |
+
LCD_WR_REG(0xB1);
|
| 248 |
+
LCD_WR_DATA8(0x00);
|
| 249 |
+
LCD_WR_DATA8(0x18);
|
| 250 |
+
|
| 251 |
+
LCD_WR_REG(0xB6); // Display Function Control
|
| 252 |
+
LCD_WR_DATA8(0x08);
|
| 253 |
+
LCD_WR_DATA8(0x82);
|
| 254 |
+
LCD_WR_DATA8(0x27);
|
| 255 |
+
|
| 256 |
+
LCD_WR_REG(0xF2); // 3Gamma Function Disable
|
| 257 |
+
LCD_WR_DATA8(0x00);
|
| 258 |
+
|
| 259 |
+
LCD_WR_REG(0x26); //Gamma curve selected
|
| 260 |
+
LCD_WR_DATA8(0x01);
|
| 261 |
+
|
| 262 |
+
LCD_WR_REG(0xE0); //Set Gamma
|
| 263 |
+
LCD_WR_DATA8(0x0F);
|
| 264 |
+
LCD_WR_DATA8(0x31);
|
| 265 |
+
LCD_WR_DATA8(0x2B);
|
| 266 |
+
LCD_WR_DATA8(0x0C);
|
| 267 |
+
LCD_WR_DATA8(0x0E);
|
| 268 |
+
LCD_WR_DATA8(0x08);
|
| 269 |
+
LCD_WR_DATA8(0x4E);
|
| 270 |
+
LCD_WR_DATA8(0xF1);
|
| 271 |
+
LCD_WR_DATA8(0x37);
|
| 272 |
+
LCD_WR_DATA8(0x07);
|
| 273 |
+
LCD_WR_DATA8(0x10);
|
| 274 |
+
LCD_WR_DATA8(0x03);
|
| 275 |
+
LCD_WR_DATA8(0x0E);
|
| 276 |
+
LCD_WR_DATA8(0x09);
|
| 277 |
+
LCD_WR_DATA8(0x00);
|
| 278 |
+
|
| 279 |
+
LCD_WR_REG(0XE1); //Set Gamma
|
| 280 |
+
LCD_WR_DATA8(0x00);
|
| 281 |
+
LCD_WR_DATA8(0x0E);
|
| 282 |
+
LCD_WR_DATA8(0x14);
|
| 283 |
+
LCD_WR_DATA8(0x03);
|
| 284 |
+
LCD_WR_DATA8(0x11);
|
| 285 |
+
LCD_WR_DATA8(0x07);
|
| 286 |
+
LCD_WR_DATA8(0x31);
|
| 287 |
+
LCD_WR_DATA8(0xC1);
|
| 288 |
+
LCD_WR_DATA8(0x48);
|
| 289 |
+
LCD_WR_DATA8(0x08);
|
| 290 |
+
LCD_WR_DATA8(0x0F);
|
| 291 |
+
LCD_WR_DATA8(0x0C);
|
| 292 |
+
LCD_WR_DATA8(0x31);
|
| 293 |
+
LCD_WR_DATA8(0x36);
|
| 294 |
+
LCD_WR_DATA8(0x0F);
|
| 295 |
+
|
| 296 |
+
LCD_WR_REG(0x11); //Exit Sleep
|
| 297 |
+
delay_ms(120);
|
| 298 |
+
|
| 299 |
+
LCD_WR_REG(0x29); //Display on
|
| 300 |
+
LCD_WR_REG(0x2c);
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
void LCD_Clear(uint16_t Color)
|
| 304 |
+
{
|
| 305 |
+
char VH,VL;
|
| 306 |
+
uint16_t i,j;
|
| 307 |
+
VH=Color>>8;
|
| 308 |
+
VL=Color;
|
| 309 |
+
Address_set(0,0,LCD_W-1,LCD_H-1);
|
| 310 |
+
for(i=0;i<LCD_W;i++)
|
| 311 |
+
{
|
| 312 |
+
for (j=0;j<LCD_H;j++)
|
| 313 |
+
{
|
| 314 |
+
LCD_WR_DATA8(VH);
|
| 315 |
+
LCD_WR_DATA8(VL);
|
| 316 |
+
}
|
| 317 |
+
}
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
void LCD_DrawPoint(uint16_t x,uint16_t y)
|
| 321 |
+
{
|
| 322 |
+
Address_set(x,y,x,y);
|
| 323 |
+
LCD_WR_DATA(POINT_COLOR);
|
| 324 |
+
}
|
| 325 |
+
|
| 326 |
+
void LCD_Fill(uint16_t xsta,uint16_t ysta,uint16_t xend,uint16_t yend,uint16_t color)
|
| 327 |
+
{
|
| 328 |
+
uint16_t i,j;
|
| 329 |
+
Address_set(xsta,ysta,xend,yend);
|
| 330 |
+
for(i=ysta;i<=yend;i++)
|
| 331 |
+
{
|
| 332 |
+
for(j=xsta;j<=xend;j++)LCD_WR_DATA(color);//??????
|
| 333 |
+
}
|
| 334 |
+
}
|
| 335 |
+
|
| 336 |
+
void LCD_DrawPoint_big(uint16_t x,uint16_t y)
|
| 337 |
+
{
|
| 338 |
+
LCD_Fill(x-1,y-1,x+1,y+1,POINT_COLOR);
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
void LCD_DrawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2)
|
| 342 |
+
{
|
| 343 |
+
uint16_t t;
|
| 344 |
+
int xerr=0,yerr=0,delta_x,delta_y,distance;
|
| 345 |
+
int incx,incy,uRow,uCol;
|
| 346 |
+
|
| 347 |
+
delta_x=x2-x1;
|
| 348 |
+
delta_y=y2-y1;
|
| 349 |
+
uRow=x1;
|
| 350 |
+
uCol=y1;
|
| 351 |
+
if(delta_x>0)incx=1;
|
| 352 |
+
else if(delta_x==0)incx=0;
|
| 353 |
+
else {incx=-1;delta_x=-delta_x;}
|
| 354 |
+
if(delta_y>0)incy=1;
|
| 355 |
+
else if(delta_y==0)incy=0;
|
| 356 |
+
else{incy=-1;delta_y=-delta_y;}
|
| 357 |
+
if( delta_x>delta_y)distance=delta_x;
|
| 358 |
+
else distance=delta_y;
|
| 359 |
+
for(t=0;t<=distance+1;t++ )
|
| 360 |
+
{
|
| 361 |
+
LCD_DrawPoint(uRow,uCol);
|
| 362 |
+
xerr+=delta_x ;
|
| 363 |
+
yerr+=delta_y ;
|
| 364 |
+
if(xerr>distance)
|
| 365 |
+
{
|
| 366 |
+
xerr-=distance;
|
| 367 |
+
uRow+=incx;
|
| 368 |
+
}
|
| 369 |
+
if(yerr>distance)
|
| 370 |
+
{
|
| 371 |
+
yerr-=distance;
|
| 372 |
+
uCol+=incy;
|
| 373 |
+
}
|
| 374 |
+
}
|
| 375 |
+
}
|
| 376 |
+
|
| 377 |
+
void LCD_DrawRectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2)
|
| 378 |
+
{
|
| 379 |
+
LCD_DrawLine(x1,y1,x2,y1);
|
| 380 |
+
LCD_DrawLine(x1,y1,x1,y2);
|
| 381 |
+
LCD_DrawLine(x1,y2,x2,y2);
|
| 382 |
+
LCD_DrawLine(x2,y1,x2,y2);
|
| 383 |
+
}
|
| 384 |
+
|
| 385 |
+
void Draw_Circle(uint16_t x0,uint16_t y0,char r)
|
| 386 |
+
{
|
| 387 |
+
int a,b;
|
| 388 |
+
int di;
|
| 389 |
+
a=0; b=r;
|
| 390 |
+
di=3-(r<<1);
|
| 391 |
+
while(a<=b)
|
| 392 |
+
{
|
| 393 |
+
LCD_DrawPoint(x0-b,y0-a); //3
|
| 394 |
+
LCD_DrawPoint(x0+b,y0-a); //0
|
| 395 |
+
LCD_DrawPoint(x0-a,y0+b); //1
|
| 396 |
+
LCD_DrawPoint(x0-b,y0-a); //7
|
| 397 |
+
LCD_DrawPoint(x0-a,y0-b); //2
|
| 398 |
+
LCD_DrawPoint(x0+b,y0+a); //4
|
| 399 |
+
LCD_DrawPoint(x0+a,y0-b); //5
|
| 400 |
+
LCD_DrawPoint(x0+a,y0+b); //6
|
| 401 |
+
LCD_DrawPoint(x0-b,y0+a);
|
| 402 |
+
a++;
|
| 403 |
+
|
| 404 |
+
if(di<0)di +=4*a+6;
|
| 405 |
+
else
|
| 406 |
+
{
|
| 407 |
+
di+=10+4*(a-b);
|
| 408 |
+
b--;
|
| 409 |
+
}
|
| 410 |
+
LCD_DrawPoint(x0+a,y0+b);
|
| 411 |
+
}
|
| 412 |
+
}
|
| 413 |
+
|
| 414 |
+
void LCD_ShowChar(uint16_t x,uint16_t y,char num,char size,char mode)
|
| 415 |
+
{
|
| 416 |
+
char temp,t1,t;
|
| 417 |
+
uint16_t y0=y;
|
| 418 |
+
uint16_t colortemp=POINT_COLOR;
|
| 419 |
+
num=num-' ';//???????
|
| 420 |
+
if(!mode) //?????
|
| 421 |
+
{
|
| 422 |
+
for(t=0;t<size;t++)
|
| 423 |
+
{
|
| 424 |
+
if(size==12)temp=asc2_1206[num][t]; //??1206??
|
| 425 |
+
else temp=asc2_1608[num][t]; //??1608??
|
| 426 |
+
for(t1=0;t1<8;t1++)
|
| 427 |
+
{
|
| 428 |
+
if(temp&0x80) POINT_COLOR=colortemp;
|
| 429 |
+
else POINT_COLOR=BACK_COLOR;
|
| 430 |
+
LCD_DrawPoint(x,y);
|
| 431 |
+
temp<<=1;
|
| 432 |
+
y++;
|
| 433 |
+
if(y>=320) { POINT_COLOR=colortemp; return; } //
|
| 434 |
+
if((y-y0)==size)
|
| 435 |
+
{
|
| 436 |
+
y=y0;
|
| 437 |
+
x++;
|
| 438 |
+
if(x>=240) {POINT_COLOR=colortemp; return;} //
|
| 439 |
+
break;
|
| 440 |
+
}
|
| 441 |
+
}
|
| 442 |
+
}
|
| 443 |
+
}else
|
| 444 |
+
{
|
| 445 |
+
for(t=0;t<size;t++)
|
| 446 |
+
{
|
| 447 |
+
if(size==12)temp=asc2_1206[num][t]; //1206
|
| 448 |
+
else temp=asc2_1608[num][t]; //1608
|
| 449 |
+
for(t1=0;t1<8;t1++)
|
| 450 |
+
{
|
| 451 |
+
if(temp&0x80)LCD_DrawPoint(x,y);
|
| 452 |
+
temp<<=1;
|
| 453 |
+
y++;
|
| 454 |
+
if(y>=320){POINT_COLOR=colortemp;return;}//
|
| 455 |
+
if((y-y0)==size)
|
| 456 |
+
{
|
| 457 |
+
y=y0;
|
| 458 |
+
x++;
|
| 459 |
+
if(x>=240){POINT_COLOR=colortemp;return;}//
|
| 460 |
+
break;
|
| 461 |
+
}
|
| 462 |
+
}
|
| 463 |
+
}
|
| 464 |
+
}
|
| 465 |
+
POINT_COLOR=colortemp;
|
| 466 |
+
}
|
| 467 |
+
uint32_t LCD_Pow(char m,char n)
|
| 468 |
+
{
|
| 469 |
+
uint32_t result=1;
|
| 470 |
+
while(n--)result*=m;
|
| 471 |
+
return result;
|
| 472 |
+
}
|
| 473 |
+
void LCD_ShowNum(uint16_t x,uint16_t y,uint32_t num,char len,char size)
|
| 474 |
+
{
|
| 475 |
+
char t,temp;
|
| 476 |
+
char enshow=0;
|
| 477 |
+
for(t=0;t<len;t++)
|
| 478 |
+
{
|
| 479 |
+
temp=(num/LCD_Pow(10,len-t-1))%10;
|
| 480 |
+
if(enshow==0&&t<(len-1))
|
| 481 |
+
{
|
| 482 |
+
if(temp==0)
|
| 483 |
+
{
|
| 484 |
+
LCD_ShowChar(x+(size/2)*t,y,' ',size,0);
|
| 485 |
+
continue;
|
| 486 |
+
}else enshow=1;
|
| 487 |
+
|
| 488 |
+
}
|
| 489 |
+
LCD_ShowChar(x+(size/2)*t,y,temp+'0',size,0);
|
| 490 |
+
}
|
| 491 |
+
}
|
| 492 |
+
void LCD_ShowString(uint16_t x,uint16_t y,uint16_t width,uint16_t height,char size,char *p)
|
| 493 |
+
{
|
| 494 |
+
char x0=x;
|
| 495 |
+
width+=x;
|
| 496 |
+
height+=y;
|
| 497 |
+
while((*p<='~')&&(*p>=' '))
|
| 498 |
+
{
|
| 499 |
+
if(x>=width){x=x0;y+=size;}
|
| 500 |
+
if(y>=height)break;
|
| 501 |
+
LCD_ShowChar(x,y,*p,size,1);
|
| 502 |
+
x+=size/2;
|
| 503 |
+
p++;
|
| 504 |
+
}
|
| 505 |
+
}
|
| 506 |
+
void LCD_SetCursor(uint16_t Xpos, uint16_t Ypos)
|
| 507 |
+
{
|
| 508 |
+
LCD_WR_REG(0X2A);
|
| 509 |
+
LCD_WR_DATA8(Xpos>>8);
|
| 510 |
+
LCD_WR_DATA8(Xpos&0XFF);
|
| 511 |
+
LCD_WR_REG(0X2B);
|
| 512 |
+
LCD_WR_DATA8(Ypos>>8);
|
| 513 |
+
LCD_WR_DATA8(Ypos&0XFF);
|
| 514 |
+
}
|
| 515 |
+
|
| 516 |
+
void LCD_WriteRAM_Prepare(void)
|
| 517 |
+
{
|
| 518 |
+
LCD_WR_REG(0X2C);
|
| 519 |
+
}
|
| 520 |
+
void showhanzi16(unsigned int x,unsigned int y,unsigned char index)
|
| 521 |
+
{
|
| 522 |
+
unsigned char i,j,k;
|
| 523 |
+
const unsigned char *temp=hanzi16;
|
| 524 |
+
temp+=index*32;
|
| 525 |
+
for(j=0;j<16;j++)
|
| 526 |
+
{
|
| 527 |
+
LCD_SetCursor(x,y+j);
|
| 528 |
+
LCD_WriteRAM_Prepare();
|
| 529 |
+
for(k=0;k<2;k++)
|
| 530 |
+
{
|
| 531 |
+
for(i=0;i<8;i++)
|
| 532 |
+
{
|
| 533 |
+
if((*temp&(1<<i))!=0)
|
| 534 |
+
{
|
| 535 |
+
LCD_WR_DATA(POINT_COLOR);
|
| 536 |
+
}
|
| 537 |
+
else
|
| 538 |
+
{
|
| 539 |
+
LCD_WR_DATA(BACK_COLOR);
|
| 540 |
+
}
|
| 541 |
+
}
|
| 542 |
+
temp++;
|
| 543 |
+
}
|
| 544 |
+
}
|
| 545 |
+
}
|
| 546 |
+
void showhanzi32(unsigned int x,unsigned int y,unsigned char index)
|
| 547 |
+
{
|
| 548 |
+
unsigned char i,j,k;
|
| 549 |
+
const unsigned char *temp=hanzi32;
|
| 550 |
+
temp+=index*128;
|
| 551 |
+
for(j=0;j<32;j++)
|
| 552 |
+
{
|
| 553 |
+
LCD_SetCursor(x,y+j);
|
| 554 |
+
LCD_WriteRAM_Prepare(); //GRAM
|
| 555 |
+
for(k=0;k<4;k++)
|
| 556 |
+
{
|
| 557 |
+
for(i=0;i<8;i++)
|
| 558 |
+
{
|
| 559 |
+
if((*temp&(1<<i))!=0)
|
| 560 |
+
{
|
| 561 |
+
LCD_WR_DATA(POINT_COLOR);
|
| 562 |
+
}
|
| 563 |
+
else
|
| 564 |
+
{
|
| 565 |
+
LCD_WR_DATA(BACK_COLOR);
|
| 566 |
+
}
|
| 567 |
+
}
|
| 568 |
+
temp++;
|
| 569 |
+
}
|
| 570 |
+
}
|
| 571 |
+
}
|
| 572 |
+
void xianshi() //������ʾ
|
| 573 |
+
{
|
| 574 |
+
LCD_Clear(RED); //WHITE
|
| 575 |
+
BACK_COLOR=RED;
|
| 576 |
+
POINT_COLOR=WHITE;
|
| 577 |
+
//32*32
|
| 578 |
+
showhanzi32(20,10,0); //��
|
| 579 |
+
showhanzi32(60,10,1); //��
|
| 580 |
+
showhanzi32(100,10,2); //��
|
| 581 |
+
showhanzi32(140,10,3); //��
|
| 582 |
+
showhanzi32(180,10,4); //��
|
| 583 |
+
//16*16
|
| 584 |
+
|
| 585 |
+
showhanzi16(20,80,18); //��
|
| 586 |
+
showhanzi16(40,80,19); //��
|
| 587 |
+
|
| 588 |
+
showhanzi16(20,120,2); //��
|
| 589 |
+
showhanzi16(40,120,3); //��
|
| 590 |
+
showhanzi16(60,120,15); //��
|
| 591 |
+
showhanzi16(80,120,16); //ֵ
|
| 592 |
+
|
| 593 |
+
showhanzi16(20,140,0); //��
|
| 594 |
+
showhanzi16(40,140,1); //��
|
| 595 |
+
showhanzi16(60,140,15); //��
|
| 596 |
+
showhanzi16(80,140,16); //ֵ
|
| 597 |
+
|
| 598 |
+
showhanzi16(20,160,11); //��
|
| 599 |
+
showhanzi16(40,160,12); //��
|
| 600 |
+
showhanzi16(60,160,0); //��
|
| 601 |
+
showhanzi16(80,160,17); //��
|
| 602 |
+
showhanzi16(100,160,4); //ʱ
|
| 603 |
+
showhanzi16(120,160,5); //��
|
| 604 |
+
|
| 605 |
+
LCD_ShowString(60,80,160,16,16,": jinglxixi ");
|
| 606 |
+
LCD_ShowString(140,120,40,16,16,": S");
|
| 607 |
+
LCD_ShowString(140,140,20,16,16,": B");
|
| 608 |
+
LCD_ShowString(140,160,20,16,16,": Q");
|
| 609 |
+
LCD_ShowString(20,240,200,16,16,"2.2 SPI TFT 240*320");
|
| 610 |
+
LCD_ShowString(20,260,200,16,16," 2016.8.26 ");
|
| 611 |
+
}
|
| 612 |
+
|
| 613 |
+
|
| 614 |
+
// ADC1:PA0 USART2: 115200 bps USART2_TX:PA2 USART2_RX:PA3
|
| 615 |
+
|
| 616 |
+
int main(void)
|
| 617 |
+
{
|
| 618 |
+
unsigned char m=0;
|
| 619 |
+
unsigned int b=300;
|
| 620 |
+
HAL_Init();
|
| 621 |
+
/* Configure the system clock */
|
| 622 |
+
SystemClock_Config();
|
| 623 |
+
/* Initialize all configured peripherals */
|
| 624 |
+
MX_GPIO_Init();
|
| 625 |
+
MX_ADC1_Init();
|
| 626 |
+
MX_TIM3_Init();
|
| 627 |
+
MX_USART2_UART_Init();
|
| 628 |
+
GPIO_Configuration();
|
| 629 |
+
Lcd_Init(); //tft
|
| 630 |
+
xianshi();
|
| 631 |
+
delay_ms(1000);
|
| 632 |
+
|
| 633 |
+
LCD_Clear(WHITE);
|
| 634 |
+
BACK_COLOR=WHITE;
|
| 635 |
+
POINT_COLOR=RED; // BLACK YELLOW ;
|
| 636 |
+
|
| 637 |
+
showhanzi16(20,0,2); //��
|
| 638 |
+
showhanzi16(40,0,3); //��
|
| 639 |
+
showhanzi16(60,0,6); //��
|
| 640 |
+
showhanzi16(80,0,7); //��
|
| 641 |
+
|
| 642 |
+
POINT_COLOR=RED;
|
| 643 |
+
LCD_ShowString(0,302,200,16,16,"Design : jinglxixi ");
|
| 644 |
+
LCD_DrawLine(0, 300, 239, 300);
|
| 645 |
+
|
| 646 |
+
HAL_TIM_Base_Start_IT(&htim3);
|
| 647 |
+
|
| 648 |
+
BACK_COLOR=WHITE;
|
| 649 |
+
POINT_COLOR=RED; //BLUE;
|
| 650 |
+
while (1)
|
| 651 |
+
{
|
| 652 |
+
sendDataToProcessing('S', Signal); // send Processing the raw Pulse Sensor data
|
| 653 |
+
LCD_ShowString(140,240,80,16,16,"S :");
|
| 654 |
+
LCD_ShowNum(180,240,Signal,3,16);
|
| 655 |
+
if (Signal>=750) Signal=750;
|
| 656 |
+
LCD_DrawLine(m*4, 300-b*2/5, (m+1)*4, 300-Signal*2/5);
|
| 657 |
+
b=Signal;
|
| 658 |
+
m++;
|
| 659 |
+
if (m>=60)
|
| 660 |
+
{
|
| 661 |
+
m=0;
|
| 662 |
+
LCD_Clear(WHITE);
|
| 663 |
+
showhanzi16(20,0,2); //��
|
| 664 |
+
showhanzi16(40,0,3); //��
|
| 665 |
+
showhanzi16(60,0,6); //��
|
| 666 |
+
showhanzi16(80,0,7); //��
|
| 667 |
+
LCD_DrawLine(0, 300, 239, 300);
|
| 668 |
+
LCD_ShowString(0,302,200,16,16,"Design : jinglxixi ");
|
| 669 |
+
}
|
| 670 |
+
|
| 671 |
+
if (QS == true)
|
| 672 |
+
{
|
| 673 |
+
LCD_ShowString(140,260,200,16,16,"BPM:");
|
| 674 |
+
LCD_ShowString(140,280,200,16,16,"HRV:");
|
| 675 |
+
LCD_ShowNum(180,260,BPM,3,16);
|
| 676 |
+
LCD_ShowNum(180,280,IBI,3,16);
|
| 677 |
+
sendDataToProcessing('B',BPM); // send heart rate with a 'B' prefix
|
| 678 |
+
sendDataToProcessing('Q',IBI); // send time between beats with a 'Q' prefix
|
| 679 |
+
QS = false; // reset the Quantified Self flag for next time
|
| 680 |
+
}
|
| 681 |
+
HAL_Delay(20); //delay for 20ms
|
| 682 |
+
}
|
| 683 |
+
|
| 684 |
+
}
|
| 685 |
+
|
| 686 |
+
/** System Clock Configuration
|
| 687 |
+
*/
|
| 688 |
+
void SystemClock_Config(void)
|
| 689 |
+
{
|
| 690 |
+
|
| 691 |
+
RCC_OscInitTypeDef RCC_OscInitStruct;
|
| 692 |
+
|
| 693 |
+
__PWR_CLK_ENABLE();
|
| 694 |
+
|
| 695 |
+
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2);
|
| 696 |
+
|
| 697 |
+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
| 698 |
+
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
| 699 |
+
RCC_OscInitStruct.HSICalibrationValue = 16;
|
| 700 |
+
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
|
| 701 |
+
HAL_RCC_OscConfig(&RCC_OscInitStruct);
|
| 702 |
+
|
| 703 |
+
}
|
| 704 |
+
|
| 705 |
+
/* ADC1 init function */
|
| 706 |
+
void MX_ADC1_Init(void)
|
| 707 |
+
{
|
| 708 |
+
|
| 709 |
+
ADC_ChannelConfTypeDef sConfig;
|
| 710 |
+
|
| 711 |
+
/**Configure the global features of the ADC (Clock, Resolution, Data Alignment and number of conversion)
|
| 712 |
+
*/
|
| 713 |
+
hadc1.Instance = ADC1;
|
| 714 |
+
hadc1.Init.ClockPrescaler = ADC_CLOCKPRESCALER_PCLK_DIV2;
|
| 715 |
+
hadc1.Init.Resolution = ADC_RESOLUTION10b;
|
| 716 |
+
hadc1.Init.ScanConvMode = DISABLE;
|
| 717 |
+
hadc1.Init.ContinuousConvMode = DISABLE;
|
| 718 |
+
hadc1.Init.DiscontinuousConvMode = DISABLE;
|
| 719 |
+
hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
|
| 720 |
+
hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;
|
| 721 |
+
hadc1.Init.NbrOfConversion = 1;
|
| 722 |
+
hadc1.Init.DMAContinuousRequests = DISABLE;
|
| 723 |
+
hadc1.Init.EOCSelection = EOC_SINGLE_CONV;
|
| 724 |
+
HAL_ADC_Init(&hadc1);
|
| 725 |
+
|
| 726 |
+
/**Configure for the selected ADC regular channel its corresponding rank in the sequencer and its sample time.
|
| 727 |
+
*/
|
| 728 |
+
sConfig.Channel = ADC_CHANNEL_0;
|
| 729 |
+
sConfig.Rank = 1;
|
| 730 |
+
sConfig.SamplingTime = ADC_SAMPLETIME_15CYCLES;
|
| 731 |
+
HAL_ADC_ConfigChannel(&hadc1, &sConfig);
|
| 732 |
+
|
| 733 |
+
}
|
| 734 |
+
|
| 735 |
+
/* TIM3 init function */
|
| 736 |
+
void MX_TIM3_Init(void)
|
| 737 |
+
{
|
| 738 |
+
|
| 739 |
+
TIM_ClockConfigTypeDef sClockSourceConfig;
|
| 740 |
+
TIM_MasterConfigTypeDef sMasterConfig;
|
| 741 |
+
|
| 742 |
+
htim3.Instance = TIM3;
|
| 743 |
+
htim3.Init.Prescaler = 15;
|
| 744 |
+
htim3.Init.CounterMode = TIM_COUNTERMODE_UP;
|
| 745 |
+
htim3.Init.Period = 1999;
|
| 746 |
+
htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
| 747 |
+
HAL_TIM_Base_Init(&htim3);
|
| 748 |
+
|
| 749 |
+
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
|
| 750 |
+
HAL_TIM_ConfigClockSource(&htim3, &sClockSourceConfig);
|
| 751 |
+
|
| 752 |
+
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
|
| 753 |
+
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
|
| 754 |
+
HAL_TIMEx_MasterConfigSynchronization(&htim3, &sMasterConfig);
|
| 755 |
+
|
| 756 |
+
}
|
| 757 |
+
|
| 758 |
+
/* USART2 init function */
|
| 759 |
+
void MX_USART2_UART_Init(void)
|
| 760 |
+
{
|
| 761 |
+
|
| 762 |
+
huart2.Instance = USART2;
|
| 763 |
+
huart2.Init.BaudRate = 115200;
|
| 764 |
+
huart2.Init.WordLength = UART_WORDLENGTH_8B;
|
| 765 |
+
huart2.Init.StopBits = UART_STOPBITS_1;
|
| 766 |
+
huart2.Init.Parity = UART_PARITY_NONE;
|
| 767 |
+
huart2.Init.Mode = UART_MODE_TX_RX;
|
| 768 |
+
huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
| 769 |
+
huart2.Init.OverSampling = UART_OVERSAMPLING_16;
|
| 770 |
+
HAL_UART_Init(&huart2);
|
| 771 |
+
|
| 772 |
+
}
|
| 773 |
+
|
| 774 |
+
/** Configure pins as
|
| 775 |
+
* Analog
|
| 776 |
+
* Input
|
| 777 |
+
* Output
|
| 778 |
+
* EVENT_OUT
|
| 779 |
+
* EXTI
|
| 780 |
+
*/
|
| 781 |
+
void MX_GPIO_Init(void)
|
| 782 |
+
{
|
| 783 |
+
|
| 784 |
+
GPIO_InitTypeDef GPIO_InitStruct;
|
| 785 |
+
|
| 786 |
+
/* GPIO Ports Clock Enable */
|
| 787 |
+
__GPIOC_CLK_ENABLE();
|
| 788 |
+
__GPIOH_CLK_ENABLE();
|
| 789 |
+
__GPIOA_CLK_ENABLE();
|
| 790 |
+
__GPIOB_CLK_ENABLE();
|
| 791 |
+
|
| 792 |
+
/*Configure GPIO pin : PC13 */
|
| 793 |
+
GPIO_InitStruct.Pin = GPIO_PIN_13;
|
| 794 |
+
GPIO_InitStruct.Mode = GPIO_MODE_EVT_RISING;
|
| 795 |
+
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
| 796 |
+
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
| 797 |
+
|
| 798 |
+
/*Configure GPIO pin : PA5 */
|
| 799 |
+
GPIO_InitStruct.Pin = GPIO_PIN_5;
|
| 800 |
+
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
| 801 |
+
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
| 802 |
+
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
|
| 803 |
+
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
| 804 |
+
|
| 805 |
+
}
|
| 806 |
+
|
| 807 |
+
/* USER CODE BEGIN 4 */
|
| 808 |
+
/**
|
| 809 |
+
* @brief Retargets the C library printf function to the USART.
|
| 810 |
+
* @param None
|
| 811 |
+
* @retval None
|
| 812 |
+
*/
|
| 813 |
+
PUTCHAR_PROTOTYPE
|
| 814 |
+
{
|
| 815 |
+
/* Place your implementation of fputc here */
|
| 816 |
+
/* e.g. write a character to the EVAL_COM1 and Loop until the end of transmission */
|
| 817 |
+
HAL_UART_Transmit(&huart2, (uint8_t *)&ch, 1, 0xFFFF);
|
| 818 |
+
|
| 819 |
+
return ch;
|
| 820 |
+
}
|
| 821 |
+
|
| 822 |
+
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
|
| 823 |
+
{
|
| 824 |
+
unsigned int runningTotal;
|
| 825 |
+
if(htim->Instance==htim3.Instance)
|
| 826 |
+
{
|
| 827 |
+
Signal=HAL_ADC_GetValue(&hadc1); // read the Pulse Senso
|
| 828 |
+
sampleCounter += 2; // keep track of the time in mS with this variable
|
| 829 |
+
Num = sampleCounter - lastBeatTime; // monitor the time since the last beat to avoid noise
|
| 830 |
+
HAL_ADC_Start(&hadc1); //restart ADC conversion
|
| 831 |
+
|
| 832 |
+
// find the peak and trough of the pulse wave
|
| 833 |
+
if(Signal < thresh && Num > (IBI/5)*3){ // avoid dichrotic noise by waiting 3/5 of last IBI
|
| 834 |
+
if (Signal < T){ // T is the trough
|
| 835 |
+
T = Signal; // keep track of lowest point in pulse wave
|
| 836 |
+
}
|
| 837 |
+
}
|
| 838 |
+
|
| 839 |
+
if(Signal > thresh && Signal > P){ // thresh condition helps avoid noise
|
| 840 |
+
P = Signal; // P is the peak
|
| 841 |
+
} // keep track of highest point in pulse wave
|
| 842 |
+
|
| 843 |
+
// NOW IT'S TIME TO LOOK FOR THE HEART BEAT
|
| 844 |
+
// signal surges up in value every time there is a pulse
|
| 845 |
+
if (Num > 250){ // avoid high frequency noise
|
| 846 |
+
if ( (Signal > thresh) && (Pulse == false) && (Num > (IBI/5)*3) ){
|
| 847 |
+
Pulse = true; // set the Pulse flag when we think there is a pulse
|
| 848 |
+
HAL_GPIO_WritePin(GPIOA,GPIO_PIN_5,GPIO_PIN_SET); // turn on pin 13 LED
|
| 849 |
+
IBI = sampleCounter - lastBeatTime; // measure time between beats in mS
|
| 850 |
+
lastBeatTime = sampleCounter; // keep track of time for next pulse
|
| 851 |
+
|
| 852 |
+
if(secondBeat){ // if this is the second beat, if secondBeat == TRUE
|
| 853 |
+
secondBeat = false; // clear secondBeat flag
|
| 854 |
+
for(int i=0; i<=9; i++){ // seed the running total to get a realisitic BPM at startup
|
| 855 |
+
rate[i] = IBI;
|
| 856 |
+
}
|
| 857 |
+
}
|
| 858 |
+
|
| 859 |
+
if(firstBeat){ // if it's the first time we found a beat, if firstBeat == TRUE
|
| 860 |
+
firstBeat = false; // clear firstBeat flag
|
| 861 |
+
secondBeat = true; // set the second beat flag
|
| 862 |
+
return; // IBI value is unreliable so discard it
|
| 863 |
+
}
|
| 864 |
+
|
| 865 |
+
|
| 866 |
+
// keep a running total of the last 10 IBI values
|
| 867 |
+
runningTotal = 0; // clear the runningTotal variable
|
| 868 |
+
|
| 869 |
+
for(int i=0; i<=8; i++){ // shift data in the rate array
|
| 870 |
+
rate[i] = rate[i+1]; // and drop the oldest IBI value
|
| 871 |
+
runningTotal += rate[i]; // add up the 9 oldest IBI values
|
| 872 |
+
}
|
| 873 |
+
|
| 874 |
+
rate[9] = IBI; // add the latest IBI to the rate array
|
| 875 |
+
runningTotal += rate[9]; // add the latest IBI to runningTotal
|
| 876 |
+
runningTotal /= 10; // average the last 10 IBI values
|
| 877 |
+
BPM = 60000/runningTotal; // how many beats can fit into a minute? that's BPM!
|
| 878 |
+
QS = true; // set Quantified Self flag
|
| 879 |
+
// QS FLAG IS NOT CLEARED INSIDE THIS ISR
|
| 880 |
+
}
|
| 881 |
+
}
|
| 882 |
+
|
| 883 |
+
if (Signal < thresh && Pulse == true){ // when the values are going down, the beat is over
|
| 884 |
+
HAL_GPIO_WritePin(GPIOA,GPIO_PIN_5,GPIO_PIN_RESET); // turn off pin 13 LED
|
| 885 |
+
Pulse = false; // reset the Pulse flag so we can do it again
|
| 886 |
+
amp = P - T; // get amplitude of the pulse wave
|
| 887 |
+
thresh = amp/2 + T; // set thresh at 50% of the amplitude
|
| 888 |
+
P = thresh; // reset these for next time
|
| 889 |
+
T = thresh;
|
| 890 |
+
}
|
| 891 |
+
|
| 892 |
+
if (Num > 2500){ // if 2.5 seconds go by without a beat
|
| 893 |
+
thresh = 512; // set thresh default
|
| 894 |
+
P = 512; // set P default
|
| 895 |
+
T = 512; // set T default
|
| 896 |
+
lastBeatTime = sampleCounter; // bring the lastBeatTime up to date
|
| 897 |
+
firstBeat = true; // set these to avoid noise
|
| 898 |
+
secondBeat = false; // when we get the heartbeat back
|
| 899 |
+
}
|
| 900 |
+
|
| 901 |
+
}
|
| 902 |
+
}
|
| 903 |
+
|
| 904 |
+
void sendDataToProcessing(char symbol, int dat )
|
| 905 |
+
{
|
| 906 |
+
putchar(symbol); // symbol prefix tells Processing what type of data is coming
|
| 907 |
+
printf("%d\r\n",dat); // the data to send culminating in a carriage return
|
| 908 |
+
}
|
| 909 |
+
/* USER CODE END 4 */
|
| 910 |
+
|
| 911 |
+
#ifdef USE_FULL_ASSERT
|
| 912 |
+
|
| 913 |
+
/**
|
| 914 |
+
* @brief Reports the name of the source file and the source line number
|
| 915 |
+
* where the assert_param error has occurred.
|
| 916 |
+
* @param file: pointer to the source file name
|
| 917 |
+
* @param line: assert_param error line source number
|
| 918 |
+
* @retval None
|
| 919 |
+
*/
|
| 920 |
+
void assert_failed(uint8_t* file, uint32_t line)
|
| 921 |
+
{
|
| 922 |
+
/* USER CODE BEGIN 6 */
|
| 923 |
+
/* User can add his own implementation to report the file name and line number,
|
| 924 |
+
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
|
| 925 |
+
/* USER CODE END 6 */
|
| 926 |
+
|
| 927 |
+
}
|
| 928 |
+
|
| 929 |
+
#endif
|
| 930 |
+
|
| 931 |
+
/**
|
| 932 |
+
* @}
|
| 933 |
+
*/
|
| 934 |
+
|
| 935 |
+
/**
|
| 936 |
+
* @}
|
| 937 |
+
*/
|
| 938 |
+
|
| 939 |
+
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
Engineering/project6/具波形显示功能的数据采集系统.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0292d06356be6177571373e1f9b6cd6e66b85869dc3515f0afe5888c1f36a1fd
|
| 3 |
+
size 2570656
|
Engineering/project6/具波形显示功能的数据采集系统PCB反面.jpg
ADDED
|
Git LFS Details
|
Engineering/project6/具波形显示功能的数据采集系统PCB正面.jpg
ADDED
|
Git LFS Details
|
Engineering/project6/具波形显示功能的数据采集系统pcb图.jpg
ADDED
|
Git LFS Details
|
Engineering/project6/具波形显示功能的数据采集系统sch图.jpg
ADDED
|
Git LFS Details
|
Engineering/project6/具波形显示功能的数据采集系统效果图.jpg
ADDED
|
Git LFS Details
|
Engineering/project7/1.png
ADDED
|
Git LFS Details
|