Skip to content

Commit 27daf71

Browse files
authored
Merge pull request rust-embedded#96 from LehMaxence/update-hal-to-rc
Update embedded-hal to 1.0.0-rc.1
2 parents 752b65f + 830d2fb commit 27daf71

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

CHANGELOG.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
99

1010
### Changed
1111
- [breaking-change] Replace serial-rs with the serialport-rs crate. `Serial::open` now needs a baud-rate argument as well.
12-
- Updated to `embedded-hal` `1.0.0-alpha.11` release ([API changes](https://github.com/rust-embedded/embedded-hal/blob/master/embedded-hal/CHANGELOG.md#v100-alpha11---2023-07-04))
13-
- Updated to `spidev` `0.5.2` release([API changes](https://github.com/rust-embedded/rust-spidev/blob/master/CHANGELOG.md#052--2023-08-02))
12+
- Updated to `embedded-hal` `1.0.0-rc.1` release ([API changes](https://github.com/rust-embedded/embedded-hal/blob/master/embedded-hal/CHANGELOG.md#v100-rc1---2023-08-15))
13+
- Updated to `embedded-hal-nb` `1.0.0-rc.1` release ([API changes](https://github.com/rust-embedded/embedded-hal/blob/master/embedded-hal-nb/CHANGELOG.md#v100-rc1---2023-08-15))
14+
- Updated to `spidev` `0.6.0` release([API changes](https://github.com/rust-embedded/rust-spidev/blob/master/CHANGELOG.md#060--2023-08-03))
15+
- Updated to `i2cdev` `0.6.0` release([API changes](https://github.com/rust-embedded/rust-i2cdev/blob/master/CHANGELOG.md#v060---2023-08-03))
16+
- Updated to `nix` `0.26` to match `i2cdev`
1417

1518
### Fixed
1619
- Fix using SPI transfer with unequal buffer sizes (#97, #98).

Cargo.toml

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ spi = ["spidev"]
2222
default = [ "gpio_cdev", "gpio_sysfs", "i2c", "spi" ]
2323

2424
[dependencies]
25-
embedded-hal = "=1.0.0-alpha.11"
26-
embedded-hal-nb = "=1.0.0-alpha.3"
25+
embedded-hal = "=1.0.0-rc.1"
26+
embedded-hal-nb = "=1.0.0-rc.1"
2727
gpio-cdev = { version = "0.5.1", optional = true }
2828
sysfs_gpio = { version = "0.6.1", optional = true }
29-
i2cdev = { version = "0.5.1", optional = true }
29+
i2cdev = { version = "0.6.0", optional = true }
3030
nb = "1"
3131
serialport = { version = "4.2.0", default-features = false }
32-
spidev = { version = "0.5.2", optional = true }
33-
nix = "0.23.1"
32+
spidev = { version = "0.6.0", optional = true }
33+
nix = "0.26.2"
3434

3535
[dev-dependencies]
3636
openpty = "0.2.0"

src/i2c.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ impl embedded_hal::i2c::Error for I2CError {
138138
use nix::errno::Errno::*;
139139

140140
let errno = match &self.err {
141-
i2cdev::linux::LinuxI2CError::Nix(e) => *e,
141+
i2cdev::linux::LinuxI2CError::Errno(e) => nix::Error::from_i32(*e),
142142
i2cdev::linux::LinuxI2CError::Io(e) => match e.raw_os_error() {
143143
Some(r) => nix::Error::from_i32(r),
144144
None => return ErrorKind::Other,

src/serial.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn translate_io_errors(err: std::io::Error) -> nb::Error<SerialError> {
3232
}
3333
}
3434

35-
impl embedded_hal::serial::ErrorType for Serial {
35+
impl embedded_hal_nb::serial::ErrorType for Serial {
3636
type Error = SerialError;
3737
}
3838

@@ -80,10 +80,10 @@ impl fmt::Display for SerialError {
8080

8181
impl std::error::Error for SerialError {}
8282

83-
impl embedded_hal::serial::Error for SerialError {
83+
impl embedded_hal_nb::serial::Error for SerialError {
8484
#[allow(clippy::match_single_binding)]
85-
fn kind(&self) -> embedded_hal::serial::ErrorKind {
86-
use embedded_hal::serial::ErrorKind::*;
85+
fn kind(&self) -> embedded_hal_nb::serial::ErrorKind {
86+
use embedded_hal_nb::serial::ErrorKind::*;
8787
// TODO: match any errors here if we can find any that are relevant
8888
Other
8989
}
@@ -120,7 +120,7 @@ mod test {
120120
#[test]
121121
fn test_read() {
122122
let (mut master, mut serial) = create_pty_and_serial();
123-
master.write(&[1]).expect("Write failed");
123+
master.write_all(&[1]).expect("Write failed");
124124
assert_eq!(Ok(1), serial.read());
125125
}
126126

0 commit comments

Comments
 (0)