Advertisement
Guest User

Untitled

a guest
May 9th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.21 KB | None | 0 0
  1. ------ArduSlave.h-----
  2. #pragma once
  3.  
  4. // Includes
  5. #include "CModule.h"
  6. #include "CPin.h"
  7. #include "SysConfig.h"
  8.  
  9. class ArduSlave : public CModule
  10. {
  11. public:
  12. _ void Initialize();_
  13. _ void Update( CCommand& commandIn );_
  14. };
  15.  
  16. -------ArduSlave.cpp------
  17.  
  18. #include "SysConfig.h"
  19. #if(HASArduSlave)_
  20. #include "NDataManager.h"
  21. #include "CPin.h"
  22. #include "ArduSlave.h"
  23.  
  24. #include "NConfigManager.h"
  25.  
  26. namespace {}
  27.  
  28. void ArduSlave::Initialize(){
  29. /* Serial.begin(9600); */
  30. _ }_
  31.  
  32. void ArduSlave::Update( CCommand& commandIn ){
  33.  
  34. Serial.print(F("ArduSlaveTEST:"));_
  35. Serial.println(';');
  36. }
  37.  
  38. _#endif _
  39.  
  40. -----OpenROV2x.ino-------
  41. // Includes
  42. #include
  43.  
  44. #include "NArduinoManager.h"
  45. #include "NVehicleManager.h"
  46. #include "NDataManager.h"
  47. #include "NCommManager.h"
  48. #include "NModuleManager.h"
  49.  
  50. void setup()
  51. {
  52. _ // Initialize main subsystems_
  53. _ NArduinoManager::Initialize();_
  54. _ NCommManager::Initialize();_
  55. _ NVehicleManager::Initialize();_
  56. _ NModuleManager::Initialize();_
  57. _ NDataManager::Initialize();_
  58.  
  59. _ ArduSlave::Initialize();_
  60. _ ArduSlave::Update( CCommand& commandIn );_
  61. _ // Set timer 5 divisor to 8 for PWM frequency of 3921.16Hz (D44, D45, D46)_
  62. _ TCCR5B = ( TCCR5B & B11111000 ) | B00000010;_
  63.  
  64. _ // Boot complete_
  65. _ Serial.println( F( "boot:1;" ) );_
  66. }
  67.  
  68. void loop()
  69. {
  70. _ // Reset the watchdog timer_
  71. _ wdt_reset();_
  72.  
  73. _ // Attempt to read a current command off of the command line_
  74. _ NCommManager::GetCurrentCommand();_
  75.  
  76. _ // Handle any config change requests_
  77. _ NVehicleManager::HandleMessages( NCommManager::m_currentCommand );_
  78.  
  79. _ // Handle update loops for each module_
  80. _ NModuleManager::HandleModuleUpdates( NCommManager::m_currentCommand );_
  81.  
  82. _ // Handle update loops that send data back to the beaglebone_
  83. _ NDataManager::HandleOutputLoops();_
  84. _ _
  85. _ _
  86. _ _
  87. }
  88.  
  89. -------SysModules.h-----
  90. #pragma once
  91. #include "SysConfig.h"
  92.  
  93. #include "Plugins.h"
  94. #include "PinDefinitions.h"
  95.  
  96. // ---------------------------------------
  97. // Conditional module definitions
  98. // -------------------------------
  99. // Once these objects are instantiated, they will register themselves as modules in the module manager.
  100. // They can also be accessed individually as namespace members.
  101. // ---------------------------------------
  102.  
  103. #if( HASOROV_CONTROLLERBOARD_25 )_
  104. #include "CControllerBoard.h"
  105. CControllerBoard mcontrollerBoard;_
  106. #endif
  107.  
  108. #if(HASSTD_LIGHTS)_
  109. #include "CLights.h"
  110. CLights mlights( PIN_STANDARD_LIGHTS );_
  111. #endif
  112.  
  113. #if(HASEXT_LIGHTS )_
  114. #include "CExternalLights.h"
  115. CExternalLights melights( PIN_PWM_3 );_
  116. #endif
  117.  
  118. #if(HASSTD_CALIBRATIONLASERS)_
  119. #include "CCalibrationLaser.h"
  120. CCalibrationLaser mcalibrationLaser( PIN_LASERS );_
  121. #endif
  122.  
  123. #if(THRUSTERCONFIGURATION != THRUSTER_CONFIG_NONE )_
  124. #include "CThrusters.h"
  125. CThrusters mthrusters;_
  126. #endif
  127.  
  128. #if(HASSTD_AUTOPILOT)_
  129. #include "CAutopilot.h"
  130. CAutopilot mautopilot;_
  131. #endif
  132.  
  133. #if(HASCAMERASERVO)_
  134. #include "CCameraServo.h"
  135. CCameraServo mcameraServo;_
  136. #endif
  137.  
  138. #if(HASALT_SERVO)_
  139. #include "CAltServo.h"
  140. CAltServo altservo1;
  141. #endif
  142.  
  143. #if(DEADMANSWITCHON)_
  144. #include "CDeadManSwitch.h"
  145. CDeadManSwitch mdeadManSwitch;_
  146. #endif
  147.  
  148. // IMU1
  149. #if( HASMPU9150 )_
  150. #include "CMPU9150.h"
  151. CMPU9150 mmpu9150( mpu9150::EAddress::ADDRESS_B );_
  152. #endif
  153.  
  154. #if(HASMS5803_14BA)_
  155. #include "CMS580314BA.h"_
  156. CMS580314BA m_ms5803( &I2C0, ms5803_14ba::EAddress::ADDRESS_A );_
  157. #endif
  158.  
  159. // IMU2
  160. #if(HASBNO055)_
  161. #include "CBNO055.h"
  162. CBNO055 mbno055( &I2C0, bno055::EAddress::ADDRESS_A );_
  163. #endif
  164.  
  165. #if(HASMS5837_30BA)_
  166. #include "CMS583730BA.h"_
  167. CMS583730BA m_ms5837( &I2C0, ms5837_30ba::EAddress::ADDRESS_A );_
  168. #endif
  169.  
  170. #if(HASArduSlave)_
  171. #include "ArduSlave.h"
  172. ArduSlave marduslave;_
  173. #endif
  174.  
  175. -----SysConfig.h-----
  176. #pragma once
  177.  
  178. #include "PinDefinitions.h"
  179. #include "CompileOptions.h"
  180.  
  181. // TODO: The MCU ARCH and Board Type should eventually be passed in solely from the build script.
  182.  
  183. // ---------------------------------------------------------
  184. // MCU Architecture Selection
  185. // ---------------------------------------------------------
  186.  
  187. #ifndef ARDUINOARCH_AVR_
  188. _ #error "This sketch is only supported on for ARDUINO_ARCH_AVR!"_
  189. #endif
  190.  
  191. // Configuration
  192. #define HASOROV_CONTROLLERBOARD_25 (1)_
  193. #define HASSTD_LIGHTS (1)_
  194. #define HASSTD_CALIBRATIONLASERS (1)_
  195. #define HASCAMERASERVO (1)_
  196. #define HASSTD_AUTOPILOT (1)_
  197. #define DEADMANSWITCHON (0)_
  198.  
  199. // Thrusters configurations (These appear depricated and replaced by the THRUSTERCONFIGURATION below)_
  200. #define THRUSTERCONFIG_NONE (0)_
  201. #define THRUSTERCONFIG_2X1 (1)_
  202. #define THRUSTERCONFIG_2Xv2 (2)_
  203. #define THRUSTERCONFIG_v2X1Xv2 (3)_
  204.  
  205. // Selected Thruster Configuration
  206. #define THRUSTERCONFIGURATION THRUSTER_CONFIG_2X1_
  207. //#define THRUSTERCONFIGURATION THRUSTER_CONFIG_2Xv2_
  208. //#define THRUSTERCONFIGURATION THRUSTER_CONFIG_v2X1Xv2_
  209.  
  210. // ---------------------------------------------------------
  211. // After Market Modules
  212. // ---------------------------------------------------------
  213.  
  214. // External Lights
  215. #define HASEXT_LIGHTS (1)_
  216.  
  217. // AltServo
  218. #define HASALT_SERVO (0)_
  219.  
  220. // MS580314BA Depth Sensor_
  221. #define HASMS5803_14BA (1)_
  222.  
  223. // MS583730BA Depth Sensor_
  224. #define HASMS5837_30BA (1)_
  225.  
  226. // MPU9150
  227. #define HASMPU9150 (1)_
  228.  
  229. // BNO055 IMU
  230. #define HASBNO055 (1)_
  231.  
  232. #define HASArduSlave (1)_
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement