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:
committed by
GitHub
parent
c0cc853cf8
commit
ed2a26fbc9
+6
-21
@@ -1,9 +1,13 @@
|
||||
#include "mmr_can.h"
|
||||
#include "mmr_can_util.h"
|
||||
|
||||
static uint8_t maskIdLower5Bits(CanRxHeader *header);
|
||||
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Initializes the filter using the values
|
||||
* from MMR_CAN_GetDefaultFilterSettings, and then
|
||||
* starts the CAN
|
||||
*/
|
||||
HalStatus MMR_CAN_BasicSetupAndStart(CanHandle *hcan) {
|
||||
return
|
||||
MMR_CAN_FilterConfigDefault(hcan) |
|
||||
@@ -31,12 +35,6 @@ HalStatus MMR_CAN_FilterConfig(CanHandle *hcan, MmrCanFilterSettings settings) {
|
||||
}
|
||||
|
||||
|
||||
CanFilterMask MMR_CAN_AlignStandardMask(CanFilterMask baseMask) {
|
||||
static const uint8_t extendedMaskSurplusBytes = 5;
|
||||
return baseMask << extendedMaskSurplusBytes;
|
||||
}
|
||||
|
||||
|
||||
MmrCanFilterSettings MMR_CAN_GetDefaultFilterSettings() {
|
||||
return (MmrCanFilterSettings) {
|
||||
.enabled = true,
|
||||
@@ -46,16 +44,3 @@ MmrCanFilterSettings MMR_CAN_GetDefaultFilterSettings() {
|
||||
.slaveBankStart = 14,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
bool MMR_CAN_IsMultiFrame(CanRxHeader *header) {
|
||||
return maskIdLower5Bits(header) == MMR_CAN_MESSAGE_TYPE_MULTI_FRAME;
|
||||
}
|
||||
|
||||
bool MMR_CAN_IsMultiFrameEnd(CanRxHeader *header) {
|
||||
return maskIdLower5Bits(header) == MMR_CAN_MESSAGE_TYPE_MULTI_FRAME_END;
|
||||
}
|
||||
|
||||
static always_inline uint8_t maskIdLower5Bits(CanRxHeader *header) {
|
||||
return mask(header->ExtId, B8_(0001, 1111));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user