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>
This commit was merged in pull request #3.
This commit is contained in:
committed by
GitHub
parent
7aa61ed9ad
commit
4d5c1934a4
+43
-13
@@ -1,3 +1,13 @@
|
||||
/**
|
||||
* @file mmr_can_header.h
|
||||
* @brief
|
||||
* This file defines the header used for the can message,
|
||||
* along with its utilities.
|
||||
*
|
||||
* With header is intended the ExtendedId portion
|
||||
* of the can message.
|
||||
*/
|
||||
|
||||
#ifndef INC_MMR_CAN_HEADER_H_
|
||||
#define INC_MMR_CAN_HEADER_H_
|
||||
|
||||
@@ -12,17 +22,17 @@
|
||||
* portion of the CAN bus message (that is, the lower 5 bits
|
||||
* of the standard id)
|
||||
*
|
||||
* They are used to check if a message is either standalone
|
||||
* or split into multiple frames
|
||||
* They are used to check if a message is either standalone, an
|
||||
* acknowledgement or split into multiple frames
|
||||
*
|
||||
* When the priority and id fields are the same, multi-frame
|
||||
* messages have a higher priority over normal ones
|
||||
* Constants with lower values have an higher priority.
|
||||
*/
|
||||
typedef enum {
|
||||
MMR_CAN_MESSAGE_ACK = B_(0001),
|
||||
MMR_CAN_MESSAGE_TYPE_SCS = B_(0000),
|
||||
MMR_CAN_MESSAGE_TYPE_ACK = B_(0001),
|
||||
MMR_CAN_MESSAGE_TYPE_MULTI_FRAME = B_(0010),
|
||||
MMR_CAN_MESSAGE_TYPE_MULTI_FRAME_END = B_(0011),
|
||||
MMR_CAN_MESSAGE_TYPE_NORMAL = B_(1000),
|
||||
MMR_CAN_MESSAGE_TYPE_NORMAL = B_(0100),
|
||||
} MmrCanMessageType;
|
||||
|
||||
|
||||
@@ -40,16 +50,36 @@ typedef enum {
|
||||
*/
|
||||
typedef struct {
|
||||
MmrCanMessagePriority priority : 3;
|
||||
MmrCanMessageId messageId : 10;
|
||||
uint32_t senderId : 12;
|
||||
MmrCanMessageType messageType : 4;
|
||||
uint16_t messageId : 10;
|
||||
uint16_t senderId : 10;
|
||||
uint8_t seqNumber : 3;
|
||||
MmrCanMessageType messageType : 3;
|
||||
} MmrCanHeader;
|
||||
|
||||
|
||||
uint32_t *MMR_CAN_HeaderToBits(MmrCanHeader *header);
|
||||
MmrCanHeader *MMR_CAN_HeaderFromBits(uint32_t *bits);
|
||||
/**
|
||||
* @brief
|
||||
* Serializes an MmrCanHeader to bits.
|
||||
* That is, a 32bits integer with the first
|
||||
* 3 bits set to zero and the remaining 29 containing the
|
||||
* extended id
|
||||
*/
|
||||
uint32_t MMR_CAN_HeaderToBits(MmrCanHeader header);
|
||||
|
||||
bool MMR_CAN_IsMultiFrame(MmrCanHeader *header);
|
||||
bool MMR_CAN_IsMultiFrameEnd(MmrCanHeader *header);
|
||||
/**
|
||||
* @brief
|
||||
* Deserializes a 32bits integer to an MmrCanHeader.
|
||||
* The 3 left-most bits must be of padding.
|
||||
*/
|
||||
MmrCanHeader MMR_CAN_HeaderFromBits(uint32_t bits);
|
||||
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Tells wether the given header represents an SCS.
|
||||
*/
|
||||
bool MMR_CAN_IsHeaderScs(MmrCanHeader header);
|
||||
bool MMR_CAN_IsMultiFrame(MmrCanHeader header);
|
||||
bool MMR_CAN_IsMultiFrameEnd(MmrCanHeader header);
|
||||
|
||||
#endif /* INC_MMR_CAN_HEADER_H_ */
|
||||
|
||||
Reference in New Issue
Block a user