<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>LeafLabs Garden &#187; Topic: Pins as objects - Wiring API 2.0?</title>
		<link>http://forums.leaflabs.com/topic.php?id=9685</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:18:44 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://forums.leaflabs.com/search.php</link>
		</textInput>
		<atom:link href="http://forums.leaflabs.com/rss.php?topic=9685" rel="self" type="application/rss+xml" />

		<item>
			<title>gbulmer on "Pins as objects - Wiring API 2.0?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=9685&amp;page=2#post-21367</link>
			<pubDate>Fri, 30 Nov 2012 13:26:35 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">21367@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;StephenFromNYC - You are always welcome; I'm pleased to be of help.&#60;/p&#62;
&#60;p&#62;BYOB is much more interesting than Scratch! I think the OU might have started with BYOB instead of extending Scratch to make Sense, it BYOB had been around.&#60;br /&#62;
IMHO Snap! is more interesting than proprietary and Flash-based (i.e proprietary platform) Scratch-like systems that run within the browser, for obvious reasons. If folks haven't tried Snap!, I strongly encourage them to have a look, even though it is 'Alpha' quality.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>StephenFromNYC on "Pins as objects - Wiring API 2.0?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=9685&amp;page=2#post-21363</link>
			<pubDate>Fri, 30 Nov 2012 08:35:48 +0000</pubDate>
			<dc:creator>StephenFromNYC</dc:creator>
			<guid isPermaLink="false">21363@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Thanks!&#60;/p&#62;
&#60;p&#62;I am glad I asked, because the Build Your Own Blocks (BYOB) project was not one of the Snap! sites I found using Google.&#60;/p&#62;
&#60;p&#62;Now I understand why you find BYOB-Snap so appealing.  Thanks for sharing the resource.&#60;/p&#62;
&#60;p&#62;Stephen from NYC
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "Pins as objects - Wiring API 2.0?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=9685&amp;page=2#post-21347</link>
			<pubDate>Thu, 29 Nov 2012 19:08:15 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">21347@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;StephenFromNYC - &#60;a href=&#34;http://byob.berkeley.edu/#snap4.0&#34; rel=&#34;nofollow&#34;&#62;http://byob.berkeley.edu/#snap4.0&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>StephenFromNYC on "Pins as objects - Wiring API 2.0?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=9685&amp;page=2#post-21345</link>
			<pubDate>Thu, 29 Nov 2012 18:59:58 +0000</pubDate>
			<dc:creator>StephenFromNYC</dc:creator>
			<guid isPermaLink="false">21345@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;@gbulmer,&#60;/p&#62;
&#60;p&#62;In an &#60;a href=&#34;http://forums.leaflabs.com/topic.php?id=9685&#38;amp;replies=16#post-21292&#34;&#62;earlier post in this thread&#60;/a&#62; you mentioned &#34;Snap!&#34;  I found a few open source projects with Snap in their names, but it was not clear which one you were describing.&#60;/p&#62;
&#60;p&#62;I could post all my &#34;Snap!&#34; links here here, but I am afraid doing this (listing both the correct and incorrect links) could confuse the conversation.&#60;/p&#62;
&#60;p&#62;Can you give us the URL for the Snap! project you like?&#60;/p&#62;
&#60;p&#62;Thanks!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "Pins as objects - Wiring API 2.0?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=9685#post-21343</link>
			<pubDate>Thu, 29 Nov 2012 18:25:59 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">21343@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;modkit -&#60;br /&#62;
&#60;blockquote&#62;The larger discussion is &#34;Pins as objects&#34; towards a Wiring API 2.0 implementation/proposal. I agree this should be discussed in public. I was asking for your email as a way to &#34;loop you in to the larger discussion&#34; which would probably happen elsewhere as this is a larger discussion than the STM32 implementation mainly supported and discussed here.&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;So where is the &#34;larger discussion&#34; happening?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>modkit on "Pins as objects - Wiring API 2.0?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=9685#post-21339</link>
			<pubDate>Thu, 29 Nov 2012 11:48:23 +0000</pubDate>
			<dc:creator>modkit</dc:creator>
			<guid isPermaLink="false">21339@http://forums.leaflabs.com/</guid>
			<description>&#60;blockquote&#62;&#60;p&#62;
I disagree with said direction (I also believe IOS is about the last thing I would like to see come out of this discussion).
&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;I referred to IOS being built on top of a POSIX OS to say that we don't need to make decisions about a well formed API vs. easy implementation that can simply live on top of it.  Let's not be polarized by IOS' restrictions or proprietary nature when discussing &#34;easy&#34; as IOS' ease of use is probably exactly where Android wants to end up.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;
&#34;what is the best way to expose common microcontroller functionality (GPIO, USB, I2C, etc) at the lowest possible cross-device level &#34;?&#60;/p&#62;
&#60;p&#62;Is the meat of it. I believe the obsession with oop is part of the problem (zb look at the arduino EEPROM library / reduced functionality increased overhead on top of a library that wasn't broken). I would like to see more stdlib like, c based work exposed (then when the foundations are built oop it up all you want)
&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;You'll see we're looking at this the other way.  We have a harder requirement (than anyone here has explained) for a C API (see first post) but are still advocating for C++ at the core.  Why is that?  We certainly don't have an obsession with OOP or even want to expose it to our Modkit Micro users.  We're advocating for this because we think objects are the right way to organize pins at the low level.&#60;/p&#62;
&#60;p&#62;Wikipedia describes Objects as &#34;data structures combined with the associated processing routines&#34;.  Why do we need objects then?  Because our C API (based on Wiring) abstracts the physical pins so that a single identifier (int/uint_8 - our &#34;data&#34;) can be used to call the various peripheral functionality exposed on that pin (our &#34;processing routines&#34;).  This would be fine as is except that the actual processing routines don't accept a single identifier when referencing the same physical pin for different uses.  So you need to store this mapping somewhere.  We think the &#34;best&#34; way to do this is directly from a pin object which keeps references to the various identifiers for the given pin's functionality.  &#60;/p&#62;
&#60;p&#62;The original post we referred to starts to explore some of the reasons this could be more efficient than any non-class-based approach to pin mapping.  If you're not interested in understanding why this can be the case, that's fine, but I believe the space and runtime efficiency of one approach vs. the other is provable so this is not a question of style or preference.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>modkit on "Pins as objects - Wiring API 2.0?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=9685#post-21338</link>
			<pubDate>Thu, 29 Nov 2012 11:18:41 +0000</pubDate>
			<dc:creator>modkit</dc:creator>
			<guid isPermaLink="false">21338@http://forums.leaflabs.com/</guid>
			<description>&#60;blockquote cite=&#34;gbulmer&#34;&#62;&#60;p&#62;
Please clarify the aims, goals, and terms of that 'larger discussion'.&#60;br /&#62;
I don' understand why my experience and ideas might go to waste by discussing them here, in the open. Would you please clarify your rationale for saying that?&#60;br /&#62;
I'd rather discuss this stuff in public so we can all benefit, or have some clear, up-front, explanation.
&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;The larger discussion is &#34;Pins as objects&#34; towards a Wiring API 2.0 implementation/proposal.  I agree this should be discussed in public.  I was asking for your email as a way to &#34;loop you in to the larger discussion&#34; which would probably happen elsewhere as this is a larger discussion than the STM32 implementation mainly supported and discussed here.&#60;/p&#62;
&#60;blockquote cite=&#34;gbulmer&#34;&#62;&#60;p&#62;
modkit - IMHO Snap! is a far better basis for my interests than Modkit because:&#60;br /&#62;
1. Snap! is Open Source. AFAICT modkit is proprietary, not Open Source.&#60;br /&#62;
2. Snap! is freely available at no cost, significantly less than $50 for 1 year for modkit. So anyone can use Snap!, now.&#60;br /&#62;
3. AFAIK Modkit has been in development since, at least, March, 2009; Snap! appears to have started mid 2011, so its 'velocity' is impressively high by comparison.&#60;/p&#62;
&#60;p&#62;There is already a prototype to connect Snap! to Arduino (not by the Snap! authors).&#60;br /&#62;
Because Snap! is Open Source, making it work on different microcontrollers is not restricted to the authors; anyone can access the source and explore it.
&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;Sorry, I think you have mistaken our background (why we care about Wiring etc) as promotion of our solutions.  Our interest here is as the title states:  Pins as objects - Wiring API 2.0.  &#60;/p&#62;
&#60;blockquote cite=&#34;gbulmer&#34;&#62;&#60;p&#62;
feurig - I wrote: I am okay with class-based solutions for low-level peripheral interfaces.&#60;/p&#62;
&#60;p&#62;But I should add that doing stuff in C is easier. There is a problem which I didn't mention, and which folks need to understand before assuming it is as easy to use C++ as C for low-level code.&#60;/p&#62;
&#60;p&#62;The problem is: all the Cortex-M3 interrupt vectors call a C function. There is no way to directly call a class method on a C++ object. There are quite a lot of implications from this for C++ development.
&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;Right there are all of these implications that we'd like your input on.  Modkit's own user API is C based so we're only really concerned about a better way to keep the low level &#34;pin&#34; to peripheral mapping for our own use case.  But I think exploring a complementary C++ API would bring an even broader user base so I think it is worth identifying the issues and possible solutions.&#60;/p&#62;
&#60;p&#62;In any case, thanks again for all your comments.  Of course discussing this in public is how we found your initial thoughts.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "Pins as objects - Wiring API 2.0?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=9685#post-21319</link>
			<pubDate>Wed, 28 Nov 2012 13:13:40 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">21319@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;feurig - I wrote: &#60;em&#62;I am okay with class-based solutions for low-level peripheral interfaces.&#60;/em&#62;&#60;/p&#62;
&#60;p&#62;But I should add that doing stuff in C is easier. There is a problem which I didn't mention, and which folks need to understand before assuming it is as easy to use C++ as C for low-level code.&#60;/p&#62;
&#60;p&#62;The problem is: all the Cortex-M3 interrupt vectors call a C function. There is no way to &#60;em&#62;directly&#60;/em&#62; call a class method on a C++ object.  There are quite a lot of implications from this for C++ development.&#60;/p&#62;
&#60;p&#62;For C developers, it means that any C function can be called as an interrupt service routine on Cortex-M (there is no need to identify it as a &#60;code&#62;SIGNAL(...)&#60;/code&#62; or &#60;code&#62;ISR(...)&#60;/code&#62; handler in the code either). 'Simples' :-)&#60;/p&#62;
&#60;p&#62;For C++ developers it means that either an extra layer of code (e.g. something like an 'attach interrupt' mechanism), executed at run-time is needed, or some of the benefits of having multiple instances of a class object (to represent multiple instances of a peripheral device) can't be used because a signal handler would need to be 'static'.  C++ has costs which IMHO are subtle. &#60;/p&#62;
&#60;p&#62;Fuerig, I am confident that you understand these issues. I am just raising them for anyone else reading this thread.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "Pins as objects - Wiring API 2.0?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=9685#post-21311</link>
			<pubDate>Tue, 27 Nov 2012 12:25:16 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">21311@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;modkit&#60;br /&#62;
&#60;blockquote&#62;Also could anyone interested in this direction (especially @siy and @gbulmer) please send me an email to ed [at] modk [dot] it, so we can loop you in to the larger discussion? We'd hate to see your experience and ideas go to waste!
&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;Please clarify the aims, goals, and terms of that 'larger discussion'.&#60;br /&#62;
I don' understand why my experience and ideas might go to waste by discussing them here, in the open. Would you please clarify your rationale for saying that?&#60;br /&#62;
I'd rather discuss this stuff in public so we can all benefit, or have some clear, up-front, explanation.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "Pins as objects - Wiring API 2.0?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=9685#post-21294</link>
			<pubDate>Mon, 26 Nov 2012 20:45:31 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">21294@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;feurig - &#60;em&#62;&#34;I believe the obsession with oop is part of the problem&#34;&#60;/em&#62;&#60;/p&#62;
&#60;p&#62;I might agree (about 70+%-), however, aside from the EEPROM example, have their been any other egregious uses of OOP?&#60;/p&#62;
&#60;p&#62;I think it is confusing to new users to have more than one syntax, &#60;code&#62;object.foo()&#60;/code&#62; or &#60;code&#62;foo(pin, ...)&#60;/code&#62;.&#60;br /&#62;
As I've written before, one of my major concerns is the error messages from the compiler when code contains errors. These tend to become harder to understand when classes are used.&#60;/p&#62;
&#60;p&#62;I think the &#60;code&#62;foo(pin, ...)&#60;/code&#62; syntax works very well with simple things like digital and analogue I/O where the pins get treated as pretty much independent; most of the documentation is on the board's silkscreen.&#60;/p&#62;
&#60;p&#62;It starts to get messier when trying to deal with peripheral resources shared by pins, or pins shared by peripherals. For example if you want to manipulate one of three ADC's that can sample a shared pin, or change which ADC is sampling the pin. It gets even worse when there are several peripheral on different pins, and alternative peripherals are only on specific pins. That is when some sort of abstraction other than an integer becomes useful. This isn't automatically inefficient, though (my) simple solutions tend to become pointers :-) &#60;/p&#62;
&#60;p&#62;I find it takes time and care to do a good job of an API no matter which approach is used. I need to write programs that use the API to get a feel for how it is working out. Those programs become the 'use cases' and 'integration tests' for the API.&#60;/p&#62;
&#60;p&#62;IMHO a problem is C++ class mechanisms are 'brittle' and create work if the class relationships aren't just right. But, I don't feel we should blame OOP for weaknesses in C++ or lack of care in design and implementation. OOP is a much bigger hammer than simple functions, so KISS applies even more so. &#60;/p&#62;
&#60;p&#62;Summary: I am okay with class-based solutions for low-level peripheral interfaces. However OOP is hard to do well, easy to mess up, hard to improve without breaking code, easy to over complicate, and only significantly help for complex peripheral hardware, or for flexibility, which often doesn't matter :-)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>feurig on "Pins as objects - Wiring API 2.0?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=9685#post-21293</link>
			<pubDate>Mon, 26 Nov 2012 15:49:42 +0000</pubDate>
			<dc:creator>feurig</dc:creator>
			<guid isPermaLink="false">21293@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Modkit,&#60;/p&#62;
&#60;p&#62;I disagree with said direction (I also believe IOS is about the last thing I would like to see come out of this discussion). &#60;/p&#62;
&#60;p&#62;That said,&#60;/p&#62;
&#60;p&#62;&#34;what is the best way to expose common microcontroller functionality (GPIO, USB, I2C, etc) at the lowest possible cross-device level &#34;?&#60;/p&#62;
&#60;p&#62;Is the meat of it. I believe the obsession with oop is part of the problem (zb look at the arduino EEPROM library / reduced functionality increased overhead on top of a library that wasn't broken).  I would like to see more stdlib like, c based work exposed (then when the foundations are built oop it up all you want) &#60;/p&#62;
&#60;p&#62;That is where I am headed.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "Pins as objects - Wiring API 2.0?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=9685#post-21292</link>
			<pubDate>Mon, 26 Nov 2012 12:44:16 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">21292@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;modkit - IMHO Snap! is a far better basis for my interests than Modkit because:&#60;br /&#62;
1. Snap! is Open Source. AFAICT modkit is &#60;em&#62;proprietary&#60;/em&#62;, &#60;em&#62;not&#60;/em&#62; Open Source.&#60;br /&#62;
2. Snap! is freely available at no cost, significantly less than $50 for 1 year for modkit. So anyone can use Snap!, now.&#60;br /&#62;
3. AFAIK Modkit has been in development since, at least, March, 2009; Snap! appears to have started mid 2011, so its 'velocity' is impressively high by comparison.&#60;/p&#62;
&#60;p&#62;There is already a prototype to connect Snap! to Arduino (not by the Snap! authors).&#60;br /&#62;
Because Snap! is Open Source, making it work on different microcontrollers is not restricted to the authors; anyone can access the source and explore it.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>modkit on "Pins as objects - Wiring API 2.0?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=9685#post-21278</link>
			<pubDate>Sun, 25 Nov 2012 22:30:42 +0000</pubDate>
			<dc:creator>modkit</dc:creator>
			<guid isPermaLink="false">21278@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;@feurig and @gbulmer - Thanks for your comments.  I don't know the state of Maple/Arduino/Wiring on STM32 but there seemed to be some good ideas here for how to evolve the Wiring API so we thought we'd say hi.  &#60;/p&#62;
&#60;p&#62;@feurig  -We don't believe we need to choose between well formed and easy.  We'd like to see the underlying Wiring APIs tightened up and to make use of the full power of C++ which is why we linked to the original post and the ideas of @gblumer and @siy which seem like the right direction.   The main question here is what is the best way to expose common microcontroller functionality (GPIO, USB, I2C, etc) at the lowest possible cross-device level and then let all the other languages/platforms make use of those APIs.  This is like the POSIX of the microcontroller world and we think Wiring can get there with a little help. Then in terms of well formed vs. easy we only need o remember that IOS is built on a POSIX OS. &#60;/p&#62;
&#60;p&#62;@gbulmer - We second the need for a threading/event system.  As we're all about cross-device portability for 8, 16 and 32 bit micros, we were convinced that a low-overhead, non-stack-based, cooperative multithreading system like proto-threads would serve all common needs while being feasible on even the most constrained micros.  Here's an implementation by our friend Daniel Ozick also has scratch-like events &#60;a href=&#34;http://code.google.com/p/threadkit/&#34; rel=&#34;nofollow&#34;&#62;http://code.google.com/p/threadkit/&#60;/a&#62;   Also, snap looks cool but where's the microcontroller implementation?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>feurig on "Pins as objects - Wiring API 2.0?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=9685#post-21274</link>
			<pubDate>Sat, 24 Nov 2012 20:57:40 +0000</pubDate>
			<dc:creator>feurig</dc:creator>
			<guid isPermaLink="false">21274@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Also agree about 2b. My experience with freertos on the maple was nightmarish and cost me about a man month.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>feurig on "Pins as objects - Wiring API 2.0?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=9685#post-21273</link>
			<pubDate>Sat, 24 Nov 2012 20:48:57 +0000</pubDate>
			<dc:creator>feurig</dc:creator>
			<guid isPermaLink="false">21273@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;At present I am looking at CMSIS v2 or 3 and better new lib integration, c based, BSD/MIT licsensed (I am tired of rewriting code that is vendor closed or gpl3 open -- and therefore useless ), thinking about taking the wiring-s, stm32f[0-1], and the lpc1114 as base platforms and seeing if I can come up with a coherent way of doing i/o, a couple of tasks, and error handling for my own projects. &#60;/p&#62;
&#60;p&#62;The maple is a pretty good case study for porting the arduino to the arm and frankly I am not as pleased with it as I should be. The team is bright the design is conservative but I think the arduino/wiring and object orientation are at the core of the issues.&#60;/p&#62;
&#60;p&#62;So yeah as someone who has been teaching on this platform for 5 years now and doing professional projects with it for another 3, I am finding myself thinking its time for something a little less easy to but a little better formed. &#60;/p&#62;
&#60;p&#62;On the arduino side  we were backed up by Weddington and Wuenches avrlibc combined with gcc on all major platforms so I could get away with writing hybrids where you prototype with the arduino stuff and rewrite it (most of the arduino stuff works but thats about it) until it is something stable if it needed to be more than a prototype.&#60;/p&#62;
&#60;p&#62;On the arm side there is no open source equivalent (newlib is close but mostly a retrofit), every vendor has their own way of doing things, and a lot of venders code isn't portable between families of their own arm derivatives (look at nxp for ample examples). This weekend  I just got my stellaris launchpad programmed on osx and I looked at the deep pile of work that it would take to make it usefull without just using ti's codebase and I put it back in the box.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
