From d2a0bd35f4f5337df643a6d1584d904d65992efb Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Sat, 12 Nov 2011 22:42:20 -0800 Subject: [PATCH] hil-sensors: added stub libraries for InertialSensor and PeriodicProcess * Also added dummy ivar to APM_BMP085_hil --- libraries/APM_BMP085/APM_BMP085_hil.h | 1 + .../AP_InertialSensor/AP_InertialSensor.h | 1 + .../AP_InertialSensor_Stub.cpp | 26 ++++++++++++++ .../AP_InertialSensor_Stub.h | 35 +++++++++++++++++++ .../AP_PeriodicProcess/AP_PeriodicProcess.h | 1 + .../AP_PeriodicProcessStub.cpp | 6 ++++ .../AP_PeriodicProcessStub.h | 21 +++++++++++ 7 files changed, 91 insertions(+) create mode 100644 libraries/AP_InertialSensor/AP_InertialSensor_Stub.cpp create mode 100644 libraries/AP_InertialSensor/AP_InertialSensor_Stub.h create mode 100644 libraries/AP_PeriodicProcess/AP_PeriodicProcessStub.cpp create mode 100644 libraries/AP_PeriodicProcess/AP_PeriodicProcessStub.h diff --git a/libraries/APM_BMP085/APM_BMP085_hil.h b/libraries/APM_BMP085/APM_BMP085_hil.h index d880766a8b..68f9da07d7 100644 --- a/libraries/APM_BMP085/APM_BMP085_hil.h +++ b/libraries/APM_BMP085/APM_BMP085_hil.h @@ -16,6 +16,7 @@ class APM_BMP085_HIL_Class void Init(int initialiseWireLib = 1, bool purple_hardware=false); uint8_t Read(); void setHIL(float Temp, float Press); + int32_t _offset_press; }; #endif diff --git a/libraries/AP_InertialSensor/AP_InertialSensor.h b/libraries/AP_InertialSensor/AP_InertialSensor.h index f3a5dc02e4..81838f5e3d 100644 --- a/libraries/AP_InertialSensor/AP_InertialSensor.h +++ b/libraries/AP_InertialSensor/AP_InertialSensor.h @@ -57,5 +57,6 @@ class AP_InertialSensor #include "AP_InertialSensor_Oilpan.h" #include "AP_InertialSensor_MPU6000.h" +#include "AP_InertialSensor_Stub.h" #endif // __AP_INERTIAL_SENSOR_H__ diff --git a/libraries/AP_InertialSensor/AP_InertialSensor_Stub.cpp b/libraries/AP_InertialSensor/AP_InertialSensor_Stub.cpp new file mode 100644 index 0000000000..dfc3c224a5 --- /dev/null +++ b/libraries/AP_InertialSensor/AP_InertialSensor_Stub.cpp @@ -0,0 +1,26 @@ + +#include "AP_InertialSensor_Stub.h" + +void AP_InertialSensor_Stub::init( AP_PeriodicProcess * scheduler ) {} + +/*================ AP_INERTIALSENSOR PUBLIC INTERFACE ==================== */ + +bool AP_InertialSensor_Stub::update( void ) {} + + +float AP_InertialSensor_Stub::gx() { return 0.0f; } +float AP_InertialSensor_Stub::gy() { return 0.0f; } +float AP_InertialSensor_Stub::gz() { return 0.0f; } + +void AP_InertialSensor_Stub::get_gyros( float * g ) { } + +float AP_InertialSensor_Stub::ax() { return 0.0f; } +float AP_InertialSensor_Stub::ay() { return 0.0f; } +float AP_InertialSensor_Stub::az() { return 0.0f; } + +void AP_InertialSensor_Stub::get_accels( float * a ) {} +void AP_InertialSensor_Stub::get_sensors( float * sensors ) {} + +float AP_InertialSensor_Stub::temperature() { return 0.0; } +uint32_t AP_InertialSensor_Stub::sample_time() { return 0; } +void AP_InertialSensor_Stub::reset_sample_time() {} diff --git a/libraries/AP_InertialSensor/AP_InertialSensor_Stub.h b/libraries/AP_InertialSensor/AP_InertialSensor_Stub.h new file mode 100644 index 0000000000..89330597b2 --- /dev/null +++ b/libraries/AP_InertialSensor/AP_InertialSensor_Stub.h @@ -0,0 +1,35 @@ + +#ifndef __AP_INERTIAL_SENSOR_STUB_H__ +#define __AP_INERTIAL_SENSOR_STUB_H__ + +#include +#include + +#include "../AP_PeriodicProcess/AP_PeriodicProcess.h" +#include "AP_InertialSensor.h" + +class AP_InertialSensor_Stub : public AP_InertialSensor +{ + public: + + AP_InertialSensor_Stub() {} + + void init( AP_PeriodicProcess * scheduler ); + + /* Concrete implementation of AP_InertialSensor functions: */ + bool update(); + float gx(); + float gy(); + float gz(); + void get_gyros( float * ); + float ax(); + float ay(); + float az(); + void get_accels( float * ); + void get_sensors( float * ); + float temperature(); + uint32_t sample_time(); + void reset_sample_time(); + }; + +#endif // __AP_INERTIAL_SENSOR_STUB_H__ diff --git a/libraries/AP_PeriodicProcess/AP_PeriodicProcess.h b/libraries/AP_PeriodicProcess/AP_PeriodicProcess.h index c54b531dde..7b879bdcc4 100644 --- a/libraries/AP_PeriodicProcess/AP_PeriodicProcess.h +++ b/libraries/AP_PeriodicProcess/AP_PeriodicProcess.h @@ -3,6 +3,7 @@ #define __AP_PERIODIC_PROCESS_H__ #include "PeriodicProcess.h" +#include "AP_PeriodicProcessStub.h" #include "AP_TimerProcess.h" #include "AP_TimerAperiodicProcess.h" diff --git a/libraries/AP_PeriodicProcess/AP_PeriodicProcessStub.cpp b/libraries/AP_PeriodicProcess/AP_PeriodicProcessStub.cpp new file mode 100644 index 0000000000..2d6ff0e5f7 --- /dev/null +++ b/libraries/AP_PeriodicProcess/AP_PeriodicProcessStub.cpp @@ -0,0 +1,6 @@ + +#include "AP_PeriodicProcessStub.h" +AP_PeriodicProcessStub::AP_PeriodicProcessStub(int period) {} +void AP_PeriodicProcessStub::init( Arduino_Mega_ISR_Registry * isr_reg ){} +void AP_PeriodicProcessStub::register_process(void (*proc)(void) ) {} +void AP_PeriodicProcessStub::run(void) {} diff --git a/libraries/AP_PeriodicProcess/AP_PeriodicProcessStub.h b/libraries/AP_PeriodicProcess/AP_PeriodicProcessStub.h new file mode 100644 index 0000000000..0b8bcd5119 --- /dev/null +++ b/libraries/AP_PeriodicProcess/AP_PeriodicProcessStub.h @@ -0,0 +1,21 @@ + +#ifndef __AP_PERIODIC_PROCESS_STUB_H__ +#define __AP_PERIODIC_PROCESS_STUB_H__ + +#include "PeriodicProcess.h" +#include "../Arduino_Mega_ISR_Registry/Arduino_Mega_ISR_Registry.h" + + +class AP_PeriodicProcessStub : public AP_PeriodicProcess +{ + public: + AP_PeriodicProcessStub(int period = 0); + void init( Arduino_Mega_ISR_Registry * isr_reg ); + void register_process(void (* proc)(void)); + static void run(void); + protected: + static int _period; + static void (*_proc)(void); +}; + +#endif