Subversion Repositories FlightCtrl

Rev

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
 
304 ingob 27
void i2c_reset(void);
395 hbuss 28
extern void i2c_init (void); // I2C initialisieren
694 killagreg 29
extern void i2c_start (void); // Start I2C
395 hbuss 30
extern void i2c_stop (void); // Stop I2C
694 killagreg 31
extern void i2c_write_byte (int8_t byte); // 1 Byte schreiben
395 hbuss 32
extern void i2c_reset(void);
1 ingob 33
 
34
#endif