Subversion Repositories MK3Mag

Rev

Rev 22 | Rev 29 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#ifndef _TWI_SLAVE_H_
#define _TWI_SLAVE_H_

#include <inttypes.h>

#define I2C_SLAVE_ADDRESS               0x50
#define I2C_PROTOCOL_COMP               1

#define I2C_CMD_VERSION                 0x01
#define I2C_CMD_READ_MAG        0x02
#define I2C_CMD_READ_HEADING    0x03
#define I2C_CMD_WRITE_CAL       0x04
#define I2C_CMD_WRITE_EEPROM    0x0A
#define I2C_CMD_READ_EEPROM     0x0B


struct I2C_Version_t
{
        uint8_t Major;
        uint8_t Minor;
        uint8_t Compatible;
} ;

struct I2C_Mag_t
{
        int16_t MagX;
        int16_t MagY;
        int16_t MagZ;
} ;


struct I2C_WriteAttitude_t
{
        int16_t Nick;
        int16_t Roll;
} ;


struct I2C_WriteCal_t
{
        uint8_t CalByte;
        uint8_t Dummy1;
        uint8_t Dummy2;
} ;

struct I2C_Heading_t
{
        int16_t Heading;
} ;


struct I2C_Heading_t            I2C_Heading;
struct I2C_WriteAttitude_t      I2C_WriteAttitude;
struct I2C_Mag_t                        I2C_Mag;
struct I2C_Version_t            I2C_Version;
struct I2C_WriteCal_t           I2C_WriteCal;

void I2C_Init(void);


#endif // _TWI_SLAVE_H_