]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/blobdiff - source/notification.c
CANLOOPBACK extended to support CAN1, CAN2, CAN3. User can choose vchich CAN is sourc...
[pes-rpp/rpp-test-sw.git] / source / notification.c
index 85ea15e8d9d951ba917d7ac58d6d965338ce690e..33978037fb5c9ed2578c85459debc92136ba1844 100644 (file)
@@ -28,6 +28,7 @@
  *\r
  * Defined in commands.c */\r
 extern xSemaphoreHandle canMsgReceived;\r
+extern xSemaphoreHandle canMsgSent;\r
 /** @brief Semaphore blocking task when it waits for interrupt signaling end of the conversion\r
  *\r
  * Defined in commands.c */\r
@@ -37,6 +38,7 @@ extern xSemaphoreHandle adcDataConverted;
  *     Defined in commands.c */\r
 extern ADCData_t adcData;\r
 extern canBASE_t *canDst;\r
+extern canBASE_t *canSrc;\r
 extern uint32_t canMsgBox;\r
 /* USER CODE END */\r
 \r
@@ -110,7 +112,12 @@ void adcNotification(adcBASE_t *adc, uint32_t group)
 void canErrorNotification(canBASE_t *node, uint32_t notification)\r
 {\r
 /* USER CODE BEGIN (13) */\r
-       if (notification != canERROR_OK) while(1) ;             // Critical error during CAN transaction\r
+       if (node == canSrc) {\r
+               xSemaphoreGiveFromISR(canMsgSent, NULL);\r
+       }\r
+       if (node == canDst) {\r
+               xSemaphoreGiveFromISR(canMsgReceived, NULL);\r
+       }\r
 /* USER CODE END */\r
 \r
 }\r
@@ -126,9 +133,13 @@ void canMessageNotification(canBASE_t *node, uint32_t messageBox)
        {\r
                if (node == canDst) {\r
                        /* node 2 - receive testloopback message complete */\r
-                        while(!canIsRxMessageArrived(node, canMsgBox));\r
+                        while(!canIsRxMessageArrived(node, canMsgBox))\r
+                                ;\r
                         xSemaphoreGiveFromISR(canMsgReceived, NULL);\r
                }\r
+               if (node == canSrc) {\r
+                        xSemaphoreGiveFromISR(canMsgSent, NULL);\r
+               }\r
        }\r
 \r
 /* USER CODE END */\r