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:
Abhishek Malik
2017-05-31 11:47:23 -07:00
parent da18bac925
commit 50bb4ae1be
22 changed files with 2 additions and 161 deletions

View File

@ -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 {