-
Notifications
You must be signed in to change notification settings - Fork 27
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
Advice on doing away with the C
generic parameters (ble_bas_peripheral
)
#203
Comments
Yes, it makes ensuring the examples work a little easier for us.
I think the easiest is if you just copy everything from the example into your main.rs, then add a
Then replace all instances of
I would instead maybe keep a minimal example that's per platform that does not use examples/apps, that can show how the app works without. As long as it's a simple minimal example (just an advertising beacon for instance), then I think that's an OK compromise for maintainability. I'm against using features for this, because it brings a lot of problems wrt. target architecture etc. as well. |
I agree, this is the way I've done it for an easily swappable application (I use a very similar architecture on a private esp project) https://github.com/jamessizeland/microbit-ble-gamepad/blob/main/src%2Fble%2Fmod.rs So I can define the platform specific types in one place. |
The
ble_bas_peripheral
has a comment:I am only targeting ESP32, so don't need the
C
generics (I assume they are there to have the same code support many platforms).1. How should I code the "alternative"?
Every place in
trouble
code usingspawner
is in themain()
. But I cannot place the line 104 tomain
since it usesrunner
- andrunner
is direved withinrun()
here.I can surely get this working one way or the other, but would like to hear how you would change the code for the alternative approach.
2. How about... not needing the generics?
This is a suggestion from a newcomer - so bear with me. If the normal use case is for a certain platform (like mine is), and if the
C
is only needed for supporting multiple platforms, how about:The idea is that it's far easier to strip away unneeded conditional lines than it is to unravel a generic parameter. If you are okay to see a PR of this approach, I can make one. Then we'd be able to discuss the pros/cons with two working solutions... If there's a reason this approach is a dead-end, please comment.
The text was updated successfully, but these errors were encountered: