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.
97 lines
2.4 KiB
97 lines
2.4 KiB
//////////////////////////////////////////////////////////////////////////
|
|
/// COPYRIGHT NOTICE
|
|
/// Copyright (c) 2023 CCSENS
|
|
/// 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(MainFre_5M == D_sys_MainFre)
|
|
|
|
|
|
#define D_iicm_delay 1
|
|
|
|
#elif(MainFre_11M == D_sys_MainFre)
|
|
// #define L0_slc_1_delay(x)
|
|
// #define L0_slc_0_delay(x)
|
|
|
|
#define D_iicm_delay 1
|
|
#define L0_slc_1_delay(x) Lc_delay_nop(x);
|
|
#define L0_slc_0_delay(x) Lc_delay_nop(x);
|
|
#elif(MainFre_22M == D_sys_MainFre)
|
|
|
|
#define D_iicm_delay 2
|
|
|
|
#define L0_slc_1_delay(x) Lc_delay_nop(x);
|
|
#define L0_slc_0_delay(x) Lc_delay_nop(x);
|
|
#elif(MainFre_27M == D_sys_MainFre)
|
|
|
|
#define D_iicm_delay 3
|
|
|
|
|
|
#elif(MainFre_44M == D_sys_MainFre)
|
|
|
|
#define D_iicm_delay 4
|
|
|
|
#define L0_slc_1_delay(x) Lc_delay_us(x);
|
|
#define L0_slc_0_delay(x) Lc_delay_us(x);
|
|
|
|
#else ///MainFre_11M
|
|
///#warnning
|
|
#endif//D_sys_MainFre)
|
|
|
|
|
|
|
|
|
|
///>>>端��定义,�修�!!!!!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
|
|
typedef struct
|
|
{
|
|
u16 t1[D_iic_chnum];
|
|
u16 t0[D_iic_chnum];
|
|
|
|
}TS_iicm_;
|
|
extern TS_iicm_ ts_iicm;
|
|
|
|
|
|
|
|
|
|
//<<<<端��定义,�修 !!!!!!<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
|
extern void L2_IICMx_Write1Reg(vtype ch,unsigned char sla,unsigned char reg );
|
|
|
|
extern void L2_IICMx_ReadReg(vtype ch,unsigned char sla,unsigned char reg,unsigned char *r,unsigned char n);
|
|
extern void L2_IICMx_WriteCmd(vtype ch,unsigned char sla,unsigned char reg,unsigned char cmd);
|
|
extern void L0_IICMx_INIT(vtype ch,unsigned char v);
|
|
////extern void L2_tws_ReadReg(unsigned char sla,unsigned char reg,
|
|
//// unsigned char *v);
|
|
#define L2_tws_ReadReg(ch,x,y,z) L2_IICMx_ReadReg((ch),(x),(y),(z),1)
|
|
|
|
extern unsigned char L2_IICMx_Read1Reg1D(vtype ch,unsigned char sla,unsigned char reg);
|
|
|
|
void L0_IICMx_SCL(vtype ch,vtype v);
|
|
|
|
void L0_IICMx_SDA(vtype ch,vtype v);
|
|
|
|
|
|
void L0_IICMx_Stop(vtype ch);
|
|
|
|
|
|
|
|
|
|
#endif// #ifndef _IIC_H_
|
|
|
|
|