31 template<u
int16_t KBYTE, BOARD::pin_t SS_PIN, u
int32_t FREQ = 16000000L>
33 protected SPI::Device<0, MSBFIRST, FREQ, SS_PIN>
46 SPI::Device<0, MSBFIRST,
FREQ, SS_PIN>(spi)
59 virtual int read(
void* dst, uint32_t src,
size_t count)
61 uint8_t* sp = (uint8_t*) &src;
66 header.addr[0] = sp[2];
67 header.addr[1] = sp[1];
68 header.addr[2] = sp[0];
69 size =
sizeof(header);
72 header.addr[0] = sp[1];
73 header.addr[1] = sp[0];
74 size =
sizeof(header) - 1;
93 virtual int write(uint32_t dst,
const void* src,
size_t count)
95 uint8_t* dp = (uint8_t*) &dst;
100 header.addr[0] = dp[2];
101 header.addr[1] = dp[1];
102 header.addr[2] = dp[0];
103 size =
sizeof(header);
106 header.addr[0] = dp[1];
107 header.addr[1] = dp[0];
108 size =
sizeof(header) - 1;
111 write(&header, size);
122 } __attribute__((packed));
132 using SPI::Device<0,MSBFIRST,FREQ,SS_PIN>::acquire;
133 using SPI::Device<0,MSBFIRST,FREQ,SS_PIN>::transfer;
134 using SPI::Device<0,MSBFIRST,FREQ,SS_PIN>::read;
135 using SPI::Device<0,MSBFIRST,FREQ,SS_PIN>::write;
136 using SPI::Device<0,MSBFIRST,FREQ,SS_PIN>::release;
155 template<BOARD::pin_t SS_PIN, u
int32_t FREQ = 16000000L>
182 template<BOARD::pin_t SS_PIN, u
int32_t FREQ = 16000000L>
Software::SPI< BOARD::D11, BOARD::D12, BOARD::D13 > spi
virtual int read(void *dst, uint32_t src, size_t count)
virtual int write(uint32_t dst, const void *src, size_t count)
static const uint32_t MAX_FREQ