Skip to content
Snippets Groups Projects
Commit bdb76d01 authored by Michael Schaeuble's avatar Michael Schaeuble Committed by Lorenz Meier
Browse files

Fix incorrect MPU9250 device ID

We propagate the bus parameters from the bus interface to the sensor
devices. Thus, the device ID of the sensor driver is set to the correct
bus id and address. Otherwise it would be zero, which is an issue if several MPU9250s
are running at the same time.
parent 1fbc6887
No related branches found
No related tags found
No related merge requests found
......@@ -130,6 +130,20 @@ public:
*/
virtual int ioctl(unsigned operation, unsigned &arg);
/**
* Return the bus ID the device is connected to.
*
* @return The bus ID
*/
virtual uint8_t get_device_bus() {return _device_id.devid_s.bus;};
/**
* Return the bus address of the device.
*
* @return The bus address
*/
virtual uint8_t get_device_address() {return _device_id.devid_s.address;};
/*
device bus types for DEVID
*/
......
......@@ -166,11 +166,17 @@ MPU9250::MPU9250(device::Device *interface, device::Device *mag_interface, const
// disable debug() calls
_debug_enabled = false;
/* Set device parameters and make sure parameters of the bus device are adopted */
_device_id.devid_s.devtype = DRV_ACC_DEVTYPE_MPU9250;
_device_id.devid_s.bus = _interface->get_device_bus();;
_device_id.devid_s.address = _interface->get_device_address();;
/* Prime _gyro with parents devid. */
/* Set device parameters and make sure parameters of the bus device are adopted */
_gyro->_device_id.devid = _device_id.devid;
_gyro->_device_id.devid_s.devtype = DRV_GYR_DEVTYPE_MPU9250;
_gyro->_device_id.devid_s.bus = _interface->get_device_bus();
_gyro->_device_id.devid_s.address = _interface->get_device_address();
/* Prime _mag with parents devid. */
_mag->_device_id.devid = _device_id.devid;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment