Skip to content

Commit b7b4a9c

Browse files
committed
K64F - I2c - ack flag retreive correction (logic inverted in ksdk hal)
1 parent 46c8752 commit b7b4a9c

File tree

1 file changed

+2
-3
lines changed
  • libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_K64F

1 file changed

+2
-3
lines changed

libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_K64F/i2c_api.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,10 @@ void i2c_init(i2c_t *obj, PinName sda, PinName scl) {
4747

4848
pinmap_pinout(sda, PinMap_I2C_SDA);
4949
pinmap_pinout(scl, PinMap_I2C_SCL);
50-
5150
first_read = 1;
5251
}
5352

5453
int i2c_start(i2c_t *obj) {
55-
volatile uint32_t n = 0;
5654
i2c_hal_send_start(obj->instance);
5755
first_read = 1;
5856
return 0;
@@ -92,7 +90,7 @@ static int i2c_wait_end_tx_transfer(i2c_t *obj) {
9290
}
9391

9492
// check if we received the ACK or not
95-
return i2c_hal_get_receive_ack(obj->instance) ? 1 : 0;
93+
return i2c_hal_get_receive_ack(obj->instance) ? 0 : 1;
9694
}
9795

9896
// this function waits the end of a rx transfer and return the status of the transaction:
@@ -243,6 +241,7 @@ void i2c_slave_mode(i2c_t *obj, int enable_slave) {
243241
if (enable_slave) {
244242
// set slave mode
245243
BW_I2C_C1_MST(obj->instance, 0);
244+
i2c_hal_enable_interrupt(obj->instance);
246245
} else {
247246
// set master mode
248247
BW_I2C_C1_MST(obj->instance, 1);

0 commit comments

Comments
 (0)