arduino / arduino/ArduinoCore-API
SPI API add void transfer(const void *tx_buffer, void *rx_buffer, size_t count);
- Dominant language
- C++
- Stars
- 306
- Forks
- 150
- PR merge metrics
- No merged PRs in 30d
Description
### API component
SPI API
### Description
SPI API add
```
virtual void transfer(const void *tx_buffer, void *rx_buffer, size_t count);
```
[Expand SPI API and Functionality for High Speed Devices](https://github.com/arduino/ArduinoCore-API/discussions/189)
### Is this a breaking change?
Unlikely
### Additional information
This is really a missing API method, it doesn't make sense to have only a single buffer for both transmit and receive, as DMA hardware normally works in 2 buffers.
The plain old
https://github.com/arduino/ArduinoCore-API/blob/master/api/HardwareSPI.h#L112
```
virtual void transfer(void *buf, size_t count) = 0;
```
forces hacks such as:
- allocate a temporary buffer
- do the DMA transfers receiving into the temporary buffer
- copy that temporary buffer data back into the address pointed by *buf*
wasting both memory and cpu cycles
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with api/HardwareSPI.h at the existing single-buffer transfer declaration, then read the linked discussion for the intended SPI API scope. Trace the affected API implementations and verification paths before changing the interface. Done means the two-buffer virtual transfer signature is consistently supported without the temporary-buffer workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- api, embedded-iot
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100