<?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>SCPI on a Linux Board - Part 2b: PiFace Digital C++ programming</title><link>/technologies/test-and-measurement/b/blog/posts/scpi-on-a-linux-board---part-2b-piface-digital-c-programming</link><description>I&amp;#39;m building a SCPI electronics lab instrument for Linux.This post is an object oriented one: porting the PiFace Digital API to C++. If you aren&amp;#39;t interested in object oriented design, you may want to walk away from this blog. API and Abstr...</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: SCPI on a Linux Board - Part 2b: PiFace Digital C++ programming</title><link>https://community.element14.com/technologies/test-and-measurement/b/blog/posts/scpi-on-a-linux-board---part-2b-piface-digital-c-programming</link><pubDate>Sun, 24 Jun 2018 13:45:42 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:328cf4ed-5051-45ee-a9fd-374ffb59dc0f</guid><dc:creator>Jan Cumps</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;For the OO lovers, I&amp;#39;ve added the next subject: using C++ streams to handle TCP/IP traffic.&lt;/p&gt;&lt;p&gt;I&amp;#39;ll use them to get commands and send replies over a network port.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;a class="jive-link-blog-small" href="/technologies/test-and-measurement/b/blog/posts/scpi-on-a-linux-board---part-3-tcp-ip-socket-c-programming"&gt;SCPI on a Linux Board - Part 3: TCP/IP Socket C++ programming&lt;/a&gt; &lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=5011&amp;AppID=13&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: SCPI on a Linux Board - Part 2b: PiFace Digital C++ programming</title><link>https://community.element14.com/technologies/test-and-measurement/b/blog/posts/scpi-on-a-linux-board---part-2b-piface-digital-c-programming</link><pubDate>Fri, 22 Jun 2018 21:27:49 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:328cf4ed-5051-45ee-a9fd-374ffb59dc0f</guid><dc:creator>Jan Cumps</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;&lt;span&gt;[View:/resized-image/__size/702x72/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-328cf4ed-5051-45ee-a9fd-374ffb59dc0f/contentimage_5F00_188146.png:702:72]&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;This disclaimer seems to have missed its purpose &lt;span&gt;[View:/resized-image/__size/16x16/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-328cf4ed-5051-45ee-a9fd-374ffb59dc0f/contentimage_5F00_1.png:16:16]&lt;/span&gt;.&lt;/p&gt;&lt;p&gt;On the other hand, I like the way the comments go. Civil and to the point reactions. &lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=5011&amp;AppID=13&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: SCPI on a Linux Board - Part 2b: PiFace Digital C++ programming</title><link>https://community.element14.com/technologies/test-and-measurement/b/blog/posts/scpi-on-a-linux-board---part-2b-piface-digital-c-programming</link><pubDate>Fri, 22 Jun 2018 20:13:43 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:328cf4ed-5051-45ee-a9fd-374ffb59dc0f</guid><dc:creator>DAB</dc:creator><slash:comments>3</slash:comments><description>&lt;p&gt;While there are some merits to OO design, it does come with a lot of code overhead.&lt;/p&gt;&lt;p&gt;In most embedded designs you are looking for efficiency in every aspect.&lt;/p&gt;&lt;p&gt;Code bloat you do not need, which is why C has dominated the software for so long. It is clean and efficient, albeit dangerous to the novice programmer.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;As with all things, each programming language and approach has a domain for which it was intended.&lt;/p&gt;&lt;p&gt;C++ is not a panacea for all software.&lt;/p&gt;&lt;p&gt;In the embedded world, less is more.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Just my opinion after dealing with these issues for the last 40 years.&lt;/p&gt;&lt;p&gt;There is no ONE language or design approach.&lt;/p&gt;&lt;p&gt;I still use structured analysis and design methods because they still work best for me in embedded applications.&lt;/p&gt;&lt;p&gt;There is a good place for OO, but not necessarily in embedded systems.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;DAB&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=5011&amp;AppID=13&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: SCPI on a Linux Board - Part 2b: PiFace Digital C++ programming</title><link>https://community.element14.com/technologies/test-and-measurement/b/blog/posts/scpi-on-a-linux-board---part-2b-piface-digital-c-programming</link><pubDate>Fri, 22 Jun 2018 18:25:11 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:328cf4ed-5051-45ee-a9fd-374ffb59dc0f</guid><dc:creator>jomoenginer</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;I applaud your use of C++ in your project. There still seems to be some hesitation to move to more C++ in Embedded development which Michael Barr&amp;#39;s recent study has shown indicating an actual decline in the use of C++ in Embedded dev. It does seem to pop up quite a bit in interview questions though. &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;However, with the code you presented, I wonder if it might be best served to use the mcp23s17 class as a Base class for PifaceDigital and just inherent the methods from mcp23s17.&amp;nbsp; Also, your member variables are left as public meaning they can be accessed by anyone creating an object of PifaceDigital.&amp;nbsp; Is there a reason why you did not hide these and implement getter and setters for these variables? Moving into C++11 and above land with constexp, auto and templates might be interesting.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks for sharing this.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=5011&amp;AppID=13&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: SCPI on a Linux Board - Part 2b: PiFace Digital C++ programming</title><link>https://community.element14.com/technologies/test-and-measurement/b/blog/posts/scpi-on-a-linux-board---part-2b-piface-digital-c-programming</link><pubDate>Fri, 22 Jun 2018 18:22:10 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:328cf4ed-5051-45ee-a9fd-374ffb59dc0f</guid><dc:creator>Jan Cumps</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;To make this OO api work on multiple Piface digital hats, I have to implement an object count.&lt;/p&gt;&lt;p&gt;Because I allocate the access to the particular SPI resource exclusively, I have to share that access across all objects in my code.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;That means that I should not request exclusive access if it&amp;#39;s already been granted, and that I should not release it before the last object closes.&lt;/p&gt;&lt;p&gt;There are solutions for that (thank you Gang of Four). I will re-read the applicable chapters of that book and implement the right measures.&lt;/p&gt;&lt;p&gt;In the mean time, my code only only supports a single PiFace Digital hat per Pi. &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;The original procedural C API is resilient to this. Use that for the moment if you have a project with more than one Piface Digital hat. Or help me improve my OO API if you need it.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;This is not a C++ limitation. It&amp;#39;s me running out of time.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=5011&amp;AppID=13&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>