Skip to content

Commit

Permalink
Add example to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
eldruin committed May 23, 2019
1 parent 28862f8 commit 408bde2
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,28 @@ I wrote an example MIDI player that plays Beethoven's ninth symphony in hardware

[driver-examples]: https://github.com/eldruin/driver-examples

<!--
```rust
TODO
extern crate ad983x;
extern crate linux_embedded_hal;

use ad983x::{Ad983x, FrequencyRegister};
use linux_embedded_hal::{Pin, Spidev};

fn main() {
let spi = Spidev::open("/dev/spidev0.0").unwrap();
let chip_select = Pin::new(25);
let mut dds = Ad983x::new_ad9833(spi, chip_select);
dds.reset().unwrap(); // reset is necessary before operation
dds.set_frequency(FrequencyRegister::F0, 4724).unwrap();
dds.enable().unwrap();
// Given a 25 MHz clock, this now outputs a sine wave
// with a frequency of 440 Hz, which is a standard
// A4 tone.

// Get SPI device and CS pin back
let (_spi, _chip_select) = dds.destroy();
}
```
-->

## Status

Expand Down

0 comments on commit 408bde2

Please sign in to comment.