Commit Graph

4 Commits

Author SHA1 Message Date
Andrew Tridgell ac2c25539b AP_InertialSensor: implement device IDs for AuxilaryBus 2016-11-09 17:08:04 +11:00
Andrew Tridgell 90dc9e3327 AP_InertialSensor: dummy implementation of register_periodic_callback()
for AuxiliaryBus
2016-11-09 17:07:55 +11:00
Lucas De Marchi a66a201bf5 AP_Compass: HMC5843: Add support for MPU6000 auxiliary bus
Allow HMC5843 to be on MPU6000's auxiliary bus.
2015-08-28 12:39:09 +10:00
Lucas De Marchi caae933c28 AP_InertialSensor: Add support for auxiliary buses
Add an AuxiliaryBus class that can be derived for specific
implementations in inertial sensor backends. It's an abstract
implementation so other libraries can use the auxiliary bus exported. In
order for this to succeed the backend implementation must split the
initialization of the sensor from the actual sample collecting, like is
done in MPU6000.

When AP_InertialSensor::get_auxiliary_bus() is called it will execute
following steps:
	a) Force the backends to be detected if it's the first time it's
	   being called
	b) Find the backend identified by the id
	c) call get_auxiliary_bus() on the backend so other libraries can
	   that AuxiliaryBus to initialize a slave device

Slave devices can be used by calling AuxiliaryBus::request_next_slave()
and are owned by the caller until AuxiliaryBus::register_periodic_read()
is called. From that time on the AuxiliaryBus object takes its ownership.
This way it's possible to do the necessary cleanup later without
introducing refcounts, that we don't have support to.

Between these 2 functions the caller can configure the slave device by
doing its specific initializations by calling the passthrough_*
functions. After the initial configuration and register_periodic_read()
is called only read() can be called.
2015-08-28 12:39:08 +10:00