63 #define CAN_SIGNAL_MAX_SIZE (64u)
66 #define CAN_MESSAGE_BIT_MASK_ONE_BYTE (0xFFu)
69 #define CAN_BYTE_LENGTH (8u)
75 56u, 57u, 58u, 59u, 60u, 61u, 62u, 63u, 48u, 49u, 50u, 51u, 52u, 53u, 54u, 55u, 40u, 41u, 42u, 43u, 44u, 45u,
76 46u, 47u, 32u, 33u, 34u, 35u, 36u, 37u, 38u, 39u, 24u, 25u, 26u, 27u, 28u, 29u, 30u, 31u, 16u, 17u, 18u, 19u,
77 20u, 21u, 22u, 23u, 8u, 9u, 10u, 11u, 12u, 13u, 14u, 15u, 0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u};
128 position = position - (bitLength - 1u);
145 if (*pSignal > signalProperties.
max) {
146 *pSignal = signalProperties.
max;
147 }
else if (*pSignal < signalProperties.
min) {
148 *pSignal = signalProperties.
min;
154 *pSignal = *pSignal + signalProperties.
offset;
157 *pSignal = *pSignal / signalProperties.
factor;
163 *pSignalConverted = (signalRaw * signalProperties.
factor) - signalProperties.
offset;
179 uint64_t position = bitStart;
192 uint64_t mask = UINT64_MAX;
202 *pMessage |= (canSignal & mask) << position;
252 uint64_t *pCanSignal,
262 uint64_t position = bitStart;
275 uint64_t mask = UINT64_MAX;
285 *pCanSignal = (message >> position) & mask;
290 const uint8_t *
const kpkCanData,
enum CAN_ENDIANNESS CAN_ENDIANNESS_e
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.
void CAN_TxPrepareSignalData(float *pSignal, CAN_SIGNAL_TYPE_s signalProperties)
Prepare signal data. This function takes the signal data and applies factor, applies offset and compa...
#define CAN_MESSAGE_BIT_MASK_ONE_BYTE
#define CAN_SIGNAL_MAX_SIZE
void CAN_RxConvertRawSignalData(float *pSignalConverted, float signalRaw, CAN_SIGNAL_TYPE_s signalProperties)
Convert raw signal data. This function takes the raw signal data and applies offset and factor to con...
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...
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.