{"id":3224,"date":"2012-06-16T02:41:32","date_gmt":"2012-06-16T06:41:32","guid":{"rendered":"https:\/\/example.com\/?postname=stm32f4-configpin"},"modified":"2012-06-16T02:41:32","modified_gmt":"2012-06-16T06:41:32","slug":"stm32f4-configpin","status":"publish","type":"post","link":"http:\/\/atomsofttech.com\/blog\/uncategorized\/stm32f4-configpin\/","title":{"rendered":"STM32F4 ConfigPin"},"content":{"rendered":"<p>Ok im getting tired of how that CMSIS is setup and find it to be more of hassle.Here is a simple but very useful function:<\/p>\n<div id=\"codeSnippetWrapper\" style=\"text-align:left;line-height:12pt;background-color:#f4f4f4;margin:20px 0 10px;width:97.5%;font-family:'Courier New', courier, monospace;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;cursor:text;padding:4px;border:silver 1px solid;\">\n<pre style=\"text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;\"><span style=\"color:#0000ff;\">void<\/span> ConfigPin(GPIO_TypeDef *myGPIO, uint32_t PIN, uint32_t MODE, uint32_t SPEED, uint32_t PUPD)\n{\n    <span style=\"color:#008000;\">\/*<\/span>\n<span style=\"color:#008000;\"> myGPIO: The GPIOx port for the selected pin<\/span>\n\n<span style=\"color:#008000;\"> MODE: 0 = INPUT .... 1 = OUTPUT .... 2 = ALTERNATE FUNCTION .... 3 = ANALOG<\/span>\n\n<span style=\"color:#008000;\"> SPEED: 0 = 2MHz (Low Speed) .... 1 = 25MHz (Med. Speed) .... 2 = 50MHz (Fast Speed) .... 3 = 100MHz\/80MHz (High Speed)(100MHz(30pf) - 80MHz(15pf))<\/span>\n\n<span style=\"color:#008000;\"> PUPD: 0 = No Pull-Up \/ No Pull-Down .... 1 = Pull-Up Enabled .... 2 = Pull-Down Enabled .... 3 = Reserved<\/span>\n<span style=\"color:#008000;\"> *\/<\/span>\n    myGPIO-&gt;MODER |= (MODE &lt;&lt; (PIN * 2));<span style=\"color:#008000;\">\/\/OUTPUT<\/span>\n    myGPIO-&gt;OSPEEDR |= (SPEED &lt;&lt; (PIN * 2));<span style=\"color:#008000;\">\/\/50MHz<\/span>\n    myGPIO-&gt;PUPDR |= (PUPD &lt;&lt; (PIN * 2));   <span style=\"color:#008000;\">\/\/Set it for NO PUPD<\/span>\n}<\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Ok im getting tired of how that CMSIS is setup and find it to be more of hassle.Here is a simple but very useful function: void ConfigPin(GPIO_TypeDef *myGPIO, uint32_t PIN, uint32_t MODE, uint32_t SPEED, uint32_t PUPD) { \/* myGPIO: The GPIOx port for the selected pin MODE: 0 = INPUT &#8230;. 1 = OUTPUT &#8230;. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-3224","post","type-post","status-publish","format-standard","hentry"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/atomsofttech.com\/blog\/wp-json\/wp\/v2\/posts\/3224","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/atomsofttech.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/atomsofttech.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/atomsofttech.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/atomsofttech.com\/blog\/wp-json\/wp\/v2\/comments?post=3224"}],"version-history":[{"count":0,"href":"http:\/\/atomsofttech.com\/blog\/wp-json\/wp\/v2\/posts\/3224\/revisions"}],"wp:attachment":[{"href":"http:\/\/atomsofttech.com\/blog\/wp-json\/wp\/v2\/media?parent=3224"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/atomsofttech.com\/blog\/wp-json\/wp\/v2\/categories?post=3224"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/atomsofttech.com\/blog\/wp-json\/wp\/v2\/tags?post=3224"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}