Skip to content
Snippets Groups Projects
Commit 212502b2 authored by Beat Küng's avatar Beat Küng
Browse files

camera_trigger: make sure it builds for SITL & add to SITL cmake

parent 88214678
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ set(CMAKE_TOOLCHAIN_FILE ${PX4_SOURCE_DIR}/cmake/toolchains/Toolchain-native.cma
set(config_module_list
drivers/boards/sitl
drivers/camera_trigger
drivers/device
drivers/gps
drivers/pwm_out_sim
......
......@@ -49,9 +49,7 @@
#include <fcntl.h>
#include <stdbool.h>
#include <mathlib/mathlib.h>
#include <nuttx/clock.h>
#include <nuttx/arch.h>
#include <nuttx/wqueue.h>
#include <px4_workqueue.h>
#include <systemlib/systemlib.h>
#include <systemlib/err.h>
#include <systemlib/param/param.h>
......@@ -67,6 +65,7 @@
#include <drivers/drv_hrt.h>
#include <board_config.h>
#include "interfaces/src/camera_interface.h"
#include "interfaces/src/pwm.h"
#include "interfaces/src/relay.h"
......@@ -74,7 +73,7 @@
extern "C" __EXPORT int camera_trigger_main(int argc, char *argv[]);
typedef enum {
typedef enum : int32_t {
CAMERA_INTERFACE_MODE_NONE = 0,
CAMERA_INTERFACE_MODE_RELAY,
CAMERA_INTERFACE_MODE_SEAGULL_MAP2_PWM
......@@ -254,15 +253,20 @@ CameraTrigger::CameraTrigger() :
param_get(_p_interface, &_camera_interface_mode);
switch (_camera_interface_mode) {
#ifdef __PX4_NUTTX
case CAMERA_INTERFACE_MODE_RELAY:
_camera_interface = new CameraInterfaceRelay;
_camera_interface = new CameraInterfaceRelay();
break;
case CAMERA_INTERFACE_MODE_SEAGULL_MAP2_PWM:
_camera_interface = new CameraInterfacePWM;
_camera_interface = new CameraInterfacePWM();
break;
#endif
default:
PX4_ERR("unknown camera interface mode: %i", (int)_camera_interface_mode);
break;
}
......
#ifdef __PX4_NUTTX
#include <sys/ioctl.h>
#include <lib/mathlib/mathlib.h>
......@@ -146,3 +148,5 @@ void CameraInterfacePWM::info()
{
warnx("PWM - interface, pin config: %d,%d,%d", _pins[0] + 1, _pins[1] + 1, _pins[2] + 1);
}
#endif /* ifdef __PX4_NUTTX */
......@@ -6,6 +6,8 @@
*/
#pragma once
#ifdef __PX4_NUTTX
#include <drivers/drv_hrt.h>
#include <systemlib/param/param.h>
......@@ -33,3 +35,5 @@ private:
bool _camera_is_on;
};
#endif /* ifdef __PX4_NUTTX */
#ifdef __PX4_NUTTX
#include "relay.h"
constexpr uint32_t CameraInterfaceRelay::_gpios[6];
......@@ -75,3 +76,5 @@ void CameraInterfaceRelay::info()
warnx("Relay - camera triggering, pins 1-3 : %d,%d,%d polarity : %s", _pins[0], _pins[1], _pins[2],
_polarity ? "ACTIVE_HIGH" : "ACTIVE_LOW");
}
#endif /* ifdef __PX4_NUTTX */
......@@ -6,6 +6,8 @@
*/
#pragma once
#ifdef __PX4_NUTTX
#include <systemlib/err.h>
#include <systemlib/param/param.h>
#include <board_config.h>
......@@ -43,3 +45,5 @@ private:
};
};
#endif /* ifdef __PX4_NUTTX */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment