75 while (((bitmask >> retval) & 1u) == 0u) {
103 uint32_t fullScaleReference_mV) {
104 uint16_t temporaryVoltage = 0;
107 temporaryVoltage = temporaryVoltage + 1u;
116 *pTarget = (uint16_t)((temporaryVoltage * fullScaleReference_mV) / 0x3FFFu);
126 uint16_t voltage = 0u;
135 MXM_Convert(lsb, msb, &voltage, conversionType, 5000);
142 MXM_Convert(lsb, msb, &voltage, conversionType, 5000);
149 MXM_Convert(lsb, msb, &voltage, conversionType, 5000);
163 uint8_t lsbMasked = lsb & ((uint8_t)(bitmask &
MXM_BM_LSB));
165 uint8_t msbMasked = msb & ((uint8_t)(msbBitmask >> 8u));
168 *pValue = (uint16_t)0u | (lsbMasked >> start);
171 *pValue = (((uint16_t)msbMasked << (8u - start)) | *pValue);
177 uint16_t value = 0x00u;
204 uint16_t workingCopy = inputValue;
206 workingCopy = workingCopy << 2u;
211 *msb = (uint8_t)(workingCopy >> 8u);
215 uint32_t temporaryVoltage = voltage_mV;
217 temporaryVoltage = temporaryVoltage * 0x3FFFu;
219 return (uint16_t)(temporaryVoltage / fullscaleReference_mV);
223 const uint16_t moduleNumber,
224 uint8_t *pStringNumber,
225 uint16_t *pModuleNumberInString) {
237 *pModuleNumberInString = 0u;
#define BS_NR_OF_MODULES
number of modules in battery pack
#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.
enum STD_RETURN_TYPE STD_RETURN_TYPE_e
#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
enum MXM_CONVERSION_TYPE MXM_CONVERSION_TYPE_e
#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.