Subversion Repositories FlightCtrl

Rev

Rev 464 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 464 Rev 476
1
/*############################################################################
1
/*############################################################################
2
############################################################################*/
2
############################################################################*/
3
 
3
 
4
#ifndef _I2C_MASTER_H
4
#ifndef _I2C_MASTER_H
5
#define _I2C_MASTER_H
5
#define _I2C_MASTER_H
6
 
6
 
7
//############################################################################
7
//############################################################################
8
 
8
 
9
// I2C Konstanten
9
// I2C Konstanten
10
#define SCL_CLOCK  200000L
10
#define SCL_CLOCK  200000L
11
#define I2C_TIMEOUT 30000
11
#define I2C_TIMEOUT 30000
12
#define I2C_START          0x08
12
#define I2C_START          0x08
13
#define I2C_REPEATED_START 0x10
13
#define I2C_REPEATED_START 0x10
14
#define I2C_TX_SLA_ACK     0x18
14
#define I2C_TX_SLA_ACK     0x18
15
#define I2C_TX_DATA_ACK    0x28
15
#define I2C_TX_DATA_ACK    0x28
16
#define I2C_RX_SLA_ACK     0x40
16
#define I2C_RX_SLA_ACK     0x40
17
#define I2C_RX_DATA_ACK    0x50
17
#define I2C_RX_DATA_ACK    0x50
18
 
18
 
19
//############################################################################
19
//############################################################################
20
 
20
 
21
extern unsigned char twi_state;
21
extern volatile unsigned char twi_state;
22
extern unsigned char motor;
-
 
23
extern unsigned char motorread;
22
extern volatile unsigned char motor;
24
extern unsigned char motor_rx[8];
23
extern volatile unsigned char motor_rx[8];
25
 
24
 
26
 
25
 
27
void i2c_init (void); // I2C initialisieren
26
void i2c_init (void); // I2C initialisieren
28
void i2c_start (void); // Start I2C
27
void i2c_start (void); // Start I2C
29
void i2c_stop (void); // Stop I2C
28
void i2c_stop (void); // Stop I2C
30
void i2c_write_byte (char byte); // 1 Byte schreiben
29
void i2c_write_byte (char byte); // 1 Byte schreiben
-
 
30
void i2c_receive_byte(void); // 1 Byte empfangen
-
 
31
void i2c_receive_last_byte(void); // letztes Byte empfangen
31
 
32
 
32
#endif
33
#endif
33
 
34