From b8510b636407bdc0ed8abe77cdaf00a35dce3f94 Mon Sep 17 00:00:00 2001 From: Rex Magana Date: Wed, 16 Jul 2025 13:26:05 -0700 Subject: [PATCH 1/7] Add `cargo check` workflow --- .github/workflows/check.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/check.yml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..dac6e37 --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,24 @@ +name: Cargo Check + +on: + push: + branches: [ master, main ] + pull_request: + branches: [ master, main ] + +env: + RUST_BACKTRACE: 1 + +jobs: + check: + name: Cargo Check + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + + - name: Run cargo check + run: cargo check --all-features \ No newline at end of file From 99d99fdea3da25a594fe02561aa4a2ea213e8d0e Mon Sep 17 00:00:00 2001 From: Rex Magana Date: Thu, 17 Jul 2025 07:23:38 -0700 Subject: [PATCH 2/7] add all targets --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index dac6e37..cc4decf 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -21,4 +21,4 @@ jobs: uses: dtolnay/rust-toolchain@stable - name: Run cargo check - run: cargo check --all-features \ No newline at end of file + run: cargo check --all-targets --all-features \ No newline at end of file From 6b1b15923567223e66b98f0a253342c7df91e255 Mon Sep 17 00:00:00 2001 From: Rex Magana Date: Thu, 17 Jul 2025 07:26:24 -0700 Subject: [PATCH 3/7] attempt resolve build issues --- examples/jogcon.rs | 4 +--- src/lib.rs | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/jogcon.rs b/examples/jogcon.rs index 01fa0d6..061cd14 100755 --- a/examples/jogcon.rs +++ b/examples/jogcon.rs @@ -5,8 +5,6 @@ //! are represented and you can send them with square, triangle, //! circle, left, up, and right. -#![feature(duration_from_micros)] - extern crate embedded_hal; extern crate linux_embedded_hal as linux_hal; extern crate pscontroller_rs; @@ -56,7 +54,7 @@ fn main() { // We only care about the JogCon here so skip everything else let jogcon = match controller { - Device::JogCon(x) => (x), + Device::JogCon(x) => x, _ => continue, }; diff --git a/src/lib.rs b/src/lib.rs index ad885e4..1fdb716 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -500,6 +500,8 @@ where } mod tests { + use super::ControllerData; + #[test] fn union_test() { // Again, buttons are active low, hence 'fe' and '7f' From 94125fd7a6ff0464d03a8d068d212f7d62936652 Mon Sep 17 00:00:00 2001 From: Rex Magana Date: Thu, 17 Jul 2025 07:28:22 -0700 Subject: [PATCH 4/7] fix sizing of array --- src/lib.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 1fdb716..8969d31 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -499,15 +499,21 @@ where } } +#[cfg(test)] mod tests { use super::ControllerData; #[test] fn union_test() { // Again, buttons are active low, hence 'fe' and '7f' - let controller = ControllerData { - data: [0xfe, 0x7f, 0x00, 0x00, 0x00, 0xff], - }; + let mut data = [0u8; 32]; + data[0] = 0xfe; + data[1] = 0x7f; + data[2] = 0x00; + data[3] = 0x00; + data[4] = 0x00; + data[5] = 0xff; + let controller = ControllerData { data }; unsafe { assert!(controller.ds.buttons.select() == true); From 9b9bc5ede56be523d01b4c133cdc353615231cf6 Mon Sep 17 00:00:00 2001 From: Rex Magana Date: Thu, 17 Jul 2025 07:29:12 -0700 Subject: [PATCH 5/7] fmt --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 8969d31..cf93db2 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -502,7 +502,7 @@ where #[cfg(test)] mod tests { use super::ControllerData; - + #[test] fn union_test() { // Again, buttons are active low, hence 'fe' and '7f' From 6d5f659a9c267ec6a4a5553c289d3160e8e7703e Mon Sep 17 00:00:00 2001 From: Rex Magana Date: Thu, 17 Jul 2025 09:10:54 -0700 Subject: [PATCH 6/7] use constant --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index cf93db2..c3d958f 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -506,7 +506,7 @@ mod tests { #[test] fn union_test() { // Again, buttons are active low, hence 'fe' and '7f' - let mut data = [0u8; 32]; + let mut data = [0u8; MESSAGE_MAX_LENGTH]; data[0] = 0xfe; data[1] = 0x7f; data[2] = 0x00; From f0bd98ccac594c9d139603082e34b4ebbaa2e022 Mon Sep 17 00:00:00 2001 From: Rex Magana Date: Thu, 17 Jul 2025 09:11:49 -0700 Subject: [PATCH 7/7] add import --- src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib.rs b/src/lib.rs index c3d958f..b752dbf 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -502,6 +502,7 @@ where #[cfg(test)] mod tests { use super::ControllerData; + use super::MESSAGE_MAX_LENGTH; #[test] fn union_test() {