69 #define MXM_MON_REGISTRY_STATUS_FMEA_DEFAULT (0xFFFFu)
72 #define MXM_REGISTRY_SHIFT_ONE_BYTE (8u)
108 for (uint8_t i = 0; i < numberOfDevices; i++) {
127 uint8_t rxBufferLength,
135 const uint8_t highestConnectedDevice =
138 const uint8_t startBytes = 2u;
140 for (uint8_t i = 0; i <= highestConnectedDevice; i++) {
141 const uint8_t bufferPosition = startBytes + (i * 2u);
143 FAS_ASSERT((bufferPosition + 1u) <= rxBufferLength);
148 currentDevice->deviceID = id;
151 currentDevice->deviceID = ((uint32_t)
id << 16u) | currentDevice->deviceID;
162 const uint8_t highestConnectedDevice =
165 for (uint8_t i = 0; i <= highestConnectedDevice; i++) {
166 const uint8_t startBytes = 2u;
167 const uint8_t bufferPosition = startBytes + (i * 2u);
169 FAS_ASSERT((bufferPosition + 1u) <= rxBufferLength);
184 uint16_t version = 0;
202 const uint8_t highestConnectedDevice =
206 const uint8_t currentRegister = pState->
rxBuffer[1u];
208 for (uint8_t i = 0; i <= highestConnectedDevice; i++) {
209 const uint8_t startBytes = 2u;
210 const uint8_t bufferPosition = startBytes + (i * 2u);
212 FAS_ASSERT((bufferPosition + 1u) <= rxBufferLength);
213 uint16_t registerValue = 0u;
217 switch (currentRegister) {
219 currentDevice->registerStatus1 = registerValue;
222 currentDevice->registerStatus2 = registerValue;
225 currentDevice->registerStatus3 = registerValue;
228 currentDevice->registerFmea1 = registerValue;
231 currentDevice->registerFmea2 = registerValue;
234 currentDevice->registerBalstat = registerValue;
247 const uint8_t highestConnectedDevice =
250 bool deviceReset =
false;
252 for (uint8_t i = 0; i <= highestConnectedDevice; i++) {
254 const uint8_t lsb = (uint8_t)(status1 &
MXM_BM_LSB);
256 uint16_t alertReset = 0u;
258 if (alertReset == 1u) {
273 #ifdef UNITY_UNIT_TEST
Assert macro implementation.
#define FAS_ASSERT(x)
Assertion macro that asserts that x is true.
uint8_t MATH_MinimumOfTwoUint8_t(const uint8_t value1, const uint8_t value2)
Returns the minimum of the passed uint8_t values.
math library for often used math functions
Definition of foxBMS standard types.
#define NULL_PTR
Null pointer.
#define MXM_BM_LSB
Monitoring Register LSB.
#define MXM_BM_WHOLE_REG
All bits of monitoring register.
#define MXM_BM_MSB
Monitoring Register MSB.
#define MXM_REG_VERSION_VER
Monitoring Register Version/Silicon Version.
#define MXM_REG_VERSION_MOD
Monitoring Register Version/Model.
#define MXM_REG_STATUS1_ALRTRST
ALRTRST bit in STATUS1.
@ MXM_SILICON_VERSION_INVALID
MXM_MODEL_ID_e
Type of monitoring device.
#define MXM_MAXIMUM_NR_OF_MODULES
Maximum number of modules.
#define HELLOALL_START_SEED
MXM_REG_NAME_e
MAX1785x register names.
bool MXM_CheckIfADeviceIsConnected(const MXM_MONITORING_INSTANCE_s *const kpkState, uint8_t device)
check if a device is connected
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_MonRegistryInit(MXM_MONITORING_INSTANCE_s *pState)
Initialize monitoring registry.
STD_RETURN_TYPE_e MXM_MonRegistryConnectDevices(MXM_MONITORING_INSTANCE_s *pState, uint8_t numberOfDevices)
Mark devices as connected in the registry and set the address.
#define MXM_MON_REGISTRY_STATUS_FMEA_DEFAULT
uint8_t MXM_MonRegistryGetHighestConnected5XDevice(const MXM_MONITORING_INSTANCE_s *const kpkState)
Parse number of highest connected device from monitoring- register.
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
#define MXM_REGISTRY_SHIFT_ONE_BYTE
Functions in order to have a registry of monitoring ICs.
uint8_t rxBuffer[MXM_RX_BUFFER_LENGTH]
MXM_REGISTRY_ENTRY_s registry[MXM_MAXIMUM_NR_OF_MODULES]
MXM_SILICON_VERSION_e siliconVersion