Skip to content

Conversation

MadVikingGod
Copy link

Added functions to the Due SPI library to enable 16bit SPI transfers.

To use:

  • Initialize as normal, then use SPI.setTransferWidth(pin, width).
void setup() {
    SPI.begin(4);
    SPI.setTransferWidth(4,SPI_WIDTH_16);
}
  • Use SPI.transfer() as normal, but can use upto 16 bits.
SPI.transfer(4,0xAA55);

The LSBFIRST setting only works for 8 bits.
TODO: twiddle 9-16 bit words to be reversed for LSB transfers. This is made more difficult because of the right-justified contents of the transfer data format.

-MVG

The LSBFIRST setting only works for 8 bits.
TODO: twiddle 9-16 bit words to be reversed for LSB transfers. This is made more difficult because of the right-justified contents of the transfer data format.

-MVG
@cmaglie cmaglie added feature request A request to make an enhancement (not a bug fix) Library: SPI The SPI Arduino library Architecture: SAM Applies only to the SAM microcontrollers (Due) labels Apr 15, 2015
@cmaglie
Copy link
Member

cmaglie commented Nov 4, 2015

@MadVikingGod
thanks for the patch but we are not going to merge this one because it's very SAM3X specific.
Implementing a function like SPI.transfer16(..) is more suited for this purpose, see #3961

@cmaglie cmaglie closed this Nov 4, 2015
@ffissore ffissore modified the milestone: Release 1.6.7 Nov 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Architecture: SAM Applies only to the SAM microcontrollers (Due) feature request A request to make an enhancement (not a bug fix) Library: SPI The SPI Arduino library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants