Better parameter handling (#6)

* Add rx event handlers

* Fix compile errors and add constness

* Pass sender id

* Change api interface

* Revert changes

* Add filter fifo

* Add default setup

* Add receive function

* Remove interrupt activation

* Activate RX interrupts

* Merge remote changes

* Add event list constructor

* Fix compilation bug

* Send and receive multiple frames

* Refactor

* Refactor

* Fix compile error

* Use known syntax

* Refactor

* Provide storage

* Add frame end

* Add some documentation

* Turn macros into functions

* Refactor

* Refactor

* Fix compile error

* Use ExtendedIds

* Fix reception bug (fixes #4)

* Add packet headers

* Refactor

Co-authored-by: Riccardo998 <riccardo.storchi98@gmail.com>
This commit is contained in:
Stefano Calabretti
2021-12-20 15:12:57 +01:00
committed by GitHub
parent c0cc853cf8
commit ed2a26fbc9
8 changed files with 147 additions and 73 deletions
+2 -23
View File
@@ -4,6 +4,7 @@
#include <stdint.h>
#include <stdbool.h>
#include "mmr_can_includes.h"
#include "mmr_can_header.h"
#include "mmr_can_types.h"
#include "mmr_can_optimize.h"
#include "mmr_can_binary_literals.h"
@@ -65,31 +66,13 @@ typedef struct {
typedef struct {
CanId remoteId;
MmrCanHeader header;
CanMailbox *mailbox;
uint8_t *data;
uint8_t length;
} MmrCanPacket;
/**
* @brief
* These values can be appended to the extended-id
* 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
*
* Multi-frame messages have a higher priority over normal ones
*/
typedef enum {
MMR_CAN_MESSAGE_TYPE_MULTI_FRAME = B_(0010),
MMR_CAN_MESSAGE_TYPE_MULTI_FRAME_END = B_(0011),
MMR_CAN_MESSAGE_TYPE_NORMAL = B_(1000),
} MmrCanMessageType;
/**
* @brief
* Represents a CAN message
@@ -112,8 +95,4 @@ MmrCanFilterSettings MMR_CAN_GetDefaultFilterSettings();
HalStatus MMR_CAN_Send(CanHandle *hcan, MmrCanPacket packet);
HalStatus MMR_CAN_Receive(CanHandle *hcan, MmrCanMessage *result);
bool MMR_CAN_IsMultiFrame(CanRxHeader *header);
bool MMR_CAN_IsMultiFrameEnd(CanRxHeader *header);
#endif /* INC_MMR_CAN_H_ */