📄 softi2c.h
字号:
/*
**********************************************************************************************
* File: i2c.h
* Contents:
* The i2c module interface head file for FS8806
*
* Copyright (c) 2006 Fameg, Inc. All rights reserved
***********************************************************************************************
*/
#ifndef _SOFTIIC_H_
#define _SOFTIIC_H_
#include "kernel/system.h"
#include "hw/delay.h"
#include "user_config.h"
#if INCLUDE_FS8806
/* Define IIC communication PIN with GPIO */
#if 1 //T4 test board
sbit SDA = P2^0;
sbit SCL = P2^1;
sbit SDOUT= P2^2;
sbit SS_N = P2^3;
sbit RST = P2^4;
#else //T4 development board, TBD
sbit SDA = P2^0;
sbit SCL = P2^1;
sbit SDOUT= P2^2;
sbit SS_N = P2^3;
sbit RST = P2^4;
#endif
/* Define IIC SCL/SDA PIN operations */
#define WritePinSCL() SCL=1
#define ClearPinSCL() SCL=0
#define SetSDAin()
#define SetSDAout()
#define WritePinSDA() SDA=1
#define ClearPinSDA() SDA=0
#define ReadPinSDA() SDA
#define InitReadAck() SDA=1
/* Declare external global variable */
extern BYTE BusSlvAdr; //default I2c bus slave address for communiction
/* Global function prototype declaration */
void I2c_Init(BYTE SlvAdr, BOOL isHigh);
BYTE I2c_SendStr(BYTE sla, BYTE *s, WORD len);
BYTE I2c_RcvStr(BYTE sla, BYTE *s, WORD len);
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -