Skip to content

Commit 5ab24a5

Browse files
committed
Update nix and bitflags + bump MSRV to 1.56.1
1 parent 541cd2a commit 5ab24a5

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

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

7+
- Nix updated to 0.26
8+
- bitflags updated to 2.3
9+
- Minimum Supported Rust Version is now 1.56.1
710

811
## 0.5.2 / 2023-08-02
912

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ half-duplex SPI access, and full-duplex SPI access.
2020

2121
[dependencies]
2222
libc = "0.2"
23-
bitflags = "1.3"
24-
nix = "0.23"
23+
bitflags = "2.3"
24+
nix = "0.26"

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![Build Status](https://github.com/rust-embedded/rust-spidev/workflows/CI/badge.svg)](https://github.com/rust-embedded/rust-spidev/actions)
44
[![Version](https://img.shields.io/crates/v/spidev.svg)](https://crates.io/crates/spidev)
55
[![License](https://img.shields.io/crates/l/spidev.svg)](https://github.com/rust-embedded/rust-spidev/blob/master/README.md#license)
6+
![Minimum Supported Rust Version](https://img.shields.io/badge/rustc-1.56.1+-blue.svg)
67

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

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

7778
## Minimum Supported Rust Version (MSRV)
7879

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

8283
## Cross Compiling

src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ use std::path::Path;
7777

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

9899
// Common Configurations
99100
const SPI_MODE_0 = 0x00;
100-
const SPI_MODE_1 = Self::SPI_CPHA.bits;
101-
const SPI_MODE_2 = Self::SPI_CPOL.bits;
102-
const SPI_MODE_3 = (Self::SPI_CPOL.bits | Self::SPI_CPHA.bits);
101+
const SPI_MODE_1 = Self::SPI_CPHA.bits();
102+
const SPI_MODE_2 = Self::SPI_CPOL.bits();
103+
const SPI_MODE_3 = (Self::SPI_CPOL.bits() | Self::SPI_CPHA.bits());
103104

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

src/spidevioctl.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,10 @@ pub fn set_mode(fd: RawFd, mode: SpiModeFlags) -> io::Result<()> {
196196
// the 8-bit mask are used. This is because WR_MODE32 was not
197197
// added until later kernels. This provides a reasonable story
198198
// for forwards and backwards compatibility
199-
if (mode.bits & 0xFFFFFF00) != 0 {
200-
from_nix_result(unsafe { ioctl::set_mode32(fd, &mode.bits) })?;
199+
if (mode.bits() & 0xFFFFFF00) != 0 {
200+
from_nix_result(unsafe { ioctl::set_mode32(fd, &mode.bits()) })?;
201201
} else {
202-
let bits: u8 = mode.bits as u8;
202+
let bits: u8 = mode.bits() as u8;
203203
from_nix_result(unsafe { ioctl::set_mode(fd, &bits) })?;
204204
}
205205
Ok(())

0 commit comments

Comments
 (0)