FSG / System_

Fork of System_7_14 by Troy Holley

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers StaticDefs.cpp Source File

StaticDefs.cpp

00001 #include "StaticDefs.hpp"
00002 
00003 //Declare static global variables using 'construct on use' idiom to ensure they are always constructed correctly
00004 // and avoid "static initialization order fiasco".
00005 
00006 Timer &systemTime()
00007 {
00008     static Timer s;
00009     return s;
00010 }
00011 
00012 Serial & pc()
00013 {
00014     //static MODSERIAL p(USBTX, USBRX, 512, 64); // tx, rx
00015     static Serial p(USBTX, USBRX);
00016     return p;
00017 }
00018 
00019 SpiADC & adc()
00020 {
00021     static SpiADC adc;
00022     return adc;
00023 }
00024 
00025 PosVelFilter  &   pvf()
00026 {
00027     static PosVelFilter pvf;
00028     return pvf;
00029 }
00030 
00031 PololuHBridge & hBridge()
00032 {
00033     static PololuHBridge hBridge(p25, p29, p30);
00034     return hBridge;
00035 }
00036 
00037 PositionController & posCon()
00038 {
00039     static PositionController posCon;
00040     return posCon;
00041 }