L4 adaptaions
This commit is contained in:
@@ -1,9 +1,17 @@
|
||||
#include "CanDataHandler.h"
|
||||
#include "string.h"
|
||||
|
||||
#ifndef MAX_DATA_STORAGE
|
||||
#define MAX_DATA_STORAGE 100
|
||||
#endif
|
||||
|
||||
#ifndef MAX_EVENT_STORAGE
|
||||
#define MAX_EVENT_STORAGE 100
|
||||
#endif
|
||||
|
||||
#ifndef MAX_FILTER_SLOTS
|
||||
#define MAX_FILTER_SLOTS 100
|
||||
#endif
|
||||
|
||||
// storage for upto MAX_DATA_STORAGE diffrent messages
|
||||
static CanDataMessageSlot CanDataStore[MAX_DATA_STORAGE] = {0};
|
||||
@@ -76,8 +84,8 @@ CanDataFilterRef CanData_unusedFilterSlot(CanDataSlotFifo reqest_fifo) {
|
||||
if (CanFilterSlots[i].free < CANDATA_FULL) {
|
||||
|
||||
// either the fifo settig matches or is undefined
|
||||
if(CanFilterSlots[i].fifo == reqest_fifo || CanFilterSlots[i].fifo == CANDATA_FIFOX_UNDEFIEND)
|
||||
filterRef.ref = &CanFilterSlots[i];
|
||||
if(CanFilterSlots[i].fifo == reqest_fifo || CanFilterSlots[i].fifo == CANDATA_FIFOX_UNDEFIEND) {
|
||||
filterRef.ref = &CanFilterSlots[i];
|
||||
if (CanFilterSlots[i].fifo == CANDATA_FIFOX_UNDEFIEND) {
|
||||
CanFilterSlots[i].fifo = reqest_fifo;
|
||||
}
|
||||
@@ -101,6 +109,8 @@ CanDataFilterRef CanData_unusedFilterSlot(CanDataSlotFifo reqest_fifo) {
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return filterRef;
|
||||
@@ -216,7 +226,7 @@ size_t CanData_regDataManualMsg(const CanDataId* canid, size_t id_count, CLS_BSP
|
||||
if (!dataSlot) {
|
||||
return i; // No unused data slot available
|
||||
}
|
||||
|
||||
dataSlot->msg.canid = canid[i];
|
||||
dataSlot->filter = filterRef;
|
||||
dataSlot->filter.index = -1; // this idecates is a manual filter
|
||||
}
|
||||
@@ -248,7 +258,7 @@ bool CanData_regEventMsg(CanDataId canid, EventCallback event_callback) {
|
||||
}
|
||||
|
||||
// Find and configure an unused slot for the data message
|
||||
CanDataFilterRef filter = CanData_unusedFilterSlot(CANDATA_FIFO0_DATA);
|
||||
CanDataFilterRef filter = CanData_unusedFilterSlot(CANDATA_FIFO1_EVENT);
|
||||
if (filter.ref == NULL) {
|
||||
return false; // No unused filter slot available
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user