Subversion Repositories FlightCtrl

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 ingob 1
 
2
#ifndef _I2C_MASTER_H
3
#define _I2C_MASTER_H
687 killagreg 4
 
1 ingob 5
 
687 killagreg 6
#include <inttypes.h>
7
 
1 ingob 8
//############################################################################
9
 
10
// I2C Konstanten
11
#define SCL_CLOCK  200000L
12
#define I2C_TIMEOUT 30000
13
#define I2C_START          0x08
14
#define I2C_REPEATED_START 0x10
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
 
20
//############################################################################
21
 
694 killagreg 22
extern volatile uint8_t twi_state;
23
extern volatile uint8_t motor;
24
extern volatile uint8_t motorread;
25
extern volatile uint8_t motor_rx[8];
1 ingob 26
 
726 killagreg 27
extern void I2C_Init (void);  // Initialize I2C
28
extern void I2C_Start (void); // Start I2C
29
extern void I2C_Stop (void); // Stop I2C
30
extern void I2C_WriteByte (int8_t byte); // Write 1 Byte
31
extern void I2C_Reset(void); // Reset I2C
1 ingob 32
 
33
#endif