lpci2c.h

来自「LPC Flash Programming Routines for LPC21」· C头文件 代码 · 共 50 行

H
50
字号
/******************************************************************************
 *
 * $RCSfile: $
 * $Revision: $
 *
 * Header file for Philips LPC ARM Processors.
 * Copyright 2004 R O SoftWare
 *
 * No guarantees, warrantees, or promises, implied or otherwise.
 * May be used for hobby or commercial purposes provided copyright
 * notice remains intact.
 *
 *****************************************************************************/
#ifndef INC_LPC_I2C_H
#define INC_LPC_I2C_H

// I2C Interface Registers
typedef struct
{
  REG_8 conset;                         // Control Set Register
  REG_8 _pad0[3];
  REG_8 stat;                           // Status Register
  REG_8 _pad1[3];
  REG_8 dat;                            // Data Register
  REG_8 _pad2[3];
  REG_8 adr;                            // Slave Address Register
  REG_8 _pad3[3];
  REG16 sclh;                           // SCL Duty Cycle Register (high half word)
  REG16 _pad4;
  REG16 scll;                           // SCL Duty Cycle Register (low half word)
  REG16 _pad5;
  REG_8 conclr;                         // Control Clear Register
  REG_8 _pad6[3];
} i2cRegs_t;

// I2CONSET Register Bit Definitions
#define I2CON_I2EN  (1 << 6)            // I2C Enable
#define I2CON_STA   (1 << 5)            // START flag
#define I2CON_STO   (1 << 4)            // STOP flag
#define I2CON_SI    (1 << 3)            // I2C Interrupt flag
#define I2CON_AA    (1 << 2)            // Assert Acknowlege flag

// I2CONCLR Register Bit Definitions
#define I2CON_I2ENC (1 << 6)            // I2C Enable Clear
#define I2CON_STAC  (1 << 5)            // START Clear
#define I2CON_SIC   (1 << 3)            // I2C Interrupt Clear
#define I2CON_AAC   (1 << 2)            // Assert Acknowlege Clear

#endif

⌨️ 快捷键说明

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