{"id":16064685,"url":"https://github.com/eldruin/ad983x-rs","last_synced_at":"2025-07-22T00:33:46.392Z","repository":{"id":57479330,"uuid":"184909954","full_name":"eldruin/ad983x-rs","owner":"eldruin","description":"Platform-agnostic Rust driver for the AD9833/AD9837 programmable waveform generator / direct digital synthesizer (DDS)","archived":false,"fork":false,"pushed_at":"2024-05-04T18:31:53.000Z","size":84,"stargazers_count":16,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-04T10:50:31.111Z","etag":null,"topics":["dds","driver","embedded-hal-driver","no-std","rust","spi","waveform-generator"],"latest_commit_sha":null,"homepage":"https://blog.eldruin.com/ad983x-waveform-generator-dds-driver-in-rust/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eldruin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-04T15:07:44.000Z","updated_at":"2025-02-19T19:06:44.000Z","dependencies_parsed_at":"2024-10-27T10:12:29.744Z","dependency_job_id":"d360a8e8-5900-425b-b3f5-a7574d300f02","html_url":"https://github.com/eldruin/ad983x-rs","commit_stats":{"total_commits":78,"total_committers":2,"mean_commits":39.0,"dds":"0.012820512820512775","last_synced_commit":"c88b212df677e776f0f66d454c70c21a05323c12"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/eldruin/ad983x-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldruin%2Fad983x-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldruin%2Fad983x-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldruin%2Fad983x-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldruin%2Fad983x-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eldruin","download_url":"https://codeload.github.com/eldruin/ad983x-rs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldruin%2Fad983x-rs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266404942,"owners_count":23923498,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dds","driver","embedded-hal-driver","no-std","rust","spi","waveform-generator"],"created_at":"2024-10-09T05:09:07.557Z","updated_at":"2025-07-22T00:33:46.372Z","avatar_url":"https://github.com/eldruin.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rust AD983x Low-Power Programmable Waveform Generator / Direct Digital Synthesizer (DDS) Driver\n\n[![crates.io](https://img.shields.io/crates/v/ad983x.svg)](https://crates.io/crates/ad983x)\n[![Docs](https://docs.rs/ad983x/badge.svg)](https://docs.rs/ad983x)\n![Minimum Supported Rust Version](https://img.shields.io/badge/rustc-1.62+-blue.svg)\n[![Build Status](https://github.com/eldruin/ad983x-rs/workflows/Build/badge.svg)](https://github.com/eldruin/ad983x-rs/actions?query=workflow%3ABuild)\n[![Coverage Status](https://coveralls.io/repos/github/eldruin/ad983x-rs/badge.svg?branch=master)](https://coveralls.io/github/eldruin/ad983x-rs?branch=master)\n\nThis is a platform agnostic Rust driver for the AD9833, AD9834, AD9837 and AD9838 low-power programmable waveform generators / direct digital synthesizers (DDS) using the [`embedded-hal`] traits.\n\nThis driver allows you to:\n- Enable/disable/reset the device. See `enable()`.\n- Set the frequency registers. See: `set_frequency()`.\n- Select the output frequency register. See: `select_frequency()`.\n- Set the phase registers. See: `set_phase()`.\n- Select the output phase register. See: `select_phase()`.\n- Set the frequency registers MSBs/LSBs separately. See: `set_frequency_msb()`.\n- Set the output waveform. See: `set_output_waveform()`.\n- Power down/up device parts. See: `set_powered_down()`.\n- Select control source on AD9834/AD9838. See: `set_control_source()`.\n\n[Introductory blog post](https://blog.eldruin.com/ad983x-waveform-generator-dds-driver-in-rust/)\n\n## The devices\n\nThe AD9833, AD9834, AD9837 and AD9838 are low power, programmable waveform generators capable of producing sine, triangular, and square wave outputs. Waveform generation is required in various types of sensing, actuation, and time domain reflectometry (TDR) applications. The output frequency and phase are software programmable, allowing easy tuning. No external components are needed. The frequency registers are 28 bits wide: with a 25 MHz clock rate, resolution of 0.1 Hz can be achieved; with a 1 MHz clock rate, the AD9833 can be tuned to 0.004 Hz resolution.\n\nThe devices are written to via a 3-wire serial interface (SPI). This serial interface operates at clock rates up to 40 MHz and is compatible with DSP and microcontroller standards. The devices operate with a power supply from 2.3 V to 5.5 V.\n\nDatasheets:\n- [AD9833](https://www.analog.com/media/en/technical-documentation/data-sheets/ad9833.PDF)\n- [AD9834](https://www.analog.com/media/en/technical-documentation/data-sheets/AD9834.PDF)\n- [AD9837](https://www.analog.com/media/en/technical-documentation/data-sheets/AD9837.PDF)\n- [AD9838](https://www.analog.com/media/en/technical-documentation/data-sheets/AD9838.PDF)\n\nApplication Note:\n- [Programming the AD9833/AD9834](https://www.analog.com/media/en/technical-documentation/application-notes/AN-1070.pdf)\n\nArticle explaining DDS using an AD9833:\n- [All about direct digital synthesis](https://www.analog.com/en/analog-dialogue/articles/all-about-direct-digital-synthesis.html)\n\n## Usage\n\nTo use this driver, import this crate and an `embedded_hal` implementation,\nthen instantiate the appropriate device.\n\nI wrote an example MIDI player that plays Beethoven's ninth symphony in hardware :). See: [driver-examples].\n\n[driver-examples]: https://github.com/eldruin/driver-examples\n\n```rust\nuse ad983x::{Ad983x, FrequencyRegister};\nuse embedded_hal_bus::spi::ExclusiveDevice;\nuse linux_embedded_hal::{Delay, SpidevBus, SysfsPin};\n\nfn main() {\n    let spi = SpidevBus::open(\"/dev/spidev0.0\").unwrap();\n    let chip_select = SysfsPin::new(25);\n    let dev = ExclusiveDevice::new(spi, chip_select, Delay);\n    let mut dds = Ad983x::new_ad9833(dev);\n    dds.reset().unwrap(); // reset is necessary before operation\n    dds.set_frequency(FrequencyRegister::F0, 4724).unwrap();\n    dds.enable().unwrap();\n    // Given a 25 MHz clock, this now outputs a sine wave\n    // with a frequency of 440 Hz, which is a standard\n    // A4 tone.\n\n    // Get device back\n    let _dev = dds.destroy();\n}\n```\n\n## Status\n\n- [X] Compatible with AD9833/AD9837\n- [X] Compatible with AD9834/AD9838\n- [ ] Compatible with AD9832/AD9835\n\n## Support\n\nFor questions, issues, feature requests like compatibility with similar devices\nand other changes, please file an\n[issue in the github project](https://github.com/eldruin/ad983x-rs/issues).\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or\n   http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or\n   http://opensource.org/licenses/MIT)\n\nat your option.\n\n### Contributing\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall\nbe dual licensed as above, without any additional terms or conditions.\n\n[`embedded-hal`]: https://github.com/rust-embedded/embedded-hal\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldruin%2Fad983x-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feldruin%2Fad983x-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldruin%2Fad983x-rs/lists"}