switches.h

来自「这项工程将让您把自己的MP3播放器平台」· C头文件 代码 · 共 55 行

H
55
字号
//++
//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 + =
减小字号Ctrl + -
显示快捷键?