Subversion Repositories FlightCtrl

Rev

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

/*****************************************************************************************************************************
* File:                 twimaster.h
* Purpose:              header of twimaster.c
*****************************************************************************************************************************/


#ifndef _I2C_MASTER_H
 #define _I2C_MASTER_H


// ------------------------ definions for I2C ---
#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 unsigned char twi_state;
extern unsigned char motor,MissingMotor;
extern unsigned char motorread;
extern unsigned char motor_rx[];
extern unsigned char MotorPresent[];
extern unsigned char MotorError[];

extern void i2c_init(void);                                     // initialize I2C
extern void i2c_start(void);                                    // start I2C
extern void i2c_stop(void);                                     // stop I2C
extern void i2c_write_byte(char byte);                  // write 1 Byte
extern void i2c_reset(void);                                    // reset

#endif
// *** EOF: I2C_MASTER_H ******************************************************************************************************