Subversion Repositories MK3Mag

Rev

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