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.
71 lines
2.2 KiB
71 lines
2.2 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 _SIICx_H_
|
|
#define _SIICx_H_
|
|
|
|
#include "../clib/type.h"
|
|
#include "../clib/clib.h"
|
|
#include "../ctask/tick.h"
|
|
|
|
|
|
///>>>端口位定义,可修改!!!!!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
|
|
#include "../bsp/bsp_config.h"
|
|
|
|
#include "../msp/msp_siicx.h"
|
|
|
|
|
|
typedef struct
|
|
{
|
|
vU32 n;
|
|
vType sh;
|
|
unsigned char sal;
|
|
void (*pf_SDA_out)(vType x);
|
|
void (*pf_SDA_set)(vType x);
|
|
vType (*pf_SDA_get)(void);
|
|
|
|
void (*pf_SCL_out)(vType x);
|
|
void (*pf_SCL_set)(vType x);
|
|
|
|
/// void (*pf_init)(void);
|
|
void (*pf_close)(void);
|
|
|
|
}TS_siic;
|
|
|
|
extern TS_siic ts_siic1;
|
|
extern TS_siic ts_siic2;
|
|
|
|
//<<<<端口位定义,可修改!!!!!!<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
|
extern void L0_iicx_INIT(TS_siic *p,unsigned char v);
|
|
extern void L0_iicx_SendData(TS_siic *p,unsigned char c);
|
|
extern unsigned char L0_iicx_ReceiveData(TS_siic *p);
|
|
extern void L1_iicx_ReadNByte(TS_siic *p,unsigned char *b,unsigned char n);
|
|
///////////////////////////////
|
|
///写入一个reg 为后续的写命令或者读取服务
|
|
extern void L1_iicx_Write1Reg(TS_siic *p,unsigned char reg);
|
|
// sla.(reg)=cmd
|
|
extern void L2_iicx_Write1Reg1Cmd(TS_siic *p,unsigned char reg,unsigned char cmd);
|
|
//读取reg地址的n个数据 sla.(reg) sla.(reg+1)................ sla.(reg+n)
|
|
extern void L2_iicx_Read1Reg(TS_siic *p,unsigned char reg,
|
|
unsigned char *r,unsigned char n);
|
|
extern void L1_iicx_Read2cmd(TS_siic *p, unsigned char *c,unsigned char *b,unsigned char n);
|
|
extern void L2_iicx_Write2Cmd(TS_siic *p, unsigned char reg,unsigned char cmd,unsigned char cmd2);
|
|
extern void L2_iicx_Read2Cmd(TS_siic *p, unsigned char cmd,unsigned char cmd2,
|
|
unsigned char *buf,unsigned char n);
|
|
#endif// #ifndef _IIC_H_
|
|
|
|
|