update credits
[librepilot.git] / flight / pios / inc / pios_video.h
blob8781aa9113dc47d6ca37e04d50d011cc0c7b3e56
1 /**
2 ******************************************************************************
3 * @addtogroup PIOS PIOS Core hardware abstraction layer
4 * @{
5 * @addtogroup PIOS_VIDEO Code for OSD video generator
6 * @brief OSD generator, Parts from CL-OSD and SUPEROSD project
7 * @{
9 * @file pios_video.h
10 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
11 * @brief OSD generator, Parts from CL-OSD and SUPEROSD projects
12 * @see The GNU Public License (GPL) Version 3
14 ******************************************************************************
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 3 of the License, or
20 * (at your option) any later version.
22 * This program is distributed in the hope that it will be useful, but
23 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 * for more details.
27 * You should have received a copy of the GNU General Public License along
28 * with this program; if not, write to the Free Software Foundation, Inc.,
29 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 #ifndef PIOS_VIDEO_H
33 #define PIOS_VIDEO_H
35 #include <pios_stm32.h>
36 #include <pios_spi_priv.h>
38 struct pios_video_cfg {
39 const struct pios_spi_cfg mask;
40 const struct pios_spi_cfg level;
42 const struct pios_exti_cfg *hsync;
43 const struct pios_exti_cfg *vsync;
45 struct pios_tim_channel pixel_timer;
46 struct pios_tim_channel hsync_capture;
48 TIM_OCInitTypeDef tim_oc_init;
51 // Time vars
52 typedef struct {
53 uint8_t sec;
54 uint8_t min;
55 uint8_t hour;
56 } TTime;
58 extern TTime timex;
60 extern void PIOS_Video_Init(const struct pios_video_cfg *cfg);
61 uint16_t PIOS_Video_GetOSDLines(void);
62 extern bool PIOS_Hsync_ISR();
63 extern bool PIOS_Vsync_ISR();
65 // First OSD line
66 #define GRAPHICS_LINE 25
68 // top/left deadband
69 #define GRAPHICS_HDEADBAND 80
70 #define GRAPHICS_VDEADBAND 0
72 #define PAL
74 // Real OSD size
75 #ifdef PAL
76 // #define GRAPHICS_WIDTH_REAL (352+GRAPHICS_HDEADBAND)
77 #define GRAPHICS_WIDTH_REAL 416
78 #define GRAPHICS_HEIGHT_REAL (270 + GRAPHICS_VDEADBAND)
79 #else
80 #define GRAPHICS_WIDTH_REAL (312 + GRAPHICS_HDEADBAND)
81 #define GRAPHICS_HEIGHT_REAL (225 + GRAPHICS_VDEADBAND)
82 #endif
84 // draw area
85 #define GRAPHICS_TOP 0
86 #define GRAPHICS_LEFT 0
87 #define GRAPHICS_BOTTOM (GRAPHICS_HEIGHT_REAL - GRAPHICS_VDEADBAND - 1)
88 #define GRAPHICS_RIGHT (GRAPHICS_WIDTH_REAL - GRAPHICS_HDEADBAND - 1)
91 #define GRAPHICS_WIDTH (GRAPHICS_WIDTH_REAL / 8)
92 #define GRAPHICS_HEIGHT GRAPHICS_HEIGHT_REAL
94 // dma lenght
95 #define BUFFER_LINE_LENGTH (GRAPHICS_WIDTH) // Yes, in bytes.
97 // line types
98 #define LINE_TYPE_UNKNOWN 0
99 #define LINE_TYPE_GRAPHICS 2
101 // Macro to swap buffers given a temporary pointer.
102 #define SWAP_BUFFS(tmp, a, b) { tmp = a; a = b; b = tmp; }
104 #endif /* PIOS_VIDEO_H */