📄 i2c.h
字号:
/*--------------------------------------------------------------------------
I2C.H
Header file for I2C
History:
07/20/2006 : First Version V0.1 ---HsinChu Office
09/15/2006 : Version 0.2 ---HsinChu Office
1.Increase AL320EVB and AL320DVB I2C Port define.
Copyright (c) 1998-2006 AverLogic Inc
All rights reserved.
--------------------------------------------------------------------------*/
#ifndef __I2C_H__
#define __I2C_H__
#include <REG52.H>
#ifdef AL320EVB //AL320EVB
sfr Port1 = 0x90;
sbit sda = P1^7;
sbit scl = P1^6;
#else //AL320DVB
sfr Port1 = 0x90;
sbit sda = P1^7;
sbit scl = P1^6;
#endif
#define TRUE 1
#define FALSE 0
#define DATA_COMMAND 0xff
#define DATA_END 0xff
#define COMMAND_DELAY 0x80
#define DELAY_VALUE 0x7f
#define PAGE_ADDRESS_MAX 0x08
#define ONEMS 105
void I2CStart(void);
void I2CStop(void);
void I2CWait(void);
void I2CAck(Bool);
Bool I2CTransmit(Byte ucTxdata);
Byte I2CReceive(void);
void I2CWrite(Byte ucDevice, Byte ucAddress, Byte ucSetdata);
Byte I2CRead(Byte ucDevice,Byte ucAddress);
Byte I2CLocate(Byte ucslave_addr, Byte ucsub_addr);
void SetReg(Byte ucSlaveID,Byte ucSubAddr,Byte ucDx);
Byte GetReg(Byte ucSlaveID,Byte ucSubAddr);
void InitReg(Byte *pucDat);
void Delay(int time_ms);
void srgb_write(unsigned char addr, unsigned char dat);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -