andhieSetyabudi / BQ25896

Arduino Library for access BQ25896 through I2C ( Wire )
MIT License
7 stars 3 forks source link

ADC control #4

Closed AlbertoZandara closed 2 years ago

AlbertoZandara commented 2 years ago

Is it possible to turn off the ADC to save power with this library?

andhieSetyabudi commented 2 years ago

yes it is..

actually, in this library I set the ADC to continuous mode every 1sec by default.

you can see on the code

void setADC_enabled(void) { byte data = read(REG::ADCCTRL); data |= (1UL << (7)); // start A/D convertion data |= (1UL << 6); // set continuous convertion write(REG::ADC_CTRL, data); } you need to clear bit no. 6 of register Reg02 so replace it with data &= ~(1UL << 6);

and you need to call properties and wait after it about 1sec to get the ADC values.

as reference on datasheet https://www.ti.com/lit/ds/symlink/bq25896.pdf?ts=1637114007843&ref_url=https%253A%252F%252Fwww.ti.com%252Fproduct%252FBQ25896%253Futm_source%253Dgoogle%2526utm_medium%253Dcpc%2526utm_campaign%253DAPP-BMS-null-prodfolderdynamic-cpc-pf-google-wwe%2526utm_content%253Dprodfolddynamic%2526ds_k%253DDYNAMIC%2BSEARCH%2BADS%2526DCM%253Dyes%2526gclid%253DCj0KCQiAys2MBhDOARIsAFf1D1dvDs1g88OD8eZKakrnr0bkEEN1c9HOHTwXAP64eE2jGqHHnxaWRMgaAqzGEALw_wcB%2526gclsrc%253Daw.ds

I will update it soon

AlbertoZandara commented 2 years ago

Thank you :)