#ifndef SsiDeviceQueue_h
#define SsiDeviceQueue_h
#include "Energia.h"
class SSI;
class SsiBuffer;
/*
The L6470 needs an 800 ns pause (CS positive) between each byte to process each command and setup
the response. Since the normal SPI framing is only one clock period (0.2 ns) between bytes,
daisy-chaining the dSpins is more efficient.
At 5 MHZ clock, it take only 1.6µs to transfer the 8 bits.
The L6470 needs 350ns to respond to chip select. CS is ignored without motor power
*/
class SsiDeviceQueue {
public:
SsiDeviceQueue( SSI* ssi, uint32_t number ); // constructor
virtual ~SsiDeviceQueue(); // destructor - will perform hard stop
SSI* ssi;
uint32_t number;
SsiDeviceQueue* nextSsiDeviceQueue; // chain for SSI
SsiBuffer* startPointer; // pending queue
SsiBuffer* currentCR; // pending queue
// SsiBuffer* setupBuffer;
// dSpins get alternate calls to getByte and receiveByte from SSI TxEOT ISR
// And pass the calls on to the active buffer if one
byte
getByte();
void
receiveByte( uint32_t data );
// End Interrupt Service Routines
void
dequeue();
void
queue( SsiBuffer* request );
private:
};
#endif