You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
2.3 KiB
62 lines
2.3 KiB
//////////////////////////////////////////////////////////////////////////
|
|
/// COPYRIGHT NOTICE
|
|
/// Copyright (c) 2018, 传控科技
|
|
/// All rights reserved.
|
|
///
|
|
/// @file iic_sim
|
|
/// @brief iic 模拟io 版本, 和cpu无关,唯一需要修改的就是头函数中的管脚定义
|
|
/// @info 除了io配置 ,其他地方如无必要请勿修改
|
|
///(本文件实现的功能的详述)
|
|
///
|
|
/// @version 1.1 CCsens technology
|
|
/// @author CC
|
|
/// @date 20180102
|
|
|
|
//
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
#ifndef _IIC_M1_H_
|
|
#define _IIC_M1_H_
|
|
|
|
#include "c_lib.h"
|
|
#include "bsp_config.h"
|
|
|
|
|
|
|
|
///>>>端口位定义,可修改!!!!!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
|
|
|
|
|
|
#if 0
|
|
//// for stc 11.0M
|
|
#define delay10us() NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();///Lc_delay_us(1) //根据cpu的速率进行相应的调整
|
|
#define L0_I2C_delay(x) NOP();NOP();///Lc_delay_us(x)
|
|
#else
|
|
///#define delay10us() NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();///Lc_delay_us(1) //根据cpu的速率进行相应的调整
|
|
///#define L0_I2C_delay(x) NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();NOP();///Lc_delay_us(x)
|
|
|
|
//#define delay10us() Lc_delay_us(3000) //根据cpu的速率进行相应的调整
|
|
//#define L0_I2C_delay(x) Lc_delay_us(10000)
|
|
///#define delay10us() Lc_delay_us(80) //20us
|
|
///#define L0_I2C_delay(x) Lc_delay_us(300) //25us
|
|
|
|
#define L0_slc_1_delay() Lc_delay_nop(4);
|
|
#define L0_slc_0_delay() Lc_delay_nop(1); // 4us
|
|
|
|
#define L0_I2C_delay(x) ///Lc_delay_us(80)
|
|
|
|
#endif
|
|
|
|
//<<<<端口位定义,可修改!!!!!!<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
|
|
|
|
|
extern void L2_I2C_ReadReg(unsigned char sla,unsigned char reg,unsigned char *r,unsigned char n);
|
|
extern void L2_I2C_WriteCmd(unsigned char sla,unsigned char reg,unsigned char cmd);
|
|
extern void L0_I2C_INIT(unsigned char v);
|
|
////extern void L2_tws_ReadReg(unsigned char sla,unsigned char reg,
|
|
//// unsigned char *v);
|
|
#define L2_tws_ReadReg(x,y,z) L2_I2C_ReadReg((x),(y),(z),1)
|
|
|
|
|
|
#endif// #ifndef _IIC_H_
|
|
|
|
|