diff options
author | Andrew Tridgell <tridge@samba.org> | 2014-07-08 21:09:12 +1000 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-07-12 16:25:43 +0200 |
commit | 93d444d1aade59b5e88f41b71c842a00ab950c64 (patch) | |
tree | bac1fefd6a71196c7584804d38bf765612d11434 /src/drivers/device/spi.cpp | |
parent | a2f528c5ba20ade8c3be200ed07fb6e925030c0d (diff) | |
download | px4-firmware-93d444d1aade59b5e88f41b71c842a00ab950c64.tar.gz px4-firmware-93d444d1aade59b5e88f41b71c842a00ab950c64.tar.bz2 px4-firmware-93d444d1aade59b5e88f41b71c842a00ab950c64.zip |
device: added a _device_id to all drivers
this device ID identifies a specific device via the tuple of (bus, bus
type, address, devtype). This allows device specific configuration
data to be stored along with a device ID, so the code can know when
the user has changed device configuration (such as removing an
external compass), and either invalidate the device configuration or
force the user to re-calibrate
Diffstat (limited to 'src/drivers/device/spi.cpp')
-rw-r--r-- | src/drivers/device/spi.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/drivers/device/spi.cpp b/src/drivers/device/spi.cpp index 1ab1dc699..200acac05 100644 --- a/src/drivers/device/spi.cpp +++ b/src/drivers/device/spi.cpp @@ -75,6 +75,12 @@ SPI::SPI(const char *name, _dev(nullptr), _bus(bus) { + // 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; + // devtype needs to be filled in by the driver + _device_id.devid_s.devtype = 0; } SPI::~SPI() |