We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bms-firmware/drivers/bms_ic/bq769x2/bq769x2.c
Line 468 in 8f6a949
I'id suggest:
bq769x2_configure_voltage_regs(const struct device *dev, struct bms_ic_conf *ic_conf) { int err = 0; uint8_t reg12_config; uint8_t vregs_enable = 0; err = bq769x2_datamem_read_u1(dev, BQ769X2_SET_CONF_REG12, ®12_config); if (err != 0) { return -EIO; } /* clear REG2_EN and REG1_EN bits and keep voltage setting untouched */ reg12_config &= ~0x11; if (ic_conf->vregs_enable & BIT(1)) { reg12_config |= 0x01; /* REG1_EN */ vregs_enable |= BIT(1); } if (ic_conf->vregs_enable & BIT(2)) { reg12_config |= 0x10; /* REG2_EN */ vregs_enable |= BIT(2); } if (config->vregs_enable & BIT(0)) { vregs_enable |= BIT(0); } err = bq769x2_datamem_write_u1(dev, BQ769X2_SET_CONF_REG12, reg12_config); if (err != 0) { return -EIO; } /* control REG0 to enable/disable Pre-Regulator */ err = bq769x2_datamem_write_u1(dev, BQ769X2_SET_CONF_REG0, vregs_enable & BIT(0)); if (err != 0) { return -EIO; } ic_conf->vregs_enable = vregs_enable; return 0; }
The text was updated successfully, but these errors were encountered:
Hi @vlebedev-ora!
Thanks for your suggested improvement.
I have extended it a a bit, so that REG0 can also be configured via Devicetree at compile-time, see #86. What do you think?
Sorry, something went wrong.
martinjaeger
Successfully merging a pull request may close this issue.
bms-firmware/drivers/bms_ic/bq769x2/bq769x2.c
Line 468 in 8f6a949
I'id suggest:
The text was updated successfully, but these errors were encountered: