2013-04-07 08:49:13 +02:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
* @addtogroup PIOS PIOS Core hardware abstraction layer
|
|
|
|
* @{
|
|
|
|
* @addtogroup PIOS_VIDEO Code for OSD video generator
|
|
|
|
* @brief OSD generator, Parts from CL-OSD and SUPEROSD project
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file pios_video.h
|
|
|
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
|
|
|
* @brief OSD generator, Parts from CL-OSD and SUPEROSD projects
|
|
|
|
* @see The GNU Public License (GPL) Version 3
|
|
|
|
*
|
|
|
|
******************************************************************************
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PIOS_VIDEO_H
|
|
|
|
#define PIOS_VIDEO_H
|
|
|
|
|
|
|
|
#include <pios_stm32.h>
|
|
|
|
#include <pios_spi_priv.h>
|
|
|
|
|
|
|
|
struct pios_video_cfg {
|
2013-05-18 14:17:26 +02:00
|
|
|
const struct pios_spi_cfg mask;
|
|
|
|
const struct pios_spi_cfg level;
|
2013-04-07 08:49:13 +02:00
|
|
|
|
2013-05-18 14:17:26 +02:00
|
|
|
const struct pios_exti_cfg *hsync;
|
|
|
|
const struct pios_exti_cfg *vsync;
|
2013-04-07 08:49:13 +02:00
|
|
|
|
2013-05-18 14:17:26 +02:00
|
|
|
struct pios_tim_channel pixel_timer;
|
|
|
|
struct pios_tim_channel hsync_capture;
|
2013-04-07 08:49:13 +02:00
|
|
|
|
2013-05-18 14:17:26 +02:00
|
|
|
TIM_OCInitTypeDef tim_oc_init;
|
2013-04-07 08:49:13 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// Time vars
|
|
|
|
typedef struct {
|
2013-05-18 14:17:26 +02:00
|
|
|
uint8_t sec;
|
|
|
|
uint8_t min;
|
|
|
|
uint8_t hour;
|
2013-04-07 08:49:13 +02:00
|
|
|
} TTime;
|
|
|
|
|
|
|
|
extern TTime timex;
|
|
|
|
|
2013-05-18 14:17:26 +02:00
|
|
|
extern void PIOS_Video_Init(const struct pios_video_cfg *cfg);
|
2013-04-07 08:49:13 +02:00
|
|
|
uint16_t PIOS_Video_GetOSDLines(void);
|
|
|
|
extern bool PIOS_Hsync_ISR();
|
|
|
|
extern bool PIOS_Vsync_ISR();
|
|
|
|
|
|
|
|
// First OSD line
|
2013-05-18 14:17:26 +02:00
|
|
|
#define GRAPHICS_LINE 25
|
2013-04-07 08:49:13 +02:00
|
|
|
|
2013-05-18 14:17:26 +02:00
|
|
|
// top/left deadband
|
2013-04-07 08:49:13 +02:00
|
|
|
#define GRAPHICS_HDEADBAND 80
|
|
|
|
#define GRAPHICS_VDEADBAND 0
|
|
|
|
|
|
|
|
#define PAL
|
|
|
|
|
|
|
|
// Real OSD size
|
|
|
|
#ifdef PAL
|
2013-05-18 14:17:26 +02:00
|
|
|
// #define GRAPHICS_WIDTH_REAL (352+GRAPHICS_HDEADBAND)
|
|
|
|
#define GRAPHICS_WIDTH_REAL 416
|
|
|
|
#define GRAPHICS_HEIGHT_REAL (270 + GRAPHICS_VDEADBAND)
|
2013-04-07 08:49:13 +02:00
|
|
|
#else
|
2013-05-18 14:17:26 +02:00
|
|
|
#define GRAPHICS_WIDTH_REAL (312 + GRAPHICS_HDEADBAND)
|
|
|
|
#define GRAPHICS_HEIGHT_REAL (225 + GRAPHICS_VDEADBAND)
|
2013-04-07 08:49:13 +02:00
|
|
|
#endif
|
|
|
|
|
2013-05-18 14:17:26 +02:00
|
|
|
// draw area
|
|
|
|
#define GRAPHICS_TOP 0
|
|
|
|
#define GRAPHICS_LEFT 0
|
|
|
|
#define GRAPHICS_BOTTOM (GRAPHICS_HEIGHT_REAL - GRAPHICS_VDEADBAND - 1)
|
|
|
|
#define GRAPHICS_RIGHT (GRAPHICS_WIDTH_REAL - GRAPHICS_HDEADBAND - 1)
|
2013-04-07 08:49:13 +02:00
|
|
|
|
|
|
|
|
2013-05-18 14:17:26 +02:00
|
|
|
#define GRAPHICS_WIDTH (GRAPHICS_WIDTH_REAL / 8)
|
|
|
|
#define GRAPHICS_HEIGHT GRAPHICS_HEIGHT_REAL
|
2013-04-07 08:49:13 +02:00
|
|
|
|
|
|
|
// dma lenght
|
2013-05-18 14:17:26 +02:00
|
|
|
#define BUFFER_LINE_LENGTH (GRAPHICS_WIDTH) // Yes, in bytes.
|
2013-04-07 08:49:13 +02:00
|
|
|
|
|
|
|
// line types
|
2013-05-18 14:17:26 +02:00
|
|
|
#define LINE_TYPE_UNKNOWN 0
|
|
|
|
#define LINE_TYPE_GRAPHICS 2
|
2013-04-07 08:49:13 +02:00
|
|
|
|
|
|
|
// Macro to swap buffers given a temporary pointer.
|
|
|
|
#define SWAP_BUFFS(tmp, a, b) { tmp = a; a = b; b = tmp; }
|
|
|
|
|
|
|
|
#endif /* PIOS_VIDEO_H */
|