LED Matrix expansion module
David Betz
Posts: 14,516
in Propeller 2
Has anyone written code to drive the LEDs on the LED Matrix expansion module?
Comments
http://forums.parallax.com/discussion/169706/accessory-boards/p1
dgately
Sure, driver code can be written in C, or it can be written in Spin. The point is not to write it twice -- I already had some Spin code for the matrix, so I just used it in C rather than having to re-write it. If you really want a C only version you can convert it with spin2cpp . But you can also do it the other way around, Spin code can call C (at least within the fastspin framework).
So if you're writing a driver from scratch pick whatever language you prefer or already have code for. Some of the (fastspin) Spin library routines are written in C, and vice-versa.
EDIT: Looking at it now ... it's quite handy for learning the interface between C and spin.
Ah, I see. That's a good point, availability of good C examples is important, and I agree with you that it would be nice to see some C drivers.
Unfortunately unless Parallax gets behind something it's hard to see how anything other than Spin will gain traction. At the moment Chip's Spin interpreter is the only "official" development tool announced (although it isn't available yet). I hope Chip will provide some way to call C code from his interpreter, that would make it feasible to write portable drivers in C. Otherwise Spin drivers will be the de facto standard, since they'll be the most portable (we can call Spin from C, but not vice-versa).
Very limited class declarations, with the functions "inline" in the struct, like: