param: automatically update calibration ID params on import

This avoids the need for recalibration, and also cleans up other driver
ID's (merge separate accel/gyro).

The SPI address was previously set to a board-specific (arbitrary) value,
and is now set to 0. This will allow extending for multiple sensors of the
same type on the same bus.
This commit is contained in:
Beat Küng
2020-03-10 10:11:43 -04:00
committed by Daniel Agar
parent 1851665fab
commit b54e5a1c23
29 changed files with 275 additions and 65 deletions
+3 -1
View File
@@ -67,7 +67,9 @@ SPI::SPI(const char *name, const char *devname, int bus, uint32_t device, enum s
// fill in _device_id fields for a SPI device
_device_id.devid_s.bus_type = DeviceBusType_SPI;
_device_id.devid_s.bus = bus;
_device_id.devid_s.address = (uint8_t)device;
// Use the 2. LSB byte as SPI address. This is currently 0, but will allow to extend
// for multiple instances of the same device on a bus, should that ever be required.
_device_id.devid_s.address = (uint8_t)(device >> 8);
// devtype needs to be filled in by the driver
_device_id.devid_s.devtype = 0;