Struct Charger

Source
pub struct Charger<D> { /* private fields */ }
Expand description

A MAX77975/MAX77976 battery charger.

Implementations§

Source§

impl<D: I2c> Charger<D>

Source

pub fn new(i2c_dev: D) -> Self

Create a new Charger

Source

pub async fn set_sys_ilim( &mut self, milliamps: u16, recycle_en: bool, ) -> Result<(), D::Error>

Set the current limit for Vsys out.

If the current limit is exceeded, Vsys will be shut off. If recycle_en is false, it will remain shut off until a valid charger is present. Otherwise, it will attempt to recycle after 150ms.

Source

pub async fn set_chgin_ilim(&mut self, milliamps: u16) -> Result<(), D::Error>

Set the current limit for CHGIN.

Source

pub async fn set_fast_charge_current( &mut self, milliamps: u16, ) -> Result<(), D::Error>

Set the current to use during the ChargerDetails::ConstantCurrent charging phase.

Source

pub async fn set_mode(&mut self, mode: Mode) -> Result<(), D::Error>

Set the charger Mode.

Source

pub async fn enter_ship_mode(&mut self) -> Result<(), D::Error>

Enter ship mode.

All power will be shut down and remain off until a valid charger is present. Ship mode can not be enetered when a valid charger is present.

Source

pub async fn set_charger_irq_mask( &mut self, irqs: ChargerInterrupts, ) -> Result<(), D::Error>

Enable charger interrupts.

Fields set to true in irqs will have their interrupts enabled.

Source

pub async fn charger_irq_flags(&mut self) -> Result<ChargerInterrupts, D::Error>

Reads and clears the current charger interrupt flags

Source

pub async fn charger_status(&mut self) -> Result<ChargerInterrupts, D::Error>

Clears the charger interrupt flags and returns the current status bits

This method reads from Reg::CHARGER_INTERRUPT through Reg::CHARGER_INTERRUPT_STATUS in a single transaction to atomically clear the interrupt flags and return the current status bits.

Source

pub async fn charger_details(&mut self) -> Result<Details, D::Error>

Get the detailed status of the charger.

Auto Trait Implementations§

§

impl<D> Freeze for Charger<D>
where D: Freeze,

§

impl<D> RefUnwindSafe for Charger<D>
where D: RefUnwindSafe,

§

impl<D> Send for Charger<D>
where D: Send,

§

impl<D> Sync for Charger<D>
where D: Sync,

§

impl<D> Unpin for Charger<D>
where D: Unpin,

§

impl<D> UnwindSafe for Charger<D>
where D: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.