Yesterday I made a lengthy post in this thread after mbolivar said this:
temporarily derailed. the wiring APIs are hella AVR-centric and require changes before they make sense for STM32. it will also be necessary to integrate Make within the IDE before this can happen.
the first changes require coordination with the wiring dev team. what needs to happen is: we read the core Wiring API in detail, come up with changes for other architectures (and backwards compatibility + migration plans for AVR), and get them to agree. they are nice guys who are very receptive to this, but i haven't really had the time to dedicate to this (especially since the libmaple APIs themselves have been in a bit of flux lately). if anyone wants to help, that'd be great. i think this is a great project that needs more love from the community.
as to make: we're going to put Make into Maple IDE as a testing ground, and then port the changes over to Wiring. i've previously rewritten the Wiring IDE build system to use Apache Ant in order to automate and simplify the process of pulling in external dependencies, so (hopefully) the problem should be pretty well-factored into (1) get make into the IDE, (2) port our rules.mk system to Wiring's library (i've got a crude linux-only patch, but Windows terrifies me), (3) add the IDE build system magic to get it working on all three platforms.
The following was my feedback:
With regards to the Wiring API, when I wrote the WireBase/"the new Wire" libraries, I was actually inspired to make it so that it can on any platform. If you take a look at it (with the exception for HardWire), there is currently only 1 dependencies (except for uint8, etc) that is centred on libmaple. And that's making a structure to hold i2c messages. This is the sort of style I think that it should be looking at. Developing a general API which is platform agnostic.
For example GPIO, the primary things are to allow pull up resistors to be used, for the pins to be changed to input or output and for data to be changed on the port. There are other things and that's fine, but these are the basic blocks that should be true for the majority of micro controllers on the market. The thing I don't like about Arduino (not sure if the same is true of Wiring) is how the pull up resistors are enabled. To me, the method used is not good. One of the reasons I like libmaple is due to the fact there is an option to enable it when you call pinMode. So instead of this:
pinMode(42, INPUT);
digitalWrite(42, HIGH);you just have this:
pinMode(42, INPUT_PULLUP);
Just fixing that problem and then users don't need to know that writing a 1 in the PORT register (that is what the first example implies I believe) enables the pull-up resistor. The 2nd method does not require the user to know anything about that particular microcontroller's features/registers, they know that with that command, the pin will be made into an input with the pull-up resistor enabled, the work to do this is minimal in code side.
Also, there is something else which bugs me a little, Arduino (and I believe hence Wiring, but I'm not 100% sure) and Maple is the Print class could be easier to use for some users. For example, I want to write a string with a variable in the middle of it. This is how I need to write it in all IDEs.
SerialPort.print("The ceiling is: ");
SerialPort.print(ceiling);
SerialPort.println(" cm");It's simple and a little less complex than using printf:
printf("The ceiling is: %lf cm\r\n", ceiling);
But the query I have is more related to C++ which is the backbone of these projects. C++ can have this:
cout << "The ceiling is: " << ceiling << " cm" << endl;
Now if it were to apply the way I'd think it should, it should be like this:
SerialPort << "The ceiling is: " << ceiling << " cm" << endl;
But it could be used for any type of serial port.
Note these are my current thoughts on how the situation is currently and do not represent the thoughts of leaflabs, arduino, wiring or others. You could keep both methods (since essentially the code is shared between the methods) and requires minimal work to get it to be available.
And just lastly, in Arduino: analogWrite(). Wrong name.
EDIT: Also, can you update the drivers included for Windows 64-bit?
Since the thread was not about discussing the Wiring API, it was requested to be moved outside that thread which I can agree with.
There was also a new blog post on the front page about the new include style that is being implemented in libmaple to keep the code more organised as support for new microcontrollers are added:
http://leaflabs.com/2012/07/libmaple-new-include-style-on-the-way/
I made this comment (which got partially eaten by wordpress):
Had a thought about this over the day and the only thing I’d probably change is how libraries are included. Personally I’d prefer to see:
#include <Libraries\Servo.h>
The primary reason is the look of it. If someone wants to look at the library, they only need to look at the IDE Folder and know that library is stored in the folder and can work out the Servo library is in the folder . To me, it’s something that makes developing for the platform easier for beginners.
What do others think of the current Wiring API? Is there something that annoys them about it? What about the new style includes for libmaple? Feel free to leave feedback in this thread, I'm sure both the Leaflabs staff and the Wiring Staff would be interested in reading it.