|
24 | 24 | //! use std::time::Duration;
|
25 | 25 | //!
|
26 | 26 | //! use i2cdev::core::*;
|
| 27 | +//! #[cfg(any(target_os = "linux", target_os = "android"))] |
27 | 28 | //! use i2cdev::linux::{LinuxI2CDevice, LinuxI2CError};
|
28 | 29 | //!
|
29 | 30 | //! const NUNCHUCK_SLAVE_ADDR: u16 = 0x52;
|
30 | 31 | //!
|
31 | 32 | //! // real code should probably not use unwrap()
|
| 33 | +//! #[cfg(any(target_os = "linux", target_os = "android"))] |
32 | 34 | //! fn i2cfun() -> Result<(), LinuxI2CError> {
|
33 | 35 | //! let mut dev = LinuxI2CDevice::new("/dev/i2c-1", NUNCHUCK_SLAVE_ADDR)?;
|
34 | 36 | //!
|
|
52 | 54 | //! extern crate i2cdev;
|
53 | 55 | //!
|
54 | 56 | //! use i2cdev::core::*;
|
| 57 | +//! #[cfg(any(target_os = "linux", target_os = "android"))] |
55 | 58 | //! use i2cdev::linux::{LinuxI2CDevice, LinuxI2CError, LinuxI2CMessage};
|
56 | 59 | //!
|
57 | 60 | //! const SLAVE_ADDR: u16 = 0x57;
|
58 | 61 | //!
|
| 62 | +//! #[cfg(any(target_os = "linux", target_os = "android"))] |
59 | 63 | //! fn write_read_transaction() -> Result<(), LinuxI2CError> {
|
60 | 64 | //! let mut dev = LinuxI2CDevice::new("/dev/i2c-1", SLAVE_ADDR)?;
|
61 | 65 | //!
|
|
76 | 80 | //! extern crate i2cdev;
|
77 | 81 | //!
|
78 | 82 | //! use i2cdev::core::*;
|
| 83 | +//! #[cfg(any(target_os = "linux", target_os = "android"))] |
79 | 84 | //! use i2cdev::linux::{LinuxI2CBus, LinuxI2CError, LinuxI2CMessage};
|
80 | 85 | //!
|
81 | 86 | //! const SLAVE_ADDR: u16 = 0x57;
|
82 | 87 | //!
|
| 88 | +//! #[cfg(any(target_os = "linux", target_os = "android"))] |
83 | 89 | //! fn write_read_transaction_using_bus() -> Result<(), LinuxI2CError> {
|
84 | 90 | //! let mut dev = LinuxI2CBus::new("/dev/i2c-1")?;
|
85 | 91 | //!
|
|
0 commit comments