File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
hardware/zpuino/zpu20/cores/zpuino Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,14 @@ namespace ZPUino {
109109
110110 m_intrTimerPtr = tmr;
111111
112- return attachInterrupt (tmr->getInterruptLine (), &timerInterruptHandlerSS, (void *)this );
112+ if (attachInterrupt (tmr->getInterruptLine (), &timerInterruptHandlerSS, (void *)this ))
113+ return -1 ;
114+ if (tmr->setPeriodMilliseconds (msec)<0 ) {
115+ detachInterrupt (tmr->getInterruptLine ());
116+ return -1 ;
117+ }
118+ return 0 ;
119+
113120 }
114121
115122 int Timers_class::singleShot ( int msec, void (*function)(void ))
@@ -126,7 +133,13 @@ namespace ZPUino {
126133
127134 m_intrTimerPtr = tmr;
128135
129- return attachInterrupt (tmr->getInterruptLine (), &timerInterruptHandler, (void *)this );
136+ if (attachInterrupt (tmr->getInterruptLine (), &timerInterruptHandler, (void *)this )<0 )
137+ return -1 ;
138+ if (tmr->setPeriodMilliseconds (msec)<0 ) {
139+ detachInterrupt (tmr->getInterruptLine ());
140+ return -1 ;
141+ }
142+ return 0 ;
130143 }
131144
132145 int Timers_class::periodic ( int msec, bool (*function)(void ) )
You can’t perform that action at this time.
0 commit comments