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
T
Stefano Calabretti 4d5c1934a4 Scs (#3)
* 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>
2022-02-23 21:08:47 +01:00

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;
}