Subversion Repositories FlightCtrl

Rev

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

Rev 1221 Rev 1222
1
 
-
 
2
#ifndef _I2C_MASTER_H
1
#ifndef _I2C_MASTER_H
3
#define _I2C_MASTER_H
2
#define _I2C_MASTER_H
4
 
3
 
5
 
4
 
6
#include <inttypes.h>
5
#include <inttypes.h>
7
 
6
 
-
 
7
#define TWI_STATE_MOTOR_TX                      0
8
#define TWI_STATE_MOTOR_TX                      0
8
#define TWI_STATE_MOTOR_RX                      3
9
#define TWI_STATE_GYRO_OFFSET_TX        7
9
#define TWI_STATE_GYRO_OFFSET_TX        7
10
 
10
 
-
 
11
extern volatile uint8_t twi_state;
-
 
12
extern volatile uint8_t motor_write;
-
 
13
extern volatile uint8_t motor_read;
-
 
14
 
-
 
15
extern uint8_t MissingMotor;
-
 
16
 
-
 
17
#define MAX_MOTORS      12
-
 
18
 
-
 
19
typedef struct
-
 
20
{
-
 
21
        uint8_t SetPoint; // written by attitude controller
-
 
22
        uint8_t Present;  // 0 if BL was found
-
 
23
        uint8_t Error;    // I2C error counter
-
 
24
        uint8_t Current;  // read byck from BL
-
 
25
        uint8_t MaxPWM;   // read back from BL
11
extern volatile uint8_t twi_state;
-
 
12
 
-
 
13
#ifdef USE_QUADRO
-
 
14
extern uint8_t motor_rx[8];
26
} __attribute__((packed)) MotorData_t;
15
#else
-
 
16
extern uint8_t motor_rx[16];
27
 
17
#endif
28
extern MotorData_t Motor[MAX_MOTORS];
18
 
29
 
19
extern volatile uint16_t I2CTimeout;
30
extern volatile uint16_t I2CTimeout;
20
 
31
 
21
extern void I2C_Init (void); // Initialize I2C
32
extern void I2C_Init (void); // Initialize I2C
22
extern void I2C_Start(void); // Start I2C
33
extern void I2C_Start(uint8_t start_state); // Start I2C
23
extern void I2C_Stop (void); // Stop I2C
34
extern void I2C_Stop (uint8_t start_state); // Stop I2C
24
extern void I2C_Reset(void); // Reset I2C
35
extern void I2C_Reset(void); // Reset I2C
25
 
36
 
26
#endif
37
#endif
27
 
38