Crates.io | pdm |
lib.rs | pdm |
version | |
source | src |
created_at | 2025-04-13 16:19:03.059324+00 |
updated_at | 2025-04-15 18:45:24.840671+00 |
description | Pulse Density Modulator |
homepage | |
repository | https://github.com/lsartory/pdm |
max_upload_size | |
id | 1631953 |
Cargo.toml error: | TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
PDM (Pulse Density Modulator) is a library meant for digital-to-analog conversion in embedded systems, using a simple second-order delta sigma modulator. If no hardware PWM channels are available, this is a lightweight alternative.
This can be used, for example, to modulate the intensity of an LED.
The library offers the following features:
Easy to use
Suitable for no_std
environments
No external dependencies
Ultra-low RAM requirements
Supports the following types: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
For good results, the output frequency must be high and stable in relation to the modulated signal frequency. An external low-pass filter may be necessary to remove noise, depending on the application.
let mut pdm = pdm::Pdm::<u8>::new();
pdm.set_value(42);
loop {
if pdm.update() {
// Set output high
} else {
// Set output low
}
// Sleep until next iteration
}
Date | Version | Changes |
---|---|---|
2025-04-15 | 1.0.0 | Cleaner code structure |
2025-04-13 | 0.1.0 | Initial release |