Skip to main content

Crate ap33772s_rs

Crate ap33772s_rs 

Source
Expand description

§AP33772S USB-C Power Delivery Driver

This crate provides a Rust driver for the AP33772S USB-C Power Delivery controller IC. It supports both synchronous and asynchronous I2C operations and is designed for embedded systems with no_std support.

§Features

The driver supports two main operational modes controlled by feature flags:

§Synchronous vs Asynchronous Operation

  • sync (default): Uses embedded_hal traits for synchronous I2C operations
  • async: Uses embedded_hal_async traits for asynchronous I2C operations

Note: These features are mutually exclusive - you must choose one.

§Access Levels

  • Normal mode (default): Provides a high-level API through getter/setter methods on Ap33772s
  • advanced: Exposes low-level register access when enabled (see examples)

§Additional Features

  • interrupts: Enables interrupt pin support for asynchronous device communication (STILL In active Development)
  • defmt: Adds defmt formatting support for embedded debugging

§Quick Start

[dependencies]
ap33772s-rs = { version = "0.1", features = ["sync"] }
use ap33772s_rs::{Ap33772s, types::Statistics};
use ap33772s_rs::units::*;
// Create and initialize the driver
let mut ap33772s = Ap33772s::new_default(i2c, delay)?;

// Read device statistics
let stats: Statistics = ap33772s.get_statistics()?;
println!("Current: {}A, Voltage: {}V", stats.current.get::<ampere>(), stats.voltage.get::<volt>());

§Advanced Usage

Enable the advanced feature for direct register access:

[dependencies]
ap33772s-rs = { version = "0.1", features = ["sync", "advanced"] }

This exposes low-level register operations for advanced device control.

For more examples, see the repository’s examples/ directory and README.md.

Modules§

types
Public Types and Data Structures
units
Physical Units and Measurements

Structs§

Ap33772s
AP33772S USB-C Power Delivery Controller