Fix Timer_test broken by conditional translation for SYSTEM_TIMER_2.

This commit is contained in:
Marek Bel 2019-01-28 19:29:31 +01:00
parent 1b4e49b5ac
commit 6d2358125a
5 changed files with 30 additions and 20 deletions

View File

@ -16,24 +16,7 @@
#include <avr/pgmspace.h> #include <avr/pgmspace.h>
#include <avr/eeprom.h> #include <avr/eeprom.h>
#include <avr/interrupt.h> #include <avr/interrupt.h>
#include "system_timer.h"
#define SYSTEM_TIMER_2
#ifdef SYSTEM_TIMER_2
#include "timer02.h"
#define _millis millis2
#define _micros micros2
#define _delay delay2
#else //SYSTEM_TIMER_2
#define _millis millis
#define _micros micros
#define _delay delay
#define timer02_set_pwm0(pwm0)
#endif //SYSTEM_TIMER_2
#include "fastio.h" #include "fastio.h"
#include "Configuration.h" #include "Configuration.h"
#include "pins.h" #include "pins.h"

View File

@ -4,7 +4,7 @@
*/ */
#include "Timer.h" #include "Timer.h"
#include "Marlin.h" #include "system_timer.h"
/** /**
* @brief construct Timer * @brief construct Timer

View File

@ -7,7 +7,8 @@
#define TIMERREMAINING_H #define TIMERREMAINING_H
#include "Timer.h" #include "Timer.h"
#include "Marlin.h" #include "Arduino.h"
#include "system_timer.h"
#include <limits.h> #include <limits.h>
class TimerRemaining : public LongTimer class TimerRemaining : public LongTimer

21
Firmware/system_timer.h Normal file
View File

@ -0,0 +1,21 @@
//! @file
#ifndef FIRMWARE_SYSTEM_TIMER_H_
#define FIRMWARE_SYSTEM_TIMER_H_
#include "Arduino.h"
#define SYSTEM_TIMER_2
#ifdef SYSTEM_TIMER_2
#include "timer02.h"
#define _millis millis2
#define _micros micros2
#define _delay delay2
#else //SYSTEM_TIMER_2
#define _millis millis
#define _micros micros
#define _delay delay
#define timer02_set_pwm0(pwm0)
#endif //SYSTEM_TIMER_2
#endif /* FIRMWARE_SYSTEM_TIMER_H_ */

View File

@ -15,6 +15,11 @@ unsigned long millis()
return now; return now;
} }
unsigned long millis2()
{
return now;
}
static void basicTimer() static void basicTimer()
{ {
LongTimer timer; LongTimer timer;