Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KSDK I2C: Update the return value to match the API documentation change #3460

Merged
merged 1 commit into from
Dec 19, 2016
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
16 changes: 10 additions & 6 deletions targets/TARGET_Freescale/TARGET_KSDK2_MCUS/api/i2c_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,20 @@ int i2c_byte_read(i2c_t *obj, int last)

int i2c_byte_write(i2c_t *obj, int data)
{
status_t ret_value;
#if FSL_I2C_DRIVER_VERSION > MAKE_VERSION(2, 0, 1)
if (I2C_MasterWriteBlocking(i2c_addrs[obj->instance], (uint8_t *)(&data), 1, kI2C_TransferNoStopFlag) == kStatus_Success) {
return 1;
}
ret_value = I2C_MasterWriteBlocking(i2c_addrs[obj->instance], (uint8_t *)(&data), 1, kI2C_TransferNoStopFlag);
#else
if (I2C_MasterWriteBlocking(i2c_addrs[obj->instance], (uint8_t *)(&data), 1) == kStatus_Success) {
ret_value = I2C_MasterWriteBlocking(i2c_addrs[obj->instance], (uint8_t *)(&data), 1);
#endif

if (ret_value == kStatus_Success) {
return 1;
} else if (ret_value == kStatus_I2C_Nak) {
return 0;
} else {
return 2;
}
#endif
return 0;
}


Expand Down