csqpskswitchs.c
来自「QPSK Tuner details, for conexant chipset」· C语言 代码 · 共 126 行
C
126 行
#include "CSQPSKSwitchs.h"
#include "cs_gpio.h"
#include "cs_qpsk.h"
#include "CSHDI_typedef.h"
#include "CS_typedef.h"
#include "CS_assert.h"
extern int g_bLNBPowerGPIOIndex[MAX_TUNER_NUM];
extern int g_b13_18VGPIOIndex[MAX_TUNER_NUM];
extern int g_b0_12VGPIOIndex[MAX_TUNER_NUM];
extern CSQPSKSignalParameterS2 g_TQPSKChannelCopy[MAX_TUNER_NUM];
extern CSQPSKSignalParameterS2 g_TQPSKChannelCopy1[MAX_TUNER_NUM];
CSQPSK_Error_t CSSetLNBPower( CSHDITunerIndex bTunerIndex, CSQPSK_LNB_Status nSwitchStatus )
{
int ErrorCode;
if ( g_bLNBPowerGPIOIndex[bTunerIndex] == 0xff )
{
return CSQPSK_FAILURE;
}
if ( g_b13_18VGPIOIndex[bTunerIndex] == 0xff && (nSwitchStatus == LNB_14V || nSwitchStatus == LNB_18V ))
{
return CSQPSK_FAILURE;
}
switch( nSwitchStatus)
{
case LNB_OFF:
{
CSGPIOWrite(g_bLNBPowerGPIOIndex[bTunerIndex], 1);
}
break;
case LNB_AUTO:
{
CSGPIOWrite(g_bLNBPowerGPIOIndex[bTunerIndex], 0);
}
break;
case LNB_14V:
{
CSGPIOWrite(g_bLNBPowerGPIOIndex[bTunerIndex], 0);
CSGPIOWrite(g_b13_18VGPIOIndex[bTunerIndex], 1);
}
break;
case LNB_18V:
{
CSGPIOWrite(g_bLNBPowerGPIOIndex[bTunerIndex], 0);
CSGPIOWrite(g_b13_18VGPIOIndex[bTunerIndex], 0);
}
break;
default:
{
}
break;
}
if(nSwitchStatus == CSHDI_OFF)
ErrorCode= CSGPIOWrite(g_bLNBPowerGPIOIndex[bTunerIndex], 1);
else
ErrorCode = CSGPIOWrite(g_bLNBPowerGPIOIndex[bTunerIndex], 0);
if ( ErrorCode != CS_GPIO_SUCCESS )
{
return CSQPSK_GPIO_ERROR;
}
return CSQPSK_SUCCESS;
}
CSQPSK_Error_t CSSet13_18V( CSHDITunerIndex bTunerIndex, Channel_Polarisation nSwitchStatus )
{
int ErrorCode;
if ( g_b13_18VGPIOIndex[bTunerIndex] == 0xff )
{
return CSQPSK_FAILURE;
}
if ( nSwitchStatus == POLARISATION_H )
ErrorCode = CSGPIOWrite(g_b13_18VGPIOIndex[bTunerIndex], 0);
else
ErrorCode = CSGPIOWrite(g_b13_18VGPIOIndex[bTunerIndex], 1);
//g_TQPSKChannelCopy[bTunerIndex].bPolar = nSwitchStatus;
g_TQPSKChannelCopy1[bTunerIndex].bPolar = nSwitchStatus;
if ( ErrorCode != CS_GPIO_SUCCESS )
{
return CSQPSK_GPIO_ERROR;
}
return CSQPSK_SUCCESS;
}
CSQPSK_Error_t CSSet0_12V( CSHDITunerIndex bTunerIndex, Switch0_12V nSwitchStatus )
{
int ErrorCode;
if ( g_b0_12VGPIOIndex[bTunerIndex] == 0xff )
{
return CSQPSK_FAILURE;
}
if( nSwitchStatus == SWITCH_12V)
{
ErrorCode = CSGPIOWrite(g_b0_12VGPIOIndex[bTunerIndex], 0);
}
else
{
ErrorCode = CSGPIOWrite(g_b0_12VGPIOIndex[bTunerIndex], 1);
}
if ( ErrorCode != CS_GPIO_SUCCESS )
{
return CSQPSK_GPIO_ERROR;
}
//g_TQPSKChannelCopy[bTunerIndex].bSwitch0_12V = nSwitchStatus;
g_TQPSKChannelCopy1[bTunerIndex].bSwitch0_12V = nSwitchStatus;
return CSQPSK_SUCCESS;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?