-
-
Notifications
You must be signed in to change notification settings - Fork 129
Suggest adding SPI_writeAnything to SPI library #61
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
Comments
@nickgammon BW: C++ allows overloading so the naming is a bit "old fashion" :) |
It works as-is. The template deduces the type from the argument type (fnum is float). Try it yourself.
It is named after the EEPROMWriteAnything template library in: http://playground.arduino.cc/Code/EEPROMWriteAnything I left off the "write" part because it also reads. |
@nickgammon |
Yes, but there is already a "write" function. |
Are you suggesting it as a templated overload of the standard write? I suppose that could work, so I will leave that to the library implementers which approach they would prefer. |
@nickgammon |
@nickgammon |
I have the following small template library on my page about SPI ( http://www.gammon.com.au/spi ):
The function SPI_readAnything_ISR is for using inside an ISR, as it directly accesses SPDR.
It has been suggested to me that I request that you include this in the standard SPI library (SPI.h). This lets you more easily send things like floats or structs via SPI. For example:
Being a template function it won't add any bloat unless you actually use it.
Related request: https://github.com/arduino/Arduino/issues/3691
The text was updated successfully, but these errors were encountered: