Robus/src/reception.c
void Recep_GetData(volatile uint8_t *data)
{
    MsgAlloc_SetData(*data);
    if (data_count < data_size)
    {
        // Continue CRC computation until the end of data
        LuosHAL_ComputeCRC((uint8_t *)data, (uint8_t *)&crc_val);
    }
    else if (data_count > data_size)
    {
        uint16_t crc = ((uint16_t)current_msg->data[data_size]) | ((uint16_t)current_msg->data[data_size + 1] << 8);
        if (crc == crc_val)
        {
            if (((current_msg->header.target_mode == IDACK) || (current_msg->header.target_mode == NODEIDACK)))
            {
                Transmit_SendAck();
            }

            // Make an exception for reset detection command
            if (current_msg->header.cmd == RESET_DETECTION)
            {
                MsgAlloc_Reset();
                ctx.tx.status = TX_DISABLE;
            }
            else
            {
                MsgAlloc_EndMsg();
            }
        }
        else
        {
            ctx.rx.status.rx_error = true;
            if ((current_msg->header.target_mode == IDACK) || (current_msg->header.target_mode == NODEIDACK))
            {
                Transmit_SendAck();
            }
            MsgAlloc_InvalidMsg();
        }
        ctx.rx.callback = Recep_Drop;
        return;
    }
    data_count++;
}
/******************************************************************************
 * @brief Callback to get a complete data
 * @param data come from RX
 * @return None
 ******************************************************************************/
@brief Callback to get a complete data
@param data come from RX
@return None
@brief Callback to get a complete data @param data come from RX @return None
void Recep_GetData(volatile uint8_t *data)
{
    MsgAlloc_SetData(*data);
    if (data_count < data_size)
    {
        LuosHAL_ComputeCRC((uint8_t *)data, (uint8_t *)&crc_val);
    }
    else if (data_count > data_size)
    {
        uint16_t crc = ((uint16_t)current_msg->data[data_size]) | ((uint16_t)current_msg->data[data_size + 1] << 8);
        if (crc == crc_val)
        {
            if (((current_msg->header.target_mode == IDACK) || (current_msg->header.target_mode == NODEIDACK)))
            {
                Transmit_SendAck();
            }
            if (current_msg->header.cmd == RESET_DETECTION)
            {
                MsgAlloc_Reset();
                ctx.tx.status = TX_DISABLE;
            }
            else
            {
                MsgAlloc_EndMsg();
            }
        }
        else
        {
            ctx.rx.status.rx_error = true;
            if ((current_msg->header.target_mode == IDACK) || (current_msg->header.target_mode == NODEIDACK))
            {
                Transmit_SendAck();
            }
            MsgAlloc_InvalidMsg();
        }
        ctx.rx.callback = Recep_Drop;
        return;
    }
    data_count++;
}
void Recep_GetData ( volatile uint8_t * data ) { MsgAlloc_SetData ( * data ) ; if ( data_count < data_size ) { LuosHAL_ComputeCRC ( ( uint8_t * ) data , ( uint8_t * ) & crc_val ) ; } else if ( data_count > data_size ) { uint16_t crc = ( ( uint16_t ) current_msg -> data [ data_size ] ) | ( ( uint16_t ) current_msg -> data [ data_size + 1 ] << 8 ) ; if ( crc == crc_val ) { if ( ( ( current_msg -> header . target_mode == IDACK ) || ( current_msg -> header . target_mode == NODEIDACK ) ) ) { Transmit_SendAck ( ) ; } if ( current_msg -> header . cmd == RESET_DETECTION ) { MsgAlloc_Reset ( ) ; ctx . tx . status = TX_DISABLE ; } else { MsgAlloc_EndMsg ( ) ; } } else { ctx . rx . status . rx_error = true ; if ( ( current_msg -> header . target_mode == IDACK ) || ( current_msg -> header . target_mode == NODEIDACK ) ) { Transmit_SendAck ( ) ; } MsgAlloc_InvalidMsg ( ) ; } ctx . rx . callback = Recep_Drop ; return ; } data_count ++ ; }
@brief Callback to get a complete data
 @param data come from RX
 @return None
@brief Callback to get a complete data @param data come from RX @return None
// Continue CRC computation until the end of data // Make an exception for reset detection command