SpektrumRC / SRXL2

Library code and documentation for the Spektrum SRXL2 bi-directional serial protocol
http://www.srxl2.com/
MIT License
41 stars 13 forks source link

C99 and C++ Cleanup #1

Open andyp1per opened 4 years ago

andyp1per commented 4 years ago

This is the minimal set of changes that are needed to include SRXL2 as-is in ArduPilot. There are no functional changes other than for third-parties to be able to provide the CRC16 function.

I will do a separate PR for an alternative more modular API that will make it easier to integrate in a type-safe way with other software.

TaliesinToo commented 4 years ago

Just a quick update to let you know that some of these changes are easily managed, but some are made more complicated by the way we have separated master-only code to it's own non-public file for our internal use -- adding static to many of these entries is not easily done because of that.

We also have our own separate version control that we use internally, so I am still working out the easiest way to handle pull requests like this while also keeping things synced. SO I haven't forgotten, and we're not ignoring you, but it might be a while yet.

andyp1per commented 4 years ago

Thanks - we are getting close to committing this support into ardupilot as you can see in the linked PR. When we have done that I am happy to add the details to the README.md as part of this PR if that would be appropriate. In that PR you can also see a sketch of how the API might be improved: https://github.com/ArduPilot/ardupilot/pull/13923#issuecomment-608415173 let me know if you want me to cook up a PR for this or whether that's going to be too difficult to incorporate. The main issue is the use of global variables for exchanging information from the driver and the use of global functions as callbacks rather than some kind of callback structure.