foxBMS - Unit Tests
1.3.0
The foxBMS Unit Tests API Documentation
|
Header for the driver for the CAN module. More...
Go to the source code of this file.
Data Structures | |
struct | CAN_STATE_s |
Macros | |
#define | CAN_NR_OF_TX_MESSAGE_BOX (32U) |
#define | CAN_TICK_MS (10U) |
Functions | |
STD_RETURN_TYPE_e | CAN_DataSend (canBASE_t *pNode, uint32_t id, uint8 *pData) |
Sends over CAN the data passed in parameters. This function goes over the messageboxes and marks the ones that should be sent. More... | |
void | CAN_MainFunction (void) |
Calls the functions to drive the CAN interface. Makes the CAN timing checks and sends the periodic messages. More... | |
void | CAN_ReadRxBuffer (void) |
Checks the data received per CAN. A receive buffer is used because CAN frames are received in an interrupt routine. The TMS570LC4357 does not allow nested interrupts, so interrupts are deactivated during receive. Calls to the database do not work when interrupts are disabled. Receive callbacks are made within this function: as it is not called during an interrupt routine, calls to the database can be made. More... | |
void | CAN_Initialize (void) |
Enables the CAN transceiver.. This function sets th pins to enable the CAN transceiver. It must be called before using the CAN interface. More... | |
void | CAN_EnablePeriodic (bool command) |
Enables periodic sending per CAN. This is used to prevent sending uninitialized data per CAN (e.g., before the first LTC measurement cycle was completed). More... | |
bool | CAN_IsCurrentSensorPresent (uint8_t stringNumber) |
set flag for presence of current sensor. More... | |
bool | CAN_IsCurrentSensorCcPresent (uint8_t stringNumber) |
get flag if CC message from current sensor is received. More... | |
bool | CAN_IsCurrentSensorEcPresent (uint8_t stringNumber) |
get flag if EC message from current sensor is received More... | |
STD_RETURN_TYPE_e | CAN_TransmitBootMessage (void) |
Transmit startup boot message. More... | |
STD_RETURN_TYPE_e | CAN_TransmitDieId (void) |
Transmit chip id. More... | |
CAN_STATE_s * | TEST_CAN_GetCANState (void) |
Header for the driver 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:
Provides the interfaces for initialization, receive and transmit handling
Definition in file can.h.
#define CAN_NR_OF_TX_MESSAGE_BOX (32U) |
#define CAN_TICK_MS (10U) |
STD_RETURN_TYPE_e CAN_DataSend | ( | canBASE_t * | pNode, |
uint32_t | id, | ||
uint8 * | pData | ||
) |
Sends over CAN the data passed in parameters. This function goes over the messageboxes and marks the ones that should be sent.
[in,out] | pNode | CAN interface to use |
[in] | id | ID of message to send |
[out] | pData | data to send (8 bytes) |
Parse all TX message boxes until we find a free one, then use it to send the CAN message. In the HAL, message box numbers start from 1, not 0.
void CAN_EnablePeriodic | ( | bool | command | ) |
Enables periodic sending per CAN. This is used to prevent sending uninitialized data per CAN (e.g., before the first LTC measurement cycle was completed).
Enables periodic sending per CAN. This is used to prevent sending uninitialized data per CAN (e.g., before the first LTC measurement cycle was completed).
void CAN_Initialize | ( | void | ) |
bool CAN_IsCurrentSensorCcPresent | ( | uint8_t | stringNumber | ) |
bool CAN_IsCurrentSensorEcPresent | ( | uint8_t | stringNumber | ) |
bool CAN_IsCurrentSensorPresent | ( | uint8_t | stringNumber | ) |
void CAN_MainFunction | ( | void | ) |
void CAN_ReadRxBuffer | ( | void | ) |
Checks the data received per CAN. A receive buffer is used because CAN frames are received in an interrupt routine. The TMS570LC4357 does not allow nested interrupts, so interrupts are deactivated during receive. Calls to the database do not work when interrupts are disabled. Receive callbacks are made within this function: as it is not called during an interrupt routine, calls to the database can be made.
Definition at line 343 of file can.c.
STD_RETURN_TYPE_e CAN_TransmitBootMessage | ( | void | ) |
Transmit startup boot message.
Definition at line 489 of file can.c.
STD_RETURN_TYPE_e CAN_TransmitDieId | ( | void | ) |
Transmit chip id.
Definition at line 537 of file can.c.
CAN_STATE_s* TEST_CAN_GetCANState | ( | void | ) |