📄 yampp7_usb.h
字号:
/* ***********************************************************************
**
** Copyright (C) 2002 Jesper Hansen <jesperh@telia.com> and
** Romuald Bialy (MIS) <romek_b@o2.pl>.
**
**
** Yampp-7/USB - main header file
**
** File yampp7_usb.h
**
*************************************************************************
**
** 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-04-13 0.9 Jesper initial test release
** 2002-09-22 1.0 MIS initial public release
** 2002-10-09 1.1 MIS added Autolock status position in EEPROM
** 2002-11-03 1.2 MIS redefinition type of events to u08
** 2003-01-01 1.3 MIS added compatibility with new versions of GCC
**
*********************************************************************** */
#ifndef GCC_VERSION
#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
#endif /* GCC_VERSION */
#if (GCC_VERSION < 3003)
#error __Wrong compiler version. Use GCC 3.3 !___
#endif
#if defined (__AVR_ATmega162__)
#define GIMSK GICR
#else
#define PORTE0 PE0
#define PORTE1 PE1
#define PORTE2 PE2
#endif
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include <avr/signal.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>
#include <string.h>
#include <stdarg.h>
#include "types.h"
#include "Constants.h"
#include "yampp7lib.h"
#include "yadl.h"
#include "usb.h"
u08 *SectorBuffer;
int _p_printf(char const *fmt0, ...);
void _p_puts(char const *s);
#define printf(format, args...) _p_printf(PSTR(format) , ## args)
#define puts(str) _p_puts(PSTR(str))
u08 nKeyTime;
u08 usb_link;
#define EV_IDLE 0
#define EV_PLAYLIST 1 // playlist change
#define EV_NEXTPL 2 // next playlist
#define EV_PREVPL 3 // prevous playlist
#define EV_BALANCE 4 // balance control
#define EV_MBASS 5 // old loudness
#define EV_RANDOM 6 // random on/off
#define EV_REPEAT 7 // repeat mode
#define EV_TIME 8 // song time mode
#define EV_CONTRAST 9 // LCD contrast
#define EV_AUTOLOCK 10 // autolock mode
#define EV_LIGHTMODE 11 // backlight mode
#define EV_PLAY 12
#define EV_STOP 13
#define EV_NEXT 14
#define EV_PREV 15
#define EV_UP 16 // volume or search UP
#define EV_DOWN 17 // volume or search DOWN
#define EV_FFWD 18
#define EV_MENU 19
#define EV_PLAY_USB 20 // playing via USB
#define EV_LASTEVENT 21 // for events count calculation
#define event_e u08
event_e get_event(void);
void set_event(event_e e);
void send_sinewave_beeps(void);
#define SINE_300 54
#define SINE_500 65
#define SINE_800 64
#define SINE_1000 62
#define SINE_1500 82
#define SINE_2000 80
#define SINE_2500 89
#define SINE_3000 76
// PIN assignements on the yampp7/USB board
#define BUTTON_1 PORTE0
#define DREQ_PIN PD0
#define BUTTON_2 PD1
#define BUTTON_3 PD4
#define BUTTON_4 PD5
#define LED_PIN PB0
#define RESET_PIN PB1 // reset for VS1001
#define CHARGE_PORT PORTE
#define CHARGE_DDR DDRE
#define CHARGE_INP PINE
#ifdef PCB_REV_D
#define CHARGE_PIN PORTE1 // ALE pin
#else
#define CHARGE_PIN PORTE2 // OC1B pin
#endif
// CARD I/O functions depended of card version (CF/MMC)
#ifdef MMC_CARD
#define CARD_Read_USB MMC_Read_USB
#define CARD_Write_USB MMC_Write_USB
#define CARD_Read MMC_Read
#define CARD_Write MMC_Write
#define CARD_Identify MMC_Name
#define card_sbuf mmc_sbuf
#else
#define CARD_Read_USB ATA_Read_USB
#define CARD_Write_USB ATA_Write_USB
#define CARD_Read ATA_Read
#define CARD_Write ATA_Write
#define CARD_Identify ATA_Identify
#define card_sbuf ata_sbuf
#endif
// EEPROM structure
#define EEPROM_VOLUME 0x001 // 1 byte - volume
#define EEPROM_PLAYLIST 0x002 // 2 bytes - last song number
#define EEPROM_SONGPOS 0x004 // 2 bytes - last song number
#define EEPROM_RANDOM 0x006 // 1 byte
#define EEPROM_LOUDNESS 0x007 // 1 byte
#define EEPROM_REPEAT 0x008 // 1 byte
#define EEPROM_AUTOLOCK 0x009 // 1 byte - autolock status
#define EEPROM_LCD_CONTRAST 0x00A // 1 byte - LCD contrast
#define EEPROM_BACKLIGHT 0x00B // 1 byte - LCD backlight mode
#define EEPROM_TIME 0x00C // 1 byte - song time mode
#define EEPROM_BALANCE 0x00D // 1 byte - balance
// Note.
// This settings is used by ASM routines, and is defined in lcd.h too.
#define EEPROM_LANGTAB 0x010 // 20 bytes
#define EEPROM_LANGCHARS 0x028 // 20*14 = 280 bytes
//------------------------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -