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

📄 usbshow.c

📁 Actions ucOS-II mp3方案源码,可以做参考
💻 C
字号:
/********************************************************************************
*                        SDK30F_D1
*                     music player main sub
*
*                (c) Copyright 2002, Actions Co,Ld.
*                        All Right Reserved
*
* File: usbshow.c
* By  : wurui
* Version: 1> v1.00     first version     2005-9-19 8:28
*
*  $Id: usbshow.C,v 1.1 2006/01/16 07:36:11 wurui Exp $
*******************************************************************************
*/

#include "message.h"
#include "res.h" 
#include "sdfs.h"
//#include "LCD_PHY_DRV.h"
#define LCD_CONT_SSD1332
typedef struct
{
    unsigned char    magic[4];        //'R', 'E', 'S', 0x19
    unsigned int    counts;            //资源的个数
    char    reserved[10];
}res_head_t;


typedef struct
{
    long    offset;            //文件内偏移
    unsigned int length;            //资源长度, 最大 64 K
    unsigned char type;            //资源类型, 1,pic, 2, string, 3,multi-string
    char    name[9];        //filename, \0 结尾
}res_entry_t;
extern SD_FILE *reshandle;

#ifdef LCD_CONT_SSD1332
non_banked void LCM_Para_Write_Command(int command,int count,int,int,int,int,int,int,int,int,int,int);
#else
non_banked void LCM_Write_Command(int Index,int Value);
#endif
non_banked void LCM_Write_Pixel(int Pixel);

#pragma codeseg(LCM_RCODE)
non_banked void LCM_DrawBmp(int id, int x, int y)
{
    unsigned char usbbuf[512];
    unsigned int buf[2];    //buffer for sd read
    int size;//第一个BUFFER 能放多少行数据
    int i,j,*ptr,m;
    res_head_t res_head;
    res_entry_t res_entry;

    SD_FSeek (reshandle, SEEK_SET, (long)id * sizeof(res_entry_t));
    SD_FRead (reshandle, &res_entry, sizeof(res_entry_t));         

    if (res_entry.type !=1) //不是图片退出
        return;

    SD_FSeek (reshandle, SEEK_SET, res_entry.offset);
    SD_FRead (reshandle, buf, sizeof(buf));        

    SD_FRead (reshandle, usbbuf, 512);
    ptr = (int *)usbbuf;
    m = 0;
    for(j = 0; j < buf[1]; j++)
    {
#ifdef LCD_CONT_SSD1332
        LCM_Para_Write_Command(0x75,0x02,j + y,0x3f,0,0,0,0,0,0,0,0);
#else
        LCM_Write_Command(0x0016,(y<<8)|0x7f);
#endif
        for(i = 0; i < buf[0]; i++, ptr++, m++)
        {
            if( m == 256 )
            {
                SD_FRead (reshandle, usbbuf, 512);
                ptr = (int *)usbbuf;
                m = 0;
            }
#ifdef LCD_CONT_SSD1332
            LCM_Para_Write_Command(0x15,0x02,i + x,0x5f,0,0,0,0,0,0,0,0);
#else
        	LCM_Write_Command(0x0017,(x<<8)|0x9f);
        	LCM_Write_Command(0x0021,(x<<8)|y);
#endif
            LCM_Write_Pixel(*ptr);
        }
    }
}
#pragma memory=default

⌨️ 快捷键说明

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