FSG / System_

Fork of System_7_14 by Troy Holley

StaticDefs.cpp

Committer:
mdavis30
Date:
2017-06-09
Revision:
2:4698e312eadb
Parent:
1:e827d45c3948

File content as of revision 2:4698e312eadb:

#include "StaticDefs.hpp"

//Declare static global variables using 'construct on use' idiom to ensure they are always constructed correctly
// and avoid "static initialization order fiasco".

Timer &systemTime()
{
    static Timer s;
    return s;
}

Serial & pc()
{
    //static MODSERIAL p(USBTX, USBRX, 512, 64); // tx, rx
    static Serial p(USBTX, USBRX);
    return p;
}

SpiADC & adc()
{
    static SpiADC adc;
    return adc;
}

PosVelFilter  &   pvf()
{
    static PosVelFilter pvf;
    return pvf;
}

PololuHBridge & hBridge()
{
    static PololuHBridge hBridge(p25, p29, p30);
    return hBridge;
}

PositionController & posCon()
{
    static PositionController posCon;
    return posCon;
}