#include <SysTick.h>
#include "Timers.h"
#include "AxisTimer.h"
#include "InterpolationTimer.h"
#include "MainCommands.h"
#include <driverlib/timer.h>
#include <driverlib/SysTick.h>
#include <inc/hw_ints.h>
volatile uint32_t SysTick::microSecondTimer = 0;
/*
wiring.c initializes SysTick to 100 Khz
Here I reinitialize it to 1 MHz ( microsecond ) and change the handler
This disables the Energia delay( milliseconds ) and the delayMicroseconds ( µS ) functions
that use the SysTick timer
It also disables the registerSysTickCb function
The micro() and millis() functions will still work as they use Timer5
*/
void
SysTick::StartSysTickInterrupts() {
// Use SysTick to drive microsecond counter
SysTickPeriodSet( Timers::frequencyToPeriod( 1000000 ) ); // 1 µSec interrupts (119)
SysTickIntRegister(
SysTick::SysTickInterruptHandler );
ROM_IntPrioritySet(
FAULT_SYSTICK,
SysTickPriorityLevel );
SysTick::microSecondTimer = 0;
SysTickEnable();
SysTickIntEnable(); };
void
SysTick::SysTickInterruptHandler(void) {
// At SysTickPriorityLevel priority level the timer interrupts are disabled
// SysTick interrupt flag is automatically cleared
SysTick::microSecondTimer++; };