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

📄 i2c_hr.h

📁 ST7 Mcu I2C program driver code for learning
💻 H
字号:
/******************************************************************************
COPYRIGHT 2001 STMicroelectronics 
Source File Name : I2C_hr.h
Group            : IPSW,CMG - IPDF
Author           : MCD Application Team
Date First Issued: 04/03/2002
********************************Documentation**********************************
General Purpose - This file declares all the hardware registers as extern

********************************Revision History*******************************
_______________________________________________________________________________
Date :04/03/2002                  Release:1.0       	   		        	      
******************************************************************************/
#ifndef I2C_HR_H
#define I2C_HR_H 

#include "ST7lib_config.h"

/*****************************************************************************/
/**************** CLOCK & DATA REGISTERS & BITS DEFINITIONS ******************/
/*****************************************************************************/
#ifdef I2C_72F521                                                              
#ifdef _HIWARE_
volatile unsigned char I2C_PIN_REG1  @0x00;   /* I2C SCL, SDA pins register1 */
volatile unsigned char I2C_PIN_REG2  @0x01;   /* I2C SCL, SDA pins register2 */
volatile unsigned char I2C_PIN_REG3  @0x02;   /* I2C SCL, SDA pins register3 */
#endif 

#ifdef _COSMIC_
@tiny volatile unsigned char I2C_PIN_REG1 @0x00;/*I2C SCL, SDA pins register1*/
@tiny volatile unsigned char I2C_PIN_REG2 @0x01;/*I2C SCL, SDA pins register2*/
@tiny volatile unsigned char I2C_PIN_REG3 @0x02;/*I2C SCL, SDA pins register3*/
#endif 

#define SCL_PIN     0x80                                   /* SCL pin number */
#define SDA_PIN     0x40                                   /* SDA pin number */
#endif 
/*---------------------------------------------------------------------------*/
#ifdef I2C_72F63
#ifdef _HIWARE_                                          
volatile unsigned char I2C_PIN_REG1  @0x00;   /* I2C SCL, SDA pins register1 */
volatile unsigned char I2C_PIN_REG2  @0x01;   /* I2C SCL, SDA pins register2 */
#endif                                                                                                   

#ifdef _COSMIC_
@tiny volatile unsigned char I2C_PIN_REG1 @0x00;/*I2C SCL, SDA pins register1*/
@tiny volatile unsigned char I2C_PIN_REG2 @0x01;/*I2C SCL, SDA pins register2*/
#endif

#define SCL_PIN     0x04                                   /* SCL pin number */
#define SDA_PIN     0x02                                   /* SDA pin number */
#endif 

/*---------------------------------------------------------------------------*/
#ifdef I2C_72F65
#ifdef _HIWARE_                                          
volatile unsigned char I2C_PIN_REG1  @0x0F;   /* I2C SCL, SDA pins register1 */
volatile unsigned char I2C_PIN_REG2  @0x10;   /* I2C SCL, SDA pins register2 */
#endif                                                     

#ifdef _COSMIC_
@tiny volatile unsigned char I2C_PIN_REG1 @0x0F;/*I2C SCL, SDA pins register1*/
@tiny volatile unsigned char I2C_PIN_REG2 @0x10;/*I2C SCL, SDA pins register2*/
#endif

#define SCL_PIN     0x01                                   /* SCL pin number */
#define SDA_PIN     0x02                                   /* SDA pin number */
#endif 
/*---------------------------------------------------------------------------*/
#ifdef I2C_72F264                                        
#ifdef _HIWARE_                                          
volatile unsigned char I2C_PIN_REG1  @0x08;   /* I2C SCL, SDA pins register1 */
volatile unsigned char I2C_PIN_REG2  @0x09;   /* I2C SCL, SDA pins register2 */
volatile unsigned char I2C_PIN_REG3  @0x0A;   /* I2C SCL, SDA pins register3 */
#endif 

#ifdef _COSMIC_
@tiny volatile unsigned char I2C_PIN_REG1 @0x08;/*I2C SCL, SDA pins register1*/
@tiny volatile unsigned char I2C_PIN_REG2 @0x09;/*I2C SCL, SDA pins register2*/
@tiny volatile unsigned char I2C_PIN_REG3 @0x0A;/*I2C SCL, SDA pins register3*/
#endif 

#define SCL_PIN     0x10                                   /* SCL pin number */
#define SDA_PIN     0x40                                   /* SDA pin number */
#endif 
#endif                                                                         

/*****************************************************************************/
/***** H A R D W A R E   R E G I S T E R   B I T   D E F I N I T I O N S *****/
/*****************************************************************************/

#define ACK         0x04                             /* I2C acknowledge flag */
#define START       0x08                                       /* Start flag */
#define STOP        0x02                                        /* Stop flag */
#define PE          0x20                           /* Peripheral enable flag */
#define BTF         0x08                        /* Byte transfer status flag */
#define EVF         0x80                                       /* Event flag */
#define AF          0x10                              /* Acknowledge failure */
#define STATUS      0xBB                                     /* Status flags */
#define SB          0x01                           /* Start bit status flags */
#define ITE         0x01                           /* Interrupt enable flags */  
#define TRA         0x20                           /* Interrupt enable flags */

#ifdef I2C_72F65
#define I2C_ERR     0x10                                      /* Error flags */
#endif 
#if (defined I2C_72F521 || defined I2C_72F63 || defined I2C_72F264)
#define I2C_ERR     0x16                                      /* Error flags */
#define I2C_ALBE    0x16                   /* Arbitration loss and bus error */
#endif                                                           
#if (defined I2C_72F521 || defined I2C_72F264)
#define ADD10         0x40                         /* 10-bit addressing flag */
#endif 

/*** (c) 2001   STMicroelectronics ****************** END OF FILE ************/

⌨️ 快捷键说明

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