Subversion Repositories FlightCtrl

Rev

Rev 1651 | Rev 1662 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1651 Rev 1657
Line 24... Line 24...
24
 
24
 
25
#define MAX_MOTORS      12
25
#define MAX_MOTORS      12
26
#define MOTOR_STATE_PRESENT_MASK                0x80
26
#define MOTOR_STATE_PRESENT_MASK                0x80
Line 27... Line -...
27
#define MOTOR_STATE_ERROR_MASK                  0x7F
-
 
28
 
27
#define MOTOR_STATE_ERROR_MASK                  0x7F
Line 29... Line 28...
29
 
28
 
30
#define MOTOR_STATE_NEW_PROTOCOL_MASK   0x01
29
#define MOTOR_STATE_NEW_PROTOCOL_MASK   0x01
31
 
30
 
Line 32... Line 31...
32
#define BLFLAG_READ_VERSION     0x01
31
#define BLFLAG_READ_VERSION     0x01
Line 33... Line -...
33
#define BLFLAG_SEND_CONFIG              0x02
-
 
34
#define BLFLAG_TX_COMPLETE              0x04
-
 
35
 
-
 
36
extern volatile unsigned char BLFlags;
-
 
37
 
-
 
38
#define MASK_SET_PWM_SCALING            0x01
-
 
39
#define MASK_SET_CURRENT_LIMIT          0x02
-
 
40
#define MASK_SET_TEMP_LIMIT                     0x04
-
 
41
#define MASK_SET_CURRENT_SCALING        0x08
-
 
42
#define MASK_SET_BITCONFIG                      0x10
-
 
43
#define MASK_RESET_CAPCOUNTER           0x20
-
 
44
#define MASK_SET_DEFAULT_PARAMS         0x40
-
 
45
#define MASK_SET_SAVE_EEPROM            0x80
-
 
46
 
-
 
47
#define BITCONF_REVERSE_ROTATION 0x01
-
 
48
#define BITCONF_RES1 0x02
-
 
49
#define BITCONF_RES2 0x04
-
 
50
#define BITCONF_RES3 0x08
-
 
51
#define BITCONF_RES4 0x10
32
#define BLFLAG_SEND_CONFIG              0x02
52
#define BITCONF_RES5 0x20
33
#define BLFLAG_TX_COMPLETE              0x04
53
#define BITCONF_RES6 0x40
34
 
54
#define BITCONF_RES7 0x80
35
extern volatile unsigned char BLFlags;
55
 
36
 
Line 64... Line 45...
64
    unsigned char Version;
45
    unsigned char Version;
65
} __attribute__((packed)) MotorData_t;
46
} __attribute__((packed)) MotorData_t;
Line 66... Line 47...
66
 
47
 
Line 67... Line -...
67
extern MotorData_t Motor[MAX_MOTORS];
-
 
68
 
-
 
69
typedef struct
-
 
70
{
-
 
71
        unsigned char SetMask;                  // settings mask
-
 
72
        unsigned char PwmScaling;               // maximum value of control pwm, acts like a thrust limit
-
 
73
        unsigned char CurrentLimit;             // current limit in A
-
 
74
        unsigned char TempLimit;                // in °C
-
 
75
        unsigned char CurrentScaling;   // scaling factor for current measurement
-
 
76
        unsigned char BitConfig;                // see defines below
-
 
77
}  __attribute__((packed)) BLConfig_t;
-
 
78
 
-
 
79
extern BLConfig_t BLConfig[MAX_MOTORS];
48
extern MotorData_t Motor[MAX_MOTORS];
80
 
49
 
81
void i2c_reset(void);
50
void i2c_reset(void);
82
extern void i2c_init (void); // I2C initialisieren
51
extern void i2c_init (void); // I2C initialisieren
83
extern void i2c_write_byte (char byte); // 1 Byte schreiben
52
extern void i2c_write_byte (char byte); // 1 Byte schreiben