Arduino Library Support?


Adrian

Recommended Posts

Hi all, I just got my Papilio 250 and have been playing around with the ZPUino and associated Arduino IDE for a day or two now. Right now I'm curious who is developing support for the Arduino libraries - is it gadget factory, or is it ZPUino? I ask because there are quite a few missing functions that are normally supplied by Arduino (shiftOut comes to mind) as well as the ones supplied with avr (avr-lib). Is there any plans to implement these missing libraries to make sketches truly cross-platform? Or are these already working, and I am just missing a critical step to getting my sketches compiled onto the ZPUino? Thank you!

Link to comment
Share on other sites

Hi Adrian,

Not all functions are available for now. Those that require specific AVR register access won't work. Others I only do on a request basis, because they can take some time to port for optimal code size and speed.

I'll implement shiftOut() as you requested.

Regarding avr-lib, it's only AVR, and we are not implementing an AVR-compatible CPU. Perhaps is best you to tell me what you need from there, so I can implement their equivalents.

Best,

Alvie

Link to comment
Share on other sites

Adrian,

I look at the ZPUino as the soft processor that can do advanced stuff like VGA output and audio and the AVR8 as the AVR compatible solution. Since the AVR8 is patterned after the Atmega103 it works with avr-lib and many of the registers are the same.

So if you are looking for a high amount of Arduino compatibility then go with the AVR8, but if you want an advanced, high speed processor that runs C code in the Arduino IDE then go with the ZPUino.

Jack.

Link to comment
Share on other sites

Adrian,

I look at the ZPUino as the soft processor that can do advanced stuff like VGA output and audio and the AVR8 as the AVR compatible solution. Since the AVR8 is patterned after the Atmega103 it works with avr-lib and many of the registers are the same.

So if you are looking for a high amount of Arduino compatibility then go with the AVR8, but if you want an advanced, high speed processor that runs C code in the Arduino IDE then go with the ZPUino.

Jack.

Aaah, my mistake. I thought the ZPUino was an AVR clone.

Link to comment
Share on other sites

Regarding avr-lib, it's only AVR, and we are not implementing an AVR-compatible CPU. Perhaps is best you to tell me what you need from there, so I can implement their equivalents.

Alvie,

Thank you, I was more curious what the status was on the arduino libraries, and how important it was to have sketches be platform independent across the Zpuino. The only other functions (macros) I need now are digitalPinToPort, digitalPinToBitMask, and portInputRegister, although if those need specific AVR registers, maybe the best course of action is to just rewrite this sketch to work with the Zpuino.

Adrian

Link to comment
Share on other sites

No, I can add those. I did not because they are trivial, and I don't use them inside the code.

I'll open an issue and fix/implement them for 1.0.1.

For now, you can use the following (I'm writing this from top of my head):

digitalPinToPort(Y) -> port for pin Y is one of GPIODATA(X) where X = Y / 32.

digitalPinToBitMask(Y) is 1<<(Y%32).

portInputRegister follows the same rule as digitalPinToPort():

We handle up to 128 GPIO, since our registers are 32-bit, we can have up to 4 registers for all GPIO.

Classical arduino implementation of the functions you mentioned is very very slow (I once submitted a patch to improve stuff, but I think it ended up abandoned).

Alvie

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.