| 65 | */ |
| 66 | |
| 67 | static void *softPwmThread (void *arg) |
| 68 | { |
| 69 | int pin, mark, space ; |
| 70 | struct sched_param param ; |
| 71 | |
| 72 | param.sched_priority = sched_get_priority_max (SCHED_RR) ; |
| 73 | pthread_setschedparam (pthread_self (), SCHED_RR, ¶m) ; |
| 74 | |
| 75 | pin = *((int *)arg) ; |
| 76 | free (arg) ; |
| 77 | |
| 78 | pin = newPin ; |
| 79 | newPin = -1 ; |
| 80 | |
| 81 | piHiPri (90) ; |
| 82 | |
| 83 | for (;;) |
| 84 | { |
| 85 | mark = marks [pin] ; |
| 86 | space = range [pin] - mark ; |
| 87 | |
| 88 | if (mark != 0) |
| 89 | digitalWrite (pin, HIGH) ; |
| 90 | delayMicroseconds (mark * 100) ; |
| 91 | |
| 92 | if (space != 0) |
| 93 | digitalWrite (pin, LOW) ; |
| 94 | delayMicroseconds (space * 100) ; |
| 95 | } |
| 96 | |
| 97 | return NULL ; |
| 98 | } |
| 99 | |
| 100 | |
| 101 | /* |
nothing calls this directly
no test coverage detected