Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ------ArduSlave.h-----
- #pragma once
- // Includes
- #include "CModule.h"
- #include "CPin.h"
- #include "SysConfig.h"
- class ArduSlave : public CModule
- {
- public:
- _ void Initialize();_
- _ void Update( CCommand& commandIn );_
- };
- -------ArduSlave.cpp------
- #include "SysConfig.h"
- #if(HASArduSlave)_
- #include "NDataManager.h"
- #include "CPin.h"
- #include "ArduSlave.h"
- #include "NConfigManager.h"
- namespace {}
- void ArduSlave::Initialize(){
- /* Serial.begin(9600); */
- _ }_
- void ArduSlave::Update( CCommand& commandIn ){
- Serial.print(F("ArduSlaveTEST:"));_
- Serial.println(';');
- }
- _#endif _
- -----OpenROV2x.ino-------
- // Includes
- #include
- #include "NArduinoManager.h"
- #include "NVehicleManager.h"
- #include "NDataManager.h"
- #include "NCommManager.h"
- #include "NModuleManager.h"
- void setup()
- {
- _ // Initialize main subsystems_
- _ NArduinoManager::Initialize();_
- _ NCommManager::Initialize();_
- _ NVehicleManager::Initialize();_
- _ NModuleManager::Initialize();_
- _ NDataManager::Initialize();_
- _ ArduSlave::Initialize();_
- _ ArduSlave::Update( CCommand& commandIn );_
- _ // Set timer 5 divisor to 8 for PWM frequency of 3921.16Hz (D44, D45, D46)_
- _ TCCR5B = ( TCCR5B & B11111000 ) | B00000010;_
- _ // Boot complete_
- _ Serial.println( F( "boot:1;" ) );_
- }
- void loop()
- {
- _ // Reset the watchdog timer_
- _ wdt_reset();_
- _ // Attempt to read a current command off of the command line_
- _ NCommManager::GetCurrentCommand();_
- _ // Handle any config change requests_
- _ NVehicleManager::HandleMessages( NCommManager::m_currentCommand );_
- _ // Handle update loops for each module_
- _ NModuleManager::HandleModuleUpdates( NCommManager::m_currentCommand );_
- _ // Handle update loops that send data back to the beaglebone_
- _ NDataManager::HandleOutputLoops();_
- _ _
- _ _
- _ _
- }
- -------SysModules.h-----
- #pragma once
- #include "SysConfig.h"
- #include "Plugins.h"
- #include "PinDefinitions.h"
- // ---------------------------------------
- // Conditional module definitions
- // -------------------------------
- // Once these objects are instantiated, they will register themselves as modules in the module manager.
- // They can also be accessed individually as namespace members.
- // ---------------------------------------
- #if( HASOROV_CONTROLLERBOARD_25 )_
- #include "CControllerBoard.h"
- CControllerBoard mcontrollerBoard;_
- #endif
- #if(HASSTD_LIGHTS)_
- #include "CLights.h"
- CLights mlights( PIN_STANDARD_LIGHTS );_
- #endif
- #if(HASEXT_LIGHTS )_
- #include "CExternalLights.h"
- CExternalLights melights( PIN_PWM_3 );_
- #endif
- #if(HASSTD_CALIBRATIONLASERS)_
- #include "CCalibrationLaser.h"
- CCalibrationLaser mcalibrationLaser( PIN_LASERS );_
- #endif
- #if(THRUSTERCONFIGURATION != THRUSTER_CONFIG_NONE )_
- #include "CThrusters.h"
- CThrusters mthrusters;_
- #endif
- #if(HASSTD_AUTOPILOT)_
- #include "CAutopilot.h"
- CAutopilot mautopilot;_
- #endif
- #if(HASCAMERASERVO)_
- #include "CCameraServo.h"
- CCameraServo mcameraServo;_
- #endif
- #if(HASALT_SERVO)_
- #include "CAltServo.h"
- CAltServo altservo1;
- #endif
- #if(DEADMANSWITCHON)_
- #include "CDeadManSwitch.h"
- CDeadManSwitch mdeadManSwitch;_
- #endif
- // IMU1
- #if( HASMPU9150 )_
- #include "CMPU9150.h"
- CMPU9150 mmpu9150( mpu9150::EAddress::ADDRESS_B );_
- #endif
- #if(HASMS5803_14BA)_
- #include "CMS580314BA.h"_
- CMS580314BA m_ms5803( &I2C0, ms5803_14ba::EAddress::ADDRESS_A );_
- #endif
- // IMU2
- #if(HASBNO055)_
- #include "CBNO055.h"
- CBNO055 mbno055( &I2C0, bno055::EAddress::ADDRESS_A );_
- #endif
- #if(HASMS5837_30BA)_
- #include "CMS583730BA.h"_
- CMS583730BA m_ms5837( &I2C0, ms5837_30ba::EAddress::ADDRESS_A );_
- #endif
- #if(HASArduSlave)_
- #include "ArduSlave.h"
- ArduSlave marduslave;_
- #endif
- -----SysConfig.h-----
- #pragma once
- #include "PinDefinitions.h"
- #include "CompileOptions.h"
- // TODO: The MCU ARCH and Board Type should eventually be passed in solely from the build script.
- // ---------------------------------------------------------
- // MCU Architecture Selection
- // ---------------------------------------------------------
- #ifndef ARDUINOARCH_AVR_
- _ #error "This sketch is only supported on for ARDUINO_ARCH_AVR!"_
- #endif
- // Configuration
- #define HASOROV_CONTROLLERBOARD_25 (1)_
- #define HASSTD_LIGHTS (1)_
- #define HASSTD_CALIBRATIONLASERS (1)_
- #define HASCAMERASERVO (1)_
- #define HASSTD_AUTOPILOT (1)_
- #define DEADMANSWITCHON (0)_
- // Thrusters configurations (These appear depricated and replaced by the THRUSTERCONFIGURATION below)_
- #define THRUSTERCONFIG_NONE (0)_
- #define THRUSTERCONFIG_2X1 (1)_
- #define THRUSTERCONFIG_2Xv2 (2)_
- #define THRUSTERCONFIG_v2X1Xv2 (3)_
- // Selected Thruster Configuration
- #define THRUSTERCONFIGURATION THRUSTER_CONFIG_2X1_
- //#define THRUSTERCONFIGURATION THRUSTER_CONFIG_2Xv2_
- //#define THRUSTERCONFIGURATION THRUSTER_CONFIG_v2X1Xv2_
- // ---------------------------------------------------------
- // After Market Modules
- // ---------------------------------------------------------
- // External Lights
- #define HASEXT_LIGHTS (1)_
- // AltServo
- #define HASALT_SERVO (0)_
- // MS580314BA Depth Sensor_
- #define HASMS5803_14BA (1)_
- // MS583730BA Depth Sensor_
- #define HASMS5837_30BA (1)_
- // MPU9150
- #define HASMPU9150 (1)_
- // BNO055 IMU
- #define HASBNO055 (1)_
- #define HASArduSlave (1)_
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement