📄 carduser.h
字号:
#ifndef _CARD_USER_
#define _CARD_USER_
//Key variable define
volatile unsigned char KeyValue;
volatile unsigned char bKeyUse= FALSE;
volatile unsigned char KeyBuff;
volatile unsigned char bPressKey = FALSE;
volatile unsigned char bReleaseKey = TRUE;
volatile unsigned char bFastChange = FALSE;
volatile unsigned char FastChangeCount;
volatile unsigned char bLongPressKey = FALSE;
unsigned int FastChangeTime;
volatile unsigned int wStatusDelay;
volatile unsigned int wStatusDelay1;
volatile unsigned char IpodPowerUpDelay;
volatile unsigned char RxTimeOut = 0;
volatile unsigned char LCDFlashTime;
volatile unsigned char LCDFlashTimePreset;
volatile unsigned char PINBBuff;
volatile unsigned char PINDBuff;
FMFrequence FMFrequenceAndMode;
unsigned char bFMFrequenceChange = FALSE;
//unsigned char FMFrequenceMode = NO_M;
unsigned int wFMFrequenceAndModeAddress;
unsigned char DisplayBuff[11] = {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
unsigned char LCDDigitalToSegment[] = {SEGMENT_A|SEGMENT_B|SEGMENT_C|SEGMENT_D|SEGMENT_E|SEGMENT_F, //0
SEGMENT_C|SEGMENT_D, //1
SEGMENT_B|SEGMENT_C|SEGMENT_E|SEGMENT_F|SEGMENT_G, //2
SEGMENT_B|SEGMENT_C|SEGMENT_D|SEGMENT_E|SEGMENT_G, //3
SEGMENT_A|SEGMENT_C|SEGMENT_D|SEGMENT_G, //4
SEGMENT_A|SEGMENT_B|SEGMENT_D|SEGMENT_E|SEGMENT_G, //5
SEGMENT_A|SEGMENT_B|SEGMENT_D|SEGMENT_E|SEGMENT_F|SEGMENT_G, //6
SEGMENT_B|SEGMENT_C|SEGMENT_D, //7
SEGMENT_A|SEGMENT_B|SEGMENT_C|SEGMENT_D|SEGMENT_E|SEGMENT_F|SEGMENT_G, //8
SEGMENT_A|SEGMENT_B|SEGMENT_C|SEGMENT_D|SEGMENT_E|SEGMENT_G,0x00 //9
};
////////////
#define EEPROM_FM_DATA_ADDR 0x00
#define INIT_EEPROM_ADDR 0x0002
#define TEST_DATA 0x1133
#define FIRST_INIT_DATA 0x6857
/////
#define LCD_DIPLAY_LENG 10
#define HF_MCU_CALLER_ID_IND 0x82
//volatile unsigned char bLedOff = FALSE;
volatile unsigned char LedWorkMode = LED_OFF;
//volatile unsigned char Led1WorkMode = LED1_ON_OFF;
//volatile unsigned char Led1FlashTime;
volatile unsigned int wLedOffDelay;
volatile unsigned int wLedTurnOnTime;
volatile unsigned int wAudioDetectDelay;
//volatile unsigned char Led1FlashTimeBuff;
//volatile unsigned char iPodConnectStatus = NO_IPOD_CONNECT;
EEPROM unsigned int FMFrequenceEepromAddress = EEPROM_ADDRESS_DATA_LEN;
EEPROM unsigned int FMFrequenceEepromAddress1 = EEPROM_ADDRESS_DATA_LEN;
//EEPROM unsigned int FMFrequenceEeprom = FM_MIN_FREQUENCE;
//EEPROM unsigned int FMFrequenceEepromMode = NO_M | (NO_M << 8);
EEPROM unsigned char FMFrequenceEeprom[14]
= {
FM_FREQUENCE_MODE1L,FM_FREQUENCE_MODE1H,FM_FREQUENCE_MODE2L,FM_FREQUENCE_MODE2H,
FM_FREQUENCE_MODE3L,FM_FREQUENCE_MODE3H,FM_FREQUENCE_MODEL,FM_FREQUENCE_MODEH,
FM_FREQUENCE_MODE4L,FM_FREQUENCE_MODE4H,FM_PRESET_FREQUENCE_L,FM_PRESET_FREQUENCE_H,NO_M,
(FM_FREQUENCE_MODE1L+FM_FREQUENCE_MODE1H+FM_FREQUENCE_MODE2L+FM_FREQUENCE_MODE2H+
FM_FREQUENCE_MODE3L+FM_FREQUENCE_MODE3H+FM_FREQUENCE_MODEL+FM_FREQUENCE_MODEH+
FM_FREQUENCE_MODE4L+FM_FREQUENCE_MODE4H+FM_PRESET_FREQUENCE_L+FM_PRESET_FREQUENCE_H+NO_M)%0x100
};
volatile unsigned char ADCBuff = 0xff;
volatile unsigned char ADCBuff1 = 0xff;
//Variable define
unsigned char RxBuff[RX_BUFF_LEN];
unsigned char TxBuff[TX_BUFF_LEN];
unsigned char RxBuff1[RX_BUFF1_LEN];
unsigned char RxPayloadLength;
unsigned char RxByteCounts;
unsigned char RxCheckSum;
volatile unsigned int wTxByteNumber;
volatile unsigned int wTxByteCounts;
volatile unsigned char TxCheckSum;
volatile unsigned char bTxBuffLock = FALSE;
unsigned char UartReceive = UART_RECEIVE;
unsigned char UDRBuff;
unsigned char FMTxStatus = NO_IPOD_CONNECT_STATUS;
//unsigned char FMTxStatusBuff;
unsigned char FMTxStatus1 = NO_KEY_ACTION_STATUS;
unsigned char TxRetryCounts = TX_RETRY_COUNTS;
unsigned char TxRetryCounts1;
unsigned char IdentifyRetryCounts;
//unsigned char AckAuthStatCoun;
unsigned char bTxCommand = FALSE;
unsigned char bTxCommand1 = FALSE;
//unsigned char bFMMute = FALSE;
//unsigned char ReturnLastMenuLevel;
unsigned char iPodPowerStatus = POWER_ON;
unsigned char i;
//unsigned char MuteLockCount = 0;
//volatile unsigned char BTRxStatus = UART_RECEIVE;
//volatile unsigned char BTRxByteCount;
//volatile unsigned char BTRxBitCount;
//volatile unsigned char BTRxTimeOut;
//volatile unsigned char BTRxCheckSum;
volatile unsigned char BTTxBitCount;
volatile unsigned char BTTxByteCount;
//unsigned char bBTPrivacy = PRIVACY;
volatile unsigned char BTTxBuff[5];
//volatile unsigned char BTAudioStatus = BT_AUDIO_OFF_STATUS;
volatile unsigned char FlagBuff = 0;
volatile unsigned char FlagBuff1 = 0;
volatile unsigned char OsMode = 0;
//cCOMCommand COMCommand;
//unsigned volatile char Timer1INTTemp;
//unsigned volatile char Timer1INTTemp1;
const unsigned int OsModeSelect[]={881,941,1001,1061};
///
const prog_uchar Identify[] = {0xff,0x55,0x03,0x00,0x01,0x02};
const prog_uchar IdentifyDeviceLingoes[] = {0xff,0x55,0x0e,0x00,0x13,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x02};
const prog_uchar RetDevAuthenticationInfo[RET_DEV_AUTHENTICATION_INFO_LEN - 2] = {0xff,0x55,0x04,0x00,0x15};
const prog_uchar RetDevAuthenticationSignature[RET_DEV_AUTHENTICATION_SIGNATURE_LEN - 58] = {0xff,0x55,0x3c,0x00,0x18};
const prog_uchar ContextButtonStatus[CONTEXT_BUTTON_STATUS_LEN] = {0xff,0x55,0x06,0x02,0x00,0x01,0x00,0x00,0x00};
//const prog_uchar AudioButtonStatus[] = {0xff,0x55,0x06,0x02,0x04,0x00,0x00,0x00,0x00};
const prog_uchar Lingo1AckOk[LINGO1_ACK_OK_LEN - 1] = {0xff,0x55,0x04,0x01,0x04,0x00};
const prog_uchar Lingo1AckErrors[LINGO1_ACK_ERROR_LEN - 1] = {0xff,0x55,0x04,0x01,0x04,0x04};
const prog_uchar RetDevCaps[RET_DEV_CAPS_LEN] = {0xff,0x55,0x06,0x00,0x08,0x00,0x00,0x00,0x01};
//const prog_uchar GetiPodStatusInfos[GET_IPOD_STATUS_INFO_LEN] = {0xff,0x55,0x03,0x03,0x0c,0x3};
//const prog_uchar SetiPodStateInfos[SET_IPOD_STATE_INFO_LEN] = {0xff,0x55,0x04,0x03,0x0e,0x03,0x00};
//const prog_uchar GetPlayStatus[] = {0xff,0x55,0x02,0x03,0x01};
//const prog_uchar IdentifyDeviceLingoes[] = {0xff,0x55,0x0e,0x00,0x13,0x00,0x00,0x00,0x35,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
const prog_uchar RetAccessoryCapbilites[RET_ACCESSORY_CAPBILITES_LEN] =
{0xff,0x55,0x07,0x00,0x28,0x00,0x00,0x00,0x00,0x01};
const prog_uchar SetIpodPreferences[SET_IPOD_PREFERENCE_LEN] = {0xff,0x55,0x05,0x00,0x2b,0x03,0x01,0x00};
const prog_uchar GetPlayStatus[GET_PLAY_STATUS_LEN] = {0xff,0x55,0x02,0x03,0x0f};
////////MCU与HF命令
const prog_uchar McuAnswerReq[]={0x55,0x02,0x04,0x04};
const prog_uchar McuHangUpReq[]={0x55,0x02,0x05,0x05};
const prog_uchar McuHfPownOnOffReq[]={0x55,0x02,0x0e,0x0e};
#if defined(AUTH_PROT_VER20)
#define CERT_PACK_DATA_LEN 500
//#define SPI_WAIT_COUNTS1 40
//#define SPI_WAIT_COUNTS2 20
#define CERT_PAGE_DATA_LEN 128
#define CERT_PAGE_FIRST_ADDR 0x31
#endif
unsigned char SPIReadDataLen;
unsigned int wResiCertDataCounts;
unsigned int wResiPackDataCounts;
unsigned int wCertDataOffset;
unsigned char CertPackCounts;
unsigned char CertPageCounts;
unsigned char CurrCertPageDataCounts;
unsigned int wCurrCertDataCounts;
unsigned int wOverCertDataCounts;
unsigned int wPackTotalDataCounts;
unsigned char FMFrequenceStep = M1;
volatile unsigned int FmFrequenceData;
//RFGAIN define
#define LOWEST_RANGE 0x00
#define LOW_RANGE 0x40
#define HIGH_RANGE 0x80
#define HIGHEST_RANGE 0xf0
#define RF_AUDIO_GAIN (HIGHEST_RANGE | ZERODB)
//Input audio gain define
#define PLUS_12DB 0x38
#define PLUS_4DB 0x28
#define ZERODB 0x00
#define MINUS_8DB 0x10
#define MINUS_12DB 0x18
//Control define
#define ENABLE_MUTE 0x08
#define PILOT_AMPL_HIGH 0x04
#define PRE_EMPH_CONS 0x01
#define PILOT_PRE_EMPH_AMPL (PILOT_AMPL_HIGH|PRE_EMPH_CONS)
//Power define
#define ENABLE_HIGH_POWER 0x80
unsigned char b_OnOff=0;
////
unsigned long tempcounts = 0;
#endif
//const prog_uchar RetAccessoryName[RET_ACCESSORY_NAME_LEN]= {0xff,0x55,0x0b,0x00,0x28,0x01,
//'i','P','o','d','-','F','M',0x00};
//char RetAccessorySupportedFirmareVer[RET_ACCESSORY_SUPPORTED_FIRMWARE_VER_LEN - 7] =
//{0xff,0x55,0x0a,0x00,0x28,0x02};//,0x00,0x00,0x00,0x00,0x01,0x00,0x00};
//char RetAccessoryGeneralLingoVer[RET_ACCESSORY_GENERAL_LINGO_VER_LEN] = {0xff,0x55,0x06,0x00,0x28,0x03,0x00,0x01,0x04};
//char RetAccessoryMicLingoVer[RET_ACCESSORY_MIC_LINGO_VER_LEN] = {0xff,0x55,0x06,0x00,0x28,0x03,0x01,0x01,0x01};
//const prog_uchar RetAccessoryFirmwareVer[RET_ACCESSORY_FIRMWARE_VER_LEN] = {0xff,0x55,0x06,0x00,0x28,0x04,0x01,0x00,0x00};
//char RetAccessoryHardwareVer[RET_ACCESSORY_HARDWARE_VER_LEN] = {0xff,0x55,0x06,0x00,0x28,0x05,0x01,0x00,0x00};
//char RetAccessoryManufacture[RET_ACCESSORY_MANUFACTURE_LEN] = {0xff,0x55,0x0b,0x00,0x28,0x06
//,'m','a','c','a','l','l','y',0x00};
//const prog_uchar EnterRemoteUIMode[] = {0xff,0x55,0x02,0x00,0x05};
//const prog_uchar ExitRemoteUIMode[] = {0xff,0x55,0x02,0x00,0x06};
//const prog_uchar GetMonoDisplayImageLimits[] = {0xff,0x55,0x03,0x04,0x00,0x33};
//const prog_uchar GetPlayStatus[GET_PLAY_STATUS_LEN] = {0xff,0x55,0x03,0x04,0x00,0x1c};
//const prog_uchar PlayControl[PLAY_CONTROL_LEN] = {0xff,0x55,0x04,0x04,0x00,0x29,0x01};
//const prog_uchar ContextButtonStatus[CONTEXT_BUTTON_STATUS_LEN] = {0xff,0x55,0x06,0x02,0x00,0x01,0x00,0x00,0x00};
//uFMFrequenceEeprom.wFMFrequenceEeprom __attribute__((section(".eeprom"))) = FM_PRESET_FREQUENCE;
//cCOM::cCOM()
//{
//}
//cCOM::~cCOM()
//{
//}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -