?? main.c
字號:
/*============================================================================
Project QT60xx0 Example code
File main.c
Function Sample application
Requires
Originated D Spokes
(c) Quantum Research Group
============================================================================*/
#include "C8051F310.H"
#include <float.h>
#include "common.h"
#include "timer.h"
#include "i2c.h"
#include "qt60xx0.h"
xdata UINT8 Key[3]; /* application storage for QT60xx0 key states */
main ()
{
UINT16 Time; /* time-stamp used in main loop */
/*****************************************************************/
/* Initialisation here is required for C8051F310 target system and
should be used as example only */
OSCICN = 0x83; /* Internal Oscillator Control Register */
PCA0MD = 0x00; /* PCA Mode Register - disable watchdog */
XBR1 = 0xc0; /* enable crossbar, pull-ups off */
InitTimer (); /* start timebase generator - used by main-loop only */
EA = 1; /* enable global interrupts */
/****************************************************************/
InitI2c (); /* initialise I2c interface */
/* Specify QT60xx0 I2C device address to QT driver */
SetQtAddress( 117 );
/* wait for QT60xx0 to respond to I2C read transfers */
while (!ReadQtKeys());
/* read the QT60xx0 setup block */
ReadQtSetup ();
/* loop forever */
while (1) {
if (CheckTimer (Time, 20) )
{
Time = StartTimer();
if ( ReadQtKeys() ) /* poll QT60xx0 for key states */
{ /* get key states for onward procesing.... */
Key[0] = GetQtKeys(0);
Key[1] = GetQtKeys(1);
Key[2] = GetQtKeys(2);
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -