| 108 | */ |
| 109 | |
| 110 | int softToneCreate (int pin) |
| 111 | { |
| 112 | int res ; |
| 113 | pthread_t myThread ; |
| 114 | |
| 115 | pinMode (pin, OUTPUT) ; |
| 116 | digitalWrite (pin, LOW) ; |
| 117 | |
| 118 | if (threads [pin] != 0) |
| 119 | return -1 ; |
| 120 | |
| 121 | freqs [pin] = 0 ; |
| 122 | |
| 123 | newPin = pin ; |
| 124 | res = pthread_create (&myThread, NULL, softToneThread, NULL) ; |
| 125 | |
| 126 | while (newPin != -1) |
| 127 | delay (1) ; |
| 128 | |
| 129 | threads [pin] = myThread ; |
| 130 | |
| 131 | return res ; |
| 132 | } |
| 133 | |
| 134 | |
| 135 | /* |
no test coverage detected