mbed

Fork of mbed-dev by mbed official

Revision:
178:d650f5d4c87a
Parent:
171:19eb464bc2be
Child:
180:b0033dcd6934
--- a/targets/TARGET_STM/TARGET_STM32L4/serial_device.c	Wed Oct 25 14:53:38 2017 +0100
+++ b/targets/TARGET_STM/TARGET_STM32L4/serial_device.c	Wed Nov 08 13:50:44 2017 +0000
@@ -230,7 +230,7 @@
         }
         if (__HAL_UART_GET_FLAG(huart, UART_FLAG_ORE) != RESET) {
             if (__HAL_UART_GET_IT(huart, UART_IT_ORE) != RESET) {
-                volatile uint32_t tmpval = huart->Instance->RDR; // Clear ORE flag
+                volatile uint32_t tmpval __attribute__((unused)) = huart->Instance->RDR; // Clear ORE flag
             }
         }
     }
@@ -659,13 +659,13 @@
 
 void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart) {
     if (__HAL_UART_GET_FLAG(huart, UART_FLAG_PE) != RESET) {
-        volatile uint32_t tmpval = huart->Instance->RDR; // Clear PE flag
+        volatile uint32_t tmpval __attribute__((unused)) = huart->Instance->RDR; // Clear PE flag
     } else if (__HAL_UART_GET_FLAG(huart, UART_FLAG_FE) != RESET) {
-        volatile uint32_t tmpval = huart->Instance->RDR; // Clear FE flag
+        volatile uint32_t tmpval __attribute__((unused)) = huart->Instance->RDR; // Clear FE flag
     } else if (__HAL_UART_GET_FLAG(huart, UART_FLAG_NE) != RESET) {
-        volatile uint32_t tmpval = huart->Instance->RDR; // Clear NE flag
+        volatile uint32_t tmpval __attribute__((unused)) = huart->Instance->RDR; // Clear NE flag
     } else if (__HAL_UART_GET_FLAG(huart, UART_FLAG_ORE) != RESET) {
-        volatile uint32_t tmpval = huart->Instance->RDR; // Clear ORE flag
+        volatile uint32_t tmpval __attribute__((unused)) = huart->Instance->RDR; // Clear ORE flag
     }
 }
 
@@ -716,9 +716,9 @@
     HAL_UART_IRQHandler(huart);
     
     // Abort if an error occurs
-    if (return_event & SERIAL_EVENT_RX_PARITY_ERROR ||
-            return_event & SERIAL_EVENT_RX_FRAMING_ERROR ||
-            return_event & SERIAL_EVENT_RX_OVERRUN_ERROR) {
+    if ((return_event & SERIAL_EVENT_RX_PARITY_ERROR) ||
+        (return_event & SERIAL_EVENT_RX_FRAMING_ERROR) ||
+        (return_event & SERIAL_EVENT_RX_OVERRUN_ERROR)) {
         return return_event;
     }
     
@@ -792,7 +792,7 @@
     
     // clear flags
     __HAL_UART_CLEAR_FLAG(huart, UART_FLAG_RXNE);
-    volatile uint32_t tmpval = huart->Instance->RDR; // Clear errors flag
+    volatile uint32_t tmpval __attribute__((unused)) = huart->Instance->RDR; // Clear errors flag
     
     // reset states
     huart->RxXferCount = 0;