A #[no_std] platform-agnostic driver for the BQ40Z50 family of lithium-ion battery fuel/gas gauge, capable of managing a 1- to 4-cell battery, using the embedded-hal traits.
A higher level API exposing standard Smart Battery Specification functions is built on top of the lower level register accessor using the embedded-batteries traits.
Four revisions of the chip are currently supported:
Please choose which revision you are using by enabling the appropriate feature.
Currently, rust 1.94 and up is supported.
The test workflow runs each chip revision with and without embassy-timeout and
pec-lookup-table. To run tests locally, select a revision and any optional features:
cargo test --locked --features r1
cargo test --locked --features r1,embassy-timeout,pec-lookup-tablewrite_dataflash commits data in chunks of up to 32 bytes and is not atomic.
If a write fails, earlier chunks are not rolled back, and the failing chunk may
also have reached the gauge. Errors do not report how many bytes were committed.
Retrying the entire write rewrites earlier chunks; callers must verify the
affected data and handle recovery.
Licensed under the terms of the MIT license.
Unless you explicitly state otherwise, any contribution submitted for inclusion in the work by you shall be licensed under the terms of the MIT license.
License: MIT