• 大小: 4.74MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-15
  • 语言: 其他
  • 标签: stm32  fsmc  fpga  

资源简介

3位地址线,16位数据线,RD WR CS控制信号片选信号,控制fsmc与fpga通信。

资源截图

代码片段和文件信息

/*
 * File : bmp.c
 * Description : This file is ...
 * Author : XiaomaGee@Gmail.com
 * Copyright :
 *
 * History
 ****--------------------
 * Rev : 0.00
 * Date : 08/12/2012
 *
 * create.
 ****--------------------
 */

//----------------- Include files ------------------------//
#include 
#include 

#include “..\include\bmp.h“
#include “..\fatfs\ff.h“
#include “..\include\tft.h“
#include “..\include\color.h“

//----------------- Define -------------------------------//

//----------------- Function Prototype -------------------//
static int get_header_info(char * file BMP_HEADER_T *);
static int show(char * file int x int y);
static int capture(void);

//----------------- Variable -----------------------------//
BMP_T bmp = {
.header = get_header_info
.show = show
.capture = capture
};

static FIL f;

//----------------- Function -----------------------------//
/*
 * Name : get_header_info
 * Description : ---
 * Author : XiaomaGee.
 *
 * History
 * -----------------------
 * Rev : 0.00
 * Date         : 00/00/2012
 *
 * create.
 * ----------------------
 */
static int
get_header_info(char * file BMP_HEADER_T *h)
{
FRESULT res;

char *p = (char*)h;
unsigned int counter;

res = f_open(&f file FA_READ);
if (res != FR_OK) return -1;

res = f_read(&f p sizeof(BMP_HEADER_T) &counter);
if (res != FR_OK) return -1;

f_close(&f);

if (h->type[0] != ‘B‘ || h->type[1] != ‘M‘) return -1;

return 0;
}

/* Name : show
 * Description : ---
 * Author : XiaomaGee.
 *
 * History
 * -----------------------
 * Rev : 0.00
 * Date         : 00/00/2012
 *
 * create.
 * ----------------------
 */
static int
show(char * file int x int y)
{
int i j;
int line_byte;
unsigned int counter;
char buffer[LINE_PIXEL * 3];
unsigned short int *p;
unsigned short int a b;
unsigned char color_table[1024];
unsigned char c;
BMP_HEADER_T bh;

if (get_header_info(file &bh) != 0) return -1;

f_open(&f file FA_READ);

switch (bh.bit_count) {
case 1:
f_lseek(&f 0x36);
f_read(&f color_table 2 * 4 &counter);

line_byte = ceil(bh.width / 8);

if (line_byte % 4) line_byte = ((line_byte / 4) + 1) * 4;

f_lseek(&f bh.offset);

for (i = 0; i < bh.height; i++) {
f_read(&f buffer line_byte &counter);

lcd_csrx(x);                        //set x csr
lcd_csry(y + bh.height - i - 1);    //set y csr

lcd_ctl.b.csrmode = CSRMODE_H;      //set csr increase direction
lcd_ctl(lcd_ctl.w);

tft.write_command(0x0022);          //write data

for (j = 0; j < bh.width; j++) {
if (buffer[j / 8] & 1 << (7 - j % 8)) tft.write_data(make_rgb565(color_table[6] color_table[5] color_table[4]));
else tft.write_data(make_rgb565(color_table[2] color_table[1] color_table[0]));
}
}
break;
case 4:
f_lseek(&f 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2012-10-31 17:48  pub_iCore_fsmc_fpga\
     目录           0  2012-10-31 17:48  pub_iCore_fsmc_fpga\FPGA\
     目录           0  2012-10-31 15:48  pub_iCore_fsmc_fpga\FPGA\.qsys_edit\
     文件          69  2012-05-01 23:49  pub_iCore_fsmc_fpga\FPGA\.qsys_edit\filters.xml
     文件         619  2012-05-02 00:48  pub_iCore_fsmc_fpga\FPGA\.qsys_edit\preferences.xml
     目录           0  2012-10-31 15:48  pub_iCore_fsmc_fpga\FPGA\.sopc_builder\
     文件          66  2012-06-29 22:14  pub_iCore_fsmc_fpga\FPGA\.sopc_builder\filters.xml
     文件         498  2012-06-29 22:14  pub_iCore_fsmc_fpga\FPGA\.sopc_builder\preferences.xml
     文件        1836  2012-05-06 02:42  pub_iCore_fsmc_fpga\FPGA\csta.bsf
     文件        3528  2012-05-06 02:42  pub_iCore_fsmc_fpga\FPGA\csta.vhd
     文件        1836  2012-05-06 02:44  pub_iCore_fsmc_fpga\FPGA\cstb.bsf
     文件        3534  2012-05-06 02:44  pub_iCore_fsmc_fpga\FPGA\cstb.vhd
     文件        2072  2012-05-01 20:10  pub_iCore_fsmc_fpga\FPGA\CT24.bsf
     文件         915  2012-05-01 20:10  pub_iCore_fsmc_fpga\FPGA\CT24.cmp
     文件         357  2012-05-01 20:10  pub_iCore_fsmc_fpga\FPGA\CT24.qip
     文件        4221  2012-05-01 20:10  pub_iCore_fsmc_fpga\FPGA\CT24.vhd
     目录           0  2012-10-31 17:47  pub_iCore_fsmc_fpga\FPGA\db\
     文件        3563  2012-05-06 01:55  pub_iCore_fsmc_fpga\FPGA\DECODER_3_8.bsf
     文件        1132  2012-05-06 01:55  pub_iCore_fsmc_fpga\FPGA\DECODER_3_8.cmp
     文件         377  2012-05-06 01:56  pub_iCore_fsmc_fpga\FPGA\DECODER_3_8.qip
     文件        5953  2012-05-06 01:55  pub_iCore_fsmc_fpga\FPGA\DECODER_3_8.vhd
     文件        4962  2012-05-27 04:12  pub_iCore_fsmc_fpga\FPGA\EP4CE6E144_2.tcl
     文件        5867  2012-05-02 00:14  pub_iCore_fsmc_fpga\FPGA\EP4CE6E144_2.tcl.bak
     文件        5863  2012-05-01 20:11  pub_iCore_fsmc_fpga\FPGA\EP4CE6E144_2.tcl~
     文件        1779  2012-05-06 02:01  pub_iCore_fsmc_fpga\FPGA\fd16.bsf
     文件         120  2012-05-06 02:01  pub_iCore_fsmc_fpga\FPGA\fd16.v
     目录           0  2012-10-31 15:48  pub_iCore_fsmc_fpga\FPGA\flash\
     文件       22336  2012-05-27 05:16  pub_iCore_fsmc_fpga\FPGA\flash\iCore_niosII_epcs_flash_controller_0.flash
     文件       22336  2012-05-15 16:19  pub_iCore_fsmc_fpga\FPGA\flash\icore_nsoft_epcs_flash_controller_0.flash
     文件        5538  2012-10-31 16:56  pub_iCore_fsmc_fpga\FPGA\fsmc.bsf
     文件        2217  2012-10-31 17:09  pub_iCore_fsmc_fpga\FPGA\fsmc.v
............此处省略252个文件信息

评论

共有 条评论