-
Notifications
You must be signed in to change notification settings - Fork 697
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
asynchronous radio API #593
Conversation
Can you make the case for having a separate async driver instead of just adding new async functions, e.g., |
Well, it may be feasible to enrich the current radio API with async functions, but the necessary integration effort feels like a waste of time if the long-term goal is to move to an asynchronous radio API anyway. Another aspect is that the radio drivers already became quite complex due to adding support for polling. Adding asynchronous functions would probably ultimately turn them into hydras. Of course, we could then think about splitting each radio driver into multiple source files, but this brings us to where we are now. |
But with separate drivers, we'll end up with much duplicate code won't we? Seems likely that both drivers will eventually diverge, with e.g. different assumptions in init functions or different config parameter and what not. What do async functions do that add complexity to existing, non-async code? I haven't looked at the async code closely yet. If you're concerned about file size, maybe just having the async functions in a separate file, linked to the main driver, would work? |
I would very much also rather see add-on APIs to the current radio-drivers. Implementing async API and then a few lines of code for any sync-version of these should be very easy and kind of very similar. So I agree with @simonduq here. |
4078f96
to
6d3fbc1
Compare
As you suggested, I have added my new functions to the current radio API. BTW, I came across a questionable mechanism inside |
Is there any chance this PR can be split into smaller, easier to handle parts? I see a lot of things here not related to the async radio API |
4339a30
to
971a9c9
Compare
a61ec05
to
9c5784a
Compare
The need for an asynchronous radio API was already discussed in #220. The asynchronous radio API I am proposing here is "stripped-down". That is, I delegate many tasks that are currently handled by
radio_driver
s to the upper-layer MAC protocol, namely:loop mode
, which is, e.g., needed to implement CSL's wake-up sequences.get_rssi
functionSo far, I successfully implemented CSL and ContikiMAC on top of this API. Of course, we may need further changes so as to support other MAC protocols and radio modules.
Apart from the asynchronous radio API, this PR also adapts the packetbuf such that it is possible to call packetbuf functions from within ISRs. This now works by changing the variable
packetbuf
to point to some local memory space and restoringpacketbuf
before returning.