67 #define CAN_SIGNAL_MAX_SIZE (64u)
70 #define CAN_MESSAGE_BIT_MASK_ONE_BYTE (0xFFu)
73 #define CAN_BYTE_LENGTH (8u)
79 56u, 57u, 58u, 59u, 60u, 61u, 62u, 63u, 48u, 49u, 50u, 51u, 52u, 53u, 54u, 55u, 40u, 41u, 42u, 43u, 44u, 45u,
80 46u, 47u, 32u, 33u, 34u, 35u, 36u, 37u, 38u, 39u, 24u, 25u, 26u, 27u, 28u, 29u, 30u, 31u, 16u, 17u, 18u, 19u,
81 20u, 21u, 22u, 23u, 8u, 9u, 10u, 11u, 12u, 13u, 14u, 15u, 0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u};
132 position = position - (bitLength - 1u);
149 if (*pSignal > signalProperties.
max) {
150 *pSignal = signalProperties.
max;
151 }
else if (*pSignal < signalProperties.
min) {
152 *pSignal = signalProperties.
min;
158 *pSignal = *pSignal + signalProperties.
offset;
161 *pSignal = *pSignal / signalProperties.
factor;
165 float_t *pSignalConverted,
170 *pSignalConverted = (signalRaw * signalProperties.
factor) - signalProperties.
offset;
186 uint64_t position = bitStart;
199 uint64_t mask = UINT64_MAX;
209 *pMessage |= (canSignal & mask) << position;
259 uint64_t *pCanSignal,
269 uint64_t position = bitStart;
282 uint64_t mask = UINT64_MAX;
292 *pCanSignal = (message >> position) & mask;
297 const uint8_t *
const kpkCanData,
343 uint8_t returnValue = 0u;
351 #ifdef UNITY_UNIT_TEST
static uint64_t CAN_ConvertBitStartBigEndian(uint64_t bitStart, uint64_t bitLength)
Convert bit start in big endian case. In the big endian case for CAN, the bit start is set to the MSB...
void CAN_TxSetMessageDataWithSignalData(uint64_t *pMessage, uint64_t bitStart, uint8_t bitLength, uint64_t canSignal, CAN_ENDIANNESS_e endianness)
Puts CAN signal data in a 64-bit variable. This function is used to compose a 64-bit CAN message....
static const uint8_t can_bigEndianTable[CAN_SIGNAL_MAX_SIZE]
void CAN_TxSetCanDataWithMessageData(uint64_t message, uint8_t *pCanData, CAN_ENDIANNESS_e endianness)
Copy CAN data from a 64-bit variable to 8 bytes. This function is used to copy a 64-bit CAN message t...
void CAN_RxGetMessageDataFromCanData(uint64_t *pMessage, const uint8_t *const kpkCanData, CAN_ENDIANNESS_e endianness)
Copy CAN data from 8 bytes to a 64-bit variable.
uint8_t CAN_ConvertBooleanToInteger(bool input)
Transform a bool to a bit (set if true)
#define CAN_MESSAGE_BIT_MASK_ONE_BYTE
void CAN_TxPrepareSignalData(float_t *pSignal, CAN_SIGNAL_TYPE_s signalProperties)
Prepare signal data. This function takes the signal data and applies factor, applies offset and compa...
#define CAN_SIGNAL_MAX_SIZE
void CAN_RxGetSignalDataFromMessageData(uint64_t message, uint64_t bitStart, uint8_t bitLength, uint64_t *pCanSignal, CAN_ENDIANNESS_e endianness)
Gets CAN signal data from a 64-bit variable. This function is used to get signal data from a 64-bit C...
void CAN_RxConvertRawSignalData(float_t *pSignalConverted, float_t signalRaw, CAN_SIGNAL_TYPE_s signalProperties)
Convert raw signal data. This function takes the raw signal data and applies offset and factor to con...
Headers for the helper functions for the CAN module.
#define CAN_BYTE_2_POSITION
#define CAN_BYTE_4_POSITION
#define CAN_BYTE_0_POSITION
#define CAN_BYTE_6_POSITION
#define CAN_BYTE_7_POSITION
#define CAN_BYTE_3_POSITION
#define CAN_BYTE_5_POSITION
#define CAN_BYTE_1_POSITION
#define FAS_ASSERT(x)
Assertion macro that asserts that x is true.
#define FAS_TRAP
Define that evaluates to essential boolean false thus tripping an assert.
math library for often used math functions
#define NULL_PTR
Null pointer.