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

Function wiringPiISRStop

wiringPi/wiringPi.c:2808–2864  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2806 */
2807
2808int wiringPiISRStop(int pin) {
2809
2810 if (wiringPiMode == WPI_MODE_UNINITIALISED) {
2811 return wiringPiFailure(WPI_FATAL, "wiringPiISRStop: wiringPi has not been initialised. Unable to continue.\n");
2812 }
2813 if (!ToBCMPin(&pin)) {
2814 fprintf(stderr, "wiringPiISRStop: wrong pin %d (mode: %d) number!\n", pin, wiringPiMode);
2815 return EINVAL;
2816 }
2817 if (wiringPiDebug) {
2818 printf("wiringPiISRStop: pin %d\n", pin) ;
2819 }
2820
2821 if (isrFds[pin] > 0) {
2822 void *res;
2823
2824 if (wiringPiDebug)
2825 printf("wiringPiISRStop: close thread 0x%lX\n", (unsigned long)isrThreads[pin]);
2826
2827 if (isrThreads[pin] != 0) {
2828 if (pthread_cancel(isrThreads[pin]) == 0) {
2829 pthread_join(isrThreads[pin], &res);
2830 if (res == PTHREAD_CANCELED) {
2831 if (wiringPiDebug)
2832 printf("wiringPiISRStop: thread was canceled\n");
2833 }
2834 else {
2835 if (wiringPiDebug)
2836 printf("wiringPiISRStop: thread was not canceled\n");
2837 }
2838 } else {
2839 if (wiringPiDebug)
2840 printf("wiringPiISRStop: could not cancel thread\n");
2841 }
2842 }
2843 close(isrFds [pin]);
2844 } else {
2845 if (wiringPiDebug)
2846 printf("wiringPiISRStop: Warning stop isr, but its not active\n");
2847 }
2848 isrFds [pin] = -1;
2849 isrFunctions[pin] = NULL;
2850 isrFunctionsV2[pin] = NULL;
2851 isrUserdata[pin] = NULL;;
2852 isrDebouncePeriodUs[pin] = 0;
2853
2854 /* -not closing so far - other isr may be using it - only close if no other is using - will code later
2855 if (chipFd>0) {
2856 close(chipFd);
2857 }
2858 chipFd = -1;
2859 */
2860 if (wiringPiDebug) {
2861 printf("wiringPiISRStop: wiringPiISRStop finished\n");
2862 }
2863 return 0;
2864}
2865

Callers 14

doWfiInternalFunction · 0.85
waitForInterruptCloseFunction · 0.85
TEST_FFunction · 0.85
TEST_FFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
DurationTimeFunction · 0.85
mainFunction · 0.85
DurationTimeFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
DurationTimeFunction · 0.85

Calls 2

wiringPiFailureFunction · 0.85
ToBCMPinFunction · 0.85

Tested by 9

TEST_FFunction · 0.68
TEST_FFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68
DurationTimeFunction · 0.68
mainFunction · 0.68
DurationTimeFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68