Skip to content

Commit

Permalink
doc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ryankurte committed May 5, 2022
1 parent c8b69a7 commit 4c3c5fc
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 17 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ edition = "2018"
version = "0.11.0"

[package.metadata.docs.rs]
all-features = true
features = [ "std", "nonblocking", "mock", "helpers" ]

[features]
std = [ ]
nonblocking = [ ]
mock = [ "embedded-hal-mock" ]
helpers = [ "structopt", "humantime", "std", "pcap-file", "libc", "byteorder", "rolling-stats", "log" ]
default = []
helpers = [ "structopt", "humantime", "std", "pcap-file", "libc", "byteorder", "rolling-stats" ]
default = [ ]

[dependencies]
embedded-hal = "1.0.0-alpha.7"
nb = "1.0.0"

log = { version = "0.4.14", optional = true, default_features = false }
log = { version = "0.4.14", default_features = false }
defmt = { version = "0.3.0", optional = true }

humantime = { version = "2.0.1", optional = true }
Expand Down
6 changes: 3 additions & 3 deletions src/blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
//! These implementations use the radio's DelayUs implementation to
//! poll on completion of operations.
//!
//! ## https://github.com/ryankurte/rust-radio
//! ## Copyright 2020 Ryan Kurte
//! ## <https://github.com/rust-iot/radio-hal>
//! ## Copyright 2020-2022 Ryan Kurte

use core::fmt::Debug;
use core::time::Duration;

use embedded_hal::delay::blocking::DelayUs;

#[cfg(feature = "log")]
#[cfg(not(feature = "defmt"))]
use log::debug;

#[cfg(feature = "defmt")]
Expand Down
14 changes: 10 additions & 4 deletions src/helpers.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Provides common helpers for implementing radio utilities
//!
//! ## https://github.com/ryankurte/rust-radio
//! ## Copyright 2020 Ryan Kurte
//! ## <https://github.com/rust-iot/radio-hal>
//! ## Copyright 2020-2022 Ryan Kurte

use std::ffi::CString;
use std::fs::{File, OpenOptions};
Expand All @@ -11,7 +11,7 @@ use std::time::SystemTime;

use libc::{self};

#[cfg(feature = "log")]
#[cfg(not(feature = "defmt"))]
use log::{debug, info};

#[cfg(feature = "defmt")]
Expand Down Expand Up @@ -235,7 +235,10 @@ where

match std::str::from_utf8(&buff[0..n as usize]) {
Ok(s) => info!("Received: '{}' info: {:?}", s, i),
Err(_) => info!("Received: '{:x?}' info: {:?}", &buff[0..n as usize], i),
#[cfg(not(feature = "defmt"))]
Err(_) => info!("Received: '{:02x?}' info: {:?}", &buff[0..n as usize], i),
#[cfg(feature = "defmt")]
Err(_) => info!("Received: '{:?}' info: {:?}", &buff[0..n as usize], i),
}

if let Some(p) = &mut pcap_writer {
Expand Down Expand Up @@ -356,7 +359,10 @@ where
// Parse out string if possible, otherwise print hex
match std::str::from_utf8(&buff[0..n as usize]) {
Ok(s) => info!("Received: '{}' info: {:?}", s, i),
#[cfg(not(feature = "defmt"))]
Err(_) => info!("Received: '{:02x?}' info: {:?}", &buff[0..n as usize], i),
#[cfg(feature = "defmt")]
Err(_) => info!("Received: '{:?}' info: {:?}", &buff[0..n as usize], i),
}

// Append info if provided
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
//! This package defines traits for packet radio devices, as well as blocking and async
//! implementations using these traits, and a mock device to support application level testing.
//!
//! ## https://github.com/ryankurte/rust-radio
//! ## Copyright 2020 Ryan Kurte
//! ## <https://github.com/rust-iot/radio-hal>
//! ## Copyright 2020-2022 Ryan Kurte

// Set `no_std` where `std` feature is disabled
#![cfg_attr(not(feature = "std"), no_std)]
Expand Down
4 changes: 2 additions & 2 deletions src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
//! This provides a generic and specific mock implementation of the radio traits
//! to support network and application level testing.
//!
//! ## https://github.com/ryankurte/rust-radio
//! ## Copyright 2020 Ryan Kurte
//! ## <https://github.com/rust-iot/radio-hal>
//! ## Copyright 2020-2022 Ryan Kurte

extern crate std;
use std::convert::Infallible;
Expand Down
4 changes: 2 additions & 2 deletions src/nonblocking.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Non-blocking (async/await) APIs on top of the base radio traits
//! Note that this _requires_ use of unstable `feature(generic_associated_types)`
//!
//! ## https://github.com/ryankurte/rust-radio
//! ## Copyright 2020 Ryan Kurte
//! ## <https://github.com/rust-iot/radio-hal>
//! ## Copyright 2020-2022 Ryan Kurte

use core::fmt::Debug;
use core::future::Future;
Expand Down

0 comments on commit 4c3c5fc

Please sign in to comment.