-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
66: Updates for v0.3.x r=ryankurte a=eldruin Fixes #64 Co-authored-by: Diego Barrios Romero <[email protected]>
- Loading branch information
Showing
17 changed files
with
275 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
block_labels = ["needs-decision"] | ||
delete_merged_branches = true | ||
required_approvals = 1 | ||
status = ["continuous-integration/travis-ci/push"] | ||
status = [ | ||
"CI (stable, x86_64-unknown-linux-gnu)", | ||
"CI (stable, armv7-unknown-linux-gnueabihf)", | ||
"CI (1.46.0, x86_64-unknown-linux-gnu)", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
on: | ||
push: | ||
branches: [ staging, trying, master ] | ||
pull_request: | ||
|
||
name: Continuous integration | ||
|
||
jobs: | ||
ci-linux: | ||
name: CI | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
# All generated code should be running on stable now | ||
rust: [stable] | ||
|
||
# The default target we're compiling on and for | ||
TARGET: [x86_64-unknown-linux-gnu, armv7-unknown-linux-gnueabihf] | ||
|
||
include: | ||
# Test MSRV | ||
- rust: 1.46.0 | ||
TARGET: x86_64-unknown-linux-gnu | ||
|
||
# Test nightly but don't fail | ||
- rust: nightly | ||
experimental: true | ||
TARGET: x86_64-unknown-linux-gnu | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: ${{ matrix.rust }} | ||
target: ${{ matrix.TARGET }} | ||
override: true | ||
|
||
- name: Install armv7 libraries | ||
if: ${{ matrix.TARGET == 'armv7-unknown-linux-gnueabihf' }} | ||
run: sudo apt-get install -y libc6-armhf-cross libc6-dev-armhf-cross gcc-arm-linux-gnueabihf | ||
|
||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
args: --target=${{ matrix.TARGET }} | ||
|
||
- uses: actions-rs/cargo@v1 | ||
if: ${{ matrix.TARGET == 'x86_64-unknown-linux-gnu' }} | ||
with: | ||
command: test | ||
args: --target=${{ matrix.TARGET }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
on: | ||
push: | ||
branches: [ staging, trying, master ] | ||
pull_request: | ||
|
||
name: Clippy check | ||
jobs: | ||
clippy_check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: 1.55.0 | ||
override: true | ||
components: clippy | ||
- uses: actions-rs/clippy-check@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
on: | ||
push: | ||
branches: [ staging, trying, master ] | ||
pull_request: | ||
|
||
name: Code formatting check | ||
|
||
jobs: | ||
fmt: | ||
name: Rustfmt | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
components: rustfmt | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: fmt | ||
args: --all -- --check |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
[package] | ||
authors = ["Jorge Aparicio <[email protected]>"] | ||
authors = [ | ||
"Jorge Aparicio <[email protected]>", | ||
"The Embedded Linux Team <[email protected]>", | ||
] | ||
categories = ["embedded", "hardware-support"] | ||
description = "Implementation of the `embedded-hal` traits for Linux devices" | ||
keywords = ["Linux", "hal"] | ||
license = "MIT OR Apache-2.0" | ||
name = "linux-embedded-hal" | ||
repository = "https://github.com/japaric/linux-embedded-hal" | ||
version = "0.3.0" | ||
repository = "https://github.com/rust-embedded/linux-embedded-hal" | ||
version = "0.3.1" | ||
readme = "README.md" | ||
|
||
[features] | ||
gpio_sysfs = ["sysfs_gpio"] | ||
|
@@ -15,15 +19,15 @@ gpio_cdev = ["gpio-cdev"] | |
default = [ "gpio_cdev", "gpio_sysfs" ] | ||
|
||
[dependencies] | ||
embedded-hal = { version = "0.2.3", features = ["unproven"] } | ||
gpio-cdev = { version = "0.3", optional = true } | ||
sysfs_gpio = { version = "0.5", optional = true } | ||
embedded-hal = { version = "0.2.6", features = ["unproven"] } | ||
gpio-cdev = { version = "0.5", optional = true } | ||
sysfs_gpio = { version = "0.6", optional = true } | ||
|
||
i2cdev = "0.4.3" | ||
nb = "0.1.1" | ||
i2cdev = "0.5" | ||
nb = "0.1.3" | ||
serial-core = "0.4.0" | ||
serial-unix = "0.4.0" | ||
spidev = "0.4" | ||
spidev = "0.5" | ||
void = "1" | ||
|
||
[dev-dependencies] | ||
|
@@ -32,4 +36,4 @@ openpty = "0.1.0" | |
[dependencies.cast] | ||
# we don't need the `Error` implementation | ||
default-features = false | ||
version = "0.2.2" | ||
version = "0.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
Copyright (c) 2018 Jorge Aparicio | ||
Copyright (c) 2021 The Rust Embedded Linux Team <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any | ||
person obtaining a copy of this software and associated | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
extern crate embedded_hal; | ||
extern crate linux_embedded_hal; | ||
use embedded_hal::blocking::i2c::{Operation as I2cOperation, Transactional}; | ||
use linux_embedded_hal::I2cdev; | ||
|
||
const ADDR: u8 = 0x12; | ||
|
||
struct Driver<I2C> { | ||
i2c: I2C, | ||
} | ||
|
||
impl<I2C> Driver<I2C> | ||
where | ||
I2C: Transactional, | ||
{ | ||
pub fn new(i2c: I2C) -> Self { | ||
Driver { i2c } | ||
} | ||
|
||
fn read_something(&mut self) -> Result<u8, I2C::Error> { | ||
let mut read_buffer = [0]; | ||
let mut ops = [ | ||
I2cOperation::Write(&[0xAB]), | ||
I2cOperation::Read(&mut read_buffer), | ||
]; | ||
self.i2c.exec(ADDR, &mut ops).and(Ok(read_buffer[0])) | ||
} | ||
} | ||
|
||
fn main() { | ||
let dev = I2cdev::new("/dev/i2c-1").unwrap(); | ||
let mut driver = Driver::new(dev); | ||
let value = driver.read_something().unwrap(); | ||
println!("Read value: {}", value); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.