Library List + Porting How To

Hi Everyone,

After running into some trouble porting libraries to Spark I thought I’d setup a repo to serve as “how to” for porting Arduino/Teensy/etc libraries to Spark. I thought I’d also include a list of ported libraries for easy searching.

Here’s the repo: https://github.com/harrisonhjones/Spark-Ported-Libraries

I’d love some help on the how-to (paging @peekay123) and I could always use some help filling out the library list.

Let me know what people think. I’m hoping to get this repo to a informative-enough state that it serves as a semi-official resource for those porting libraries and those looking for already-ported libraries.

2 Likes

@harrisonhjones, good work! Sorry I am late to the party. My cup runneth over but I will get some text in there! Here are the threads I am working on:

Software

  • Some differences in type declarations - INT is 4 bytes on Core, 2 on Arduino
  • What normally takes an external Library for Arduino is built into the firmware already
  • Dev environment has more options: web IDE, CLI and DEV

Hardware

  • Core runs at 72Mhz while Arduino runs at 16Mhz
  • Flash vs RAM mapping is different

GPIO

  • I/O pins not all on single port
  • Bit/port manipulation possible with STM32 low-level macros
  • 3.3v!

ADC

  • Same as Arduino but 12 bits (0-4095) and max 3.3v input
  • Sampling speed is faster
  • Input impedance is different

I2C

  • Same as Arduino with added clock stretch, 400Khz select

SPI

  • Same as Arduino (>V1.0)
  • SPI clock is faster so need to adjust accordingly

SERIAL

  • Similar to Leonardo: Serial is on USB port but also with two extra H/W serial ports

TIMERS

  • Not same as Arduino

Interrupts

  • Almost every pin can do interrupts (similar to Arduino Due)
  • Similar to Arduino but no pin/mask necessary.

Obviously, there is more to add but it compliments what you started :smile:

4 Likes

ok. I think a section on the differences between the SparkCore and Arduino would be helpful. Perhaps as a completely separate document (advanced topics perhaps?) in the same repo? Do you have time to add it? I think I could do some of it but, reading through your list, I don’t quite understand it all!