65 #define MXM_TOOLS_LENGTH_BYTE (8u)
85 while (((bitmask >> retval) & 1u) == 0u) {
118 uint32_t fullScaleReference_mV) {
124 uint16_t temporaryVoltage = 0;
127 temporaryVoltage = temporaryVoltage + (uint16_t)1u;
128 const uint32_t scaledVoltageUnipolar_mV = (temporaryVoltage * fullScaleReference_mV) / 0x3FFFu;
137 if (scaledVoltageUnipolar_mV > (uint16_t)UINT16_MAX) {
138 *pTarget = UINT16_MAX;
140 *pTarget = (uint16_t)scaledVoltageUnipolar_mV;
158 uint16_t voltage = 1;
159 MXM_Convert(lsb, msb, &voltage, conversionType, 5000);
166 MXM_Convert(lsb, msb, &voltage, conversionType, 5000);
173 MXM_Convert(lsb, msb, &voltage, conversionType, 5000);
198 uint8_t lsbMasked = lsb & ((uint8_t)(bitmask &
MXM_BM_LSB));
199 *pValue = ((uint16_t)lsbMasked >> start);
203 *pValue = (uint16_t)msbMasked;
213 uint16_t value = 0x00u;
242 uint16_t workingCopy = inputValue;
244 workingCopy = workingCopy << 2u;
256 uint32_t temporaryVoltage = voltage_mV;
258 temporaryVoltage = temporaryVoltage * 0x3FFFu;
260 return (uint16_t)(temporaryVoltage / fullscaleReference_mV);
264 const uint16_t moduleNumber,
265 uint8_t *pStringNumber,
266 uint16_t *pModuleNumberInString) {
279 *pModuleNumberInString = 0u;
#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
#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 NULL_PTR
Null pointer.
#define 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.