|
@@ -58,9 +58,9 @@ typedef uint16_t hal_timer_t;
|
58
|
58
|
#define DISABLE_STEPPER_DRIVER_INTERRUPT() CBI(TIMSK1, OCIE1A)
|
59
|
59
|
#define STEPPER_ISR_ENABLED() TEST(TIMSK1, OCIE1A)
|
60
|
60
|
|
61
|
|
-#define ENABLE_TEMPERATURE_INTERRUPT() SBI(TIMSK0, OCIE0B)
|
62
|
|
-#define DISABLE_TEMPERATURE_INTERRUPT() CBI(TIMSK0, OCIE0B)
|
63
|
|
-#define TEMPERATURE_ISR_ENABLED() TEST(TIMSK0, OCIE0B)
|
|
61
|
+#define ENABLE_TEMPERATURE_INTERRUPT() SBI(TIMSK0, OCIE0A)
|
|
62
|
+#define DISABLE_TEMPERATURE_INTERRUPT() CBI(TIMSK0, OCIE0A)
|
|
63
|
+#define TEMPERATURE_ISR_ENABLED() TEST(TIMSK0, OCIE0A)
|
64
|
64
|
|
65
|
65
|
FORCE_INLINE void HAL_timer_start(const uint8_t timer_num, const uint32_t) {
|
66
|
66
|
switch (timer_num) {
|
|
@@ -87,7 +87,7 @@ FORCE_INLINE void HAL_timer_start(const uint8_t timer_num, const uint32_t) {
|
87
|
87
|
case MF_TIMER_TEMP:
|
88
|
88
|
// Use timer0 for temperature measurement
|
89
|
89
|
// Interleave temperature interrupt with millies interrupt
|
90
|
|
- OCR0B = 128;
|
|
90
|
+ OCR0A = 128;
|
91
|
91
|
break;
|
92
|
92
|
}
|
93
|
93
|
}
|
|
@@ -180,7 +180,7 @@ void TIMER1_COMPA_vect() { \
|
180
|
180
|
: \
|
181
|
181
|
: [timsk0] "i" ((uint16_t)&TIMSK0), \
|
182
|
182
|
[timsk1] "i" ((uint16_t)&TIMSK1), \
|
183
|
|
- [msk0] "M" ((uint8_t)(1<<OCIE0B)),\
|
|
183
|
+ [msk0] "M" ((uint8_t)(1<<OCIE0A)),\
|
184
|
184
|
[msk1] "M" ((uint8_t)(1<<OCIE1A)) \
|
185
|
185
|
: \
|
186
|
186
|
); \
|
|
@@ -193,9 +193,9 @@ void TIMER1_COMPA_vect_bottom()
|
193
|
193
|
|
194
|
194
|
/* 14 cycles maximum latency */
|
195
|
195
|
#define HAL_TEMP_TIMER_ISR() \
|
196
|
|
-extern "C" void TIMER0_COMPB_vect() __attribute__ ((signal, naked, used, externally_visible)); \
|
197
|
|
-extern "C" void TIMER0_COMPB_vect_bottom() asm ("TIMER0_COMPB_vect_bottom") __attribute__ ((used, externally_visible, noinline)); \
|
198
|
|
-void TIMER0_COMPB_vect() { \
|
|
196
|
+extern "C" void TIMER0_COMPA_vect() __attribute__ ((signal, naked, used, externally_visible)); \
|
|
197
|
+extern "C" void TIMER0_COMPA_vect_bottom() asm ("TIMER0_COMPA_vect_bottom") __attribute__ ((used, externally_visible, noinline)); \
|
|
198
|
+void TIMER0_COMPA_vect() { \
|
199
|
199
|
__asm__ __volatile__ ( \
|
200
|
200
|
A("push r16") /* 2 Save R16 */ \
|
201
|
201
|
A("in r16, __SREG__") /* 1 Get SREG */ \
|
|
@@ -223,7 +223,7 @@ void TIMER0_COMPB_vect() { \
|
223
|
223
|
A("push r30") \
|
224
|
224
|
A("push r31") \
|
225
|
225
|
A("clr r1") /* C runtime expects this register to be 0 */ \
|
226
|
|
- A("call TIMER0_COMPB_vect_bottom") /* Call the bottom handler - No inlining allowed, otherwise registers used are not saved */ \
|
|
226
|
+ A("call TIMER0_COMPA_vect_bottom") /* Call the bottom handler - No inlining allowed, otherwise registers used are not saved */ \
|
227
|
227
|
A("pop r31") \
|
228
|
228
|
A("pop r30") \
|
229
|
229
|
A("pop r27") \
|
|
@@ -251,10 +251,10 @@ void TIMER0_COMPB_vect() { \
|
251
|
251
|
A("reti") /* 4 Return from interrupt */ \
|
252
|
252
|
: \
|
253
|
253
|
: [timsk0] "i"((uint16_t)&TIMSK0), \
|
254
|
|
- [msk0] "M" ((uint8_t)(1<<OCIE0B)) \
|
|
254
|
+ [msk0] "M" ((uint8_t)(1<<OCIE0A)) \
|
255
|
255
|
: \
|
256
|
256
|
); \
|
257
|
257
|
} \
|
258
|
|
-void TIMER0_COMPB_vect_bottom()
|
|
258
|
+void TIMER0_COMPA_vect_bottom()
|
259
|
259
|
|
260
|
260
|
#endif // HAL_TEMP_TIMER_ISR
|