4d5c1934a4
* Add send scs * Create scs dict * Fix compilation errors * Fix compile error * Change default include * Add Timer SCS manager * Remove unused files * Fix bugs * Add documentation * Add SCS manager bozza * Refactor * Use same naming convention * Add tick provider * Update header * Fix header bit translation * Test HandleNext OK * Remove linting * Remove indents * Add documentation * Improve docs * Remove pointer * Remove mailbox * Remove useless comment * Add newline * Fix compile errors * Separate scs entries from manager * Refactor * Fix include guards Co-authored-by: nicolagutierrez <nicolagutierrez.ng@gmail.com>
36 lines
915 B
C
36 lines
915 B
C
#include "mmr_can_header.h"
|
|
#include "mmr_can_util.h"
|
|
#include "mmr_can_optimize.h"
|
|
|
|
uint32_t MMR_CAN_HeaderToBits(MmrCanHeader header) {
|
|
return 0
|
|
| ((uint32_t)header.priority << 26)
|
|
| ((uint32_t)header.messageId << 23)
|
|
| ((uint32_t)header.senderId << 13)
|
|
| ((uint32_t)header.seqNumber << 3)
|
|
| ((uint32_t)header.messageType);
|
|
}
|
|
|
|
MmrCanHeader MMR_CAN_HeaderFromBits(uint32_t bits) {
|
|
return (MmrCanHeader) {
|
|
.priority = bits >> 26,
|
|
.messageId = bits >> 23,
|
|
.senderId = bits >> 13,
|
|
.seqNumber = bits >> 3,
|
|
.messageType = bits,
|
|
};
|
|
}
|
|
|
|
|
|
bool MMR_CAN_IsHeaderScs(MmrCanHeader header) {
|
|
return header.messageType == MMR_CAN_MESSAGE_TYPE_SCS;
|
|
}
|
|
|
|
bool MMR_CAN_IsMultiFrame(MmrCanHeader header) {
|
|
return header.messageType == MMR_CAN_MESSAGE_TYPE_MULTI_FRAME;
|
|
}
|
|
|
|
bool MMR_CAN_IsMultiFrameEnd(MmrCanHeader header) {
|
|
return header.messageType == MMR_CAN_MESSAGE_TYPE_MULTI_FRAME_END;
|
|
}
|