I am in the process of writing a radio driver for a device I’m working with. The device is highly configurable and I am trying to identify the best strategy for exposing some of the configuration to the user. For example, the data rate, channel, preamble length, etc. can be changed to configure the radio. I understand that the netapi has some parameters that can be set through the interface, but I have quite a few parameters that don’t fit into the netapi framework that I’ll need to change. Here are the 3 proposed methods that I believe will expose the configuration to the user, I am wondering which you guys think is best.
- Put all configurable parameters in _params_t held in the device descriptor. I don’t like this option since the user basically needs to worry about all of them even if they want to just use them as default. Plus it’s more stored data that doesn’t necessarily need to be stored.
- Internally, have a bunch of default attribute((weak)) functions that can be overriden by different areas of the code. This way if someone wants a particular data rate tied to a board, the board can have the override. Or if the application wants to override it, it can.
- Simply setup the radio in what I believe to be the most useful default configuration. Then the application is responsible for configuring the radio further AFTER the radio is configured. The radio module would be responsible for providing hooks to configure different aspects. One thing I’m not sure of here is to know when the network stack has finished initializing the radio so it can begin it’s configuration.
Any suggestions or guidance on this matter is appreciated!