-
Notifications
You must be signed in to change notification settings - Fork 213
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
Configuring MISO, MOSI and SCK SPI pins? #834
Comments
Look at the mechanisms used by the various halconfig entries. No matter what it seems, the HAL really does use the information in the tables. (See, for example, |
I'm already using the pin maps like in the following code, but there is no option to set MISO, MOSI and SCK pins. How can I change that without modifying the library?
|
Ah, yes, sorry. The library uses the global object |
@terrillmoore Thank you. I would be very grateful if in version 5 we can change those pins outside the library. I've already seen that some people would also benefit from that feature. |
Changing constant parameters such as buffer size or pinouts from outside the library would nearly always increase code, and this is sometimes harmful on small targets like at328p (which otherwise works great). About Arduino IDE, there have been many attempts to enhance user experience for this purpose, with no luck so far. |
@d-a-v Thank you so much for your explanation and help. I'm using the PlatformIO IDE. Is there any solution for that IDE? |
You can use or add global defines with PIO. #define THIS_LIB_SOME_PARAMETER_DEFAULT_MS 5 // ms
#ifndef THIS_LIB_SOME_PARAMETER_MS
#define THIS_LIB_SOME_PARAMETER_MS THIS_LIB_SOME_PARAMETER_DEFAULT_MS
#endif You would have to add this in your PIO configuration file. -D THIS_LIB_SOME_PARAMETER_MS=10 |
The library already supports this, but in a slightly different way. see instructions on using with PlatformIO or the test cases. |
@terrillmoore I know that, but still, I think it is impossible to set MISO, MOSI and SCK pins this way in PlatformIO. |
@sw-dev-code the way to create a global SPI, and init LMIC after, would work like this example shows:
|
I would like to know how to configure the MISO, MOSI, SCK and SS pins for SPI in the case when I'm using the custom board?
From hal.cpp I can see that the library uses default pins:
The text was updated successfully, but these errors were encountered: