RT-AICHIP-sample
i2c.h
[詳解]
1 /*****************************************************************************
2  * i2c.h: Header file for NXP LPC13xx Family Microprocessors
3  *
4  * Copyright(C) 2006, NXP Semiconductor
5  * All rights reserved.
6  *
7  * History
8  * 2006.07.19 ver 1.00 Preliminary version, first Release
9  *
10 ******************************************************************************/
11 #ifndef __I2C_H
12 #define __I2C_H
13 
14 #define FAST_MODE_PLUS 0
15 
16 #define BUFSIZE 0x80
17 #define MAX_TIMEOUT 0x00FFFFFF
18 
19 #define I2CMASTER 0x01
20 #define I2CSLAVE 0x02
21 
22 #define MPU6050_W 0xd0
23 #define MPU6050_R 0xd1
24 #define AK8975_W 0x18
25 #define AK8975_R 0x19
26 #define PCF8594_ADDR 0xA0
27 
28 #define READ_WRITE 0x01
29 
30 #define RD_BIT 0x01
31 
32 #define I2C_IDLE 0
33 #define I2C_STARTED 1
34 #define I2C_RESTARTED 2
35 #define I2C_REPEATED_START 3
36 #define DATA_ACK 4
37 #define DATA_NACK 5
38 
39 #define I2CONSET_I2EN 0x00000040 /* I2C Control Set Register */
40 #define I2CONSET_AA 0x00000004
41 #define I2CONSET_SI 0x00000008
42 #define I2CONSET_STO 0x00000010
43 #define I2CONSET_STA 0x00000020
44 
45 #define I2CONCLR_AAC 0x00000004 /* I2C Control clear Register */
46 #define I2CONCLR_SIC 0x00000008
47 #define I2CONCLR_STAC 0x00000020
48 #define I2CONCLR_I2ENC 0x00000040
49 
50 #define I2DAT_I2C 0x00000000 /* I2C Data Reg */
51 #define I2ADR_I2C 0x00000000 /* I2C Slave Address Reg */
52 #define I2SCLH_SCLH 0x00000180 /* I2C SCL Duty Cycle High Reg */
53 #define I2SCLL_SCLL 0x00000180 /* I2C SCL Duty Cycle Low Reg */
54 #define I2SCLH_HS_SCLH 0x00000020 /* Fast Plus I2C SCL Duty Cycle High Reg */
55 #define I2SCLL_HS_SCLL 0x00000020 /* Fast Plus I2C SCL Duty Cycle Low Reg */
56 
57 
58 extern void I2C_IRQHandler( void );
59 extern uint32_t I2CInit( uint32_t I2cMode );
60 extern uint32_t I2CStart( void );
61 extern uint32_t I2CStop( void );
62 extern uint32_t I2CEngine( void );
63 
64 #endif /* end __I2C_H */
65 /****************************************************************************
66 ** End Of File
67 *****************************************************************************/
uint32_t I2CEngine(void)
Definition: i2c.c:282
void I2C_IRQHandler(void)
Definition: i2c.c:48
uint32_t I2CStart(void)
Definition: i2c.c:165
uint32_t I2CInit(uint32_t I2cMode)
Definition: i2c.c:221
uint32_t I2CStop(void)
Definition: i2c.c:201
unsigned int uint32_t
Definition: type.h:29