diff --git a/gpio/gpio.c b/gpio/gpio.c index 2f6b683..a420cd3 100644 --- a/gpio/gpio.c +++ b/gpio/gpio.c @@ -972,7 +972,7 @@ static void doVersion (char *argv []) static void doIs40Pin () { - exit(piBoard40Pin()); + exit(piBoard40Pin() ? EXIT_SUCCESS : EXIT_FAILURE); } /* diff --git a/gpio/test/gpio_test6_wfi.sh b/gpio/test/gpio_test6_wfi.sh index 89f37e0..5a0d6af 100755 --- a/gpio/test/gpio_test6_wfi.sh +++ b/gpio/test/gpio_test6_wfi.sh @@ -110,11 +110,15 @@ wfis_test() { fi } +gpio is40pin || { GPIOIN=17; GPIOOUT=18; echo "old 28 pin system"; } + + echo echo Unit test gpio GPIO${GPIOOUT} and GPIO${GPIOIN} - functions: mode, write, wfi echo ------------------------------------------------------------------ echo + #prepare trigger out gpio -g mode $GPIOOUT out diff --git a/wiringPi/test/wiringpi_test61_isr2.c b/wiringPi/test/wiringpi_test61_isr2.c index 9c37cc0..e0d21f5 100644 --- a/wiringPi/test/wiringpi_test61_isr2.c +++ b/wiringPi/test/wiringpi_test61_isr2.c @@ -12,7 +12,7 @@ int GPIO = 19; int GPIOIN = 26; const int ToggleValue = 4; float irq_timstamp_duration_ms = 0; -float accuracy = 0.012; +float accuracy = 0.015; float bounce_acc = 1.0; static volatile int globalCounter; diff --git a/wiringPi/test/wiringpi_test62_isr_wpin.c b/wiringPi/test/wiringpi_test62_isr_wpin.c index 7447c35..00a599a 100644 --- a/wiringPi/test/wiringpi_test62_isr_wpin.c +++ b/wiringPi/test/wiringpi_test62_isr_wpin.c @@ -79,35 +79,41 @@ int main (void) { int IRQpin = GPIOIN; int OUTpin = GPIO; - if (RaspberryPiModel==PI_MODEL_4B) { - pinMode(IRQpin, INPUT); - pinMode(OUTpin, OUTPUT); - digitalWrite (OUTpin, LOW) ; - - printf("\nTesting IRQ @ WPI-GPIO%d with trigger @ WPI-GPIO%d rising\n", IRQpin, OUTpin); - CheckSame("wiringPiISR", wiringPiISR(IRQpin, INT_EDGE_RISING, &wfiup), 0); - sleep(1); - StartSequence(INT_EDGE_RISING, OUTpin, 3 , 3); - sleep(1); - CheckSame("wiringPiISRStop", wiringPiISRStop(IRQpin), 0); - printf("\n.IRQ off\n"); - sleep(1); - StartSequence(INT_EDGE_RISING, OUTpin, 2, 0); + switch(RaspberryPiModel) { + case PI_MODEL_4B: + case PI_MODEL_5: + pinMode(IRQpin, INPUT); + pinMode(OUTpin, OUTPUT); + digitalWrite (OUTpin, LOW) ; - printf("\nTesting IRQ @ WPI-GPIO%d with trigger @ WPI-GPIO%d falling\n", IRQpin, OUTpin); - CheckSame("wiringPiISR", wiringPiISR(IRQpin, INT_EDGE_RISING, &wfidown), 0); - sleep(1); - StartSequence(INT_EDGE_FALLING, OUTpin, 4, -4); - sleep(1); - CheckSame("wiringPiISRStop", wiringPiISRStop(IRQpin), 0); - printf("\n.IRQ off\n"); - sleep(1); - StartSequence(INT_EDGE_RISING, OUTpin, 2, 0); + printf("\nTesting IRQ @ WPI-GPIO%d with trigger @ WPI-GPIO%d rising\n", IRQpin, OUTpin); + CheckSame("wiringPiISR", wiringPiISR(IRQpin, INT_EDGE_RISING, &wfiup), 0); + sleep(1); + StartSequence(INT_EDGE_RISING, OUTpin, 3 , 3); + sleep(1); + CheckSame("wiringPiISRStop", wiringPiISRStop(IRQpin), 0); + printf("\n.IRQ off\n"); + sleep(1); + StartSequence(INT_EDGE_RISING, OUTpin, 2, 0); - printf("Error check - next call must be wrong!\n"); - CheckSame("wiringPiISRStop with wrong pin, result code:", wiringPiISRStop(5555), EINVAL); + printf("\nTesting IRQ @ WPI-GPIO%d with trigger @ WPI-GPIO%d falling\n", IRQpin, OUTpin); + CheckSame("wiringPiISR", wiringPiISR(IRQpin, INT_EDGE_RISING, &wfidown), 0); + sleep(1); + StartSequence(INT_EDGE_FALLING, OUTpin, 4, -4); + sleep(1); + CheckSame("wiringPiISRStop", wiringPiISRStop(IRQpin), 0); + printf("\n.IRQ off\n"); + sleep(1); + StartSequence(INT_EDGE_RISING, OUTpin, 2, 0); - pinMode(OUTpin, INPUT); + printf("Error check - next call must be wrong!\n"); + CheckSame("wiringPiISRStop with wrong pin, result code:", wiringPiISRStop(5555), EINVAL); + + pinMode(OUTpin, INPUT); + break; + default: + printf("unit test not possible with this hardware, need connection between Wiringpi pin 28 and 29!\n"); + break; } return UnitTestState();