Low res (1ms) timer enabled for Teensy
This commit is contained in:
parent
7e6f102a5a
commit
241314e42d
|
@ -147,7 +147,7 @@ struct statuses {
|
|||
unsigned int PW; //In uS
|
||||
volatile byte runSecs; //Counter of seconds since cranking commenced (overflows at 255 obviously)
|
||||
volatile byte secl; //Continous
|
||||
volatile int loopsPerSecond;
|
||||
volatile unsigned int loopsPerSecond;
|
||||
boolean launchingSoft; //True when in launch control soft limit mode
|
||||
boolean launchingHard; //True when in launch control hard limit mode
|
||||
int freeRAM;
|
||||
|
|
|
@ -1196,7 +1196,7 @@ menuDialog = main
|
|||
gaugeCategory = "Other"
|
||||
clockGauge = secl, "Clock", "Seconds", 0, 255, 10, 10, 245, 245, 0, 0
|
||||
deadGauge = deadValue, "---", "", 0, 1, -1, -1, 2, 2, 0, 0
|
||||
loopGauge = loopsPerSecond,"Main loop speed", "Loops/S" , 0, 20000, -1, 500,1800, 4000, 0, 0
|
||||
loopGauge = loopsPerSecond,"Main loop speed", "Loops/S" , 0, 70000, -1, 500,1800, 4000, 0, 0
|
||||
memoryGauge = freeRAM, "Free memory", "bytes" , 0, 8000, -1, 1000,8000, 1000, 0, 0
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
|
@ -1363,7 +1363,7 @@ menuDialog = main
|
|||
TPSdot = scalar, U08, 21, "%/s", 10.00, 0.000
|
||||
advance = scalar, U08, 22, "deg", 1.000, 0.000
|
||||
tps = scalar, U08, 23, "%", 1.000, 0.000
|
||||
loopsPerSecond = scalar, S16, 24, "loops", 1.000, 0.000
|
||||
loopsPerSecond = scalar, U16, 24, "loops", 1.000, 0.000
|
||||
freeRAM = scalar, S16, 26, "bytes", 1.000, 0.000
|
||||
batCorrection = scalar, U08, 28, "%", 1.000, 0.000
|
||||
spark = scalar, U08, 29, "bits", 1.000, 0.000
|
||||
|
|
4
timers.h
4
timers.h
|
@ -24,7 +24,9 @@ volatile int loopSec;
|
|||
volatile unsigned long targetOverdwellTime;
|
||||
volatile unsigned long targetTachoPulseTime;
|
||||
|
||||
|
||||
#if defined (CORE_TEENSY)
|
||||
IntervalTimer lowResTimer;
|
||||
#endif
|
||||
void initialiseTimers();
|
||||
|
||||
#endif // TIMERS_H
|
||||
|
|
|
@ -26,6 +26,9 @@ void initialiseTimers()
|
|||
/* Now configure the prescaler to CPU clock divided by 128 = 125Khz */
|
||||
TCCR2B |= (1<<CS22) | (1<<CS20); // Set bits
|
||||
TCCR2B &= ~(1<<CS21); // Clear bit
|
||||
#elif defined (CORE_TEENSY)
|
||||
//Uses the PIT timer on Teensy.
|
||||
lowResTimer.begin(oneMSInterval, 1000);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -35,7 +38,7 @@ void initialiseTimers()
|
|||
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) //AVR chips use the ISR for this
|
||||
ISR(TIMER2_OVF_vect, ISR_NOBLOCK)
|
||||
#elif defined (CORE_TEENSY)
|
||||
void timer2Overflowinterrupt() //Most ARM chips can simply call a function
|
||||
void oneMSInterval() //Most ARM chips can simply call a function
|
||||
#endif
|
||||
{
|
||||
|
||||
|
|
Loading…
Reference in New Issue