Go Down

Topic: SPI library issues (Read 916 times) previous topic - next topic

AndrewStone

Can I somehow help get SPI library issues addressed?  There is this bug which basically stops the SPI library from working with mode 3 (and probably other modes).  http://code.google.com/p/arduino/issues/detail?id=888

Another small bug is that if you just call begin() the library relies on the values of the SPSR and SPCR to be the default since it ORs bits without initializing the registers.

Also, a great feature would be the ability to switch between different SPI slaves in a standard way (similar to how "begin" is standard).  I would propose the addition of 2 member functions for APIs that use SPI ".pause()" (generally a no-op, but might turn off interrupt handlers for example) and ".resume()".

This is needed because (in my experience) all the config bits in SPCR and SPSR regs are not actually readable -- I just get 0x80 when I read SPCR for example.  This means that generic code to push and pop SPI register state like this does not work:
class SpiSaver
{
public:
byte spcr,spsr;
SpiSaver() { spcr = SPCR; spsr = SPSR; }
~SpiSaver() { SPCR = spcr; SPSR = spsr; }
};

Cheers!
Andrew
http://www.toastedcircuits.com Lightuino LED driver: 16 sources, 70 sinks, remote controlled.  Also high powered LED drivers.

Coding Badly


Please reports your comments and suggestions on the Developer's List...
http://arduino.cc/mailman/listinfo/developers_arduino.cc

Go Up