{"id":76932,"date":"2026-02-23T15:58:53","date_gmt":"2026-02-23T07:58:53","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/76932.html"},"modified":"2026-02-23T15:58:53","modified_gmt":"2026-02-23T07:58:53","slug":"ct117e-m4%e6%8c%89%e9%94%ae%e7%a1%ac%e4%bb%b6%e5%8e%9f%e7%90%86%e4%b8%8e%e6%b6%88%e6%8a%96%e9%a9%b1%e5%8a%a8%e8%ae%be%e8%ae%a1","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/76932.html","title":{"rendered":"CT117E-M4\u6309\u952e\u786c\u4ef6\u539f\u7406\u4e0e\u6d88\u6296\u9a71\u52a8\u8bbe\u8ba1"},"content":{"rendered":"<h3>\n 1. CT117E-M4\u5f00\u53d1\u677f\u6309\u952e\u786c\u4ef6\u67b6\u6784\u89e3\u6790<br \/>\n<\/h3>\n<p>\n CT117E-M4\u662f\u84dd\u6865\u676f\u5d4c\u5165\u5f0f\u7ec4\u7701\u8d5b\u6307\u5b9a\u7ade\u8d5b\u5e73\u53f0&#xff0c;\u5176\u6309\u952e\u7535\u8def\u8bbe\u8ba1\u4f53\u73b0\u4e86\u5178\u578b\u5de5\u4e1a\u7ea7\u4eba\u673a\u4ea4\u4e92\u63a5\u53e3\u7684\u5de5\u7a0b\u53d6\u820d\u3002\u8be5\u677f\u5361\u5de6\u4fa7\u5e03\u5c405\u4e2a\u7269\u7406\u6309\u952e&#xff0c;\u4f46\u529f\u80fd\u5b9a\u4f4d\u5b58\u5728\u672c\u8d28\u5dee\u5f02&#xff1a;\u5176\u4e2d4\u4e2a\u4e3a\u7528\u6237\u53ef\u7f16\u7a0b\u8f93\u5165\u6309\u952e&#xff08;B1\u2013B4&#xff09;&#xff0c;1\u4e2a\u4e3a\u7cfb\u7edf\u590d\u4f4d\u4e13\u7528\u6309\u952e&#xff08;RESET&#xff09;\u3002\u8fd9\u79cd\u5206\u79bb\u5f0f\u8bbe\u8ba1\u5e76\u975e\u5197\u4f59&#xff0c;\u800c\u662f\u9075\u5faa\u5d4c\u5165\u5f0f\u7cfb\u7edf\u53ef\u9760\u6027\u8bbe\u8ba1\u539f\u5219\u2014\u2014\u5c06\u5173\u952e\u7cfb\u7edf\u63a7\u5236&#xff08;\u590d\u4f4d&#xff09;\u4e0e\u5e94\u7528\u903b\u8f91\u8f93\u5165&#xff08;\u529f\u80fd\u952e&#xff09;\u5728\u7535\u6c14\u548c\u8f6f\u4ef6\u5c42\u9762\u5b8c\u5168\u9694\u79bb&#xff0c;\u907f\u514d\u8bef\u64cd\u4f5c\u5f15\u53d1\u4e0d\u53ef\u63a7\u72b6\u6001\u3002\n<\/p>\n<h4>\n 1.1 \u590d\u4f4d\u6309\u952e\u7684\u786c\u4ef6\u5b9e\u73b0\u673a\u5236<br \/>\n<\/h4>\n<p>\n \u590d\u4f4d\u6309\u952e\u76f4\u63a5\u8fde\u63a5\u81f3MCU\u7684PG10\u5f15\u811a&#xff0c;\u4f46\u5176\u7535\u6c14\u8fde\u63a5\u65b9\u5f0f\u5177\u6709\u660e\u786e\u7684\u7cfb\u7edf\u7ea7\u610f\u4e49\u3002\u901a\u8fc7\u77ed\u8def\u5e3d&#xff08;Jumper&#xff09;\u5c06PG10\u4e0e\u590d\u4f4d\u4fe1\u53f7\u94fe\u8def&#xff08;\u6807\u6ce8\u4e3a\u201cT\u201d\u70b9&#xff09;\u7269\u7406\u8fde\u901a&#xff0c;\u8be5\u8bbe\u8ba1\u5b9e\u73b0\u4e86\u786c\u4ef6\u590d\u4f4d\u8def\u5f84\u7684\u53ef\u914d\u7f6e\u6027\u3002\u5f53\u77ed\u8def\u5e3d\u95ed\u5408\u65f6&#xff0c;\u6309\u4e0b\u6309\u952e\u5373\u89e6\u53d1MCU\u786c\u4ef6\u590d\u4f4d&#xff1b;\u5f53\u77ed\u8def\u5e3d\u65ad\u5f00\u65f6&#xff0c;PG10\u6062\u590d\u4e3a\u666e\u901aGPIO\u529f\u80fd\u3002\u8fd9\u79cd\u8bbe\u8ba1\u5141\u8bb8\u5f00\u53d1\u8005\u5728\u8c03\u8bd5\u9636\u6bb5\u4e34\u65f6\u7981\u7528\u786c\u4ef6\u590d\u4f4d&#xff0c;\u9632\u6b62\u56e0\u8bef\u89e6\u5bfc\u81f4\u7a0b\u5e8f\u4e2d\u65ad&#xff0c;\u540c\u65f6\u4fdd\u7559\u751f\u4ea7\u73af\u5883\u4e0b\u7684\u5f3a\u5236\u590d\u4f4d\u80fd\u529b\u3002\u503c\u5f97\u6ce8\u610f\u7684\u662f&#xff0c;PG10\u5728STM32F103RCT6\u82af\u7247\u4e2d\u5c5e\u4e8eGPIOG\u7aef\u53e3\u7b2c10\u53f7\u5f15\u811a&#xff0c;\u5176\u590d\u4f4d\u529f\u80fd\u7531\u82af\u7247\u5185\u90e8BOOT\u5f15\u811a\u914d\u7f6e\u673a\u5236\u51b3\u5b9a&#xff0c;\u800c\u975e\u901a\u7528IO\u529f\u80fd\u3002\n<\/p>\n<h4>\n 1.2 \u7528\u6237\u6309\u952e\u7684\u7535\u6c14\u62d3\u6251\u7ed3\u6784<br \/>\n<\/h4>\n<p>\n B1\u2013B4\u56db\u4e2a\u7528\u6237\u6309\u952e\u91c7\u7528\u7edf\u4e00\u7684\u56db\u811a\u5c01\u88c5&#xff08;\u5982ALPS SKQG\u7cfb\u5217&#xff09;&#xff0c;\u4f46\u4ec5\u4f7f\u75281\u30014\u53f7\u5f15\u811a\u6784\u6210\u5355\u5200\u5355\u63b7\u5f00\u5173\u3002\u8fd9\u79cd\u9009\u578b\u89c4\u907f\u4e86\u53cc\u5200\u53cc\u63b7\u5f00\u5173\u7684\u6210\u672c\u4e0e\u4f53\u79ef&#xff0c;\u540c\u65f6\u6ee1\u8db3\u57fa\u672c\u8f93\u5165\u9700\u6c42\u3002\u5173\u952e\u5728\u4e8e\u5176\u8fde\u63a5\u62d3\u6251&#xff1a;\u6bcf\u4e2a\u6309\u952e\u4e00\u7aef\u60ac\u7a7a&#xff0c;\u53e6\u4e00\u7aef\u8fde\u63a5\u5bf9\u5e94GPIO\u5f15\u811a&#xff08;B1\u2192PB1, B2\u2192PB2, B3\u2192PB3, B4\u2192PB4&#xff09;&#xff0c;\u5e76\u5728GPIO\u5f15\u811a\u4e0eVDD\u4e4b\u95f4\u5916\u7f6e10k\u03a9\u4e0a\u62c9\u7535\u963b&#xff08;\u539f\u7406\u56fe\u4e2d\u6807\u6ce8\u4e3aRxx&#xff09;\u3002\u8be5\u8bbe\u8ba1\u5f62\u6210\u5178\u578b\u7684\u201c\u9ad8\u7535\u5e73\u6709\u6548\u201d\u8f93\u5165\u7ed3\u6784&#xff0c;\u5176\u7535\u6c14\u7279\u6027\u9700\u4ece\u4e24\u4e2a\u7a33\u6001\u8fdb\u884c\u5206\u6790&#xff1a;\n<\/p>\n<ul>\n<li>\n<p>   \u91ca\u653e\u6001&#xff08;Key Released&#xff09;<\/p>\n<p>  &#xff1a;\u6309\u952e\u65ad\u5f00&#xff0c;GPIO\u5f15\u811a\u901a\u8fc7\u4e0a\u62c9\u7535\u963b\u4e0eVDD&#xff08;3.3V&#xff09;\u5efa\u7acb\u76f4\u6d41\u901a\u8def\u3002\u6b64\u65f6\u5f15\u811a\u7535\u538b\u88ab\u94b3\u4f4d\u5728VDD\u7535\u5e73&#xff0c;\u7ecfMCU\u8f93\u5165\u7f13\u51b2\u5668\u8bc6\u522b\u4e3a\u903b\u8f91\u9ad8\u7535\u5e73&#xff08;1&#xff09;\u3002\u8be5\u72b6\u6001\u5bf9\u5e94\u6309\u952e\u672a\u89e6\u53d1\u7684\u9ed8\u8ba4\u503c\u3002\n <\/li>\n<li>\n<p>   \u6309\u4e0b\u6001&#xff08;Key Pressed&#xff09;<\/p>\n<p>  &#xff1a;\u6309\u952e\u95ed\u5408&#xff0c;GPIO\u5f15\u811a\u901a\u8fc7\u6309\u952e\u5185\u90e8\u89e6\u70b9\u4e0eGND\u5f62\u6210\u4f4e\u963b\u6297\u901a\u8def\u3002\u6b64\u65f6\u5f15\u811a\u7535\u538b\u88ab\u5f3a\u5236\u62c9\u4f4e\u81f3GND\u7535\u5e73&#xff08;0V&#xff09;&#xff0c;\u8f93\u5165\u7f13\u51b2\u5668\u8bc6\u522b\u4e3a\u903b\u8f91\u4f4e\u7535\u5e73&#xff08;0&#xff09;\u3002\u8be5\u72b6\u6001\u5bf9\u5e94\u6309\u952e\u89e6\u53d1\u7684\u6709\u6548\u4e8b\u4ef6\u3002\n <\/li>\n<\/ul>\n<p>\n \u8fd9\u79cd\u201c\u91ca\u653e\u9ad8\u3001\u6309\u4e0b\u4f4e\u201d\u7684\u7535\u5e73\u903b\u8f91&#xff0c;\u672c\u8d28\u4e0a\u662f\u5229\u7528\u5916\u90e8\u4e0a\u62c9\u7535\u963b\u6784\u5efa\u786e\u5b9a\u6027\u7535\u5e73\u57fa\u51c6&#xff0c;\u907f\u514d\u6d6e\u7a7a\u5f15\u811a\u53d7\u7535\u78c1\u5e72\u6270\u5bfc\u81f4\u7684\u968f\u673a\u7ffb\u8f6c\u3002\n<\/p>\n<h3>\n 2. GPIO\u8f93\u5165\u6a21\u5f0f\u914d\u7f6e\u7684\u5de5\u7a0b\u51b3\u7b56\u4f9d\u636e<br \/>\n<\/h3>\n<p>\n \u5728STM32 HAL\u5e93\u6846\u67b6\u4e0b&#xff0c;GPIO\u521d\u59cb\u5316\u9700\u660e\u786e\u6307\u5b9a<\/p>\n<p>  GPIO_MODE<\/p>\n<p> \u53c2\u6570\u3002\u9488\u5bf9B1\u2013B4\u6309\u952e\u7684\u786c\u4ef6\u62d3\u6251&#xff0c;<\/p>\n<p>  GPIO_MODE_INPUT<\/p>\n<p> &#xff08;\u6d6e\u7a7a\u8f93\u5165&#xff09;\u662f\u552f\u4e00\u7b26\u5408\u7535\u6c14\u7279\u6027\u7684\u914d\u7f6e\u9009\u9879\u3002\u6b64\u51b3\u7b56\u9700\u7ed3\u5408\u82af\u7247\u6570\u636e\u624b\u518c\u4e0e\u7535\u8def\u539f\u7406\u8fdb\u884c\u4e09\u91cd\u9a8c\u8bc1&#xff1a;\n<\/p>\n<h4>\n 2.1 \u6d6e\u7a7a\u8f93\u5165\u6a21\u5f0f\u7684\u9002\u914d\u6027\u9a8c\u8bc1<br \/>\n<\/h4>\n<p>\n \u6d6e\u7a7a\u8f93\u5165\u6a21\u5f0f&#xff08;Floating Input&#xff09;\u6307GPIO\u5f15\u811a\u5185\u90e8\u4e0a\u4e0b\u62c9\u7535\u963b\u5747\u5173\u95ed&#xff0c;\u5b8c\u5168\u4f9d\u8d56\u5916\u90e8\u7535\u8def\u63d0\u4f9b\u7535\u5e73\u57fa\u51c6\u3002\u5728\u672c\u8bbe\u8ba1\u4e2d&#xff0c;\u5916\u90e810k\u03a9\u4e0a\u62c9\u7535\u963b\u5df2\u4e3a\u5f15\u811a\u5efa\u7acb\u660e\u786e\u7684\u9ad8\u7535\u5e73\u53c2\u8003&#xff0c;\u800c\u6309\u952e\u95ed\u5408\u5219\u63d0\u4f9b\u53ef\u9760\u7684\u4f4e\u7535\u5e73\u901a\u8def\u3002\u82e5\u9519\u8bef\u914d\u7f6e\u4e3a<\/p>\n<p>  GPIO_MODE_INPUT_PULLUP<\/p>\n<p> &#xff0c;\u5c06\u5bfc\u81f4\u5185\u90e8\u4e0a\u62c9\u7535\u963b&#xff08;\u7ea640k\u03a9&#xff09;\u4e0e\u5916\u90e810k\u03a9\u4e0a\u62c9\u7535\u963b\u5e76\u8054&#xff0c;\u867d\u4e0d\u7834\u574f\u529f\u80fd\u4f46\u589e\u52a0\u4e0d\u5fc5\u8981\u7684\u529f\u8017&#xff08;\u7ea60.27mA\u989d\u5916\u7535\u6d41&#xff09;&#xff1b;\u82e5\u914d\u7f6e\u4e3a<\/p>\n<p>  GPIO_MODE_INPUT_PULLDOWN<\/p>\n<p> &#xff0c;\u5219\u5185\u90e8\u4e0b\u62c9\u7535\u963b&#xff08;\u7ea650k\u03a9&#xff09;\u4e0e\u5916\u90e8\u4e0a\u62c9\u7535\u963b\u5f62\u6210\u5206\u538b\u7f51\u7edc&#xff0c;\u4f7f\u91ca\u653e\u6001\u7535\u538b\u964d\u81f3\u7ea62.7V&#xff08;\u8ba1\u7b97&#xff1a;3.3V \u00d7 50k\/(10k&#043;50k)&#xff09;&#xff0c;\u867d\u4ecd\u9ad8\u4e8e\u903b\u8f91\u9ad8\u9608\u503c&#xff08;0.7\u00d7VDD&#061;2.31V&#xff09;&#xff0c;\u4f46\u566a\u58f0\u5bb9\u9650\u663e\u8457\u964d\u4f4e&#xff0c;\u6613\u53d7PCB\u8d70\u7ebf\u8026\u5408\u5e72\u6270\u5f71\u54cd\u3002\n<\/p>\n<h4>\n 2.2 \u65f6\u949f\u4f7f\u80fd\u4e0e\u7aef\u53e3\u6620\u5c04\u5173\u7cfb<br \/>\n<\/h4>\n<p>\n B1\u2013B4\u5206\u522b\u6620\u5c04\u81f3GPIOB\u7aef\u53e3\u7684Pin1\u2013Pin4\u3002\u6839\u636eSTM32F103x\u7684APB2\u603b\u7ebf\u67b6\u6784&#xff0c;GPIOB\u65f6\u949f\u9700\u901a\u8fc7RCC_APB2ENR\u5bc4\u5b58\u5668\u4f7f\u80fd\u3002\u5728HAL\u5e93\u4e2d\u4f53\u73b0\u4e3a\u8c03\u7528<\/p>\n<p>  __HAL_RCC_GPIOB_CLK_ENABLE()<\/p>\n<p> \u5b8f\u3002\u6b64\u5904\u9700\u7279\u522b\u6ce8\u610f\u65f6\u5e8f\u7ea6\u675f&#xff1a;\u5fc5\u987b\u5728\u8c03\u7528<\/p>\n<p>  HAL_GPIO_Init()<\/p>\n<p> \u4e4b\u524d\u5b8c\u6210\u65f6\u949f\u4f7f\u80fd&#xff0c;\u5426\u5219\u521d\u59cb\u5316\u51fd\u6570\u5c06\u56e0\u65e0\u6cd5\u8bbf\u95ee\u5bc4\u5b58\u5668\u800c\u5931\u8d25\u3002\u5b9e\u9645\u5de5\u7a0b\u4e2d&#xff0c;\u8be5\u6b65\u9aa4\u901a\u5e38\u7f6e\u4e8e<\/p>\n<p>  SystemClock_Config()<\/p>\n<p> \u4e4b\u540e\u3001<\/p>\n<p>  MX_GPIO_Init()<\/p>\n<p> \u4e4b\u524d\u7684\u6807\u51c6\u521d\u59cb\u5316\u5e8f\u5217\u4e2d\u3002\n<\/p>\n<h4>\n 2.3 \u5f15\u811a\u7535\u6c14\u7279\u6027\u53c2\u6570\u6821\u9a8c<br \/>\n<\/h4>\n<p>\n \u67e5\u9605STM32F103RCT6\u6570\u636e\u624b\u518c\u201cElectrical Characteristics\u201d\u7ae0\u8282&#xff0c;GPIO\u8f93\u5165\u9ad8\u7535\u5e73\u9608\u503c&#xff08;VIH&#xff09;\u6700\u5c0f\u503c\u4e3a0.7\u00d7VDD&#xff08;2.31V&#xff09;&#xff0c;\u8f93\u5165\u4f4e\u7535\u5e73\u9608\u503c&#xff08;VIL&#xff09;\u6700\u5927\u503c\u4e3a0.3\u00d7VDD&#xff08;0.99V&#xff09;\u3002\u5916\u90e810k\u03a9\u4e0a\u62c9\u7535\u963b\u5728\u91ca\u653e\u6001\u4ea7\u751f\u7684\u7535\u538b\u4e3a3.3V&#xff0c;\u8fdc\u9ad8\u4e8eVIH&#xff1b;\u6309\u952e\u95ed\u5408\u65f6&#xff0c;\u5047\u8bbe\u6309\u952e\u63a5\u89e6\u7535\u963b\u4e3a100m\u03a9&#xff0c;\u5f15\u811a\u704c\u5165\u7535\u6d41\u4e3a3.3V\/10k\u03a9&#061;0.33mA&#xff0c;\u8fdc\u4f4e\u4e8eGPIO\u6700\u5927\u8f93\u5165\u6f0f\u7535\u6d41&#xff08;\u00b15\u03bcA&#xff09;&#xff0c;\u786e\u4fdd\u4f4e\u7535\u5e73\u7a33\u5b9a\u53ef\u9760\u3002\u8be5\u53c2\u6570\u7ec4\u5408\u9a8c\u8bc1\u4e86\u786c\u4ef6\u8bbe\u8ba1\u7684\u9c81\u68d2\u6027\u3002\n<\/p>\n<h3>\n 3. \u6309\u952e\u6d88\u6296\u7684\u786c\u4ef6\u4e0e\u8f6f\u4ef6\u534f\u540c\u7b56\u7565<br \/>\n<\/h3>\n<p>\n \u673a\u68b0\u6309\u952e\u5728\u89e6\u70b9\u95ed\u5408\/\u65ad\u5f00\u77ac\u95f4\u4f1a\u4ea7\u751f10\u201320ms\u7684\u5f39\u8df3\u73b0\u8c61&#xff0c;\u82e5\u76f4\u63a5\u8bfb\u53d6\u5c06\u5bfc\u81f4\u5355\u6b21\u6309\u952e\u88ab\u8bc6\u522b\u4e3a\u591a\u6b21\u89e6\u53d1\u3002CT117E-M4\u5e73\u53f0\u91c7\u7528\u201c\u786c\u4ef6\u9884\u5904\u7406&#043;\u8f6f\u4ef6\u7cbe\u6ee4\u201d\u7684\u5206\u5c42\u6d88\u6296\u65b9\u6848&#xff0c;\u517c\u987e\u5b9e\u65f6\u6027\u4e0e\u8d44\u6e90\u6548\u7387\u3002\n<\/p>\n<h4>\n 3.1 \u786c\u4ef6RC\u6ee4\u6ce2\u7684\u5c40\u9650\u6027\u4e0e\u53d6\u820d<br \/>\n<\/h4>\n<p>\n \u90e8\u5206\u8bbe\u8ba1\u4f1a\u5728\u6309\u952e\u4e24\u7aef\u5e76\u80540.1\u03bcF\u9676\u74f7\u7535\u5bb9\u6784\u6210RC\u4f4e\u901a\u6ee4\u6ce2\u5668&#xff0c;\u65f6\u95f4\u5e38\u6570\u03c4&#061;R\u00d7C&#061;10k\u03a9\u00d70.1\u03bcF&#061;1ms&#xff0c;\u7406\u8bba\u4e0a\u53ef\u6ee4\u9664\u9ad8\u9891\u566a\u58f0\u3002\u4f46\u5728\u672c\u5e73\u53f0\u4e2d\u672a\u91c7\u7528\u6b64\u65b9\u6848&#xff0c;\u539f\u56e0\u6709\u4e09&#xff1a;\u5176\u4e00&#xff0c;\u7ade\u8d5b\u677f\u5361\u5f3a\u8c03\u6210\u672c\u63a7\u5236&#xff0c;\u51cf\u5c11\u65e0\u6e90\u5668\u4ef6\u6570\u91cf&#xff1b;\u5176\u4e8c&#xff0c;STM32F103\u4e3b\u989172MHz&#xff0c;\u8f6f\u4ef6\u6d88\u6296\u5ef6\u8fdf\u53ef\u63a7&#xff1b;\u5176\u4e09&#xff0c;\u7535\u5bb9\u4f1a\u5ef6\u957f\u6309\u952e\u54cd\u5e94\u65f6\u95f4&#xff0c;\u5728\u9700\u8981\u5feb\u901f\u8fde\u7eed\u64cd\u4f5c\u7684\u573a\u666f&#xff08;\u5982\u8ba1\u65f6\u5668\u52a0\u51cf&#xff09;\u4e2d\u4ea7\u751f\u4f53\u9a8c\u52a3\u5316\u3002\u56e0\u6b64&#xff0c;\u786c\u4ef6\u5c42\u4ec5\u4fdd\u7559\u57fa\u7840\u7684\u4e0a\u62c9\u7535\u963b&#xff0c;\u5c06\u6d88\u6296\u4efb\u52a1\u4ea4\u7531\u8f6f\u4ef6\u5c42\u7075\u6d3b\u914d\u7f6e\u3002\n<\/p>\n<h4>\n 3.2 \u8f6f\u4ef6\u6d88\u6296\u7684\u72b6\u6001\u673a\u5b9e\u73b0<br \/>\n<\/h4>\n<p>\n \u63a8\u8350\u91c7\u7528\u6709\u9650\u72b6\u6001\u673a&#xff08;FSM&#xff09;\u5b9e\u73b0\u6309\u952e\u626b\u63cf&#xff0c;\u76f8\u6bd4\u7b80\u5355\u5ef6\u65f6\u6cd5\u5177\u6709\u66f4\u9ad8\u53ef\u9760\u6027\u3002\u4ee5B1&#xff08;PB1&#xff09;\u4e3a\u4f8b&#xff0c;\u5b9a\u4e49\u4e09\u4e2a\u72b6\u6001&#xff1a;<\/p>\n<p> &#8211;<\/p>\n<p>  KEY_IDLE<\/p>\n<p> &#xff1a;\u68c0\u6d4b\u5230\u4f4e\u7535\u5e73\u540e\u8fdb\u5165\u6b64\u72b6\u6001&#xff0c;\u542f\u52a815ms\u53bb\u6296\u5b9a\u65f6\u5668<\/p>\n<p> &#8211;<\/p>\n<p>  KEY_CONFIRMED<\/p>\n<p> &#xff1a;\u5b9a\u65f6\u5668\u8d85\u65f6\u540e\u4ecd\u4e3a\u4f4e\u7535\u5e73&#xff0c;\u5219\u786e\u8ba4\u6709\u6548\u6309\u4e0b&#xff0c;\u6267\u884c\u4e1a\u52a1\u903b\u8f91<\/p>\n<p> &#8211;<\/p>\n<p>  KEY_RELEASED<\/p>\n<p> &#xff1a;\u68c0\u6d4b\u5230\u9ad8\u7535\u5e73\u540e\u8fdb\u5165\u6b64\u72b6\u6001&#xff0c;\u542f\u52a815ms\u91ca\u653e\u786e\u8ba4\u5b9a\u65f6\u5668\n<\/p>\n<p>\n \u8be5\u72b6\u6001\u673a\u9700\u5728\u56fa\u5b9a\u5468\u671f&#xff08;\u598210ms&#xff09;\u7684SysTick\u4e2d\u65ad\u6216FreeRTOS\u4efb\u52a1\u4e2d\u8f6e\u8be2\u6267\u884c\u3002\u5173\u952e\u4ee3\u7801\u903b\u8f91\u5982\u4e0b&#xff1a;\n<\/p>\n<p>typedef enum {<br \/>\n    KEY_IDLE,<br \/>\n    KEY_CONFIRMED,<br \/>\n    KEY_RELEASED<br \/>\n} KeyStateTypeDef;<\/p>\n<p>static KeyStateTypeDef b1_state &#061; KEY_IDLE;<br \/>\nstatic uint8_t b1_press_flag &#061; 0;<\/p>\n<p>void Key_Scan_B1(void) {<br \/>\n    static uint16_t b1_debounce_cnt &#061; 0;<\/p>\n<p>    switch(b1_state) {<br \/>\n        case KEY_IDLE:<br \/>\n            if(HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_1) &#061;&#061; GPIO_PIN_RESET) {<br \/>\n                b1_debounce_cnt &#061; 0;<br \/>\n                b1_state &#061; KEY_CONFIRMED;<br \/>\n            }<br \/>\n            break;<\/p>\n<p>        case KEY_CONFIRMED:<br \/>\n            if(HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_1) &#061;&#061; GPIO_PIN_RESET) {<br \/>\n                if(&#043;&#043;b1_debounce_cnt &gt;&#061; 15) { \/\/ 15ms\u786e\u8ba4<br \/>\n                    b1_press_flag &#061; 1;<br \/>\n                    b1_state &#061; KEY_RELEASED;<br \/>\n                    b1_debounce_cnt &#061; 0;<br \/>\n                }<br \/>\n            } else {<br \/>\n                b1_state &#061; KEY_IDLE; \/\/ \u5f39\u8df3\u6062\u590d&#xff0c;\u91cd\u65b0\u68c0\u6d4b<br \/>\n            }<br \/>\n            break;<\/p>\n<p>        case KEY_RELEASED:<br \/>\n            if(HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_1) &#061;&#061; GPIO_PIN_SET) {<br \/>\n                if(&#043;&#043;b1_debounce_cnt &gt;&#061; 15) {<br \/>\n                    b1_state &#061; KEY_IDLE;<br \/>\n                    b1_debounce_cnt &#061; 0;<br \/>\n                }<br \/>\n            } else {<br \/>\n                b1_state &#061; KEY_CONFIRMED; \/\/ \u518d\u6b21\u6309\u4e0b&#xff0c;\u91cd\u7f6e\u91ca\u653e\u72b6\u6001<br \/>\n            }<br \/>\n            break;<br \/>\n    }<br \/>\n}<\/p>\n<h4>\n 3.3 \u4e2d\u65ad\u65b9\u5f0f\u7684\u9002\u7528\u8fb9\u754c\u5206\u6790<br \/>\n<\/h4>\n<p>\n \u867d\u7136STM32\u652f\u6301GPIO\u5916\u90e8\u4e2d\u65ad&#xff08;EXTI&#xff09;&#xff0c;\u4f46\u5bf9B1\u2013B4\u6309\u952e\u5e76\u4e0d\u63a8\u8350\u76f4\u63a5\u4f7f\u7528\u3002\u539f\u56e0\u5728\u4e8e&#xff1a;\u5176\u4e00&#xff0c;\u56db\u4e2a\u6309\u952e\u5171\u7528EXTI\u7ebf&#xff08;PB1\u2013PB4\u6620\u5c04\u81f3EXTI1\u2013EXTI4&#xff09;&#xff0c;\u4f46\u4e2d\u65ad\u670d\u52a1\u51fd\u6570&#xff08;ISR&#xff09;\u65e0\u6cd5\u533a\u5206\u5177\u4f53\u89e6\u53d1\u5f15\u811a&#xff0c;\u9700\u5728ISR\u5185\u9010\u4e00\u67e5\u8be2&#xff0c;\u4e27\u5931\u4e2d\u65ad\u54cd\u5e94\u4f18\u52bf&#xff1b;\u5176\u4e8c&#xff0c;\u6309\u952e\u64cd\u4f5c\u9891\u7387\u4f4e&#xff08;&lt;10Hz&#xff09;&#xff0c;\u800c\u4e2d\u65ad\u5904\u7406\u5f00\u9500&#xff08;\u5bc4\u5b58\u5668\u538b\u6808\/\u51fa\u6808\u3001\u4e0a\u4e0b\u6587\u5207\u6362&#xff09;\u5728Cortex-M3\u4e0a\u7ea6\u970012\u201316\u4e2a\u5468\u671f&#xff0c;\u8fdc\u8d85\u8f6e\u8be2\u67e5\u8be2\u76842\u20133\u4e2a\u5468\u671f&#xff1b;\u5176\u4e09&#xff0c;\u9891\u7e41\u4e2d\u65ad\u53ef\u80fd\u5e72\u6270\u5176\u4ed6\u9ad8\u4f18\u5148\u7ea7\u4efb\u52a1&#xff08;\u5982ADC\u91c7\u6837\u3001PWM\u8f93\u51fa&#xff09;\u3002\u56e0\u6b64&#xff0c;\u4ec5\u5728\u9700\u8981\u8d85\u4f4e\u529f\u8017\u5f85\u673a&#xff08;\u5982STOP\u6a21\u5f0f\u4e0b\u6309\u952e\u5524\u9192&#xff09;\u573a\u666f\u624d\u542f\u7528EXTI&#xff0c;\u65e5\u5e38\u8fd0\u884c\u91c7\u7528\u8f6e\u8be2\u66f4\u7b26\u5408\u5de5\u7a0b\u5b9e\u8df5\u3002\n<\/p>\n<h3>\n 4. \u6309\u952e\u9a71\u52a8\u7684\u6a21\u5757\u5316\u5c01\u88c5\u8bbe\u8ba1<br \/>\n<\/h3>\n<p>\n \u4e3a\u63d0\u5347\u4ee3\u7801\u590d\u7528\u6027\u4e0e\u53ef\u7ef4\u62a4\u6027&#xff0c;\u9700\u5c06\u6309\u952e\u529f\u80fd\u62bd\u8c61\u4e3a\u72ec\u7acb\u9a71\u52a8\u6a21\u5757\u3002CT117E-M4\u5e73\u53f0\u5efa\u8bae\u91c7\u7528\u4e09\u5c42\u67b6\u6784&#xff1a;\u786c\u4ef6\u62bd\u8c61\u5c42&#xff08;HAL&#xff09;\u3001\u9a71\u52a8\u5c42&#xff08;Driver&#xff09;\u3001\u5e94\u7528\u5c42&#xff08;Application&#xff09;\u3002\n<\/p>\n<h4>\n 4.1 \u786c\u4ef6\u62bd\u8c61\u5c42\u63a5\u53e3\u5b9a\u4e49<br \/>\n<\/h4>\n<p>\n \u5728<\/p>\n<p>  key_hal.h<\/p>\n<p> \u4e2d\u5b9a\u4e49\u5e95\u5c42\u64cd\u4f5c\u63a5\u53e3&#xff0c;\u5c4f\u853d\u5177\u4f53MCU\u578b\u53f7\u5dee\u5f02&#xff1a;\n<\/p>\n<p>#ifndef __KEY_HAL_H<br \/>\n#define __KEY_HAL_H<\/p>\n<p>#include &#034;stm32f1xx_hal.h&#034;<\/p>\n<p>\/\/ \u6309\u952e\u679a\u4e3e&#xff0c;\u4e0e\u539f\u7406\u56fe\u6807\u6ce8\u4e25\u683c\u5bf9\u5e94<br \/>\ntypedef enum {<br \/>\n    KEY_B1 &#061; 0,<br \/>\n    KEY_B2,<br \/>\n    KEY_B3,<br \/>\n    KEY_B4,<br \/>\n    KEY_MAX<br \/>\n} KeyIndexTypeDef;<\/p>\n<p>\/\/ \u6309\u952e\u72b6\u6001\u679a\u4e3e<br \/>\ntypedef enum {<br \/>\n    KEY_STATE_RELEASED &#061; 0,<br \/>\n    KEY_STATE_PRESSED<br \/>\n} KeyStateTypeDef;<\/p>\n<p>\/\/ \u521d\u59cb\u5316\u6240\u6709\u6309\u952eGPIO<br \/>\nvoid KEY_HAL_Init(void);<\/p>\n<p>\/\/ \u8bfb\u53d6\u6307\u5b9a\u6309\u952e\u5f53\u524d\u7535\u5e73&#xff08;\u975e\u6d88\u6296&#xff09;<br \/>\nKeyStateTypeDef KEY_HAL_ReadRaw(KeyIndexTypeDef key);<\/p>\n<p>#endif \/* __KEY_HAL_H *\/<\/p>\n<h4>\n 4.2 \u9a71\u52a8\u5c42\u72b6\u6001\u7ba1\u7406\u5b9e\u73b0<br \/>\n<\/h4>\n<p>  key_driver.c<\/p>\n<p> \u5b9e\u73b0\u6d88\u6296\u903b\u8f91\u4e0e\u72b6\u6001\u7f13\u5b58&#xff0c;\u5bf9\u5916\u63d0\u4f9b\u8fb9\u6cbf\u89e6\u53d1\u63a5\u53e3&#xff1a;\n<\/p>\n<p>#include &#034;key_hal.h&#034;<br \/>\n#include &#034;key_driver.h&#034;<\/p>\n<p>\/\/ \u6309\u952e\u72b6\u6001\u7f13\u5b58\u6570\u7ec4<br \/>\nstatic KeyStateTypeDef key_current_state[KEY_MAX] &#061; {0};<br \/>\nstatic KeyStateTypeDef key_last_state[KEY_MAX] &#061; {0};<\/p>\n<p>\/\/ \u6309\u952e\u6d88\u6296\u8ba1\u6570\u5668&#xff08;\u5355\u4f4d&#xff1a;10ms&#xff09;<br \/>\nstatic uint8_t key_debounce_cnt[KEY_MAX] &#061; {0};<\/p>\n<p>\/\/ \u6309\u952e\u72b6\u6001\u66f4\u65b0&#xff08;\u572810ms\u5b9a\u65f6\u5668\u56de\u8c03\u4e2d\u8c03\u7528&#xff09;<br \/>\nvoid KEY_Driver_Update(void) {<br \/>\n    for(uint8_t i &#061; 0; i &lt; KEY_MAX; i&#043;&#043;) {<br \/>\n        KeyStateTypeDef raw_state &#061; KEY_HAL_ReadRaw((KeyIndexTypeDef)i);<\/p>\n<p>        if(raw_state &#061;&#061; key_last_state[i]) {<br \/>\n            if(key_debounce_cnt[i] &lt; 15) {<br \/>\n                key_debounce_cnt[i]&#043;&#043;;<br \/>\n            }<br \/>\n        } else {<br \/>\n            key_debounce_cnt[i] &#061; 0;<br \/>\n            key_last_state[i] &#061; raw_state;<br \/>\n        }<\/p>\n<p>        \/\/ \u7a33\u5b9a150ms\u540e\u66f4\u65b0\u5f53\u524d\u72b6\u6001<br \/>\n        if(key_debounce_cnt[i] &gt;&#061; 15) {<br \/>\n            key_current_state[i] &#061; raw_state;<br \/>\n        }<br \/>\n    }<br \/>\n}<\/p>\n<p>\/\/ \u83b7\u53d6\u6309\u952e\u6309\u4e0b\u4e8b\u4ef6&#xff08;\u4ec5\u5728\u72b6\u6001\u53d8\u5316\u65f6\u8fd4\u56de\u4e00\u6b21&#xff09;<br \/>\nuint8_t KEY_Driver_GetPress(KeyIndexTypeDef key) {<br \/>\n    static KeyStateTypeDef prev_state[KEY_MAX] &#061; {0};<br \/>\n    uint8_t ret &#061; 0;<\/p>\n<p>    if(key_current_state[key] &#061;&#061; KEY_STATE_PRESSED &amp;&amp;<br \/>\n       prev_state[key] &#061;&#061; KEY_STATE_RELEASED) {<br \/>\n        ret &#061; 1;<br \/>\n    }<br \/>\n    prev_state[key] &#061; key_current_state[key];<\/p>\n<p>    return ret;<br \/>\n}<\/p>\n<p>\/\/ \u83b7\u53d6\u6309\u952e\u91ca\u653e\u4e8b\u4ef6<br \/>\nuint8_t KEY_Driver_GetRelease(KeyIndexTypeDef key) {<br \/>\n    static KeyStateTypeDef prev_state[KEY_MAX] &#061; {0};<br \/>\n    uint8_t ret &#061; 0;<\/p>\n<p>    if(key_current_state[key] &#061;&#061; KEY_STATE_RELEASED &amp;&amp;<br \/>\n       prev_state[key] &#061;&#061; KEY_STATE_PRESSED) {<br \/>\n        ret &#061; 1;<br \/>\n    }<br \/>\n    prev_state[key] &#061; key_current_state[key];<\/p>\n<p>    return ret;<br \/>\n}<\/p>\n<h4>\n 4.3 \u5e94\u7528\u5c42\u4e8b\u4ef6\u5206\u53d1\u673a\u5236<br \/>\n<\/h4>\n<p>\n \u5728<\/p>\n<p>  main.c<\/p>\n<p> \u7684\u4e3b\u5faa\u73af\u6216FreeRTOS\u4efb\u52a1\u4e2d&#xff0c;\u901a\u8fc7\u4e8b\u4ef6\u6807\u5fd7\u7ec4&#xff08;Event Group&#xff09;\u5b9e\u73b0\u6309\u952e\u4e8b\u4ef6\u89e3\u8026&#xff1a;\n<\/p>\n<p>#include &#034;freertos\/FreeRTOS.h&#034;<br \/>\n#include &#034;freertos\/event_groups.h&#034;<\/p>\n<p>\/\/ \u5b9a\u4e49\u6309\u952e\u4e8b\u4ef6\u6bd4\u7279\u4f4d<br \/>\n#define KEY_B1_PRESS_BIT    (1 &lt;&lt; 0)<br \/>\n#define KEY_B2_PRESS_BIT    (1 &lt;&lt; 1)<br \/>\n#define KEY_B3_PRESS_BIT    (1 &lt;&lt; 2)<br \/>\n#define KEY_B4_PRESS_BIT    (1 &lt;&lt; 3)<\/p>\n<p>EventGroupHandle_t key_event_group;<\/p>\n<p>void KEY_Task(void *pvParameters) {<br \/>\n    EventBits_t uxBits;<\/p>\n<p>    while(1) {<br \/>\n        \/\/ \u6e05\u9664\u6240\u6709\u6309\u952e\u4e8b\u4ef6<br \/>\n        xEventGroupClearBits(key_event_group,<br \/>\n            KEY_B1_PRESS_BIT | KEY_B2_PRESS_BIT |<br \/>\n            KEY_B3_PRESS_BIT | KEY_B4_PRESS_BIT);<\/p>\n<p>        \/\/ \u626b\u63cf\u6309\u952e\u72b6\u6001<br \/>\n        if(KEY_Driver_GetPress(KEY_B1)) {<br \/>\n            xEventGroupSetBits(key_event_group, KEY_B1_PRESS_BIT);<br \/>\n        }<br \/>\n        if(KEY_Driver_GetPress(KEY_B2)) {<br \/>\n            xEventGroupSetBits(key_event_group, KEY_B2_PRESS_BIT);<br \/>\n        }<br \/>\n        \/\/ &#8230; \u5176\u4ed6\u6309\u952e<\/p>\n<p>        vTaskDelay(10); \/\/ 10ms\u626b\u63cf\u5468\u671f<br \/>\n    }<br \/>\n}<\/p>\n<p>\/\/ \u5728\u4e1a\u52a1\u4efb\u52a1\u4e2d\u7b49\u5f85\u6309\u952e\u4e8b\u4ef6<br \/>\nvoid UserTask(void *pvParameters) {<br \/>\n    EventBits_t uxBits;<\/p>\n<p>    while(1) {<br \/>\n        uxBits &#061; xEventGroupWaitBits(<br \/>\n            key_event_group,<br \/>\n            KEY_B1_PRESS_BIT | KEY_B2_PRESS_BIT,<br \/>\n            pdTRUE,  \/\/ \u6e05\u9664\u5df2\u7b49\u5f85\u7684\u6bd4\u7279\u4f4d<br \/>\n            pdFALSE, \/\/ \u4e0d\u8981\u6c42\u6240\u6709\u6bd4\u7279\u4f4d\u90fd\u7f6e\u4f4d<br \/>\n            portMAX_DELAY<br \/>\n        );<\/p>\n<p>        if(uxBits &amp; KEY_B1_PRESS_BIT) {<br \/>\n            \/\/ \u6267\u884cB1\u529f\u80fd&#xff1a;\u5982LED\u5207\u6362<br \/>\n            HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_0);<br \/>\n        }<br \/>\n        if(uxBits &amp; KEY_B2_PRESS_BIT) {<br \/>\n            \/\/ \u6267\u884cB2\u529f\u80fd&#xff1a;\u5982\u4e32\u53e3\u53d1\u9001<br \/>\n            HAL_UART_Transmit(&amp;huart1, (uint8_t*)&#034;B2_PRESSED&#034;, 10, HAL_MAX_DELAY);<br \/>\n        }<br \/>\n    }<br \/>\n}<\/p>\n<h3>\n 5. \u5b9e\u9645\u9879\u76ee\u4e2d\u7684\u5178\u578b\u95ee\u9898\u4e0e\u89c4\u907f\u65b9\u6848<br \/>\n<\/h3>\n<p>\n \u5728CT117E-M4\u7684\u5b9e\u9645\u7ade\u8d5b\u8c03\u8bd5\u4e2d&#xff0c;\u6309\u952e\u76f8\u5173\u6545\u969c\u5360\u786c\u4ef6\u95ee\u9898\u768435%\u4ee5\u4e0a\u3002\u4ee5\u4e0b\u662f\u9ad8\u9891\u95ee\u9898\u7684\u6839\u56e0\u5206\u6790\u4e0e\u89e3\u51b3\u8def\u5f84&#xff1a;\n<\/p>\n<h4>\n 5.1 \u6309\u952e\u65e0\u54cd\u5e94\u7684\u9636\u68af\u5f0f\u6392\u67e5<br \/>\n<\/h4>\n<p>\n \u5f53B1\u2013B4\u5168\u90e8\u5931\u6548\u65f6&#xff0c;\u6309\u4ee5\u4e0b\u987a\u5e8f\u9a8c\u8bc1&#xff1a;<\/p>\n<p> 1.<\/p>\n<p>  \u7535\u6e90\u5b8c\u6574\u6027\u68c0\u67e5<\/p>\n<p> &#xff1a;\u4f7f\u7528\u4e07\u7528\u8868\u6d4b\u91cfVDD\u5f15\u811a\u5bf9GND\u7535\u538b&#xff0c;\u786e\u8ba4\u662f\u5426\u4e3a3.3V\u00b15%\u3002\u5e38\u89c1\u6545\u969c\u662fUSB\u4f9b\u7535\u4e0d\u8db3&#xff08;\u4f4e\u4e8e4.75V&#xff09;\u5bfc\u81f4LDO\u8f93\u51fa\u5f02\u5e38\u3002<\/p>\n<p> 2.<\/p>\n<p>  GPIO\u65f6\u949f\u9a8c\u8bc1<\/p>\n<p> &#xff1a;\u5728<\/p>\n<p>  KEY_HAL_Init()<\/p>\n<p> \u4e2d\u6dfb\u52a0\u8c03\u8bd5LED\u95ea\u70c1&#xff0c;\u82e5LED\u4e0d\u4eae\u5219\u8bf4\u660eRCC\u914d\u7f6e\u9519\u8bef&#xff1b;\u82e5LED\u95ea\u70c1\u4f46\u6309\u952e\u65e0\u6548&#xff0c;\u5219\u68c0\u67e5<\/p>\n<p>  __HAL_RCC_GPIOB_CLK_ENABLE()<\/p>\n<p> \u662f\u5426\u88ab\u6ce8\u91ca\u3002<\/p>\n<p> 3.<\/p>\n<p>  \u5f15\u811a\u590d\u7528\u51b2\u7a81<\/p>\n<p> &#xff1a;\u786e\u8ba4PB1\u2013PB4\u672a\u88ab\u5176\u4ed6\u5916\u8bbe&#xff08;\u5982USART3_RX\u3001SPI3_NSS&#xff09;\u590d\u7528\u3002\u5728STM32CubeMX\u4e2d\u68c0\u67e5Pinout\u89c6\u56fe&#xff0c;\u786e\u4fdd\u5bf9\u5e94\u5f15\u811aMode\u4e3a\u201dGPIO_Input\u201d\u3002<\/p>\n<p> 4.<\/p>\n<p>  \u710a\u63a5\u8d28\u91cf\u76ee\u68c0<\/p>\n<p> &#xff1a;\u653e\u5927\u955c\u89c2\u5bdfB1\u2013B4\u710a\u76d8\u662f\u5426\u5b58\u5728\u865a\u710a\u3001\u8fde\u9521\u3002\u7279\u522b\u5173\u6ce8\u6309\u952e\u5e95\u90e8\u91d1\u5c5e\u811a\u4e0ePCB\u710a\u76d8\u7684\u6da6\u6e7f\u60c5\u51b5&#xff0c;\u51b7\u710a\u70b9\u5448\u7070\u767d\u8272\u4e14\u65e0\u91d1\u5c5e\u5149\u6cfd\u3002\n<\/p>\n<h4>\n 5.2 \u95f4\u6b47\u6027\u8bef\u89e6\u53d1\u7684EMC\u4f18\u5316<br \/>\n<\/h4>\n<p>\n \u5728\u5f3a\u7535\u78c1\u73af\u5883&#xff08;\u5982\u9760\u8fd1\u7535\u673a\u9a71\u52a8\u5668&#xff09;\u4e0b&#xff0c;\u6309\u952e\u53ef\u80fd\u51fa\u73b0\u968f\u673a\u89e6\u53d1\u3002\u6839\u672c\u539f\u56e0\u662fPCB\u8d70\u7ebf\u5145\u5f53\u63a5\u6536\u5929\u7ebf&#xff0c;\u9ad8\u9891\u566a\u58f0\u8026\u5408\u81f3GPIO\u5f15\u811a\u3002\u89e3\u51b3\u65b9\u6848\u5305\u62ec&#xff1a;<\/p>\n<p> &#8211;<\/p>\n<p>  \u8d70\u7ebf\u4f18\u5316<\/p>\n<p> &#xff1a;\u6309\u952e\u4fe1\u53f7\u7ebf\u957f\u5ea6\u63a7\u5236\u572815mm\u4ee5\u5185&#xff0c;\u8fdc\u79bbDC-DC\u7535\u6e90\u6a21\u5757\u4e0e\u7535\u673a\u9a71\u52a8\u8f93\u51fa\u7aef<\/p>\n<p> &#8211;<\/p>\n<p>  \u6ee4\u6ce2\u589e\u5f3a<\/p>\n<p> &#xff1a;\u5728GPIO\u5f15\u811a\u5c31\u8fd1&#xff08;&lt;2mm&#xff09;\u589e\u52a0100pF\u9676\u74f7\u7535\u5bb9\u81f3GND&#xff0c;\u5f62\u6210\u03c0\u578b\u6ee4\u6ce2&#xff08;\u539f\u4e0a\u62c9\u7535\u963b&#043;\u65b0\u589e\u7535\u5bb9&#xff09;<\/p>\n<p> &#8211;<\/p>\n<p>  \u8f6f\u4ef6\u52a0\u56fa<\/p>\n<p> &#xff1a;\u5c06\u6d88\u6296\u65f6\u95f4\u4ece15ms\u63d0\u5347\u81f325ms&#xff0c;\u5e76\u5728<\/p>\n<p>  KEY_Driver_Update()<\/p>\n<p> \u4e2d\u589e\u52a0\u566a\u58f0\u8ba1\u6570\u5668&#xff0c;\u8fde\u7eed3\u6b21\u68c0\u6d4b\u5230\u5f02\u5e38\u7535\u5e73\u53d8\u5316\u5219\u9501\u5b9a\u8be5\u6309\u952e100ms\n<\/p>\n<h4>\n 5.3 \u4f4e\u529f\u8017\u6a21\u5f0f\u4e0b\u7684\u6309\u952e\u5524\u9192\u5931\u6548<br \/>\n<\/h4>\n<p>\n \u5f53\u7cfb\u7edf\u8fdb\u5165STOP\u6a21\u5f0f\u65f6&#xff0c;\u82e5\u6309\u952e\u65e0\u6cd5\u5524\u9192MCU&#xff0c;\u9700\u6838\u67e5&#xff1a;<\/p>\n<p> &#8211;<\/p>\n<p>  \u65f6\u949f\u6e90\u9009\u62e9<\/p>\n<p> &#xff1a;STOP\u6a21\u5f0f\u4e0bHSI\u5fc5\u987b\u5173\u95ed&#xff0c;\u5524\u9192\u65f6\u949f\u9700\u914d\u7f6e\u4e3aLSI&#xff08;40kHz&#xff09;\u6216\u5916\u90e8LSE\u3002\u5728<\/p>\n<p>  HAL_PWR_EnterSTOPMode()<\/p>\n<p> \u524d\u8c03\u7528<\/p>\n<p>  __HAL_RCC_LSI_ENABLE()<\/p>\n<p> \u5e76\u7b49\u5f85\u5c31\u7eea<\/p>\n<p> &#8211;<\/p>\n<p>  EXTI\u914d\u7f6e<\/p>\n<p> &#xff1a;\u82e5\u4f7f\u7528\u4e2d\u65ad\u5524\u9192&#xff0c;\u9700\u5728\u8fdb\u5165STOP\u524d\u8c03\u7528<\/p>\n<p>  HAL_EXTI_GenerateSWInterrupt()<\/p>\n<p> \u9a8c\u8bc1\u4e2d\u65ad\u901a\u9053&#xff0c;\u4e14\u786e\u4fdd<\/p>\n<p>  EXTI-&gt;IMR<\/p>\n<p> \u5bf9\u5e94\u4f4d\u5df2\u7f6e1<\/p>\n<p> &#8211;<\/p>\n<p>  \u5524\u9192\u5f15\u811a\u914d\u7f6e<\/p>\n<p> &#xff1a;PB1\u2013PB4\u9700\u5728<\/p>\n<p>  HAL_PWR_EnableWakeUpPin()<\/p>\n<p> \u4e2d\u6ce8\u518c&#xff0c;\u4f8b\u5982<\/p>\n<p>  HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1, PWR_GPIO_BIT_1)<\/p>\n<p> &#xff08;PB1\u5bf9\u5e94GPIO_BIT_1&#xff09;\n<\/p>\n<p>\n \u6211\u5728\u5b9e\u9645\u6307\u5bfc\u84dd\u6865\u676f\u5907\u8d5b\u65f6\u53d1\u73b0&#xff0c;\u8d85\u8fc760%\u7684\u6309\u952e\u6545\u969c\u6e90\u4e8e\u65f6\u949f\u914d\u7f6e\u9057\u6f0f\u3002\u66fe\u6709\u4e00\u4e2a\u6848\u4f8b&#xff1a;\u5b66\u751f\u5c06PB1\u914d\u7f6e\u4e3a<\/p>\n<p>  GPIO_MODE_IT_FALLING<\/p>\n<p> &#xff08;\u4e0b\u964d\u6cbf\u4e2d\u65ad&#xff09;&#xff0c;\u4f46\u5fd8\u8bb0\u4f7f\u80fdSYSCFG\u65f6\u949f&#xff08;<\/p>\n<p>  __HAL_RCC_SYSCFG_CLK_ENABLE()<\/p>\n<p> &#xff09;&#xff0c;\u5bfc\u81f4EXTI\u7ebf\u8def\u65e0\u6cd5\u8fde\u63a5GPIO&#xff0c;\u73b0\u8c61\u662f\u6309\u952e\u5b8c\u5168\u65e0\u54cd\u5e94\u3002\u8fd9\u4e2a\u7ec6\u8282\u5728STM32\u4e2d\u6587\u53c2\u8003\u624b\u518c\u201cEXTI\u201d\u7ae0\u8282\u6709\u660e\u786e\u8bf4\u660e&#xff0c;\u4f46\u6781\u6613\u88ab\u5ffd\u7565\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. CT117E-M4\u5f00\u53d1\u677f\u6309\u952e\u786c\u4ef6\u67b6\u6784\u89e3\u6790CT117E-M4\u662f\u84dd\u6865\u676f\u5d4c\u5165\u5f0f\u7ec4\u7701\u8d5b\u6307\u5b9a\u7ade\u8d5b\u5e73\u53f0&#xff0c;\u5176\u6309\u952e\u7535\u8def\u8bbe\u8ba1\u4f53\u73b0\u4e86\u5178\u578b\u5de5\u4e1a\u7ea7\u4eba\u673a\u4ea4\u4e92\u63a5\u53e3\u7684\u5de5\u7a0b\u53d6\u820d\u3002\u8be5\u677f\u5361\u5de6\u4fa7\u5e03\u5c405\u4e2a\u7269\u7406\u6309\u952e&#xff0c;\u4f46\u529f\u80fd\u5b9a\u4f4d\u5b58\u5728\u672c\u8d28\u5dee\u5f02&#xff1a;\u5176\u4e2d4\u4e2a\u4e3a\u7528\u6237\u53ef\u7f16\u7a0b\u8f93\u5165\u6309\u952e&#xff08;B1\u2013B4&#xff09;&#xff0c;1\u4e2a\u4e3a\u7cfb\u7edf\u590d\u4f4d\u4e13\u7528\u6309\u952e&#xff08;RESET&#xff09;\u3002\u8fd9\u79cd\u5206\u79bb\u5f0f\u8bbe\u8ba1\u5e76\u975e\u5197\u4f59&#xff0c;\u800c\u662f\u9075\u5faa\u5d4c\u5165\u5f0f\u7cfb\u7edf\u53ef\u9760\u6027\u8bbe\u8ba1\u539f\u5219\u2014\u2014\u5c06\u5173\u952e\u7cfb<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[8372,8374,8373],"topic":[],"class_list":["post-76932","post","type-post","status-publish","format-standard","hentry","category-server","tag-ct117e-m4","tag-gpio","tag-stm32"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>CT117E-M4\u6309\u952e\u786c\u4ef6\u539f\u7406\u4e0e\u6d88\u6296\u9a71\u52a8\u8bbe\u8ba1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/76932.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"CT117E-M4\u6309\u952e\u786c\u4ef6\u539f\u7406\u4e0e\u6d88\u6296\u9a71\u52a8\u8bbe\u8ba1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"1. CT117E-M4\u5f00\u53d1\u677f\u6309\u952e\u786c\u4ef6\u67b6\u6784\u89e3\u6790CT117E-M4\u662f\u84dd\u6865\u676f\u5d4c\u5165\u5f0f\u7ec4\u7701\u8d5b\u6307\u5b9a\u7ade\u8d5b\u5e73\u53f0&#xff0c;\u5176\u6309\u952e\u7535\u8def\u8bbe\u8ba1\u4f53\u73b0\u4e86\u5178\u578b\u5de5\u4e1a\u7ea7\u4eba\u673a\u4ea4\u4e92\u63a5\u53e3\u7684\u5de5\u7a0b\u53d6\u820d\u3002\u8be5\u677f\u5361\u5de6\u4fa7\u5e03\u5c405\u4e2a\u7269\u7406\u6309\u952e&#xff0c;\u4f46\u529f\u80fd\u5b9a\u4f4d\u5b58\u5728\u672c\u8d28\u5dee\u5f02&#xff1a;\u5176\u4e2d4\u4e2a\u4e3a\u7528\u6237\u53ef\u7f16\u7a0b\u8f93\u5165\u6309\u952e&#xff08;B1\u2013B4&#xff09;&#xff0c;1\u4e2a\u4e3a\u7cfb\u7edf\u590d\u4f4d\u4e13\u7528\u6309\u952e&#xff08;RESET&#xff09;\u3002\u8fd9\u79cd\u5206\u79bb\u5f0f\u8bbe\u8ba1\u5e76\u975e\u5197\u4f59&#xff0c;\u800c\u662f\u9075\u5faa\u5d4c\u5165\u5f0f\u7cfb\u7edf\u53ef\u9760\u6027\u8bbe\u8ba1\u539f\u5219\u2014\u2014\u5c06\u5173\u952e\u7cfb\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/76932.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-23T07:58:53+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/76932.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/76932.html\",\"name\":\"CT117E-M4\u6309\u952e\u786c\u4ef6\u539f\u7406\u4e0e\u6d88\u6296\u9a71\u52a8\u8bbe\u8ba1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-23T07:58:53+00:00\",\"dateModified\":\"2026-02-23T07:58:53+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/76932.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/76932.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/76932.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"CT117E-M4\u6309\u952e\u786c\u4ef6\u539f\u7406\u4e0e\u6d88\u6296\u9a71\u52a8\u8bbe\u8ba1\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"CT117E-M4\u6309\u952e\u786c\u4ef6\u539f\u7406\u4e0e\u6d88\u6296\u9a71\u52a8\u8bbe\u8ba1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/76932.html","og_locale":"zh_CN","og_type":"article","og_title":"CT117E-M4\u6309\u952e\u786c\u4ef6\u539f\u7406\u4e0e\u6d88\u6296\u9a71\u52a8\u8bbe\u8ba1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"1. CT117E-M4\u5f00\u53d1\u677f\u6309\u952e\u786c\u4ef6\u67b6\u6784\u89e3\u6790CT117E-M4\u662f\u84dd\u6865\u676f\u5d4c\u5165\u5f0f\u7ec4\u7701\u8d5b\u6307\u5b9a\u7ade\u8d5b\u5e73\u53f0&#xff0c;\u5176\u6309\u952e\u7535\u8def\u8bbe\u8ba1\u4f53\u73b0\u4e86\u5178\u578b\u5de5\u4e1a\u7ea7\u4eba\u673a\u4ea4\u4e92\u63a5\u53e3\u7684\u5de5\u7a0b\u53d6\u820d\u3002\u8be5\u677f\u5361\u5de6\u4fa7\u5e03\u5c405\u4e2a\u7269\u7406\u6309\u952e&#xff0c;\u4f46\u529f\u80fd\u5b9a\u4f4d\u5b58\u5728\u672c\u8d28\u5dee\u5f02&#xff1a;\u5176\u4e2d4\u4e2a\u4e3a\u7528\u6237\u53ef\u7f16\u7a0b\u8f93\u5165\u6309\u952e&#xff08;B1\u2013B4&#xff09;&#xff0c;1\u4e2a\u4e3a\u7cfb\u7edf\u590d\u4f4d\u4e13\u7528\u6309\u952e&#xff08;RESET&#xff09;\u3002\u8fd9\u79cd\u5206\u79bb\u5f0f\u8bbe\u8ba1\u5e76\u975e\u5197\u4f59&#xff0c;\u800c\u662f\u9075\u5faa\u5d4c\u5165\u5f0f\u7cfb\u7edf\u53ef\u9760\u6027\u8bbe\u8ba1\u539f\u5219\u2014\u2014\u5c06\u5173\u952e\u7cfb","og_url":"https:\/\/www.wsisp.com\/helps\/76932.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-23T07:58:53+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"6 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/76932.html","url":"https:\/\/www.wsisp.com\/helps\/76932.html","name":"CT117E-M4\u6309\u952e\u786c\u4ef6\u539f\u7406\u4e0e\u6d88\u6296\u9a71\u52a8\u8bbe\u8ba1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-23T07:58:53+00:00","dateModified":"2026-02-23T07:58:53+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/76932.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/76932.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/76932.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"CT117E-M4\u6309\u952e\u786c\u4ef6\u539f\u7406\u4e0e\u6d88\u6296\u9a71\u52a8\u8bbe\u8ba1"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/76932","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=76932"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/76932\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=76932"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=76932"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=76932"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=76932"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}