PX4 / DriverFramework

Operating system and flight stack agnostic driver framework for POSIX (Linux, NuttX, Mac OS, QNX, VxWorks).
82 stars 132 forks source link

Rework DF so we don't hardcode the sensor interface at compile time #204

Closed nicolaerosia closed 5 years ago

nicolaerosia commented 7 years ago

I was wondering if there is interest in refactoring sensors so they take the adapter type (SPI/I2C/whatever) and path to the actual adapter at start time.

Example: https://github.com/PX4/DriverFramework/blob/master/framework/include/BaroSensor.hpp#L43 Could actually have a DevObj *m_adapter, instantiated in ctor depending on parameters.

This could all go to relevant configs: https://github.com/PX4/DriverFramework/blob/master/framework/include/ImuSensor.hpp#L45-L70

bkueng commented 7 years ago

Yes, both are desirable, but I'm not sure if it's worth the effort to do the necessary refactoring for dynamic SPI/I2C at the moment.