资源简介
ili9342屏的驱动文件,可在安霸,海思上直接使用。里面有详细的初始化设置。
代码片段和文件信息
/**
* @file system/src/peripheral/vout/lcd_drv_ili9342c.c
*
* History:
* 2007/12/21 [John Yang] - created file
*
* Copyright (C) 2004-2007 Ambarella Inc.
*
* All rights reserved. No Part of this file may be reproduced stored
* in a retrieval system or transmitted in any form or by any means
* electronic mechanical photocopying recording or otherwise
* without the prior consent of Ambarella Inc.
*/
#include
#include
#include
#include
#include
#include
#define __VOUT_DEV_IMPL__
#include
#ifndef LCD_SPI_INST
#define LCD_SPI_INST 0xff
#endif
#ifndef LCD_SPI_ID
#define LCD_SPI_ID 0xff
#endif
#define BAUD_RATE 500000 /* default : 500k*/
#define SPI_MODE SPI_MODE0
#define SPI_DFS 0x8//0xf
#define I_OR_P_MODE 1 /* 0:interlace 1:progressive */
#define SATURATION_MAX_LVL 0x3f
#define SATURATION_DEF_LVL 0x20
#define SATURATION_ACT_RAGNE (SATURATION_MAX_LVL - SATURATION_DEF_LVL)
#define SATURATION_MID_LVL 0x80
static int m_lcd_is_shutdown = 1;
extern void rct_set_vout2_freq_hz(u32 freq_hz);
static void ili9342c_wr_reg(u16 *data int num)
{
spi_master_config(LCD_SPI_INST
LCD_SPI_ID SPI_MODE SPI_DFS BAUD_RATE);
spi_master_write(LCD_SPI_INST LCD_SPI_ID data num);
}
/**
* Initilzation function for LCD at through mode with
* vertical noninterlace mode
*/
static void ili9342c_init_ili9342c_960_240(int chan u8 ar)
{
vout_dev_t *dev;
lcd_dev_input_cfg_t cfg;
u32 hsync_width = YUV525I_Y_PELS_PER_LINE * 2;
u32 hsync_act_width = 960;
cfg.color_space = CS_RGB;
cfg.lcd_sync = INPUT_FORMAT_601;
if (I_OR_P_MODE) {
cfg.lcd_display = LCD_PROG_DISPLAY;
cfg.lcd_frame_rate = LCD_RGB240_DEFAULT_frame_RATE;
} else {
cfg.lcd_display = LCD_NTSC_DISPLAY;
cfg.lcd_frame_rate = LCD_RGB240_DEFAULT_frame_RATE;
}
if (I_OR_P_MODE) {
cfg.dclk_freq_hz = PLL_CLK_27_0514MHZ;
} else {
cfg.dclk_freq_hz = PLL_CLK_27MHZ;
}
/* Sync polarities */
cfg.hs_polarity = SYNC_LOW_ACTIVE;
cfg.vs_polarity = SYNC_LOW_ACTIVE;
/* frame timing */
cfg.ftime_hs = hsync_width;
cfg.ftime_vs_top = 263;
cfg.ftime_vs_bot = 263;
/* Hsync */
cfg.hs_start = 0;
cfg.hs_end = 1;
/* Vsync: top field */
cfg.vs_start_col_top = 0;
cfg.vs_start_row_top = 0;
cfg.vs_end_col_top = hsync_width - 1;
cfg.vs_end_row_top = 0;
/* Vsync: bottom field */
cfg.vs_start_col_bot = 0;
cfg.vs_start_row_bot = 0;
cfg.vs_end_col_bot = hsync_width - 1;
cfg.vs_end_row_bot = 0;
/* Active window */
cfg.act_start_col_top = 21;
cfg.act_end_col_top = 21 + (hsync_act_width - 1);
cfg.act_start_row_top = 2;
cfg.act_end_row_top = 2+ YUV525I_ACT_LINES_PER_FLD - 1;
/* Active window */
cfg.act_start_col_bot = 21;
cfg.act_end_col_bot = 21 + (hsync_act_width - 1);
cfg.act_start_row_bot = 2;
cfg.act_end_row_bot = 2 + YUV525I_ACT_LINES_PER_FLD - 1;
/* LCD contr
- 上一篇:iOS截屏相关头文件
- 下一篇:基于DSP与FPGA的变频器原理图
评论
共有 条评论