/*==========================================================================================================
本源程序文件内部使用的一些操作指令的宏定义
==========================================================================================================*/
/*------------------------------------------------------------------------------------------------
输入/输出端口和引脚宏定义:(注:下列这些定义用以简化宏函数参数字符。)
------------------------------------------------------------------------------------------------*/
#define MFH_PIN_CFG_INPU_I2cScl MFH_PIN_CFG_INPU(cDdrI2cScl, cPurI2cScl, cCirI2cScl, cOdrI2cScl, cIdrI2cScl, cBitI2cScl)
#define MFH_PIN_CFG_INHZ_I2cScl MFH_PIN_CFG_INHZ(cDdrI2cScl, cPurI2cScl, cCirI2cScl, cOdrI2cScl, cIdrI2cScl, cBitI2cScl)
#define MFH_PIN_CFG_OOUT_I2cScl MFH_PIN_CFG_OOUT(cDdrI2cScl, cPurI2cScl, cCirI2cScl, cOdrI2cScl, cIdrI2cScl, cBitI2cScl)
#define MFH_PIN_CFG_OUTH_I2cScl MFH_PIN_CFG_OUTH(cDdrI2cScl, cPurI2cScl, cCirI2cScl, cOdrI2cScl, cIdrI2cScl, cBitI2cScl)
#define MFH_PIN_CFG_OUTL_I2cScl MFH_PIN_CFG_OUTL(cDdrI2cScl, cPurI2cScl, cCirI2cScl, cOdrI2cScl, cIdrI2cScl, cBitI2cScl)
#define MFH_PIN_OUT_SETH_I2cScl MFH_PIN_OUT_SETH(cDdrI2cScl, cPurI2cScl, cCirI2cScl, cOdrI2cScl, cIdrI2cScl, cBitI2cScl)
#define MFH_PIN_OUT_CLRL_I2cScl MFH_PIN_OUT_CLRL(cDdrI2cScl, cPurI2cScl, cCirI2cScl, cOdrI2cScl, cIdrI2cScl, cBitI2cScl)
#define MFH_PIN_IN_STATE_I2cScl MFH_PIN_IN_STATE(cDdrI2cScl, cPurI2cScl, cCirI2cScl, cOdrI2cScl, cIdrI2cScl, cBitI2cScl)
#define MFH_PIN_CFG_INPU_I2cSda MFH_PIN_CFG_INPU(cDdrI2cSda, cPurI2cSda, cCirI2cSda, cOdrI2cSda, cIdrI2cSda, cBitI2cSda)
#define MFH_PIN_CFG_INHZ_I2cSda MFH_PIN_CFG_INHZ(cDdrI2cSda, cPurI2cSda, cCirI2cSda, cOdrI2cSda, cIdrI2cSda, cBitI2cSda)
#define MFH_PIN_CFG_OOUT_I2cSda MFH_PIN_CFG_OOUT(cDdrI2cSda, cPurI2cSda, cCirI2cSda, cOdrI2cSda, cIdrI2cSda, cBitI2cSda)
#define MFH_PIN_CFG_OUTH_I2cSda MFH_PIN_CFG_OUTH(cDdrI2cSda, cPurI2cSda, cCirI2cSda, cOdrI2cSda, cIdrI2cSda, cBitI2cSda)
#define MFH_PIN_CFG_OUTL_I2cSda MFH_PIN_CFG_OUTL(cDdrI2cSda, cPurI2cSda, cCirI2cSda, cOdrI2cSda, cIdrI2cSda, cBitI2cSda)
#define MFH_PIN_OUT_SETH_I2cSda MFH_PIN_OUT_SETH(cDdrI2cSda, cPurI2cSda, cCirI2cSda, cOdrI2cSda, cIdrI2cSda, cBitI2cSda)
#define MFH_PIN_OUT_CLRL_I2cSda MFH_PIN_OUT_CLRL(cDdrI2cSda, cPurI2cSda, cCirI2cSda, cOdrI2cSda, cIdrI2cSda, cBitI2cSda)
#define MFH_PIN_IN_STATE_I2cSda MFH_PIN_IN_STATE(cDdrI2cSda, cPurI2cSda, cCirI2cSda, cOdrI2cSda, cIdrI2cSda, cBitI2cSda)
/*------------------------------------------------------------------------------------------------
MFHI2cInnEventReg( ) --------- 输入I2C总线的事件和状态寄存器值
MFHI2cChkEventReg( ) --------- 检查I2C总线事件状态寄存器中的事件状态值
MFHI2cInnEventMem( ) --------- 输入I2C总线的事件和状态存储器值
MFHI2cChkEventMem( ) --------- 检查I2C总线事件状态存储器中的事件状态值
------------------------------------------------------------------------------------------------*/
#if (defined(_IAR_EW_AVR_))
#define MFHI2cInnEventMem( ) gucvI2cEvent = TWSR
#define MFHI2cChkEventMem( ) (gucvI2cEvent & cI2cTwsrMask)
#elif ((defined(_IAR_EW_MCS51_)) || (defined(_KEIL_UV_MCS51_)))
#elif ( defined(_IAR_EW_STM8_)
|| defined(_COSMIC_STM8_) ) // “......_STM8 编译器”条件编译开始
#ifdef _USE_STM8_FWLIB_ // “使用 STM8 FWLib 的库文件”条件编译开始
#else // “_USE_STM8_FWLIB_”
#define MFHI2cInnEventMem( ) NOTHING
//#define MFHI2cInnEventMem( ) gucvI2cEvent = temp
#define MFHI2cChkEventMem( ) (gucvI2cEvent & cI2cEvtSr2Mask)
#endif // “_USE_STM8_FWLIB_”
#else
#error 错误:
#endif // “PreMcuIs__......”
/*------------------------------------------------------------------------------------------------
MFHI2cBusModSwRst( ) --------- 软件复位I2C模块,释放I2C总线
MFHI2cFlgEventClr( ) --------- 清0I2C总线事件中断标志位
MFHI2cIntEventClr( ) --------- 进入中断后,在中断句柄中,清0I2C总线事件中断标志位(在中断服务程序中)
MFHI2cIntEventChk( ) --------- 检查I2C总线事件中断状态值
MFHI2cIntEventOnn( ) --------- 使能I2C总线事件全部中断
MFHI2cIntEventOne( ) --------- 使能I2C总线事件中断、错误中断,禁止缓冲中断
MFHI2cIntEventOff( ) --------- 禁止I2C总线事件全部中断
MFHI2cBusErrorChk( ) --------- 检查I2C总线在收发过程中存在的全部错误状态值
MFHI2cBusErrorClr( ) --------- 清0I2C总线在收发过程中存在的全部错误标记
MFHI2cBusNackStar( ) --------- 发出 START 信号(起始条件),没有 ACK 脉冲
MFHI2cBusNackReps( ) --------- 发出重复 START 信号(重新开始条件),没有 ACK 脉冲
MFHI2cBusNackStop( ) --------- 发出 STOP 信号(结束条件),没有 ACK 脉冲
MFHI2cBusRdataAck( ) --------- 在接收之后发出 ACK 脉冲
MFHI2cBusRdatNack( ) --------- 在接收之后发出 NOT ACK
------------------------------------------------------------------------------------------------*/
#if (defined(_IAR_EW_AVR_))
#define MFHI2cBusModSwRst( ) NOTHING
#define MFHI2cFlgEventClr( ) NOTHING
#define MFHI2cIntEventClr( ) TWCR = (1<
(1<
(0<
(0<
(0<
#define MFHI2cIntEventChk( ) NOTHING
#define MFHI2cIntEventOnn( ) NOTHING
#define MFHI2cIntEventOne( ) NOTHING
#define MFHI2cIntEventOff( ) NOTHING
#define MFHI2cBusErrorChk( ) NOTHING
#define MFHI2cBusErrorClr( ) NOTHING
#define MFHI2cBusNackStar( ) TWCR = (1<
(1<
(0<
(1<
(0<
#define MFHI2cBusNackReps( ) TWCR = (1<
(1<
(0<
(1<
(0<
#define MFHI2cBusNackStop( ) TWCR = (1<
(0<
(0<
(0<
(0<
#define MFHI2cBusRdataAck( ) TWCR = (1<
(1<
(1<
(0<
(0<
#define MFHI2cBusRdatNack( ) TWCR = (1<
(1<
(0<
(0<
(0<
#elif ((defined(_IAR_EW_MCS51_)) || (defined(_KEIL_UV_MCS51_)))
#elif ( defined(_IAR_EW_STM8_)
|| defined(_COSMIC_STM8_) ) // “......_STM8 编译器”条件编译开始
#ifdef _USE_STM8_FWLIB_ // “使用 STM8 FWLib 的库文件”条件编译开始
#else // “_USE_STM8_FWLIB_”
上一篇:STM8硬件I2C事件锁死
下一篇:stm8s跳出中断程序c语言,STM8 UART接收中断程序
推荐阅读最新更新时间:2024-11-09 08:06
设计资源 培训 开发板 精华推荐
- STEVAL-IDS003V1,自主无线多传感器节点评估套件,由热电发电机供电并基于 SPV1050 (SPIDER)
- DN05063/D、两级并联、能源之星低成本线性 LED 驱动器设计(120 VAC)
- #第七届立创电赛#usb接口电流电压显示
- 使用 Richtek Technology Corporation 的 RT7279 的参考设计
- AM6TW-2418SZ 18V 6 瓦双路输出 DC-DC 转换器的典型应用
- WCH-DAPLink调试器
- 使用 LTC3459 和 LTC1844 的基于 SuperCap 的备用电源
- 0.8寸数码管时钟
- AD9763-EBZ,AD9763 DAC 评估板
- L7808A 分体式电源稳压器的典型应用 (± 15 V - 1 A)