|
foxBMS-UnitTests
1.0.0
The foxBMS Unit Tests API Documentation
|
Go to the documentation of this file.
62 #define HELLOALL_TX_LENGTH (3u)
63 #define HELLOALL_RX_LENGTH HELLOALL_TX_LENGTH
164 uint8_t deviceAddress,
193 if (regAddress <= 0x98U) {
208 if ((regAddress == 0x5DU) || (regAddress == 0x5EU)) {
222 if (regAddress <= 0x98U) {
225 if ((regAddress == 0x5DU) || (regAddress == 0x5EU)) {
238 if (regAddress <= 0x98U) {
240 if ((regAddress == 0x46U) || ((0x2CU <= regAddress) && (regAddress <= 0x2FU)) ||
241 ((0x84U <= regAddress) && (regAddress <= 0x8BU))) {
289 uint8_t deviceAddress,
354 for (uint16_t i = 0; i < rxBufferLength; i++) {
392 pInstance5x->
state = state;
401 pInstance5x->
state = state;
414 switch (pInstance5x->
state) {
1025 if ((retval_check0 ==
STD_OK) && (retval_check1 ==
STD_OK) && (retval_check2 ==
STD_OK) &&
1026 (retval_check3 ==
STD_OK) && (retval_check4 ==
STD_OK) && (retval_check5 ==
STD_OK) &&
1027 (retval_check6 ==
STD_OK) && (retval_check7 ==
STD_OK) && (retval_check8 ==
STD_OK) &&
@ MXM_5X_INIT_WAKE_UP_SATELLITE_DEVICES_WAIT_FOR_RX_STATUS_EMPTY
#define DATA_CHECK_BYTE_SEED
5x statemachine structure
@ MXM_41B_REG_FUNCTION_RX_ERROR_INT
static STD_RETURN_TYPE_e MXM_5XConstructCommandBufferWriteDevice(MXM_5X_INSTANCE_s *pInstance, uint8_t deviceAddress, uint8_t regAddress, uint8_t dataLSB, uint8_t dataMSB)
clears the command buffer and writes a WRITEDEVICE message
#define HELLOALL_RX_LENGTH
MXM_5X_STATE_REQUEST_STATUS_e * processed
@ MXM_STATEMACH_41B_CLEAR_TRANSMIT_BUFFER
MXM_5X_SUBSTATES_e substate
#define BS_NR_OF_MODULES
number of modules in battery pack
STD_RETURN_TYPE_e MXM_41BWriteRegisterFunction(MXM_41B_INSTANCE_s *pInstance, MXM_41B_REG_FUNCTION_e registerFunction, MXM_41B_REG_BIT_VALUE value)
Write a register function.
@ MXM_5X_INIT_WAKE_UP_SATELLITE_DEVICES_CLEAR_RECEIVE_BUFFER_2
@ MXM_5X_INIT_WAKE_UP_SATELLITE_DEVICES_HELLOALL_VERIFY_MSG_AND_COUNT
@ MXM_5X_INIT_ENABLE_KEEP_ALIVE
enum STD_RETURN_TYPE STD_RETURN_TYPE_e
@ MXM_STATEMACH_5X_41B_FMEA_CHECK
STD_RETURN_TYPE_e MXM_41BSetStateRequest(MXM_41B_INSTANCE_s *pInstance, MXM_STATEMACH_41B_e state, uint16_t *pPayload, uint16_t payloadLength, uint8_t extendMessageBytes, uint16_t *pRxBuffer, uint16_t rxBufferLength, MXM_41B_STATE_REQUEST_STATUS_e *processed)
Set state transition for MAX17841B-state-machine.
#define BATTERY_MANAGEMENT_READALL
READALL message (read single register of all daisy-chain devices)
#define COMMAND_BUFFER_LENGTH
STD_RETURN_TYPE_e must_check_return MXM_5XUserAccessibleAddressSpaceCheckerSelfCheck(void)
runs a selfcheck for the address space check
@ MXM_STATEMACH_5X_UNINITIALIZED
@ MXM_41B_REG_FUNCTION_RX_BUSY_STATUS
enum MXM_DC_BYTE MXM_DC_BYTE_e
MXM_5X_STATE_REQUEST_STATUS_e
Request status of Battery Management Protocol states.
@ MXM_STATEMACH_41B_UART_TRANSACTION
@ MXM_5X_INIT_WAKE_UP_SATELLITE_DEVICES_WAIT_FOR_RX_STATUS_BUSY
@ MXM_41B_REG_FUNCTION_RX_EMPTY_STATUS
uint8_t commandBufferCurrentLength
Length of Command Buffer.
@ MXM_5X_INIT_ENABLE_RX_INTERRUPT_FLAGS
#define BATTERY_MANAGEMENT_HELLOALL
HELLOALL message.
@ MXM_5X_INIT_WAKE_UP_SATELLITE_DEVICES_HELLOALL
@ MXM_41B_REG_FUNCTION_KEEP_ALIVE
const uint8_t mxm_kConfig3KeepAlive160us41BRegister
standard configuration for register config 3
@ MXM_STATEMACH_41B_READ_STATUS_REGISTER
@ MXM_5X_STATE_UNPROCESSED
@ MXM_STATEMACH_5X_WRITEALL
@ MXM_41B_REG_FUNCTION_RX_OVERFLOW_INT
#define FAS_ASSERT(x)
Assertion macro that asserts that x is true.
@ MXM_STATEMACH_5X_WRITE_DEVICE
@ MXM_5X_INIT_WAKE_UP_SATELLITE_DEVICES_CLEAR_TRANSMIT_BUFFER
MXM_REG_NAME_e regAddress
@ MXM_5X_41B_FMEA_REQUEST
uint8_t numberOfSatellites
Number of satellites.
@ MXM_STATEMACH_5X_MAXSTATE
uint8_t MXM_CRC8(uint16_t *pData, int32_t lenData)
Compute CRC8 with initial value set to 0x00.
#define must_check_return
Allows functions to generate warnings in GCC for unused returns.
@ MXM_5X_READALL_CHECK_CRC
STD_RETURN_TYPE_e MXM_5XSetStateRequest(MXM_5X_INSTANCE_s *pInstance5x, MXM_STATEMACHINE_5X_e state, MXM_5X_COMMAND_PAYLOAD_s commandPayload, MXM_5X_STATE_REQUEST_STATUS_e *processed)
Set state request for the Battery Management Statemachine.
@ MXM_STATEMACH_41B_WRITE_CONF_AND_INT_REGISTER
STD_RETURN_TYPE_e MXM_5XGetNumberOfSatellitesGood(MXM_5X_INSTANCE_s *pInstance)
Get the value of MXM_5X_INSTANCE::numberOfSatellitesIsGood.
#define BATTERY_MANAGEMENT_WRITEDEVICE
WRITEDEVICE message (write single register of a single device)
@ MXM_5X_INIT_WAKE_UP_SATELLITE_DEVICES_DIS_PREAMBLES
static STD_RETURN_TYPE_e MXM_5XConstructCommandBufferWriteall(MXM_5X_INSTANCE_s *pInstance, uint8_t regAddress, uint8_t dataLSB, uint8_t dataMSB)
clears the command buffer and writes WRITEALL into the buffer
MXM_STATEMACHINE_5X_e state
Struct for the state-variable of state-machine.
@ MXM_41B_STATE_PROCESSED
#define BATTERY_MANAGEMENT_TX_LENGTH_READALL
Battery Management Protocol lengths of TX buffer.
STD_RETURN_TYPE_e numberOfSatellitesIsGood
Command Buffer.
STD_RETURN_TYPE_e MXM_41BReadRegisterFunction(MXM_41B_INSTANCE_s *pInstance, MXM_41B_REG_FUNCTION_e registerFunction, MXM_41B_REG_BIT_VALUE *pValue)
Read the value of a register function.
@ MXM_5X_READALL_UART_TRANSACTION
@ MXM_5X_WRITEALL_UART_TRANSACTION
uint8_t MXM_5XGetNumberOfSatellites(MXM_5X_INSTANCE_s *pInstance)
Get number of satellites.
MXM_41B_STATE_REQUEST_STATUS_e status41b
static STD_RETURN_TYPE_e MXM_52IsUserAccessibleRegister(uint8_t regAddress)
Check if a register address is user accessible in MAX17852.
@ MXM_41B_REG_FUNCTION_TX_PREAMBLES
#define HELLOALL_START_SEED
@ MXM_STATEMACH_5X_READALL
@ MXM_41B_STATE_UNPROCESSED
STD_RETURN_TYPE_e MXM_5XGetRXBuffer(MXM_5X_INSTANCE_s *pInstance, uint8_t *rxBuffer, uint16_t rxBufferLength)
Copy RX buffer into variable.
#define NULL_PTR
Null pointer.
@ MXM_5X_INIT_WAKE_UP_SATELLITE_DEVICES_CLEAR_RECEIVE_BUFFER
MXM_DC_BYTE_e MXM_5XGetLastDCByte(MXM_5X_INSTANCE_s *pInstance)
Returns the last received DC byte.
static STD_RETURN_TYPE_e MXM_53IsUserAccessibleRegister(uint8_t regAddress)
Check if a register address is user accessible in MAX17853.
static STD_RETURN_TYPE_e MXM_5XConstructCommandBufferReadall(MXM_5X_INSTANCE_s *pInstance, uint8_t regAddress)
clears the command buffer and writes READALL into the buffer
@ MXM_STATEMACH_41B_CHECK_FMEA
static void MXM_5XClearCommandBuffer(MXM_5X_INSTANCE_s *pInstance)
Clear the command-buffer.
#define BATTERY_MANAGEMENT_WRITEALL
WRITEALL message (write single register of all daisy-chain devices)
static void MXM_5XConstructCommandBufferHelloall(MXM_5X_INSTANCE_s *pInstance)
clears the command buffer and writes HELLOALL into the buffer
static STD_RETURN_TYPE_e MXM_5XIsUserAccessibleRegister(uint8_t regAddress)
Check if a register address is user accessible.
MXM_5X_COMMAND_PAYLOAD_s commandPayload
@ MXM_5X_INIT_WAKE_UP_SATELLITE_DEVICES_EN_PREAMBLES
#define FAS_TRAP
Define that evaluates to essential boolean false thus tripping an assert.
uint16_t rxBuffer[MXM_5X_RX_BUFFER_LEN]
void MXM_5XStateMachine(MXM_41B_INSTANCE_s *pInstance41b, MXM_5X_INSTANCE_s *pInstance5x)
Execute state-machine for Battery Management Protocol.
uint16_t commandBuffer[COMMAND_BUFFER_LENGTH]
uint8_t lastDCByte
Tracks the last received DC byte.
@ MXM_5X_WRITE_DEVICE_UART_TRANSACTION
#define MXM_5X_RX_BUFFER_LEN
MXM_STATEMACHINE_5X_e
States of the Battery Management Protocol state-machine.
Headers for the driver for the MAX17841B ASCI and MAX1785x monitoring chip.
@ MXM_STATEMACH_41B_CLEAR_RECEIVE_BUFFER