⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 osd.c

📁 C语言编写的监控中心终端程序。基于GPRS上传收发数据功能
💻 C
字号:
#include "config.h"
#include "memmap.h"
#include "global.h"
#include "dma.h"
#include "mon.h"
#include "func.h"
#include "osd.h"
#include "osdfont.h"
#include "stdlib.h"
#include "endian.h"
#include "osd_init.h"

#undef	OSD_SHADE

#if SUPPORT_OSD
t_osd_region		region[8];

#define	OSD_STATUS_DELAY	5		// x Second
static BYTE		MenuPrintTimer;

static BYTE		IsShadeRegion;

#define SUPPORT_OSD_COLOR4	1
#define	SUPPORT_OSD_COLOR16	0

#define	COLOR_BACK		0
#define	COLOR_BORDER		2
#define	COLOR_FORE		3
#define	CHAR_SEPARATOR		1
#define	LINE_SPACE		16

#define	COLOR4			1

// 0 -> 00(OSD background)
// 1 -> 01(anti background)
static const BYTE	PatternEdge[] = {	// Detect Edge
    0x00,		// 0000 0000 0000
    0x01,		// 0001 0000 0001
    0x04,		// 0010 0000 0100
    0x05,		// 0011 0000 0101
    0x10,		// 0100 0001 0000
    0x11,		// 0101 0001 0001
    0x14,		// 0110 0001 0100
    0x15,		// 0111 0001 0101
    0x40,		// 1000 0100 0000
    0x41,		// 1001 0100 0001
    0x44,		// 1010 0100 0100
    0x45,		// 1011 0100 0101
    0x50,		// 1100 0101 0000
    0x51,		// 1101 0101 0001
    0x54,		// 1110 0101 0100
    0x55, 		// 1111 0101 0101
};

// 0 -> 00(OSD background)
// 1 -> 11(font color : yellow-green)
// font boundary(only horizontal) -> 01(anti-background)
static const BYTE	pattern_4Normal[] = {		// old:pattern_4
    0x00,		// 0000 0000 0000
    0x07,		// 0001 0000 0111
    0x1d,		// 0010 0001 1101
    0x1f,		// 0011 0001 1111
    0x74,		// 0100 0111 0100
    0x77,		// 0101 0111 0111
    0x7d,		// 0110 0111 1101
    0x7f,		// 0111 0111 1111
    0xd0,		// 1000 1101 0000
    0xd7,		// 1001 1101 0111
    0xdd,		// 1010 1101 1101
    0xdf,		// 1011 1101 1111
    0xf4,		// 1100 1111 0100
    0xf7,		// 1101 1111 0111
    0xfd,		// 1110 1111 1101
    0xff,		// 1111 1111 1111
};

// 0 -> 00(OSD background : STD_BLACK)
// 1 -> 11(font color : STD_WHITE)
static const BYTE	pattern_setup[] = {		// setup menu normal
    0x00,		// 0000 0000 0000
    0x03,		// 0001 0000 0011
    0x0c,		// 0010 0000 1100
    0x0f,		// 0011 0000 1111
    0x30,		// 0100 0011 0000
    0x33,		// 0101 0011 0011
    0x3c,		// 0110 0011 1100
    0x3f,		// 0111 0011 1111
    0xc0,		// 1000 1100 0000
    0xc3,		// 1001 1100 0011
    0xcc,		// 1010 1100 1100
    0xcf,		// 1011 1100 1111
    0xf0,		// 1100 1111 0000
    0xf3,		// 1101 1111 0011
    0xfc,		// 1110 1111 1100
    0xff,		// 1111 1111 1111
};

// 0 -> 00(OSD background : STD_BLACK)
// 1 -> 01(font color : STD_GREEN)
static const BYTE	pattern_setup_anti[] = {	//setup menu anti
    0x00,		// 0000 0000 0000
    0x01,		// 0001 0000 0001
    0x04,		// 0010 0000 0100
    0x05,		// 0011 0000 0101
    0x10,		// 0100 0001 0000
    0x11,		// 0101 0001 0001
    0x14,		// 0110 0001 0100
    0x15,		// 0111 0001 0101
    0x40,		// 1000 0100 0000
    0x41,		// 1001 0100 0001
    0x44,		// 1010 0100 0100
    0x45,		// 1011 0100 0101
    0x50,		// 1100 0101 0000
    0x51,		// 1101 0101 0001
    0x54,		// 1110 0101 0100
    0x55,		// 1111 0101 0101
};

// 0 -> 10(OSD background : STD_MAGENTA)
// 1 -> 01(font color : STD_WHITE)
static const BYTE	pattern_setup_title[] = {	// setup menu title
    0xaa,		// 0000 1010 1010
    0xab,		// 0001 1010 1011
    0xae,		// 0010 1010 1110
    0xaf,		// 0011 1010 1111
    0xba,		// 0100 1011 1010
    0xbb,		// 0101 1011 1011
    0xbe,		// 0110 1011 1110
    0xbf,		// 0111 1011 1111
    0xea,		// 1000 1110 1010
    0xeb,		// 1001 1110 1011
    0xee,		// 1010 1110 1110
    0xef,		// 1011 1110 1111
    0xfa,		// 1100 1111 1010
    0xfb,		// 1101 1111 1011
    0xfe,		// 1110 1111 1110
    0xff,		// 1111 1111 1111
};

// 0 -> 10(transparent background)
// 1 -> 11(font color : yellow-green)
/*
static const BYTE	pattern_4Prog[] = {		// old:pattern_a4
    0xaa,		// 0000 1010 1010
    0xab,		// 0001 1010 1011 
    0xad,		// 0010 1010 1110
    0xaf,		// 0011 1010 1111
    0xba,		// 0100 1011 1010
    0xbb,		// 0101 1011 1011
    0xbd,		// 0110 1011 1110 
    0xbf,		// 0111 1011 1111
    0xda,		// 1000 1110 1010 
    0xdb,		// 1001 1110 1011 
    0xdd,		// 1010 1110 1110 
    0xdf,		// 1011 1110 1111
    0xfa,		// 1100 1111 1010
    0xfb,		// 1101 1111 1011
    0xfd,		// 1110 1111 1110
    0xff,		// 1111 1111 1111
};
*/

//-------------------------------------------------------------------//
#ifdef SUPPORT_OSD_COLOR4

#define	COLOR0			0x01
#define	COLOR1			0x03
#undef	COLOR0
#undef	COLOR1

#ifdef OSD_SHADE
static const UINT16	palette_4color[] = {
    0,			// __palette2F(0x50, 0x70, 0x70, 0, 0),    // shade behind font // 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -