Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
cv.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015
3  *
4  * This file is part of Paparazzi.
5  *
6  * Paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * Paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, see
18  * <http://www.gnu.org/licenses/>.
19  *
20  */
21 
29 #ifndef CV_H_
30 #define CV_H_
31 
32 #include <pthread.h>
33 
34 #include "std.h"
36 
37 #include BOARD_CONFIG
38 
39 typedef struct image_t *(*cv_function)(struct image_t *img, uint8_t camera_id);
40 
41 struct cv_async {
42  pthread_t thread_id;
43  volatile bool thread_running;
44  volatile int thread_priority;
45  pthread_mutex_t img_mutex;
46  pthread_cond_t img_available;
47  volatile bool img_processed;
48  struct image_t img_copy;
49 };
50 
53  struct cv_async *async;
54  struct timeval ts;
57 
58  // Can be set by user
60  volatile bool active;
61 };
62 
63 extern bool add_video_device(struct video_config_t *device);
64 
65 extern struct video_listener *cv_add_to_device(struct video_config_t *device, cv_function func, uint16_t fps, uint8_t id);
66 extern struct video_listener *cv_add_to_device_async(struct video_config_t *device, cv_function func, int nice_level,
67  uint16_t fps, uint8_t id);
68 
69 extern void cv_run_device(struct video_config_t *device, struct image_t *img);
70 
71 #endif /* CV_H_ */
uint16_t maximum_fps
Definition: cv.h:59
struct video_listener * cv_add_to_device(struct video_config_t *device, cv_function func, uint16_t fps, uint8_t id)
Definition: cv.c:46
pthread_t thread_id
Definition: cv.h:42
struct cv_async * async
Definition: cv.h:53
volatile bool active
Definition: cv.h:60
volatile int thread_priority
Definition: cv.h:44
void cv_run_device(struct video_config_t *device, struct image_t *img)
Definition: cv.c:178
struct timeval ts
Definition: cv.h:54
volatile bool thread_running
Definition: cv.h:43
cv_function func
Definition: cv.h:55
uint8_t id
Definition: cv.h:56
struct image_t img_copy
Definition: cv.h:48
struct video_listener * next
Definition: cv.h:52
volatile bool img_processed
Definition: cv.h:47
pthread_cond_t img_available
Definition: cv.h:46
bool add_video_device(struct video_config_t *device)
Keep track of video devices added by modules.
Definition: video_thread.c:197
struct image_t *(* cv_function)(struct image_t *img, uint8_t camera_id)
Definition: cv.h:39
pthread_mutex_t img_mutex
Definition: cv.h:45
struct video_listener * cv_add_to_device_async(struct video_config_t *device, cv_function func, int nice_level, uint16_t fps, uint8_t id)
Definition: cv.c:83
Definition: cv.h:41
Definition: image.h:44
V4L2 device settings.
Definition: video_device.h:55
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
Definition: vl53l1_types.h:88
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98