Skip to content

Commit

Permalink
Drivers: QURT I2C do not use a static mutex for all I2C drivers
Browse files Browse the repository at this point in the history
  • Loading branch information
hendjoshsr71 committed Aug 8, 2024
1 parent a294e01 commit 2cb1903
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/lib/drivers/device/qurt/I2C.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ I2C::_config_i2c_bus_func_t I2C::_config_i2c_bus = NULL;
I2C::_set_i2c_address_func_t I2C::_set_i2c_address = NULL;
I2C::_i2c_transfer_func_t I2C::_i2c_transfer = NULL;

pthread_mutex_t I2C::_mutex = PTHREAD_MUTEX_INITIALIZER;

I2C::I2C(uint8_t device_type, const char *name, const int bus, const uint16_t address, const uint32_t frequency) :
CDev(name, nullptr),
_frequency(frequency / 1000)
Expand All @@ -69,6 +67,8 @@ I2C::I2C(uint8_t device_type, const char *name, const int bus, const uint16_t ad
_device_id.devid_s.bus = bus;
_device_id.devid_s.address = address;

_mutex = PTHREAD_MUTEX_INITIALIZER;

PX4_INFO("*** I2C Device ID 0x%x %d", _device_id.devid, _device_id.devid);
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/drivers/device/qurt/I2C.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class __EXPORT I2C : public CDev
static _config_i2c_bus_func_t _config_i2c_bus;
static _set_i2c_address_func_t _set_i2c_address;
static _i2c_transfer_func_t _i2c_transfer;
static pthread_mutex_t _mutex;
pthread_mutex_t _mutex;
};

} // namespace device
Expand Down

0 comments on commit 2cb1903

Please sign in to comment.