{"id":56670,"date":"2023-10-22T19:51:22","date_gmt":"2023-10-22T11:51:22","guid":{"rendered":"https:\/\/www.techphant.cn\/?p=56670"},"modified":"2023-10-22T19:51:22","modified_gmt":"2023-10-22T11:51:22","slug":"hkszck","status":"publish","type":"post","link":"https:\/\/www.techphant.cn\/blog\/56670.html","title":{"rendered":"HAL\u5e93\u8bbe\u7f6e\u4e32\u53e3"},"content":{"rendered":"
\u4e32\u53e3\u662f\u8ba1\u7b97\u673a\u4e2d\u4e00\u79cd\u91cd\u8981\u7684\u63a5\u53e3\uff0c\u5b83\u53ef\u4ee5\u7528\u4e8e\u4e0e\u5916\u90e8\u7684\u8bbe\u5907\u8fdb\u884c\u901a\u4fe1\uff0c\u4ece\u800c\u5b9e\u73b0\u63a7\u5236\u548c\u6570\u636e\u4f20\u8f93\u3002\u4e3a\u4e86\u4f7f\u7528\u4e32\u53e3\uff0c\u6211\u4eec\u9700\u8981\u8bbe\u7f6e\u4e32\u53e3\uff0c\u4f7f\u5176\u80fd\u591f\u6b63\u5e38\u5de5\u4f5c\u3002HAL\u5e93\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u5e93\uff0c\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u5b9e\u73b0\u4e32\u53e3\u7684\u8bbe\u7f6e\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528HAL\u5e93\u8bbe\u7f6e\u4e32\u53e3\uff0c\u4ee5\u53ca\u5982\u4f55\u5b9e\u73b0\u4e32\u53e3\u7684\u529f\u80fd\u3002<\/p>\n
HAL\u5e93\uff08\u786c\u4ef6\u62bd\u8c61\u5c42\u5e93\uff09\u662f\u4e00\u4e2a\u7528\u4e8e\u7ba1\u7406\u786c\u4ef6\u8bbe\u5907\u7684\u5e93\uff0c\u5b83\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u5b9e\u73b0\u5bf9\u786c\u4ef6\u8bbe\u5907\u7684\u63a7\u5236\u548c\u7ba1\u7406\u3002HAL\u5e93\u63d0\u4f9b\u4e86\u4e00\u7cfb\u5217\u7684API\uff0c\u53ef\u4ee5\u7528\u6765\u63a7\u5236\u786c\u4ef6\u8bbe\u5907\uff0c\u5305\u62ec\u4e32\u53e3\u3001I2C\u3001SPI\u7b49\u7b49\u3002HAL\u5e93\u5177\u6709\u8de8\u5e73\u53f0\u7684\u4f18\u52bf\uff0c\u53ef\u4ee5\u7528\u4e8e\u591a\u79cd\u82af\u7247\u548c\u64cd\u4f5c\u7cfb\u7edf\uff0c\u56e0\u6b64\u5728\u8bbe\u7f6e\u4e32\u53e3\u65f6\u53ef\u4ee5\u5f88\u65b9\u4fbf\u5730\u4f7f\u7528HAL\u5e93\u3002<\/p>\n
\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u4f7f\u7528HAL\u5e93\u6765\u521d\u59cb\u5316\u4e32\u53e3\uff0c\u4ee5\u4fbf\u5b83\u53ef\u4ee5\u6b63\u5e38\u5de5\u4f5c\u3002HAL\u5e93\u63d0\u4f9b\u4e86\u4e00\u4e2a\u53eb\u505ahal_uart_init()\u7684API\uff0c\u53ef\u4ee5\u7528\u6765\u521d\u59cb\u5316\u4e32\u53e3\u3002\u6b64API\u9700\u8981\u4f20\u5165\u4e00\u4e2ahal_uart_config_t\u7ed3\u6784\u4f53\uff0c\u5176\u4e2d\u5305\u542b\u4e86\u4e32\u53e3\u7684\u914d\u7f6e\u53c2\u6570\uff0c\u5305\u62ec\u6ce2\u7279\u7387\u3001\u6821\u9a8c\u4f4d\u3001\u6570\u636e\u4f4d\u7b49\u7b49\u3002<\/p>\n
\u5f53\u4e32\u53e3\u521d\u59cb\u5316\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u4f7f\u7528HAL\u5e93\u7684API\u6765\u53d1\u9001\u6570\u636e\u3002HAL\u5e93\u63d0\u4f9b\u4e86\u4e00\u4e2a\u53eb\u505ahal_uart_send()\u7684API\uff0c\u53ef\u4ee5\u7528\u6765\u53d1\u9001\u6570\u636e\u3002\u6b64API\u9700\u8981\u4f20\u5165\u4e00\u4e2a\u5b57\u7b26\u4e32\u6307\u9488\uff0c\u7528\u4e8e\u6307\u5b9a\u8981\u53d1\u9001\u7684\u6570\u636e\u3002<\/p>\n
\u5f53\u6211\u4eec\u9700\u8981\u4ece\u4e32\u53e3\u63a5\u6536\u6570\u636e\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528HAL\u5e93\u7684hal_uart_receive() API\u6765\u5b9e\u73b0\u3002\u6b64API\u9700\u8981\u4f20\u5165\u4e00\u4e2a\u5b57\u7b26\u4e32\u6307\u9488\uff0c\u7528\u4e8e\u6307\u5b9a\u8981\u63a5\u6536\u7684\u6570\u636e\u3002\u5f53\u63a5\u6536\u5230\u6570\u636e\u65f6\uff0c\u4f1a\u5c06\u6570\u636e\u5b58\u50a8\u5230\u6307\u5b9a\u7684\u5b57\u7b26\u4e32\u6307\u9488\u4e2d\u3002<\/p>\n
\u672c\u6587\u4ecb\u7ecd\u4e86\u5982\u4f55\u4f7f\u7528HAL\u5e93\u8bbe\u7f6e\u4e32\u53e3\uff0c\u4ee5\u53ca\u5982\u4f55\u5b9e\u73b0\u4e32\u53e3\u7684\u529f\u80fd\u3002<\/strong>HAL\u5e93\u63d0\u4f9b\u4e86\u4e00\u7cfb\u5217\u7684API\uff0c\u53ef\u4ee5\u7528\u6765\u63a7\u5236\u786c\u4ef6\u8bbe\u5907\uff0c\u5305\u62ec\u4e32\u53e3\u3001I2C\u3001SPI\u7b49\u7b49\u3002\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528HAL\u5e93\u7684API\u6765\u5b9e\u73b0\u4e32\u53e3\u7684\u521d\u59cb\u5316\u3001\u53d1\u9001\u6570\u636e\u548c\u63a5\u6536\u6570\u636e\u3002HAL\u5e93\u5177\u6709\u8de8\u5e73\u53f0\u7684\u4f18\u52bf\uff0c\u53ef\u4ee5\u7528\u4e8e\u591a\u79cd\u82af\u7247\u548c\u64cd\u4f5c\u7cfb\u7edf\uff0c\u56e0\u6b64\u5728\u8bbe\u7f6e\u4e32\u53e3\u65f6\u53ef\u4ee5\u5f88\u65b9\u4fbf\u5730\u4f7f\u7528HAL\u5e93\u3002<\/p>\n","protected":false},"excerpt":{"rendered":" \u4e32\u53e3\u662f\u8ba1\u7b97\u673a\u4e2d\u4e00\u79cd\u91cd\u8981\u7684\u63a5\u53e3\uff0c\u5b83\u53ef\u4ee5\u7528\u4e8e\u4e0e\u5916\u90e8\u7684\u8bbe\u5907\u8fdb\u884c\u901a\u4fe1\uff0c\u4ece\u800c\u5b9e\u73b0\u63a7\u5236\u548c\u6570\u636e\u4f20\u8f93\u3002\u4e3a\u4e86\u4f7f\u7528\u4e32\u53e3\uff0c\u6211\u4eec\u9700\u8981\u8bbe\u7f6e\u4e32\u53e3\uff0c\u4f7f\u5176\u80fd\u591f\u6b63\u5e38\u5de5\u4f5c\u3002HAL\u5e93\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u5e93\uff0c\u53ef\u4ee5\u5e2e\u52a9\u6211<\/p>\n","protected":false},"author":1,"featured_media":4132,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"categories":[36],"tags":[69],"class_list":["post-56670","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-cktx"],"_links":{"self":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/56670","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/comments?post=56670"}],"version-history":[{"count":0,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/56670\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media\/4132"}],"wp:attachment":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media?parent=56670"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/categories?post=56670"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/tags?post=56670"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}