Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: 7_21_17_FSG 7_26_17_FSG
Fork of System_ by
Diff: StaticDefs.cpp
- Revision:
- 0:45085dd174e7
- Child:
- 1:e827d45c3948
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/StaticDefs.cpp Thu Apr 27 13:16:07 2017 +0000 @@ -0,0 +1,41 @@ +#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; +} + +BCEmotor & bce() +{ + static BCEmotor bce(p26, p29, p30); + return bce; +} + +PositionController & posCon() +{ + static PositionController posCon; + return posCon; +}