Code Monkey home page Code Monkey logo

rt-ltc681x's Introduction

Client for LTC681X battery stack monitors

License License Crates.io Actions Status

Abstraction for LTC681X family. Supports all devices of LTC681X family: LTC6813, LTC6812, LTC6811 and LTC6810.

Currently, the following features are implemented:

Example

For all details see monitor module.

use ltc681x::example::{ExampleCSPin, ExampleSPIBus};
use ltc681x::ltc6813::{CellSelection, Channel, GPIOSelection, LTC6813};
use ltc681x::monitor::{ADCMode, LTC681X, LTC681XClient, PollClient};

let spi_bus = ExampleSPIBus::default();
let cs_pin = ExampleCSPin{};

// LTC6813 device
let mut client: LTC681X<_, _, _, LTC6813, 1> = LTC681X::ltc6813(spi_bus, cs_pin)
    .enable_sdo_polling();

// Starts conversion for cell group 1
client.start_conv_cells(ADCMode::Normal, CellSelection::Group1, true);

// Poll ADC status
while !client.adc_ready().unwrap() {
    // Conversion is not done yet
}

// Returns the value of cell group A. In case of LTC613: cell 1, 7 and 13
let voltages = client.read_voltages(CellSelection::Group1).unwrap();
assert_eq!(Channel::Cell1, voltages[0][0].channel);
assert_eq!(24979, voltages[0][0].voltage);

State

⚠️ The crate is still incomplete, but is under active development.

⚠️ The crate has only been tested for the LTC6813 variant. Although the protocol of the LTC681X family is essentially the same, inconsistencies are still conceivable for some variants. Practical tests + feedback with other variants are therefore welcome.

Development

Any form of support is greatly appreciated. Feel free to create issues and PRs. See DEVELOPMENT for more details.

License

Licensed under either of

Each contributor agrees that his/her contribution covers both licenses.

rt-ltc681x's People

Contributors

marius-meissner avatar

Stargazers

Jonathan Graesser  avatar Andy George avatar Ryan Huber avatar Riccardo Persello avatar G. Berthiaume avatar

Watchers

 avatar

rt-ltc681x's Issues

ADBMS1818

Hi

will it work for ADBMS1818?, Since LTC6813 is compatible with ADBMS1818
Thanks

build fails with stm32h7xx_hal

Hi @marius-meissner ,

I was happy to find that there is already a create implementing the LTC681x family.
I'm working on a BMS based on the Portenta H7 development board
and cell sensor board with two LTC6812 ICs.

I have a working simple test code with spi in this commit: 1e2885d

When I add the LTC681x create like this commit b954de7 the build fails with the message:

error: no global memory allocator found but one is required; link to std or add `#[global_allocator]` to 
a static item that implements the GlobalAlloc trait

This shouldn't happen as the LTC681x crate is not using any alloc(), right?
I tried to check the heapless create, but except in its tests it also not using the std allocator.
Then maybe an interaction with the STM32H7xx_hal create?

Any hints or suggestions on how to fix this issue would be very appreciated!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.