Rev 29 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 29 | Rev 30 | ||
---|---|---|---|
1 | #ifndef _TWI_SLAVE_H_ |
1 | #ifndef _TWI_SLAVE_H_ |
2 | #define _TWI_SLAVE_H_ |
2 | #define _TWI_SLAVE_H_ |
3 | 3 | ||
4 | #include <inttypes.h> |
4 | #include <inttypes.h> |
5 | 5 | ||
6 | #define I2C_SLAVE_ADDRESS 0x50 |
6 | #define I2C_SLAVE_ADDRESS 0x50 |
7 | #define I2C_PROTOCOL_COMP 1 |
7 | #define I2C_PROTOCOL_COMP 1 |
8 | 8 | ||
9 | #define I2C_CMD_VERSION 0x01 |
9 | #define I2C_CMD_VERSION 0x01 |
10 | #define I2C_CMD_READ_MAG 0x02 |
10 | #define I2C_CMD_READ_MAG 0x02 |
11 | #define I2C_CMD_READ_HEADING 0x03 |
11 | #define I2C_CMD_READ_HEADING 0x03 |
12 | #define I2C_CMD_WRITE_CAL 0x04 |
12 | #define I2C_CMD_WRITE_CAL 0x04 |
13 | #define I2C_CMD_WRITE_EEPROM 0x0A |
13 | #define I2C_CMD_WRITE_EEPROM 0x0A |
14 | #define I2C_CMD_READ_EEPROM 0x0B |
14 | #define I2C_CMD_READ_EEPROM 0x0B |
15 | 15 | ||
16 | 16 | ||
17 | struct I2C_Version_t |
17 | typedef struct |
18 | { |
18 | { |
19 | uint8_t Major; |
19 | uint8_t Major; |
20 | uint8_t Minor; |
20 | uint8_t Minor; |
21 | uint8_t Compatible; |
21 | uint8_t Compatible; |
22 | } ; |
22 | } I2C_Version_t; |
23 | 23 | ||
24 | struct I2C_Mag_t |
24 | typedef struct |
25 | { |
25 | { |
26 | int16_t MagX; |
26 | int16_t MagX; |
27 | int16_t MagY; |
27 | int16_t MagY; |
28 | int16_t MagZ; |
28 | int16_t MagZ; |
29 | } ; |
29 | } I2C_Mag_t; |
30 | 30 | ||
31 | 31 | ||
32 | struct I2C_WriteAttitude_t |
32 | typedef struct |
33 | { |
33 | { |
34 | int16_t Nick; |
34 | int16_t Nick; |
35 | int16_t Roll; |
35 | int16_t Roll; |
36 | } ; |
36 | } I2C_WriteAttitude_t; |
37 | 37 | ||
38 | 38 | ||
39 | struct I2C_WriteCal_t |
39 | typedef struct |
40 | { |
40 | { |
41 | uint8_t CalByte; |
41 | uint8_t CalByte; |
42 | uint8_t Dummy1; |
42 | uint8_t Dummy1; |
43 | uint8_t Dummy2; |
43 | uint8_t Dummy2; |
44 | } ; |
44 | } I2C_WriteCal_t; |
45 | 45 | ||
46 | struct I2C_Heading_t |
46 | typedef struct |
47 | { |
47 | { |
48 | int16_t Heading; |
48 | int16_t Heading; |
49 | } ; |
49 | } I2C_Heading_t; |
50 | 50 | ||
51 | extern uint8_t NC_Connected; |
51 | extern uint8_t NC_Connected; |
52 | extern struct I2C_Heading_t I2C_Heading; |
52 | extern I2C_Heading_t I2C_Heading; |
53 | extern struct I2C_WriteAttitude_t I2C_WriteAttitude; |
53 | extern I2C_WriteAttitude_t I2C_WriteAttitude; |
54 | extern struct I2C_Mag_t I2C_Mag; |
54 | extern I2C_Mag_t I2C_Mag; |
55 | extern struct I2C_Version_t I2C_Version; |
55 | extern I2C_Version_t I2C_Version; |
56 | extern struct I2C_WriteCal_t I2C_WriteCal; |
56 | extern I2C_WriteCal_t I2C_WriteCal; |
57 | 57 | ||
58 | 58 | ||
59 | void I2C_Init(void); |
59 | void I2C_Init(void); |
60 | 60 | ||
61 | 61 | ||
62 | #endif // _TWI_SLAVE_H_ |
62 | #endif // _TWI_SLAVE_H_ |
63 | 63 | ||
64 | 64 |