📄 m52795.c
字号:
/*******************************************************************************
** (c) Copyright 2004-2005, xujiajun
** All Rights Reserved
** V040723
**--------------文件信息--------------------------------------------------------
**创 建 人: 徐家俊
**创建日期: 2006年1月20日
**描 述:M52795驱动, call I2C function
**--------------版本修订历史----------------------------------------------------
** 修改人:徐家俊
** 版 本: V
** 日 期: 年月日
** 描 述:
**--------------当前版本修订----------------------------------------------------
** 修改人:徐家俊
** 版 本:
** 日 期:年月日
** 描 述:
**------------------------------------------------------------------------------
*******************************************************************************/
#define IN_M52795
#include"main.h"
/*-----------------------------------------------------------------------------*/
#define ADDR_M52795 0x90//0x92 //I2C写地址
/*-----------------------------------------------------------------------------*/
//define the two byte data for M52795
uchar idata M52795Data[2];
/********************************************************************************************************
Descriptions: SendDataTo52795
input parameters: None
Returned value: None
Used global variables: None
Calling modules: None
Created by: xjj 2006/01/20
-------------------------------------------------------------------------------------------------------
Modified by:
********************************************************************************************************/
void SendDataTo52795(void)
{
ISendStr(ADDR_M52795, M52795Data[0], &M52795Data[1], 1);
}
/********************************************************************************************************
Descriptions: SelectSW1OfM52795
input parameters: use defined switch orders
Returned value: None
Used global variables: None
Calling modules: None
Created by: xjj 2006/01/20
-------------------------------------------------------------------------------------------------------
Modified by:
********************************************************************************************************/
void SelectSW1OfM52795(uchar VideoSelect, uchar AudioSelect, uchar VAmp)
{
M52795Data[0] &= 0x30;
M52795Data[0] |= VideoSelect;
M52795Data[0] |= AudioSelect;
M52795Data[0] |= VAmp;
SendDataTo52795();
}
/********************************************************************************************************
Descriptions: SelectSW2OfM52795
input parameters: use defined switch orders
Returned value: None
Used global variables: None
Calling modules: None
Created by: xjj 2006/01/20
-------------------------------------------------------------------------------------------------------
Modified by:
********************************************************************************************************/
void SelectSW2OfM52795(uchar VideoSelect, uchar AudioSelect, uchar VAmp)
{
M52795Data[1] &= 0x30;
M52795Data[1] |= VideoSelect;
M52795Data[1] |= AudioSelect;
M52795Data[1] |= VAmp;
SendDataTo52795();
}
/********************************************************************************************************
Descriptions: Select all switches of M52795
input parameters: use defined switch orders
Returned value: None
Used global variables: None
Calling modules: None
Created by: simon 2006.05.05
-------------------------------------------------------------------------------------------------------
Modified by:
********************************************************************************************************/
void SelectAllSwOfM52795(uchar VideoSelect, uchar AudioSelect, uchar VAmp)
{
M52795Data[0] &= 0x30;
M52795Data[0] |= VideoSelect;
M52795Data[0] |= AudioSelect;
M52795Data[0] |= VAmp;
M52795Data[1] &= 0x30;
M52795Data[1] |= VideoSelect;
M52795Data[1] |= AudioSelect;
M52795Data[1] |= VAmp;
SendDataTo52795();
}
/********************************************************************************************************
Descriptions: Set M52795 two switchs mute
input parameters: use defined switch orders
Returned value: None
Used global variables: None
Calling modules: None
Created by: xjj 2006/01/20
-------------------------------------------------------------------------------------------------------
Modified by:
********************************************************************************************************/
void M52795Mute(void)
{
SelectSW1OfM52795(VIDEO_1,AUDIO_MUTE,V_AMP_0DB);
SelectSW2OfM52795(VIDEO_1,AUDIO_MUTE,V_AMP_0DB);
}
/********************************************************************************************************
Descriptions: Set the I/O of M52795
input parameters: Data: D3=D5;D2=D4;D1=DD;D0=DC; high 4 bits are ignored.
Returned value: None
Used global variables: None
Calling modules: None
Created by: xjj 2006/01/20
-------------------------------------------------------------------------------------------------------
Modified by:
********************************************************************************************************/
void SetIOM52795(uchar Data)
{
uchar temp;
Data &= 0x0f;
temp = Data;
temp <<= 2;
temp &= 0x30;
M52795Data[0] |= temp;
temp = Data;
temp <<= 4;
temp &= 0x30;
M52795Data[1] |= temp;
SendDataTo52795();
}
/********************************************************************************************************
Descriptions: Get the I/O of M52795
input parameters: None
Returned value: D3=D5;D2=D4;D1=DD;D0=DC; high 4 bits are ignored.
Used global variables: None
Calling modules: None
Created by: xjj 2006/01/20
-------------------------------------------------------------------------------------------------------
Modified by:
********************************************************************************************************/
/*
uchar GetIOM52795(void)
{
uchar temp = 0;
temp = M52795Data[0];
temp >>= 2;
temp &= 0x0c;
temp |= ((M52795Data[1]&0x30)>>4) ;
return temp;
}
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -