-
Notifications
You must be signed in to change notification settings - Fork 118
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
Make SPICONFIG configurable #61
base: master
Are you sure you want to change the base?
Conversation
… change the SPISettings
Any idea if turning this from a constant to a variable has a performance impact on other boards? |
I honestly don't know for certain, and I don't have anything else to test with for confirmation. It's been a while since I've delved too deeply into C++, but I would think that the variable form would perform better than the old define at least, and may be negligibly worse than a "static const" version. As I understand, because #define is a macro, it is replacing all intsances of Unfortunately, I can't seem to find any meaningful information on whether "const" vs. a mutable variable declaration perform any better. Anywhere it is discussed, it simply says the compiler can optimize away the fact that you may not have used "const" (i.e., if it sees you never re-assign, it will just treat it as const). The advantages of const seem to be more maintainability, but obviously if you need to allow for changing a value, any optimizations related to immutable values go out the window. |
@PaulStoffregen - Any further thoughts on this PR, or is there anything else I can do to make you more comfortable with any potential performance differences? |
I would suggest putting the clock in terms of clock_div so that this is compatible with even the lower clock speed Arduinos... automatically by adjusting the clock speed according to the board on which the thing is running on |
Any news on this merge request? On ESP32 the default SPICONFIG doesn't seem to work However, If I change it to Also, since I use the hardware SPI (HSPI) which uses different pins
none of the example code work out of the box unless I define a SPIClass variable like:
Then use the SerialFlash.begin like so: So far I successfully tested the RawHardwareTest and EraseEverything samples with the above modifications. |
Any news on this? |
I think there's a good chance the issue I raised #79 will also need this change to resolve as a change in the core related to SPI frequency is causing that issue. I don't know enough about SPI to be sure. |
In order to support ESP32, we need to be able to change the max speed from the SPICONFIG. This pull request is related to #57.