@@ -27,38 +27,7 @@ The source includes an example of using the library to talk to a Wii
2727Nunchuck (which has an i2c interface).
2828[ Go View the Example] ( https://github.com/rust-embedded/rust-i2cdev/blob/master/examples/nunchuck.rs ) .
2929
30- Here's a real quick example showing the guts of how you create
31- device and start talking to it...
32-
33- ``` rust,no_run,skeptic-template
34- extern crate i2cdev;
35-
36- use std::thread;
37- use std::time::Duration;
38-
39- use i2cdev::core::*;
40- use i2cdev::linux::{LinuxI2CDevice, LinuxI2CError};
41-
42- const NUNCHUCK_SLAVE_ADDR: u16 = 0x52;
43-
44- // real code should probably not use unwrap()
45- fn i2cfun() -> Result<(), LinuxI2CError> {
46- let mut dev = LinuxI2CDevice::new("/dev/i2c-1", NUNCHUCK_SLAVE_ADDR)?;
47-
48- // init sequence
49- dev.smbus_write_byte_data(0xF0, 0x55)?;
50- dev.smbus_write_byte_data(0xFB, 0x00)?;
51- thread::sleep(Duration::from_millis(100));
52-
53- loop {
54- let mut buf: [u8; 6] = [0; 6];
55- dev.smbus_write_byte(0x00).unwrap();
56- thread::sleep(Duration::from_millis(10));
57- dev.read(&mut buf).unwrap();
58- println!("Reading: {:?}", buf);
59- }
60- }
61- ```
30+ The [ Documentation] ( https://docs.rs/i2cdev ) contains a quick overview of how to get started with an i2c device.
6231
6332In addition to the Read/Write traits, the following methods are
6433available via the [ I2CDevice trait] ( https://rust-embedded.github.io/rust-i2cdev/i2cdev/core/trait.I2CDevice.html ) .
0 commit comments