Skip to content

Commit 5c3bf3e

Browse files
authored
Merge pull request #27 from eldruin/update
Some basic updates
2 parents c22665f + 8b916c5 commit 5c3bf3e

File tree

7 files changed

+80
-96
lines changed

7 files changed

+80
-96
lines changed

.github/workflows/ci.yml

Lines changed: 35 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -19,141 +19,87 @@ jobs:
1919
rust: [stable]
2020
TARGET:
2121
- aarch64-unknown-linux-gnu
22+
- aarch64-unknown-linux-musl
2223
- arm-unknown-linux-gnueabi
24+
# - arm-unknown-linux-gnueabihf # not supported by the CI at the moment
2325
- armv7-unknown-linux-gnueabihf
2426
- i686-unknown-linux-gnu
2527
- i686-unknown-linux-musl
26-
- mips-unknown-linux-gnu
27-
- mips64-unknown-linux-gnuabi64
28-
- mips64el-unknown-linux-gnuabi64
29-
- mipsel-unknown-linux-gnu
28+
# - loongarch64-unknown-linux-gnu
3029
- powerpc-unknown-linux-gnu
3130
# - powerpc64-unknown-linux-gnu
3231
- powerpc64le-unknown-linux-gnu
32+
- riscv64gc-unknown-linux-gnu
3333
- s390x-unknown-linux-gnu
3434
- x86_64-unknown-linux-gnu
3535
- x86_64-unknown-linux-musl
3636

3737
include:
38-
- rust: 1.28.0
39-
TARGET: x86_64-unknown-linux-gnu
40-
4138
# Test nightly but don't fail
4239
- rust: nightly
4340
TARGET: x86_64-unknown-linux-gnu
4441
experimental: true
4542

4643
steps:
47-
- uses: actions/checkout@v2
48-
- uses: actions-rs/toolchain@v1
44+
- uses: actions/checkout@v5
45+
- uses: dtolnay/rust-toolchain@master
4946
with:
50-
profile: minimal
5147
toolchain: ${{ matrix.rust }}
52-
target: ${{ matrix.TARGET }}
53-
override: true
48+
target: ${{ matrix.target }}
5449

55-
- name: Build
56-
uses: actions-rs/cargo@v1
57-
with:
58-
command: build
59-
args: --target=${{ matrix.TARGET }}
50+
- run: cargo build --target=${{ matrix.TARGET }}
6051

6152
- name: Test
62-
uses: actions-rs/cargo@v1
53+
uses: taiki-e/setup-cross-toolchain-action@v1
6354
with:
64-
use-cross: true
65-
command: test
66-
args: --target=${{ matrix.TARGET }}
55+
target: ${{ matrix.TARGET }}
56+
- run: cargo test --target=${{ matrix.TARGET }}
6757

6858
ci-linux-msrv:
69-
name: CI
59+
name: CI-MSRV
7060
runs-on: ubuntu-latest
71-
strategy:
72-
matrix:
73-
rust: [1.28.0]
74-
TARGET:
75-
- x86_64-unknown-linux-gnu
76-
7761
steps:
78-
- uses: actions/checkout@v2
79-
- uses: actions-rs/toolchain@v1
80-
with:
81-
profile: minimal
82-
toolchain: ${{ matrix.rust }}
83-
target: ${{ matrix.TARGET }}
84-
override: true
85-
86-
- name: Build
87-
uses: actions-rs/cargo@v1
88-
with:
89-
command: build
90-
args: --target=${{ matrix.TARGET }}
91-
92-
- name: Test
93-
uses: actions-rs/cargo@v1
94-
with:
95-
use-cross: true
96-
command: test
97-
args: --target=${{ matrix.TARGET }}
62+
- uses: actions/checkout@v5
63+
- uses: dtolnay/rust-toolchain@1.28.0
64+
- run: cargo build
65+
- run: cargo test
9866

9967
ci-macos:
100-
name: CI
101-
runs-on: macos-11
102-
103-
strategy:
104-
matrix:
105-
rust: [stable, 1.28.0]
106-
TARGET: [x86_64-apple-darwin]
68+
name: CI-macOS
69+
runs-on: macos-latest
10770

10871
steps:
109-
- uses: actions/checkout@v2
72+
- uses: actions/checkout@v5
73+
- uses: dtolnay/rust-toolchain@stable
74+
- run: cargo build
11075

111-
- uses: actions-rs/toolchain@v1
112-
with:
113-
profile: minimal
114-
toolchain: ${{ matrix.rust }}
115-
target: ${{ matrix.TARGET }}
116-
override: true
117-
118-
- uses: actions-rs/cargo@v1
119-
with:
120-
command: build
121-
args: --target=${{ matrix.TARGET }}
76+
ci-macos-msrv:
77+
name: CI-macOS-MSRV
78+
runs-on: macos-13 # Latest for Intel-based CPUs
79+
steps:
80+
- uses: actions/checkout@v5
81+
- uses: dtolnay/rust-toolchain@1.28.0
82+
- run: cargo build
12283

12384
checks:
12485
runs-on: ubuntu-latest
12586

12687
steps:
127-
- uses: actions/checkout@v2
128-
- uses: actions-rs/toolchain@v1
88+
- uses: actions/checkout@v5
89+
- uses: dtolnay/rust-toolchain@stable
12990
with:
130-
profile: minimal
131-
toolchain: stable
13291
components: rustfmt
13392

134-
- name: Doc
135-
uses: actions-rs/cargo@v1
136-
with:
137-
command: doc
138-
139-
- name: Formatting
140-
uses: actions-rs/cargo@v1
141-
with:
142-
command: fmt
143-
args: --all -- --check
93+
- run: cargo doc
94+
- run: cargo fmt --all -- --check
14495

14596
clippy:
14697
runs-on: ubuntu-latest
14798
env:
14899
RUSTFLAGS: '--allow warnings'
149100
steps:
150-
- uses: actions/checkout@v2
151-
- uses: actions-rs/toolchain@v1
101+
- uses: actions/checkout@v5
102+
- uses: dtolnay/rust-toolchain@1.91.1
152103
with:
153-
profile: minimal
154-
toolchain: 1.62.0
155104
components: clippy
156-
157-
- uses: actions-rs/clippy-check@v1
158-
with:
159-
token: ${{ secrets.GITHUB_TOKEN }}
105+
- run: cargo clippy --all-targets

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7+
8+
<!-- next-header -->
9+
## [Unreleased] - ReleaseDate
10+
11+
### Added
12+
- Add ability to read capture file descriptor #18
13+
- Add functions for polarity get/set #16
14+
- Add `get_duty_cycle` and `set_duty_cycle` methods #13
15+
- Add getter for checking state of `enable`
16+
17+
### Fixed
18+
- Fix addition of explicit `dyn`
19+
- Handle errors in closure for function `with_exported` #14
20+
21+
### Removed
22+
- Remove implementation of deprecated `Error::description` function
23+
24+
## [0.1.0] - 2016-03-02
25+
26+
- Initial release.
27+
28+
<!-- next-url -->
29+
[Unreleased]: https://github.com/rust-embedded/rust-sysfs-pwm/compare/v0.1.0...HEAD
30+
[0.1.0]: https://github.com/rust-embedded/rust-sysfs-pwm/releases/tag/v0.1.0

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sysfs-pwm"
3-
version = "0.2.0"
3+
version = "0.2.0-alpha.0"
44
authors = [
55
"Rust Embedded WG Linux Team <embedded-linux@teams.rust-embedded.org>",
66
"Paul Osborne <osbpau@gmail.com>"
@@ -17,5 +17,7 @@ which there is an appropriate driver loaded in the kernel.
1717
See https://www.kernel.org/doc/Documentation/pwm.txt
1818
"""
1919
readme = "README.md"
20+
categories = ["embedded", "hardware-support"]
21+
keywords = ["linux", "pwm"]
2022

2123
[dependencies]

LICENSE-MIT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
The MIT License (MIT)
22

3+
Copyright (c) 2025 Rust Embedded WG Linux Team
34
Copyright (c) 2015 Paul Osborne
45

56
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -19,4 +20,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1920
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2021
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2122
SOFTWARE.
22-

README.md

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

87
- [API Documentation](https://docs.rs/sysfs-pwm)
98

release.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pre-release-replacements = [
2+
{file="CHANGELOG.md", search="Unreleased", replace="{{version}}", min=1},
3+
{file="CHANGELOG.md", search="\\.\\.\\.HEAD", replace="...{{tag_name}}", exactly=1},
4+
{file="CHANGELOG.md", search="ReleaseDate", replace="{{date}}", min=1},
5+
{file="CHANGELOG.md", search="<!-- next-header -->", replace="<!-- next-header -->\n## [Unreleased] - ReleaseDate\n", exactly=1},
6+
{file="CHANGELOG.md", search="<!-- next-url -->", replace="<!-- next-url -->\n[Unreleased]: https://github.com/rust-embedded/rust-sysfs-pwm/compare/{{tag_name}}...HEAD", exactly=1},
7+
]

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ fn pwm_capture_parse<T: FromStr>(chip: &PwmChip, pin: u32, name: &str) -> Result
8989

9090
impl PwmChip {
9191
pub fn new(number: u32) -> Result<PwmChip> {
92-
fs::metadata(&format!("/sys/class/pwm/pwmchip{}", number))?;
92+
fs::metadata(format!("/sys/class/pwm/pwmchip{}", number))?;
9393
Ok(PwmChip { number })
9494
}
9595

@@ -109,7 +109,7 @@ impl PwmChip {
109109

110110
pub fn export(&self, number: u32) -> Result<()> {
111111
// only export if not already exported
112-
if fs::metadata(&format!(
112+
if fs::metadata(format!(
113113
"/sys/class/pwm/pwmchip{}/pwm{}",
114114
self.number, number
115115
))
@@ -123,7 +123,7 @@ impl PwmChip {
123123
}
124124

125125
pub fn unexport(&self, number: u32) -> Result<()> {
126-
if fs::metadata(&format!(
126+
if fs::metadata(format!(
127127
"/sys/class/pwm/pwmchip{}/pwm{}",
128128
self.number, number
129129
))
@@ -205,7 +205,7 @@ impl Pwm {
205205
if t.len() == 2 {
206206
Ok((t[0], t[1]))
207207
} else {
208-
Err(error::Error::Unexpected(format!("Failed exporting")))
208+
Err(error::Error::Unexpected("Failed exporting".to_string()))
209209
}
210210
}
211211

0 commit comments

Comments
 (0)