This commit is contained in:
Stefano Calabretti
2022-05-31 10:04:05 +02:00
parent bf81796125
commit 772d87b3db
5 changed files with 145 additions and 8 deletions
+21
View File
@@ -1,7 +1,28 @@
#include <stdbool.h>
#include <stdint.h>
#include "mmr_can.h"
#define cast(pmsg, to) (*(to*)(pmsg->store))
uint16_t MMR_CAN_GetUInt16(MmrCanMessage *message) {
return cast(message, uint16_t);
}
uint32_t MMR_CAN_GetUInt32(MmrCanMessage *message) {
return cast(message, uint32_t);
}
uint64_t MMR_CAN_GetUInt64(MmrCanMessage *message) {
return cast(message, uint64_t);
}
float MMR_CAN_GetFloat(MmrCanMessage *message) {
return cast(message, float);
}
MmrResult MMR_CAN_TryReceive(MmrCan *can, MmrCanMessage *result) {
size_t pendingMessages =
HAL_CAN_GetRxFifoFillLevel(hcan, MMR_CAN_RX_FIFO);