错误[P​​e513]:无法将类型为“ void(*)(void *,CO_CANrxMsg_t *)”的值分配给类型为“ void(*)(void *,CanRxMsgTypeDef *)”的实体

时间:2018-09-28 09:06:03

标签: c compilation can-bus

我尝试编译CanOpenNode项目。我无法解决一个错误,任何人都可以帮忙。项目在“ C”中。

错误:

Error[Pe513]: a value of type "void (*)(void *, CO_CANrxMsg_t *)" cannot be assigned to an entity of type "void (*)(void *, CanRxMsgTypeDef *)" 

错误行:

buffer->pFunct = pFunct;

代码:

CO_ReturnError_t CO_CANrxBufferInit(
        CO_CANmodule_t          *CANmodule,
        uint16_t                index,
        uint16_t                ident,
        uint16_t                mask,
        bool_t                  rtr,
        void                    *object,
        void                    (*pFunct)(void *object, CO_CANrxMsg_t *message))
{
    CO_ReturnError_t ret = CO_ERROR_NO;
        //CAN_FilterConfTypeDef     sFilterConfig;
        uint16_t RXF, RXM;

    if((CANmodule!=NULL) && (object!=NULL) && (pFunct!=NULL) && (index < CANmodule->rxSize)){
        /* buffer, which will be configured */
        CO_CANrx_t *buffer = &CANmodule->rxArray[index];

        /* Configure object variables */
        buffer->object = object;
        buffer->pFunct = pFunct;

        /* CAN identifier and CAN mask, bit aligned with CAN module. Different on different microcontrollers. */
        //CAN identifier and CAN mask, bit aligned with CAN module registers
                RXF = (ident & 0x07FF) << 2;
                if (rtr) RXF |= 0x02;
                RXM = (mask & 0x07FF) << 2;
                RXM |= 0x02;
        //configure filter and mask
                if (RXF != buffer->ident || RXM != buffer->mask)
                {
                        buffer->ident = RXF;
                        buffer->mask = RXM;
                }
                ret = CO_ERROR_NO;
    }
    else{
        ret = CO_ERROR_ILLEGAL_ARGUMENT;
    }

    return ret;
}

0 个答案:

没有答案