Subversion Repositories FlightCtrl

Rev

Rev 935 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 935 Rev 936
1
 
1
 
2
#ifndef _I2C_MASTER_H
2
#ifndef _I2C_MASTER_H
3
#define _I2C_MASTER_H
3
#define _I2C_MASTER_H
4
 
4
 
5
 
5
 
6
#include <inttypes.h>
-
 
7
 
-
 
8
//############################################################################
-
 
9
 
-
 
10
// I2C Konstanten
-
 
11
#define SCL_CLOCK  200000L
-
 
12
#define I2C_TIMEOUT 30000
6
#include <inttypes.h>
13
#define I2C_START          0x08
-
 
14
#define I2C_REPEATED_START 0x10
7
 
15
#define I2C_TX_SLA_ACK     0x18
-
 
16
#define I2C_TX_DATA_ACK    0x28
-
 
17
#define I2C_RX_SLA_ACK     0x40
-
 
18
#define I2C_RX_DATA_ACK    0x50
-
 
19
 
8
#define TWI_STATE_MOTOR_TX                      0
20
//############################################################################
-
 
21
 
-
 
22
extern volatile uint8_t twi_state;
9
#define TWI_STATE_GYRO_OFFSET_TX        7
-
 
10
 
23
extern volatile uint8_t motor;
11
extern volatile uint8_t twi_state;
24
extern volatile uint8_t motorread;
12
extern volatile uint8_t motor_rx[8];
25
extern volatile uint8_t motor_rx[8];
13
extern volatile uint16_t I2CTimeout;
26
 
-
 
27
extern void I2C_Init (void);  // Initialize I2C
14
 
28
extern void I2C_Start (void); // Start I2C
15
extern void I2C_Init (void); // Initialize I2C
29
extern void I2C_Stop (void); // Stop I2C
16
extern void I2C_Start(void); // Start I2C
30
extern void I2C_WriteByte (int8_t byte); // Write 1 Byte
17
extern void I2C_Stop (void); // Stop I2C
31
extern void I2C_Reset(void); // Reset I2C
18
extern void I2C_Reset(void); // Reset I2C
32
 
19
 
33
#endif
20
#endif
34
 
21