Skip to content
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

Changing bit shift order of spidriver #24

Open
boxofrox opened this issue Jan 31, 2020 · 1 comment
Open

Changing bit shift order of spidriver #24

boxofrox opened this issue Jan 31, 2020 · 1 comment

Comments

@boxofrox
Copy link

I'm using the spidriver to interface with a PN532 NFC module. The former uses most-significant bit (MSB) first shifting while the latter uses least-significant bit (LSB) first shifting on the SPI bus.

It seems from the datasheet for the spidrivers microcontroller, the hardware SPI shift order can be configured, and would be a nice feature to have.

Unfortunately, I don't know Forth to implement a PR. Instead, I've modified the spicli tool [1] to add "lsb" and "msb" commands to reverse the bits in bytes before transmitting and after receiving, and it works well enough that writing shell scripts against spicli remains clean and readable.

[1]: https://github.com/boxofrox/spidriver/tree/feature/bit-shift-order

@brouhaha
Copy link

Having this functionality in SPIDriver would be useful to eme as well, but for now I'm following boxorox' approach of reversing the bits in my Python program.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants