Skip to content
Snippets Groups Projects
Commit c7866bfc authored by Cristian Maglie's avatar Cristian Maglie Committed by Cristian Maglie
Browse files

Added SPI block-transfer method

parent 29bc12e7
No related branches found
No related tags found
No related merge requests found
......@@ -318,6 +318,7 @@ class SPIClass {
SPIClass(SERCOM *p_sercom, uint8_t uc_pinMISO, uint8_t uc_pinSCK, uint8_t uc_pinMOSI);
byte transfer(uint8_t data);
inline void transfer(void *buf, size_t count);
// Transaction Functions
void usingInterrupt(uint8_t interruptNumber);
......@@ -342,6 +343,14 @@ class SPIClass {
uint8_t _uc_pinSCK;
};
void SPIClass::transfer(void *buf, size_t count)
{
// TODO: Optimize for faster block-transfer
uint8_t *buffer = reinterpret_cast<uint8_t *>(buf);
for (size_t i=0; i<count; i++)
buffer[i] = transfer(buffer[i]);
}
#if SPI_INTERFACES_COUNT > 0
extern SPIClass SPI;
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment