Skip to content

Commit 6f2da89

Browse files
committed
[L0] Fix HAL I2C functions name
Signed-off-by: Frederic.Pillon <[email protected]>
1 parent aafbbec commit 6f2da89

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

cores/arduino/stm32/twi.c

+15
Original file line numberDiff line numberDiff line change
@@ -524,15 +524,25 @@ void HAL_I2C_AddrCallback(I2C_HandleTypeDef *hi2c, uint8_t TransferDirection, ui
524524
if(obj->i2c_onSlaveTransmit != NULL) {
525525
obj->i2c_onSlaveTransmit();
526526
}
527+
#if defined(STM32L0xx)
528+
HAL_I2C_Slave_Seq_Transmit_IT(hi2c, (uint8_t *) obj->i2cTxRxBuffer,
529+
obj->i2cTxRxBufferSize, I2C_LAST_FRAME);
530+
#else
527531
HAL_I2C_Slave_Sequential_Transmit_IT(hi2c, (uint8_t *) obj->i2cTxRxBuffer,
528532
obj->i2cTxRxBufferSize, I2C_LAST_FRAME);
533+
#endif
529534
} else {
530535
obj->slaveRxNbData = 0;
531536
obj->slaveMode = SLAVE_MODE_RECEIVE;
532537
/* We don't know in advance how many bytes will be sent by master so
533538
* we'll fetch one by one until master ends the sequence */
539+
#if defined(STM32L0xx)
540+
HAL_I2C_Slave_Seq_Receive_IT(hi2c, (uint8_t *) &(obj->i2cTxRxBuffer[obj->slaveRxNbData]),
541+
1, I2C_NEXT_FRAME);
542+
#else
534543
HAL_I2C_Slave_Sequential_Receive_IT(hi2c, (uint8_t *) &(obj->i2cTxRxBuffer[obj->slaveRxNbData]),
535544
1, I2C_NEXT_FRAME);
545+
#endif
536546
}
537547
}
538548
}
@@ -577,8 +587,13 @@ void HAL_I2C_SlaveRxCpltCallback(I2C_HandleTypeDef *hi2c)
577587
}
578588
/* Restart interrupt mode for next Byte */
579589
if(obj->slaveMode == SLAVE_MODE_RECEIVE) {
590+
#if defined(STM32L0xx)
591+
HAL_I2C_Slave_Seq_Receive_IT(hi2c, (uint8_t *) &(obj->i2cTxRxBuffer[obj->slaveRxNbData]),
592+
1, I2C_NEXT_FRAME);
593+
#else
580594
HAL_I2C_Slave_Sequential_Receive_IT(hi2c, (uint8_t *) &(obj->i2cTxRxBuffer[obj->slaveRxNbData]),
581595
1, I2C_NEXT_FRAME);
596+
#endif
582597
}
583598
}
584599

0 commit comments

Comments
 (0)