📄 radio.h
字号:
extern void RadioInit(void);
extern void RadioOn(void);
extern void RadioOff(void);
extern void RadioMain(void);
extern void RadioSeek(void);
extern void RadioSetFreq(unsigned int setfreq);
extern void RadioTunerSend(unsigned char start, unsigned char end);
extern void RadioTunerRead(void);
extern void RadioKey(void);
extern void RadioWork(void);
extern unsigned int RadioFreqCal(unsigned char step);
extern void Radio10msTimer(void);
extern void Radio100msTimer(void);
extern void RadioDisplay(void);
extern void RadioSave(unsigned char pos);
extern void RadioLoad(unsigned char pos);
extern void SeekOn(void);
extern void SeekOff(void);
extern void RadioMute(unsigned char type);
extern void PresetOrder(void);
extern signed char ChangeTV2(unsigned char inputbuff);
extern unsigned char ChangeToTV2(signed char inputbuff);
extern unsigned char GetTV2(unsigned int inputfreq);
unsigned char Radio_PLL_FMISet(unsigned int FMfreq);
unsigned char Radio_PLL_AMISet(unsigned int AMfreq);
#define Pin_AFS PIN36
#define PD_AFS PINDDR36
#define PO_AFS PINOR36
#define Pin_SWFLAG PIN38
#define PD_SWFLAG PINDDR38
#define PO_SWFLAG PINOR38
#define Pin_SSTOP PIN64
#define PD_SSTOP PINDDR64
#define PO_SSTOP PINOR64
#define AD_FSU 2
#define AD_QUAL 3
#define AD_ADJCH 6
#define AD_MPXW 12
#define AD_AMSTMP 15
typedef struct Band_stuct {
unsigned int BandFreq;
unsigned int MemFreq[6];
unsigned char MemSmeter[6];
unsigned int PI[6];
unsigned char MemAFList[6][8];
unsigned char MemAFNum[6];
unsigned char CurrentMem;
} BandStuct;
typedef struct Radio_stuct {
unsigned char SeekMode;
unsigned char WorkMode;
unsigned char CurrentBand;
unsigned int ReqFreq;
unsigned int Freq;
unsigned int BackupFreq;
unsigned char TunerBuff[40];
UCharField ReadBuff;
unsigned int TestPointFreq;
signed char TestPointVal;
signed int Slope;
signed int Slope2;
//unsigned char TunerBuff[10];
//unsigned char PllBuff[10];
BandStuct Band[5];
unsigned int MaxFreq;
unsigned int MinFreq;
unsigned char Step;
unsigned char SeekStep;
unsigned char Area;
signed char Direction;
unsigned char Smeter;
unsigned char SeekTh;
unsigned char F_ForceSetBuff:1;
unsigned char F_GoodStation:1;
unsigned char F_TunerDispReq:1;
unsigned char F_ManualSeek:1;
unsigned char F_Tuner_Empty:1;
unsigned char F_Board_Empty:1;
} RadioStuct;
ext RadioStuct Radio;
ext unsigned char RadioWaitTimer;
ext unsigned char RadioWorkTimer10ms;
ext unsigned char RadioWorkTimer;
ext unsigned char RadioTunerEepromTimer;
/*typedef struct Preset_stuct {
unsigned int Freq;
unsigned char Smeter;
} PresetStuct;
ext PresetStuct TempPreset[6];*/
ext unsigned char TempPresetNum;
ext unsigned char TempPresetSMMin;
ext unsigned char TempPresetSMMinNum;
#if TDA7540_TUNER
ext unsigned char SaveSmeterSlider;
#endif
#if TDA7541_TUNER
ext unsigned char SaveFSWOffset;
#endif
ext unsigned char SeekKeyTimer;
#define F_TunerISSON Radio.ReadBuff.field.B0
#define F_TunerISS80kHz Radio.ReadBuff.field.B1
#define F_TunerStereo Radio.ReadBuff.field.B2
#define F_TunerPLLLock Radio.ReadBuff.field.B3
#define F_TunerFieldStrengthLow Radio.ReadBuff.field.B4
#define F_TunerAdjacentChannel Radio.ReadBuff.field.B5
#define F_TunerDeviationStrong Radio.ReadBuff.field.B6
#define F_TunerDeviation Radio.ReadBuff.field.B7
#define RADIO_SEEK_IDLE 0
#define RADIO_SEEK_INIT 1
#define RADIO_SEEK_CHANGE_FRE 2
#define RADIO_SEEK_WAIT 3
#define RADIO_SEEK_CHECK 4
#define RADIO_SEEK_GOOD_STATION 5
#define RADIO_SEEK_BAD_STATION 6
#define RADIO_WORK_IDLE 0
#define RADIO_WORK_SEEKMODE 0x10
#define RADIO_WORK_SEEKREQ 0x11
#define RADIO_WORK_SEEKWAIT 0x12
#define RADIO_WORK_SEEKOK 0x13
#define RADIO_WORK_SEEKBREAK 0x14
#define RADIO_WORK_SEEKNEXT 0x15
#define RADIO_WORK_SEEKWAITRDS 0x16
#define RADIO_WORK_SEEKWAITPI 0x17
#define RADIO_WORK_SEEKWAITTP 0x18
#define RADIO_WORK_SEEKWAITPTY 0x19
#define RADIO_WORK_ASPSMODE 0x20
#define RADIO_WORK_PSREQ 0x21
#define RADIO_WORK_PSWAIT 0x22
#define RADIO_WORK_PSEND 0x23
#define RADIO_WORK_ASPSBREAK 0x24
#define RADIO_WORK_ASREQ 0x25
#define RADIO_WORK_ASWAIT 0x26
#define RADIO_WORK_ASEND 0x27
#define RADIO_WORK_ASNEXT 0x28
#define RADIO_WORK_ASWAITRDS 0x29
#define RADIO_WORK_ASWAITPI 0x2A
#define RADIO_WORK_ASWAITAFLIST 0x2B
//#define RADIO_IN_SEARCH (Radio.WorkMode==RADIO_WORK_ASWAIT ||Radio.WorkMode==RADIO_WORK_SEEKWAIT ||Radio.WorkMode==RADIO_WORK_SEEKNEXT ||Radio.WorkMode==RADIO_WORK_SEEKWAITRDS ||Radio.WorkMode==RADIO_WORK_SEEKWAITPI)
#define RADIO_IN_SEEK ((Radio.WorkMode>>4)==1)
#define RADIO_IN_AS (Radio.WorkMode>0x25)
#define RADIO_IN_PS ((Radio.WorkMode>0x20)&&(Radio.WorkMode<0x24))
#define RADIO_IN_SEARCH (RADIO_IN_SEEK||RADIO_IN_AS)
#define AREA_USA 0
#define AREA_LATIN 1
#define AREA_EUROPE 2
#define AREA_OIRT 3
#define AREA_JAPAN 4
#define LW_FREQ 300
#define AM_FREQ 2000
#define FM_FREQ 2000
#define FM_WB_START_FREQ 2300
#define FM_WB_STOP_FREQ 2600
#define FM_NORMAL_START_FREQ 8000
#define FM_OIRT_START_FREQ 6000
#define FM_OIRT_STOP_FREQ 7500
#define FM_JAPAN_START_FREQ 7500
#define FM_JAPAN_STOP_FREQ 9100
#define FreqInFM(x) (x>AM_FREQ)
#define FreqInAM(x) (x<FM_FREQ)
#define FreqInNormalFM(x) (x>FM_NORMAL_START_FREQ)
#define FreqInOirtFM(x) ((x>FM_OIRT_START_FREQ && x<FM_OIRT_STOP_FREQ)&&Radio.Area==AREA_OIRT)
#define FreqInJapanFM(x) (x>FM_JAPAN_START_FREQ && x<FM_JAPAN_STOP_FREQ&&Radio.Area==AREA_JAPAN)
#define FreqInWBFM(x) (x>FM_WB_START_FREQ && x<FM_WB_STOP_FREQ)
#define FreqInMWAM(x) (x>LW_FREQ && x<FM_FREQ)
#define FreqInLWAM(x) (x<LW_FREQ)
#define TunerEepromAddress 0xA0
#define BoardEepromAddress 0xA2 //socket board
//#define BoardEepromAddress 0xA4 //flash board--modify for use 24c04
//ext unsigned char TunerEepromBuff[72];
//ext unsigned char BoardEepromBuff[72];
ext unsigned char TunerEepromBuff[100];
ext unsigned char BoardEepromBuff[100];
//ext unsigned char EepromBuff[50];
ext unsigned char OtherPointBuff[7];
#define SEEK_FM_DIS 55
#define SEEK_FM_LOC 75
#define SEEK_AM_DIS 70
#define SEEK_AM_LOC 105
#ifdef DEBUGRADIO
ext unsigned char DebugBuffNum;
ext unsigned char DebugBuffPos;
#endif
//====================================================//
//=================== frequency define======================//
//====================================================//
//FM frequency define
#define FM80_0MHZ 8000
#define FM83_0MHZ 8300
#define FM87_0MHZ 8700
#define FM106_1MHZ 10610 // FM 106.1MHz
#define FM93_3MHZ 9330 // FM 93.3MHz
#define FM94_5MHZ 9450
#define FM98_6MHZ 9860
#define FM106_9MHZ 10690
#define FM98_1MHZ 9810
#define FM70_1MHZ 7010
#define FM87_5MHZ 8750
#define FM89_5MHz 8950
#define FM92_7MHz 9270
#define FM96_1MHz 9610
#define FM99_6MHz 9960
#define FM103_1MHz 10310
#define FM106_5MHz 10650
#define FM108MHZ 10800
//ORIT
#define FM65_0MHZ 6500
#define FM67_0MHZ 6700
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -