Open gschorcht opened 5 years ago
Wrapper is the best option.
No, people are looking for the drivers that support their chip, not for the chips supported by the driver, so at first glance they decide chip is not supported at all if there's no driver with a similar name.
Yes.
Will become a mess someday, something like "mpxx5050" that should mean both "MPX5050" and "MPXV5050". Also, impossible with ST sensors (I think their engineers are strictly forbidden to communicate with each other, there's no other reasonable explanation for their chips' naming and specs differences).
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.
@aabadie @haukepetersen @smlng They have also developed many drivers. Before I close this issue, I would like to know what you think is the best approach to use an existing driver for other sensors.
After reading the description, I like the wrapper option.
There's also an old PR from @gebart that introduced a generic sensor module, see #9075. It might also be interesting.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.
Description
How do we deal with sensors for which there is no specific sensor driver but that are working with an existing sensor driver? Examples:
For a user, it is not obvious from the driver names for these examples that they also work for the other sensors.
From my point of view, possible approaches would be:
mpu9150
renamed tompu9x59
. This might produce compatibility issues for applications that already used the driver.The realization of a wrapper seems to be a feasible approach. Such a wrapper would only consist of
drivers/include/<driver>.h
drivers/<driver>/include/<driver>_params.h
The driver include file
drivers/include/<driver>.h
would include the wrapped driver header file and rename symbols that are visible for the application, for exampledrivers/include/mpu9250.h
The driver parameters file
drivers/<driver>/include/<driver>_params.h
would include the wrapped driver paremeters file and rename symbol names that are visible for the application, for exampleThen the application could use the wrapper as a driver.
In that way also sensors could be supported that are combinations of other sensors like LSM9DS1.