Skip to content

Commit

Permalink
Merge pull request #41 from eldruin/updates
Browse files Browse the repository at this point in the history
Update dependencies + bump MRSV + 0.6.0 release
  • Loading branch information
eldruin authored Aug 9, 2023
2 parents 541cd2a + 27a2b6f commit 473db93
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 50 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @rust-embedded/embedded-linux
34 changes: 12 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:

name: CI

env:
RUSTFLAGS: '--deny warnings'

jobs:
ci-linux:
name: CI
Expand All @@ -15,7 +18,7 @@ jobs:
strategy:
matrix:
# All published crates must build on stable.
rust: [stable, beta, 1.46.0]
rust: [stable, beta, 1.56.1]

# The default target we're compiling on and for.
TARGET: [x86_64-unknown-linux-gnu, x86_64-unknown-linux-musl]
Expand All @@ -27,26 +30,13 @@ jobs:
TARGET: x86_64-unknown-linux-gnu

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: ${{ matrix.TARGET }}
override: true
- uses: actions-rs/cargo@v1
with:
command: check
args: --target=${{ matrix.TARGET }}
- uses: actions-rs/cargo@v1
with:
command: build
args: --target=${{ matrix.TARGET }}
- uses: actions-rs/cargo@v1
with:
command: test
args: --target=${{ matrix.TARGET }}
- uses: actions-rs/cargo@v1
with:
command: build
args: --target=${{ matrix.TARGET }} --examples
target: ${{ matrix.target }}

- run: cargo check --target=${{ matrix.TARGET }}
- run: cargo build --target=${{ matrix.TARGET }}
- run: cargo test --target=${{ matrix.TARGET }}
- run: cargo build --target=${{ matrix.TARGET }} --examples
12 changes: 4 additions & 8 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,9 @@ jobs:
clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: 1.55.0
override: true
toolchain: 1.71.0
components: clippy
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- run: cargo clippy
13 changes: 4 additions & 9 deletions .github/workflows/rustfmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,9 @@ jobs:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: stable
override: true
toolchain: 1.71.0
components: rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- run: cargo fmt --all -- --check
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@

## Not yet released

[Full Changelog](https://github.com/rust-embedded/rust-spidev/compare/0.5.2...HEAD)
[Full Changelog](https://github.com/rust-embedded/rust-spidev/compare/0.6.0...HEAD)

## 0.6.0 / 2023-08-03

[Full Changelog](https://github.com/rust-embedded/rust-spidev/compare/0.5.2...0.6.0)

- Nix updated to 0.26
- bitflags updated to 2.3
- Minimum Supported Rust Version is now 1.56.1

## 0.5.2 / 2023-08-02

Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]

name = "spidev"
version = "0.5.2"
version = "0.6.0"
authors = [
"Paul Osborne <osbpau@gmail.com>",
"The Embedded Linux Team <embedded-linux@teams.rust-embedded.org>"
Expand All @@ -20,5 +20,5 @@ half-duplex SPI access, and full-duplex SPI access.

[dependencies]
libc = "0.2"
bitflags = "1.3"
nix = "0.23"
bitflags = "2.3"
nix = "0.26.2"
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![Build Status](https://github.com/rust-embedded/rust-spidev/workflows/CI/badge.svg)](https://github.com/rust-embedded/rust-spidev/actions)
[![Version](https://img.shields.io/crates/v/spidev.svg)](https://crates.io/crates/spidev)
[![License](https://img.shields.io/crates/l/spidev.svg)](https://github.com/rust-embedded/rust-spidev/blob/master/README.md#license)
![Minimum Supported Rust Version](https://img.shields.io/badge/rustc-1.56.1+-blue.svg)

[Documentation](https://docs.rs/spidev)

Expand Down Expand Up @@ -76,7 +77,7 @@ The following features are implemented and planned for the library:

## Minimum Supported Rust Version (MSRV)

This crate is guaranteed to compile on stable Rust 1.46 and up. It *might*
This crate is guaranteed to compile on stable Rust 1.56.1 and up. It *might*
compile with older versions but that may change in any new patch release.

## Cross Compiling
Expand Down
7 changes: 4 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ use std::path::Path;

// Constants extracted from linux/spi/spidev.h
bitflags! {
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct SpiModeFlags: u32 {
/// Clock Phase
const SPI_CPHA = 0x01;
Expand All @@ -97,9 +98,9 @@ bitflags! {

// Common Configurations
const SPI_MODE_0 = 0x00;
const SPI_MODE_1 = Self::SPI_CPHA.bits;
const SPI_MODE_2 = Self::SPI_CPOL.bits;
const SPI_MODE_3 = (Self::SPI_CPOL.bits | Self::SPI_CPHA.bits);
const SPI_MODE_1 = Self::SPI_CPHA.bits();
const SPI_MODE_2 = Self::SPI_CPOL.bits();
const SPI_MODE_3 = (Self::SPI_CPOL.bits() | Self::SPI_CPHA.bits());

// == Only Supported with 32-bits ==

Expand Down
6 changes: 3 additions & 3 deletions src/spidevioctl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ pub fn set_mode(fd: RawFd, mode: SpiModeFlags) -> io::Result<()> {
// the 8-bit mask are used. This is because WR_MODE32 was not
// added until later kernels. This provides a reasonable story
// for forwards and backwards compatibility
if (mode.bits & 0xFFFFFF00) != 0 {
from_nix_result(unsafe { ioctl::set_mode32(fd, &mode.bits) })?;
if (mode.bits() & 0xFFFFFF00) != 0 {
from_nix_result(unsafe { ioctl::set_mode32(fd, &mode.bits()) })?;
} else {
let bits: u8 = mode.bits as u8;
let bits: u8 = mode.bits() as u8;
from_nix_result(unsafe { ioctl::set_mode(fd, &bits) })?;
}
Ok(())
Expand Down

0 comments on commit 473db93

Please sign in to comment.