File tree 1 file changed +15
-2
lines changed
hardware/zpuino/zpu20/cores/zpuino
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,14 @@ namespace ZPUino {
109
109
110
110
m_intrTimerPtr = tmr;
111
111
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
+
113
120
}
114
121
115
122
int Timers_class::singleShot ( int msec, void (*function)(void ))
@@ -126,7 +133,13 @@ namespace ZPUino {
126
133
127
134
m_intrTimerPtr = tmr;
128
135
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 ;
130
143
}
131
144
132
145
int Timers_class::periodic ( int msec, bool (*function)(void ) )
You can’t perform that action at this time.
0 commit comments