|
foxBMS
1.0.0
The foxBMS Battery Management System API Documentation
|
Go to the documentation of this file.
61 #include "bender_iso165c.h"
74 .currentSensorPresent =
false,
75 .currentSensorCCPresent =
false,
76 .currentSensorECPresent =
false,
127 #if CURRENT_SENSOR_PRESENT == true
197 if (canIsTxMessagePending(pNode, messageBox) == 0) {
202 canUpdateID(pNode, messageBox, ((
id << 18) | (1U << 29)));
203 canTransmit(pNode, messageBox, pData);
219 static uint32_t counterTicks = 0;
220 uint8_t data[8] = {0};
246 uint32_t current_time;
249 #if CURRENT_SENSOR_PRESENT == true
271 #if CURRENT_SENSOR_PRESENT == true
275 for (uint8_t stringNumber = 0u; stringNumber <
BS_NR_OF_STRINGS; stringNumber++) {
348 if (command ==
true) {
355 #if CURRENT_SENSOR_PRESENT == true
357 if (command ==
true) {
369 if (command ==
true) {
381 if (command ==
true) {
414 uint8_t data[8] = {0};
416 canGetData(pNode, messageBox, (uint8 *)&data[0]);
420 id = canGetID(pNode, messageBox) >> 18;
449 #ifdef UNITY_UNIT_TEST
static STD_RETURN_TYPE_e CAN_PeriodicTransmit(void)
Handles the processing of messages that are meant to be transmitted. This function looks for the repe...
const CAN_MSG_RX_TYPE_s can_rxMessages[]
@ DIAG_ID_CAN_EC_RESPONDING
#define CAN0_RX_BUFFER_LENGTH
#define BS_COULOMB_COUNTING_MEASUREMENT_RESPONSE_TIMEOUT_MS
DATA_BLOCK_HEADER_s header
bool CAN_IsCurrentSensorCcPresent(uint8_t stringNumber)
get flag if CC message from current sensor is received.
enum STD_RETURN_TYPE STD_RETURN_TYPE_e
static void CAN_TxInterrupt(canBASE_t *pNode, uint32 messageBox)
Called in case of CAN TX interrupt.
static CAN_STATE_s can_state
static CAN_BUFFERELEMENT_s can_rxBufferData[CAN0_RX_BUFFER_LENGTH]
static void CAN_InitializeTransceiver(void)
const uint8_t can_rxLength
CAN_BUFFERELEMENT_s * pRead
const uint8_t can_txLength
const CAN_MSG_TX_TYPE_s can_txMessages[]
static void CAN_SetCurrentSensorPresent(bool command, uint8_t stringNumber)
Sets flag to indicate current sensor is present.
DIAG_RETURNTYPE_e DIAG_Handler(DIAG_ID_e diag_id, DIAG_EVENT_e event, DIAG_IMPACT_LEVEL_e impact, uint32_t data)
DIAG_Handler provides generic error handling, based on diagnosis group.
CAN_BUFFERELEMENT_s * pWrite
@ DIAG_ID_CURRENT_SENSOR_RESPONDING
#define FAS_ASSERT(x)
Assertion macro that asserts that x is true.
void OS_ExitTaskCritical(void)
Exit Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.
static CAN_RX_BUFFER_s can_rxBuffer
void MCU_delay_us(uint32_t delay_us)
Wait blocking a certain time in microseconds.
uint32_t timestampEnergyCounting[BS_NR_OF_STRINGS]
uint32_t OS_GetTickCount(void)
Returns OS based system tick value.
static void CAN_SetCurrentSensorCcPresent(bool command, uint8_t stringNumber)
Sets flag to indicate current sensor sends C-C values.
static bool CAN_CheckCanTiming(void)
Checks if the CAN messages come in the specified time window If the (current time stamp) - (previous ...
Headers for the driver for the MCU module.
void CAN_Initialize(void)
Enables the CAN transceiver.. This function sets th pins to enable the CAN transceiver....
static void CAN_SetCurrentSensorEcPresent(bool command, uint8_t stringNumber)
Sets flag to indicate current sensor sends C-C values.
void CAN_MainFunction(void)
Calls the functions to drive the CAN interface. Makes the CAN timing checks and sends the periodic me...
DATA_BLOCK_HEADER_s header
void OS_EnterTaskCritical(void)
Enter Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.
@ DIAG_ID_CAN_CC_RESPONDING
can_callback_funcPtr callbackFunction
bool currentSensorCCPresent[BS_NR_OF_STRINGS]
#define CAN_PIN_TOGGLE_DELAY_US
bool currentSensorECPresent[BS_NR_OF_STRINGS]
uint32_t timestampCurrent[BS_NR_OF_STRINGS]
#define BS_CURRENT_MEASUREMENT_RESPONSE_TIMEOUT_MS
@ DATA_BLOCK_ID_STATEREQUEST
void IO_PinReset(uint32_t *pRegisterAddress, uint32_t pin)
Set pin by writing in pin output register.
DATA_BLOCK_HEADER_s header
#define DATA_READ_DATA(...)
bool CAN_IsCurrentSensorPresent(uint8_t stringNumber)
set flag for presence of current sensor.
@ DATA_BLOCK_ID_ERRORSTATE
static void CAN_RxInterrupt(canBASE_t *pNode, uint32 messageBox)
Called in case of CAN RX interrupt.
#define NULL_PTR
Null pointer.
Header for the driver for the IO module.
#define BS_ENERGY_COUNTING_MEASUREMENT_RESPONSE_TIMEOUT_MS
uint32_t timestampCurrentCounting[BS_NR_OF_STRINGS]
Header for the driver for the CAN module.
bool CAN_IsCurrentSensorEcPresent(uint8_t stringNumber)
get flag if EC message from current sensor is received
void CAN_ReadRxBuffer(void)
Checks the data received per CAN. A receive buffer is used because CAN frames are received in an inte...
@ DATA_BLOCK_ID_CURRENT_SENSOR
can_callback_funcPtr callbackFunction
void IO_PinSet(uint32_t *pRegisterAddress, uint32_t pin)
Set pin by writing in pin output register.
bool currentSensorPresent[BS_NR_OF_STRINGS]
#define UNIT_TEST_WEAK_IMPL
#define CAN_NR_OF_TX_MESSAGEBOX
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 ...
void CAN_EnablePeriodic(bool command)
enable/disable the periodic transmit/receive.
#define SETBIT(register, bit)
sets a bit to 1u
void UNIT_TEST_WEAK_IMPL canMessageNotification(canBASE_t *node, uint32 messageBox)