////////////////////////////////////////////////////////////////////////////////
/// @file reg_i2c.h
/// @author AE TEAM
/// @brief THIS FILE CONTAINS ALL THE FUNCTIONS PROTOTYPES FOR THE SERIES OF
/// MM32 FIRMWARE LIBRARY.
////////////////////////////////////////////////////////////////////////////////
/// @attention
///
/// THE EXISTING FIRMWARE IS ONLY FOR REFERENCE, WHICH IS DESIGNED TO PROVIDE
/// CUSTOMERS WITH CODING INFORMATION ABOUT THEIR PRODUCTS SO THEY CAN SAVE
/// TIME. THEREFORE, MINDMOTION SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT OR
/// CONSEQUENTIAL DAMAGES ABOUT ANY CLAIMS ARISING OUT OF THE CONTENT OF SUCH
/// HARDWARE AND/OR THE USE OF THE CODING INFORMATION CONTAINED HEREIN IN
/// CONNECTION WITH PRODUCTS MADE BY CUSTOMERS.
///
///
© COPYRIGHT MINDMOTION
////////////////////////////////////////////////////////////////////////////////
// Define to prevent recursive inclusion
#ifndef __REG_I2C_H
#define __REG_I2C_H
// Files includes
#include
#include
#include "types.h"
#if defined ( __CC_ARM )
#pragma anon_unions
#endif
////////////////////////////////////////////////////////////////////////////////
/// @brief I2C Base Address Definition
////////////////////////////////////////////////////////////////////////////////
#define I2C1_BASE (APB1PERIPH_BASE + 0x5400) ///< Base Address: 0x40005400
#define I2C2_BASE (APB1PERIPH_BASE + 0x5800) ///< Base Address: 0x40005800
////////////////////////////////////////////////////////////////////////////////
/// @brief I2C Register Structure Definition
////////////////////////////////////////////////////////////////////////////////
#undef USENCOMBINEREGISTER
#undef USENNEWREGISTER
#undef USENOLDREGISTER
#define USENCOMBINEREGISTER
#ifdef USENCOMBINEREGISTER
typedef struct {
union {
__IO u32 CR; ///< Control Register offset: 0x00
__IO u32 IC_CON;
};
union {
__IO u32 TAR; ///< Target Address Register offset: 0x04
__IO u32 IC_TAR;
};
union {
__IO u32 SAR; ///< Slave Address Register offset: 0x08
__IO u32 IC_SAR;
};
__IO u32 IC_HS_MADDR_RESERVED; ///< Reserved Register offset: 0x0C
union {
__IO u32 DR; ///< Data Command Register offset: 0x10
__IO u32 IC_DATA_CMD;
};
union {
__IO u32 SSHR; ///< SCL High Period Count for Std. Speed Register offset: 0x14
__IO u32 IC_SS_SCL_HCNT;
};
union {
__IO u32 SSLR; ///< SCL Low Period Count for Std. Speed Register offset: 0x18
__IO u32 IC_SS_SCL_LCNT;
};
union {
__IO u32 FSHR; ///< SCL High Period Count for Fast Speed Register offset: 0x1C
__IO u32 IC_FS_SCL_HCNT;
};
union {
__IO u32 FSLR; ///< SCL Low Period Count for Fast Speed Register offset: 0x20
__IO u32 IC_FS_SCL_LCNT;
};
__IO u32 IC_HS_SCL_HCNT_RESERVED; ///< Reserved Register offset: 0x24
__IO u32 IC_HS_SCL_LCNT_RESERVED; ///< Reserved Register offset: 0x28
union {
__IO u32 ISR; ///< Interrupt Status Register offset: 0x2C
__IO u32 IC_INTR_STAT;
};
union {
__IO u32 IMR; ///< Interrupt Mask Register offset: 0x30
__IO u32 IC_INTR_MASK;
};
union {
__IO u32 RAWISR; ///< RAW Interrupt Status Register offset: 0x34
__IO u32 IC_RAW_INTR_STAT;
};
union {
__IO u32 RXTLR; ///< Receive FIFO Threshold Level Register offset: 0x38
__IO u32 IC_RX_TL;
};
union {
__IO u32 TXTLR; ///< Transmit FIFO Threshold Level Register offset: 0x3C
__IO u32 IC_TX_TL;
};
union {
__IO u32 ICR; ///< Clear All Interrupt Register offset: 0x40
__IO u32 IC_CLR_INTR;
};
union {
__IO u32 RX_UNDER; ///< Clear RX_UNDER Interrupt Register offset: 0x44
__IO u32 IC_CLR_RX_UNDER;
};
union {
__IO u32 RX_OVER; ///< Clear RX_OVER Interrupt Register offset: 0x48
__IO u32 IC_CLR_RX_OVER;
};
union {
__IO u32 TX_OVER; ///< Clear TX_OVER Interrupt Register offset: 0x4C
__IO u32 IC_CLR_TX_OVER;
};
union {
__IO u32 RD_REQ; ///< Clear RD_REQ Interrupt Register offset: 0x50
__IO u32 IC_CLR_RD_REQ;
};
union {
__IO u32 TX_ABRT; ///< Clear TX_ABRT Interrupt Register offset: 0x54
__IO u32 IC_CLR_TX_ABRT;
};
union {
__IO u32 RX_DONE; ///< Clear RX_DONE Interrupt Register offset: 0x58
__IO u32 IC_CLR_RX_DONE;
};
union {
__IO u32 ACTIV; ///< Clear ACTIVITY Interrupt Register offset: 0x5C
__IO u32 IC_CLR_ACTIVITY;
};
union {
__IO u32 STOP; ///< Clear STOP_DET Interrupt Register offset: 0x60
__IO u32 IC_CLR_STOP_DET;
};
union {
__IO u32 START; ///< Clear START_DET Interrupt Register offset: 0x64
__IO u32 IC_CLR_START_DET;
};
union {
__IO u32 GC; ///< Clear GEN_CALL Interrupt Register offset: 0x68
__IO u32 IC_CLR_GEN_CALL;
};
union {
__IO u32 ENR; ///< Enable Register offset: 0x6C
__IO u32 IC_ENABLE;
};
union {
__IO u32 SR; ///< Status Register offset: 0x70
__IO u32 IC_STATUS;
};
union {
__IO u32 TXFLR; ///< Transmit FIFO Level Register offset: 0x74
__IO u32 IC_TXFLR;
};
union {
__IO u32 RXFLR; ///< Receive FIFO Level Register offset: 0x78
__IO u32 IC_RXFLR;
};
union {
__IO u32 HOLD; ///< SDA Hold Time Register offset: 0x7C
__IO u32 IC_SDA_HOLD;
};
__IO u32 RESERVED28; ///IC_TX_ABRT_SOURCE_RESERVED;
__IO u32 RESERVED29; ///IC_SLV_DATA_NACK_ONLY_RESERVED;
union {
__IO u32 DMA; ///< DMA Control Register offset: 0x88
__IO u32 IC_DMA_CR;
};
__IO u32 RESERVED30; ///IC_DMA_TDLR_RESERVED;
__IO u32 RESERVED31; ///IC_DMA_RDLR_RESERVED;
union {
__IO u32 SETUP; ///< SDA Setup Time Register offset: 0x94
__IO u32 IC_SDA_SETUP;
};
union {
__IO u32 GCR; ///< ACK General Call Register offset: 0x98
__IO u32 IC_ACK_GENERAL_CALL;
};
__IO u32 RESERVED32a; ///_RESERVED; offset: 0x9C
__IO u32 RESERVED33; ///_RESERVED; offset: 0xA0
__IO u32 RESERVED34; ///_RESERVED; offset: 0xA4
__IO u32 RESERVED35; ///_RESERVED; offset: 0xA8
__IO u32 RESERVED36; ///_RESERVED; offset: 0xAC
__IO u32 SLVMASK; ///