Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions targets/TARGET_TOSHIBA/TARGET_TMPM46B/i2c_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop)

i2c_num = obj->index;
gI2C_TxData = (char *)calloc(length, sizeof(int8_t));
if (gI2C_TxData == NULL) {
error("Insufficient memory");
return 0;
}

for (i = 0; i < length; i++) {
gI2C_TxData[i] = data[i];
Expand Down Expand Up @@ -258,6 +262,10 @@ int i2c_byte_write(i2c_t *obj, int data)
byte_func = 1;
if (start_flag == 0 && send_byte == 0) {
gI2C_LTxData = (char *)realloc(gI2C_LTxData, counter++);
if (gI2C_LTxData == NULL) {
error("Insufficient memory");
return 0;
}
gI2C_LTxData[counter - 2] = data;
}

Expand Down