![](/media/cache/group/flyingpig-cover.png.50x50_q85.jpg)
most functionality to splashdwon, find neutral and start mission. short timeouts still in code for testing, will adjust to go directly to sit_idle after splashdown
Dependencies: mbed MODSERIAL FATFileSystem
System/StaticDefs.cpp@65:2ac186553959, 2018-06-19 (annotated)
- Committer:
- tnhnrl
- Date:
- Tue Jun 19 18:10:50 2018 +0000
- Revision:
- 65:2ac186553959
- Parent:
- 57:ec69651c8c21
- Child:
- 66:0f20870117b7
Version with limit switches in output
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tnhnrl | 45:16b8162188ca | 1 | #include "StaticDefs.hpp" |
tnhnrl | 45:16b8162188ca | 2 | |
tnhnrl | 45:16b8162188ca | 3 | //Declare static global variables using 'construct on use' idiom to ensure they |
tnhnrl | 45:16b8162188ca | 4 | // are always constructed correctly and avoid "static initialization order fiasco". |
tnhnrl | 45:16b8162188ca | 5 | |
tnhnrl | 45:16b8162188ca | 6 | Timer & systemTime() { |
tnhnrl | 45:16b8162188ca | 7 | static Timer s; |
tnhnrl | 45:16b8162188ca | 8 | return s; |
tnhnrl | 45:16b8162188ca | 9 | } |
tnhnrl | 45:16b8162188ca | 10 | |
tnhnrl | 45:16b8162188ca | 11 | Ticker & pulse() { |
tnhnrl | 45:16b8162188ca | 12 | static Ticker pulse; |
tnhnrl | 45:16b8162188ca | 13 | return pulse; |
tnhnrl | 45:16b8162188ca | 14 | } |
tnhnrl | 45:16b8162188ca | 15 | |
tnhnrl | 45:16b8162188ca | 16 | MODSERIAL & pc() { |
mkelly10 | 51:c5c40272ecc3 | 17 | static MODSERIAL pc(USBTX, USBRX); |
mkelly10 | 51:c5c40272ecc3 | 18 | //static MODSERIAL pc(p9, p10); //XBee tx, rx pins |
tnhnrl | 45:16b8162188ca | 19 | return pc; |
tnhnrl | 45:16b8162188ca | 20 | } |
tnhnrl | 45:16b8162188ca | 21 | |
tnhnrl | 45:16b8162188ca | 22 | //MODSERIAL & xb() { |
tnhnrl | 45:16b8162188ca | 23 | // static MODSERIAL xb(p9, p10); //XBee tx, rx pins |
tnhnrl | 45:16b8162188ca | 24 | // return xb; |
tnhnrl | 45:16b8162188ca | 25 | //} |
tnhnrl | 45:16b8162188ca | 26 | |
tnhnrl | 45:16b8162188ca | 27 | |
tnhnrl | 45:16b8162188ca | 28 | //FIX THIS TO USE SPI data logger... |
mkelly10 | 51:c5c40272ecc3 | 29 | /* |
tnhnrl | 45:16b8162188ca | 30 | MODSERIAL & datalogger() { |
tnhnrl | 45:16b8162188ca | 31 | static MODSERIAL datalogger(p28, p27); //Data Logger tx, rx pins |
tnhnrl | 45:16b8162188ca | 32 | return datalogger; |
tnhnrl | 45:16b8162188ca | 33 | } |
mkelly10 | 51:c5c40272ecc3 | 34 | */ |
tnhnrl | 45:16b8162188ca | 35 | |
tnhnrl | 45:16b8162188ca | 36 | LocalFileSystem & local() { |
tnhnrl | 45:16b8162188ca | 37 | static LocalFileSystem local("local"); |
tnhnrl | 45:16b8162188ca | 38 | return local; |
tnhnrl | 45:16b8162188ca | 39 | } |
tnhnrl | 45:16b8162188ca | 40 | |
mkelly10 | 51:c5c40272ecc3 | 41 | /*************************************************************** Conflict with IMU |
tnhnrl | 45:16b8162188ca | 42 | SDFileSystem & sd_card() { |
tnhnrl | 45:16b8162188ca | 43 | static SDFileSystem sd_card(p11, p12, p13, p14, "sd"); //SDFileSystem sd_card(MOSI, MISO, SCK, CS, "sd"); |
tnhnrl | 45:16b8162188ca | 44 | return sd_card; |
tnhnrl | 45:16b8162188ca | 45 | } |
mkelly10 | 51:c5c40272ecc3 | 46 | */ |
tnhnrl | 45:16b8162188ca | 47 | |
tnhnrl | 45:16b8162188ca | 48 | SpiADC & adc() { |
tnhnrl | 45:16b8162188ca | 49 | static SpiADC adc(p5,p6,p7,p8,LED2); |
tnhnrl | 45:16b8162188ca | 50 | return adc; |
tnhnrl | 45:16b8162188ca | 51 | } |
tnhnrl | 45:16b8162188ca | 52 | |
tnhnrl | 53:c0586fe62b01 | 53 | LinearActuator & bce() { // pwm,dir,res,swt |
tnhnrl | 53:c0586fe62b01 | 54 | static LinearActuator bce(0.01,p22,p15,p16,p17,0); //interval , pwm, dir, reset, limit switch, adc channel (confirmed) |
tnhnrl | 45:16b8162188ca | 55 | return bce; |
tnhnrl | 45:16b8162188ca | 56 | } |
tnhnrl | 45:16b8162188ca | 57 | |
tnhnrl | 53:c0586fe62b01 | 58 | LinearActuator & batt() { // pwm,dir,res,swt |
tnhnrl | 53:c0586fe62b01 | 59 | static LinearActuator batt(0.01,p21,p20,p19,p18,1); //interval , pwm, dir, reset, limit switch, adc channel (confirmed) |
tnhnrl | 45:16b8162188ca | 60 | return batt; |
tnhnrl | 45:16b8162188ca | 61 | } |
tnhnrl | 45:16b8162188ca | 62 | |
tnhnrl | 52:f207567d3ea4 | 63 | ServoDriver & rudder() { |
tnhnrl | 56:48a8a5a65b82 | 64 | static ServoDriver rudder(p26); //current rudder pin on the latest drawing 06/11/2018 |
tnhnrl | 52:f207567d3ea4 | 65 | return rudder; |
tnhnrl | 45:16b8162188ca | 66 | } |
tnhnrl | 45:16b8162188ca | 67 | |
mkelly10 | 51:c5c40272ecc3 | 68 | //*************Need to adjust class************** |
tnhnrl | 45:16b8162188ca | 69 | omegaPX209 & depth() { |
tnhnrl | 45:16b8162188ca | 70 | static omegaPX209 depth(p19); // pin |
tnhnrl | 45:16b8162188ca | 71 | return depth; |
tnhnrl | 45:16b8162188ca | 72 | } |
tnhnrl | 45:16b8162188ca | 73 | |
tnhnrl | 45:16b8162188ca | 74 | IMU & imu() { |
tnhnrl | 57:ec69651c8c21 | 75 | static IMU imu(p28, p27); // tx, rx pin |
tnhnrl | 45:16b8162188ca | 76 | return imu; |
tnhnrl | 45:16b8162188ca | 77 | } |
tnhnrl | 45:16b8162188ca | 78 | |
tnhnrl | 45:16b8162188ca | 79 | OuterLoop & depthLoop() { |
tnhnrl | 45:16b8162188ca | 80 | static OuterLoop depthLoop(0.1, 0); // interval, sensor type |
tnhnrl | 45:16b8162188ca | 81 | return depthLoop; |
tnhnrl | 45:16b8162188ca | 82 | } |
tnhnrl | 45:16b8162188ca | 83 | |
tnhnrl | 45:16b8162188ca | 84 | OuterLoop & pitchLoop() { |
tnhnrl | 45:16b8162188ca | 85 | static OuterLoop pitchLoop(0.1, 1); // interval, sensor type |
tnhnrl | 45:16b8162188ca | 86 | return pitchLoop; |
tnhnrl | 45:16b8162188ca | 87 | } |
tnhnrl | 45:16b8162188ca | 88 | |
tnhnrl | 54:d4990fb68404 | 89 | OuterLoop & headingLoop() { |
tnhnrl | 54:d4990fb68404 | 90 | static OuterLoop headingLoop(0.1, 2); // interval, sensor type |
tnhnrl | 54:d4990fb68404 | 91 | return headingLoop; |
tnhnrl | 45:16b8162188ca | 92 | } |
tnhnrl | 45:16b8162188ca | 93 | |
tnhnrl | 45:16b8162188ca | 94 | StateMachine & stateMachine() { |
tnhnrl | 45:16b8162188ca | 95 | static StateMachine stateMachine; |
tnhnrl | 45:16b8162188ca | 96 | return stateMachine; |
tnhnrl | 45:16b8162188ca | 97 | } |
tnhnrl | 45:16b8162188ca | 98 | |
tnhnrl | 45:16b8162188ca | 99 | ConfigFileIO & configFileIO() { |
tnhnrl | 45:16b8162188ca | 100 | static ConfigFileIO configFileIO; |
tnhnrl | 45:16b8162188ca | 101 | return configFileIO; |
tnhnrl | 45:16b8162188ca | 102 | } |
tnhnrl | 45:16b8162188ca | 103 | |
tnhnrl | 45:16b8162188ca | 104 | SequenceController & sequenceController() { |
tnhnrl | 45:16b8162188ca | 105 | static SequenceController sequenceController; |
tnhnrl | 45:16b8162188ca | 106 | return sequenceController; |
tnhnrl | 45:16b8162188ca | 107 | } |
tnhnrl | 45:16b8162188ca | 108 | |
tnhnrl | 45:16b8162188ca | 109 | MbedLogger & mbedLogger() { |
tnhnrl | 45:16b8162188ca | 110 | static MbedLogger mbedLogger("/local/"); //local file system |
tnhnrl | 45:16b8162188ca | 111 | return mbedLogger; |
tnhnrl | 45:16b8162188ca | 112 | } |
tnhnrl | 45:16b8162188ca | 113 | |
tnhnrl | 45:16b8162188ca | 114 | MbedLogger & sdLogger() { |
tnhnrl | 45:16b8162188ca | 115 | static MbedLogger sdLogger("/sd/"); |
tnhnrl | 45:16b8162188ca | 116 | return sdLogger; |
tnhnrl | 45:16b8162188ca | 117 | } |
tnhnrl | 45:16b8162188ca | 118 | |
tnhnrl | 45:16b8162188ca | 119 | DigitalOut & led1() { |
tnhnrl | 45:16b8162188ca | 120 | static DigitalOut led1(LED1); |
tnhnrl | 45:16b8162188ca | 121 | return led1; |
tnhnrl | 45:16b8162188ca | 122 | } |
tnhnrl | 45:16b8162188ca | 123 | |
tnhnrl | 45:16b8162188ca | 124 | DigitalOut & led2() { |
tnhnrl | 45:16b8162188ca | 125 | static DigitalOut led2(LED2); |
tnhnrl | 45:16b8162188ca | 126 | return led2; |
tnhnrl | 45:16b8162188ca | 127 | } |
tnhnrl | 45:16b8162188ca | 128 | |
tnhnrl | 45:16b8162188ca | 129 | DigitalOut & led3() { |
tnhnrl | 45:16b8162188ca | 130 | static DigitalOut led3(LED3); |
tnhnrl | 45:16b8162188ca | 131 | return led3; |
tnhnrl | 45:16b8162188ca | 132 | } |
tnhnrl | 45:16b8162188ca | 133 | |
tnhnrl | 45:16b8162188ca | 134 | DigitalOut & led4() { |
tnhnrl | 45:16b8162188ca | 135 | static DigitalOut led4(LED4); |
tnhnrl | 45:16b8162188ca | 136 | return led4; |
tnhnrl | 45:16b8162188ca | 137 | } |