74 #define MXM_I2C_MUX0_ADDRESS (0x4Cu)
76 #define MXM_I2C_MUX1_ADDRESS (0x4Du)
80 #define MXM_DELAY_BALANCING 10000u
149 const uint8_t temp_len =
153 if (someDeviceHasBeenReset ==
true) {
161 const uint8_t temp_len =
168 const uint8_t temp_len =
175 const uint8_t temp_len =
182 const uint8_t temp_len =
258 "invalid define MXM_VOLTAGE_READ_ARRAY_LENGTH");
395 if (database_retval ==
STD_OK) {
475 const uint8_t temp_len =
865 #ifdef UNITY_UNIT_TEST
#define DATA_READ_DATA(...)
#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.
#define f_static_assert(cond, msg)
#define NULL_PTR
Null pointer.
#define MXM_I2C_MUX0_ADDRESS
address of MUX0
#define MXM_I2C_MUX1_ADDRESS
address of MUX1
#define MXM_BM_LSB
Monitoring Register LSB.
#define MXM_DELAY_BALANCING
Delay in milliseconds before the balancing status is updated.
MXM_MODEL_ID_e MXM_GetModelIdOfDaisyChain(void)
returns the model ID of the daisy chain
void MXM_StateMachineOperation(MXM_MONITORING_INSTANCE_s *pState)
State-Machine implementation for operation state.
void MXM_ErrorHandlerReset(MXM_MONITORING_INSTANCE_s *pInstance, bool immediateReset)
This error handler is used as a last resort and tries a reset of the complete driver.
STD_RETURN_TYPE_e MXM_ProcessOpenWire(const MXM_MONITORING_INSTANCE_s *const kpkInstance)
Processes the retrieved information on openwire.
bool must_check_return MXM_HandleStateReadall(MXM_MONITORING_INSTANCE_s *pInstance, MXM_REG_NAME_e registerName, MXM_STATEMACHINE_OPERATION_STATES_e nextState)
Handle the statemachine-transactions for a READALL.
STD_RETURN_TYPE_e MXM_ParseVoltagesIntoDB(const MXM_MONITORING_INSTANCE_s *const kpkInstance)
Copies measured voltage data into the database.
STD_RETURN_TYPE_e MXM_ConstructBalancingBuffer(MXM_BALANCING_STATE_s *pBalancingInstance)
Fill the balancing datastructure.
MXM_MONITORING_STATE_e must_check_return MXM_MonGetVoltages(MXM_MONITORING_INSTANCE_s *pState, MXM_REG_NAME_e regAddress)
Encapsulation for reading voltages from a register.
void MXM_HandleStateWriteall(MXM_MONITORING_INSTANCE_s *pInstance, MXM_STATEMACHINE_OPERATION_STATES_e nextState)
Handle the statemachine-transactions for a WRITEALL.
Headers for the driver for the MAX17841B ASCI and MAX1785x monitoring chip.
#define MXM_REF_UNIPOLAR_CELL_mV
#define MXM_THRESHOLD_DIAGNOSTIC_AFTER_CYCLES
Battery monitoring driver for MAX1785x battery monitoring ICs.
#define MXM_VOLTAGE_READ_ARRAY_LENGTH
MXM_MODEL_ID_e
Type of monitoring device.
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.
uint8_t MXM_5XGetNumberOfSatellites(const MXM_5X_INSTANCE_s *const kpkInstance)
Get number of satellites.
Headers for the driver for the MAX17841B ASCI and MAX1785x monitoring chip.
@ MXM_STATEMACH_5X_WRITE_DEVICE
@ MXM_5X_STATE_UNPROCESSED
#define BATTERY_MANAGEMENT_TX_LENGTH_READALL
Battery Management Protocol lengths of TX buffer.
MXM_REG_NAME_e
MAX1785x register names.
void MXM_MonRegistryParseIdIntoDevices(MXM_MONITORING_INSTANCE_s *pState, uint8_t rxBufferLength, MXM_REG_NAME_e type)
Parse ID (1 or 2) into the registry.
void MXM_MonRegistryParseStatusFmeaIntoDevices(MXM_MONITORING_INSTANCE_s *pState, uint8_t rxBufferLength)
Parse STATUS or FMEA into the registry.
void MXM_MonRegistryParseVersionIntoDevices(MXM_MONITORING_INSTANCE_s *pState, uint8_t rxBufferLength)
Parse Version into the registry.
bool MXM_CheckIfADeviceHasBeenReset(const MXM_MONITORING_INSTANCE_s *const kpkState)
check if one of the devices in the registry has the ALRTRST bit set
Functions in order to have a registry of monitoring ICs.
bool OS_CheckTimeHasPassedWithTimestamp(uint32_t oldTimeStamp_ms, uint32_t currentTimeStamp_ms, uint32_t timeToPass_ms)
This function checks if timeToPass has passed since the last timestamp to now.
Declaration of the OS wrapper interface.
uint32_t OS_GetTickCount(void)
Returns OS based system tick value.
MXM_REG_NAME_e regAddress
DATA_BLOCK_BALANCING_CONTROL_s *const pBalancingControl_table
bool oddCellsNeedBalancing
bool evenCellsBalancingProcessed
bool oddCellsBalancingProcessed
bool evenCellsNeedBalancing
uint8_t moduleBalancingIndex
uint32_t previousTimeStamp
uint32_t currentTimeStamp
MXM_5X_COMMAND_PAYLOAD_s batteryCmdBuffer
MXM_STATEMACHINE_OPERATION_STATES_e operationSubstate
uint8_t diagnosticCounter
MXM_BALANCING_STATE_s *const pBalancingState
uint8_t mxmVoltageCellCounter
MXM_STATEMACHINE_STATES_e state
bool firstMeasurementDone
MXM_5X_INSTANCE_s *const pInstance5X
MXM_5X_STATE_REQUEST_STATUS_e requestStatus5x