319 #ifdef HAL_I2C_MODULE_ENABLED
327 #define TIMING_CLEAR_MASK (0xF0FFFFFFU)
328 #define I2C_TIMEOUT_ADDR (10000U)
329 #define I2C_TIMEOUT_BUSY (25U)
330 #define I2C_TIMEOUT_DIR (25U)
331 #define I2C_TIMEOUT_RXNE (25U)
332 #define I2C_TIMEOUT_STOPF (25U)
333 #define I2C_TIMEOUT_TC (25U)
334 #define I2C_TIMEOUT_TCR (25U)
335 #define I2C_TIMEOUT_TXIS (25U)
336 #define I2C_TIMEOUT_FLAG (25U)
338 #define MAX_NBYTE_SIZE 255U
339 #define SlaveAddr_SHIFT 7U
340 #define SlaveAddr_MSK 0x06U
343 #define I2C_STATE_MSK ((uint32_t)((uint32_t)((uint32_t)HAL_I2C_STATE_BUSY_TX | (uint32_t)HAL_I2C_STATE_BUSY_RX) & (uint32_t)(~((uint32_t)HAL_I2C_STATE_READY))))
344 #define I2C_STATE_NONE ((uint32_t)(HAL_I2C_MODE_NONE))
345 #define I2C_STATE_MASTER_BUSY_TX ((uint32_t)(((uint32_t)HAL_I2C_STATE_BUSY_TX & I2C_STATE_MSK) | (uint32_t)HAL_I2C_MODE_MASTER))
346 #define I2C_STATE_MASTER_BUSY_RX ((uint32_t)(((uint32_t)HAL_I2C_STATE_BUSY_RX & I2C_STATE_MSK) | (uint32_t)HAL_I2C_MODE_MASTER))
347 #define I2C_STATE_SLAVE_BUSY_TX ((uint32_t)(((uint32_t)HAL_I2C_STATE_BUSY_TX & I2C_STATE_MSK) | (uint32_t)HAL_I2C_MODE_SLAVE))
348 #define I2C_STATE_SLAVE_BUSY_RX ((uint32_t)(((uint32_t)HAL_I2C_STATE_BUSY_RX & I2C_STATE_MSK) | (uint32_t)HAL_I2C_MODE_SLAVE))
349 #define I2C_STATE_MEM_BUSY_TX ((uint32_t)(((uint32_t)HAL_I2C_STATE_BUSY_TX & I2C_STATE_MSK) | (uint32_t)HAL_I2C_MODE_MEM))
350 #define I2C_STATE_MEM_BUSY_RX ((uint32_t)(((uint32_t)HAL_I2C_STATE_BUSY_RX & I2C_STATE_MSK) | (uint32_t)HAL_I2C_MODE_MEM))
354 #define I2C_XFER_TX_IT (0x00000001U)
355 #define I2C_XFER_RX_IT (0x00000002U)
356 #define I2C_XFER_LISTEN_IT (0x00000004U)
358 #define I2C_XFER_ERROR_IT (0x00000011U)
359 #define I2C_XFER_CPLT_IT (0x00000012U)
360 #define I2C_XFER_RELOAD_IT (0x00000012U)
363 #define I2C_NO_OPTION_FRAME (0xFFFF0000U)
393 static HAL_StatusTypeDef I2C_RequestMemoryWrite(
I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint32_t Timeout, uint32_t Tickstart);
394 static HAL_StatusTypeDef I2C_RequestMemoryRead(
I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint32_t Timeout, uint32_t Tickstart);
417 static void I2C_TransferConfig(
I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t Size, uint32_t
Mode, uint32_t Request);
492 #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1)
505 if (hi2c->MspInitCallback ==
NULL)
511 hi2c->MspInitCallback(hi2c);
594 #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1)
595 if (hi2c->MspDeInitCallback ==
NULL)
601 hi2c->MspDeInitCallback(hi2c);
650 #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1)
676 if (pCallback ==
NULL)
679 hi2c->
ErrorCode |= HAL_I2C_ERROR_INVALID_CALLBACK;
690 case HAL_I2C_MASTER_TX_COMPLETE_CB_ID :
691 hi2c->MasterTxCpltCallback = pCallback;
694 case HAL_I2C_MASTER_RX_COMPLETE_CB_ID :
695 hi2c->MasterRxCpltCallback = pCallback;
698 case HAL_I2C_SLAVE_TX_COMPLETE_CB_ID :
699 hi2c->SlaveTxCpltCallback = pCallback;
702 case HAL_I2C_SLAVE_RX_COMPLETE_CB_ID :
703 hi2c->SlaveRxCpltCallback = pCallback;
706 case HAL_I2C_LISTEN_COMPLETE_CB_ID :
707 hi2c->ListenCpltCallback = pCallback;
710 case HAL_I2C_MEM_TX_COMPLETE_CB_ID :
711 hi2c->MemTxCpltCallback = pCallback;
714 case HAL_I2C_MEM_RX_COMPLETE_CB_ID :
715 hi2c->MemRxCpltCallback = pCallback;
718 case HAL_I2C_ERROR_CB_ID :
719 hi2c->ErrorCallback = pCallback;
722 case HAL_I2C_ABORT_CB_ID :
723 hi2c->AbortCpltCallback = pCallback;
726 case HAL_I2C_MSPINIT_CB_ID :
727 hi2c->MspInitCallback = pCallback;
730 case HAL_I2C_MSPDEINIT_CB_ID :
731 hi2c->MspDeInitCallback = pCallback;
736 hi2c->
ErrorCode |= HAL_I2C_ERROR_INVALID_CALLBACK;
747 case HAL_I2C_MSPINIT_CB_ID :
748 hi2c->MspInitCallback = pCallback;
751 case HAL_I2C_MSPDEINIT_CB_ID :
752 hi2c->MspDeInitCallback = pCallback;
757 hi2c->
ErrorCode |= HAL_I2C_ERROR_INVALID_CALLBACK;
767 hi2c->
ErrorCode |= HAL_I2C_ERROR_INVALID_CALLBACK;
810 case HAL_I2C_MASTER_TX_COMPLETE_CB_ID :
814 case HAL_I2C_MASTER_RX_COMPLETE_CB_ID :
818 case HAL_I2C_SLAVE_TX_COMPLETE_CB_ID :
822 case HAL_I2C_SLAVE_RX_COMPLETE_CB_ID :
826 case HAL_I2C_LISTEN_COMPLETE_CB_ID :
830 case HAL_I2C_MEM_TX_COMPLETE_CB_ID :
834 case HAL_I2C_MEM_RX_COMPLETE_CB_ID :
838 case HAL_I2C_ERROR_CB_ID :
842 case HAL_I2C_ABORT_CB_ID :
846 case HAL_I2C_MSPINIT_CB_ID :
850 case HAL_I2C_MSPDEINIT_CB_ID :
856 hi2c->
ErrorCode |= HAL_I2C_ERROR_INVALID_CALLBACK;
867 case HAL_I2C_MSPINIT_CB_ID :
871 case HAL_I2C_MSPDEINIT_CB_ID :
877 hi2c->
ErrorCode |= HAL_I2C_ERROR_INVALID_CALLBACK;
887 hi2c->
ErrorCode |= HAL_I2C_ERROR_INVALID_CALLBACK;
910 if (pCallback ==
NULL)
913 hi2c->
ErrorCode |= HAL_I2C_ERROR_INVALID_CALLBACK;
922 hi2c->AddrCallback = pCallback;
927 hi2c->
ErrorCode |= HAL_I2C_ERROR_INVALID_CALLBACK;
959 hi2c->
ErrorCode |= HAL_I2C_ERROR_INVALID_CALLBACK;
1084 hi2c->XferISR =
NULL;
1102 if (I2C_WaitOnTXISFlagUntilTimeout(hi2c, Timeout, tickstart) !=
HAL_OK)
1138 if (I2C_WaitOnSTOPFlagUntilTimeout(hi2c, Timeout, tickstart) !=
HAL_OK)
1198 hi2c->XferISR =
NULL;
1216 if (I2C_WaitOnRXNEFlagUntilTimeout(hi2c, Timeout, tickstart) !=
HAL_OK)
1253 if (I2C_WaitOnSTOPFlagUntilTimeout(hi2c, Timeout, tickstart) !=
HAL_OK)
1293 if ((pData ==
NULL) || (Size == 0U))
1311 hi2c->XferISR =
NULL;
1353 if (I2C_WaitOnTXISFlagUntilTimeout(hi2c, Timeout, tickstart) !=
HAL_OK)
1370 if (I2C_WaitOnSTOPFlagUntilTimeout(hi2c, Timeout, tickstart) !=
HAL_OK)
1430 if ((pData ==
NULL) || (Size == 0U))
1448 hi2c->XferISR =
NULL;
1475 if (I2C_WaitOnRXNEFlagUntilTimeout(hi2c, Timeout, tickstart) !=
HAL_OK)
1505 if (I2C_WaitOnSTOPFlagUntilTimeout(hi2c, Timeout, tickstart) !=
HAL_OK)
1572 hi2c->XferISR = I2C_Master_ISR_IT;
1599 I2C_Enable_IRQ(hi2c, I2C_XFER_TX_IT);
1641 hi2c->XferISR = I2C_Master_ISR_IT;
1668 I2C_Enable_IRQ(hi2c, I2C_XFER_RX_IT);
1705 hi2c->XferISR = I2C_Slave_ISR_IT;
1717 I2C_Enable_IRQ(hi2c, I2C_XFER_TX_IT | I2C_XFER_LISTEN_IT);
1754 hi2c->XferISR = I2C_Slave_ISR_IT;
1766 I2C_Enable_IRQ(hi2c, I2C_XFER_RX_IT | I2C_XFER_LISTEN_IT);
1809 hi2c->XferISR = I2C_Master_ISR_DMA;
1854 if (dmaxferstatus ==
HAL_OK)
1870 I2C_Enable_IRQ(hi2c, I2C_XFER_ERROR_IT);
1893 hi2c->XferISR = I2C_Master_ISR_IT;
1908 I2C_Enable_IRQ(hi2c, I2C_XFER_TX_IT);
1952 hi2c->XferISR = I2C_Master_ISR_DMA;
1997 if (dmaxferstatus ==
HAL_OK)
2013 I2C_Enable_IRQ(hi2c, I2C_XFER_ERROR_IT);
2036 hi2c->XferISR = I2C_Master_ISR_IT;
2051 I2C_Enable_IRQ(hi2c, I2C_XFER_TX_IT);
2076 if ((pData ==
NULL) || (Size == 0U))
2093 hi2c->XferISR = I2C_Slave_ISR_DMA;
2125 if (dmaxferstatus ==
HAL_OK)
2137 I2C_Enable_IRQ(hi2c, I2C_XFER_LISTEN_IT);
2179 if ((pData ==
NULL) || (Size == 0U))
2196 hi2c->XferISR = I2C_Slave_ISR_DMA;
2228 if (dmaxferstatus ==
HAL_OK)
2240 I2C_Enable_IRQ(hi2c, I2C_XFER_LISTEN_IT);
2289 if ((pData ==
NULL) || (Size == 0U))
2313 hi2c->XferISR =
NULL;
2316 if (I2C_RequestMemoryWrite(hi2c, DevAddress, MemAddress, MemAddSize, Timeout, tickstart) !=
HAL_OK)
2338 if (I2C_WaitOnTXISFlagUntilTimeout(hi2c, Timeout, tickstart) !=
HAL_OK)
2377 if (I2C_WaitOnSTOPFlagUntilTimeout(hi2c, Timeout, tickstart) !=
HAL_OK)
2424 if ((pData ==
NULL) || (Size == 0U))
2448 hi2c->XferISR =
NULL;
2451 if (I2C_RequestMemoryRead(hi2c, DevAddress, MemAddress, MemAddSize, Timeout, tickstart) !=
HAL_OK)
2512 if (I2C_WaitOnSTOPFlagUntilTimeout(hi2c, Timeout, tickstart) !=
HAL_OK)
2558 if ((pData ==
NULL) || (Size == 0U))
2583 hi2c->XferISR = I2C_Master_ISR_IT;
2597 if (I2C_RequestMemoryWrite(hi2c, DevAddress, MemAddress, MemAddSize, I2C_TIMEOUT_FLAG, tickstart) !=
HAL_OK)
2617 I2C_Enable_IRQ(hi2c, I2C_XFER_TX_IT);
2649 if ((pData ==
NULL) || (Size == 0U))
2674 hi2c->XferISR = I2C_Master_ISR_IT;
2688 if (I2C_RequestMemoryRead(hi2c, DevAddress, MemAddress, MemAddSize, I2C_TIMEOUT_FLAG, tickstart) !=
HAL_OK)
2708 I2C_Enable_IRQ(hi2c, I2C_XFER_RX_IT);
2740 if ((pData ==
NULL) || (Size == 0U))
2765 hi2c->XferISR = I2C_Master_ISR_DMA;
2779 if (I2C_RequestMemoryWrite(hi2c, DevAddress, MemAddress, MemAddSize, I2C_TIMEOUT_FLAG, tickstart) !=
HAL_OK)
2817 if (dmaxferstatus ==
HAL_OK)
2833 I2C_Enable_IRQ(hi2c, I2C_XFER_ERROR_IT);
2884 if ((pData ==
NULL) || (Size == 0U))
2909 hi2c->XferISR = I2C_Master_ISR_DMA;
2923 if (I2C_RequestMemoryRead(hi2c, DevAddress, MemAddress, MemAddSize, I2C_TIMEOUT_FLAG, tickstart) !=
HAL_OK)
2960 if (dmaxferstatus ==
HAL_OK)
2975 I2C_Enable_IRQ(hi2c, I2C_XFER_ERROR_IT);
3018 __IO uint32_t I2C_Trials = 0UL;
3052 if (((
HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
3107 if (I2C_Trials == Trials)
3125 while (I2C_Trials < Trials);
3177 hi2c->XferISR = I2C_Master_ISR_IT;
3200 I2C_ConvertOtherXferOptions(hi2c);
3210 I2C_TransferConfig(hi2c, DevAddress, (uint8_t)hi2c->
XferSize, xfermode, xferrequest);
3218 I2C_Enable_IRQ(hi2c, I2C_XFER_TX_IT);
3262 hi2c->XferISR = I2C_Master_ISR_DMA;
3285 I2C_ConvertOtherXferOptions(hi2c);
3326 if (dmaxferstatus ==
HAL_OK)
3329 I2C_TransferConfig(hi2c, DevAddress, (uint8_t)hi2c->
XferSize, xfermode, xferrequest);
3341 I2C_Enable_IRQ(hi2c, I2C_XFER_ERROR_IT);
3364 hi2c->XferISR = I2C_Master_ISR_IT;
3379 I2C_Enable_IRQ(hi2c, I2C_XFER_TX_IT);
3423 hi2c->XferISR = I2C_Master_ISR_IT;
3446 I2C_ConvertOtherXferOptions(hi2c);
3456 I2C_TransferConfig(hi2c, DevAddress, (uint8_t)hi2c->
XferSize, xfermode, xferrequest);
3464 I2C_Enable_IRQ(hi2c, I2C_XFER_RX_IT);
3508 hi2c->XferISR = I2C_Master_ISR_DMA;
3531 I2C_ConvertOtherXferOptions(hi2c);
3572 if (dmaxferstatus ==
HAL_OK)
3575 I2C_TransferConfig(hi2c, DevAddress, (uint8_t)hi2c->
XferSize, xfermode, xferrequest);
3587 I2C_Enable_IRQ(hi2c, I2C_XFER_ERROR_IT);
3610 hi2c->XferISR = I2C_Master_ISR_IT;
3625 I2C_Enable_IRQ(hi2c, I2C_XFER_TX_IT);
3653 if ((pData ==
NULL) || (Size == 0U))
3660 I2C_Disable_IRQ(hi2c, I2C_XFER_LISTEN_IT | I2C_XFER_TX_IT);
3670 I2C_Disable_IRQ(hi2c, I2C_XFER_RX_IT);
3705 hi2c->XferISR = I2C_Slave_ISR_IT;
3721 I2C_Enable_IRQ(hi2c, I2C_XFER_TX_IT | I2C_XFER_LISTEN_IT);
3750 if ((pData ==
NULL) || (Size == 0U))
3760 I2C_Disable_IRQ(hi2c, I2C_XFER_LISTEN_IT | I2C_XFER_TX_IT);
3767 I2C_Disable_IRQ(hi2c, I2C_XFER_RX_IT);
3828 hi2c->XferISR = I2C_Slave_ISR_DMA;
3860 if (dmaxferstatus ==
HAL_OK)
3897 I2C_Enable_IRQ(hi2c, I2C_XFER_LISTEN_IT);
3927 if ((pData ==
NULL) || (Size == 0U))
3934 I2C_Disable_IRQ(hi2c, I2C_XFER_LISTEN_IT | I2C_XFER_RX_IT);
3944 I2C_Disable_IRQ(hi2c, I2C_XFER_TX_IT);
3979 hi2c->XferISR = I2C_Slave_ISR_IT;
3995 I2C_Enable_IRQ(hi2c, I2C_XFER_RX_IT | I2C_XFER_LISTEN_IT);
4024 if ((pData ==
NULL) || (Size == 0U))
4031 I2C_Disable_IRQ(hi2c, I2C_XFER_LISTEN_IT | I2C_XFER_RX_IT);
4041 I2C_Disable_IRQ(hi2c, I2C_XFER_TX_IT);
4102 hi2c->XferISR = I2C_Slave_ISR_DMA;
4134 if (dmaxferstatus ==
HAL_OK)
4171 I2C_Enable_IRQ(hi2c, I2C_XFER_RX_IT | I2C_XFER_LISTEN_IT);
4195 hi2c->XferISR = I2C_Slave_ISR_IT;
4198 I2C_Enable_IRQ(hi2c, I2C_XFER_LISTEN_IT);
4222 tmp = (uint32_t)(hi2c->
State) & I2C_STATE_MSK;
4226 hi2c->XferISR =
NULL;
4229 I2C_Disable_IRQ(hi2c, I2C_XFER_LISTEN_IT);
4255 I2C_Disable_IRQ(hi2c, I2C_XFER_RX_IT);
4256 I2C_Disable_IRQ(hi2c, I2C_XFER_TX_IT);
4271 I2C_Enable_IRQ(hi2c, I2C_XFER_CPLT_IT);
4304 if (hi2c->XferISR !=
NULL)
4306 hi2c->XferISR(hi2c, itflags, itsources);
4355 I2C_ITError(hi2c, tmperror);
4434 UNUSED(TransferDirection);
4597 uint16_t devaddress;
4598 uint32_t tmpITFlags = ITFlags;
4614 I2C_Flush_TXDR(hi2c);
4671 I2C_ITMasterSeqCplt(hi2c);
4696 I2C_ITMasterSeqCplt(hi2c);
4715 I2C_ITMasterCplt(hi2c, tmpITFlags);
4735 uint32_t tmpITFlags = ITFlags;
4744 I2C_ITSlaveCplt(hi2c, tmpITFlags);
4758 I2C_ITListenCplt(hi2c, tmpITFlags);
4766 I2C_Flush_TXDR(hi2c);
4770 I2C_ITSlaveSeqCplt(hi2c);
4809 (tmpoptions != I2C_NO_OPTION_FRAME))
4812 I2C_ITSlaveSeqCplt(hi2c);
4817 I2C_ITAddrCplt(hi2c, tmpITFlags);
4842 I2C_ITSlaveSeqCplt(hi2c);
4867 uint16_t devaddress;
4884 I2C_Enable_IRQ(hi2c, I2C_XFER_CPLT_IT);
4887 I2C_Flush_TXDR(hi2c);
4940 I2C_ITMasterSeqCplt(hi2c);
4965 I2C_ITMasterSeqCplt(hi2c);
4979 I2C_ITMasterCplt(hi2c, ITFlags);
5003 uint32_t treatdmanack = 0U;
5012 I2C_ITSlaveCplt(hi2c, ITFlags);
5048 if (treatdmanack == 1U)
5053 I2C_ITListenCplt(hi2c, ITFlags);
5061 I2C_Flush_TXDR(hi2c);
5065 I2C_ITSlaveSeqCplt(hi2c);
5097 I2C_ITAddrCplt(hi2c, ITFlags);
5122 static HAL_StatusTypeDef I2C_RequestMemoryWrite(
I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint32_t Timeout, uint32_t Tickstart)
5127 if (I2C_WaitOnTXISFlagUntilTimeout(hi2c, Timeout, Tickstart) !=
HAL_OK)
5145 if (I2C_WaitOnTXISFlagUntilTimeout(hi2c, Timeout, Tickstart) !=
HAL_OK)
5175 static HAL_StatusTypeDef I2C_RequestMemoryRead(
I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint32_t Timeout, uint32_t Tickstart)
5180 if (I2C_WaitOnTXISFlagUntilTimeout(hi2c, Timeout, Tickstart) !=
HAL_OK)
5198 if (I2C_WaitOnTXISFlagUntilTimeout(hi2c, Timeout, Tickstart) !=
HAL_OK)
5224 uint8_t transferdirection;
5225 uint16_t slaveaddrcode;
5226 uint16_t ownadd1code;
5227 uint16_t ownadd2code;
5243 if ((slaveaddrcode & SlaveAddr_MSK) == ((ownadd1code >> SlaveAddr_SHIFT) & SlaveAddr_MSK))
5245 slaveaddrcode = ownadd1code;
5246 hi2c->AddrEventCount++;
5247 if (hi2c->AddrEventCount == 2U)
5250 hi2c->AddrEventCount = 0U;
5259 #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1)
5260 hi2c->AddrCallback(hi2c, transferdirection, slaveaddrcode);
5268 slaveaddrcode = ownadd2code;
5271 I2C_Disable_IRQ(hi2c, I2C_XFER_LISTEN_IT);
5277 #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1)
5278 hi2c->AddrCallback(hi2c, transferdirection, slaveaddrcode);
5288 I2C_Disable_IRQ(hi2c, I2C_XFER_LISTEN_IT);
5294 #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1)
5295 hi2c->AddrCallback(hi2c, transferdirection, slaveaddrcode);
5328 hi2c->XferISR =
NULL;
5331 I2C_Disable_IRQ(hi2c, I2C_XFER_TX_IT);
5337 #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1)
5338 hi2c->MasterTxCpltCallback(hi2c);
5348 hi2c->XferISR =
NULL;
5351 I2C_Disable_IRQ(hi2c, I2C_XFER_RX_IT);
5357 #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1)
5358 hi2c->MasterRxCpltCallback(hi2c);
5382 I2C_Disable_IRQ(hi2c, I2C_XFER_TX_IT);
5388 #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1)
5389 hi2c->SlaveTxCpltCallback(hi2c);
5402 I2C_Disable_IRQ(hi2c, I2C_XFER_RX_IT);
5408 #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1)
5409 hi2c->SlaveRxCpltCallback(hi2c);
5438 hi2c->XferISR =
NULL;
5451 I2C_Flush_TXDR(hi2c);
5454 I2C_Disable_IRQ(hi2c, I2C_XFER_TX_IT | I2C_XFER_RX_IT);
5478 #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1)
5479 hi2c->MemTxCpltCallback(hi2c);
5492 #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1)
5493 hi2c->MasterTxCpltCallback(hi2c);
5512 #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1)
5513 hi2c->MemRxCpltCallback(hi2c);
5526 #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1)
5527 hi2c->MasterRxCpltCallback(hi2c);
5548 uint32_t tmpITFlags = ITFlags;
5554 I2C_Disable_IRQ(hi2c, I2C_XFER_LISTEN_IT | I2C_XFER_TX_IT | I2C_XFER_RX_IT);
5563 I2C_Flush_TXDR(hi2c);
5613 hi2c->XferISR =
NULL;
5624 I2C_ITListenCplt(hi2c, tmpITFlags);
5627 else if (hi2c->
XferOptions != I2C_NO_OPTION_FRAME)
5630 I2C_ITSlaveSeqCplt(hi2c);
5639 #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1)
5640 hi2c->ListenCpltCallback(hi2c);
5654 #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1)
5655 hi2c->SlaveRxCpltCallback(hi2c);
5668 #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1)
5669 hi2c->SlaveTxCpltCallback(hi2c);
5689 hi2c->XferISR =
NULL;
5711 I2C_Disable_IRQ(hi2c, I2C_XFER_LISTEN_IT | I2C_XFER_RX_IT | I2C_XFER_TX_IT);
5720 #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1)
5721 hi2c->ListenCpltCallback(hi2c);
5751 I2C_Disable_IRQ(hi2c, I2C_XFER_RX_IT | I2C_XFER_TX_IT);
5756 hi2c->XferISR = I2C_Slave_ISR_IT;
5761 I2C_Disable_IRQ(hi2c, I2C_XFER_LISTEN_IT | I2C_XFER_RX_IT | I2C_XFER_TX_IT);
5771 hi2c->XferISR =
NULL;
5826 #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1)
5827 hi2c->AbortCpltCallback(hi2c);
5838 #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1)
5839 hi2c->ErrorCallback(hi2c);
5883 I2C_Enable_IRQ(hi2c, I2C_XFER_CPLT_IT);
5910 I2C_Enable_IRQ(hi2c, I2C_XFER_RELOAD_IT);
5932 I2C_ITSlaveSeqCplt(hi2c);
5958 I2C_Enable_IRQ(hi2c, I2C_XFER_CPLT_IT);
5985 I2C_Enable_IRQ(hi2c, I2C_XFER_RELOAD_IT);
6001 (tmpoptions != I2C_NO_OPTION_FRAME))
6007 I2C_ITSlaveSeqCplt(hi2c);
6024 uint32_t treatdmaerror = 0U;
6074 #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1)
6075 hi2c->AbortCpltCallback(hi2c);
6083 #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1)
6084 hi2c->ErrorCallback(hi2c);
6108 if (((
HAL_GetTick() - Tickstart) > Timeout) || (Timeout == 0U))
6136 if (I2C_IsAcknowledgeFailed(hi2c, Timeout, Tickstart) !=
HAL_OK)
6144 if (((
HAL_GetTick() - Tickstart) > Timeout) || (Timeout == 0U))
6173 if (I2C_IsAcknowledgeFailed(hi2c, Timeout, Tickstart) !=
HAL_OK)
6179 if (((
HAL_GetTick() - Tickstart) > Timeout) || (Timeout == 0U))
6207 if (I2C_IsAcknowledgeFailed(hi2c, Timeout, Tickstart) !=
HAL_OK)
6243 if (((
HAL_GetTick() - Tickstart) > Timeout) || (Timeout == 0U))
6276 if (((
HAL_GetTick() - Tickstart) > Timeout) || (Timeout == 0U))
6297 I2C_Flush_TXDR(hi2c);
6333 static void I2C_TransferConfig(
I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t Size, uint32_t
Mode, uint32_t Request)
6354 uint32_t tmpisr = 0U;
6356 if ((hi2c->XferISR == I2C_Master_ISR_DMA) || \
6357 (hi2c->XferISR == I2C_Slave_ISR_DMA))
6359 if ((InterruptRequest & I2C_XFER_LISTEN_IT) == I2C_XFER_LISTEN_IT)
6365 if ((InterruptRequest & I2C_XFER_ERROR_IT) == I2C_XFER_ERROR_IT)
6371 if ((InterruptRequest & I2C_XFER_CPLT_IT) == I2C_XFER_CPLT_IT)
6377 if ((InterruptRequest & I2C_XFER_RELOAD_IT) == I2C_XFER_RELOAD_IT)
6385 if ((InterruptRequest & I2C_XFER_LISTEN_IT) == I2C_XFER_LISTEN_IT)
6391 if ((InterruptRequest & I2C_XFER_TX_IT) == I2C_XFER_TX_IT)
6397 if ((InterruptRequest & I2C_XFER_RX_IT) == I2C_XFER_RX_IT)
6403 if ((InterruptRequest & I2C_XFER_CPLT_IT) == I2C_XFER_CPLT_IT)
6425 uint32_t tmpisr = 0U;
6427 if ((InterruptRequest & I2C_XFER_TX_IT) == I2C_XFER_TX_IT)
6439 if ((InterruptRequest & I2C_XFER_RX_IT) == I2C_XFER_RX_IT)
6451 if ((InterruptRequest & I2C_XFER_LISTEN_IT) == I2C_XFER_LISTEN_IT)
6457 if ((InterruptRequest & I2C_XFER_ERROR_IT) == I2C_XFER_ERROR_IT)
6463 if ((InterruptRequest & I2C_XFER_CPLT_IT) == I2C_XFER_CPLT_IT)
6469 if ((InterruptRequest & I2C_XFER_RELOAD_IT) == I2C_XFER_RELOAD_IT)