diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d687352..58e9174 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -8,9 +8,44 @@ env:
CARGO_TERM_COLOR: always
jobs:
+ # Ensures the README is up-to-date with that of docs.rs.
+ check_rdme:
+ runs-on: ubuntu-22.04
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Install Rust
+ uses: actions-rust-lang/setup-rust-toolchain@v1
+ with:
+ toolchain: stable
+
+ - name: Install `cargo-rdme`
+ uses: taiki-e/install-action@v2
+ with:
+ tool: cargo-rdme
+
+ - name: Use `cargo-rdme` to see if README matches `lib.rs`
+ run: cargo rdme --check
+
+ # Checks for missed Clippy lints.
+ clippy:
+ runs-on: ubuntu-22.04
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Install Rust
+ uses: actions-rust-lang/setup-rust-toolchain@v1
+ with:
+ components: clippy
+ toolchain: stable
+
+ - name: Check for missed Clippy lints
+ run: RUSTFLAGS="-Dwarnings" cargo clippy
+
+ # Build the project and runs the test suite.
build_and_test:
name: Rust project - latest
- runs-on: ubuntu-latest
+ runs-on: ubuntu-22.04
strategy:
matrix:
toolchain:
@@ -21,10 +56,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- - name: Set up Rust toolchain
- uses: dtolnay/rust-toolchain@stable
+ - name: Install Rust
+ uses: actions-rust-lang/setup-rust-toolchain@v1
with:
- toolchain: ${{ matrix.toolchain }}
+ toolchain: ${{ matrix.toolchain }}
- name: Cache cargo registry
uses: actions/cache@v3
@@ -52,7 +87,7 @@ jobs:
- uses: taiki-e/install-action@v2
with:
- tool: cargo-all-features
+ tool: cargo-all-features,cargo-deny
- name: Build
run: cargo build-all-features --verbose
@@ -61,14 +96,14 @@ jobs:
run: cargo test-all-features
- name: Run `cargo-deny`
- uses: EmbarkStudios/cargo-deny-action@v1
+ run: cargo deny check
- name: Check feature gate
working-directory: ./.github/workflows/ci
run: rustc main.rs --verbose --forbid warnings
test_semver:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
@@ -76,7 +111,7 @@ jobs:
uses: obi1kenobi/cargo-semver-checks-action@v2
build_examples:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
diff --git a/.gitignore b/.gitignore
index 972b0c4..4349fd6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,5 @@
**/target
**/Cargo.lock
+
+# macos :p
+**/.DS_Store
diff --git a/README.md b/README.md
index ad1208e..e70d5ed 100644
--- a/README.md
+++ b/README.md
@@ -1,25 +1,26 @@
+
+
# max6675-hal
+An embedded-hal driver for the MAX6675 digital thermocouple converter.
+
[
](https://github.com/onkoe/max6675-hal)
[
](https://docs.rs/max6675-hal)
[
](https://crates.io/crates/max6675-hal)
[
](https://github.com/onkoe/max6675-hal)
[
](https://github.com/onkoe/max6675-hal/actions)
-An `embedded-hal` driver for the MAX6675 digital thermocouple converter.
-
## Usage
-This example code will change depending on which HAL device driver you're using. An `arduino-hal` project's SPI isn't like that of an `esp32-hal` project.
-
-However, you only have to focus on two parts:
+This example code will change depending on which HAL device driver you're
+using. An `arduino-hal` project's SPI isn't like that of an `esp32-hal`
+project.
-1. A CS (chip select) pin as an `OutputPin`
-2. Some SPI representation that doesn't exclusively own the CS pin (I'm looking at you, `linux-embedded-hal`!)
+However, you only need to focus on your device's SPI implementation!
+(thanks, `embedded-hal` 1.0 ☺️)
-Your SPI settings should use MSB (most significant bit) first, target a clock speed of at least 4mhz, and utilize SPI Mode 1.
-
-After both are good, pass them into the `Max6675::new(spi, chip_select)` constructor. Ta-da! Your MAX6675 gets put to good use.
+Your SPI settings should use MSB (most significant bit) first, target a clock speed of
+at least 4mhz, and utilize SPI Mode 1.
```rust
// first, define what pins you're connecting to
@@ -31,7 +32,7 @@ let sck_pin = pins.("your sck/clock pin").into_output();
// if so, just pick some pin that you're not using ☺️
let dummy_mosi = pins.("some pin you're not using").into_output();
-let (spi, cs) = device-hal::spi::Spi::new(
+let (spi, _) = device-hal::spi::Spi::new(
sck_pin, dummy_mosi, so_pin, cs_pin,
device-hal::spi::Settings {
// pick some settings that roughly align like so:
@@ -40,17 +41,28 @@ let (spi, cs) = device-hal::spi::Spi::new(
mode: embedded_hal::spi::MODE_1,
}
);
-let mut max = Max6675::new(spi, cs)?; // your spi and chip select here
+let mut max = Max6675::new(spi)?; // your spi and chip select here
let temp = max.read_celsius()? // ayo! we got the temperature
```
+## Note
+
+This crate re-exports a Temperature type from another crate, `simmer`.
+You can change and play with the temperatures in various ways, so feel free
+to [check out its docs](https://docs.rs/crate/simmer/latest) for more info.
+
## Contributions
-Contributions are welcome to this project! Since it's pretty small, feel free to submit a PR whenever. You can also make an issue - I'll likely get to it soon!
+Contributions are welcome to this project! Since it's pretty small, feel
+free to submit a PR whenever. You can also make an issue - I'll likely get
+to it soon!
## Help
Please don't hesitate to make an issue if you experience any problems!
-If you can, please submit a [`hw-probe` report](https://linux-hardware.org/?view=howto) alongside any error messages or useful logs you have!
+If you can, please submit a [`hw-probe` report](https://linux-hardware.org/?view=howto)
+alongside any error messages or useful logs you have!
+
+
diff --git a/deny.toml b/deny.toml
index 031cd9f..9c9ea37 100644
--- a/deny.toml
+++ b/deny.toml
@@ -1,5 +1,5 @@
[licenses]
-allow = ["MIT", "Apache-2.0", "Unicode-DFS-2016"]
+allow = ["MIT", "Apache-2.0", "Unicode-3.0"]
[bans]
# disable duplicate crates
diff --git a/src/lib.rs b/src/lib.rs
index 73b9fe6..c226b4d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,6 +3,12 @@
//!
//! An embedded-hal driver for the MAX6675 digital thermocouple converter.
//!
+//! [
](https://github.com/onkoe/max6675-hal)
+//! [
](https://docs.rs/max6675-hal)
+//! [
](https://crates.io/crates/max6675-hal)
+//! [
](https://github.com/onkoe/max6675-hal)
+//! [
](https://github.com/onkoe/max6675-hal/actions)
+//!
//! ## Usage
//!
//! This example code will change depending on which HAL device driver you're
@@ -44,6 +50,19 @@
//! This crate re-exports a Temperature type from another crate, `simmer`.
//! You can change and play with the temperatures in various ways, so feel free
//! to [check out its docs](https://docs.rs/crate/simmer/latest) for more info.
+//!
+//! ## Contributions
+//!
+//! Contributions are welcome to this project! Since it's pretty small, feel
+//! free to submit a PR whenever. You can also make an issue - I'll likely get
+//! to it soon!
+//!
+//! ## Help
+//!
+//! Please don't hesitate to make an issue if you experience any problems!
+//!
+//! If you can, please submit a [`hw-probe` report](https://linux-hardware.org/?view=howto)
+//! alongside any error messages or useful logs you have!
use core::marker::PhantomData;
use embedded_hal::spi::SpiDevice;