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

📄 constants.h

📁 fat文件系统的源码 老外写的FAT32文件系统 还是有用的
💻 H
字号:
/*
  Written by:	Nikolai Vorontsov <nickviz@mail.be>

  Idea by :	Jesper Hansen <jesperh@telia.com>

  Rewritten by : Romuald Bialy (aka MIS) <romek_b@o2.pl>


  This file is part of the yampp system.

  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  as published by the Free Software Foundation; either version 2
  of the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software Foundation, 
  Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/


#ifndef __CONST_H__
#define __CONST_H__

// Here is some constants are defined.

//============================================================================
// BOARD VERSION
//============================================================================
//
// If you have a new YAMPP3-USB version of board based on AT_MEGA161 - 
// uncomment the following line, and change CPU type in makefile
//#define YAMPP3USB


//============================================================================
// VS1001
//============================================================================
//
// Define F_VS1001 constant according to your VS1001 clock divided by 2000.
// Add 0x8000 if you use clock doubler.
#define F_VS1001	(6144 + 0x8000)			/* 12,288MHz x2 */
//#define F_VS1001	(6400 + 0x8000)			/* 12,8MHz */
//#define F_VS1001	(7159 + 0x8000)			/* 14,318MHz x2 */
//#define F_VS1001	(12000 + 0x0000)		/* 24MHz */
//#define F_VS1001	(12288 + 0x0000)		/* 24.576Mhz */
//----------------------------------------------------------------------------
// If you have VS1001 in version older that "K" - uncomment the following line
//#define OLD_VS1001


//============================================================================
// LCD
//============================================================================
//
// In case you have attached LCD - uncomment the following line:
#define ENABLE_LCD
//----------------------------------------------------------------------------
// Define LCD display organisation.
#define LCD_TYPE	1		// 2x16 LCD
//#define LCD_TYPE	2		// 2x20 LCD
//#define LCD_TYPE	3		// 2x24 LCD
//#define LCD_TYPE	4		// 4x16 LCD
//#define LCD_TYPE	5		// 4x20 LCD
//----------------------------------------------------------------------------
// In case you need improved progressbar - uncomment the following line:
#define PROGRESBAR_II
//----------------------------------------------------------------------------
// In case you need LCDHome command - uncomment the following line:
//#define ENABLE_LCD_HOME_COMMAND


//============================================================================
// ATA & FAT
//============================================================================
//
// In case you need debug ATA command - uncomment the following line:
//#define DEBUG_ATA
//----------------------------------------------------------------------------
// In case you need dump sectors via serial interface - uncomment the
//  following line:
//#define HEXDUMP
//----------------------------------------------------------------------------
// In case you need check memory and ATA read functions - uncomment the
// following line:
//#define ENABLE_CRC 
//----------------------------------------------------------------------------
// In case you need fast song load - uncoment the following line
#define FAST_LOAD
//----------------------------------------------------------------------------
// Define here cluster size in bytes of the used disk.
// It can be 2048, 4096, ... 65536
#define CLUSTER_SIZE 4096
//#define CLUSTER_SIZE 16384
//#define CLUSTER_SIZE 32768
//----------------------------------------------------------------------------
// If you have HDD formatted with FAT16 filesystem - uncomment the following line:
//#define FAT16
//----------------------------------------------------------------------------
// In case you need HDD spindown after STOP - uncomment the following line:
#define HDD_SPINDOWN
//----------------------------------------------------------------------------
// In case you may problems with player locking during initialise HDD - 
// uncomment the following line:
//#define CHS_ACCES_FIRST
//----------------------------------------------------------------------------
// In case you may problems with scratches at end of played songs - uncomment 
// the following line:
//#define CHECK_FILESIZE


//============================================================================
// SONG NAVIGATION
//============================================================================
//
// In case you need letter navigation - uncomment the following line:
//#define ENABLE_NAVL
//----------------------------------------------------------------------------
// In case you need direct song number navigation - uncomment the following line:
#define ENABLE_NUMERIC
//----------------------------------------------------------------------------
// In case you need fast forward search - uncomment the following line:
#define FFWD_SEARCH
//----------------------------------------------------------------------------
// In case you need fast rewind search - uncomment the following line:
#define FREW_SEARCH
//----------------------------------------------------------------------------
// In case you need remain time displaying - uncomment the following line:
#define REMAIN_TIME
//----------------------------------------------------------------------------
// In case you need new "PREVOUS" key functionality (like normal CD players) -
// uncomment the following line:
#define NEW_PREV

//============================================================================
// Infra Red Controls
//============================================================================
//
// In case you need use an remote IR controller - uncomment the following line
#define ENABLE_IR
//
//----------------------------------------------------------------------------
// If you need setup remote controller codes first uncomment the following
// definition (#define SETUP_REMOTE_CODES), compile the code and download to
// yampp. Next press several times any key on your remote to autorecognize 
// remote standard. If yampp recognize it, you see appropriate message on LCD 
// and UART terminal, and you see standard number for enter to "REM_STD" 
// definition in remote definition file. Next you must copy the sample 
// (!_SAMPLE_BASE.def) file from "REMOTES" folder to source code folder,
// and change it's name to "remote.def". Next you must edit this file and enter
// appropriate codes that you see on LCD and UART terminal after any remote 
// keypress. Next save edited file, comment back SETUP_REMOTE_CODES definition,
// recompile and download full working code to yampp.
// You should copy back the "remote.def" file to "REMOTES" folder and change it's 
// name for use later (and/or send to me for include in next versions of f/w).
//
//#define SETUP_REMOTE_CODES
//
//----------------------------------------------------------------------------
// In case you have a problems with volume keys - comment the following line.
#define ENABLE_AUTOREPEAT
//----------------------------------------------------------------------------
// In case you have a problems with double interpretted random, loudness
// and numerical keys - set following constants value to 2,3 or 4.
// Note:  Increase this value slow down AUTOREPEAT function too.
#define DOUBLE_TRAP 1
//----------------------------------------------------------------------------
// In case you need always showing remote codes on serial terminal - uncomment 
// the following line:
//#define SHOW_REMOTE_CODES


//============================================================================
// Local keys control and layout definitions
//============================================================================
//
// In case you need use a local keyboard  - uncomment the following line:
#define ENABLE_LOCAL_KBD
//----------------------------------------------------------------------------
// Here is local keys layout definitions
//
// Shortpress
#define KBD_SHORT { EV_IDLE, EV_RANDOM,   EV_PLAY, EV_NEXT, EV_PREV, EV_NEXTD,  EV_PREVD,  EV_VOLUP, EV_VOLDN };
// Longpress
#define KBD_LONG  { EV_IDLE, EV_LOUDNESS, EV_STOP, EV_FFWD, EV_FREW, EV_NEXT10, EV_PREV10, EV_VOLUP, EV_VOLDN };


//============================================================================
// UART
//============================================================================
//
// In case you need serial interface - uncomment the following string:
//#define ENABLE_SERIAL
//----------------------------------------------------------------------------
// In case you need asyncronous transmit - uncomment the following string:
//#define UART_TX_ASYNC
//----------------------------------------------------------------------------
// In fact this is not true async transmit - we do not have a dedicated
// buffer, and due to this have to wait when make a second UART call. But
// for a practical use, if using only single call, it's acceptable.


//============================================================================
// WATCHDOG
//============================================================================
//
// In case you need watchdog timer - uncomment the following string:
#define ENABLE_WATCHDOG


//============================================================================
// APPLICATION
//============================================================================
//
// This constant defines minimum volume level - to decrease unnessesary
// steps in volume control
// note that 0 is max volume and 0xff is minimum volume
#define MIN_VOLUME 	0x60
//----------------------------------------------------------------------------
// number of volume steps 
#define NUM_VOL_STEPS	24
//----------------------------------------------------------------------------
//In case you can hear three power up beeps - uncomment the following line:
//#define PWR_BEEPS
//----------------------------------------------------------------------------
// If you have a trouble with reset of VS1001 and/or IDE, you may use free
// PD4 line of MCU to provide output of RESET signal to this devices (after
// modification on yampp PCB), and enable this option. 
// You must disable this option if you want to use PD4 pin to you other
// features like LCD backlight switch, next 8 key input ect.
//
//#define ENABLE_RST_OUT
//



//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&


//
// Some checks and calculations - DON'T change it !
//

#define F_CPU	7372800		/* 7,3728MHz CPU quartz */

#define VOL_STEP	( (MIN_VOLUME + 1) / NUM_VOL_STEPS )

#if (LCD_TYPE == 1)
 #define LCD_LINES 2
 #define LCD_LINE_LENGTH 16
#endif
#if (LCD_TYPE == 2)
 #define LCD_LINES 2
 #define LCD_LINE_LENGTH 20
#endif
#if (LCD_TYPE == 3)
 #define LCD_LINES 2
 #define LCD_LINE_LENGTH 24
#endif
#if (LCD_TYPE == 4)
 #define LCD_LINES 4
 #define LCD_LINE_LENGTH 16
#endif
#if (LCD_TYPE == 5)
 #define LCD_LINES 4
 #define LCD_LINE_LENGTH 20
#endif

#ifdef SETUP_REMOTE_CODES
 #define ENABLE_SERIAL
 #define PWR_BEEPS
 #define SHOW_REMOTE_CODES
 #undef ENABLE_NAVL
 #undef ENABLE_NUMERIC
 #undef FFWD_SEARCH
 #undef FREW_SEARCH
#endif

#ifdef ENABLE_WATCHDOG
#define WDR asm volatile ("wdr")
#else
#define WDR ;
#endif

#if F_CPU < 4000000 || F_CPU > 12000000
#error Invalid F_CPU!
#endif

#if F_VS1001 < 10000 || F_VS1001 > 65536
#error Invalid F_VS1001!
#endif

#if CLUSTER_SIZE != 2048 && CLUSTER_SIZE != 4096 && CLUSTER_SIZE != 8192 \
&& CLUSTER_SIZE != 16384 && CLUSTER_SIZE != 32768 && CLUSTER_SIZE != 65536 
#error Invalid CLUSTER_SIZE!
#endif

#endif // __CONST_H__

⌨️ 快捷键说明

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