This repository has been archived on 2026-02-22. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
can/Src/mmr_can_header.c
Stefano Calabretti f34e2a1fc6 WIP
2022-05-17 14:17:50 +02:00

33 lines
712 B
C

#include "mmr_can_header.h"
#include "mmr_can_util.h"
#include "mmr_can_optimize.h"
struct MmrCanHeader {
};
uint32_t MMR_CAN_HeaderToBits(MmrCanHeader header) {
return 0
| ((uint32_t)header.priority << 26)
| ((uint32_t)header.messageId << 16)
| ((uint32_t)header.senderId << 6)
| ((uint32_t)header.seqNumber << 3)
| ((uint32_t)header.messageType);
}
MmrCanHeader MMR_CAN_HeaderFromBits(uint32_t bits) {
return (MmrCanHeader) {
.priority = bits >> 26,
.messageId = bits >> 16,
.senderId = bits >> 6,
.seqNumber = bits >> 3,
.messageType = bits,
};
}
bool MMR_CAN_IsHeaderScs(MmrCanHeader header) {
return header.messageType == MMR_CAN_MESSAGE_TYPE_SCS;
}