foxBMS - Unit Tests
1.3.0
The foxBMS Unit Tests API Documentation
|
Headers for the helper functions for the CAN module. More...
Go to the source code of this file.
Data Structures | |
struct | CAN_SIGNAL_TYPE_s |
Macros | |
#define | CAN_BYTE_0_POSITION (0u) |
#define | CAN_BYTE_1_POSITION (1u) |
#define | CAN_BYTE_2_POSITION (2u) |
#define | CAN_BYTE_3_POSITION (3u) |
#define | CAN_BYTE_4_POSITION (4u) |
#define | CAN_BYTE_5_POSITION (5u) |
#define | CAN_BYTE_6_POSITION (6u) |
#define | CAN_BYTE_7_POSITION (7u) |
Functions | |
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 compares with signal minimum and maximum values. More... | |
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 convert the raw value. More... | |
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. It takes signal data, signal bit start, signal bit length and puts the data in the 64-bit variable. More... | |
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 to 8 bytes. More... | |
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 CAN message. It takes signal bit start, signal bit length and extract signal data from the the 64-bit variable. More... | |
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. More... | |
uint8_t | CAN_ConvertBooleanToInteger (bool input) |
Transform a bool to a bit (set if true) More... | |
Headers for the helper functions for the CAN module.
SPDX-License-Identifier: BSD-3-Clause
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
We kindly request you to use one or more of the following phrases to refer to foxBMS in your hardware, software, documentation or advertising materials:
Definition in file can_helper.h.
#define CAN_BYTE_0_POSITION (0u) |
position for CAN byte 0 to 7
Definition at line 69 of file can_helper.h.
#define CAN_BYTE_1_POSITION (1u) |
position for CAN byte 0 to 7
Definition at line 70 of file can_helper.h.
#define CAN_BYTE_2_POSITION (2u) |
position for CAN byte 0 to 7
Definition at line 71 of file can_helper.h.
#define CAN_BYTE_3_POSITION (3u) |
position for CAN byte 0 to 7
Definition at line 72 of file can_helper.h.
#define CAN_BYTE_4_POSITION (4u) |
position for CAN byte 0 to 7
Definition at line 73 of file can_helper.h.
#define CAN_BYTE_5_POSITION (5u) |
position for CAN byte 0 to 7
Definition at line 74 of file can_helper.h.
#define CAN_BYTE_6_POSITION (6u) |
position for CAN byte 0 to 7
Definition at line 75 of file can_helper.h.
#define CAN_BYTE_7_POSITION (7u) |
position for CAN byte 0 to 7
Definition at line 76 of file can_helper.h.
uint8_t CAN_ConvertBooleanToInteger | ( | bool | input | ) |
Transform a bool to a bit (set if true)
[in] | input | input boolean (true will become 1u) |
Definition at line 336 of file can_helper.c.
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 convert the raw value.
[out] | pSignalConverted | coverted signal data |
[in] | signalRaw | raw signal data |
[in] | signalProperties | signal properties (factor, offset, min, max) |
Definition at line 161 of file can_helper.c.
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.
This function is used to copy data from a 64-bit variable to 8 bytes.
[in] | pMessage | 64-bit where the data is copied |
[out] | kpkCanData | 8 bytes containing the data |
[in] | endianness | big or little endianness of data |
Definition at line 289 of file can_helper.c.
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 CAN message. It takes signal bit start, signal bit length and extract signal data from the the 64-bit variable.
[in] | message | 64-bit variable containing the CAN data |
[in] | bitStart | starting bit were the signal data must be put |
[in] | bitLength | length of the signal data to be put in CAN message |
[out] | pCanSignal | signal data to be retrieved from message |
[in] | endianness | big or little endianness of data |
Definition at line 249 of file can_helper.c.
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 compares with signal minimum and maximum values.
[in,out] | pSignal | signal data |
[in] | signalProperties | signal properties (factor, offset, min, max) |
Definition at line 142 of file can_helper.c.
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 to 8 bytes.
[in] | message | 64-bit variable containing the CAN data |
[out] | pCanData | 8 bytes where the data is copied |
[in] | endianness | big or little endianness of data |
Definition at line 206 of file can_helper.c.
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. It takes signal data, signal bit start, signal bit length and puts the data in the 64-bit variable.
[out] | pMessage | 64-bit variable containing the CAN data |
[in] | bitStart | starting bit were the signal data must be put |
[in] | bitLength | length of the signal data to be put in CAN message |
[in] | canSignal | signal data to be put in message |
[in] | endianness | big or little endianness of data |
Definition at line 167 of file can_helper.c.