[−][src]Struct axp173::Axp173
AXP173 PMIC instance.
Methods
impl<I, E> Axp173<I> where
I: WriteRead<Error = E> + Write<Error = E>,
[src]
I: WriteRead<Error = E> + Write<Error = E>,
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]
&mut self,
current: ChargingCurrent
) -> Result<(), Error<E>>
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]
&mut self,
voltage: ChargingVoltage
) -> Result<(), Error<E>>
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]
&mut self,
adc_settings: &AdcSettings
) -> Result<(), Error<E>>
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,
I: Send,
impl<I> Sync for Axp173<I> where
I: Sync,
I: Sync,
impl<I> Unpin for Axp173<I> where
I: Unpin,
I: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,