Files
2026-10-19 15:33:00 +08:00

222 lines
4.7 KiB
C
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**************************************************************************
**************************************************************************/
#include "Define_Global.h"
/**************************************************************************
* IO¿ÚÉÏÀ­ÉèÖÃ
**************************************************************************/
#if !_MODE_COMM_NO_
unsigned char SetWPUX_CommHave(unsigned char x)
{
volatile unsigned char i = 0;
//---------------------------------------------------------------------
#ifdef _pIGBT_OVUV
if(x == (_pIGBT_OVUV >> 4))
{
i |= 1 << (unsigned)(0xF & _pIGBT_OVUV);
}
#endif
#ifdef _pCOMM_IN
if(x == (_pCOMM_IN >> 4))
{
i |= 1 << (unsigned)(0xF & _pCOMM_IN);
}
#endif
//---------------------------------------------------------------------
return i;
}
#endif
/*************************************************************************/
#if _MODE_COMM_NO_ || !_MODE_COMM_HAVE_
unsigned char SetWPUX_CommNo(unsigned char x)
{
volatile unsigned char i = 0;
//---------------------------------------------------------------------
#ifdef _pIGBT_OVUV
if(x == (_pIGBT_OVUV >> 4))
{
i |= 1 << (unsigned)(0xF & _pIGBT_OVUV);
}
#endif
//---------------------------------------------------------------------
return i;
}
#endif
/**************************************************************************
* IO¿Ú·½ÏòÉèÖÃ
**************************************************************************/
#if !_MODE_COMM_NO_
unsigned char SetTRISX_CommHave(unsigned char x)
{
volatile unsigned char i = 0;
//---------------------------------------------------------------------
#ifdef _pBUZZ
if(x == (_pBUZZ >> 4))
{
i |= 1 << (unsigned)(0xF & _pBUZZ);
}
#endif
#ifdef _pFAN
if(x == (_pFAN >> 4))
{
i |= 1 << (unsigned)(0xF & _pFAN);
}
#endif
#ifdef _pIGBT_SUP
if(x == (_pIGBT_SUP >> 4))
{
i |= 1 << (unsigned)(0xF & _pIGBT_SUP);
}
#endif
#ifdef _pCOMM_OUT
if(x == (_pCOMM_OUT >> 4))
{
i |= 1 << (unsigned)(0xF & _pCOMM_OUT);
}
#endif
//---------------------------------------------------------------------
#ifdef _TEST_CMPOUT_
#if _TEST_CMPOUT_ == _Pin_CMPOUT1
if(x == (_Pin_CMPOUT1 >> 4))
{
i |= 1 << (unsigned)(0xF & _Pin_CMPOUT1);
}
#elif _TEST_CMPOUT_ == _Pin_CMPOUT2
if(x == (_Pin_CMPOUT2 >> 4))
{
i |= 1 << (unsigned)(0xF & _Pin_CMPOUT2);
}
#endif
#elif _MODE_IHDEBUG_
if(B_Test_CM_RA0)
{
if(x == (_Pin_CMPOUT1 >> 4))
{
i |= 1 << (unsigned)(0xF & _Pin_CMPOUT1);
}
}
else if(B_Test_CM_RB7)
{
if(x == (_Pin_CMPOUT2 >> 4))
{
i |= 1 << (unsigned)(0xF & _Pin_CMPOUT2);
}
}
#endif
#ifdef _TEST_PGAOUT_
if(x == (_Pin_PGAOUT >> 4))
{
i &= ~(1 << (unsigned)(0xF & _Pin_PGAOUT));
}
#elif _MODE_IHDEBUG_
if(B_Test_PGA)
{
if(x == (_Pin_PGAOUT >> 4))
{
i &= ~(1 << (unsigned)(0xF & _Pin_PGAOUT));
}
}
#endif
//---------------------------------------------------------------------
return (unsigned)~i;
}
#endif
/*************************************************************************/
#if _MODE_COMM_NO_ || !_MODE_COMM_HAVE_
unsigned char SetTRISX_CommNo(unsigned char x)
{
volatile unsigned char i = 0;
//---------------------------------------------------------------------
#ifdef _pBUZZ
if(x == (_pBUZZ >> 4))
{
i |= 1 << (unsigned)(0xF & _pBUZZ);
}
#endif
#ifdef _pFAN
if(x == (_pFAN >> 4))
{
i |= 1 << (unsigned)(0xF & _pFAN);
}
#endif
#ifdef _pIGBT_SUP
if(x == (_pIGBT_SUP >> 4))
{
i |= 1 << (unsigned)(0xF & _pIGBT_SUP);
}
#endif
#ifdef _pSDA
if(x == (_pSDA >> 4))
{
i |= 1 << (unsigned)(0xF & _pSDA);
}
#endif
#ifdef _pSCK
if(x == (_pSCK >> 4))
{
i |= 1 << (unsigned)(0xF & _pSCK);
}
#endif
#ifdef _pSTB
if(x == (_pSTB >> 4))
{
i |= 1 << (unsigned)(0xF & _pSTB);
}
#endif
//---------------------------------------------------------------------
#ifdef _TEST_CMPOUT_
#if _TEST_CMPOUT_ == _Pin_CMPOUT1
if(x == (_Pin_CMPOUT1 >> 4))
{
i |= 1 << (unsigned)(0xF & _Pin_CMPOUT1);
}
#elif _TEST_CMPOUT_ == _Pin_CMPOUT2
if(x == (_Pin_CMPOUT2 >> 4))
{
i |= 1 << (unsigned)(0xF & _Pin_CMPOUT2);
}
#endif
#elif _MODE_IHDEBUG_
if(B_Test_CM_RA0)
{
if(x == (_Pin_CMPOUT1 >> 4))
{
i |= 1 << (unsigned)(0xF & _Pin_CMPOUT1);
}
}
else if(B_Test_CM_RB7)
{
if(x == (_Pin_CMPOUT2 >> 4))
{
i |= 1 << (unsigned)(0xF & _Pin_CMPOUT2);
}
}
#endif
#ifdef _TEST_PGAOUT_
if(x == (_Pin_PGAOUT >> 4))
{
i &= ~(1 << (unsigned)(0xF & _Pin_PGAOUT));
}
#elif _MODE_IHDEBUG_
if(B_Test_PGA)
{
if(x == (_Pin_PGAOUT >> 4))
{
i &= ~(1 << (unsigned)(0xF & _Pin_PGAOUT));
}
}
#endif
//---------------------------------------------------------------------
return (unsigned)~i;
}
#endif