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

📄 constants.h

📁 DIY自己的MP3的参考价值极高的代码。含有详细的解释
💻 H
字号:
/* **  Revision History
**
**  when         what  who   why
**
**  2002-09-22   1.00  MIS   initial release
**  2002-10-02   1.11  MIS   added power management section
**  2002-10-09   1.13  MIS   added new options for keys locking
**  2002-10-19   2.00  MIS   added new options for LCD display
**  2002-10-09   2.20  MIS   added new option for card type selecting
**  2003-03-20   2.22  MIS   added new option for new PCB version
**  2003-07-14   2.25  MIS   added new option for NEW_PREW, REVERSE_BALANCE and FIXED_RESET
**  2003-10-04   2.28  MIS   added new option for ATmega162
**  2004-02-08   3.00  MIS   added new options for colour LCD's

*********************************************************************** */

#ifndef __CONST_H__
#define __CONST_H__

// Here is some constants are defined.

//============================================================================
// BOARD VERSION (PCB Rev)
//============================================================================
// In case you have "Rev D" or later version of yampp-7 board 
// - uncomment the following line
//
#define PCB_REV_D

//----------------------------------------------------------------------------
// If you modify yampp board for solving problems with CF card initialisation 
// after card inserting - uncomment the following line. 
// Modification is described in README.TXT file (in v2.25b2 description).
//
//#define FIXED_RESET


//============================================================================
// FLASH CARD TYPE
//============================================================================
// In case you need use MMC card rather than CF card 
// - uncomment the following line. 
// NOTE. MMC cards work only on Rev.D and next revisions of boards.
//
//#define MMC_CARD


//============================================================================
// ATmega162 CPU crystal options (impotrant and used only in M162 native mode)
//============================================================================
//
//#define M162CRYSTAL	 8000000	// 8MHz crystal or internal RC osc.
//#define M162CRYSTAL	12000000	// 12MHz crystal
#define M162CRYSTAL	12288000	// 12.288MHz crystal
//#define M162CRYSTAL	14318000	// 14.318MHz crystal

//============================================================================
// 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	(12288 + 0x0000)		/* 24.576Mhz */

//============================================================================
 // POWER MANAGEMENT
//============================================================================
//
// This constant defines automatic CF card sleep timer value. In case you have
// problems with small breaks in the music, try increase this value to 30, or
// even 100. Smaller values decrease power consumption during playing.
//
#define SLEEP_TIME	2	// automatic CF sleep time is n*5 miliseconds

//----------------------------------------------------------------------------
// Maximum of allowed PAUSE time in 1/10 sec. After this time yampp
// automatically goes to power off state.
//
#define MAX_PAUSE_TIME		9000	// 15 minutes

//----------------------------------------------------------------------------
// Maximum of allowed STOP time in 1/10 sec. After this time yampp
// automatically goes to power off state.
//
#define DEEP_SLEEP_TIMEOUT	1800	// 3 minutes


//============================================================================
// COLOR LCD
//============================================================================
// If you have the LCD with EPSON controller (without goldpads), uncomment
// the following definition. 
// Warning ! For now these controllers not work propertly with supply voltage
// higher than 3V. These controllers need additional voltage regulator and
// level converter. Now implamented only for tests.
//
//#define EPSON_LCD

//----------------------------------------------------------------------------
// Backlight ON time in 1/10 sec (0-255) - Backlight is on after any keypress.
//
#define BACKLIGHT_TIME	100	// 10 seconds

//----------------------------------------------------------------------------
// Backlight DIMM state brightness level (1-250, default 20) (M162 mode only)
//
#define BL_DIMMLEVEL	25	// about 10% off full light

//----------------------------------------------------------------------------
// In case you need alternative scroll method - uncomment the following line
//
#define ALTERNATE_SCROLL

//----------------------------------------------------------------------------
// Enter scrolling speed here (in 1/10 second delay for every step).
//
#define SCROLL_SPEED	5	// from 1 to 10 lower is speedest


//============================================================================
// APPLICATION MISCLEANOUS
//============================================================================
//
// In case you need new "PREVOUS" key functionality (like normal CD players) -
// uncomment the following line:
//
#define NEW_PREW

//----------------------------------------------------------------------------
// 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

//----------------------------------------------------------------------------
// If you need swap up/down keys during balance control 
// - uncomment the following line
//
//#define REVERSE_BALANCE

//----------------------------------------------------------------------------
// This constant defines automatic keyboard locking time in 1/10 sec.
//
#define AUTOLOCK_TIME	150	// autolock after 15 seconds of playing 
				// (if enabled)





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

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

#ifdef MMC_CARD
 #define PCB_REV_D
#endif

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

#if SLEEP_TIME > 255
 #error Invalid SLEEP_TIME !
#endif

#if (BACKLIGHT_TIME > 255) || (BACKLIGHT_TIME < 1)
 #error Invalid BACKLIGHT_TIME !
#endif

#if (BL_DIMMLEVEL > 250) || (BL_DIMMLEVEL < 1)
 #error Invalid BL_DIMMLEVEL !
#endif

#if SCROLL_SPEED < 1 || SCROLL_SPEED > 10
 #error Invalid SCROLL_SPEED !
#endif

#if M162CRYSTAL < 4000000 || M162CRYSTAL > 15000000
 #error Invalid M162CRYSTAL value !
#endif

#if M162CRYSTAL > 8000000
 #define M162DIVIDER	2
 #define CLKDIV	1
#else
 #define M162DIVIDER	1
 #define CLKDIV	0
#endif

#define F_CPU (M162CRYSTAL / M162DIVIDER)

#endif // __CONST_H__

⌨️ 快捷键说明

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