LibreSolar / bms-firmware

Firmware for LibreSolar BMS boards based on bq769x0, bq769x2 or ISL94202
https://libre.solar/bms-firmware/
Apache License 2.0
146 stars 67 forks source link

drivers: bq769x0: fix activation and introduce error handling for read/write functions #47

Closed martinjaeger closed 7 months ago

martinjaeger commented 7 months ago

The functions to read/write registers did not have any proper error handling so far.

This PR changes the functions to return the usual int error code instead of void or the read values. Values are now read using a pointer.

The activation of the chip is moved to a dedicated function (similar to the bq769x2 and isl94202) in order to fix the initialization in main.c.