Skip to content

Commit 687ab98

Browse files
committed
changes for edition 2018
1 parent 86b8c2b commit 687ab98

File tree

6 files changed

+38
-38
lines changed

6 files changed

+38
-38
lines changed

Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
[package]
2-
authors = ["Jorge Aparicio <[email protected]>"]
2+
authors = [
3+
"The Embedded Linux Team <[email protected]>",
4+
"Jorge Aparicio <[email protected]>"
5+
]
36
categories = ["embedded", "hardware-support"]
47
description = "Implementation of the `embedded-hal` traits for Linux devices"
58
keywords = ["Linux", "hal"]
69
license = "MIT OR Apache-2.0"
710
name = "linux-embedded-hal"
8-
repository = "https://github.com/japaric/linux-embedded-hal"
11+
repository = "https://github.com/rust-embedded/linux-embedded-hal"
912
version = "0.3.0"
1013
edition = "2018"
1114

src/cdev_pin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ impl CdevPin {
1515
}
1616
}
1717

18-
impl hal::digital::OutputPin for CdevPin {
18+
impl embedded_hal::digital::OutputPin for CdevPin {
1919
type Error = gpio_cdev::errors::Error;
2020

2121
fn try_set_low(&mut self) -> Result<(), Self::Error> {
@@ -27,7 +27,7 @@ impl hal::digital::OutputPin for CdevPin {
2727
}
2828
}
2929

30-
impl hal::digital::InputPin for CdevPin {
30+
impl embedded_hal::digital::InputPin for CdevPin {
3131
type Error = gpio_cdev::errors::Error;
3232

3333
fn try_is_high(&self) -> Result<bool, Self::Error> {

src/lib.rs

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@
1212
1313
#![deny(missing_docs)]
1414

15-
extern crate cast;
16-
extern crate embedded_hal as hal;
17-
pub extern crate i2cdev;
18-
pub extern crate nb;
19-
pub extern crate serial_core;
20-
pub extern crate serial_unix;
21-
pub extern crate spidev;
15+
use cast;
16+
pub use i2cdev;
17+
pub use nb;
18+
pub use serial_core;
19+
pub use serial_unix;
20+
pub use spidev;
2221

2322
#[cfg(feature = "gpio_sysfs")]
24-
pub extern crate sysfs_gpio;
23+
pub use sysfs_gpio;
2524

2625
#[cfg(feature = "gpio_cdev")]
27-
pub extern crate gpio_cdev;
26+
pub use gpio_cdev;
27+
2828

2929
use core::convert::Infallible;
3030
use std::io::{self, Write};
@@ -61,7 +61,7 @@ pub use sysfs_pin::SysfsPin;
6161
/// Empty struct that provides delay functionality on top of `thread::sleep`
6262
pub struct Delay;
6363

64-
impl hal::blocking::delay::DelayUs<u8> for Delay {
64+
impl embedded_hal::blocking::delay::DelayUs<u8> for Delay {
6565
type Error = Infallible;
6666

6767
fn try_delay_us(&mut self, n: u8) -> Result<(), Self::Error> {
@@ -70,7 +70,7 @@ impl hal::blocking::delay::DelayUs<u8> for Delay {
7070
}
7171
}
7272

73-
impl hal::blocking::delay::DelayUs<u16> for Delay {
73+
impl embedded_hal::blocking::delay::DelayUs<u16> for Delay {
7474
type Error = Infallible;
7575

7676
fn try_delay_us(&mut self, n: u16) -> Result<(), Self::Error> {
@@ -79,7 +79,7 @@ impl hal::blocking::delay::DelayUs<u16> for Delay {
7979
}
8080
}
8181

82-
impl hal::blocking::delay::DelayUs<u32> for Delay {
82+
impl embedded_hal::blocking::delay::DelayUs<u32> for Delay {
8383
type Error = Infallible;
8484

8585
fn try_delay_us(&mut self, n: u32) -> Result<(), Self::Error> {
@@ -91,7 +91,7 @@ impl hal::blocking::delay::DelayUs<u32> for Delay {
9191
}
9292
}
9393

94-
impl hal::blocking::delay::DelayUs<u64> for Delay {
94+
impl embedded_hal::blocking::delay::DelayUs<u64> for Delay {
9595
type Error = Infallible;
9696

9797
fn try_delay_us(&mut self, n: u64) -> Result<(), Self::Error> {
@@ -103,7 +103,7 @@ impl hal::blocking::delay::DelayUs<u64> for Delay {
103103
}
104104
}
105105

106-
impl hal::blocking::delay::DelayMs<u8> for Delay {
106+
impl embedded_hal::blocking::delay::DelayMs<u8> for Delay {
107107
type Error = Infallible;
108108

109109
fn try_delay_ms(&mut self, n: u8) -> Result<(), Self::Error> {
@@ -112,7 +112,7 @@ impl hal::blocking::delay::DelayMs<u8> for Delay {
112112
}
113113
}
114114

115-
impl hal::blocking::delay::DelayMs<u16> for Delay {
115+
impl embedded_hal::blocking::delay::DelayMs<u16> for Delay {
116116
type Error = Infallible;
117117

118118
fn try_delay_ms(&mut self, n: u16) -> Result<(), Self::Error> {
@@ -121,7 +121,7 @@ impl hal::blocking::delay::DelayMs<u16> for Delay {
121121
}
122122
}
123123

124-
impl hal::blocking::delay::DelayMs<u32> for Delay {
124+
impl embedded_hal::blocking::delay::DelayMs<u32> for Delay {
125125
type Error = Infallible;
126126

127127
fn try_delay_ms(&mut self, n: u32) -> Result<(), Self::Error> {
@@ -130,7 +130,7 @@ impl hal::blocking::delay::DelayMs<u32> for Delay {
130130
}
131131
}
132132

133-
impl hal::blocking::delay::DelayMs<u64> for Delay {
133+
impl embedded_hal::blocking::delay::DelayMs<u64> for Delay {
134134
type Error = Infallible;
135135

136136
fn try_delay_ms(&mut self, n: u64) -> Result<(), Self::Error> {
@@ -173,7 +173,7 @@ impl I2cdev {
173173
}
174174
}
175175

176-
impl hal::blocking::i2c::Read for I2cdev {
176+
impl embedded_hal::blocking::i2c::Read for I2cdev {
177177
type Error = i2cdev::linux::LinuxI2CError;
178178

179179
fn try_read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error> {
@@ -182,7 +182,7 @@ impl hal::blocking::i2c::Read for I2cdev {
182182
}
183183
}
184184

185-
impl hal::blocking::i2c::Write for I2cdev {
185+
impl embedded_hal::blocking::i2c::Write for I2cdev {
186186
type Error = i2cdev::linux::LinuxI2CError;
187187

188188
fn try_write(&mut self, address: u8, bytes: &[u8]) -> Result<(), Self::Error> {
@@ -191,7 +191,7 @@ impl hal::blocking::i2c::Write for I2cdev {
191191
}
192192
}
193193

194-
impl hal::blocking::i2c::WriteRead for I2cdev {
194+
impl embedded_hal::blocking::i2c::WriteRead for I2cdev {
195195
type Error = i2cdev::linux::LinuxI2CError;
196196

197197
fn try_write_read(
@@ -240,7 +240,7 @@ impl Spidev {
240240
}
241241
}
242242

243-
impl hal::blocking::spi::Transfer<u8> for Spidev {
243+
impl embedded_hal::blocking::spi::Transfer<u8> for Spidev {
244244
type Error = io::Error;
245245

246246
fn try_transfer<'b>(&mut self, buffer: &'b mut [u8]) -> io::Result<&'b [u8]> {
@@ -251,18 +251,18 @@ impl hal::blocking::spi::Transfer<u8> for Spidev {
251251
}
252252
}
253253

254-
impl hal::blocking::spi::Write<u8> for Spidev {
254+
impl embedded_hal::blocking::spi::Write<u8> for Spidev {
255255
type Error = io::Error;
256256

257257
fn try_write(&mut self, buffer: &[u8]) -> io::Result<()> {
258258
self.0.write_all(buffer)
259259
}
260260
}
261261

262-
pub use hal::blocking::spi::{Operation as SpiOperation};
262+
pub use embedded_hal::blocking::spi::{Operation as SpiOperation};
263263

264264
/// Transactional implementation batches SPI operations into a single transaction
265-
impl hal::blocking::spi::Transactional<u8> for Spidev {
265+
impl embedded_hal::blocking::spi::Transactional<u8> for Spidev {
266266
type Error = io::Error;
267267

268268
fn try_exec<'a>(&mut self, operations: &mut [SpiOperation<'a, u8>]) -> Result<(), Self::Error> {
@@ -285,9 +285,7 @@ impl hal::blocking::spi::Transactional<u8> for Spidev {
285285
}).collect();
286286

287287
// Execute transfer
288-
self.0.transfer_multiple(&mut messages)?;
289-
290-
Ok(())
288+
self.0.transfer_multiple(&mut messages)
291289
}
292290
}
293291

src/serial.rs

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

66
use nb;
77

8-
use hal;
98
use serial_core;
109
use serial_unix::TTYPort;
1110

@@ -30,7 +29,7 @@ fn translate_io_errors(err: std::io::Error) -> nb::Error<IoErrorKind> {
3029
}
3130
}
3231

33-
impl hal::serial::Read<u8> for Serial {
32+
impl embedded_hal::serial::Read<u8> for Serial {
3433
type Error = IoErrorKind;
3534

3635
fn try_read(&mut self) -> nb::Result<u8, Self::Error> {
@@ -44,7 +43,7 @@ impl hal::serial::Read<u8> for Serial {
4443
}
4544
}
4645

47-
impl hal::serial::Write<u8> for Serial {
46+
impl embedded_hal::serial::Write<u8> for Serial {
4847
type Error = IoErrorKind;
4948

5049
fn try_write(&mut self, word: u8) -> nb::Result<(), Self::Error> {
@@ -61,7 +60,7 @@ impl hal::serial::Write<u8> for Serial {
6160
mod test {
6261
use std::path::Path;
6362

64-
use hal::serial::{Read, Write};
63+
use embedded_hal::serial::{Read, Write};
6564
use std::io::{Read as IoRead, Write as IoWrite};
6665

6766
use super::*;

src/sysfs_pin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl SysfsPin {
2626
}
2727
}
2828

29-
impl hal::digital::OutputPin for SysfsPin {
29+
impl embedded_hal::digital::OutputPin for SysfsPin {
3030
type Error = sysfs_gpio::Error;
3131

3232
fn try_set_low(&mut self) -> Result<(), Self::Error> {
@@ -38,7 +38,7 @@ impl hal::digital::OutputPin for SysfsPin {
3838
}
3939
}
4040

41-
impl hal::digital::InputPin for SysfsPin {
41+
impl embedded_hal::digital::InputPin for SysfsPin {
4242
type Error = sysfs_gpio::Error;
4343

4444
fn try_is_high(&self) -> Result<bool, Self::Error> {

src/timer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use core::convert::Infallible;
44
use std::time::{Duration, Instant};
55

6-
use hal::timer::{CountDown, Periodic};
6+
use embedded_hal::timer::{CountDown, Periodic};
77

88
/// A periodic timer based on [`std::time::Instant`][instant], which is a
99
/// monotonically nondecreasing clock.

0 commit comments

Comments
 (0)