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

📄 tuner_drv.c

📁 模拟高频头的 驱动程序(搜台、换台等功能)
💻 C
字号:
/******************************************************************************/
/**
 * @file    tuner_drv.c
 *
 * @brief   This file contains the register transfer functions
 *          of the driver of module Tuner.
 *
 * @note    (c) 2005 - 2008 Micronas GmbH. All rights reserved.
 *          Any use of the Software is permitted only in accordance
 *          with the terms set forth in the disclaimer text file.
 *
 * @author  ACOM software team
 ******************************************************************************/

#define _SOURCE_TUNER_DRV_


/******************************************************************************/
/**
 * INCLUDE FILES:
 ******************************************************************************/

#include <system.h>

#include "tuner_init.h"
#include "tuner_drv.h"
#include "tuner_rh_reg.h"
#include "tuner_reg.h"
#include <api_i2c.h>



/******************************************************************************/
/**
 * GLOBAL FUNCTIONS:
 ******************************************************************************/

void TUNER_DrvRsaRsb(const uint8_t rsaRsb)
{
   Tuner_RegSet(TUNER_RsaRsb, rsaRsb);
}
//land7Astart
#ifdef __AD_TUNER_ALPS__
void TUNER_SwitchToDTV(noYes_t YesOrNo)
{
	if (!YesOrNo)
	{
		Tuner_RegSet(TUNER_IFBW2_1,0);
	}
	else
	{
		Tuner_RegSet(TUNER_IFBW2_1,3);
	}
}
#endif
//Aend02-08
/******************************************************************************/
/**
 * @brief   Calculates frequency band and writes to tuner registers.
 *
 * @param   tunerFrequ [in] = tuner frequency, IF correction included
 *
 * @return  --
 ******************************************************************************/

void Tuner_DrvCalcFrequencyBand(const uint16_t tunerFrequ)
{
   uint8_t bandPorts = TUNER_VHFLOWBAND;
   uint8_t progDivByte1, progDivByte2;
 uint8_t dataBuf[5];
       if( tunerFrequ < (153*16+IFBG) )  // low bank//xw070115
        dataBuf[3] = 0x65;//TN_LOW_BAND;
    else if( tunerFrequ < (398.00 *16+IFBG) ) // middle band
        dataBuf[3] = 0x66;
    else if( tunerFrequ < (430.00 *16+IFBG) ) // middle band
        dataBuf[3] = 0xa6;//TN_MID_BAND;
    else if( tunerFrequ < (782.00 *16+IFBG) ) // middle band
        dataBuf[3] = 0xac;
    else
        dataBuf[3] = 0xec;//TN_HIGH_BAND;
   progDivByte1 = (uint8_t)(tunerFrequ >> 8);
   progDivByte2 = (uint8_t)(tunerFrequ);
   dataBuf[0]=progDivByte1;//xw
   dataBuf[1]=progDivByte2;//xw
   dataBuf[2]=0x8b;//0x8a;
   dataBuf[4]=0xc6;

/*
   if (tunerFrequ < (gwTunerVHF1VHF3Bound+IFBG))
      bandPorts = TUNER_VHFHIGHBAND;
   if (tunerFrequ >= (gwTunerVHF3UHFBound + IFBG))
      bandPorts = TUNER_UHFBAND;
   
   progDivByte1 = (uint8_t)(tunerFrequ >> 8);
   progDivByte2 = (uint8_t)(tunerFrequ);
   Tuner_RegSet(TUNER_ProgDividerByte1_14_8, progDivByte1);
   Tuner_RegSet(TUNER_ProgDividerByte2_7_0, progDivByte2);
   #ifndef __AD_TUNER_ALPS__
   Tuner_RegSet(TUNER_BandPorts2_0, bandPorts);
   #else
   Tuner_RegSet(TUNER_ControlByte2NotUsed,0);
   Tuner_RegSet(TUNER_BandPorts2_0, bandPorts);
   Tuner_RegSet(TUNER_ControlByte1Const, 1);
   Tuner_RegSet(TUNER_Chp, 0);
   Tuner_RegSet(TUNER_T2_0,2);
   #endif
   Tuner_RegWriteAllRegisters();
*/

       API_I2c_Write(4, 0, 0, dataBuf, 5);
}

⌨️ 快捷键说明

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