1
0
Fork 0

Expanded info passed through Emergency callback

This commit is contained in:
Wilkins White 2017-11-29 10:48:03 -08:00
parent ee9d809d0f
commit ecc4056bb4
2 changed files with 25 additions and 10 deletions

View file

@ -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);
}
}
}

View file

@ -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.