Skip to content

Commit

Permalink
Merge pull request #118 from Ayush1325/serial-optional
Browse files Browse the repository at this point in the history
Make unused dependencies optional
  • Loading branch information
eldruin authored Feb 7, 2025
2 parents 3ed5ad8 + 17b2457 commit 1ffb268
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Added

- Added async `DelayNs` implementation for `tokio`.
- Added feature flag for `serial`.

## [v0.4.0] - 2024-01-10

Expand Down
11 changes: 6 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,23 @@ edition = "2018"
gpio_sysfs = ["sysfs_gpio"]
gpio_cdev = ["gpio-cdev"]
async-tokio = ["gpio-cdev/async-tokio", "dep:embedded-hal-async", "tokio/time"]
i2c = ["i2cdev"]
i2c = ["i2cdev", "nix"]
spi = ["spidev"]
serial = ["serialport", "embedded-hal-nb"]

default = [ "gpio_cdev", "gpio_sysfs", "i2c", "spi" ]
default = [ "gpio_cdev", "gpio_sysfs", "i2c", "spi", "serial" ]

[dependencies]
embedded-hal = "1"
embedded-hal-nb = "1"
embedded-hal-nb = { version = "1", optional = true }
embedded-hal-async = { version = "1", optional = true }
gpio-cdev = { version = "0.6.0", optional = true }
sysfs_gpio = { version = "0.6.1", optional = true }
i2cdev = { version = "0.6.0", optional = true }
nb = "1"
serialport = { version = "4.2.0", default-features = false }
serialport = { version = "4.2.0", default-features = false, optional = true }
spidev = { version = "0.6.0", optional = true }
nix = "0.27.1"
nix = { version = "0.27.1", optional = true }
tokio = { version = "1", default-features = false, optional = true }

[dev-dependencies]
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#[cfg(feature = "i2c")]
pub use i2cdev;
pub use nb;
#[cfg(feature = "serial")]
pub use serialport;
#[cfg(feature = "spi")]
pub use spidev;
Expand Down Expand Up @@ -43,6 +44,7 @@ pub use sysfs_pin::{SysfsPin, SysfsPinError};
mod delay;
#[cfg(feature = "i2c")]
mod i2c;
#[cfg(feature = "serial")]
mod serial;
#[cfg(feature = "spi")]
mod spi;
Expand All @@ -51,6 +53,7 @@ mod timer;
pub use crate::delay::Delay;
#[cfg(feature = "i2c")]
pub use crate::i2c::{I2CError, I2cdev};
#[cfg(feature = "serial")]
pub use crate::serial::{Serial, SerialError};
#[cfg(feature = "spi")]
pub use crate::spi::{SPIError, SpidevBus, SpidevDevice};
Expand Down

0 comments on commit 1ffb268

Please sign in to comment.