Subversion Repositories MK3Mag

Rev

Rev 22 | Rev 29 | Go to most recent revision | 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
 
23 killagreg 17
struct I2C_Version_t
3 ingob 18
{
19 killagreg 19
        uint8_t Major;
20
        uint8_t Minor;
21
        uint8_t Compatible;
23 killagreg 22
} ;
3 ingob 23
 
23 killagreg 24
struct I2C_Mag_t
3 ingob 25
{
19 killagreg 26
        int16_t MagX;
27
        int16_t MagY;
28
        int16_t MagZ;
23 killagreg 29
} ;
7 hbuss 30
 
19 killagreg 31
 
23 killagreg 32
struct I2C_WriteAttitude_t
3 ingob 33
{
19 killagreg 34
        int16_t Nick;
35
        int16_t Roll;
23 killagreg 36
} ;
3 ingob 37
 
38
 
23 killagreg 39
struct I2C_WriteCal_t
19 killagreg 40
{
23 killagreg 41
        uint8_t CalByte;
42
        uint8_t Dummy1;
43
        uint8_t Dummy2;
44
} ;
3 ingob 45
 
23 killagreg 46
struct I2C_Heading_t
19 killagreg 47
{
23 killagreg 48
        int16_t Heading;
49
} ;
3 ingob 50
 
51
 
23 killagreg 52
struct I2C_Heading_t            I2C_Heading;
53
struct I2C_WriteAttitude_t      I2C_WriteAttitude;
54
struct I2C_Mag_t                        I2C_Mag;
55
struct I2C_Version_t            I2C_Version;
56
struct I2C_WriteCal_t           I2C_WriteCal;
1 ingob 57
 
19 killagreg 58
void I2C_Init(void);
1 ingob 59
 
60
 
19 killagreg 61
#endif // _TWI_SLAVE_H_
1 ingob 62