[][src]Struct axp173::Axp173

pub struct Axp173<I> { /* fields omitted */ }

AXP173 PMIC instance.

Methods

impl<I, E> Axp173<I> where
    I: WriteRead<Error = E> + Write<Error = E>, 
[src]

pub fn new(i2c: I) -> Self[src]

Side-effect-free constructor. Nothing will be read or written before init() call.

pub fn init(&mut self) -> Result<(), Error<E>>[src]

Checks the I2C connection to the AXP173 chip. AXP173 doesn't have a dedicated chip ID register and connection is checked by reading on-chip buffer for a presence of default values.

pub fn read_onchip_buffer(&mut self) -> Result<[u8; 6], Error<E>>[src]

Reads 6-byte user data buffer from the chip.

pub fn write_onchip_buffer(&mut self, bytes: &[u8; 6]) -> Result<(), Error<E>>[src]

Writes 6-byte user data buffer into the chip.

pub fn vbus_present(&mut self) -> Result<bool, Error<E>>[src]

Returns true if device is connected to the USB power source.

pub fn battery_present(&mut self) -> Result<bool, Error<E>>[src]

Returns true if lithium battery is connected.

pub fn battery_charging(&mut self) -> Result<bool, Error<E>>[src]

Returns true if lithium battery is connected and currently charging.

pub fn enable_ldo(&mut self, ldo: &Ldo) -> Result<(), Error<E>>[src]

Enables selected LDO with selected output voltage.

pub fn disable_ldo(&mut self, ldo: &LdoKind) -> Result<(), Error<E>>[src]

Disables selected LDO.

pub fn set_charging_current(
    &mut self,
    current: ChargingCurrent
) -> Result<(), Error<E>>
[src]

Sets charging current of the battery. Adjust this for an efficient and safe charging of your lithium battery's capacity.

pub fn set_charging_voltage(
    &mut self,
    voltage: ChargingVoltage
) -> Result<(), Error<E>>
[src]

Sets battery charging regulation voltage. This value varies depending on battery's chemistry and should be as close to the value from battery's datasheet as possible to ensure efficient charging and long battery life.

pub fn set_charging(&mut self, enabled: bool) -> Result<(), Error<E>>[src]

Enables or disables battery charging.

pub fn set_adc_settings(
    &mut self,
    adc_settings: &AdcSettings
) -> Result<(), Error<E>>
[src]

Enables or disables certain ADC functions of AXP173.

pub fn vbus_voltage(&mut self) -> Result<Voltage, Error<E>>[src]

Returns VBUS voltage.

pub fn vbus_current(&mut self) -> Result<Current, Error<E>>[src]

Returns battery charging current.

pub fn batt_voltage(&mut self) -> Result<Voltage, Error<E>>[src]

Returns battery voltage.

pub fn batt_charge_current(&mut self) -> Result<Current, Error<E>>[src]

Returns battery charging current.

pub fn batt_discharge_current(&mut self) -> Result<Current, Error<E>>[src]

Returns battery discharging current.

Auto Trait Implementations

impl<I> Send for Axp173<I> where
    I: Send

impl<I> Sync for Axp173<I> where
    I: Sync

impl<I> Unpin for Axp173<I> where
    I: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.