Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPIO V2 API changes #944

Closed
wants to merge 6 commits into from
Closed

GPIO V2 API changes #944

wants to merge 6 commits into from

Conversation

TMRh20
Copy link
Member

@TMRh20 TMRh20 commented Feb 19, 2024

Update to v2 API re #942 #943

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cpp-linter Review

Click here for the full clang-format patch
diff --git a/utility/SPIDEV/gpio.cpp b/utility/SPIDEV/gpio.cpp
index 6da8d99..792e19b 100644
--- a/utility/SPIDEV/gpio.cpp
+++ b/utility/SPIDEV/gpio.cpp
@@ -80 +80 @@ void GPIO::write(int port, int value)
-    memset(&rq, 0, sizeof(rq));       // This is needed to set to default values apparently
+    memset(&rq, 0, sizeof(rq)); // This is needed to set to default values apparently
@@ -82 +82 @@ void GPIO::write(int port, int value)
-    
+
@@ -92 +92 @@ void GPIO::write(int port, int value)
-    
+
@@ -99 +99 @@ void GPIO::write(int port, int value)
-    
+
@@ -102 +102 @@ void GPIO::write(int port, int value)
-    
+

Have any feedback or feature suggestions? Share it here.

utility/SPIDEV/gpio.cpp Outdated Show resolved Hide resolved
utility/SPIDEV/gpio.cpp Outdated Show resolved Hide resolved
utility/SPIDEV/gpio.cpp Outdated Show resolved Hide resolved
utility/SPIDEV/gpio.cpp Outdated Show resolved Hide resolved
utility/SPIDEV/gpio.cpp Outdated Show resolved Hide resolved
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions github-actions bot dismissed their stale review February 19, 2024 02:58

outdated suggestion

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cpp-linter Review

Click here for the full clang-format patch
diff --git a/utility/SPIDEV/gpio.cpp b/utility/SPIDEV/gpio.cpp
index 471144b..6bb6e54 100644
--- a/utility/SPIDEV/gpio.cpp
+++ b/utility/SPIDEV/gpio.cpp
@@ -80 +80 @@ void GPIO::write(int port, int value)
-    memset(&rq, 0, sizeof(rq));       // This is needed to set to default values apparently
+    memset(&rq, 0, sizeof(rq)); // This is needed to set to default values apparently
@@ -82 +82 @@ void GPIO::write(int port, int value)
-    
+
@@ -92 +92 @@ void GPIO::write(int port, int value)
-    
+
@@ -99 +99 @@ void GPIO::write(int port, int value)
-    
+

Have any feedback or feature suggestions? Share it here.

utility/SPIDEV/gpio.cpp Outdated Show resolved Hide resolved
utility/SPIDEV/gpio.cpp Outdated Show resolved Hide resolved
utility/SPIDEV/gpio.cpp Outdated Show resolved Hide resolved
utility/SPIDEV/gpio.cpp Outdated Show resolved Hide resolved
@github-actions github-actions bot dismissed their stale review February 19, 2024 03:00

outdated suggestion

@TMRh20
Copy link
Member Author

TMRh20 commented Feb 19, 2024

This one can wait a little bit for testing etc, but it seems to work fine, only some minor changes to the v1 API code

@TMRh20
Copy link
Member Author

TMRh20 commented Feb 19, 2024

Oh I see you already did a better job of this in another branch @2bndy5 ... LOL

@TMRh20 TMRh20 closed this Feb 19, 2024
@2bndy5
Copy link
Member

2bndy5 commented Feb 19, 2024

Yes but it doesn't work. The request type and/or struct passed to ioctl() is malformed somehow.

@TMRh20
Copy link
Member Author

TMRh20 commented Feb 19, 2024

Did you get it working with the memset(); call? Seems to be very little difference from mine and it works here.

@2bndy5
Copy link
Member

2bndy5 commented Feb 19, 2024

ok, well I took some pointers from this branch and got mine working. But I really think we should cache the FD for both chip and used gpio lines.

My RPi4 runs slightly slower with the new GPIO changes
Transmission successful! Time to transmit = 617 us. Sent: 0.14
Transmission successful! Time to transmit = 570 us. Sent: 0.15
Transmission successful! Time to transmit = 567 us. Sent: 0.16
Transmission successful! Time to transmit = 561 us. Sent: 0.17
Transmission successful! Time to transmit = 612 us. Sent: 0.18
Transmission successful! Time to transmit = 557 us. Sent: 0.19
Transmission successful! Time to transmit = 561 us. Sent: 0.2
Transmission successful! Time to transmit = 568 us. Sent: 0.21
Transmission successful! Time to transmit = 558 us. Sent: 0.22
Transmission successful! Time to transmit = 554 us. Sent: 0.23
Transmission successful! Time to transmit = 562 us. Sent: 0.24
Transmission successful! Time to transmit = 554 us. Sent: 0.25
Transmission successful! Time to transmit = 561 us. Sent: 0.26
compared to to my RPi3 using v1.4.8 (without new gpio changes)
Transmission successful! Time to transmit = 532 us. Sent: 0
Transmission successful! Time to transmit = 556 us. Sent: 0.01
Transmission successful! Time to transmit = 536 us. Sent: 0.02
Transmission successful! Time to transmit = 536 us. Sent: 0.03
Transmission successful! Time to transmit = 523 us. Sent: 0.04
Transmission successful! Time to transmit = 520 us. Sent: 0.05
Transmission successful! Time to transmit = 554 us. Sent: 0.06
Transmission successful! Time to transmit = 547 us. Sent: 0.07
Transmission successful! Time to transmit = 538 us. Sent: 0.08
Transmission successful! Time to transmit = 526 us. Sent: 0.09
Transmission successful! Time to transmit = 531 us. Sent: 0.1
Transmission successful! Time to transmit = 537 us. Sent: 0.11
Transmission successful! Time to transmit = 545 us. Sent: 0.12
Transmission successful! Time to transmit = 539 us. Sent: 0.13
Transmission successful! Time to transmit = 525 us. Sent: 0.14
Its worse on my RPi3 using the new GPIO changes
Transmission successful! Time to transmit = 583 us. Sent: 0
Transmission successful! Time to transmit = 612 us. Sent: 0.01
Transmission successful! Time to transmit = 592 us. Sent: 0.02
Transmission successful! Time to transmit = 600 us. Sent: 0.03
Transmission successful! Time to transmit = 602 us. Sent: 0.04
Transmission successful! Time to transmit = 596 us. Sent: 0.05
Transmission successful! Time to transmit = 612 us. Sent: 0.06
Transmission successful! Time to transmit = 650 us. Sent: 0.07

@2bndy5 2bndy5 deleted the GPIO_ChangesV2 branch March 13, 2024 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants