Hello everybody,
Can someone help me creating a block class from a SPI device? I want to use it with the webserver generating the response as a file download from this spi data and have good speed.
class DEVICE
{
private:
SPIClass * _hspi = NULL;
int _interruptPin = 16;
const int _spiClk = 15000000;
void readFromSPI(byte reg_address, int num, byte buff[]);
public:
size_t len;
void Begin(void);
int Read(uint8_t *buffer, size_t maxLen);
};
#include <SPI.h>
#include "DEVICE.h"
void DEVICE::readFromSPI(byte reg_address, int num, byte buff[])
{
}
void DEVICE::Begin()
{
}
int DEVICE::Read(uint8_t *buffer, size_t maxLen)
{
readFromSPI(...);
return (n);
}