Subversion Repositories MK3Mag

Rev

Rev 29 | Details | Compare with Previous | Last modification | View Log | RSS feed

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