MCPcopy Create free account
hub / github.com/WiringPi/WiringPi / CheckGPIO

Function CheckGPIO

wiringPi/test/wpi_test.h:19–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17unsigned int globalError = 0;
18
19void CheckGPIO(int GPIO, int GPIOIN, int out) {
20
21 int in = out;
22 if (GPIOIN>=0) {
23 in = digitalRead(GPIOIN);
24 }
25 int readback = digitalRead(GPIO);
26
27 int pass = 0;
28 if (out==readback && in==out) {
29 pass = 1;
30 }
31
32 if (GPIOIN>=0) {
33 printf("set GPIO%02d = %d (readback %d), in GPIO%02d = %d ", GPIO, out, readback, GPIOIN, in);
34 } else {
35 printf("set GPIO%02d = %d (readback %d) ", GPIO, out, readback);
36 }
37
38 if (pass) {
39 printf("-> %spassed%s\n", COLORGRN, COLORDEF );
40 } else {
41 globalError=1;
42 printf("-> %sfailed%s\n", COLORRED, COLORDEF );
43 }
44}
45
46
47void CheckInversGPIO(int GPIO, int GPIOIN, int out) {

Callers 7

ReadUntilTimeoutFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
CheckInversGPIOFunction · 0.85
digitalWriteExFunction · 0.85
pullUpDnControlExFunction · 0.85

Calls 1

digitalReadFunction · 0.85

Tested by

no test coverage detected