22 lines
454 B
C
22 lines
454 B
C
|
#ifndef SPICLASS_H
|
||
|
#define SPICLASS_H
|
||
|
|
||
|
/**
|
||
|
*/
|
||
|
static constexpr unsigned SPIBUFLEN = 8u;
|
||
|
|
||
|
class SpiClass {
|
||
|
volatile unsigned index;
|
||
|
unsigned total;
|
||
|
volatile bool complete;
|
||
|
char buffer [SPIBUFLEN];
|
||
|
public:
|
||
|
explicit SpiClass () noexcept;
|
||
|
void irq ();
|
||
|
void select (const bool set) const noexcept;
|
||
|
bool send (const char * data, const unsigned len);
|
||
|
char * received (unsigned & count);
|
||
|
};
|
||
|
|
||
|
#endif // SPICLASS_H
|