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

📄 switches.h

📁 这项工程将让您把自己的MP3播放器平台
💻 H
字号:
//++
//switches.h - declarations for switches.c module
//
// Copyright (C) 2005 by Spare Time Gizmos.  All rights reserved.
//
// This file is part of the Spare Time Gizmos' MP3 Player firmware.
//
// This firmware 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:
// dd-mmm-yy    who     description
//  9-Jun-05	RLA	New file.
// 12-Oct-05	RLA	Add SwitchesInterrupt() prototype for SDCC.
//--
#ifndef _switches_h_
#define _switches_h_

// Constants...
#define ENCODER_POLL_FREQUENCY	 500	// encoder polling frequency, in Hertz!
#define BUTTON_POLL_FREQUENCY	  50	// ditto, but for the push button

//   The timer 0 reload constant is easily determined from the ENCODER_POLL_
// FREQUENCY (remember that timer 0 is used in mode 1 - 16 bit down counter).
// The BUTTON_COUNT is simply the number of timer interrupts that must go by
// before we poll the button (e.g. 10 polls the button every 10 interrupts).
#define TIMER0_RELOAD	(-(CPU_CLOCK/CPU_CLOCKS_PER_CYCLE/ENCODER_POLL_FREQUENCY))
#define BUTTON_COUNT	(ENCODER_POLL_FREQUENCY/BUTTON_POLL_FREQUENCY)

// Public members...
extern signed char DATA g_nEncoderCount;
extern BYTE DATA g_bButtonTime;

// Methods...
extern void InitializeSwitches (void);

//   SDCC requires that any interrupt function be declared in the main
// program file (i.e. the file which contains the main() procedure) so that
// SDCC can correctly set the interrupt vector.
extern void SwitchesInterrupt (void) interrupt TIMER0_VECTOR;

#endif	// _switches_h_

⌨️ 快捷键说明

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