71 #define MXM_TOOLS_LENGTH_BYTE (8u)
91 while (((bitmask >> retval) & 1u) == 0u) {
124 uint32_t fullScaleReference_mV) {
130 uint16_t temporaryVoltage = 0;
133 temporaryVoltage = temporaryVoltage + (uint16_t)1u;
134 const uint32_t scaledVoltageUnipolar_mV = (temporaryVoltage * fullScaleReference_mV) / 0x3FFFu;
143 if (scaledVoltageUnipolar_mV > (uint16_t)UINT16_MAX) {
144 *pTarget = UINT16_MAX;
146 *pTarget = (uint16_t)scaledVoltageUnipolar_mV;
164 uint16_t voltage = 1;
165 MXM_Convert(lsb, msb, &voltage, conversionType, 5000);
172 MXM_Convert(lsb, msb, &voltage, conversionType, 5000);
179 MXM_Convert(lsb, msb, &voltage, conversionType, 5000);
204 uint8_t lsbMasked = lsb & ((uint8_t)(bitmask &
MXM_BM_LSB));
205 *pValue = ((uint16_t)lsbMasked >> start);
209 *pValue = (uint16_t)msbMasked;
219 uint16_t value = 0x00u;
248 uint16_t workingCopy = inputValue;
250 workingCopy = workingCopy << 2u;
262 uint32_t temporaryVoltage = voltage_mV;
264 temporaryVoltage = temporaryVoltage * 0x3FFFu;
266 return (uint16_t)(temporaryVoltage / fullscaleReference_mV);
270 const uint16_t moduleNumber,
271 uint8_t *pStringNumber,
272 uint16_t *pModuleNumberInString) {
285 *pModuleNumberInString = 0u;
293 #ifdef UNITY_UNIT_TEST
#define BS_NR_OF_STRINGS
Number of parallel strings in the battery pack.
#define BS_NR_OF_MODULES_PER_STRING
number of modules in a string
Assert macro implementation.
#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.
Definition of foxBMS standard types.
#define NULL_PTR
Null pointer.
General macros and definitions for the whole platform.
#define GEN_MUST_CHECK_RETURN
Allows functions to generate warnings in GCC for unused returns.
#define MXM_BM_LSB
Monitoring Register LSB.
#define MXM_BM_MSB
Monitoring Register MSB.
#define MXM_BM_NULL
Monitoring Register Null byte.
#define MXM_REG_VERSION_VER
Monitoring Register Version/Silicon Version.
#define MXM_REG_VERSION_MOD
Monitoring Register Version/Model.
#define MXM_REG_ADC_14BIT_VALUE
Monitoring Register 14bit ADC value.
@ MXM_CONVERSION_UNIPOLAR
@ MXM_CONVERSION_BLOCK_VOLTAGE
#define MXM_MAXIMUM_NR_OF_MODULES
Maximum number of modules.
Register map of the MAX1785x monitoring IC.
uint16_t MXM_REG_BM
Type for register access for monitoring ICs.