void BK_Set_Freq(UINT8 dir, double frequency) //frequencyP 这个参数为什么没有使用
{
UINT16 val = 0;
if(DIR_TX==dir)
{
BK_RampDown_Enable();
}
if((chan_num == 1)||(chan_num == 2)) //chan_num 这个变量没看到赋值,怎么做判断
{
val = BK_Read_Reg(126);
val |= 0x0010;
BK_Write_Reg(126, val);
if(chan_num == 1)
BK_Write_Reg(127, 0x4719);
else
BK_Write_Reg(127, 0x1095);
}
if((chan_num == 3)||(chan_num == 4)||(chan_num == 5))
{
val = BK_Read_Reg(126);
val &= 0xffef;
BK_Write_Reg(126, val);
if(chan_num == 3)
BK_Write_Reg(127, 0xDa11);
else if(chan_num == 4)
BK_Write_Reg(127, 0xA38D);
else
BK_Write_Reg(127, 0x6D08);
}
BK_Write_Reg(113, freq_h);//freq_h这个也没见给赋值
BK_Write_Reg(114, freq_l);//freq_l这个也没见给赋值
BK_SPI_trigger();
g_reg0_15_buff[3]&=0x1FFF;
if(chan_num == 1)
{
g_reg0_15_buff[3]|=0x8000;
}
else if(chan_num == 2)
{
g_reg0_15_buff[3]|=0x6000;
}
else if(chan_num == 3)
{
g_reg0_15_buff[3]|=0x4000;
}
else if(chan_num == 4)
{
g_reg0_15_buff[3]|=0x2000;
}
else if(chan_num == 5)
{
g_reg0_15_buff[3]|=0x0000;
}
BK_Write_Reg(3, g_reg0_15_buff[3]);
delay_ms(15);
if(DIR_TX==dir)
{
BK_RampUp_Enable();
}
}
求解 谢谢
|