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.

64 lines
2.4 KiB

1 year ago
//////////////////////////////////////////////////////////////////////////
/// 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 _msp_iicM1_H_
#define _msp_iicM1_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_IICM1_delay(x) ///Lc_delay_us(80)
#endif
//<<<<端口位定义,可修改!!!!!!<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
extern void L2_IICM1_ReadReg(unsigned char sla,unsigned char reg,unsigned char *r,unsigned char n);
extern void L2_IICM1_WriteCmd(unsigned char sla,unsigned char reg,unsigned char cmd);
extern void L0_IICM1_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_IICM1_ReadReg((x),(y),(z),1)
extern unsigned char L2_IICM1_Read1Reg1D(unsigned char sla,unsigned char reg);
#endif// #ifndef _IIC_H_