{"id":114,"date":"2021-03-02T16:49:48","date_gmt":"2021-03-02T08:49:48","guid":{"rendered":"http:\/\/blogs.gongqilin.cn\/?p=114"},"modified":"2021-03-02T16:49:48","modified_gmt":"2021-03-02T08:49:48","slug":"%e7%bb%98%e5%88%b6%e5%b7%a5%e7%a8%8b%e6%a8%a1%e6%9d%bf%e7%bb%93%e6%9e%84%e5%9b%be%ef%bc%88%e4%b8%80%ef%bc%89","status":"publish","type":"post","link":"https:\/\/blogs.gongqilin.cn\/?p=114","title":{"rendered":"\u7ed8\u5236\u5de5\u7a0b\u6a21\u677f\u7ed3\u6784\u56fe\uff08\u4e00\uff09"},"content":{"rendered":"<p>\u4e3a\u4e86C++\u6784\u5efaSTM32\u7684\u5de5\u7a0b\u6a21\u677f\u5c3d\u53ef\u80fd\u964d\u4f4e\u8f6f\u4ef6\u7684\u903b\u8f91\u5904\u7406\u90e8\u5206\u4e0e\u786c\u4ef6\u7684\u8026\u5408\uff0c\u53ef\u4ee5\u4f7f\u4e1a\u52a1\u76f8\u5173\u529f\u80fd\u8131\u79bb\u786c\u4ef6\u8fd0\u884c\u3002\u6240\u4ee5\u5e94\u8be5\u62bd\u8c61\u51fa\u4e0e\u786c\u4ef6\u76f8\u5173\u7684\u64cd\u4f5c\u3002\u7531\u4e8e\u5185\u5bb9\u8fc7\u591a\uff0c\u4e0d\u80fd\u4e00\u4e00\u5217\u4e3e\uff0c\u5177\u4f53\u5185\u5bb9\u8bf7\u67e5\u770b\u6e90\u6587\u4ef6\u3002<\/p>\n<h1>\u521b\u5efacore\u6587\u4ef6\u5939&#8211;\u7cfb\u7edf\u5e38\u7528\u5b9a\u4e49<\/h1>\n<p style=\"padding-left: 40px;\"><span style=\"font-size: 12pt;\"><strong>\u521b\u5efacpu_type\u6587\u4ef6<\/strong><\/span><\/p>\n<p style=\"padding-left: 80px;\">\u8be5\u6587\u4ef6\u5bf9\u5e38\u89c1\u7684CPU\u7c7b\u578b\u8fdb\u884c\u679a\u4e3e\u5b9a\u4e49\uff0c\u8bb0\u5f55\u5404\u4e2a\u7cfb\u5217\u7684\u82af\u7247ID\u7684\u8d77\u59cb\u5730\u5740\uff0cflash\u5bb9\u91cf\u5730\u5740\u7b49\u4fe1\u606f\u3002\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u8bb0\u5f55\u4e86F0\u3001F1\u3001F2\u3001F3\u3001F4\u7cfb\u5217\u7684\u82af\u7247\u552f\u4e00ID\u7684\u8d77\u59cb\u5730\u5740\u4ee5\u53ca\u3002<\/p>\n<p><a href=\"http:\/\/blogs.gongqilin.cn\/wp-content\/uploads\/2021\/03\/2021030102225667.png\" rel=\"box\" class=\"fancybox\"><img class=\"aligncenter size-full wp-image-120\" data-original=\"http:\/\/blogs.gongqilin.cn\/wp-content\/uploads\/2021\/03\/2021030102225667.png\"  alt=\"\" \/><\/a><\/p>\n<noscript><img loading=\"lazy\" decoding=\"async\" width=\"699\" height=\"269\" class=\"aligncenter size-full wp-image-120\" src=\"http:\/\/blogs.gongqilin.cn\/wp-content\/uploads\/2021\/03\/2021030102225667.png\" alt=\"\" \/><\/a><\/p><\/noscript>\n<p style=\"padding-left: 80px;\">\u6700\u540e\u6839\u636e\u5f53\u524d\u7f16\u8bd1\u7684\u82af\u7247\uff08\u5728\u7f16\u8bd1\u914d\u7f6e\u6587\u4ef6config.mk\u4e2d\u5b9a\u4e49\uff09\u9884\u7f16\u8bd1ID\u5730\u5740\u3001Flash\u5730\u5740\u7b49\u4fe1\u606f\u4ece\u800c\u9002\u914d\u5404\u4e2a\u7cfb\u5217\u7684MCU\u3002<a href=\"http:\/\/blogs.gongqilin.cn\/wp-content\/uploads\/2021\/03\/2021030102225772.png\" rel=\"box\" class=\"fancybox\"><img class=\"aligncenter size-full wp-image-121\" data-original=\"http:\/\/blogs.gongqilin.cn\/wp-content\/uploads\/2021\/03\/2021030102225772.png\"  alt=\"\" \/><\/a><\/p>\n<noscript><img loading=\"lazy\" decoding=\"async\" width=\"1079\" height=\"299\" class=\"aligncenter size-full wp-image-121\" src=\"http:\/\/blogs.gongqilin.cn\/wp-content\/uploads\/2021\/03\/2021030102225772.png\" alt=\"\" \/><\/a><\/p><\/noscript>\n<p><span style=\"font-size: 12pt;\"><strong>\u00a0 \u00a0 \u00a0 \u00a0 \u521b\u5efasys_type\u6587\u4ef6<\/strong><\/span><\/p>\n<p style=\"padding-left: 80px;\">\u8be5\u6587\u4ef6\u4e3b\u8981\u5bf9\u4e00\u4e9b\u5e38\u7528\u7684\u5e38\u91cf\u8fdb\u884c\u5b9a\u4e49\u5982LOW\u4e3a0\uff0c HIGH\u4e3a1\uff0cPI\u4e3a3.1415926535897932384626433832795\u7b49\u7b49\uff0c\u4e5f\u5728\u6b64\u6587\u4ef6\u4e0b\u5b9a\u4e49\u4e86CPU\u65f6\u949f\u3001CPU\u3001\u65f6\u95f4\u3001\u7b49\u7ed3\u6784\u4f53\u3002<\/p>\n<p style=\"padding-left: 40px;\"><span style=\"font-size: 12pt;\"><strong>\u521b\u5efasys_core\u6587\u4ef6<\/strong><\/span><\/p>\n<p style=\"padding-left: 80px;\">\u8be5\u6587\u4ef6\u5bf9\u4e00\u4e9b\u5e38\u7528\u64cd\u4f5c\u5b9a\u4e49\u4e3a\u5b8f\/\u51fd\u6570\uff0c\u65b9\u4fbf\u5feb\u901f\u8c03\u7528\uff0c\u4f8b\u5982\u8bfb\u6307\u5b9abit\u4f4d\uff0c\u6307\u5b9abit\u4f4d\u7f6e1\uff0c\u6307\u5b9abit\u4f4d\u6e05\u96f6\uff0c4\u5b57\u82828\u4f4d\u65e0\u7b26\u53f7\u6574\u578b\u6570\u8f6c\u6362\u4e3a32\u4f4d\u65e0\u7b26\u53f7\u6574\u578b\u6570\u7b49\u7b49\u3002<\/p>\n<h1 style=\"padding-left: 40px;\"><span style=\"font-size: 12pt;\"><strong>\u521b\u5efaport_gpio\u6587\u4ef6<\/strong><\/span><\/h1>\n<p style=\"padding-left: 80px;\">\u8be5\u6587\u4ef6\u5bf9GPIO\u7aef\u53e3\u8fdb\u884c\u91cd\u65b0\u5b9a\u4e49\uff0c\u4e3a\u6bcf\u4e2aGPIO\u91cd\u65b0\u7f16\u53f7\u4e3aPinId,\u540e\u9762\u65e0\u8bba\u54ea\u4e2a\u7cfb\u5217\u7684\u82af\u7247\u90fd\u53ef\u4ee5\u901a\u8fc7\u8fd9\u4e2aPinId\u7684\u83b7\u53d6\u5230\u8be5\u5f15\u811a\u7684<\/p>\n<ul>\n<li>\u4e2d\u65ad\u7aef\u53e3#define GETEXTIPORT(a) ((uint32_t)a &gt;&gt;4 )\uff08\u5f97\u5230\u7684\u5c31\u662fEXTI_PortSourceGPIOA&#8211;EXTI_PortSourceGPIOK\uff09<\/li>\n<li>\u4e2d\u65ad\u7ebf#define GETEXTILINE(a) ((uint32_t)1&lt;&lt;( a &amp; 0x0f ))\u00a0 (\u5f97\u5230\u7684\u5c31\u662fEXTI_LINE_0&#8211;EXTI_LINE_31\uff09<\/li>\n<li>\u5f15\u811a\u7f16\u53f7#define GETPIN(a) (uint16_t)(1&lt;&lt;(a&amp;0x0f))\u00a0 \uff08\u5f97\u5230\u7684\u5c31\u662fGPIO_Pin_0 &#8212; GPIO_Pin_15\uff09<\/li>\n<li>\u5f15\u811a\u590d\u7528\u529f\u80fd\u7f16\u53f7 #define GETPINSOURCR(a) (a &amp; 0x0f)\u00a0 \uff08\u5f97\u5230\u7684\u5c31\u662fGPIO_PinSource0 &#8212; GPIO_PinSource15 \uff09<\/li>\n<li>\u5f15\u811a\u7aef\u53e3\u53f7#define GETPORT(a) ((GPIO_TypeDef*)(((((a)&amp;0xf0))&lt;&lt;6)+PORT_BASE))\u00a0 \uff08\u5f97\u5230\u7684\u5c31\u662fGPIOA_BASE &#8212; GPIOF_BASE\uff09<\/li>\n<\/ul>\n<p style=\"padding-left: 40px;\">\u5176\u4e2dPORT_BASE\u6839\u636e\u4e0d\u540c\u7c7b\u578b\u7684\u82af\u7247\u5df2\u7ecf\u5728cpu_type\u5b8c\u6210\u5b9a\u4e49\uff0c\u5728\u4f7f\u7528\u8fc7\u7a0b\u4e2d\uff0c\u4f8b\u5982\u6211\u4eec\u6709\u4e00\u4e2agpio\u7684\u7c7b\u5bf9\u8c61\u4e3a_pin,\u8be5\u5bf9\u8c61\u5177\u5907id\u5c5e\u6027\uff08port_gpio\u5b9a\u4e49\u7684\u5f15\u811a\u7f16\u53f7\uff0c\u8fd9\u4e2a\u7f16\u53f7\u5728\u521b\u5efa\u8fd9\u4e2a\u5bf9\u8c61\u65f6\u5c31\u5b8c\u6210\u4e86\u521d\u59cb\u5316\uff09\u90a3\u4e48\u6211\u4eec\u5728\u505a\u914d\u7f6e\u4e2d\u65ad\u7ebf\u65f6\u76f4\u63a5\u8c03\u7528SYSCFG_EXTILineConfig(GETEXTIPORT(_pin-&gt;id), GETPINSOURCR(_pin-&gt;id)); \u5c31\u53ef\u4ee5\u5b8c\u6210\u8be5GPIO\u7684\u4e2d\u65ad\u7ebf\u914d\u7f6e\u3002\u8fd9\u4e2a\u5c31\u662f\u66f4\u6362\u82af\u7247\u8be5\u4ee3\u7801\u4e5f\u53ef\u590d\u7528\uff0c\u5982\u679c\u66f4\u6362\u5f15\u811a\u4e5f\u53ea\u9700\u8981\u5728\u521d\u59cb\u5316_pin\u8fd9\u4e2a\u5bf9\u8c61\u65f6id\u4fee\u6539\u4e3a\u76f8\u5e94\u7684\u5f15\u811a\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<h1>\u521b\u5efaconfig\u6587\u4ef6\u5939&#8211;\u5de5\u7a0b\u914d\u7f6e<\/h1>\n<p style=\"padding-left: 40px;\"><span style=\"font-size: 12pt;\"><strong>\u521b\u5efasys_config\u6587\u4ef6<\/strong><\/span><\/p>\n<p style=\"padding-left: 80px;\">\u8be5\u6587\u4ef6\u4f5c\u4e3a\u7cfb\u7edf\u914d\u7f6e\u6587\u4ef6\uff0c\u914d\u7f6e\u662f\u5426\u6253\u5f00\u5168\u5c40\u4e32\u53e3\uff0cdebug\u4e32\u53e3\u9009\u62e9\uff0c\u662f\u5426\u4f7f\u7528IAP\uff0c\u662f\u5426\u4f7f\u7528SW\u63a5\u53e3\u7b49\u3002<\/p>\n<p style=\"padding-left: 40px;\"><span style=\"font-size: 12pt;\"><strong>\u521b\u5efamcu_config\u6587\u4ef6<\/strong><\/span><\/p>\n<p style=\"padding-left: 80px;\">mcu\u914d\u7f6e\u6587\u4ef6\uff0c\u8be5\u6587\u4ef6\u5bf9\u4f7f\u7528\u5230\u7684\u8be5\u7cfb\u5217\u7684mcu\u5b9a\u4e49flash\u533a\u57df\u3001\u5f15\u811a\u6570\u3001flash\u5927\u5c0f\u3001\u5185\u5b58\u5927\u5c0f\u7b49\u7b49\u3002<\/p>\n<p style=\"padding-left: 40px;\"><span style=\"font-size: 12pt;\"><strong>\u521b\u5efabsp\u6587\u4ef6<\/strong><\/span><\/p>\n<p style=\"padding-left: 80px;\">\u8be5\u6587\u4ef6\u5b9a\u4e49\u51fa\u6240\u6709\u7684\u786c\u4ef6\u62bd\u8c61\u51fa\u7684\u7c7b\u5bf9\u8c61\uff0c\u4f8b\u5982GPIO\u5bf9\u8c61\uff0cCMcuGpio PA0(PA0_ID);CMcuGpio PA1(PA1_ID); \u5229\u7528\u8fd9\u4e9bGPIO\u5bf9\u8c61\u53c8\u53ef\u4ee5\u6839\u636e\u5de5\u7a0b\u9700\u8981\u521b\u5efa\u5982CExti exti4(&amp;PD4);CUsart uart5(UART5, &amp;PC12, &amp;PD2);\u8fd9\u4e9b\u4e2d\u65ad\u3001\u4e32\u53e3\u5bf9\u8c61\u7b49\u7b49\uff0c\u5728\u9879\u76ee\u9700\u8981\u65f6\u53ea\u9700\u8981\u9009\u62e9\u914d\u7f6e\u76f8\u5e94\u7684GPIO\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<h1>\u521b\u5efahardware\u6587\u4ef6\u5939&#8211;\u786c\u4ef6\u76f8\u5173<\/h1>\n<p style=\"padding-left: 40px;\">\u524d\u9762\u6240\u63cf\u8ff0\u7684\u57fa\u672c\u4e0e\u786c\u4ef6\u5dee\u5f02\u6027\u4e0d\u5927\uff0c\u7a0d\u4f5c\u9884\u7f16\u8bd1\u5c31\u53ef\u4ee5\u901a\u7528\u4e8e\u5404\u4e2a\u7cfb\u5217\u7684mcu\uff0c\u800chardware\u6587\u4ef6\u5939\u4e0b\u53ef\u4ee5\u6839\u636e\u7c7b\u578b\u4e0d\u540c\u5206\u522b\u521b\u5efacortex-m0\uff0ccortex-m3\uff0ccortex-m4\u7b49\u7b49\u6587\u4ef6\u5939\uff0c\u5728config.mk\u5de5\u7a0b\u914d\u7f6e\u6587\u4ef6\u8fdb\u884c\u914d\u7f6e\uff0c\u8c03\u7528\u5de5\u7a0b\u5f53\u524d\u4f7f\u7528mcu\u76f8\u5339\u914d\u7684\u5185\u6838\u8fdb\u884c\u7f16\u8bd1\u3002<\/p>\n<p style=\"padding-left: 40px;\"><span style=\"font-size: 12pt;\"><strong>\u521b\u5efamcu_define\u6587\u4ef6<\/strong><\/span><\/p>\n<p style=\"padding-left: 80px;\">\u5b9a\u4e49\u5916\u8bbe\u65f6\u949f\u6e90\u3001\u5916\u8bbe\u4e2d\u65ad\u6e90\u3001GPIO\u5f15\u811a\u914d\u7f6e\u7b49\u7ed3\u6784\u4f53\uff0c\u4e14\u5b9a\u4e49\u4e86\u4e00\u4e2a\u53ef\u4ee5\u6839\u636e\u82af\u7247ID\u83b7\u53d6\u5916\u8bbe\u7d22\u5f15\u7684\u51fd\u6570uint8_t getIndex(PinId_t pin_id, const AF_FUN_S *emap)\u3002\u5916\u8bbe\u7d22\u5f15\u6839\u636e\u82af\u7247\u624b\u518c\u83b7\u53d6\uff0c\u6bcf\u79cd\u82af\u7247\u5b9a\u4e49\u4e00\u4e2a\u5916\u8bbe\u7d22\u5f15\u7684\u6587\u4ef6\uff08\u53ea\u8981\u914d\u7f6e\u5b8c\u6210\u5c31\u4e0d\u518d\u9700\u8981\u4fee\u6539\uff09\u4f8b\u5982\u4e0b\u56fe\u7684\u4e32\u53e3\u5f15\u811a\u7d22\u5f15\uff08f407ve\u7cfb\u5217\u7684\u7d22\u5f15\u6587\u4ef6stm32f407VE_define.h\uff09\u3002<a href=\"http:\/\/blogs.gongqilin.cn\/wp-content\/uploads\/2021\/03\/202103020838093.png\" rel=\"box\" class=\"fancybox\"><img class=\"aligncenter size-full wp-image-130\" data-original=\"http:\/\/blogs.gongqilin.cn\/wp-content\/uploads\/2021\/03\/202103020838093.png\"  alt=\"\" \/><\/a><\/p>\n<noscript><img loading=\"lazy\" decoding=\"async\" width=\"880\" height=\"551\" class=\"aligncenter size-full wp-image-130\" src=\"http:\/\/blogs.gongqilin.cn\/wp-content\/uploads\/2021\/03\/202103020838093.png\" alt=\"\" \/><\/a><\/p><\/noscript>\n<p style=\"padding-left: 80px;\">\u5047\u8bbe\u73b0\u5728\u6211\u4eec\u9700\u8981\u914d\u7f6e\u4e00\u4e2a\u4e32\u53e3\u4f7f\u7528\uff0c\u9996\u5148\u6309\u7167\u5728\u7d22\u5f15\u6587\u4ef6stm32f407VE_define.h\u6587\u4ef6\u4e2d\u627e\u5230\u60f3\u4f7f\u7528\u7684\u4e32\u53e31\uff0c\u53d1\u73b0\u53ef\u4ee5\u4f7f\u7528PA9\u3001PA10\u6216\u8005PB6\u3001PB7\u3002\u5047\u8bbe\u786c\u4ef6\u63a5\u7740PA9\u3001PA10\u3002\u90a3\u4e48\u6211\u4eec\u914d\u7f6e\u53ea\u9700\u8981\u5728bsp\u4e2d\u5b9a\u4e49\u4e00\u4e2aCUsart usart1(USART1, &amp;PA9, &amp;PA10);\u8fd9\u4e2aCUsart\u8fd9\u4e2a\u5185\u6211\u4eec\u5148\u4e0d\u4ecb\u7ecd\u3002\u73b0\u5728\u6211\u4eec\u5c31\u6709\u4e86\u4e00\u4e2ausart1\u7684\u4e32\u53e3\u5b9e\u4f8b\u4e86\u3002\u5982\u679cCUsart\u7c7b\u63d0\u4f9b\u4e86\u521d\u59cb\u5316\u7684\u65b9\u6cd5Init\uff08\uff09\u3002\u90a3\u6211\u4eec\u5c31\u53ef\u4ee5\u5728\u8fd9\u4e2a\u65b9\u6cd5\u4e2d\u5b9e\u73b0\u5bf9\u4e32\u53e3\u7684\u521d\u59cb\u5316\uff0c\u9996\u5148\u4f7f\u7528uint8_t getIndex(PinId_t pin_id, const AF_FUN_S *emap)\u51fd\u6570\u627e\u5230\u4e32\u53e3\u6240\u6709\u5c31\u662fPA9\/PA10\u5728UART_MAP\u4e2d\u7684\u4f4d\u7f6e\uff0c\u53ef\u4ee5\u53d1\u73b0PA9\u7684\u7d22\u5f15\u4e3a0\uff0cPA10\u4e3a1\u3002\u63a5\u7740\u4f7f\u7528GPIO\u7c7b\u63d0\u4f9b\u5f15\u811a\u5de5\u4f5c\u6a21\u5f0f\u914d\u7f6e\u7684_rx_pin-&gt;Mode(UART_MAP[index]._pinMode, UART_MAP[index]._pinAf)\u76f4\u63a5\u914d\u7f6e\u4e32\u53e3rx\u4f7f\u7528\u5f15\u811a\u7684\u5de5\u4f5c\u6a21\u5f0f\uff0ctx\u540c\u6837\u5982\u6b64_tx_pin-&gt;Mode(UART_MAP[index]._pinMode, UART_MAP[index]._pinAf);\u3002\u63a5\u7740\u6253\u5f00\u4e32\u53e3\u65f6\u949f\uff0c\u8fd9\u91cc\u5c31\u8981\u7528\u5230rcc\u6587\u4ef6\u63d0\u4f9b\u7684\u529f\u80fd\u3002<\/p>\n<p style=\"padding-left: 40px;\"><span style=\"font-size: 12pt;\"><strong>\u521b\u5efarcc\u6587\u4ef6<\/strong><\/span><\/p>\n<p style=\"padding-left: 80px;\">rcc\u6587\u4ef6\u6bd4\u8f83\u7b80\u5355\uff0c\u53ea\u63d0\u4f9b\u4e86\u6839\u636e\u6839\u636e\u8bbe\u5907\u5730\u5740\u5f00\u542f\u6216\u5173\u95ed\u65f6\u949f\uff08void rcc_clock_cmd(uint32_t dev, FunctionalState state)\uff09\u548c\u83b7\u53d6\u7cfb\u7edf\u65f6\u949f\u7684\u529f\u80fd\u3002\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u5176\u4e2ddev_to_rcc_table\u540c\u6837\u5b9a\u4e49\u5728\u7d22\u5f15\u6587\u4ef6stm32f407VE_define.h\u4e2d\u3002<a href=\"http:\/\/blogs.gongqilin.cn\/wp-content\/uploads\/2021\/03\/2021030208390640.png\" rel=\"box\" class=\"fancybox\"><img class=\"aligncenter size-full wp-image-132\" data-original=\"http:\/\/blogs.gongqilin.cn\/wp-content\/uploads\/2021\/03\/2021030208390640.png\"  alt=\"\" \/><\/a><\/p>\n<noscript><img loading=\"lazy\" decoding=\"async\" width=\"733\" height=\"316\" class=\"aligncenter size-full wp-image-132\" src=\"http:\/\/blogs.gongqilin.cn\/wp-content\/uploads\/2021\/03\/2021030208390640.png\" alt=\"\" \/><\/a><\/p><\/noscript>\n<p style=\"padding-left: 80px;\">\u63a5\u7740\u4e0a\u9762\u6253\u5f00\u4e32\u53e3\u65f6\u949f\uff0c\u76f4\u63a5\u8c03\u7528 rcc_clock_cmd((uint32_t)mUSARTx, ENABLE); \/\/\u6253\u5f00\u4e32\u53e3\u65f6\u949f\uff0c\u5176\u4e2dmUSARTx\u6709\u7c7bCUsart\u63d0\u4f9b\u3002\u63a5\u7740\u5f00\u59cb\u914d\u7f6e\u4e32\u53e3\u7684\u4e2d\u65ad\uff0c\u90a3\u5c31\u9700\u8981\u7528\u5230\u4e0b\u9762\u7684nvic\u6587\u4ef6\u63d0\u4f9b\u7684\u529f\u80fd\u3002<\/p>\n<p style=\"padding-left: 40px;\"><span style=\"font-size: 12pt;\"><strong>\u521b\u5efanvic\u6587\u4ef6<\/strong><\/span><\/p>\n<p style=\"padding-left: 80px;\">nvic\u6587\u4ef6\u4e3b\u8981\u662f\u5bf9mcu\u7684\u4e2d\u65ad\u8fdb\u884c\u914d\u7f6e\uff0c\u63d0\u4f9b\u4e86\u4e2d\u65ad\u4f18\u5148\u7ea7\u5206\u7ec4\u914d\u7f6e\uff0c\u6839\u636e\u8bbe\u5907\u5730\u5740\u548c\u5176\u5bf9\u5e94\u7684\u7b2c\u51e0\u4e2a\u4e2d\u65ad\u7d22\u5f15\uff0c\u67e5\u627e\u51fa\u5bf9\u5e94\u7684\u4e2d\u65ad\u53f7\uff0c\u8bbe\u7f6e\u5176\u4e2d\u65ad\u4f18\u5148\u7ea7\uff0c\u5f00\u542f\u8bbe\u5907\u5730\u5740\u548c\u7d22\u5f15\u5bf9\u5e94\u7684\u4e2d\u65ad\u53f7\u7684\u4e2d\u65ad \u7b49\u529f\u80fd\u3002<\/p>\n<p style=\"padding-left: 80px;\">\u63a5\u7740\u4e0a\u9762\u7684\u914d\u7f6e\u4e32\u53e3\u4e2d\u65ad\uff0c\u8bbe\u7f6e\u4e32\u53e3\u4f18\u5148\u7ea7nvic_dev_set_priority((uint32_t)mUSARTx, 0, preemption_priority, sub_priority);\u4f7f\u80fd\u4e32\u53e3\u4e2d\u65adnvic_dev_enable((uint32_t)mUSARTx, 0);\u63a5\u7740\u521d\u59cb\u5316\u4e00\u4e9b\u4e32\u53e3\u7684\u5de5\u4f5c\u6a21\u5f0f\u540e\u5c31\u5b8c\u6210\u4e86\u5bf9\u4e32\u53e3\u7684\u914d\u7f6e\uff0c\u53ea\u6709\u4e32\u53e3\u63d0\u4f9b\u7684\u63a5\u53e3\u5b8c\u5584\u4e14\u6b63\u786e\uff0c\u90a3\u4e48\u5373\u4f7f\u4e0b\u6b21\u66f4\u6362\u4e32\u53e3PB6\/PB7\uff0c\u5168\u5de5\u7a0b\u53ea\u9700\u4fee\u6539CUsart usart1(USART1, &amp;PB6, &amp;PB7);\u5c31\u53ef\u4ee5\u4e86<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e3a\u4e86C++\u6784\u5efaSTM32\u7684\u5de5\u7a0b\u6a21\u677f\u5c3d\u53ef\u80fd\u964d\u4f4e\u8f6f\u4ef6\u7684\u903b\u8f91\u5904\u7406\u90e8\u5206\u4e0e\u786c\u4ef6\u7684\u8026\u5408\uff0c\u53ef\u4ee5\u4f7f\u4e1a\u52a1\u76f8\u5173\u529f\u80fd\u8131\u79bb\u786c\u4ef6\u8fd0\u884c\u3002\u6240 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-114","post","type-post","status-publish","format-standard","hentry","category-c"],"_links":{"self":[{"href":"https:\/\/blogs.gongqilin.cn\/index.php?rest_route=\/wp\/v2\/posts\/114","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.gongqilin.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.gongqilin.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.gongqilin.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.gongqilin.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=114"}],"version-history":[{"count":12,"href":"https:\/\/blogs.gongqilin.cn\/index.php?rest_route=\/wp\/v2\/posts\/114\/revisions"}],"predecessor-version":[{"id":133,"href":"https:\/\/blogs.gongqilin.cn\/index.php?rest_route=\/wp\/v2\/posts\/114\/revisions\/133"}],"wp:attachment":[{"href":"https:\/\/blogs.gongqilin.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.gongqilin.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=114"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.gongqilin.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}