Subversion Repositories FlightCtrl

Rev

Rev 726 | Blame | Compare with Previous | Last modification | View Log | RSS feed


#ifndef _I2C_MASTER_H
#define _I2C_MASTER_H


#include <inttypes.h>

//############################################################################

// I2C Konstanten
#define SCL_CLOCK  200000L
#define I2C_TIMEOUT 30000
#define I2C_START          0x08
#define I2C_REPEATED_START 0x10
#define I2C_TX_SLA_ACK     0x18
#define I2C_TX_DATA_ACK    0x28
#define I2C_RX_SLA_ACK     0x40
#define I2C_RX_DATA_ACK    0x50

//############################################################################

extern volatile uint8_t twi_state;
extern volatile uint8_t motor;
extern volatile uint8_t motorread;
extern volatile uint8_t motor_rx[12];

extern void I2C_Init (void);  // Initialize I2C
extern void I2C_Start (void); // Start I2C
extern void I2C_Stop (void); // Stop I2C
extern void I2C_WriteByte (int8_t byte); // Write 1 Byte
extern void I2C_Reset(void); // Reset I2C

#endif