mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Revision:
151:5eaa88a5bcc7
Parent:
149:156823d33999
Child:
153:fa9ff456f731
--- a/targets/TARGET_STM/TARGET_STM32L0/device/stm32l0xx_hal_spi.c	Tue Nov 08 17:45:16 2016 +0000
+++ b/targets/TARGET_STM/TARGET_STM32L0/device/stm32l0xx_hal_spi.c	Thu Nov 24 17:03:03 2016 +0000
@@ -2,8 +2,8 @@
   ******************************************************************************
   * @file    stm32l0xx_hal_spi.c
   * @author  MCD Application Team
-  * @version V1.5.0
-  * @date    8-January-2016
+  * @version V1.7.0
+  * @date    31-May-2016
   * @brief   SPI HAL module driver.
   *    
   *          This file provides firmware functions to manage the following 
@@ -164,7 +164,7 @@
 /** @addtogroup SPI_Private
   * @{
   */
-#define SPI_TIMEOUT_VALUE  10
+#define SPI_TIMEOUT_VALUE  10U
 
 /* Private macro -------------------------------------------------------------*/
 /* Private variables ---------------------------------------------------------*/
@@ -277,7 +277,7 @@
                                   hspi->Init.BaudRatePrescaler | hspi->Init.FirstBit  | hspi->Init.CRCCalculation) );
 
   /* Configure : NSS management */
-  WRITE_REG(hspi->Instance->CR2, (((hspi->Init.NSS >> 16) & SPI_CR2_SSOE) | hspi->Init.TIMode));
+  WRITE_REG(hspi->Instance->CR2, (((hspi->Init.NSS >> 16U) & SPI_CR2_SSOE) | hspi->Init.TIMode));
 
   /*---------------------------- SPIx CRCPOLY Configuration ------------------*/
   /* Configure : CRC Polynomial */
@@ -429,7 +429,7 @@
 
   if(hspi->State == HAL_SPI_STATE_READY)
   {
-    if((pData == NULL ) || (Size == 0)) 
+    if((pData == NULL ) || (Size == 0U)) 
     {
       return  HAL_ERROR;
     }
@@ -449,11 +449,11 @@
     hspi->TxXferCount = Size;
 
     /*Init field not used in handle to zero */
-    hspi->TxISR = 0;
-    hspi->RxISR = 0;
+    hspi->TxISR = 0U;
+    hspi->RxISR = 0U;
     hspi->pRxBuffPtr  = NULL;
-    hspi->RxXferSize  = 0;
-    hspi->RxXferCount = 0;
+    hspi->RxXferSize  = 0U;
+    hspi->RxXferCount = 0U;
 
     /* Reset CRC Calculation */
     if(hspi->Init.CRCCalculation == SPI_CRCCALCULATION_ENABLE)
@@ -477,13 +477,13 @@
     /* Transmit data in 8 Bit mode */
     if(hspi->Init.DataSize == SPI_DATASIZE_8BIT)
     {
-      if((hspi->Init.Mode == SPI_MODE_SLAVE)|| (hspi->TxXferCount == 0x01))
+      if((hspi->Init.Mode == SPI_MODE_SLAVE)|| (hspi->TxXferCount == 0x01U))
       {
         hspi->Instance->DR = (*hspi->pTxBuffPtr++);
         hspi->TxXferCount--;
       }
 
-      while(hspi->TxXferCount > 0)
+      while(hspi->TxXferCount > 0U)
       {
         /* Wait until TXE flag is set to send data */
         if(SPI_WaitOnFlagUntilTimeout(hspi, SPI_FLAG_TXE, RESET, Timeout) != HAL_OK)
@@ -502,14 +502,14 @@
     /* Transmit data in 16 Bit mode */
     else
     {
-      if((hspi->Init.Mode == SPI_MODE_SLAVE) || (hspi->TxXferCount == 0x01))
+      if((hspi->Init.Mode == SPI_MODE_SLAVE) || (hspi->TxXferCount == 0x01U))
       {
         hspi->Instance->DR = *((uint16_t*)hspi->pTxBuffPtr);
-        hspi->pTxBuffPtr+=2;
+        hspi->pTxBuffPtr+=2U;
         hspi->TxXferCount--;
       }
 
-      while(hspi->TxXferCount > 0)
+      while(hspi->TxXferCount > 0U)
       {
         /* Wait until TXE flag is set to send data */
         if(SPI_WaitOnFlagUntilTimeout(hspi, SPI_FLAG_TXE, RESET, Timeout) != HAL_OK)
@@ -517,7 +517,7 @@
           return HAL_TIMEOUT;
         }
         hspi->Instance->DR = *((uint16_t*)hspi->pTxBuffPtr);
-        hspi->pTxBuffPtr+=2;
+        hspi->pTxBuffPtr+=2U;
         hspi->TxXferCount--;
       }
       /* Enable CRC Transmission */
@@ -571,11 +571,11 @@
   */
 HAL_StatusTypeDef HAL_SPI_Receive(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size, uint32_t Timeout)
 {
-  __IO uint16_t tmpreg = 0;
+  __IO uint16_t tmpreg = 0U;
 
   if(hspi->State == HAL_SPI_STATE_READY)
   {
-    if((pData == NULL ) || (Size == 0)) 
+    if((pData == NULL ) || (Size == 0U)) 
     {
       return  HAL_ERROR;
     }
@@ -592,11 +592,11 @@
     hspi->RxXferCount = Size;
 
     /*Init field not used in handle to zero */
-    hspi->RxISR = 0;
-    hspi->TxISR = 0;
+    hspi->RxISR = 0U;
+    hspi->TxISR = 0U;
     hspi->pTxBuffPtr  = NULL;
-    hspi->TxXferSize  = 0;
-    hspi->TxXferCount = 0;
+    hspi->TxXferSize  = 0U;
+    hspi->TxXferCount = 0U;
 
     /* Configure communication direction : 1Line */
     if(hspi->Init.Direction == SPI_DIRECTION_1LINE)
@@ -629,7 +629,7 @@
     /* Receive data in 8 Bit mode */
     if(hspi->Init.DataSize == SPI_DATASIZE_8BIT)
     {
-      while(hspi->RxXferCount > 1)
+      while(hspi->RxXferCount > 1U)
       {
         /* Wait until RXNE flag is set */
         if(SPI_WaitOnFlagUntilTimeout(hspi, SPI_FLAG_RXNE, RESET, Timeout) != HAL_OK)
@@ -649,7 +649,7 @@
     /* Receive data in 16 Bit mode */
     else
     {
-      while(hspi->RxXferCount > 1)
+      while(hspi->RxXferCount > 1U)
       {
         /* Wait until RXNE flag is set to read data */
         if(SPI_WaitOnFlagUntilTimeout(hspi, SPI_FLAG_RXNE, RESET, Timeout) != HAL_OK)
@@ -658,7 +658,7 @@
         }
 
         *((uint16_t*)hspi->pRxBuffPtr) = hspi->Instance->DR;
-        hspi->pRxBuffPtr+=2;
+        hspi->pRxBuffPtr+=2U;
         hspi->RxXferCount--;
       }
       /* Enable CRC Reception */
@@ -683,7 +683,7 @@
     else
     {
       *((uint16_t*)hspi->pRxBuffPtr) = hspi->Instance->DR;
-      hspi->pRxBuffPtr+=2;
+      hspi->pRxBuffPtr+=2U;
     }
     hspi->RxXferCount--;
 
@@ -747,11 +747,11 @@
   */
 HAL_StatusTypeDef HAL_SPI_TransmitReceive(SPI_HandleTypeDef *hspi, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size, uint32_t Timeout)
 {
-  __IO uint16_t tmpreg = 0;
+  __IO uint16_t tmpreg = 0U;
 
   if((hspi->State == HAL_SPI_STATE_READY) || (hspi->State == HAL_SPI_STATE_BUSY_RX))
   {
-    if((pTxData == NULL ) || (pRxData == NULL ) || (Size == 0))
+    if((pTxData == NULL ) || (pRxData == NULL ) || (Size == 0U))
     {
       return  HAL_ERROR;
     }
@@ -780,8 +780,8 @@
     hspi->TxXferCount = Size;
 
     /*Init field not used in handle to zero */
-    hspi->RxISR = 0;
-    hspi->TxISR = 0;
+    hspi->RxISR = 0U;
+    hspi->TxISR = 0U;
 
     /* Reset CRC Calculation */
     if(hspi->Init.CRCCalculation == SPI_CRCCALCULATION_ENABLE)
@@ -799,13 +799,13 @@
     /* Transmit and Receive data in 16 Bit mode */
     if(hspi->Init.DataSize == SPI_DATASIZE_16BIT)
     {
-      if((hspi->Init.Mode == SPI_MODE_SLAVE) || ((hspi->Init.Mode == SPI_MODE_MASTER) && (hspi->TxXferCount == 0x01)))
+      if((hspi->Init.Mode == SPI_MODE_SLAVE) || ((hspi->Init.Mode == SPI_MODE_MASTER) && (hspi->TxXferCount == 0x01U)))
       {
         hspi->Instance->DR = *((uint16_t*)hspi->pTxBuffPtr);
-        hspi->pTxBuffPtr+=2;
+        hspi->pTxBuffPtr+=2U;
         hspi->TxXferCount--;
       }
-      if(hspi->TxXferCount == 0)
+      if(hspi->TxXferCount == 0U)
       {
         /* Enable CRC Transmission */
         if(hspi->Init.CRCCalculation == SPI_CRCCALCULATION_ENABLE)
@@ -820,12 +820,12 @@
         }
 
         *((uint16_t*)hspi->pRxBuffPtr) = hspi->Instance->DR;
-        hspi->pRxBuffPtr+=2;
+        hspi->pRxBuffPtr+=2U;
         hspi->RxXferCount--;
       }
       else
       {
-        while(hspi->TxXferCount > 0)
+        while(hspi->TxXferCount > 0U)
         {
           /* Wait until TXE flag is set to send data */
           if(SPI_WaitOnFlagUntilTimeout(hspi, SPI_FLAG_TXE, RESET, Timeout) != HAL_OK)
@@ -834,11 +834,11 @@
           }
 
           hspi->Instance->DR = *((uint16_t*)hspi->pTxBuffPtr);
-          hspi->pTxBuffPtr+=2;
+          hspi->pTxBuffPtr+=2U;
           hspi->TxXferCount--;
 
           /* Enable CRC Transmission */
-          if((hspi->TxXferCount == 0) && (hspi->Init.CRCCalculation == SPI_CRCCALCULATION_ENABLE))
+          if((hspi->TxXferCount == 0U) && (hspi->Init.CRCCalculation == SPI_CRCCALCULATION_ENABLE))
           {
             SET_BIT(hspi->Instance->CR1, SPI_CR1_CRCNEXT);
           }
@@ -850,7 +850,7 @@
           }
 
           *((uint16_t*)hspi->pRxBuffPtr) = hspi->Instance->DR;
-          hspi->pRxBuffPtr+=2;
+          hspi->pRxBuffPtr+=2U;
           hspi->RxXferCount--;
         }
         /* Receive the last byte */
@@ -863,7 +863,7 @@
           }
           
           *((uint16_t*)hspi->pRxBuffPtr) = hspi->Instance->DR;
-          hspi->pRxBuffPtr+=2;
+          hspi->pRxBuffPtr+=2U;
           hspi->RxXferCount--;
         }
       }
@@ -871,12 +871,12 @@
     /* Transmit and Receive data in 8 Bit mode */
     else
     {
-      if((hspi->Init.Mode == SPI_MODE_SLAVE) || ((hspi->Init.Mode == SPI_MODE_MASTER) && (hspi->TxXferCount == 0x01)))
+      if((hspi->Init.Mode == SPI_MODE_SLAVE) || ((hspi->Init.Mode == SPI_MODE_MASTER) && (hspi->TxXferCount == 0x01U)))
       {
         hspi->Instance->DR = (*hspi->pTxBuffPtr++);
         hspi->TxXferCount--;
       }
-      if(hspi->TxXferCount == 0)
+      if(hspi->TxXferCount == 0U)
       {
         /* Enable CRC Transmission */
         if(hspi->Init.CRCCalculation == SPI_CRCCALCULATION_ENABLE)
@@ -895,7 +895,7 @@
       }
       else
       {
-        while(hspi->TxXferCount > 0)
+        while(hspi->TxXferCount > 0U)
         {
           /* Wait until TXE flag is set to send data */
           if(SPI_WaitOnFlagUntilTimeout(hspi, SPI_FLAG_TXE, RESET, Timeout) != HAL_OK)
@@ -907,7 +907,7 @@
           hspi->TxXferCount--;
 
           /* Enable CRC Transmission */
-          if((hspi->TxXferCount == 0) && (hspi->Init.CRCCalculation == SPI_CRCCALCULATION_ENABLE))
+          if((hspi->TxXferCount == 0U) && (hspi->Init.CRCCalculation == SPI_CRCCALCULATION_ENABLE))
           {
             SET_BIT(hspi->Instance->CR1, SPI_CR1_CRCNEXT);
           }
@@ -994,7 +994,7 @@
 {
   if(hspi->State == HAL_SPI_STATE_READY)
   {
-    if((pData == NULL) || (Size == 0))
+    if((pData == NULL) || (Size == 0U))
     {
       return  HAL_ERROR;
     }
@@ -1015,10 +1015,10 @@
     hspi->TxXferCount  = Size;
 
     /*Init field not used in handle to zero */
-    hspi->RxISR        = 0;
+    hspi->RxISR        = 0U;
     hspi->pRxBuffPtr   = NULL;
-    hspi->RxXferSize   = 0;
-    hspi->RxXferCount  = 0;
+    hspi->RxXferSize   = 0U;
+    hspi->RxXferCount  = 0U;
 
     /* Configure communication direction : 1Line */
     if(hspi->Init.Direction == SPI_DIRECTION_1LINE)
@@ -1071,7 +1071,7 @@
 {
   if(hspi->State == HAL_SPI_STATE_READY)
   {
-    if((pData == NULL) || (Size == 0)) 
+    if((pData == NULL) || (Size == 0U)) 
     {
       return  HAL_ERROR;
     }
@@ -1089,10 +1089,10 @@
     hspi->RxXferCount  = Size ; 
 
    /*Init field not used in handle to zero */
-    hspi->TxISR        = 0;
+    hspi->TxISR        = 0U;
     hspi->pTxBuffPtr   = NULL;
-    hspi->TxXferSize   = 0;
-    hspi->TxXferCount  = 0;
+    hspi->TxXferSize   = 0U;
+    hspi->TxXferCount  = 0U;
 
     /* Configure communication direction : 1Line */
     if(hspi->Init.Direction == SPI_DIRECTION_1LINE)
@@ -1154,7 +1154,7 @@
   if((hspi->State == HAL_SPI_STATE_READY) || \
      ((hspi->Init.Mode == SPI_MODE_MASTER) && (hspi->Init.Direction == SPI_DIRECTION_2LINES) && (hspi->State == HAL_SPI_STATE_BUSY_RX)))
   {
-    if((pTxData == NULL ) || (pRxData == NULL ) || (Size == 0)) 
+    if((pTxData == NULL ) || (pRxData == NULL ) || (Size == 0U)) 
     {
       return  HAL_ERROR;
     }
@@ -1223,7 +1223,7 @@
 {
   if(hspi->State == HAL_SPI_STATE_READY)
   {
-    if((pData == NULL) || (Size == 0))
+    if((pData == NULL) || (Size == 0U))
     {
 	  /* Process Unlocked */
       __HAL_UNLOCK(hspi);
@@ -1245,12 +1245,12 @@
     hspi->TxXferCount = Size;
 
     /*Init field not used in handle to zero */
-    hspi->TxISR       = 0;
-    hspi->RxISR       = 0;
+    hspi->TxISR       = 0U;
+    hspi->RxISR       = 0U;
 	
     hspi->pRxBuffPtr  = NULL;
-    hspi->RxXferSize  = 0;
-    hspi->RxXferCount = 0;
+    hspi->RxXferSize  = 0U;
+    hspi->RxXferCount = 0U;
 
     /* Configure communication direction : 1Line */
     if(hspi->Init.Direction == SPI_DIRECTION_1LINE)
@@ -1317,7 +1317,7 @@
 {
   if(hspi->State == HAL_SPI_STATE_READY)
   {
-    if((pData == NULL) || (Size == 0))
+    if((pData == NULL) || (Size == 0U))
     {
 	  /* Process Unlocked */
       __HAL_UNLOCK(hspi);
@@ -1336,12 +1336,12 @@
     hspi->RxXferCount = Size;
 
     /*Init field not used in handle to zero */
-    hspi->RxISR       = 0;
-    hspi->TxISR       = 0;
+    hspi->RxISR       = 0U;
+    hspi->TxISR       = 0U;
 	
     hspi->pTxBuffPtr  = NULL;
-    hspi->TxXferSize  = 0;
-    hspi->TxXferCount = 0;
+    hspi->TxXferSize  = 0U;
+    hspi->TxXferCount = 0U;
 
     /* Configure communication direction : 1Line */
     if(hspi->Init.Direction == SPI_DIRECTION_1LINE)
@@ -1418,7 +1418,7 @@
   if((hspi->State == HAL_SPI_STATE_READY) || \
      ((hspi->Init.Mode == SPI_MODE_MASTER) && (hspi->Init.Direction == SPI_DIRECTION_2LINES) && (hspi->State == HAL_SPI_STATE_BUSY_RX)))
   {
-    if((pTxData == NULL ) || (pRxData == NULL ) || (Size == 0))
+    if((pTxData == NULL ) || (pRxData == NULL ) || (Size == 0U))
     {
       return  HAL_ERROR;
     }
@@ -1447,8 +1447,8 @@
     hspi->RxXferCount = Size;
 
     /*Init field not used in handle to zero */
-    hspi->RxISR = 0;
-    hspi->TxISR = 0;
+    hspi->RxISR = 0U;
+    hspi->TxISR = 0U;
 
     /* Reset CRC Calculation */
     if(hspi->Init.CRCCalculation == SPI_CRCCALCULATION_ENABLE)
@@ -1902,11 +1902,11 @@
   else
   {
     hspi->Instance->DR = *((uint16_t*)hspi->pTxBuffPtr);
-    hspi->pTxBuffPtr+=2;
+    hspi->pTxBuffPtr+=2U;
   }
   hspi->TxXferCount--;
 
-  if(hspi->TxXferCount == 0)
+  if(hspi->TxXferCount == 0U)
   {
     if(hspi->Init.CRCCalculation == SPI_CRCCALCULATION_ENABLE)
     {
@@ -1925,7 +1925,7 @@
   */
 static void SPI_RxCloseIRQHandler(SPI_HandleTypeDef *hspi)
 {
-  __IO uint16_t tmpreg = 0;
+  __IO uint16_t tmpreg = 0U;
 
   if(hspi->Init.CRCCalculation == SPI_CRCCALCULATION_ENABLE)
   {
@@ -2014,11 +2014,11 @@
   else
   {
     *((uint16_t*)hspi->pRxBuffPtr) = hspi->Instance->DR;
-    hspi->pRxBuffPtr+=2;
+    hspi->pRxBuffPtr+=2U;
   }
   hspi->RxXferCount--;
 
-  if(hspi->RxXferCount==0)
+  if(hspi->RxXferCount==0U)
   {
     SPI_RxCloseIRQHandler(hspi);
   }
@@ -2041,18 +2041,18 @@
   else
   {
     *((uint16_t*)hspi->pRxBuffPtr) = hspi->Instance->DR;
-    hspi->pRxBuffPtr+=2;
+    hspi->pRxBuffPtr+=2U;
   }
     hspi->RxXferCount--;
 
   /* Enable CRC Transmission */
-  if((hspi->RxXferCount == 1) && (hspi->Init.CRCCalculation == SPI_CRCCALCULATION_ENABLE))
+  if((hspi->RxXferCount == 1U) && (hspi->Init.CRCCalculation == SPI_CRCCALCULATION_ENABLE))
   {
     /* Set CRC Next to calculate CRC on Rx side */
     SET_BIT(hspi->Instance->CR1, SPI_CR1_CRCNEXT);
   }
 
-  if(hspi->RxXferCount == 0)
+  if(hspi->RxXferCount == 0U)
   {
     SPI_RxCloseIRQHandler(hspi);
   }
@@ -2070,7 +2070,7 @@
 
 
   /* DMA Normal Mode */
-  if((hdma->Instance->CCR & DMA_CCR_CIRC) == 0)
+  if((hdma->Instance->CCR & DMA_CCR_CIRC) == 0U)
   {
     /* Wait until TXE flag is set to send data */
     if(SPI_WaitOnFlagUntilTimeout(hspi, SPI_FLAG_TXE, RESET, SPI_TIMEOUT_VALUE) != HAL_OK)
@@ -2087,7 +2087,7 @@
       SET_BIT(hspi->ErrorCode, HAL_SPI_ERROR_FLAG);
     }
 
-    hspi->TxXferCount = 0;
+    hspi->TxXferCount = 0U;
     hspi->State = HAL_SPI_STATE_READY;
   }
 
@@ -2116,12 +2116,12 @@
   */
 static void SPI_DMAReceiveCplt(DMA_HandleTypeDef *hdma)
 {
-  __IO uint16_t tmpreg = 0;
+  __IO uint16_t tmpreg = 0U;
 
   SPI_HandleTypeDef* hspi = ( SPI_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent;
 
   /* DMA Normal mode */
-  if((hdma->Instance->CCR & DMA_CCR_CIRC) == 0)
+  if((hdma->Instance->CCR & DMA_CCR_CIRC) == 0U)
   {
     /* Disable Rx DMA Request */
     CLEAR_BIT(hspi->Instance->CR2, SPI_CR2_RXDMAEN);
@@ -2162,7 +2162,7 @@
       __HAL_SPI_DISABLE(hspi);
     }
 
-    hspi->RxXferCount = 0;
+    hspi->RxXferCount = 0U;
     hspi->State = HAL_SPI_STATE_READY;
 
     /* Check if Errors has been detected during transfer */
@@ -2189,10 +2189,10 @@
   */
 static void SPI_DMATransmitReceiveCplt(DMA_HandleTypeDef *hdma)   
 {
-  __IO uint16_t tmpreg = 0;
+  __IO uint16_t tmpreg = 0U;
 
   SPI_HandleTypeDef* hspi = ( SPI_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent;
-  if((hdma->Instance->CCR & DMA_CCR_CIRC) == 0)
+  if((hdma->Instance->CCR & DMA_CCR_CIRC) == 0U)
   {
     /* CRC Calculation handling */
     if(hspi->Init.CRCCalculation == SPI_CRCCALCULATION_ENABLE)
@@ -2236,8 +2236,8 @@
     /* Disable Rx DMA Request */
     CLEAR_BIT(hspi->Instance->CR2, SPI_CR2_RXDMAEN);
 
-    hspi->TxXferCount = 0;
-    hspi->RxXferCount = 0;
+    hspi->TxXferCount = 0U;
+    hspi->RxXferCount = 0U;
 
     hspi->State = HAL_SPI_STATE_READY;
 
@@ -2305,8 +2305,8 @@
 static void SPI_DMAError(DMA_HandleTypeDef *hdma)
 {
   SPI_HandleTypeDef* hspi = (SPI_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent;
-  hspi->TxXferCount = 0;
-  hspi->RxXferCount = 0;
+  hspi->TxXferCount = 0U;
+  hspi->RxXferCount = 0U;
   hspi->State= HAL_SPI_STATE_READY;
   SET_BIT(hspi->ErrorCode, HAL_SPI_ERROR_DMA);
   HAL_SPI_ErrorCallback(hspi);
@@ -2323,7 +2323,7 @@
   */
 static HAL_StatusTypeDef SPI_WaitOnFlagUntilTimeout(SPI_HandleTypeDef *hspi, uint32_t Flag, FlagStatus Status, uint32_t Timeout)  
 {
-  uint32_t tickstart = 0;
+  uint32_t tickstart = 0U;
 
   /* Get tick */ 
   tickstart = HAL_GetTick();
@@ -2335,7 +2335,7 @@
     {
       if(Timeout != HAL_MAX_DELAY)
       {
-        if((Timeout == 0) || ((HAL_GetTick() - tickstart ) > Timeout))
+        if((Timeout == 0U) || ((HAL_GetTick() - tickstart ) > Timeout))
         {
           /* Disable the SPI and reset the CRC: the CRC value should be cleared
              on both master and slave sides in order to resynchronize the master
@@ -2369,7 +2369,7 @@
     {
       if(Timeout != HAL_MAX_DELAY)
       {
-        if((Timeout == 0) || ((HAL_GetTick() - tickstart ) > Timeout))
+        if((Timeout == 0U) || ((HAL_GetTick() - tickstart ) > Timeout))
         {
           /* Disable the SPI and reset the CRC: the CRC value should be cleared
              on both master and slave sides in order to resynchronize the master