Arduino Libraries

There is no reason why we could use Arduino libraries for the spark core correct?
I would love to just use this library for a TL5940 LED driver.

http://code.google.com/p/tlc5940arduino/

I am guessing I have to setup the proper pins for spark core though in this libraries header files.

Ok so to clarify there are a few arm based libraries for the tlc5940.
Could one of them be easily ported since you just have to switch the ports?

@gooswa, maybe you meant that,

There is no reason why Arduino libraries can’t be ported to :spark:? :slight_smile:

It can be done but sometimes you need some patience to get this going.

Are you intending to get your feets wet and try porting? Else, I can help you along when I get home later.

I’m nowhere and expert in porting libraries etc but I would like to try it out at the very least!

EDIT: This kinda gonna take a long while with the Interrupts and all being used…

So i gave it a shot…and porting like 5 files was a breeze but i commented out the avr/io.h and avr/interrupt.h

1 Like

kennethlimpc, I looked at the code and it seems very hardware specific. So the code may compile but it most likely will not work. Pin assignments, timer1 usage and register manipulation are all not compatible with the STM32 Spark. Any thoughts?

2 Likes

Agreed but we can figure out how to get the pins properly mapped like how they have pinouts for different devices and even the Teensy.

The only complication comes from interrupts…

1 Like

That but more. TIMER1 is off limits since it is used by systicks, the core system timer. Second, the timer overflow is used to fire an XLAT pulse so we need to figure out how that works on the STM32 timers (should be ok). If servos are used, the code interferes with the existing servo library which also uses timers. I wonder if there is an existing driver for the SMT32 platform or even ARM. It may provide a better start.

Did a bit of research. I believe you may be right… it comes down to the timer and its interrupt. The pin-specific I/O can easily rewritten for the Spark. So, another member re-tasked TIMER2 in another topic. It may be worth looking at.

1 Like

Wow I go to sleep and you guys jumped on it.

So the thing is I am not a very good C++ programmer. Especially when it comes to hardware programming.

What would be great is to be pointed to a resource that I can learn about all this timer/clock stuff that is used by all these chips so I can get a better understanding of how I could port libraries. So where on the internet can I learn about general hardware programming for stuff like this? I also need it for accelerometer that i would like to use.

I definitely am looking at wanting to use the tlc5940 library since it was very simple to setup in Arduino.

gooswa, here is a tutorial on STM32 timers. I was planning on creating a timer pool, like what PJRC does with their interval timers. I won’t have time to work on it for a while yet though. You can also check out Creating timer-based interrupts on the forum.

1 Like

Hi

Has anyone made any progress on the library for the tlc5940 led driver?
I have a internship project where I have to use the tlc5940 so I am going to try and write a library for it. :slight_smile:

Hey David, I have something very basic that I finally got working after about of week of hacking, and I am by no means a good embed programmer.

shoot me a PM with your email and I will send you over what I got so far.

It’s not in a Class yet but would love it switch it over to be class based instead so it be delivered to the community.

I am looking for a library to use with a photon to control a TLC5940. Is there any update to this thread or does anyone have a link to one that has been worked out? Thanks!