All mbed code for control over dive planes, pump motor, valve motor, BCUs, UART interface, etc.

Dependencies:   mbed ESC mbed MODDMA

Committer:
juansal12
Date:
Tue Jan 14 19:17:05 2020 +0000
Revision:
0:c3a329a5b05d
Sofi7 mbed code;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
juansal12 0:c3a329a5b05d 1
juansal12 0:c3a329a5b05d 2 // NOTE look at the below h files to define whether that control mode is enabled
juansal12 0:c3a329a5b05d 3
juansal12 0:c3a329a5b05d 4 #include "mbed.h"
juansal12 0:c3a329a5b05d 5 //#include "AcousticControl/AcousticController.h" // also need to define acousticControl in ToneDetector.h
juansal12 0:c3a329a5b05d 6 #include "SerialControl/SerialController.h"
juansal12 0:c3a329a5b05d 7 //#include "ROSControl/ROSController.h"
juansal12 0:c3a329a5b05d 8
juansal12 0:c3a329a5b05d 9 Serial pc(USBTX, USBRX);
juansal12 0:c3a329a5b05d 10
juansal12 0:c3a329a5b05d 11 int main()
juansal12 0:c3a329a5b05d 12 {
juansal12 0:c3a329a5b05d 13 /* ACOUSTIC CONTROL */
juansal12 0:c3a329a5b05d 14 //#ifdef acousticControl
juansal12 0:c3a329a5b05d 15 // pc.baud(115200);
juansal12 0:c3a329a5b05d 16 // // Initialize the acoustic controller
juansal12 0:c3a329a5b05d 17 // acousticController.init(&pc); // if no serial object is provided, it will create one on the USB pins
juansal12 0:c3a329a5b05d 18 // // Start the controller
juansal12 0:c3a329a5b05d 19 // // NOTE this is a blocking method, and if infiniteLoopAcoustic is defined it will run forever (or until low battery callback or button board reset command)
juansal12 0:c3a329a5b05d 20 // // It can be stopped by the acousticController.stop() method, but you have to
juansal12 0:c3a329a5b05d 21 // // control threading here to actually be able to call that
juansal12 0:c3a329a5b05d 22 // // The acoustic controller hasn't been tested with multi-threading though
juansal12 0:c3a329a5b05d 23 // acousticController.run();
juansal12 0:c3a329a5b05d 24 // #endif
juansal12 0:c3a329a5b05d 25
juansal12 0:c3a329a5b05d 26 /* SERIAL CONTROL */
juansal12 0:c3a329a5b05d 27 #ifdef serialControl
juansal12 0:c3a329a5b05d 28
juansal12 0:c3a329a5b05d 29 pc.baud(115200);
juansal12 0:c3a329a5b05d 30 pc.printf("Beginning serial control. \n");
juansal12 0:c3a329a5b05d 31 // Initialize the serial controller
juansal12 0:c3a329a5b05d 32 serialController.init(NULL, &pc);
juansal12 0:c3a329a5b05d 33 // Start the controller
juansal12 0:c3a329a5b05d 34 // NOTE this is a blocking method, and if infiniteLoopSerial is defined it will run forever (or until low battery callback or button board reset command)
juansal12 0:c3a329a5b05d 35 // It can be stopped by the serialController.stop() method, but you have to
juansal12 0:c3a329a5b05d 36 // control threading here to actually be able to call that
juansal12 0:c3a329a5b05d 37 serialController.run();
juansal12 0:c3a329a5b05d 38 #endif
juansal12 0:c3a329a5b05d 39
juansal12 0:c3a329a5b05d 40 /* ROS CONTROL */
juansal12 0:c3a329a5b05d 41 //#ifdef rosControl
juansal12 0:c3a329a5b05d 42 // pc.baud(115200);
juansal12 0:c3a329a5b05d 43 // // Initialize the ROS controller
juansal12 0:c3a329a5b05d 44 // rosController.init(NULL, &pc);
juansal12 0:c3a329a5b05d 45 // // Start the controller
juansal12 0:c3a329a5b05d 46 // // NOTE this is a blocking method, and if infiniteLoopSerial is defined it will run forever (or until low battery callback or button board reset command)
juansal12 0:c3a329a5b05d 47 // // It can be stopped by the rosController.stop() method, but you have to
juansal12 0:c3a329a5b05d 48 // // control threading here to actually be able to call that
juansal12 0:c3a329a5b05d 49 // rosController.run();
juansal12 0:c3a329a5b05d 50 // #endif
juansal12 0:c3a329a5b05d 51 }