Skip to content

Commit

Permalink
- fixed implementation of transfer(buf, count) to match standard Ardu…
Browse files Browse the repository at this point in the history
…ino implementation
  • Loading branch information
RudolphRiedel committed Jul 16, 2023
1 parent a354920 commit 58f465b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions libraries/SPI/src/SPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class SPIClass

uint8_t transfer(uint8_t data);
inline uint16_t transfer16(uint16_t data);
inline void transfer(uint8_t* buf, uint8_t count);
inline void transfer(void *buf, size_t count);

// Transaction Functions
// Function not used here
Expand Down Expand Up @@ -208,14 +208,13 @@ extern SPIClass SPI;
# endif
#endif

void SPIClass::transfer(uint8_t *buf, uint8_t count)
void SPIClass::transfer(void *buf, size_t count)
{
uint8_t buf_in[count];
for (uint8_t i = 0; i < count; i++)
uint8_t *buffer = (uint8_t *) buf;
for (size_t index = 0; index < count; index++)
{
buf_in[i] = transfer(buf[i]);
buffer[index] = transfer(buffer[index]);
}
buf = buf_in;
}

uint16_t SPIClass::transfer16(uint16_t data)
Expand Down

0 comments on commit 58f465b

Please sign in to comment.