📄 def.h
字号:
#define Trigger(x) x = 1; while (x);
#define Power_Down() PCON|=0x02
#define Power_Idle() PCON|=0x01
// System Status
enum
{
STATUS_STOP = 0,
// STATUS_READY,
STATUS_PLAY,
STATUS_PAUSE,
STATUS_DOWNLOAD
};
/*
//usb command
#define usbRESET 0x10
#define usbFORMAT 0x20
#define usbDOWNLOAD 0x30
#define usbUPLOAD 0x40
#define usbERASE 0x50
#define usbREFRESH 0x60
#define usbEXIT 0x70
#define usbMEM_INFO 0x80
// usb request, acknowledge
enum
{
// USB_READY = 1,
// USB_BULK_IN = 6,
// USB_FORMAT_SM = 14,
USB_READY = 0,
RESET_START,
RESET_END,
FORMAT_START,
FORMAT_END,
ERASE_START,
ERASE_END,
DOWNLOAD_START,
DOWNLOAD_END,
UPLOAD_START,
UPLOAD_END,
EXIT_START,
EXIT_END,
MEM_INFO_START,
MEM_INFO_END,
START,
BAD_END,
GOOD_END,
ERROR
};
*/
//usb command
#define usbRESET 0x00
#define usbMEM_INFO 0x10
#define usbFORMAT 0x20
#define usbREAD_FAT 0x30
#define usbWRITE_FAT 0x40
#define usbREAD_RD 0x50
#define usbWRITE_RD 0x60
#define usbDOWNLOAD 0x70
#define usbUPLOAD 0x80
#define usbDELETE 0x90
#define usbREFRESH 0xA0
#define usbEXIT 0xB0
#define usbCHANGE_ORDER 0xC0
// usb request, acknowledge
enum
{
USB_READY = 0,
START,
END,
SYSTEM_AREA_ERROR,
REMAINED_MEM_ERROR,
START_BLOCK_ERROR,
BAD_BLOCK_ERROR,
UNKNOWN_RESPONSE_ERROR,
REFRESHED
};
// usb option
#define SELECT_BIM (Command[1]&0x01) == 0
#define SELECT_SMC (Command[1]&0x01) == 1
//#define SELECT_FAT (Command[1]&0x02) == 0
//#define SELECT_SONG (Command[1]&0x02) == 1
#define USB_Select_BIM() Command[1] = Command[1] & 0xfe
#define USB_Select_SMC() Command[1] = Command[1] | 0x01
#define USB_Select_FAT() Command[1] = Command[1] & 0xfd
#define USB_Select_SONG() Command[1] = Command[1] | 0x02
// Key Definition
/*
#define NONE_KEY 0xff // b'11111111'
#define PLAY_KEY 0xfe // b'11111110'
#define STOP_KEY 0xfd // b'11111101'
#define FF_KEY 0xfb // b'11111011'
#define RW_KEY 0xf7 // b'11110111'
#define BASS_KEY 0xef // b'11101111'
#define TREBLE_KEY 0xdf // b'11011111'
#define DOWN_KEY 0xbf // b'10111111'
#define UP_KEY 0x7f // b'01111111'
*/
#define NONE_KEY 0xff // b'11111111'
#define PLAY_KEY 0xfe // b'11111110'
#define BASS_KEY 0xfd // b'11111101'
//#define STOP_KEY 0xfd // b'11111101'
#define RW_KEY 0xfb // b'11111011'
#define FF_KEY 0xf7 // b'11110111'
//#define TREBLE_KEY 0xdf // b'11011111'
#define DOWN_KEY 0xef // b'11101111'
#define UP_KEY 0xdf // b'11011111'
#define REPEAT_KEY 0xbf // b'10111111'
#define AUTO_OFF_TIME 2 // minutes
//---------------------------------------------------------
// Equalizer
//---------------------------------------------------------
// Max EQ
#define MAX_VOLUME 40 // Limite = 56
#define MAX_BASS 20
#define MAX_TREBLE 20
// default EQ
#define DEFAULT_VOLUME 20
#define DEFAULT_BASS 10
#define DEFAULT_TREBLE 10
// Mode Change
enum
{
NORMAL_MODE = 0, BASS_UP_MODE, TREBLE_UP_MODE, BASS_TREBLE_UP_MODE
};
enum
{
MODE1 = 0, MODE2, MODE3, MODE4, MODE5
};
/*
#define Normal_Mode() EQ_Mode_Change(7, 7, NORMAL_MODE)
#define Bass_Up_Mode() EQ_Mode_Change(13, 5, BASS_UP_MODE)
#define Treble_Up_Mode() EQ_Mode_Change(5, 13, TREBLE_UP_MODE)
#define Bass_Treble_Up_Mode() EQ_Mode_Change(13, 13, BASS_TREBLE_UP_MODE)
#define Mode1() EQ_Mode_Change(5, 5, MODE1)
#define Mode2() EQ_Mode_Change(10, 10, MODE2)
#define Mode3() EQ_Mode_Change(15, 15, MODE3)
#define Mode4() EQ_Mode_Change(15, 5, MODE4)
#define Mode5() EQ_Mode_Change(5, 15, MODE5)
*/
//---------------------------------------------------------
//
//---------------------------------------------------------
#define DWORD 0x32
#define WORD 0x16
#define BYTE 0x8
#define PAGE_SIZE 512
#define BLOCK_SIZE 512*32
#define BIM 0
#define SMC 1
#define BULK_TIME_OUT 100000
#define PAGES_PER_64MBYTES 131072 //2048*64
#define BLOCKS_OF_64MB 4096
// offset, location ------------------------------------------------------------------
#define VALID_BLOCK 0x1234
#define UNUSED_BLOCK 0xFFFF
//#define BAD_BLOCK 0xFFF7
#define START_BLOCK 0xFFFA
#define LAST_BLOCK 0xFFFB
/*
#define FAT0_PAGE_OFFSET 0
#define FAT1_PAGE_OFFSET 32
#define FAT2_PAGE_OFFSET 64
#define RD0_PAGE_OFFSET 96
#define RD1_PAGE_OFFSET 128
#define FILE_AREA_PAGE_OFFSET 160
*/
//#define FAT0_BLOCK_OFFSET 0
//#define FAT1_BLOCK_OFFSET 1
//#define FAT2_BLOCK_OFFSET 2
#define MEM_INFO_INDEX 0
#define RD0_BLOCK_INDEX 1
#define RD1_BLOCK_INDEX 2
#define FILE_AREA_BLOCK_INDEX 5
// Root Directory byte address location
#define FILE_NAME_LOCATION 0
#define FILE_START_BLOCK_LOCATION 134
#define FILE_BYTE_LOCATION 136
#define BIT_RATE_LOCATION 140
#define MP3_OR_GF_LOCATION 142
#define FILE_START_BLOCK_INDEX 508
#define FILE_LAST_BLOCK_INDEX 510
// FAT page address location
//#define VERIFY_DATA_LOCATION 0
//#define NEXT_BLOCK_INFO_LOCATION 1
#define PREV_CHECK_LOCATION 0
#define NEXT_CHECK_LOCATION 1
#define VALID_CHECK_LOCATION 2
// ----------------------------------------------------------
#define FAIL 0
#define PASS 1
#define FORMAT_MARK 0x7a
//---------------------------------------------------------
// Variable
//---------------------------------------------------------
xByte AuxRam[512] _at_ 0;
Bit Display_FAT_En=0;
Bit ADC_Enable = 0;
Bit SMC_In_Out;
//Byte Temp;
Bit BIM_Exist, SMC_Exist, Mem_Select, Is_MP3, Formatted;
// USB
Bit Error, UID_Transfered;
Byte USB_Command_Temp[8];
Byte UsbInterruptData;
Bit UsbCommandIn;
Byte USB_Command[8];
Bit BIM_Refreshed, SMC_Refreshed;
// play
Bit RW_Enable, FF_Enable;
Byte Play_Cnt;
Byte SystemStatus;
Dword File_Pages, File_Bytes, Last_Pages;
Word File_Start_Block, File_Last_Block, File_Blocks;
Dword Total_Played_Pages;
Word Total_Played_Blocks;
Word Play_Block;
Byte Play_Page;
//Word Download_Blocks;
//Word Download_Start_Block, Download_Blocks;
//Dword Download_Start_Page, Download_Pages;
// Flash Memory
// Word Verify_Data, Next_Block;
//Dword SMC_Pages, Mem1_Pages, Mem2_Pages, Total_Mem_Pages, Used_Mem_Pages;
Word SMC_Blocks, Mem1_Blocks, Mem2_Blocks, BIM_Blocks, Total_Mem_Blocks, Current_Flash_Mem_Blocks;
Bit SMC_Over64, Mem1_Over64, Mem2_Over64;
//Byte SMC_Mbytes, Mem1_Mbytes, Mem2_Mbytes, Total_Mem_Mbytes, Used_Mem_Mbytes;
Byte Current_Flash_Mem_Files;
Word Unused_Blocks, File_Blocks, Bad_Blocks;
//, Downloaded_Blocks, Remained_Downloading_Blocks;
//Dword Mp3IndexPage;
//Word Mp3IndexByte;
// for only display
/*
Word Block;
Dword Page;
Dword Pages;
*/
//-----------------
//Word Bit_Rate;
//Byte Page_Per_Sec;
Bit I2C_Error;
Byte Volume, Bass, Treble, EQ_Mode;
Byte BIM_Files, SMC_Files, Total_Files, MP3_Files, File_Num;
// Key
Bit Released, Same_Key, Time0_Over, Hold, Hold_Changed;
Byte Key_Time, Old_Key_Input, Old_Key_Code, Key_Code;
Word Time0, Time0_Turn;
Bit Power_Off_Time;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -