⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 di2cs.h

📁 I2c驱动
💻 H
字号:
/****************************************************************************/
/* Copyright (c) 1999-2007  Digital Core Design  DCD                        */
/****************************************************************************/
/* Please review the terms of the license agreement before using this file. */
/* If you are not an authorized user, please destroy this source code file  */
/* and notify DCD immediately that you inadvertently received an            */
/* unauthorized copy.                                                       */
/****************************************************************************/
/*                                                                          */
/*--------------------------------------------------------------------------*/
/* Project name         : DI2CS                                             */
/* Project description  : DI2CS - I2C BUS INTERFACE-SLAVE                   */
/*                                                                          */
/* File name            : di2cs.h                                           */
/* File contents        : DI2CS C compiler interface functions              */
/*                        headers.                                          */
/*--------------------------------------------------------------------------*/
/* Design Engineer      : T.K.                                              */
/* Version              : 1.38                                              */
/* Last modification    : 2007-01-24                                        */
/*--------------------------------------------------------------------------*/
/****************************************************************************/

/* DI2CS registers location                                                 */
sfr DI2CS_OA  = 0xF1;    /* Slave Own Address register      */
sfr DI2CS_CR  = 0xF2;    /* Control register                */
sfr DI2CS_SR  = 0xF2;    /* Status register                 */
sfr DI2CS_BUF = 0xF3;    /* Buffer register                 */


/* DI2CS pseudo-functions                                                  */
#define reset_di2cs()     (DI2CS_CR|=0x80) /* Reset DI2CS                */
#define enable_di2cs()    (DI2CS_CR|=0x01) /* Enable DI2CS module        */
#define disable_di2cs()   (DI2CS_CR&=0xFE) /* Disable DI2CS module       */
#define readbuf_di2cs()   (DI2CS_BUF)      /* Read data buffer           */
#define writebuf_di2cs(a) (DI2CS_BUF=a)    /* Write data buffer          */
#define ownaddr_di2cs(sa) (DI2CS_OA=sa)    /* Set Own addr.              */

/* DI2CS registers direct access                                             */
#define write_di2cs(a, addr) (addr=a)
#define read_di2cs(addr)     (addr)


/* DI2CS STATUS CODES                                                       */
#define SR_SENDFIN                   0x04
#define SR_TREQ                      0x02
#define SR_RREQ                      0x01

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -