Skip to content

Set SPI_HAS_TRANSACTION to 1 and implement buffer transfer #2639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

Lauszus
Copy link
Contributor

@Lauszus Lauszus commented Oct 26, 2016

When implementing support for the ESP8266 in the USB Host library: felis/USB_Host_Shield_2.0#263 I noticed some differences compared to the standard Arduino core. This commit fixes that.

Note the data pointer is decreased by the data size in the buffer transfer, as transferBytes increments the pointer every time data is read: https://github.com/esp8266/Arduino/blob/master/libraries/SPI/SPI.cpp#L481.

Since I do not have a ESP8266 at hand I haven't tested these changes.

Also see: https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/libraries/SPI/src/SPI.h#L21, https://www.arduino.cc/en/Reference/SPITransfer, and https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/libraries/SPI/src/SPI.h#L244-L257 for reference.

@codecov-io
Copy link

codecov-io commented Oct 26, 2016

Current coverage is 27.80% (diff: 100%)

Merging #2639 into master will not change coverage

@@             master      #2639   diff @@
==========================================
  Files            20         20          
  Lines          3625       3625          
  Methods         335        335          
  Messages          0          0          
  Branches        656        656          
==========================================
  Hits           1008       1008          
  Misses         2441       2441          
  Partials        176        176          

Powered by Codecov. Last update 7b32e6a...52f32a2

@xxxajk
Copy link

xxxajk commented Oct 26, 2016

Just a small comment.
UHS30 uses SPI from within an interrupt.
This needs to be ISR safe to be complete (SPI_ATOMIC_VERSION 1) then it could work with UHS30.
ATOMIC access also allows > 1 SPI device to be accessed without collisions when one or more targets on the SPI bus use an ISR.

@earlephilhower earlephilhower added merge-conflict PR has a merge conflict that needs manual correction waiting for feedback Waiting on additional info. If it's not received, the issue may be closed. labels Oct 1, 2019
@earlephilhower
Copy link
Collaborator

Thanks for your PR, but the core and libraries have changed enough that this PR now has a merge conflict.

Could you merge it manually with the latest core, so we can consider it for future releases?

1 similar comment
@earlephilhower
Copy link
Collaborator

Thanks for your PR, but the core and libraries have changed enough that this PR now has a merge conflict.

Could you merge it manually with the latest core, so we can consider it for future releases?

@xxxajk
Copy link

xxxajk commented Oct 2, 2019

Yeah, It's very simple.

@xxxajk
Copy link

xxxajk commented Oct 2, 2019

briefly, the patch is a one-liner.
https://github.com/Lauszus/Arduino/blob/SPI/libraries/SPI/SPI.h#L27
That's all that needs to be added.

@xxxajk
Copy link

xxxajk commented Oct 2, 2019

Lauszus added a commit to Lauszus/Arduino that referenced this pull request Oct 3, 2019
@Lauszus
Copy link
Contributor Author

Lauszus commented Oct 3, 2019

This issue was partly fixed in 3cc12b1.

Please see the new PR: #6591

@Lauszus Lauszus closed this Oct 3, 2019
earlephilhower pushed a commit that referenced this pull request Oct 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-conflict PR has a merge conflict that needs manual correction waiting for feedback Waiting on additional info. If it's not received, the issue may be closed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants