softPWM question

Status
Not open for further replies.

oric_dan

Well-known member
I've been trying to figure out the code for softPWM, but bogged down a bit. In the following code, "ocr" is not used inside the definition for SOFTPWM_TIMER_INIT(ocr), so you'll get timing very different from what you expect from using SoftPWMBegin(), where it states
.....
SOFTPWM_TIMER_INIT(SOFTPWM_OCR);
.....

Plus, I can nowheres find a definition for "softpwm_interval_timer" after searching all other place in many core and library files. Can someone help explain?

Code:
#elif defined(USE_INTERVALTIMER)
#define SOFTPWM_TIMER_INTERRUPT    softpwm_interval_timer
#ifdef ISR
#undef ISR
#endif
#define ISR(f) void f(void)
#define SOFTPWM_TIMER_SET(val)
#define SOFTPWM_TIMER_INIT(ocr) ({\
  IntervalTimer *t = new IntervalTimer(); \
  t->begin(softpwm_interval_timer, 1000000.0 / (float)(SOFTPWM_FREQ * 256)); \
})
#endif
 
Status
Not open for further replies.
Back
Top