| 17 | unsigned int globalError = 0; |
| 18 | |
| 19 | void 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 | |
| 47 | void CheckInversGPIO(int GPIO, int GPIOIN, int out) { |
no test coverage detected