Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]

name = "i2cdev"
build = "build.rs"
version = "0.4.0"
authors = ["Paul Osborne <osbpau@gmail.com>"]
license = "MIT/Apache-2.0"
Expand All @@ -22,7 +21,4 @@ nix = "0.11"

[dev-dependencies]
docopt = "0.8"
skeptic = "0.13"

[build-dependencies]
skeptic = "0.13"
33 changes: 1 addition & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,38 +27,7 @@ The source includes an example of using the library to talk to a Wii
Nunchuck (which has an i2c interface).
[Go View the Example](https://github.com/rust-embedded/rust-i2cdev/blob/master/examples/nunchuck.rs).

Here's a real quick example showing the guts of how you create
device and start talking to it...

```rust,no_run,skeptic-template
extern crate i2cdev;

use std::thread;
use std::time::Duration;

use i2cdev::core::*;
use i2cdev::linux::{LinuxI2CDevice, LinuxI2CError};

const NUNCHUCK_SLAVE_ADDR: u16 = 0x52;

// real code should probably not use unwrap()
fn i2cfun() -> Result<(), LinuxI2CError> {
let mut dev = LinuxI2CDevice::new("/dev/i2c-1", NUNCHUCK_SLAVE_ADDR)?;

// init sequence
dev.smbus_write_byte_data(0xF0, 0x55)?;
dev.smbus_write_byte_data(0xFB, 0x00)?;
thread::sleep(Duration::from_millis(100));

loop {
let mut buf: [u8; 6] = [0; 6];
dev.smbus_write_byte(0x00).unwrap();
thread::sleep(Duration::from_millis(10));
dev.read(&mut buf).unwrap();
println!("Reading: {:?}", buf);
}
}
```
The [Documentation](https://docs.rs/i2cdev) contains a quick overview of how to get started with an i2c device.

In addition to the Read/Write traits, the following methods are
available via the [I2CDevice trait](https://rust-embedded.github.io/rust-i2cdev/i2cdev/core/trait.I2CDevice.html).
Expand Down
14 changes: 0 additions & 14 deletions build.rs

This file was deleted.

29 changes: 29 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,35 @@
//! with i2c devices under Linux. The API wraps the Linux
//! kernel interface for interacting with i2c in userspace:
//! https://www.kernel.org/doc/Documentation/i2c/dev-interface
//! ```rust,no_run
//! extern crate i2cdev;
//!
//! use std::thread;
//! use std::time::Duration;
//!
//! use i2cdev::core::*;
//! use i2cdev::linux::{LinuxI2CDevice, LinuxI2CError};
//!
//! const NUNCHUCK_SLAVE_ADDR: u16 = 0x52;
//!
//! // real code should probably not use unwrap()
//! fn i2cfun() -> Result<(), LinuxI2CError> {
//! let mut dev = LinuxI2CDevice::new("/dev/i2c-1", NUNCHUCK_SLAVE_ADDR)?;
//!
//! // init sequence
//! dev.smbus_write_byte_data(0xF0, 0x55)?;
//! dev.smbus_write_byte_data(0xFB, 0x00)?;
//! thread::sleep(Duration::from_millis(100));
//!
//! loop {
//! let mut buf: [u8; 6] = [0; 6];
//! dev.smbus_write_byte(0x00).unwrap();
//! thread::sleep(Duration::from_millis(10));
//! dev.read(&mut buf).unwrap();
//! println!("Reading: {:?}", buf);
//! }
//! }
//! ```

#![crate_name = "i2cdev"]
#![crate_type = "lib"]
Expand Down
9 changes: 0 additions & 9 deletions tests/skeptic.rs

This file was deleted.