Andy,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
Or even make the whole thing one lineCode:
uint16_t configReg = read16(MAX17043_CONFIG);configReg = (0xFFE0 & configReg) | percent;
Code:
uint16_t configReg = (read16(MAX17043_CONFIG) & 0xFFE0) | percent;
Thanks a lot for the help.
Very appreciated!
Statistics: Posted by Gitduino — Tue Jan 23, 2024 4:26 am