NULL
This commit is contained in:
70
user/Device/TPL0501.c
Executable file
70
user/Device/TPL0501.c
Executable file
@@ -0,0 +1,70 @@
|
||||
#include "../main/SystemInclude.h"
|
||||
|
||||
//##############################################################################
|
||||
#ifndef ENABLE_USE_TPL0501
|
||||
#pragma message("[undefined] ENABLE_USE_TPL0501")
|
||||
#elif(ENABLE_USE_TPL0501)
|
||||
//##############################################################################
|
||||
//==============================================================================
|
||||
//==============================================================================
|
||||
void DigitalPotOutput(unsigned int PotCHN, unsigned int PotData)
|
||||
{
|
||||
unsigned int selBit, I;
|
||||
|
||||
POT_DIR |= POTA_CS_PIN + POTC_CS_PIN;
|
||||
POT_OUT |= POTA_CS_PIN + POTC_CS_PIN;
|
||||
|
||||
SDA2_OUT();
|
||||
SCL2_OUT();
|
||||
CLR_SCL2();
|
||||
|
||||
if(PotCHN == CTYPE_POT) selBit = POTC_CS_PIN;
|
||||
else selBit = POTA_CS_PIN;
|
||||
|
||||
POT_OUT &= ~selBit;
|
||||
for(I=0; I<8; I++)
|
||||
{
|
||||
if((PotData & 0x80) == 0x80) SET_SDA2();
|
||||
else CLR_SDA2();
|
||||
|
||||
SET_SCL2();
|
||||
_NOP();
|
||||
_NOP();
|
||||
PotData <<= 1;
|
||||
CLR_SCL2();
|
||||
_NOP();
|
||||
_NOP();
|
||||
_NOP();
|
||||
}
|
||||
|
||||
POT_OUT |= selBit;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void DigitalPotLowPower(void)
|
||||
{
|
||||
// SCL2_OUT();
|
||||
// SDA2_OUT();
|
||||
//
|
||||
// CLR_SCL2();
|
||||
// CLR_SDA2();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
unsigned char DigitalPotRead(unsigned int PotCHN)
|
||||
{
|
||||
unsigned char readData;
|
||||
|
||||
// I2C2_Init();
|
||||
//
|
||||
// I2C2_Start();
|
||||
// I2C2_Write(I2C2_RD | CAT5171_ADDR | PotCHN);
|
||||
// readData = I2C2_Read();
|
||||
// I2C2_Stop();
|
||||
|
||||
return readData;
|
||||
}
|
||||
|
||||
//##############################################################################
|
||||
#endif
|
||||
//##############################################################################
|
||||
Reference in New Issue
Block a user