RISC-V/V203/usb/ch32v203/spiclass.h
2024-11-08 20:56:19 +01:00

21 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