You could write the masking and setting on one line asCan it be written in a more concise, better way than the horrible translation I have done for the pico version above ??Code:
uint16_t configReg = read16(MAX17043_CONFIG);configReg &= 0xFFE0; // Mask out threshold bitsconfigReg |= percent; // Add new threshold
Code:
uint16_t configReg = read16(MAX17043_CONFIG);configReg = (0xFFE0 & configReg) | percent;
Code:
uint16_t configReg = (read16(MAX17043_CONFIG) & 0xFFE0) | percent;
Statistics: Posted by AndyD — Mon Jan 22, 2024 9:31 am