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

Function softPwmThread

wiringPi/softPwm.c:67–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65 */
66
67static 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, &param) ;
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/*

Callers

nothing calls this directly

Calls 3

piHiPriFunction · 0.85
digitalWriteFunction · 0.85
delayMicrosecondsFunction · 0.85

Tested by

no test coverage detected