https://github.com/pulse-loop/afe4404
AFE4404 driver for Rust Embedded HAL.
https://github.com/pulse-loop/afe4404
afe4404 embedded-hal-driver rust
Last synced: about 1 year ago
JSON representation
AFE4404 driver for Rust Embedded HAL.
- Host: GitHub
- URL: https://github.com/pulse-loop/afe4404
- Owner: pulse-loop
- License: mit
- Created: 2022-07-22T12:24:43.000Z (almost 4 years ago)
- Default Branch: develop
- Last Pushed: 2023-04-07T13:13:21.000Z (about 3 years ago)
- Last Synced: 2025-04-15T15:12:42.513Z (about 1 year ago)
- Topics: afe4404, embedded-hal-driver, rust
- Language: Rust
- Size: 168 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AFE4404 Rust driver
[](https://crates.io/crates/afe4404)
[](https://github.com/pulse-loop/AFE4404/actions/workflows/build.yml)
[](https://docs.rs/afe4404)


This is a AFE4404 driver for Rust embedded-hal.
It allows a high level interaction with the AFE.
## Usage
Initialise the AFE:
```rust
let mut frontend = AFE4404::with_three_leds(i2c, 0x58u8, Frequency::new::(4.0));
```
Set the LEDs current:
```rust
frontend
.set_leds_current(&LedCurrentConfiguration::::new(
ElectricCurrent::new::(60.0),
ElectricCurrent::new::(10.0),
ElectricCurrent::new::(10.0),
))
.expect("Cannot set leds current");
```
Set the TIA resistors:
```rust
frontend
.set_tia_resistors(&ResistorConfiguration::::new(
ElectricalResistance::new::(250.0),
ElectricalResistance::new::(100.0),
))
.expect("Cannot set tia resistors");
```
Set the clock source:
```rust
frontend
.set_clock_source(ClockConfiguration::Internal)
.expect("Cannot set clock source");
```
Read the sampled values:
```rust
let sample = frontend.read();
```