mirror of
https://github.com/eclipse/upm.git
synced 2025-07-02 01:41:12 +03:00
I2C: Removing multiple address calls
~20 UPM modules have multiple I2C calls in them. As per MRAA API the I2C address is set in the MRAA I2C context and used from there for all I2C transactions. Setting the I2C address alone does not actually result in an I2C transaction. This makes multiple set address calls pointless. This commit removes these superflous set address calls from the UPM modules. Setting the address once per context per device should be enough, unless there are multiple addresses or multiple devices with different addresses. Signed-off-by: Abhishek Malik <abhishek.malik@intel.com>
This commit is contained in:
@ -199,12 +199,6 @@ AM2315::i2cWriteReg(uint8_t reg, uint8_t* data, uint8_t ilen)
|
||||
tdata[ilen+3] = crc;
|
||||
tdata[ilen+4] = (crc >> 8);
|
||||
|
||||
if (mraa_i2c_address(m_i2ControlCtx, m_controlAddr) != MRAA_SUCCESS)
|
||||
{
|
||||
fprintf(stdout, "Error, setting i2c address.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
int iLoops = 5;
|
||||
mraa_set_priority(HIGH_PRIORITY);
|
||||
do {
|
||||
@ -241,7 +235,7 @@ AM2315::i2cReadReg(int reg, uint8_t* data, int ilen)
|
||||
uint8_t tdata[16] = { AM2315_READ, static_cast<uint8_t>(reg),
|
||||
static_cast<uint8_t>(ilen) };
|
||||
|
||||
mraa_result_t ret = mraa_i2c_address(m_i2ControlCtx, m_controlAddr);
|
||||
mraa_result_t ret;
|
||||
int iLoops = 5;
|
||||
mraa_set_priority(HIGH_PRIORITY);
|
||||
do {
|
||||
|
Reference in New Issue
Block a user