📄 constants.h
字号:
/* ***********************************************************************
**
** Copyright (C) 2002 Romuald Bialy (MIS) <romek_b@o2.pl>.
**
**
** Yampp-7/USB - Constants and options definition file
**
** File Constants.c
**
*************************************************************************
**
** 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.
**
*************************************************************************
**
** 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
*********************************************************************** */
#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 4000000 // 4MHz crystal
//#define M162CRYSTAL 8000000 // 8MHz crystal
//#define M162CRYSTAL 12000000 // 12MHz crystal
#define M162CRYSTAL 12288000 // 12.288MHz crystal
//#define M162CRYSTAL 14318000 // 14.318MHz crystal
#define M162DIVIDER 4 // 1, 2 or 4
//============================================================================
// 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
//----------------------------------------------------------------------------
// If you need true battery status monitoring, and you have modified hardware
// - uncomment the following line. More information about this feature inside
// "BattMon.txt" file.
//
//#define BATT_MONITOR
// Here is definitions of full and empty battery adc value readout. Note, the
// minimum value is higher than maximum. These values is depended from parts
// tolerance and CPU crystal frequency.
//
#define BATT_MAX 52
#define BATT_MIN 80
//============================================================================
// LCD
//============================================================================
// Backlight ON time in 1/10 sec (0-255) - Backlight is on after any keypress.
// If 0 - backlight is not used and PB4 is used for LED output
//
#define BACKLIGHT_TIME 80 // 8 second
// Backlight DIMM state brightness level (1-200, default 20) (M162 mode only)
//
#define BL_DIMMLEVEL 30 // about 10% off full light
//----------------------------------------------------------------------------
// In case you need alternative scroll method - uncomment the following line
//
#define ALTERNATE_SCROLL
//----------------------------------------------------------------------------
// Enter scroll parameters here. Old style have SPEED=5 and STEP=6.
//
#define SCROLL_SPEED 2 // from 1 to 10 lower is speedest
#define SCROLL_STEP 2 // 1,2,3,6 - in pixels
//----------------------------------------------------------------------------
// In case you need negative screen on Graphics LCD display
// - uncomment the following line
//
//#define LCD_NEGATIV
//============================================================================
// APPLICATION
//============================================================================
//
// 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
#error Invalid BACKLIGHT_TIME !
#endif
#if SCROLL_SPEED < 1 || SCROLL_SPEED > 10
#error Invalid SCROLL_SPEED !
#endif
#if SCROLL_STEP != 1 && SCROLL_STEP != 2 && SCROLL_STEP != 3 && SCROLL_STEP != 6
#error Invalid SCROLL_STEP !
#endif
#if M162CRYSTAL < 4000000 || M162CRYSTAL > 15000000
#error Invalid M162 CRYSTAL frequency !
#endif
#if M162DIVIDER == 1
#define CLKDIV 0
#elif M162DIVIDER == 2
#define CLKDIV 1
#elif M162DIVIDER == 4
#define CLKDIV 2
#else
#error Invalid M162DIVIDER !
#endif
#if defined (__AVR_ATmega162__)
#define F_CPU (M162CRYSTAL / M162DIVIDER)
#else
#define F_CPU 4000000
#endif
#endif // __CONST_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -