From ecc4056bb465f929ba81f57096e2c5898e5273e1 Mon Sep 17 00:00:00 2001 From: Wilkins White Date: Wed, 29 Nov 2017 10:48:03 -0800 Subject: [PATCH] Expanded info passed through Emergency callback --- stack/CO_Emergency.c | 20 ++++++++++++++------ stack/CO_Emergency.h | 15 +++++++++++---- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/stack/CO_Emergency.c b/stack/CO_Emergency.c index 49c5c2c..56b1b59 100644 --- a/stack/CO_Emergency.c +++ b/stack/CO_Emergency.c @@ -59,15 +59,19 @@ */ static void CO_EM_receive(void *object, const CO_CANrxMsg_t *msg){ CO_EM_t *em; - uint8_t errorBit; + uint16_t errorCode; uint32_t infoCode; em = (CO_EM_t*)object; if(em->pFunctSignal!=NULL){ - errorBit = msg->data[3]; + CO_memcpySwap2(&errorCode, &msg->data[0]); CO_memcpySwap4(&infoCode, &msg->data[4]); - em->pFunctSignal(errorBit, infoCode); + em->pFunctSignal(msg->ident, + errorCode, + msg->data[2], + msg->data[3], + infoCode); } } @@ -218,7 +222,11 @@ CO_ReturnError_t CO_EM_init( /******************************************************************************/ void CO_EM_initCallback( CO_EM_t *em, - void (*pFunctSignal)(const uint8_t errorBit, const uint32_t infoCode)) + void (*pFunctSignal)(const uint32_t ident, + const uint16_t errorCode, + const uint8_t errorRegister, + const uint8_t errorBit, + const uint32_t infoCode)) { if(em != NULL){ em->pFunctSignal = pFunctSignal; @@ -366,7 +374,7 @@ void CO_errorReport(CO_EM_t *em, const uint8_t errorBit, const uint16_t errorCod /* Optional signal to RTOS, which can resume task, which handles CO_EM_process */ if(em->pFunctSignal != NULL) { - em->pFunctSignal(errorBit, infoCode); + em->pFunctSignal(0, errorCode, 0, errorBit, infoCode); } } } @@ -425,7 +433,7 @@ void CO_errorReset(CO_EM_t *em, const uint8_t errorBit, const uint32_t infoCode) /* Optional signal to RTOS, which can resume task, which handles CO_EM_process */ if(em->pFunctSignal != NULL) { - em->pFunctSignal(errorBit, infoCode); + em->pFunctSignal(0, 0, 0, errorBit, infoCode); } } } diff --git a/stack/CO_Emergency.h b/stack/CO_Emergency.h index 384483b..49b6149 100644 --- a/stack/CO_Emergency.h +++ b/stack/CO_Emergency.h @@ -283,7 +283,11 @@ typedef struct{ uint8_t wrongErrorReport; /**< Error in arguments to CO_errorReport() */ /** From CO_EM_initCallback() or NULL */ - void (*pFunctSignal)(const uint8_t errorBit, const uint32_t infoCode); + void (*pFunctSignal)(const uint32_t ident, + const uint16_t errorCode, + const uint8_t errorRegister, + const uint8_t errorBit, + const uint32_t infoCode); }CO_EM_t; @@ -410,9 +414,12 @@ CO_ReturnError_t CO_EM_init( * @param pFunctSignal Pointer to the callback function. Not called if NULL. */ void CO_EM_initCallback( - CO_EM_t *em, - void (*pFunctSignal)(const uint8_t errorBit, const uint32_t infoCode)); - + CO_EM_t *em, + void (*pFunctSignal)(const uint32_t ident, + const uint16_t errorCode, + const uint8_t errorRegister, + const uint8_t errorBit, + const uint32_t infoCode)); /** * Process Error control and Emergency object.