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

📄 card.h

📁 基于单片机ATmega16制作IC card 。程序中包含数据的采集和通信。
💻 H
📖 第 1 页 / 共 2 页
字号:
#define CP_RESET_STATUS                    0x01
#define CP_RESET_DELAY_STATUS              0x02
#define TX_SYN_CODE_STATUS                 0x03
#define TX_IDENTIFY_DEVICE_LINGO_STATUS    0x04
#define IDENTIFY_STATUS                    0x05
#define IDENTIFY_DEVICE_LINGO_STATUS       0x06

#define GET_DEV_AUTHENTICATION_INFO_STATUS 0x07
#define AUTHENTICATION_PROCESS_STATUS      0x08
#define IDENTIFY_DEVICE_LINGO_FAIL_STATUS  0x09
#define AUTHENTICATION_FINISH_STATUS       0x0a
//#define CONTEX_BOTTON_PRESS_STATUS         0x0b
#define RECORD_STATUS                      0x0c
//#define CONTEX_BOTTON_PRESS_STATUS1        0x0d
//#define CONTEX_BOTTON_RELEASE_STATUS1 0x0a
#define TX_SEND_CONTEX_BOTTON_PRESS_STATUS 0x0e
#define CONTEX_BOTTON_PRESS_STATUS2        0x0f
//#define SET_IPOD_STATE_INFO_STATUS    0x0a

//FMTxStatus1 define
#define NO_KEY_ACTION_STATUS         0x00
#define CONTEX_BOTTON_PRESS_STATUS   0x01

/*
#define CONTEX_BOTTON_PRESS_STATUS1   0x08
#define CONTEX_BOTTON_PRESS_STATUS2   0x06
#define CONTEX_BOTTON_RELEASE_STATUS2 0x07
//#define WRITE_FM_CONTROL_STATUS       0x06
#define ENTER_REMOTE_UI_MODE_STATUS   0x06
#define GET_PLAY_STATUS_STATUS        0x07
#define PLAY_CONTROL_STATUS           0x08
#define SET_DISPLAY_IMAGE_STATUS      0x09
#define EXIT_REMOTE_UI_MODE_STATUS    0x0a
#define CONTEX_BOTTON_PRESS_STATUS    0x0b
#define CONTEX_BOTTON_RELEASE_STATUS  0x0c
#define CONTEX_BOTTON_RELEASE_DELAY_STATUS  0x0d
#define STANDARD_UI_MODE_STATUS       0x0e
*/

#define IDENTIFY_LEN                         6
#define IDENTIFY_DEVICE_LINGO_LEN            17
#define RET_DEV_AUTHENTICATION_INFO_LEN      7
#define RET_DEV_AUTHENTICATION_SIGNATURE_LEN 63
//#define ENTER_REMOTE_UIMODE_LEN              5
//#define EXIT_REMOTE_UIMODE_LEN               5
//#define IMAGE_LIMITS_LEN                     6
//#define GET_PLAY_STATUS_LEN                  6
//#define PLAY_CONTROL_LEN                     7

//Microphone lingo command length define
#define LINGO1_ACK_OK_LEN                    7
#define LINGO1_ACK_ERROR_LEN                 7
#define RET_DEV_CAPS_LEN                     9

#define GET_IPOD_STATUS_INFO_LEN             6
#define SET_IPOD_STATE_INFO_LEN                  7


#define CONTEXT_BUTTON_STATUS_LEN            9
#define RET_ACCESSORY_CAPBILITES_LEN         10
#define RET_ACCESSORY_NAME_LEN               14
#define RET_ACCESSORY_SUPPORTED_FIRMWARE_VER_LEN 13
#define RET_ACCESSORY_GENERAL_LINGO_VER_LEN  9
#define RET_ACCESSORY_MIC_LINGO_VER_LEN      9
#define	RET_ACCESSORY_FIRMWARE_VER_LEN       9
#define	RET_ACCESSORY_HARDWARE_VER_LEN	     9
#define RET_ACCESSORY_MANUFACTURE_LEN        14
#define SET_IPOD_PREFERENCE_LEN              8
#define GET_PLAY_STATUS_LEN                  5
//I/O port define
//PB bit define
#define IPOD_POWER_UP_DETECT 0x01
#define BT_SWITCH_DETECT   0x02
#define BT_MUTE        			0x10		
#define SPI_MISO      			0x40
#define CP_READY      SPI_MISO
#define SPI_CLK       0x80


//PORTD bit define
//#define CP_READY       0x08
#define  RX   0x01 
#define  TX   0x02
#define	IR_PORT	0x04
#define BT_POWER_ON     0x10
//#define BT_TX          0x04
#define BT_RX          	0x08		//0x04
#define AUDIO_DETECT   0x20
#define FM_CLK         0x40
#define FM_DATA        0x80




//PORTC bit define
#define LCD_DATA       0x01
#define LCD_WR         0x02
#define LCD_CS         0x04
#define LED      			0x10
//#define LED1          0x10
#define CP_RESET       0x08
#define KT0801_RESET   0x20
#define KT0801_POWER_ON 0x40
#define	BT_TX						0x80





//LCD define
#define SEGMENT_A     0x01
#define SEGMENT_B     0x10
#define SEGMENT_C     0x20
#define SEGMENT_D     0x40
#define SEGMENT_E     0x08
#define SEGMENT_F     0x04
#define SEGMENT_G     0x02

#define DIGITAL_1     0x80
#define NO_M          0x00
#define M1            0x01
#define M2            0x02
#define M3            0x04
#define M4            0x08
#define DOT           0x80
#define MHZ           0x04
#define FM          	0x01
#define	IPOM					0x02

//IPOD connect status define
//#define  NO_IPOD_CONNECT       0x00
//#define  IPOD_CONNECT          0x01
//#define  IPOD_SUPPLY_POWER     0x02

#define COMMAND_ID    0x80
#define WRITE_ID      0xa0
#define LCD_ADDRESS   0x00
#define SYS_EN        0x01
#define SYS_DIS       0x00
#define LCD_ON        0x03
#define LCD_OFF       0x02
#define BIAS          0x29

//CP running result define
#define  SIGNATURE_OK_MASK              0x30
#define  SIGNATURE_OK                   0x10

//Recorder state change define
#define BEGIN_RECORD                        0x00
#define END_RECORD                          0x01
#define NO_RECORD                           0x00
#define RECORD_START                        0x80

//LED define
#define LED_ON_DELAY     0x01
#define LED_OFF          0x02
#define LED1_ON_OFF      0x10
#define LED1_FLASH       0x20
#define LED1_FLASH_TIME  MS_300

//BT status define	
//#define  PAIRING         0x01
//#define  PAIR_SUCCESSED  0x02
//#define  PAIR_FAIL       0x03
//#define  CONNECT_SUCCESS 0x04
//#define  CONNECT_FAIL    0x05  
//#define  CLOSE           0xf1
//#define  PRIVACY         0x01
//#define  NO_PRIVACY      0x02
#define BT_AUDIO_OFF_STATUS          0x01
#define BT_AUDIO_SWITCH_ON_STATUS    0x02
#define BT_AUDIO_ON_STATUS           0x03
#define BT_AUDIO_SWITCH_OFF_STATUS   0x04

//FlagBuff flag define
#define  IPOD_POWER_UP        0x01
#define  AUDIO_ON             0x08
#define  AUDIO_TRANSMIT       0x04
#define  BT_AUDIO_ON          0x02
#define  BT_AUDIO_ON_HOLD     0x10
#define  AUDIO_DETECT_OFF     0x20
#define  FM_MUTE_ON           0x40
#define  IPOD_POWER_UP_HOLD   0x80

//FlagBuff1 flag define 
#define  INSERT_IPOD             0x01
#define  IPOD_POWER_STEADY       0x02
#define  LCD_LIGHT_KEEP          0x04
//#define  LCD_LIGHT               0x08
#define  IDENTIFY_ACK            0x10
//#define  IPOD_AUDIO_CHECK_STATUS 0x20
#define  MICROPHONE_MUTE_ON       0x20
#define  IPOD_PLAY               0x40
#define  GET_IPOD_PLAY_STATUS    0x80



typedef struct
{
 unsigned int wModeFrequenceValue[5];   
 union
 {
  unsigned int wFMFrequence;
  struct
  {
   unsigned char FrequenceL;
   unsigned char FrequenceH;
  }FMFrequence;
 }FMFrequence;
 unsigned char FMFrequenceMode;
 unsigned char FMFrequenceCheckSum;
} FMFrequence;


/*
typedef union
{
 unsigned int wFMFrequenceEeprom;
 struct
 {
  unsigned char FMFrequenceEepromL;
  unsigned char FMFrequenceEepromH;
 }FMFrequenceEeprom;
}FMFrequenceEeprom;*/

//class cLCD
//{
// private:
	 //unsigned char DisplayBuff[4];
	 
// public:
     //cLCD();
	 //~cLCD();
//	 void WriteBit(unsigned char Data,unsigned char Number);
//	 void WriteDataBit(unsigned char Data,unsigned char Number);
//	 void WriteCommand(unsigned char Command);
//    void FrequenceToDisplayBuff(unsigned int wFrequence);
//	 void FrequenceAreaToDisplayBuff(unsigned char FrequenceArea);
//     void DisplayFrequence(); 
//};
/*
class cCOM
{
  private:
	  
	
  public:
	  //cCOM();
	  //~cCOM();
	  void WriteUart(unsigned int wTxNumber,unsigned char bIsWaitTx);
};*/

/*
class cCOMCommand:public cCOM
{
 private:
	
 public:
	//cCOMCommand();
	//~cCOMCommand();
	void SendIdentify(void);
	void SendIdentifyDeviceLingoes(void);
	//void RetAccessoryCapbilite(void);
	void SendDevAuthenticationInfo(void);
	void SendDevAuthenticationSignature(void);
	void SendContextButtonStatus(unsigned long int ButtonStatus);
    void Lingo1Ack(unsigned char CommandID);
	void Lingo1AckError(unsigned char CommandID);
    void RetDevCap(void);
	//void GetiPodStatusInfo(void);
    //void SetiPodStateInfo(unsigned char StateInfo);	
};*/
//////RX与TX状态标志
extern	volatile unsigned char BtRxFirstData;
extern	volatile unsigned char BtRxOk;
extern	volatile unsigned char BtRxDataBuff[];
extern	volatile unsigned char BtRxData[BT_RX_BUFF_LENG];
extern	volatile unsigned char BtTxData[BT_TX_BUFF_LENG];
extern	volatile unsigned char BtRxCount;
extern	volatile unsigned char BtDataBuff;
extern	volatile unsigned char	BtRxRecive;
extern	volatile unsigned char BtRxDataPackOver;

extern	volatile unsigned char	BtTxDataCount;
extern	volatile unsigned char	BtTxDataStart;

/////
extern unsigned char UartReceive;
extern unsigned char UDRBuff;

extern unsigned char TxBuff[TX_BUFF_LEN];
extern volatile unsigned int  wTxByteNumber;
extern volatile unsigned int  wTxByteCounts;
extern volatile unsigned char TxBuffCounts;
extern volatile unsigned char TxCheckSum;
extern volatile unsigned char bTxBuffLock;
//extern volatile unsigned char TxBuff1State;
//extern volatile unsigned char TxBuff2State;
//extern volatile unsigned char TxBuffEmpty;


extern unsigned char RxBuff[RX_BUFF_LEN];
extern unsigned char RxBuff1[RX_BUFF1_LEN];
extern unsigned char RxPayloadLength;
extern unsigned char RxByteCounts;
extern unsigned char RxCheckSum;

extern volatile unsigned char KeyValue;
extern volatile unsigned char bKeyUse;
extern volatile unsigned char KeyBuff;
extern volatile unsigned char bPressKey;
extern volatile unsigned char bReleaseKey;
extern volatile unsigned char bFastChange;
extern volatile unsigned char FastChangeCount;
extern volatile unsigned char bLongPressKey;
extern unsigned int FastChangeTime;
//extern volatile unsigned int ImageDisplayTime;
extern volatile unsigned int wStatusDelay;
extern volatile unsigned int wStatusDelay1;
extern volatile unsigned char IpodPowerUpDelay;
extern volatile unsigned char  RxTimeOut;
extern volatile unsigned char WriteFMControlDelay;
extern volatile unsigned char FlagBuff;
extern volatile unsigned char FlagBuff1;

extern volatile unsigned char ADCBuff;
extern volatile unsigned char ADCBuff1;
extern volatile unsigned char Timer1INTTemp;
extern volatile unsigned char Timer1INTTemp1;

extern volatile unsigned char iPodConnectStatus;

//extern volatile unsigned char bLedOff;
extern volatile unsigned char LedWorkMode;
extern volatile unsigned char Led1WorkMode;
extern volatile unsigned char Led1FlashTime;
extern volatile unsigned int wLedOffDelay;
extern volatile unsigned int wLedTurnOnTime;
extern volatile unsigned char Led1FlashTimeBuff;
extern volatile unsigned int wAudioDetectDelay;
extern volatile unsigned char LCDFlashTime;
extern volatile unsigned char LCDFlashTimePreset;

//extern volatile unsigned char BTRxStatus;
extern volatile unsigned char BTTxByteCount;
extern volatile unsigned char BTTxBitCount;
//extern volatile unsigned char BTRxTimeOut;
extern volatile unsigned char BTTxBuff[5];

extern volatile unsigned char PINBBuff;
extern volatile unsigned char PINDBuff;
/////遥控相关寄存器定义
extern volatile	unsigned char	IrDataHigh;
extern volatile	unsigned char	IrDataLow;

extern	volatile	unsigned int	NoIrReviceTime;
extern	volatile	unsigned char	IpodLongKey;

extern	volatile unsigned char B_10ms;
extern	volatile	unsigned char adc_data;
extern	volatile	unsigned char ADC_INT_Temp1;
/////遥控相关位定义
//unsigned char	b_IrHigh;
//unsigned char	b_IrLow;





//extern cCOMCommand COMCommand;
//extern	void FrequenceToDisplayBuff(unsigned int wFrequence);

extern void Delay(unsigned char i);
extern void DelayUs(unsigned char UsNumber); 
extern void ReadFlash(unsigned char *pDestinationAddr,unsigned char *pFlashAddr,unsigned char Number);
extern void ReadOrWriteSPI(unsigned char *pSPIBuff,unsigned char Number);
#endif

⌨️ 快捷键说明

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