<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Port an MBED design to non-MBED - Phase 2a: DigitalOut Class Constructor</title><link>/technologies/embedded/b/blog/posts/port-an-mbed-design-to-non-mbed---phase-2a-digitalout-class-constructor</link><description>I&amp;#39;ve ported the MBED DigitalOut class to the Hercules controller that I&amp;#39;ll be using.It could be any controller or SBC, but having one example makes it tangible. I&amp;#39;ve try to do this with as limited as possible impact to the SemTech library. That ...</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Port an MBED design to non-MBED - Phase 2a: DigitalOut Class Constructor</title><link>https://community.element14.com/technologies/embedded/b/blog/posts/port-an-mbed-design-to-non-mbed---phase-2a-digitalout-class-constructor</link><pubDate>Tue, 12 Nov 2019 16:37:51 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:b22a0c2c-203d-4e8d-b334-cbda0db139fa</guid><dc:creator>Jan Cumps</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;The port of this class is now complete. &lt;a class="jive-link-blog-small" href="/technologies/embedded/b/blog/posts/port-an-mbed-design-to-non-mbed---phase-2b-digitalout-class-and-blinky-example"&gt;See here for the full code an some explanation&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I have made some changes to the constructor. The one described here needs board knowledge (the pin and port data members). In the final version that is abstracted out to the board dependent definitions.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=8179&amp;AppID=7&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Port an MBED design to non-MBED - Phase 2a: DigitalOut Class Constructor</title><link>https://community.element14.com/technologies/embedded/b/blog/posts/port-an-mbed-design-to-non-mbed---phase-2a-digitalout-class-constructor</link><pubDate>Mon, 11 Nov 2019 22:24:08 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:b22a0c2c-203d-4e8d-b334-cbda0db139fa</guid><dc:creator>fmilburn</dc:creator><slash:comments>2</slash:comments><description>&lt;p&gt;Hi Jan,&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I believe there is a typo&lt;/p&gt;&lt;blockquote class="jive-quote"&gt;&lt;p&gt;What I did id somewhat sneakier, and controversial on a 32-bit microcontroller.&lt;/p&gt;&lt;p&gt;I defined the PinName type as a 32 bit unsigned integer.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;PinName is uint64_ so 64 bit.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Is this approach controversial because not all microcontrollers implement 64 bit integers?&amp;nbsp; I am learning a lot from reading this series btw.&amp;nbsp; &lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=8179&amp;AppID=7&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Port an MBED design to non-MBED - Phase 2a: DigitalOut Class Constructor</title><link>https://community.element14.com/technologies/embedded/b/blog/posts/port-an-mbed-design-to-non-mbed---phase-2a-digitalout-class-constructor</link><pubDate>Mon, 11 Nov 2019 22:09:24 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:b22a0c2c-203d-4e8d-b334-cbda0db139fa</guid><dc:creator>Jan Cumps</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;STM &lt;a class="jive-link-external-small" href="http://www.awesomeband.nz/kieren/Arduino_Core_STM32/blob/1003930587362dec2c8562c1db713a9fb20ceace/cores/arduino/stm32/PinNamesTypes.h" rel="nofollow ugc noopener" target="_blank"&gt;did it simpler&lt;/a&gt;, but not unlike me.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span lang="c"&gt;// High nibble = port number (FirstPort &amp;lt;= PortName &amp;lt;= LastPort)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span lang="c"&gt;// Low nibble = pin number&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span lang="c"&gt;#define STM_PORT(X) (((uint32_t)(X) &amp;gt;&amp;gt; 4) &amp;amp; 0xF)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span lang="c"&gt;#define STM_PIN(X) ((uint32_t)(X) &amp;amp; 0xF)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span lang="c"&gt;They can do that because in their API, the ports aren&amp;#39;t 32 bit addresses but a low number like 1, 2, 3.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span lang="c"&gt;I could have kept it to a single 32 bit variable too with a little redirection, by putting all the available I/O ports in lookup table (there are a decent lot, because you can use almost all peripherals as I/O).&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span lang="c"&gt;Then my high nibble would be the index into that table.&lt;/span&gt;&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=8179&amp;AppID=7&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>