44 #define commandParamToInt(n) static_cast<int>(n >= 0 ? n + 0.5f : n - 0.5f) 52 ScheduledWorkItem(MODULE_NAME,
px4::wq_configurations::lp_default)
114 bool publish =
false;
152 trigger.feedback =
true;
178 if (cmd.command == vehicle_command_s::VEHICLE_CMD_DO_TRIGGER_CONTROL) {
199 command_ack.command = cmd.command;
200 command_ack.result = (uint8_t)vehicle_command_s::VEHICLE_CMD_RESULT_ACCEPTED;
201 command_ack.target_system = cmd.source_system;
202 command_ack.target_component = cmd.source_component;
212 #if !defined CONFIG_ARCH_BOARD_AV_X_V1 217 PX4_ERR(
"open fail");
240 unsigned int capture_count = 0;
243 PX4_INFO(
"Not in a capture mode");
248 PX4_INFO(
"Mode changed to 4PWM2CAP");
251 PX4_ERR(
"Mode NOT changed to 4PWM2CAP!");
262 PX4_ERR(
"Unable to set capture callback for chan %u\n", conf.channel);
277 #if !defined CONFIG_ARCH_BOARD_AV_X_V1 309 ScheduleOnInterval(100000, 10000);
342 PX4_INFO(
"usage: camera_capture {start|stop|on|off|reset|status}\n");
354 if (!strcmp(argv[1],
"start")) {
357 PX4_WARN(
"already running");
364 PX4_WARN(
"alloc failed");
378 PX4_WARN(
"not running");
381 }
else if (!strcmp(argv[1],
"stop")) {
384 }
else if (!strcmp(argv[1],
"status")) {
387 }
else if (!strcmp(argv[1],
"on")) {
390 }
else if (!strcmp(argv[1],
"off")) {
393 }
else if (!strcmp(argv[1],
"reset")) {
#define PX4FMU_DEVICE_PATH
hrt_abstime _last_exposure_time
int start()
Start the task.
static int gpio_interrupt_routine(int irq, void *context, void *arg)
void stop()
Stop the task.
__EXPORT int param_get(param_t param, void *val)
Copy the value of a parameter.
void capture_callback(uint32_t chan_index, hrt_abstime edge_time, uint32_t edge_state, uint32_t overflow)
__EXPORT int camera_capture_main(int argc, char *argv[])
#define commandParamToInt(n)
ringbuffer::RingBuffer * _trig_buffer
bool publish(const T &data)
Publish the struct.
hrt_abstime _last_trig_begin_time
int32_t _camera_capture_edge
uORB::Publication< camera_trigger_s > _trigger_pub
void reset_statistics(bool reset_seq)
static struct work_s _work_publisher
bool publish(const T &data)
Publish the struct.
uint32_t _capture_overflows
static void capture_trampoline(void *context, uint32_t chan_index, hrt_abstime edge_time, uint32_t edge_state, uint32_t overflow)
struct CameraCapture::_trig_s _trigger
CameraCapture()
Constructor.
__BEGIN_DECLS typedef uint64_t hrt_abstime
Absolute time, in microsecond units.
#define PWM_SERVO_MODE_4PWM2CAP
CameraCapture * g_camera_capture
__EXPORT param_t param_find(const char *name)
Look up a parameter by name.
param_t _p_camera_capture_edge
#define PWM_SERVO_SET_MODE
int32_t _camera_capture_mode
hrt_abstime _last_trig_time
void set_capture_control(bool enabled)
~CameraCapture()
Destructor, also kills task.
uORB::PublicationQueued< vehicle_command_ack_s > _command_ack_pub
static void publish_trigger_trampoline(void *arg)
bool update(void *dst)
Update the struct.
param_t _p_camera_capture_mode
uORB::Subscription _command_sub
__EXPORT hrt_abstime hrt_absolute_time(void)
Get absolute time in [us] (does not wrap).