java: Changed size_t and unsigned int to int in array declarations. Renamed buf to buffer where necesarry. Moved most Java array typemaps to java_buffer.i. Fixed some String buffers.
Signed-off-by: Petre Eftime <petre.p.eftime@intel.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com> Conflicts: src/upm.i
This commit is contained in:
committed by
Mihai Tudor Panu
parent
ab730038fd
commit
2cab79b4c2
@@ -163,9 +163,9 @@ uint8_t M24LR64E::getAFI()
|
||||
return EEPROM_Read_Byte(AFI_ADDR);
|
||||
}
|
||||
|
||||
void M24LR64E::getUID(uint8_t* buf)
|
||||
void M24LR64E::getUID(uint8_t* buffer)
|
||||
{
|
||||
EEPROM_Read_Bytes(UID_ADDR,buf,UID_LENGTH);
|
||||
EEPROM_Read_Bytes(UID_ADDR, buffer, UID_LENGTH);
|
||||
}
|
||||
|
||||
uint32_t M24LR64E::getMemorySize()
|
||||
@@ -184,14 +184,14 @@ void M24LR64E::clearMemory()
|
||||
}
|
||||
}
|
||||
|
||||
void M24LR64E::writeByte(unsigned int address, uint8_t data)
|
||||
mraa::Result M24LR64E::writeByte(unsigned int address, uint8_t data)
|
||||
{
|
||||
EEPROM_Write_Byte(address, data);
|
||||
return EEPROM_Write_Byte(address, data);
|
||||
}
|
||||
|
||||
void M24LR64E::writeBytes(unsigned int address, uint8_t* buf, unsigned int len)
|
||||
mraa::Result M24LR64E::writeBytes(unsigned int address, uint8_t* buffer, int len)
|
||||
{
|
||||
EEPROM_Write_Bytes(address, buf, len);
|
||||
return EEPROM_Write_Bytes(address, buffer, len);
|
||||
}
|
||||
|
||||
uint8_t M24LR64E::readByte(unsigned int address)
|
||||
@@ -199,31 +199,34 @@ uint8_t M24LR64E::readByte(unsigned int address)
|
||||
return EEPROM_Read_Byte(address);
|
||||
}
|
||||
|
||||
void M24LR64E::readBytes(unsigned int address, uint8_t* buf, unsigned int len)
|
||||
int M24LR64E::readBytes(unsigned int address, uint8_t* buffer, int len)
|
||||
{
|
||||
EEPROM_Read_Bytes(address, buf, len);
|
||||
return EEPROM_Read_Bytes(address, buffer, len);
|
||||
}
|
||||
|
||||
void M24LR64E::EEPROM_Write_Byte(unsigned int address, uint8_t data)
|
||||
mraa::Result M24LR64E::EEPROM_Write_Byte(unsigned int address, uint8_t data)
|
||||
{
|
||||
const int pktLen = 3;
|
||||
uint8_t buf[pktLen];
|
||||
mraa::Result rv;
|
||||
|
||||
buf[0] = ((address >> 8) & 0xff);
|
||||
buf[1] = (address & 0xff);
|
||||
buf[2] = data;
|
||||
|
||||
if (m_i2c.write(buf, pktLen))
|
||||
if ((rv = m_i2c.write(buf, pktLen)))
|
||||
cerr << __FUNCTION__ << "@" << __LINE__ << ": write failed" << endl;
|
||||
|
||||
usleep(I2C_WRITE_TIME * 1000);
|
||||
return rv;
|
||||
}
|
||||
|
||||
void M24LR64E::EEPROM_Write_Bytes(unsigned int address, uint8_t* data,
|
||||
unsigned int len)
|
||||
mraa::Result M24LR64E::EEPROM_Write_Bytes(unsigned int address, uint8_t* data,
|
||||
int len)
|
||||
{
|
||||
const int pktLen = 2 + len;
|
||||
uint8_t buf[pktLen];
|
||||
mraa::Result rv;
|
||||
|
||||
buf[0] = ((address >> 8) & 0xff);
|
||||
buf[1] = (address & 0xff);
|
||||
@@ -231,10 +234,12 @@ void M24LR64E::EEPROM_Write_Bytes(unsigned int address, uint8_t* data,
|
||||
for (int i=0; i<len; i++)
|
||||
buf[2+i] = data[i];
|
||||
|
||||
if (m_i2c.write(buf, pktLen))
|
||||
if ((rv = m_i2c.write(buf, pktLen)))
|
||||
cerr << __FUNCTION__ << "@" << __LINE__ << ": write failed" << endl;
|
||||
|
||||
usleep(I2C_WRITE_TIME * 1000);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
uint8_t M24LR64E::EEPROM_Read_Byte(unsigned int address)
|
||||
@@ -265,8 +270,8 @@ uint8_t M24LR64E::EEPROM_Read_Byte(unsigned int address)
|
||||
return buf[0];
|
||||
}
|
||||
|
||||
unsigned int M24LR64E::EEPROM_Read_Bytes(unsigned int address,
|
||||
uint8_t* buf, unsigned int len)
|
||||
int M24LR64E::EEPROM_Read_Bytes(unsigned int address,
|
||||
uint8_t* buffer, int len)
|
||||
{
|
||||
const int apktLen = 2;
|
||||
uint8_t abuf[apktLen];
|
||||
@@ -280,7 +285,7 @@ unsigned int M24LR64E::EEPROM_Read_Bytes(unsigned int address,
|
||||
return false;
|
||||
}
|
||||
|
||||
int rv = m_i2c.read(buf, len);
|
||||
int rv = m_i2c.read(buffer, len);
|
||||
if (rv != len)
|
||||
{
|
||||
cerr << __FUNCTION__ << "@" << __LINE__ << ": read failed" << endl;
|
||||
|
||||
Reference in New Issue
Block a user